[Feature]add MT2731_MP2_MR2_SVN388 baseline version
Change-Id: Ief04314834b31e27effab435d3ca8ba33b499059
diff --git a/src/bsp/lk/platform/lpc15xx/debug.c b/src/bsp/lk/platform/lpc15xx/debug.c
new file mode 100644
index 0000000..cbf9a48
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/debug.c
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <stdarg.h>
+#include <reg.h>
+#include <debug.h>
+#include <stdio.h>
+#include <compiler.h>
+#include <lib/cbuf.h>
+#include <kernel/thread.h>
+#include <platform/debug.h>
+#include <arch/ops.h>
+#include <arch/arm/cm.h>
+#include <target/debugconfig.h>
+
+#include <platform/lpc.h>
+
+static cbuf_t debug_rx_buf;
+
+/* this code is only set up to handle UART0 as the debug uart */
+STATIC_ASSERT(DEBUG_UART == LPC_USART0);
+
+void lpc_debug_early_init(void)
+{
+ /* Use main clock rate as base for UART baud rate divider */
+ Chip_Clock_SetUARTBaseClockRate(Chip_Clock_GetMainClockRate(), false);
+
+ /* Setup UART */
+ Chip_UART_Init(DEBUG_UART);
+ Chip_UART_ConfigData(DEBUG_UART, UART_CFG_DATALEN_8 | UART_CFG_PARITY_NONE | UART_CFG_STOPLEN_1);
+ Chip_UART_SetBaud(DEBUG_UART, 115200);
+ Chip_UART_Enable(DEBUG_UART);
+ Chip_UART_TXEnable(DEBUG_UART);
+}
+
+void lpc_debug_init(void)
+{
+ cbuf_initialize(&debug_rx_buf, 16);
+
+ /* enable uart interrupts */
+ Chip_UART_IntEnable(DEBUG_UART, UART_INTEN_RXRDY);
+
+ NVIC_EnableIRQ(UART0_IRQn);
+}
+
+void lpc_UART0_irq(void)
+{
+ arm_cm_irq_entry();
+
+ /* read the rx buffer until it's empty */
+ while ((Chip_UART_GetStatus(DEBUG_UART) & UART_STAT_RXRDY) != 0) {
+ uint8_t c = Chip_UART_ReadByte(DEBUG_UART);
+ cbuf_write_char(&debug_rx_buf, c, false);
+ }
+
+ arm_cm_irq_exit(true);
+}
+
+void platform_dputc(char c)
+{
+ if (c == '\n') {
+ platform_dputc('\r');
+ }
+
+ Chip_UART_SendBlocking(DEBUG_UART, &c, 1);
+}
+
+int platform_dgetc(char *c, bool wait)
+{
+#if 1
+ return cbuf_read_char(&debug_rx_buf, c, wait);
+#else
+ uint8_t data;
+
+ if (Chip_UART_Read(DEBUG_UART, &data, 1) == 1) {
+ *c = data;
+ return 1;
+ }
+ return -1;
+#endif
+}
+
diff --git a/src/bsp/lk/platform/lpc15xx/include/platform/gpio.h b/src/bsp/lk/platform/lpc15xx/include/platform/gpio.h
new file mode 100644
index 0000000..8ee0295
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/include/platform/gpio.h
@@ -0,0 +1,36 @@
+#pragma once
+
+#if 0
+/* helper defines for Stellaris platforms */
+
+/* flag to gpio_configure */
+#define GPIO_STELLARIS_OD (0x1 << 12)
+#define GPIO_STELLARIS_AF_ENABLE (0x2 << 12)
+
+#define GPIO_STELLARIS_AF(x) (((x) & 0xf) << 8)
+
+/* gpio port/pin is packed into a single unsigned int in 20x:4alternatefunc:4port:4pin format */
+#define GPIO(port, pin) ((unsigned int)(((port) << 4) | (pin)))
+
+#define GPIO_PORT(gpio) (((gpio) >> 4) & 0xf)
+#define GPIO_PIN(gpio) ((gpio) & 0xf)
+
+#define GPIO_PORT_A 0
+#define GPIO_PORT_B 1
+#define GPIO_PORT_C 2
+#define GPIO_PORT_D 3
+#define GPIO_PORT_E 4
+#define GPIO_PORT_F 5
+#define GPIO_PORT_G 6
+#define GPIO_PORT_H 7
+/* discontinuity */
+#define GPIO_PORT_J 8
+#define GPIO_PORT_K 9
+#define GPIO_PORT_L 10
+#define GPIO_PORT_M 11
+#define GPIO_PORT_N 12
+/* discontinuity */
+#define GPIO_PORT_P 13
+#define GPIO_PORT_Q 14
+#endif
+
diff --git a/src/bsp/lk/platform/lpc15xx/include/platform/lpc.h b/src/bsp/lk/platform/lpc15xx/include/platform/lpc.h
new file mode 100644
index 0000000..7f053e1
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/include/platform/lpc.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#define CORE_M3 1
+
+/* from lpcopen */
+#include "chip.h"
diff --git a/src/bsp/lk/platform/lpc15xx/include/platform/platform_cm.h b/src/bsp/lk/platform/lpc15xx/include/platform/platform_cm.h
new file mode 100644
index 0000000..bad6e12
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/include/platform/platform_cm.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+/* include cmsis.h in platform/lpc space */
+#include <cmsis.h>
+
diff --git a/src/bsp/lk/platform/lpc15xx/init.c b/src/bsp/lk/platform/lpc15xx/init.c
new file mode 100644
index 0000000..31f212b
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/init.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <err.h>
+#include <stdio.h>
+#include <debug.h>
+#include <platform.h>
+#include <platform/lpc.h>
+#include <arch/arm/cm.h>
+
+void lpc_debug_early_init(void);
+void lpc_debug_init(void);
+
+void lpc_gpio_early_init(void);
+void lpc_gpio_init(void);
+
+void lpc_usbc_early_init(void);
+void lpc_usbc_init(void);
+
+void platform_early_init(void)
+{
+ /* set up clocking for a board with an external oscillator */
+ Chip_SetupXtalClocking();
+
+ /* Set USB PLL input to main oscillator */
+ Chip_Clock_SetUSBPLLSource(SYSCTL_PLLCLKSRC_MAINOSC);
+ /* Setup USB PLL (FCLKIN = 12MHz) * 4 = 48MHz
+ MSEL = 3 (this is pre-decremented), PSEL = 1 (for P = 2)
+ FCLKOUT = FCLKIN * (MSEL + 1) = 12MHz * 4 = 48MHz
+ FCCO = FCLKOUT * 2 * P = 48MHz * 2 * 2 = 192MHz (within FCCO range) */
+ Chip_Clock_SetupUSBPLL(3, 1);
+
+ /* Powerup USB PLL */
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_USBPLL_PD);
+
+ /* Wait for PLL to lock */
+ while (!Chip_Clock_IsUSBPLLLocked()) {}
+
+ /* Set default system tick divder to 1 */
+ Chip_Clock_SetSysTickClockDiv(1);
+
+ /* start the generic systick driver */
+ arm_cm_systick_init(Chip_Clock_GetMainClockRate());
+
+ lpc_debug_early_init();
+}
+
+void platform_init(void)
+{
+ lpc_debug_init();
+}
+
+// vim: set ts=4 sw=4 expandtab:
diff --git a/src/bsp/lk/platform/lpc15xx/lpccheck.py b/src/bsp/lk/platform/lpc15xx/lpccheck.py
new file mode 100755
index 0000000..495515d
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpccheck.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+import sys, os, struct
+
+if len(sys.argv) < 2:
+ print "not enough args, usage:"
+ print "%s <binfile>" % sys.argv[0]
+ sys.exit(1)
+
+f = open(sys.argv[1], "r+b")
+
+a = struct.unpack('iiiiiii', f.read(7*4))
+
+s = 0
+for i in a:
+ s += i
+s = -s
+
+f.seek(7*4)
+f.write(struct.pack('i', s))
+
+f.close()
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/VERSION.txt b/src/bsp/lk/platform/lpc15xx/lpcopen/VERSION.txt
new file mode 100644
index 0000000..90b6d72
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/VERSION.txt
@@ -0,0 +1 @@
+From lpcopen_2_08_lpcxpresso_nxp_lpcxpresso_1549.zip
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_board_nxp_lpcxpresso_1549/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_board_nxp_lpcxpresso_1549/.cproject
new file mode 100644
index 0000000..5172136
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_board_nxp_lpcxpresso_1549/.cproject
@@ -0,0 +1,206 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.lib.debug.494097339">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.lib.debug.494097339" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings>
+ <externalSetting>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/lpc_board_nxp_lpcxpresso_1549"/>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/lpc_board_nxp_lpcxpresso_1549/Debug"/>
+ <entry flags="RESOLVED" kind="libraryFile" name="lpc_board_nxp_lpcxpresso_1549" srcPrefixMapping="" srcRootPath=""/>
+ </externalSetting>
+ </externalSettings>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="a" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.lib.debug.494097339" name="Debug" parent="com.crt.advproject.config.lib.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "lib${BuildArtifactFileName}" ; # arm-none-eabi-objdump -h -S "lib${BuildArtifactFileName}" >"${BuildArtifactFileBaseName}.lss"">
+ <folderInfo id="com.crt.advproject.config.lib.debug.494097339." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.lib.debug.177100394" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.lib.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.lib.debug.1200005358" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.lib.debug"/>
+ <builder buildPath="${workspace_loc:/lpc_board_nxp_lpcxpresso_1549}/Debug" id="com.crt.advproject.builder.lib.debug.989509346" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.lib.debug"/>
+ <tool id="com.crt.advproject.cpp.lib.debug.1045426437" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.lib.debug"/>
+ <tool id="com.crt.advproject.gcc.lib.debug.1643916012" name="MCU C Compiler" superClass="com.crt.advproject.gcc.lib.debug">
+ <option id="com.crt.advproject.gcc.arch.122234127" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.613601153" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.946805139" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1326094832" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.2121104043" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.704445161" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1852967589" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.lib.debug.193926635" name="MCU Assembler" superClass="com.crt.advproject.gas.lib.debug">
+ <option id="com.crt.advproject.gas.arch.726337626" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.502707714" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.2094776797" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1363445490" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1473343009" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.422553299" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.ar.lib.debug.571373137" name="MCU Archiver" superClass="com.crt.advproject.ar.lib.debug"/>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.lib.release.500032776">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.lib.release.500032776" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings>
+ <externalSetting>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/lpc_board_nxp_lpcxpresso_1549"/>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/lpc_board_nxp_lpcxpresso_1549/Release"/>
+ <entry flags="RESOLVED" kind="libraryFile" name="lpc_board_nxp_lpcxpresso_1549" srcPrefixMapping="" srcRootPath=""/>
+ </externalSetting>
+ </externalSettings>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="a" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.lib.release.500032776" name="Release" parent="com.crt.advproject.config.lib.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "lib${BuildArtifactFileName}" ; # arm-none-eabi-objdump -h -S "lib${BuildArtifactFileName}" >"${BuildArtifactFileBaseName}.lss"">
+ <folderInfo id="com.crt.advproject.config.lib.release.500032776." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.lib.release.1836709360" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.lib.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.lib.release.1077921300" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.lib.release"/>
+ <builder buildPath="${workspace_loc:/lpc_board_nxp_lpcxpresso_1549}/Release" id="com.crt.advproject.builder.lib.release.1201628753" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.lib.release"/>
+ <tool id="com.crt.advproject.cpp.lib.release.643195821" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.lib.release"/>
+ <tool id="com.crt.advproject.gcc.lib.release.2115106169" name="MCU C Compiler" superClass="com.crt.advproject.gcc.lib.release">
+ <option id="com.crt.advproject.gcc.arch.300704216" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1204053864" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.149847811" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.204730381" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.lib.release.option.optimization.level.2074525465" superClass="com.crt.advproject.gcc.lib.release.option.optimization.level" value="gnu.c.optimization.level.size" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1008728004" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.209250897" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1867365054" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.lib.release.1940830393" name="MCU Assembler" superClass="com.crt.advproject.gas.lib.release">
+ <option id="com.crt.advproject.gas.arch.1240101157" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.200285036" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1073254670" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1232240206" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1273748608" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.747508666" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.ar.lib.release.1244904681" name="MCU Archiver" superClass="com.crt.advproject.ar.lib.release"/>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="lpc_board_nxp_lpcxpresso_1549.com.crt.advproject.projecttype.lib.1981124745" name="Static Library" projectType="com.crt.advproject.projecttype.lib"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_board_nxp_lpcxpresso_1549/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_board_nxp_lpcxpresso_1549/.project
new file mode 100644
index 0000000..d4f0d44
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_board_nxp_lpcxpresso_1549/.project
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>lpc_board_nxp_lpcxpresso_1549</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_board_nxp_lpcxpresso_1549/inc/board.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_board_nxp_lpcxpresso_1549/inc/board.h
new file mode 100644
index 0000000..c7cd7a7
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_board_nxp_lpcxpresso_1549/inc/board.h
@@ -0,0 +1,111 @@
+/*
+ * @brief LPCXPresso LPC1549 board file
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __BOARD_H_
+#define __BOARD_H_
+
+#include "chip.h"
+/* board_api.h is included at the bottom of this file after DEBUG setup */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup BOARD_NXP_LPCXPRESSO_1549 LPCXPresso LPC1549 board support software API functions
+ * @ingroup LPCOPEN_15XX_NXP_LPCXPRESSO_1549
+ * The board support software API functions provide some simple abstracted
+ * functions used across multiple LPCOpen board examples. See @ref BOARD_COMMON_API
+ * for the functions defined by this board support layer.<br>
+ * @{
+ */
+
+/** @defgroup BOARD_NXP_LPCXPRESSO_1549_OPTIONS BOARD: LPCXPresso LPC1549 board build options
+ * This board has options that configure its operation at build-time.<br>
+ * @{
+ */
+
+/** Define DEBUG_ENABLE to enable IO via the DEBUGSTR, DEBUGOUT, and
+ DEBUGIN macros. If not defined, DEBUG* functions will be optimized
+ out of the code at build time.
+ */
+#define DEBUG_ENABLE
+
+/** Define DEBUG_SEMIHOSTING along with DEBUG_ENABLE to enable IO support
+ via semihosting. You may need to use a C library that supports
+ semihosting with this option.
+ */
+// #define DEBUG_SEMIHOSTING
+
+/** Board UART used for debug output and input using the DEBUG* macros. This
+ is also the port used for Board_UARTPutChar, Board_UARTGetChar, and
+ Board_UARTPutSTR functions.
+ */
+#define DEBUG_UART LPC_USART0
+
+/**
+ * @}
+ */
+
+/* Board name */
+#define BOARD_NXP_LPCXPRESSO_1549
+
+/**
+ * Joystick defines
+ */
+#define JOY_UP 0x01
+#define JOY_DOWN 0x02
+#define JOY_LEFT 0x04
+#define JOY_RIGHT 0x08
+#define JOY_PRESS 0x10
+
+/**
+ * @brief Initialize Joystick
+ * @return Nothing
+ */
+void Board_Joystick_Init(void);
+
+/**
+ * @brief Get Joystick status
+ * @return status of Joystick
+ */
+uint8_t Joystick_GetStatus(void);
+
+/**
+ * @}
+ */
+
+#include "board_api.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __BOARD_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_board_nxp_lpcxpresso_1549/inc/board_api.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_board_nxp_lpcxpresso_1549/inc/board_api.h
new file mode 100644
index 0000000..5875574
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_board_nxp_lpcxpresso_1549/inc/board_api.h
@@ -0,0 +1,187 @@
+/*
+ * @brief Common board API functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __BOARD_API_H_
+#define __BOARD_API_H_
+
+#include "lpc_types.h"
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup BOARD_COMMON_API BOARD: Common board functions
+ * @ingroup BOARD_Common
+ * This file contains common board definitions that are shared across
+ * boards and devices. All of these functions do not need to be
+ * implemented for a specific board, but if they are implemented, they
+ * should use this API standard.
+ * @{
+ */
+
+/**
+ * @brief Setup and initialize hardware prior to call to main()
+ * @return None
+ * @note Board_SystemInit() is called prior to the application and sets up system
+ * clocking, memory, and any resources needed prior to the application
+ * starting.
+ */
+void Board_SystemInit(void);
+
+/**
+ * @brief Setup pin multiplexer per board schematics
+ * @return None
+ * @note Board_SetupMuxing() should be called from SystemInit() prior to application
+ * main() is called. So that the PINs are set in proper state.
+ */
+void Board_SetupMuxing(void);
+
+/**
+ * @brief Setup system clocking
+ * @return None
+ * @note This sets up board clocking.
+ */
+void Board_SetupClocking(void);
+
+/**
+ * @brief Setup external system memory
+ * @return None
+ * @note This function is typically called after pin mux setup and clock setup and
+ * sets up any external memory needed by the system (DRAM, SRAM, etc.). Not all
+ * boards need this function.
+ */
+void Board_SetupExtMemory(void);
+
+/**
+ * @brief Set up and initialize all required blocks and functions related to the board hardware.
+ * @return None
+ */
+void Board_Init(void);
+
+/**
+ * @brief Initializes board UART for output, required for printf redirection
+ * @return None
+ */
+void Board_Debug_Init(void);
+
+/**
+ * @brief Sends a single character on the UART, required for printf redirection
+ * @param ch : character to send
+ * @return None
+ */
+void Board_UARTPutChar(char ch);
+
+/**
+ * @brief Get a single character from the UART, required for scanf input
+ * @return EOF if not character was received, or character value
+ */
+int Board_UARTGetChar(void);
+
+/**
+ * @brief Prints a string to the UART
+ * @param str : Terminated string to output
+ * @return None
+ */
+void Board_UARTPutSTR(char *str);
+
+/**
+ * @brief Sets the state of a board LED to on or off
+ * @param LEDNumber : LED number to set state for
+ * @param State : true for on, false for off
+ * @return None
+ */
+void Board_LED_Set(uint8_t LEDNumber, bool State);
+
+/**
+ * @brief Returns the current state of a board LED
+ * @param LEDNumber : LED number to set state for
+ * @return true if the LED is on, otherwise false
+ */
+bool Board_LED_Test(uint8_t LEDNumber);
+
+/**
+ * @brief Toggles the current state of a board LED
+ * @param LEDNumber : LED number to change state for
+ * @return None
+ */
+void Board_LED_Toggle(uint8_t LEDNumber);
+
+/**
+ * @brief Turn on Board LCD Backlight
+ * @param Intensity : Backlight intensity (0 = off, >=1 = on)
+ * @return None
+ * @note On boards where a GPIO is used to control backlight on/off state, a '0' or '1'
+ * value will turn off or on the backlight. On some boards, a non-0 value will
+ * control backlight intensity via a PWN. For PWM systems, the intensity value
+ * is a percentage value between 0 and 100%.
+ */
+void Board_SetLCDBacklight(uint8_t Intensity);
+
+/**
+ * @brief Function prototype for a MS delay function. Board layers or example code may
+ * define this function as needed.
+ */
+typedef void (*p_msDelay_func_t)(uint32_t);
+
+/* The DEBUG* functions are selected based on system configuration.
+ Code that uses the DEBUG* functions will have their I/O routed to
+ the UART, semihosting, or nowhere. */
+#if defined(DEBUG_ENABLE)
+#if defined(DEBUG_SEMIHOSTING)
+#define DEBUGINIT()
+#define DEBUGOUT(...) printf(__VA_ARGS__)
+#define DEBUGSTR(str) printf(str)
+#define DEBUGIN() (int) EOF
+
+#else
+#define DEBUGINIT() Board_Debug_Init()
+#define DEBUGOUT(...) printf(__VA_ARGS__)
+#define DEBUGSTR(str) Board_UARTPutSTR(str)
+#define DEBUGIN() Board_UARTGetChar()
+#endif /* defined(DEBUG_SEMIHOSTING) */
+
+#else
+#define DEBUGINIT()
+#define DEBUGOUT(...)
+#define DEBUGSTR(str)
+#define DEBUGIN() (int) EOF
+#endif /* defined(DEBUG_ENABLE) */
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __BOARD_API_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_board_nxp_lpcxpresso_1549/src/board.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_board_nxp_lpcxpresso_1549/src/board.c
new file mode 100644
index 0000000..1779758
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_board_nxp_lpcxpresso_1549/src/board.c
@@ -0,0 +1,198 @@
+/*
+ * @brief LPCXPresso LPC1549 board file
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include "retarget.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/* System oscillator rate and RTC oscillator rate */
+const uint32_t OscRateIn = 12000000;
+const uint32_t RTCOscRateIn = 32768;
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Sends a character on the UART */
+void Board_UARTPutChar(char ch)
+{
+#if defined(DEBUG_UART)
+ Chip_UART_SendBlocking(DEBUG_UART, &ch, 1);
+#endif
+}
+
+/* Gets a character from the UART, returns EOF if no character is ready */
+int Board_UARTGetChar(void)
+{
+#if defined(DEBUG_UART)
+ uint8_t data;
+
+ if (Chip_UART_Read(DEBUG_UART, &data, 1) == 1) {
+ return (int) data;
+ }
+#endif
+ return EOF;
+}
+
+/* Outputs a string on the debug UART */
+void Board_UARTPutSTR(char *str)
+{
+#if defined(DEBUG_UART)
+ while (*str != '\0') {
+ Board_UARTPutChar(*str++);
+ }
+#endif
+}
+
+/* Initialize debug output via UART for board */
+void Board_Debug_Init(void)
+{
+#if defined(DEBUG_UART)
+ /* Disables pullups/pulldowns and enable digitial mode */
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 13, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 18, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+
+ /* UART signal muxing via SWM */
+ Chip_SWM_MovablePortPinAssign(SWM_UART0_RXD_I, 0, 13);
+ Chip_SWM_MovablePortPinAssign(SWM_UART0_TXD_O, 0, 18);
+
+ /* Use main clock rate as base for UART baud rate divider */
+ Chip_Clock_SetUARTBaseClockRate(Chip_Clock_GetMainClockRate(), false);
+
+ /* Setup UART */
+ Chip_UART_Init(DEBUG_UART);
+ Chip_UART_ConfigData(DEBUG_UART, UART_CFG_DATALEN_8 | UART_CFG_PARITY_NONE | UART_CFG_STOPLEN_1);
+ Chip_UART_SetBaud(DEBUG_UART, 115200);
+ Chip_UART_Enable(DEBUG_UART);
+ Chip_UART_TXEnable(DEBUG_UART);
+#endif
+}
+
+#define MAXLEDS 3
+static const uint8_t ledpins[MAXLEDS] = {25, 3, 1};
+static const uint8_t ledports[MAXLEDS] = {0, 0, 1};
+
+/* Initializes board LED(s) */
+static void Board_LED_Init(void)
+{
+ int idx;
+
+ for (idx = 0; idx < MAXLEDS; idx++) {
+ /* Set the GPIO as output with initial state off (high) */
+ Chip_GPIO_SetPinDIROutput(LPC_GPIO, ledports[idx], ledpins[idx]);
+ Chip_GPIO_SetPinState(LPC_GPIO, ledports[idx], ledpins[idx], true);
+ }
+}
+
+/* Sets the state of a board LED to on or off */
+void Board_LED_Set(uint8_t LEDNumber, bool On)
+{
+ if (LEDNumber < MAXLEDS) {
+ /* Toggle state, low is on, high is off */
+ Chip_GPIO_SetPinState(LPC_GPIO, ledports[LEDNumber], ledpins[LEDNumber], !On);
+ }
+}
+
+/* Returns the current state of a board LED */
+bool Board_LED_Test(uint8_t LEDNumber)
+{
+ bool state = false;
+
+ if (LEDNumber < MAXLEDS) {
+ state = !Chip_GPIO_GetPinState(LPC_GPIO, ledports[LEDNumber], ledpins[LEDNumber]);
+ }
+
+ return state;
+}
+
+/* Toggles the current state of a board LED */
+void Board_LED_Toggle(uint8_t LEDNumber)
+{
+ Chip_GPIO_SetPinToggle(LPC_GPIO, ledports[LEDNumber], ledpins[LEDNumber]);
+}
+
+/* Set up and initialize all required blocks and functions related to the
+ board hardware */
+void Board_Init(void)
+{
+ /* Sets up DEBUG UART */
+ DEBUGINIT();
+
+ /* Initialize GPIO */
+ Chip_GPIO_Init(LPC_GPIO);
+
+ /* Initialize LEDs */
+ Board_LED_Init();
+}
+
+/* Ordered up, down, left, right, press */
+#define NUM_BUTTONS 5
+static const uint8_t portButton[NUM_BUTTONS] = {1, 1, 1, 1, 1};
+static const uint8_t pinButton[NUM_BUTTONS] = {4, 6, 8, 7, 5};
+static const uint8_t stateButton[NUM_BUTTONS] = {JOY_UP, JOY_DOWN, JOY_LEFT,
+ JOY_RIGHT, JOY_PRESS};
+
+/* Initialize Joystick */
+void Board_Joystick_Init(void)
+{
+ int i;
+
+ /* IOCON states already selected in SystemInit(), GPIO setup only. Pullups
+ are external, so IOCON with no states */
+ for (i = 0; i < NUM_BUTTONS; i++) {
+ Chip_GPIO_SetPinDIRInput(LPC_GPIO, portButton[i], pinButton[i]);
+ }
+}
+
+/* Get Joystick status */
+uint8_t Joystick_GetStatus(void)
+{
+ uint8_t i, ret = 0;
+
+ for (i = 0; i < NUM_BUTTONS; i++) {
+ if ((Chip_GPIO_GetPinState(LPC_GPIO, portButton[i], pinButton[i])) == 0x00) {
+ ret |= stateButton[i];
+ }
+ }
+
+ return ret;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_board_nxp_lpcxpresso_1549/src/board_sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_board_nxp_lpcxpresso_1549/src/board_sysinit.c
new file mode 100644
index 0000000..869f393
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_board_nxp_lpcxpresso_1549/src/board_sysinit.c
@@ -0,0 +1,183 @@
+/*
+ * @brief LPCXPresso LPC1549 Sysinit file
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+ #include "string.h"
+
+/* The System initialization code is called prior to the application and
+ initializes the board for run-time operation. Board initialization
+ includes clock setup and default pin muxing configuration. */
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* IOCON setup table, only items that need changing from their default pin
+ state are in this table. */
+STATIC const PINMUX_GRP_T ioconSetup[] = {
+ /* LEDs */
+ {0, 25, (IOCON_MODE_INACT | IOCON_DIGMODE_EN)}, /* PIO0_25-BREAK_CTRL-RED (low enable) */
+ {0, 3, (IOCON_MODE_INACT | IOCON_DIGMODE_EN)}, /* PIO0_3-SCT1_OUT4-GRN */
+ {1, 1, (IOCON_MODE_INACT | IOCON_DIGMODE_EN)}, /* PIO1_1-BREAK_STS1-BLUE */
+
+ /* QEI, motor controler, I2C, CAN */
+ {0, 2, (IOCON_MODE_INACT | IOCON_DIGMODE_EN)}, /* PIO0_2-QEI-SCT0_IN */
+ {0, 30, (IOCON_MODE_INACT | IOCON_DIGMODE_EN)}, /* PIO0_30-QEI-SCT0_IN */
+ {0, 17, (IOCON_MODE_INACT | IOCON_DIGMODE_EN)}, /* PIO0_17-QEI-SCT0_IN */
+ {0, 25, (IOCON_MODE_INACT | IOCON_DIGMODE_EN)}, /* PIO0_25-BREAK_CTRL-RED */
+ {1, 1, (IOCON_MODE_INACT | IOCON_DIGMODE_EN)}, /* PIO1_1-BREAK_STS1-BLUE */
+ {0, 23, (IOCON_MODE_INACT | IOCON_DIGMODE_EN)}, /* PIO0_23-I2C_SDA */
+ {0, 22, (IOCON_MODE_INACT | IOCON_DIGMODE_EN)}, /* PIO0_22-I2C_SCL */
+ {0, 11, (IOCON_MODE_INACT | IOCON_DIGMODE_EN)}, /* PIO0_11-CAN_RD */
+ {0, 31, (IOCON_MODE_INACT | IOCON_DIGMODE_EN)}, /* PIO0_31-CAN_TD */
+
+ /* ADC */
+ {1, 3, (IOCON_MODE_INACT)}, /* PIO1_3-ADC1_5 */
+ {0, 4, (IOCON_MODE_INACT)}, /* PIO0_4-ADC0_4 */
+ {0, 5, (IOCON_MODE_INACT)}, /* PIO0_5-ADC0_3 */
+ {0, 7, (IOCON_MODE_INACT)}, /* PIO0_7-ADC0_1 */
+ {0, 8, (IOCON_MODE_INACT)}, /* PIO0_8-ADC0_0 */
+ {0, 9, (IOCON_MODE_INACT)}, /* PIO0_9-ADC1_1 */
+ {0, 10, (IOCON_MODE_INACT)}, /* PIO0_10-ADC1_2 */
+
+ /* Joystick */
+ {1, 4, (IOCON_MODE_INACT | IOCON_DIGMODE_EN)}, /* PIO1_4-JOY_U */
+ {1, 5, (IOCON_MODE_INACT | IOCON_DIGMODE_EN)}, /* PIO1_5-JOY_C */
+ {1, 6, (IOCON_MODE_INACT | IOCON_DIGMODE_EN)}, /* PIO1_6-JOY_D */
+ {1, 7, (IOCON_MODE_INACT | IOCON_DIGMODE_EN)}, /* PIO1_7-JOY_R */
+ {1, 8, (IOCON_MODE_INACT | IOCON_DIGMODE_EN)}, /* PIO1_8-JOY_L */
+
+ /* UART */
+ {0, 13, (IOCON_MODE_INACT | IOCON_DIGMODE_EN)}, /* PIO0_13-ISP_RX */
+ {0, 18, (IOCON_MODE_INACT | IOCON_DIGMODE_EN)}, /* PIO0_18-ISP_TX */
+ {0, 11, (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},
+ {0, 31, (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},
+
+ /* USB related */
+ {1, 11, (IOCON_MODE_PULLDOWN | IOCON_DIGMODE_EN)}, /* PIO1_11-ISP_1 (VBUS) */
+};
+
+/* SWIM pin assignment definitions for pin assignment/muxing */
+typedef struct {
+ uint16_t assignedpin : 9; /* Function and mode */
+ uint16_t port : 2; /* Pin port */
+ uint16_t pin : 5; /* Pin number */
+} SWM_GRP_T;
+
+/* Pin muxing table, only items that need changing from their default pin
+ state are in this table. */
+STATIC const SWM_GRP_T swmSetup[] = {
+ /* USB related */
+ {(uint16_t) SWM_USB_VBUS_I, 1, 11}, /* PIO1_11-ISP_1-AIN_CTRL */
+
+ /* UART */
+ {(uint16_t) SWM_UART0_RXD_I, 0, 13}, /* PIO0_13-ISP_RX */
+ {(uint16_t) SWM_UART0_TXD_O, 0, 18}, /* PIO0_18-ISP_TX */
+};
+
+/* Setup fixed pin functions (GPIOs are fixed) */
+/* No fixed pins except GPIOs */
+#define PINENABLE0_VAL 0xFFFFFFFF
+
+/* No fixed pins except GPIOs */
+#define PINENABLE1_VAL 0x00FFFFFF
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Sets up system pin muxing */
+void Board_SetupMuxing(void)
+{
+ int i;
+
+ /* Enable SWM and IOCON clocks */
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON);
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
+ Chip_SYSCTL_PeriphReset(RESET_IOCON);
+
+ /* IOCON setup */
+ Chip_IOCON_SetPinMuxing(LPC_IOCON, ioconSetup, sizeof(ioconSetup) / sizeof(PINMUX_GRP_T));
+
+ /* SWM assignable pin setup */
+ for (i = 0; i < (sizeof(swmSetup) / sizeof(SWM_GRP_T)); i++) {
+ Chip_SWM_MovablePortPinAssign((CHIP_SWM_PIN_MOVABLE_T) swmSetup[i].assignedpin,
+ swmSetup[i].port, swmSetup[i].pin);
+ }
+
+ /* SWM fixed pin setup */
+ // LPC_SWM->PINENABLE[0] = PINENABLE0_VAL;
+ // LPC_SWM->PINENABLE[1] = PINENABLE1_VAL;
+
+ /* Note SWM and IOCON clocks are left on */
+}
+
+/* Set up and initialize clocking prior to call to main */
+void Board_SetupClocking(void)
+{
+ Chip_SetupXtalClocking();
+
+ /* Set USB PLL input to main oscillator */
+ Chip_Clock_SetUSBPLLSource(SYSCTL_PLLCLKSRC_MAINOSC);
+ /* Setup USB PLL (FCLKIN = 12MHz) * 4 = 48MHz
+ MSEL = 3 (this is pre-decremented), PSEL = 1 (for P = 2)
+ FCLKOUT = FCLKIN * (MSEL + 1) = 12MHz * 4 = 48MHz
+ FCCO = FCLKOUT * 2 * P = 48MHz * 2 * 2 = 192MHz (within FCCO range) */
+ Chip_Clock_SetupUSBPLL(3, 1);
+
+ /* Powerup USB PLL */
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_USBPLL_PD);
+
+ /* Wait for PLL to lock */
+ while (!Chip_Clock_IsUSBPLLLocked()) {}
+
+ /* Set default system tick divder to 1 */
+ Chip_Clock_SetSysTickClockDiv(1);
+}
+
+/* Set up and initialize hardware prior to call to main */
+void Board_SystemInit(void)
+{
+ /* Setup system clocking and muxing */
+ Board_SetupMuxing();
+ Board_SetupClocking();
+
+ /* Set SYSTICKDIV to 1 so CMSIS Systick functions work */
+ LPC_SYSCTL->SYSTICKCLKDIV = 1;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_board_nxp_lpcxpresso_1549/src/retarget.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_board_nxp_lpcxpresso_1549/src/retarget.h
new file mode 100644
index 0000000..0fd5957
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_board_nxp_lpcxpresso_1549/src/retarget.h
@@ -0,0 +1,251 @@
+/*
+ * @brief IO redirection support
+ *
+ * This file adds re-direction support to the library for various
+ * projects. It can be configured in one of 3 ways - no redirection,
+ * redirection via a UART, or redirection via semihosting. If DEBUG
+ * is not defined, all printf statements will do nothing with the
+ * output being throw away. If DEBUG is defined, then the choice of
+ * output is selected by the DEBUG_SEMIHOSTING define. If the
+ * DEBUG_SEMIHOSTING is not defined, then output is redirected via
+ * the UART. If DEBUG_SEMIHOSTING is defined, then output will be
+ * attempted to be redirected via semihosting. If the UART method
+ * is used, then the Board_UARTPutChar and Board_UARTGetChar
+ * functions must be defined to be used by this driver and the UART
+ * must already be initialized to the correct settings.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2012
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/* Keil (Realview) support */
+#if defined(__CC_ARM)
+
+#include <stdio.h>
+#include <rt_misc.h>
+
+#if defined(DEBUG_ENABLE)
+#if defined(DEBUG_SEMIHOSTING)
+#define ITM_Port8(n) (*((volatile unsigned char *) (0xE0000000 + 4 * n)))
+#define ITM_Port16(n) (*((volatile unsigned short *) (0xE0000000 + 4 * n)))
+#define ITM_Port32(n) (*((volatile unsigned long *) (0xE0000000 + 4 * n)))
+
+#define DEMCR (*((volatile unsigned long *) (0xE000EDFC)))
+#define TRCENA 0x01000000
+
+/* Write to SWO */
+void _ttywrch(int ch)
+{
+ if (DEMCR & TRCENA) {
+ while (ITM_Port32(0) == 0) {}
+ ITM_Port8(0) = ch;
+ }
+}
+
+#else
+static INLINE void BoardOutChar(char ch)
+{
+ Board_UARTPutChar(ch);
+}
+
+#endif /* defined(DEBUG_SEMIHOSTING) */
+#endif /* defined(DEBUG_ENABLE) */
+
+struct __FILE {
+ int handle;
+};
+
+FILE __stdout;
+FILE __stdin;
+FILE __stderr;
+
+void *_sys_open(const char *name, int openmode)
+{
+ return 0;
+}
+
+int fputc(int c, FILE *f)
+{
+#if defined(DEBUG_ENABLE)
+#if defined(DEBUG_SEMIHOSTING)
+ _ttywrch(c);
+#else
+ BoardOutChar((char) c);
+#endif
+#endif
+ return 0;
+}
+
+int fgetc(FILE *f)
+{
+#if defined(DEBUG_ENABLE) && !defined(DEBUG_SEMIHOSTING)
+ return Board_UARTGetChar();
+#else
+ return 0;
+#endif
+}
+
+int ferror(FILE *f)
+{
+ return EOF;
+}
+
+void _sys_exit(int return_code)
+{
+label:
+ __WFI();
+ goto label; /* endless loop */
+}
+
+#endif /* defined (__CC_ARM) */
+
+/* IAR support */
+#if defined(__ICCARM__)
+/*******************
+ *
+ * Copyright 1998-2003 IAR Systems. All rights reserved.
+ *
+ * $Revision: 30870 $
+ *
+ * This is a template implementation of the "__write" function used by
+ * the standard library. Replace it with a system-specific
+ * implementation.
+ *
+ * The "__write" function should output "size" number of bytes from
+ * "buffer" in some application-specific way. It should return the
+ * number of characters written, or _LLIO_ERROR on failure.
+ *
+ * If "buffer" is zero then __write should perform flushing of
+ * internal buffers, if any. In this case "handle" can be -1 to
+ * indicate that all handles should be flushed.
+ *
+ * The template implementation below assumes that the application
+ * provides the function "MyLowLevelPutchar". It should return the
+ * character written, or -1 on failure.
+ *
+ ********************/
+
+#include <yfuns.h>
+
+#if defined(DEBUG_ENABLE) && !defined(DEBUG_SEMIHOSTING)
+
+_STD_BEGIN
+
+#pragma module_name = "?__write"
+
+/*
+ If the __write implementation uses internal buffering, uncomment
+ the following line to ensure that we are called with "buffer" as 0
+ (i.e. flush) when the application terminates. */
+size_t __write(int handle, const unsigned char *buffer, size_t size)
+{
+#if defined(DEBUG_ENABLE)
+ size_t nChars = 0;
+
+ if (buffer == 0) {
+ /*
+ This means that we should flush internal buffers. Since we
+ don't we just return. (Remember, "handle" == -1 means that all
+ handles should be flushed.)
+ */
+ return 0;
+ }
+
+ /* This template only writes to "standard out" and "standard err",
+ for all other file handles it returns failure. */
+ if (( handle != _LLIO_STDOUT) && ( handle != _LLIO_STDERR) ) {
+ return _LLIO_ERROR;
+ }
+
+ for ( /* Empty */; size != 0; --size) {
+ Board_UARTPutChar(*buffer++);
+ ++nChars;
+ }
+
+ return nChars;
+#else
+ return size;
+#endif /* defined(DEBUG_ENABLE) */
+}
+
+_STD_END
+#endif
+
+#endif /* defined (__ICCARM__) */
+
+#if defined( __GNUC__ )
+/* Include stdio.h to pull in __REDLIB_INTERFACE_VERSION__ */
+#include <stdio.h>
+
+#if (__REDLIB_INTERFACE_VERSION__ >= 20000)
+/* We are using new Redlib_v2 semihosting interface */
+ #define WRITEFUNC __sys_write
+ #define READFUNC __sys_readc
+#else
+/* We are using original Redlib semihosting interface */
+ #define WRITEFUNC __write
+ #define READFUNC __readc
+#endif
+
+#if defined(DEBUG_ENABLE)
+#if defined(DEBUG_SEMIHOSTING)
+/* Do nothing, semihosting is enabled by default in LPCXpresso */
+#endif /* defined(DEBUG_SEMIHOSTING) */
+#endif /* defined(DEBUG_ENABLE) */
+
+#if !defined(DEBUG_SEMIHOSTING)
+int WRITEFUNC(int iFileHandle, char *pcBuffer, int iLength)
+{
+#if defined(DEBUG_ENABLE)
+ unsigned int i;
+ for (i = 0; i < iLength; i++) {
+ Board_UARTPutChar(pcBuffer[i]);
+ }
+#endif
+
+ return iLength;
+}
+
+/* Called by bottom level of scanf routine within RedLib C library to read
+ a character. With the default semihosting stub, this would read the character
+ from the debugger console window (which acts as stdin). But this version reads
+ the character from the LPC1768/RDB1768 UART. */
+int READFUNC(void)
+{
+#if defined(DEBUG_ENABLE)
+ char c = Board_UARTGetChar();
+ return (int) c;
+
+#else
+ return (int) -1;
+#endif
+}
+
+#endif /* !defined(DEBUG_SEMIHOSTING) */
+#endif /* defined ( __GNUC__ ) */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/.cproject
new file mode 100644
index 0000000..0dd0444
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/.cproject
@@ -0,0 +1,204 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.lib.debug.1107065132">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.lib.debug.1107065132" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings>
+ <externalSetting>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/lpc_chip_15xx"/>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/lpc_chip_15xx/Debug"/>
+ <entry flags="RESOLVED" kind="libraryFile" name="lpc_chip_15xx" srcPrefixMapping="" srcRootPath=""/>
+ </externalSetting>
+ </externalSettings>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="a" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.lib.debug.1107065132" name="Debug" parent="com.crt.advproject.config.lib.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "lib${BuildArtifactFileName}" ; # arm-none-eabi-objdump -h -S "lib${BuildArtifactFileName}" >"${BuildArtifactFileBaseName}.lss"">
+ <folderInfo id="com.crt.advproject.config.lib.debug.1107065132." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.lib.debug.1477496540" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.lib.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.lib.debug.1211368874" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.lib.debug"/>
+ <builder buildPath="${workspace_loc:/lpc_chip_15xx}/Debug" id="com.crt.advproject.builder.lib.debug.1760738714" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.lib.debug"/>
+ <tool id="com.crt.advproject.cpp.lib.debug.984753503" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.lib.debug"/>
+ <tool id="com.crt.advproject.gcc.lib.debug.1143674000" name="MCU C Compiler" superClass="com.crt.advproject.gcc.lib.debug">
+ <option id="com.crt.advproject.gcc.arch.2016537426" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1554936705" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1556661352" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.625539214" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="gnu.c.compiler.option.include.paths.1613525827" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/>
+ </option>
+ <option id="com.crt.advproject.gcc.hdrlib.2131947623" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="com.crt.advproject.compiler.input.1763008077" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.lib.debug.166040530" name="MCU Assembler" superClass="com.crt.advproject.gas.lib.debug">
+ <option id="com.crt.advproject.gas.arch.465070513" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1366354539" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.735758227" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1298129609" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.986432448" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.2129415000" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.ar.lib.debug.1778297695" name="MCU Archiver" superClass="com.crt.advproject.ar.lib.debug"/>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.lib.release.256837497">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.lib.release.256837497" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings>
+ <externalSetting>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/lpc_chip_15xx"/>
+ <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/lpc_chip_15xx/Release"/>
+ <entry flags="RESOLVED" kind="libraryFile" name="lpc_chip_15xx" srcPrefixMapping="" srcRootPath=""/>
+ </externalSetting>
+ </externalSettings>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="a" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.lib.release.256837497" name="Release" parent="com.crt.advproject.config.lib.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "lib${BuildArtifactFileName}" ; # arm-none-eabi-objdump -h -S "lib${BuildArtifactFileName}" >"${BuildArtifactFileBaseName}.lss"">
+ <folderInfo id="com.crt.advproject.config.lib.release.256837497." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.lib.release.559329999" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.lib.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.lib.release.788873773" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.lib.release"/>
+ <builder buildPath="${workspace_loc:/lpc_chip_15xx}/Release" id="com.crt.advproject.builder.lib.release.2099251087" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.lib.release"/>
+ <tool id="com.crt.advproject.cpp.lib.release.1268364779" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.lib.release"/>
+ <tool id="com.crt.advproject.gcc.lib.release.135424516" name="MCU C Compiler" superClass="com.crt.advproject.gcc.lib.release">
+ <option id="com.crt.advproject.gcc.arch.1718211886" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1215653768" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1823449696" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.2050560840" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="gnu.c.compiler.option.include.paths.2001738408" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/>
+ </option>
+ <option id="com.crt.advproject.gcc.lib.release.option.optimization.level.1019974252" superClass="com.crt.advproject.gcc.lib.release.option.optimization.level" value="gnu.c.optimization.level.size" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1942506114" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="com.crt.advproject.compiler.input.1804142121" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.lib.release.234454369" name="MCU Assembler" superClass="com.crt.advproject.gas.lib.release">
+ <option id="com.crt.advproject.gas.arch.1076699427" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.510370556" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.80438984" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1458107179" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1202049573" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1818975755" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.ar.lib.release.633703982" name="MCU Archiver" superClass="com.crt.advproject.ar.lib.release"/>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="lpc_chip_15xx.com.crt.advproject.projecttype.lib.1100405836" name="Static Library" projectType="com.crt.advproject.projecttype.lib"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/.project
new file mode 100644
index 0000000..dec5b46
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/.project
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>lpc_chip_15xx</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/acmp_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/acmp_15xx.h
new file mode 100644
index 0000000..9f47794
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/acmp_15xx.h
@@ -0,0 +1,490 @@
+/*
+ * @brief LPC15xx Analog comparator driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licenser disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __ACMP_15XX_H_
+#define __ACMP_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup ACMP_15XX CHIP: LPC15xx Analog Comparator driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief Analog Comparator channel register block structure
+ */
+typedef struct {
+ __IO uint32_t CMP; /*!< Individual Comparator control register */
+ __IO uint32_t CMPFILTR; /*!< Individual Comparator Filter registers */
+} CMP_REG_T;
+
+/**
+ * @brief Analog Comparator register block structure
+ */
+typedef struct { /*!< ACMP Structure */
+ __IO uint32_t CTRL; /*!< Comparator block control register */
+ __IO CMP_REG_T ACMP[4]; /*!< Individual Comparator registers */
+} LPC_CMP_T;
+
+/* Bit definitions for block control register */
+#define ACMP_ROSCCTL_BIT (1 << 8) /* Ring Oscillator control bit */
+#define ACMP_EXTRESET_BIT (1 << 9) /* Reset source for ring oscillator 0 - Internal, 1 - External pin */
+
+/* Bit definitions for compare register */
+#define ACMP_CMPEN_BIT (1 << 0) /* Comparator enable bit */
+#define ACMP_INTEN_BIT (1 << 2) /* Comparator Interrupt enable bit */
+#define ACMP_STATUS_BIT (1 << 3) /* Comparator status, reflects the state of the comparator output */
+#define ACMP_COMPVMSEL_MASK (0x7 << 4) /* Mask for VM Input selection */
+#define ACMP_COMPVPSEL_MASK (0x7 << 8) /* Mask for VP Input selection */
+#define ACMP_HYSTERESIS_MASK (0x3 << 13) /* Mask for Hysterisis Control */
+#define ACMP_INTPOL_BIT (1 << 15) /* Polarity of CMP output for interrupt 0 - Not Inverted, 1 - Inverted */
+#define ACMP_INTTYPE_BIT (1 << 16) /* Interrupt Type 0 - Edge, 1 - Level */
+#define ACMP_INTEDGE_MASK (0x3 << 17) /* Mask for Interrupt edge selection */
+#define ACMP_INTFLAG_BIT (1 << 19) /* Interrupt Flag bit */
+#define ACMP_LADENAB_BIT (1 << 20) /* Voltage ladder enable bit */
+#define ACMP_LADREF_BIT (1 << 22) /* Voltage reference select bit for voltage ladder */
+#define ACMP_LADSEL_MASK (0x1F << 24) /* Reference voltage selection mask for ladder */
+#define ACMP_PROPDLY_MASK (0x3 << 29) /* Propogation delay mask */
+
+/* Bit definitions for comparator filter register */
+#define ACMP_SMODE_MASK (0x3 << 0) /* Mask for digital filter sample mode */
+#define ACMP_CLKDIV_MASK (0x7 << 2) /* Mask for comparator clock */
+
+/** Edge selection for comparator */
+typedef enum {
+ ACMP_EDGESEL_FALLING = (0 << 17), /* Set the COMPEDGE bit on falling edge */
+ ACMP_EDGESEL_RISING = (1 << 17), /* Set the COMPEDGE bit on rising edge */
+ ACMP_EDGESEL_BOTH = (2 << 17) /* Set the COMPEDGE bit on falling and rising edges */
+} CHIP_ACMP_EDGESEL_T;
+
+/** Hysteresis selection for comparator */
+typedef enum {
+ ACMP_HYS_NONE = (0 << 13), /* No hysteresis (the output will switch as the voltages cross) */
+ ACMP_HYS_5MV = (1 << 13), /* 5mV hysteresis */
+ ACMP_HYS_10MV = (2 << 13), /* 10mV hysteresis */
+ ACMP_HYS_15MV = (3 << 13) /* 20mV hysteresis */
+} CHIP_ACMP_HYS_T;
+
+/**
+ * Analog Comparator positive input values
+ */
+typedef enum CHIP_ACMP_POS_INPUT {
+ ACMP_POSIN_VREF_DIV = (0 << 8), /*!< Voltage ladder output */
+ ACMP_POSIN_ACMP_I1 = (1 << 8), /*!< ACMP_I1 pin */
+ ACMP_POSIN_ACMP_I2 = (2 << 8), /*!< ACMP_I2 pin */
+ ACMP_POSIN_ACMP_I3 = (3 << 8), /*!< ACMP_I3 pin */
+ ACMP_POSIN_ACMP_I4 = (4 << 8), /*!< ACMP_I4 pin */
+ ACMP_POSIN_INT_REF = (5 << 8), /*!< Internal reference voltage */
+ ACMP_POSIN_ADCIN_1 = (6 << 8), /*!< ADC Input or Temperature sensor varies with comparator */
+ ACMP_POSIN_ADCIN_2 = (7 << 8) /*!< ADC Input varies with comparator */
+} CHIP_ACMP_POS_INPUT_T;
+
+/**
+ * Analog Comparator negative input values
+ */
+typedef enum CHIP_ACMP_NEG_INPUT {
+ ACMP_NEGIN_VREF_DIV = (0 << 4), /*!< Voltage ladder output */
+ ACMP_NEGIN_ACMP_I1 = (1 << 4), /*!< ACMP_I1 pin */
+ ACMP_NEGIN_ACMP_I2 = (2 << 4), /*!< ACMP_I2 pin */
+ ACMP_NEGIN_ACMP_I3 = (3 << 4), /*!< ACMP_I3 pin */
+ ACMP_NEGIN_ACMP_I4 = (4 << 4), /*!< ACMP_I4 pin */
+ ACMP_NEGIN_INT_REF = (5 << 4), /*!< Internal reference voltage */
+ ACMP_NEGIN_ADCIN_1 = (6 << 4), /*!< ADC Input or Temperature sensor varies with comparator */
+ ACMP_NEGIN_ADCIN_2 = (7 << 4) /*!< ADC Input varies with comparator */
+} CHIP_ACMP_NEG_INPUT_T;
+
+/**
+ * Analog Comparator sample mode values
+ */
+typedef enum {
+ ACMP_SMODE_0 = 0, /*!< Bypass filter */
+ ACMP_SMODE_1, /*!< Reject pulses shorter than 1 filter clock cycle */
+ ACMP_SMODE_2, /*!< Reject pulses shorter than 2 filter clock cycle */
+ ACMP_SMODE_3 /*!< Reject pulses shorter than 3 filter clock cycle */
+} CHIP_ACMP_SMODE_T;
+
+/**
+ * Analog Comparator clock divider values
+ */
+typedef enum {
+ ACMP_CLKDIV_1 = (0x0 << 2), /*!< Use CMP_PCLK */
+ ACMP_CLKDIV_2 = (0x1 << 2), /*!< Use CMP_PCLK/2 */
+ ACMP_CLKDIV_4 = (0x2 << 2), /*!< Use CMP_PCLK/4 */
+ ACMP_CLKDIV_8 = (0x3 << 2), /*!< Use CMP_PCLK/8 */
+ ACMP_CLKDIV_16 = (0x4 << 2), /*!< Use CMP_PCLK/16 */
+ ACMP_CLKDIV_32 = (0x5 << 2), /*!< Use CMP_PCLK/32 */
+ ACMP_CLKDIV_64 = (0x6 << 2) /*!< Use CMP_PCLK/64 */
+} CHIP_ACMP_CLKDIV_T;
+
+/**
+ * @brief Initializes the ACMP
+ * @param pACMP : Pointer to Analog Comparator block
+ * @return Nothing
+ */
+void Chip_ACMP_Init(LPC_CMP_T *pACMP);
+
+/**
+ * @brief Deinitializes the ACMP
+ * @param pACMP : Pointer to Analog Comparator block
+ * @return Nothing
+ */
+void Chip_ACMP_Deinit(LPC_CMP_T *pACMP);
+
+/**
+ * @brief Enable the comparator
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ACMP_EnableComp(LPC_CMP_T *pACMP, uint8_t index)
+{
+ /* Make sure interrupt flag is not set during read write operation */
+ pACMP->ACMP[index].CMP = (pACMP->ACMP[index].CMP & ~ACMP_INTFLAG_BIT) | ACMP_CMPEN_BIT;
+}
+
+/**
+ * @brief Disable the comparator
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ACMP_DisableComp(LPC_CMP_T *pACMP, uint8_t index)
+{
+ pACMP->ACMP[index].CMP = (pACMP->ACMP[index].CMP & ~ACMP_INTFLAG_BIT) & ~ACMP_CMPEN_BIT;
+}
+
+/**
+ * @brief Enable the interrupt for the comparator
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ACMP_EnableCompInt(LPC_CMP_T *pACMP, uint8_t index)
+{
+ /* Make sure interrupt flag is not set during read write operation */
+ pACMP->ACMP[index].CMP = (pACMP->ACMP[index].CMP & ~ACMP_INTFLAG_BIT) | ACMP_INTEN_BIT;
+}
+
+/**
+ * @brief Disable the interrupt for the comparator
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ACMP_DisableCompInt(LPC_CMP_T *pACMP, uint8_t index)
+{
+ /* Make sure interrupt flag is not set during read write operation */
+ pACMP->ACMP[index].CMP = (pACMP->ACMP[index].CMP & ~ACMP_INTFLAG_BIT) & ~ACMP_INTEN_BIT;
+}
+
+/**
+ * @brief Returns the current comparator status
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @return TRUE if ACMP_STATUS_BIT is set else returns FALSE
+ */
+STATIC INLINE bool Chip_ACMP_GetCompStatus(LPC_CMP_T *pACMP, uint8_t index)
+{
+ return (pACMP->ACMP[index].CMP & ACMP_STATUS_BIT) != 0;
+}
+
+/**
+ * @brief Selects positive voltage input
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @param Posinput: one of the positive input voltage sources
+ * @return Nothing
+ */
+void Chip_ACMP_SetPosVoltRef(LPC_CMP_T *pACMP, uint8_t index, CHIP_ACMP_POS_INPUT_T Posinput);
+
+/**
+ * @brief Selects negative voltage input
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @param Neginput: one of the negative input voltage sources
+ * @return Nothing
+ */
+void Chip_ACMP_SetNegVoltRef(LPC_CMP_T *pACMP, uint8_t index, CHIP_ACMP_NEG_INPUT_T Neginput);
+
+/**
+ * @brief Selects hysteresis level
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @param hys : Selected Hysteresis level
+ * @return Nothing
+ */
+void Chip_ACMP_SetHysteresis(LPC_CMP_T *pACMP, uint8_t index, CHIP_ACMP_HYS_T hys);
+
+/**
+ * @brief Set the ACMP interrupt polarity (INTPOL bit)
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ACMP_SetIntPolarity(LPC_CMP_T *pACMP, uint8_t index)
+{
+ /* Make sure interrupt flag is not set during read write operation */
+ pACMP->ACMP[index].CMP = (pACMP->ACMP[index].CMP & ~ACMP_INTFLAG_BIT) | ACMP_INTPOL_BIT;
+}
+
+/**
+ * @brief Clear the ACMP interrupt polarity (INTPOL bit)
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ACMP_ClearIntPolarity(LPC_CMP_T *pACMP, uint8_t index)
+{
+ /* Make sure interrupt flag is not set during read write operation */
+ pACMP->ACMP[index].CMP = (pACMP->ACMP[index].CMP & ~ACMP_INTFLAG_BIT) & ~ACMP_INTPOL_BIT;
+}
+
+/**
+ * @brief Set the ACMP interrupt type as edge (INTTYPE bit)
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ACMP_SetIntTypeEdge(LPC_CMP_T *pACMP, uint8_t index)
+{
+ /* Make sure interrupt flag is not set during read write operation */
+ pACMP->ACMP[index].CMP = (pACMP->ACMP[index].CMP & ~ACMP_INTFLAG_BIT) & ~ACMP_INTTYPE_BIT;
+}
+
+/**
+ * @brief Set the ACMP interrupt type as level (INTTYPE bit)
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ACMP_SetIntTypeLevel(LPC_CMP_T *pACMP, uint8_t index)
+{
+ /* Make sure interrupt flag is not set during read write operation */
+ pACMP->ACMP[index].CMP = (pACMP->ACMP[index].CMP & ~ACMP_INTFLAG_BIT) | ACMP_INTTYPE_BIT;
+}
+
+/**
+ * @brief Sets up ACMP edge selection
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @param edgeSel : Edge selection value
+ * @return Nothing
+ */
+void Chip_ACMP_SetIntEdgeSelection(LPC_CMP_T *pACMP, uint8_t index, CHIP_ACMP_EDGESEL_T edgeSel);
+
+/**
+ * @brief Get the ACMP interrupt flag bit(INTFLAG bit)
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @return TRUE if ACMP_INTFLAG_BIT is set else returns FALSE
+ */
+STATIC INLINE bool Chip_ACMP_GetIntFlag(LPC_CMP_T *pACMP, uint8_t index)
+{
+ return (pACMP->ACMP[index].CMP & ACMP_INTFLAG_BIT) != 0;
+}
+
+/**
+ * @brief Clears the ACMP interrupt flag bit (INTFLAG bit)
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ACMP_ClearIntFlag(LPC_CMP_T *pACMP, uint8_t index)
+{
+ pACMP->ACMP[index].CMP |= ACMP_INTFLAG_BIT;
+}
+
+/**
+ * @brief Helper function for setting up ACMP voltage settings
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @param Posinput : one of the positive input voltage sources
+ * @param Neginput : one of the negative input voltage sources
+ * @param hys : Selected Hysteresis level
+ * @return Nothing
+ */
+void Chip_ACMP_SetupACMPRefs(LPC_CMP_T *pACMP, uint8_t index,
+ CHIP_ACMP_POS_INPUT_T Posinput, CHIP_ACMP_NEG_INPUT_T Neginput,
+ CHIP_ACMP_HYS_T hys);
+
+/**
+ * @brief Helper function for setting up ACMP interrupt settings
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @param level : interrupt type false - edge, true - level
+ * @param invert : polarity of CMP output for interrupt, false - Not Inverted, true - Inverted
+ * @param edgeSel : Edge selection value
+ * @return Nothing
+ */
+void Chip_ACMP_SetupACMPInt(LPC_CMP_T *pACMP, uint8_t index, bool level,
+ bool invert, CHIP_ACMP_EDGESEL_T edgeSel);
+
+/**
+ * @brief Sets up voltage ladder
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @param ladsel : Voltage ladder value (0 .. 31)
+ * @param ladrefVDDCMP : Selects the reference voltage Vref for the voltage ladder
+ * true for VDD, false for VDDCMP pin
+ * @return Nothing
+ */
+void Chip_ACMP_SetupVoltLadder(LPC_CMP_T *pACMP, uint8_t index, uint32_t ladsel, bool ladrefVDDCMP);
+
+/**
+ * @brief Enables voltage ladder
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ACMP_EnableVoltLadder(LPC_CMP_T *pACMP, uint8_t index)
+{
+ /* Make sure interrupt flag is not set during read write operation */
+ pACMP->ACMP[index].CMP = (pACMP->ACMP[index].CMP & ~ACMP_INTFLAG_BIT) | ACMP_LADENAB_BIT;
+}
+
+/**
+ * @brief Disables voltage ladder
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ACMP_DisableVoltLadder(LPC_CMP_T *pACMP, uint8_t index)
+{
+ /* Make sure interrupt flag is not set during read write operation */
+ pACMP->ACMP[index].CMP = (pACMP->ACMP[index].CMP & ~ACMP_INTFLAG_BIT) & ~ACMP_LADENAB_BIT;
+}
+
+/**
+ * @brief Set propogation delay for comparator output
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @param delay : propogation delay (0 - 2), 0 is short delay more power consumption
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ACMP_SetPropagationDelay(LPC_CMP_T *pACMP, uint8_t index, uint8_t delay)
+{
+ /* Make sure interrupt flag is not set during read write operation */
+ pACMP->ACMP[index].CMP =
+ ((pACMP->ACMP[index].CMP & ~ACMP_INTFLAG_BIT) & ~ACMP_PROPDLY_MASK) | ((uint32_t) delay << 29);
+}
+
+/**
+ * @brief Set filter sample mode
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @param mode : sample mode enum value
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ACMP_SetSampleMode(LPC_CMP_T *pACMP, uint8_t index, CHIP_ACMP_SMODE_T mode)
+{
+ pACMP->ACMP[index].CMPFILTR = (pACMP->ACMP[index].CMPFILTR & ~ACMP_SMODE_MASK) | (uint32_t) mode;
+}
+
+/**
+ * @brief Set clock divider
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @param div : SysClk divider enum value
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ACMP_SetClockDiv(LPC_CMP_T *pACMP, uint8_t index, CHIP_ACMP_CLKDIV_T div)
+{
+ pACMP->ACMP[index].CMPFILTR = (pACMP->ACMP[index].CMPFILTR & ~ACMP_CLKDIV_MASK) | (uint32_t) div;
+}
+
+/**
+ * @brief Setup Comparator filter register
+ * @param pACMP : Pointer to Analog Comparator block
+ * @param index : index to the comparator (0 - 3)
+ * @param mode : sample mode enum value
+ * @param div : SysClk divider enum value
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ACMP_SetCompFiltReg(LPC_CMP_T *pACMP,
+ uint8_t index,
+ CHIP_ACMP_SMODE_T mode,
+ CHIP_ACMP_CLKDIV_T div)
+{
+ pACMP->ACMP[index].CMPFILTR = (uint32_t) mode | (uint32_t) div;
+}
+
+/**
+ * @brief Set Ring Oscillator control bit, ROSC output is set by ACMP1 and reset by ACMP0
+ * @param pACMP : Pointer to Analog Comparator block
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ACMP_SetRingOscCtl(LPC_CMP_T *pACMP)
+{
+ pACMP->CTRL |= ACMP_ROSCCTL_BIT;
+}
+
+/**
+ * @brief Clear Ring Oscillator control bit, ROSC output is set by ACMP0 and reset by ACMP1
+ * @param pACMP : Pointer to Analog Comparator block
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ACMP_ClearRingOscCtl(LPC_CMP_T *pACMP)
+{
+ pACMP->CTRL &= ~ACMP_ROSCCTL_BIT;
+}
+
+/**
+ * @brief Set Ring Oscillator Reset Source to Internal
+ * @param pACMP : Pointer to Analog Comparator block
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ACMP_SetROscResetSrcInternal(LPC_CMP_T *pACMP)
+{
+ pACMP->CTRL &= ~ACMP_EXTRESET_BIT;
+}
+
+/**
+ * @brief Set Ring Oscillator Reset Source to External
+ * @param pACMP : Pointer to Analog Comparator block
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ACMP_SetROscResetSrcExternal(LPC_CMP_T *pACMP)
+{
+ pACMP->CTRL |= ACMP_EXTRESET_BIT;
+}
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ACMP_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/adc_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/adc_15xx.h
new file mode 100644
index 0000000..c5abbef
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/adc_15xx.h
@@ -0,0 +1,597 @@
+/*
+ * @brief LPC15xx ADC driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __ADC_15XX_H_
+#define __ADC_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup ADC_15XX CHIP: LPC15xx A/D conversion driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/** Sequence index enumerations, used in various parts of the code for
+ register indexing and sequencer selection */
+typedef enum {
+ ADC_SEQA_IDX,
+ ADC_SEQB_IDX
+} ADC_SEQ_IDX_T;
+
+/**
+ * @brief ADC register block structure
+ */
+typedef struct { /*!< ADCn Structure */
+ __IO uint32_t CTRL; /*!< A/D Control Register. The AD0CR register must be written to select the operating mode before A/D conversion can occur. */
+ __IO uint32_t INSEL; /*!< A/D Input Select Register. This field selects the input source for channel 0. */
+ __IO uint32_t SEQ_CTRL[ADC_SEQB_IDX + 1]; /*!< A/D Sequence A & B Control Register. Controls triggering and channel selection for sonversion sequence. */
+ __IO uint32_t SEQ_GDAT[ADC_SEQB_IDX + 1]; /*!< A/D Sequence A & B Global Data Register. Contains the result of the most recent A/D conversion for sequence. */
+ __I uint32_t RESERVED1[2];
+ __I uint32_t DR[12]; /*!< A/D Channel Data Register. This register contains the result of the most recent conversion completed on channel n. */
+ __IO uint32_t THR_LOW[2]; /*!< A/D Low Compare Threshold Register 0 & 1. Contains the lower threshold level for automatic threshold comparison. */
+ __IO uint32_t THR_HIGH[2]; /*!< A/D High Compare Threshold Register 0 & 1. Contains the higher threshold level for automatic threshold comparison. */
+ __IO uint32_t CHAN_THRSEL; /*!< A/D Channel Threshold Select Register. Specifies which set of threshold compare registers to use. */
+ __IO uint32_t INTEN; /*!< A/D Interrupt Enable Register. This register contains enable bits that enable sequence-A, sequence-B, threshold compare and overrun interrupts. */
+ __IO uint32_t FLAGS; /*!< A/D Flags Register. This register contains interrupt flags. - To be checked */
+ __IO uint32_t TRM; /*!< A/D Trim Register. */
+} LPC_ADC_T;
+
+/** Maximum sample rate in Hz (12-bit conversions) */
+#define ADC_MAX_SAMPLE_RATE 50000000
+
+/**
+ * @brief ADC register support bitfields and mask
+ */
+/** ADC Control register bit fields */
+#define ADC_CR_CLKDIV_MASK (0xFF << 0) /*!< Mask for Clock divider value */
+#define ADC_CR_CLKDIV_BITPOS (0) /*!< Bit position for Clock divider value */
+#define ADC_CR_ASYNMODE (1 << 8) /*!< Asynchronous mode enable bit */
+#define ADC_CR_MODE10BIT (1 << 9) /*!< 10-bit mode enable bit */
+#define ADC_CR_LPWRMODEBIT (1 << 10) /*!< Low power mode enable bit */
+#define ADC_CR_CALMODEBIT (1 << 30) /*!< Self calibration cycle enable bit */
+#define ADC_CR_BITACC(n) ((((n) & 0x1) << 9)) /*!< 12-bit or 10-bit ADC accuracy */
+#define ADC_CR_CLKDIV(n) ((((n) & 0xFF) << 0)) /*!< The APB clock (PCLK) is divided by (this value plus one) to produce the clock for the A/D */
+#define ADC_SAMPLE_RATE_CONFIG_MASK (ADC_CR_CLKDIV(0xFF) | ADC_CR_BITACC(0x01))
+
+/** ADC input select register */
+#define ADC_INSEL_ADC0 (0x0 << 0) /*!< Select ADCn_0 for channel 0 */
+#define ADC_INSEL_CRVO (0x1 << 0) /*!< Selects the Core voltage regulator output for channel 0 */
+#define ADC_INSEL_IVR (0x2 << 0) /*!< Selects the Internal voltage reference for channel 0 */
+#define ADC_INSEL_TS (0x3 << 0) /*!< Selects the Temperature Sensor for channel 0 */
+#define ADC_INSEL_VDDA_DIV (0x4 << 0) /*!< Selects VDDA/2 for channel 0 */
+
+/** ADC Sequence Control register bit fields */
+#define ADC_SEQ_CTRL_CHANSEL(n) (1 << (n)) /*!< Channel select macro */
+#define ADC_SEQ_CTRL_CHANSEL_MASK (0xFFF) /*!< Channel select mask */
+
+/** ADC hardware trigger sources in SEQ_CTRL for ADC0 only. These sources should
+ * only be used when selecting trigger sources for ADC0. */
+#define ADC0_SEQ_CTRL_HWTRIG_ADC0_PIN_TRIG0 (0 << 12) /*!< HW trigger input - ADC0_PIN_TRIG0 */
+#define ADC0_SEQ_CTRL_HWTRIG_ADC0_PIN_TRIG1 (1 << 12) /*!< HW trigger input - ADC0_PIN_TRIG1 */
+#define ADC0_SEQ_CTRL_HWTRIG_SCT0_OUT7 (2 << 12) /*!< HW trigger input - SCT0_OUT7 */
+#define ADC0_SEQ_CTRL_HWTRIG_SCT0_OUT9 (3 << 12) /*!< HW trigger input - SCT0_OUT9 */
+#define ADC0_SEQ_CTRL_HWTRIG_SCT1_OUT7 (4 << 12) /*!< HW trigger input - SCT1_OUT7 */
+#define ADC0_SEQ_CTRL_HWTRIG_SCT1_OUT9 (5 << 12) /*!< HW trigger input - SCT1_OUT9 */
+#define ADC0_SEQ_CTRL_HWTRIG_SCT2_OUT3 (6 << 12) /*!< HW trigger input - SCT2_OUT3 */
+#define ADC0_SEQ_CTRL_HWTRIG_SCT2_OUT4 (7 << 12) /*!< HW trigger input - SCT2_OUT4 */
+#define ADC0_SEQ_CTRL_HWTRIG_SCT3_OUT3 (8 << 12) /*!< HW trigger input - SCT3_OUT3 */
+#define ADC0_SEQ_CTRL_HWTRIG_SCT3_OUT4 (9 << 12) /*!< HW trigger input - SCT3_OUT4 */
+#define ADC0_SEQ_CTRL_HWTRIG_ACMP0_O (10 << 12) /*!< HW trigger input - ACMP0_O */
+#define ADC0_SEQ_CTRL_HWTRIG_ACMP1_O (11 << 12) /*!< HW trigger input - ACMP1_O */
+#define ADC0_SEQ_CTRL_HWTRIG_ACMP2_O (12 << 12) /*!< HW trigger input - ACMP2_O */
+#define ADC0_SEQ_CTRL_HWTRIG_ACMP3_O (13 << 12) /*!< HW trigger input - ACMP3_O */
+#define ADC0_SEQ_CTRL_HWTRIG_MASK (0x3F << 12) /*!< HW trigger input bitfield mask */
+
+/** ADC hardware trigger sources in SEQ_CTRL for ADC1 only. These sources should
+ * only be used when selecting trigger sources for ADC1. */
+#define ADC1_SEQ_CTRL_HWTRIG_ADC1_PIN_TRIG0 (0 << 12) /*!< HW trigger input - ADC1_PIN_TRIG0 */
+#define ADC1_SEQ_CTRL_HWTRIG_ADC1_PIN_TRIG1 (1 << 12) /*!< HW trigger input - ADC1_PIN_TRIG1 */
+#define ADC1_SEQ_CTRL_HWTRIG_SCT0_OUT6 (2 << 12) /*!< HW trigger input - SCT0_OUT6 */
+#define ADC1_SEQ_CTRL_HWTRIG_SCT0_OUT9 (3 << 12) /*!< HW trigger input - SCT0_OUT9 */
+#define ADC1_SEQ_CTRL_HWTRIG_SCT1_OUT8 (4 << 12) /*!< HW trigger input - SCT1_OUT8 */
+#define ADC1_SEQ_CTRL_HWTRIG_SCT1_OUT9 (5 << 12) /*!< HW trigger input - SCT1_OUT9 */
+#define ADC1_SEQ_CTRL_HWTRIG_SCT2_OUT2 (6 << 12) /*!< HW trigger input - SCT2_OUT2 */
+#define ADC1_SEQ_CTRL_HWTRIG_SCT2_OUT5 (7 << 12) /*!< HW trigger input - SCT2_OUT5 */
+#define ADC1_SEQ_CTRL_HWTRIG_SCT3_OUT2 (8 << 12) /*!< HW trigger input - SCT3_OUT2 */
+#define ADC1_SEQ_CTRL_HWTRIG_SCT3_OUT5 (9 << 12) /*!< HW trigger input - SCT3_OUT5 */
+#define ADC1_SEQ_CTRL_HWTRIG_ACMP0_O (10 << 12) /*!< HW trigger input - ACMP0_O */
+#define ADC1_SEQ_CTRL_HWTRIG_ACMP1_O (11 << 12) /*!< HW trigger input - ACMP1_O */
+#define ADC1_SEQ_CTRL_HWTRIG_ACMP2_O (12 << 12) /*!< HW trigger input - ACMP2_O */
+#define ADC1_SEQ_CTRL_HWTRIG_ACMP3_O (13 << 12) /*!< HW trigger input - ACMP3_O */
+#define ADC1_SEQ_CTRL_HWTRIG_MASK (0x3F << 12) /*!< HW trigger input bitfield mask */
+
+/** SEQ_CTRL register bit fields */
+#define ADC_SEQ_CTRL_HWTRIG_POLPOS (1 << 18) /*!< HW trigger polarity - positive edge */
+#define ADC_SEQ_CTRL_HWTRIG_SYNCBYPASS (1 << 19) /*!< HW trigger bypass synchronisation */
+#define ADC_SEQ_CTRL_START (1 << 26) /*!< Start conversion enable bit */
+#define ADC_SEQ_CTRL_BURST (1 << 27) /*!< Repeated conversion enable bit */
+#define ADC_SEQ_CTRL_SINGLESTEP (1 << 28) /*!< Single step enable bit */
+#define ADC_SEQ_CTRL_LOWPRIO (1 << 29) /*!< High priority enable bit (regardless of name) */
+#define ADC_SEQ_CTRL_MODE_EOS (1 << 30) /*!< Mode End of sequence enable bit */
+#define ADC_SEQ_CTRL_SEQ_ENA (1UL << 31) /*!< Sequence enable bit */
+
+/** ADC global data register bit fields */
+#define ADC_SEQ_GDAT_RESULT_MASK (0xFFF << 4) /*!< Result value mask */
+#define ADC_SEQ_GDAT_RESULT_BITPOS (4) /*!< Result start bit position */
+#define ADC_SEQ_GDAT_THCMPRANGE_MASK (0x3 << 16) /*!< Comparion range mask */
+#define ADC_SEQ_GDAT_THCMPRANGE_BITPOS (16) /*!< Comparison range bit position */
+#define ADC_SEQ_GDAT_THCMPCROSS_MASK (0x3 << 18) /*!< Comparion cross mask */
+#define ADC_SEQ_GDAT_THCMPCROSS_BITPOS (18) /*!< Comparison cross bit position */
+#define ADC_SEQ_GDAT_CHAN_MASK (0xF << 26) /*!< Channel number mask */
+#define ADC_SEQ_GDAT_CHAN_BITPOS (26) /*!< Channel number bit position */
+#define ADC_SEQ_GDAT_OVERRUN (1 << 30) /*!< Overrun bit */
+#define ADC_SEQ_GDAT_DATAVALID (1UL << 31) /*!< Data valid bit */
+
+/** ADC Data register bit fields */
+#define ADC_DR_RESULT(n) ((((n) >> 4) & 0xFFF)) /*!< Macro for getting the ADC data value */
+#define ADC_DR_THCMPRANGE_MASK (0x3 << 16) /*!< Comparion range mask */
+#define ADC_DR_THCMPRANGE_BITPOS (16) /*!< Comparison range bit position */
+#define ADC_DR_THCMPRANGE(n) (((n) >> ADC_DR_THCMPRANGE_BITPOS) & 0x3)
+#define ADC_DR_THCMPCROSS_MASK (0x3 << 18) /*!< Comparion cross mask */
+#define ADC_DR_THCMPCROSS_BITPOS (18) /*!< Comparison cross bit position */
+#define ADC_DR_THCMPCROSS(n) (((n) >> ADC_DR_THCMPCROSS_BITPOS) & 0x3)
+#define ADC_DR_CHAN_MASK (0xF << 26) /*!< Channel number mask */
+#define ADC_DR_CHAN_BITPOS (26) /*!< Channel number bit position */
+#define ADC_DR_CHANNEL(n) (((n) >> ADC_DR_CHAN_BITPOS) & 0xF) /*!< Channel number bit position */
+#define ADC_DR_OVERRUN (1 << 30) /*!< Overrun bit */
+#define ADC_DR_DATAVALID (1UL << 31) /*!< Data valid bit */
+#define ADC_DR_DONE(n) (((n) >> 31))
+
+/** ADC low/high Threshold register bit fields */
+#define ADC_THR_VAL_MASK (0xFFF << 4) /*!< Threshold value bit mask */
+#define ADC_THR_VAL_POS (4) /*!< Threshold value bit position */
+
+/** ADC Threshold select register bit fields */
+#define ADC_THRSEL_CHAN_SEL_THR1(n) (1 << (n)) /*!< Select THR1 register for channel n */
+
+/** ADC Interrupt Enable register bit fields */
+#define ADC_INTEN_SEQA_ENABLE (1 << 0) /*!< Sequence A Interrupt enable bit */
+#define ADC_INTEN_SEQB_ENABLE (1 << 1) /*!< Sequence B Interrupt enable bit */
+#define ADC_INTEN_SEQN_ENABLE(seq) (1 << (seq)) /*!< Sequence A/B Interrupt enable bit */
+#define ADC_INTEN_OVRRUN_ENABLE (1 << 2) /*!< Overrun Interrupt enable bit */
+#define ADC_INTEN_CMP_DISBALE (0) /*!< Disable comparison interrupt value */
+#define ADC_INTEN_CMP_OUTSIDETH (1) /*!< Outside threshold interrupt value */
+#define ADC_INTEN_CMP_CROSSTH (2) /*!< Crossing threshold interrupt value */
+#define ADC_INTEN_CMP_MASK (3) /*!< Comparison interrupt value mask */
+#define ADC_INTEN_CMP_ENABLE(isel, ch) (((isel) & ADC_INTEN_CMP_MASK) << ((2 * (ch)) + 3)) /*!< Interrupt selection for channel */
+
+/** ADC Flags register bit fields */
+#define ADC_FLAGS_THCMP_MASK(ch) (1 << (ch)) /*!< Threshold comparison status for channel */
+#define ADC_FLAGS_OVRRUN_MASK(ch) (1 << (12 + (ch))) /*!< Overrun status for channel */
+#define ADC_FLAGS_SEQA_OVRRUN_MASK (1 << 24) /*!< Seq A Overrun status */
+#define ADC_FLAGS_SEQB_OVRRUN_MASK (1 << 25) /*!< Seq B Overrun status */
+#define ADC_FLAGS_SEQN_OVRRUN_MASK(seq) (1 << (24 + (seq))) /*!< Seq A/B Overrun status */
+#define ADC_FLAGS_SEQA_INT_MASK (1 << 28) /*!< Seq A Interrupt status */
+#define ADC_FLAGS_SEQB_INT_MASK (1 << 29) /*!< Seq B Interrupt status */
+#define ADC_FLAGS_SEQN_INT_MASK(seq) (1 << (28 + (seq)))/*!< Seq A/B Interrupt status */
+#define ADC_FLAGS_THCMP_INT_MASK (1 << 30) /*!< Threshold comparison Interrupt status */
+#define ADC_FLAGS_OVRRUN_INT_MASK (1UL << 31) /*!< Overrun Interrupt status */
+
+/** ADC Trim register bit fields */
+#define ADC_TRIM_VRANGE_HIGHV (0 << 5) /*!< Voltage range bit - High volatge (2.7V to 3.6V) */
+#define ADC_TRIM_VRANGE_LOWV (1 << 5) /*!< Voltage range bit - Low volatge (1.8V to 2.7V) */
+
+/**
+ * @brief Initialize the ADC peripheral
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param flags : ADC flags for init (ADC_CR_MODE10BIT and/or ADC_CR_LPWRMODEBIT)
+ * @return Nothing
+ * @note To select low-power ADC mode, enable the ADC_CR_LPWRMODEBIT flag.
+ * To select 10-bit conversion mode, enable the ADC_CR_MODE10BIT flag. You ca
+ * also enable asychronous clock mode by using the ADC_CR_ASYNMODE.
+ * Example: Chip_ADC_Init(LPC_ADC, (ADC_CR_MODE10BIT | ADC_CR_LPWRMODEBIT));
+ */
+void Chip_ADC_Init(LPC_ADC_T *pADC, uint32_t flags);
+
+/**
+ * @brief Shutdown ADC
+ * @param pADC : The base of ADC peripheral on the chip
+ * @return Nothing
+ * @note Disables the ADC clocks and ADC power
+ */
+void Chip_ADC_DeInit(LPC_ADC_T *pADC);
+
+/**
+ * @brief Set ADC divider
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param div : ADC divider value to set minus 1
+ * @return Nothing
+ * @note The value is used as a divider to generate the ADC
+ * clock rate from the ADC input clock. The ADC input clock is based
+ * on the system clock. Valid values for this function are from 0 to 255
+ * with 0=divide by 1, 1=divide by 2, 2=divide by 3, etc.<br>
+ * Do not decrement this value by 1.<br>
+ * To set the ADC clock rate to 1MHz, use the following function:<br>
+ * Chip_ADC_SetDivider(LPC_ADC, (Chip_Clock_GetSystemClockRate() / 1000000) - 1);
+ */
+STATIC INLINE void Chip_ADC_SetDivider(LPC_ADC_T *pADC, uint8_t div)
+{
+ uint32_t temp;
+
+ temp = pADC->CTRL & ~(ADC_CR_CLKDIV_MASK);
+ pADC->CTRL = temp | (uint32_t) div;
+}
+
+/**
+ * @brief Set ADC clock rate
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param rate : rate in Hz to set ADC clock to (maximum ADC_MAX_SAMPLE_RATE)
+ * @return Nothing
+ * @note This function will not work if the ADC is used with the ASYNC
+ * ADC clock (set when the ADC_CR_ASYNMODE bit is on in the ADC CTRL register).
+ */
+void Chip_ADC_SetClockRate(LPC_ADC_T *pADC, uint32_t rate);
+
+/**
+ * @brief Get ADC divider
+ * @param pADC : The base of ADC peripheral on the chip
+ * @return the current ADC divider
+ * @note This function returns the divider that is used to generate the
+ * ADC frequency. The returned value must be incremented by 1. The
+ * frequency can be determined with the following function:<br>
+ * adc_freq = Chip_Clock_GetSystemClockRate() / (Chip_ADC_GetDivider(LPC_ADC) + 1);
+ */
+STATIC INLINE uint8_t Chip_ADC_GetDivider(LPC_ADC_T *pADC)
+{
+ return pADC->CTRL & ADC_CR_CLKDIV_MASK;
+}
+
+/**
+ * @brief Start ADC calibration
+ * @param pADC : The base of ADC peripheral on the chip
+ * @return Nothing
+ * @note Calibration is not done as part of Chip_ADC_Init(), but
+ * is required after the call to Chip_ADC_Init() or after returning
+ * from a power-down state. Calibration may alter the ADC_CR_ASYNMODE
+ * and ADC_CR_LPWRMODEBIT flags ni the CTRL register.
+ */
+void Chip_ADC_StartCalibration(LPC_ADC_T *pADC);
+
+/**
+ * @brief Start ADC calibration
+ * @param pADC : The base of ADC peripheral on the chip
+ * @return TRUE if calibration is complete, otherwise FALSE.
+ */
+STATIC INLINE bool Chip_ADC_IsCalibrationDone(LPC_ADC_T *pADC)
+{
+ return (bool) ((pADC->CTRL & ADC_CR_CALMODEBIT) == 0);
+}
+
+/**
+ * @brief Select input select for ADC channel 0
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param inp : Select an ADC_INSEL_* value for ADC0 input selection
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ADC_SetADC0Input(LPC_ADC_T *pADC, uint32_t inp)
+{
+ pADC->INSEL = inp;
+}
+
+/**
+ * @brief Helper function for safely setting ADC sequencer register bits
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param seqIndex : Sequencer to set bits for
+ * @param bits : Or'ed bits of a sequencer register to set
+ * @return Nothing
+ * @note This function will safely set the ADC sequencer register bits
+ * while maintaining bits 20..25 as 0, regardless of the read state of those bits.
+ */
+void Chip_ADC_SetSequencerBits(LPC_ADC_T *pADC, ADC_SEQ_IDX_T seqIndex, uint32_t bits);
+
+/**
+ * @brief Helper function for safely clearing ADC sequencer register bits
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param seqIndex : Sequencer to clear bits for
+ * @param bits : Or'ed bits of a sequencer register to clear
+ * @return Nothing
+ * @note This function will safely clear the ADC sequencer register bits
+ * while maintaining bits 20..25 as 0, regardless of the read state of those bits.
+ */
+void Chip_ADC_ClearSequencerBits(LPC_ADC_T *pADC, ADC_SEQ_IDX_T seqIndex, uint32_t bits);
+
+/**
+ * @brief Sets up ADC conversion sequencer A or B
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param seqIndex : Sequencer to setup
+ * @param options : OR'ed Sequencer options to setup (see notes)
+ * @return Nothing
+ * @note Sets up sequencer options for a conversion sequence. This function
+ * should be used to setup the selected channels for the sequence, the sequencer
+ * trigger, the trigger polarity, synchronization bypass, priority, and mode. All
+ * options are passed to the functions as a OR'ed list of values. This function will
+ * disable/clear the sequencer start/burst/single step/enable if they are enabled.<br>
+ * Select the channels by OR'ing in one or more ADC_SEQ_CTRL_CHANSEL(ch) values.<br>
+ * Select the hardware trigger by OR'ing in one ADC_SEQ_CTRL_HWTRIG_* value.<br>
+ * Select a positive edge hardware trigger by OR'ing in ADC_SEQ_CTRL_HWTRIG_POLPOS.<br>
+ * Select trigger bypass synchronisation by OR'ing in ADC_SEQ_CTRL_HWTRIG_SYNCBYPASS.<br>
+ * Select ADC single step on trigger/start by OR'ing in ADC_SEQ_CTRL_SINGLESTEP.<br>
+ * Select higher priority conversion on the other sequencer by OR'ing in ADC_SEQ_CTRL_LOWPRIO.<br>
+ * Select end of seqeuence instead of end of conversion interrupt by OR'ing in ADC_SEQ_CTRL_MODE_EOS.<br>
+ * Example for setting up sequencer A (channels 0-2, trigger on high edge of PIO0_2, interrupt on end of sequence):<br>
+ * Chip_ADC_SetupSequencer(LPC_ADC, ADC_SEQA_IDX, (
+ * ADC_SEQ_CTRL_CHANSEL(0) | ADC_SEQ_CTRL_CHANSEL(1) | ADC_SEQ_CTRL_CHANSEL(2) |
+ * ADC_SEQ_CTRL_HWTRIG_PIO0_2 | ADC_SEQ_CTRL_HWTRIG_POLPOS | ADC_SEQ_CTRL_MODE_EOS));
+ */
+STATIC INLINE void Chip_ADC_SetupSequencer(LPC_ADC_T *pADC, ADC_SEQ_IDX_T seqIndex, uint32_t options)
+{
+ pADC->SEQ_CTRL[seqIndex] = options;
+}
+
+/**
+ * @brief Enables a sequencer
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param seqIndex : Sequencer to enable
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ADC_EnableSequencer(LPC_ADC_T *pADC, ADC_SEQ_IDX_T seqIndex)
+{
+ Chip_ADC_SetSequencerBits(pADC, seqIndex, ADC_SEQ_CTRL_SEQ_ENA);
+}
+
+/**
+ * @brief Disables a sequencer
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param seqIndex : Sequencer to disable
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ADC_DisableSequencer(LPC_ADC_T *pADC, ADC_SEQ_IDX_T seqIndex)
+{
+ Chip_ADC_ClearSequencerBits(pADC, seqIndex, ADC_SEQ_CTRL_SEQ_ENA);
+}
+
+/**
+ * @brief Forces a sequencer trigger event (software trigger of ADC)
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param seqIndex : Sequencer to start
+ * @return Nothing
+ * @note This function sets the START bit for the sequencer to force a
+ * single conversion sequence or a single step conversion.
+ */
+STATIC INLINE void Chip_ADC_StartSequencer(LPC_ADC_T *pADC, ADC_SEQ_IDX_T seqIndex)
+{
+ Chip_ADC_SetSequencerBits(pADC, seqIndex, ADC_SEQ_CTRL_START);
+}
+
+/**
+ * @brief Starts sequencer burst mode
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param seqIndex : Sequencer to start burst on
+ * @return Nothing
+ * @note This function sets the BURST bit for the sequencer to force
+ * continuous conversion. Use Chip_ADC_StopBurstSequencer() to stop the
+ * ADC burst sequence.
+ */
+STATIC INLINE void Chip_ADC_StartBurstSequencer(LPC_ADC_T *pADC, ADC_SEQ_IDX_T seqIndex)
+{
+ Chip_ADC_SetSequencerBits(pADC, seqIndex, ADC_SEQ_CTRL_BURST);
+}
+
+/**
+ * @brief Stops sequencer burst mode
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param seqIndex : Sequencer to stop burst on
+ * @return Nothing
+ */
+STATIC INLINE void Chip_ADC_StopBurstSequencer(LPC_ADC_T *pADC, ADC_SEQ_IDX_T seqIndex)
+{
+ Chip_ADC_ClearSequencerBits(pADC, seqIndex, ADC_SEQ_CTRL_BURST);
+}
+
+/** ADC sequence global data register threshold comparison range enumerations */
+typedef enum {
+ ADC_DR_THCMPRANGE_INRANGE,
+ ADC_DR_THCMPRANGE_RESERVED,
+ ADC_DR_THCMPRANGE_BELOW,
+ ADC_DR_THCMPRANGE_ABOVE
+} ADC_DR_THCMPRANGE_T;
+
+/** ADC sequence global data register threshold comparison cross enumerations */
+typedef enum {
+ ADC_DR_THCMPCROSS_NOCROSS,
+ ADC_DR_THCMPCROSS_RESERVED,
+ ADC_DR_THCMPCROSS_DOWNWARD,
+ ADC_DR_THCMPCROSS_UPWARD
+} ADC_DR_THCMPCROSS_T;
+
+/**
+ * @brief Read a ADC sequence global data register
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param seqIndex : Sequencer to read
+ * @return Current raw value of the ADC sequence A or B global data register
+ * @note This function returns the raw value of the data register and clears
+ * the overrun and datavalid status for the register. Once this register is read,
+ * the following functions can be used to parse the raw value:<br>
+ * uint32_t adcDataRawValue = Chip_ADC_ReadSequencerDataReg(LPC_ADC, ADC_SEQA_IDX); // Get raw value
+ * uint32_t adcDataValue = ADC_DR_RESULT(adcDataRawValue); // Aligned and masked ADC data value
+ * ADC_DR_THCMPRANGE_T adcRange = (ADC_DR_THCMPRANGE_T) ADC_DR_THCMPRANGE(adcDataRawValue); // Sample range compared to threshold low/high
+ * ADC_DR_THCMPCROSS_T adcRange = (ADC_DR_THCMPCROSS_T) ADC_DR_THCMPCROSS(adcDataRawValue); // Sample cross compared to threshold low
+ * uint32_t channel = ADC_DR_CHANNEL(adcDataRawValue); // ADC channel for this sample/data
+ * bool adcDataOverrun = (bool) ((adcDataRawValue & ADC_DR_OVERRUN) != 0); // Data overrun flag
+ * bool adcDataValid = (bool) ((adcDataRawValue & ADC_SEQ_GDAT_DATAVALID) != 0); // Data valid flag
+ */
+STATIC INLINE uint32_t Chip_ADC_GetSequencerDataReg(LPC_ADC_T *pADC, ADC_SEQ_IDX_T seqIndex)
+{
+ return pADC->SEQ_GDAT[seqIndex];
+}
+
+/**
+ * @brief Read a ADC data register
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param index : Data register to read, 1-8
+ * @return Current raw value of the ADC data register
+ * @note This function returns the raw value of the data register and clears
+ * the overrun and datavalid status for the register. Once this register is read,
+ * the following functions can be used to parse the raw value:<br>
+ * uint32_t adcDataRawValue = Chip_ADC_ReadSequencerDataReg(LPC_ADC, ADC_SEQA_IDX); // Get raw value
+ * uint32_t adcDataValue = ADC_DR_RESULT(adcDataRawValue); // Aligned and masked ADC data value
+ * ADC_DR_THCMPRANGE_T adcRange = (ADC_DR_THCMPRANGE_T) ADC_DR_THCMPRANGE(adcDataRawValue); // Sample range compared to threshold low/high
+ * ADC_DR_THCMPCROSS_T adcRange = (ADC_DR_THCMPCROSS_T) ADC_DR_THCMPCROSS(adcDataRawValue); // Sample cross compared to threshold low
+ * uint32_t channel = ADC_DR_CHANNEL(adcDataRawValue); // ADC channel for this sample/data
+ * bool adcDataOverrun = (bool) ((adcDataRawValue & ADC_DR_OVERRUN) != 0); // Data overrun flag
+ * bool adcDataValid = (bool) ((adcDataRawValue & ADC_SEQ_GDAT_DATAVALID) != 0); // Data valid flag
+ */
+STATIC INLINE uint32_t Chip_ADC_GetDataReg(LPC_ADC_T *pADC, uint8_t index)
+{
+ return pADC->DR[index];
+}
+
+/**
+ * @brief Set Threshold low value in ADC
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param thrnum : Threshold register value (1 for threshold register 1, 0 for threshold register 0)
+ * @param value : Threshold low data value (should be 12-bit value)
+ * @return None
+ */
+STATIC INLINE void Chip_ADC_SetThrLowValue(LPC_ADC_T *pADC, uint8_t thrnum, uint16_t value)
+{
+ pADC->THR_LOW[thrnum] = (((uint32_t) value) << ADC_THR_VAL_POS);
+}
+
+/**
+ * @brief Set Threshold high value in ADC
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param thrnum : Threshold register value (1 for threshold register 1, 0 for threshold register 0)
+ * @param value : Threshold high data value (should be 12-bit value)
+ * @return None
+ */
+STATIC INLINE void Chip_ADC_SetThrHighValue(LPC_ADC_T *pADC, uint8_t thrnum, uint16_t value)
+{
+ pADC->THR_HIGH[thrnum] = (((uint32_t) value) << ADC_THR_VAL_POS);
+}
+
+/**
+ * @brief Select threshold 0 values for comparison for selected channels
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param channels : An OR'ed value of one or more ADC_THRSEL_CHAN_SEL_THR1(ch) values
+ * @return None
+ * @note Select multiple channels to use the threshold 0 comparison.<br>
+ * Example:<br>
+ * Chip_ADC_SelectTH0Channels(LPC_ADC, (ADC_THRSEL_CHAN_SEL_THR1(1) | ADC_THRSEL_CHAN_SEL_THR1(2))); // Selects channels 1 and 2 for threshold 0
+ */
+void Chip_ADC_SelectTH0Channels(LPC_ADC_T *pADC, uint32_t channels);
+
+/**
+ * @brief Select threshold 1 value for comparison for selected channels
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param channels : An OR'ed value of one or more ADC_THRSEL_CHAN_SEL_THR1(ch) values
+ * @return None
+ * @note Select multiple channels to use the 1 threshold comparison.<br>
+ * Example:<br>
+ * Chip_ADC_SelectTH1Channels(LPC_ADC, (ADC_THRSEL_CHAN_SEL_THR1(4) | ADC_THRSEL_CHAN_SEL_THR1(5))); // Selects channels 4 and 5 for 1 threshold
+ */
+void Chip_ADC_SelectTH1Channels(LPC_ADC_T *pADC, uint32_t channels);
+
+/**
+ * @brief Enable interrupts in ADC (sequencers A/B and overrun)
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param intMask : Interrupt values to be enabled (see notes)
+ * @return None
+ * @note Select one or more OR'ed values of ADC_INTEN_SEQA_ENABLE,
+ * ADC_INTEN_SEQB_ENABLE, and ADC_INTEN_OVRRUN_ENABLE to enable the
+ * specific ADC interrupts.
+ */
+void Chip_ADC_EnableInt(LPC_ADC_T *pADC, uint32_t intMask);
+
+/**
+ * @brief Disable interrupts in ADC (sequencers A/B and overrun)
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param intMask : Interrupt values to be disabled (see notes)
+ * @return None
+ * @note Select one or more OR'ed values of ADC_INTEN_SEQA_ENABLE,
+ * ADC_INTEN_SEQB_ENABLE, and ADC_INTEN_OVRRUN_ENABLE to disable the
+ * specific ADC interrupts.
+ */
+void Chip_ADC_DisableInt(LPC_ADC_T *pADC, uint32_t intMask);
+
+/** Threshold interrupt event options */
+typedef enum {
+ ADC_INTEN_THCMP_DISABLE,
+ ADC_INTEN_THCMP_OUTSIDE,
+ ADC_INTEN_THCMP_CROSSING,
+} ADC_INTEN_THCMP_T;
+
+/**
+ * @brief Enable a threshold event interrupt in ADC
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param ch : ADC channel to set threshold inetrrupt for, 1-8
+ * @param thInt : Selected threshold interrupt type
+ * @return None
+ */
+void Chip_ADC_SetThresholdInt(LPC_ADC_T *pADC, uint8_t ch, ADC_INTEN_THCMP_T thInt);
+
+/**
+ * @brief Get flags register in ADC
+ * @param pADC : The base of ADC peripheral on the chip
+ * @return Flags register value (ORed ADC_FLAG* values)
+ * @note Mask the return value of this function with the ADC_FLAGS_*
+ * definitions to determine the overall ADC interrupt events.<br>
+ * Example:<br>
+ * if (Chip_ADC_GetFlags(LPC_ADC) & ADC_FLAGS_THCMP_MASK(3) // Check of threshold comp status for ADC channel 3
+ */
+STATIC INLINE uint32_t Chip_ADC_GetFlags(LPC_ADC_T *pADC)
+{
+ return pADC->FLAGS;
+}
+
+/**
+ * @brief Clear flags register in ADC
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param flags : An Or'ed values of ADC_FLAGS_* values to clear
+ * @return Flags register value (ORed ADC_FLAG* values)
+ */
+STATIC INLINE void Chip_ADC_ClearFlags(LPC_ADC_T *pADC, uint32_t flags)
+{
+ pADC->FLAGS = flags;
+}
+
+/**
+ * @brief Set Trim register in ADC
+ * @param pADC : The base of ADC peripheral on the chip
+ * @param trim : Trim value (ADC_TRIM_VRANGE_HIGHV or ADC_TRIM_VRANGE_LOWV)
+ * @return None
+ */
+STATIC INLINE void Chip_ADC_SetTrim(LPC_ADC_T *pADC, uint32_t trim)
+{
+ pADC->TRM = trim;
+}
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ADC_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/chip.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/chip.h
new file mode 100644
index 0000000..bea5b1a
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/chip.h
@@ -0,0 +1,247 @@
+/*
+ * @brief LPC15xx basic chip inclusion file
+ *
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __CHIP_H_
+#define __CHIP_H_
+
+#include "lpc_types.h"
+#include "sys_config.h"
+#include "cmsis.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef CORE_M3
+#error CORE_M3 is not defined for the LPC15xx architecture
+#error CORE_M3 should be defined as part of your compiler define list
+#endif
+
+#if !defined(CHIP_LPC15XX)
+#error CHIP_LPC15XX is not defined!
+#endif
+
+/** @defgroup PERIPH_15XX_BASE CHIP: LPC15xx Peripheral addresses and register set declarations
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+#define LPC_ADC0_BASE 0x40000000
+#define LPC_DAC_BASE 0x40004000
+#define LPC_CMP_BASE 0x40008000
+#define LPC_INMUX_BASE 0x40014000
+#define LPC_RTC_BASE 0x40028000
+#define LPC_WWDT_BASE 0x4002C000
+#define LPC_SWM_BASE 0x40038000
+#define LPC_PMU_BASE 0x4003C000
+#define LPC_USART0_BASE 0x40040000
+#define LPC_USART1_BASE 0x40044000
+#define LPC_SPI0_BASE 0x40048000
+#define LPC_SPI1_BASE 0x4004C000
+#define LPC_I2C_BASE 0x40050000
+#define LPC_QEI_BASE 0x40058000
+#define LPC_SYSCTL_BASE 0x40074000
+#define LPC_ADC1_BASE 0x40080000
+#define LPC_MRT_BASE 0x400A0000
+#define LPC_PIN_INT_BASE 0x400A4000
+#define LPC_GPIO_GROUP_INT0_BASE 0x400A8000
+#define LPC_GPIO_GROUP_INT1_BASE 0x400AC000
+#define LPC_RITIMER_BASE 0x400B4000
+#define LPC_SCTIPU_BASE 0x400B8000
+#define LPC_FLASH_BASE 0x400BC000
+#define LPC_USART2_BASE 0x400C0000
+#define TBD_BASE 0x400E8000
+#define LPC_C_CAN0_BASE 0x400F0000
+#define LPC_IOCON_BASE 0x400F8000
+#define LPC_EEPROM_BASE 0x400FC000
+#define LPC_GPIO_PIN_INT_BASE 0x1C000000
+#define LPC_DMA_BASE 0x1C004000
+#define LPC_USB0_BASE 0x1C00C000
+#define LPC_CRC_BASE 0x1C010000
+#define LPC_SCTLARGE_0_BASE 0x1C018000
+#define LPC_SCTLARGE_1_BASE 0x1C01C000
+#define LPC_SCTSMALL_0_BASE 0x1C020000
+#define LPC_SCTSMALL_1_BASE 0x1C024000
+
+#define LPC_PMU ((LPC_PMU_T *) LPC_PMU_BASE)
+#define LPC_IOCON ((LPC_IOCON_T *) LPC_IOCON_BASE)
+#define LPC_SYSCTL ((LPC_SYSCTL_T *) LPC_SYSCTL_BASE)
+#define LPC_SYSCON ((LPC_SYSCTL_T *) LPC_SYSCTL_BASE) /* Alias for LPC_SYSCTL */
+#define LPC_GPIO ((LPC_GPIO_T *) LPC_GPIO_PIN_INT_BASE)
+#define LPC_GPIOGROUP ((LPC_GPIOGROUPINT_T *) LPC_GPIO_GROUP_INT0_BASE)
+#define LPC_GPIO_PIN_INT ((LPC_PIN_INT_T *) LPC_PIN_INT_BASE)
+#define LPC_USART0 ((LPC_USART_T *) LPC_USART0_BASE)
+#define LPC_USART1 ((LPC_USART_T *) LPC_USART1_BASE)
+#define LPC_USART2 ((LPC_USART_T *) LPC_USART2_BASE)
+#define LPC_I2C0 ((LPC_I2C_T *) LPC_I2C_BASE)
+// #define LPC_I2C1 ((LPC_I2C_T *) LPC_I2C1_BASE)
+// #define LPC_SSP0 ((LPC_SSP_T *) LPC_SSP0_BASE)
+// #define LPC_SSP1 ((LPC_SSP_T *) LPC_SSP1_BASE)
+#define LPC_USB ((LPC_USB_T *) LPC_USB0_BASE)
+#define LPC_ADC0 ((LPC_ADC_T *) LPC_ADC0_BASE)
+#define LPC_ADC1 ((LPC_ADC_T *) LPC_ADC1_BASE)
+// #define LPC_SCT0 ((LPC_SCT_T *) LPC_SCT0_BASE)
+// #define LPC_SCT1 ((LPC_SCT_T *) LPC_SCT1_BASE)
+// #define LPC_TIMER16_0 ((LPC_TIMER_T *) LPC_TIMER16_0_BASE)
+// #define LPC_TIMER16_1 ((LPC_TIMER_T *) LPC_TIMER16_1_BASE)
+// #define LPC_TIMER32_0 ((LPC_TIMER_T *) LPC_TIMER32_0_BASE)
+// #define LPC_TIMER32_1 ((LPC_TIMER_T *) LPC_TIMER32_1_BASE)
+#define LPC_RTC ((LPC_RTC_T *) LPC_RTC_BASE)
+#define LPC_WWDT ((LPC_WWDT_T *) LPC_WWDT_BASE)
+#define LPC_DMA ((LPC_DMA_T *) LPC_DMA_BASE)
+#define LPC_CRC ((LPC_CRC_T *) LPC_CRC_BASE)
+#define LPC_FMC ((LPC_FMC_T *) LPC_FLASH_BASE)
+#define LPC_MRT ((LPC_MRT_T *) LPC_MRT_BASE)
+#define LPC_SWM ((LPC_SWM_T *) LPC_SWM_BASE)
+#define LPC_RITIMER ((LPC_RITIMER_T *) LPC_RITIMER_BASE)
+#define LPC_INMUX ((LPC_INMUX_T *) LPC_INMUX_BASE)
+#define LPC_SCTIPU ((LPC_SCTIPU_T *) LPC_SCTIPU_BASE)
+#define LPC_CMP ((LPC_CMP_T *) LPC_CMP_BASE)
+#define LPC_DAC ((LPC_DAC_T *) LPC_DAC_BASE)
+#define LPC_SPI0 ((LPC_SPI_T *) LPC_SPI0_BASE)
+#define LPC_SPI1 ((LPC_SPI_T *) LPC_SPI1_BASE)
+
+/**
+ * @}
+ */
+
+/** @ingroup CHIP_15XX_DRIVER_OPTIONS
+ * @{
+ */
+
+/**
+ * @brief System oscillator rate
+ * This value is defined externally to the chip layer and contains
+ * the value in Hz for the external oscillator for the board. If using the
+ * internal oscillator, this rate can be 0.
+ */
+extern const uint32_t OscRateIn;
+
+/**
+ * @brief RTC oscillator rate
+ * This value is defined externally to the chip layer and contains
+ * the value in Hz for the RTC oscillator for the board. This is
+ * usually 32KHz (32768). If not using the RTC, this rate can be 0.
+ */
+extern const uint32_t RTCOscRateIn;
+
+
+/**
+ * @}
+ */
+
+/* Include order is important! */
+#include "romapi_15xx.h"
+#include "sysctl_15xx.h"
+#include "clock_15xx.h"
+#include "iocon_15xx.h"
+#include "swm_15xx.h"
+#include "pmu_15xx.h"
+#include "crc_15xx.h"
+#include "gpio_15xx.h"
+#include "pinint_15xx.h"
+#include "gpiogroup_15xx.h"
+// #include "timer_11u6x.h"
+#include "uart_15xx.h"
+// #include "ssp_11u6x.h"
+#include "adc_15xx.h"
+#include "mrt_15xx.h"
+#include "ritimer_15xx.h"
+#include "dma_15xx.h"
+// #include "i2c_11u6x.h"
+#include "usbd_15xx.h"
+#include "sctipu_15xx.h"
+// #include "sct_11u6x.h"
+#include "rtc_15xx.h"
+#include "wwdt_15xx.h"
+#include "fmc_15xx.h"
+#include "inmux_15xx.h"
+#include "acmp_15xx.h"
+#include "dac_15xx.h"
+#include "spi_15xx.h"
+#include "i2cm_15xx.h"
+#include "i2cs_15xx.h"
+
+/** @defgroup SUPPORT_15XX_FUNC CHIP: LPC15xx support functions
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief Current system clock rate, mainly used for sysTick
+ */
+extern uint32_t SystemCoreClock;
+
+/**
+ * @brief Update system core clock rate, should be called if the
+ * system has a clock rate change
+ * @return None
+ */
+void SystemCoreClockUpdate(void);
+
+/**
+ * @brief Set up and initialize hardware prior to call to main()
+ * @return None
+ * @note Chip_SystemInit() is called prior to the application and sets up
+ * system clocking prior to the application starting.
+ */
+void Chip_SystemInit(void);
+
+/**
+ * @brief USB clock initialization
+ * Calling this function will initialize the USB PLL and clock divider
+ * @return None
+ * @note This function will assume that the chip is clocked by an
+ * external crystal oscillator of frequency 12MHz and the Oscillator
+ * is running.
+ */
+void Chip_USB_Init(void);
+
+/**
+ * @brief Clock and PLL initialization based on the external oscillator
+ * @return None
+ * @note This function assumes an external crystal oscillator
+ * frequency of 12MHz.
+ */
+void Chip_SetupXtalClocking(void);
+
+/**
+ * @brief Clock and PLL initialization based on the internal oscillator
+ * @return None
+ */
+void Chip_SetupIrcClocking(void);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CHIP_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/clock_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/clock_15xx.h
new file mode 100644
index 0000000..872e0cd
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/clock_15xx.h
@@ -0,0 +1,692 @@
+/*
+ * @brief LPC15XX Clock control functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __CLOCK_15XX_H_
+#define __CLOCK_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup CLOCK_15XX CHIP: LPC15xx Clock Control block driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/** Internal oscillator frequency */
+#define SYSCTL_IRC_FREQ (12000000)
+
+/** Internal watchdog oscillator frequency */
+#define SYSCTL_WDTOSC_FREQ (503000)
+
+/** @defgroup CLOCK_15XXcCHIP_SEL: Clock source selection functions
+ * These functions provide selection of clocks for system functions such as
+ * the USB clock, main system clock, or the clock output pin.
+ * @{
+ */
+
+/**
+ * Clock source selections for only the main A system clock. The main A system
+ * clock is used as an input into the main B system clock selector. Main clock A
+ * only needs to be setup if the main clock A input is used in the main clock
+ * system selector.
+ */
+typedef enum CHIP_SYSCTL_MAIN_A_CLKSRC {
+ SYSCTL_MAIN_A_CLKSRC_IRC = 0, /*!< Internal oscillator */
+ SYSCTL_MAIN_A_CLKSRCA_MAINOSC, /*!< Crystal (main) oscillator in */
+ SYSCTL_MAIN_A_CLKSRCA_SYSOSC = SYSCTL_MAIN_A_CLKSRCA_MAINOSC,
+ SYSCTL_MAIN_A_CLKSRCA_WDTOSC, /*!< Watchdog oscillator rate */
+ SYSCTL_MAIN_A_CLKSRCA_RESERVED,
+} CHIP_SYSCTL_MAIN_A_CLKSRC_T;
+
+/**
+ * @brief Set main A system clock source
+ * @param src : Clock source for main A
+ * @return Nothing
+ * @note This function only neesd to be setup if main clock A will be
+ * selected in the Chip_Clock_GetMain_B_ClockRate() function.
+ */
+STATIC INLINE void Chip_Clock_SetMain_A_ClockSource(CHIP_SYSCTL_MAIN_A_CLKSRC_T src)
+{
+ LPC_SYSCTL->MAINCLKSELA = (uint32_t) src;
+}
+
+/**
+ * @brief Returns the main A clock source
+ * @return Returns which clock is used for the main A
+ */
+STATIC INLINE CHIP_SYSCTL_MAIN_A_CLKSRC_T Chip_Clock_GetMain_A_ClockSource(void)
+{
+ return (CHIP_SYSCTL_MAIN_A_CLKSRC_T) (LPC_SYSCTL->MAINCLKSELA);
+}
+
+/**
+ * @brief Return main A clock rate
+ * @return main A clock rate in Hz
+ */
+uint32_t Chip_Clock_GetMain_A_ClockRate(void);
+
+/**
+ * Clock sources for only main B system clock
+ */
+typedef enum CHIP_SYSCTL_MAIN_B_CLKSRC {
+ SYSCTL_MAIN_B_CLKSRC_MAINCLKSELA = 0, /*!< main clock A */
+ SYSCTL_MAIN_B_CLKSRC_SYSPLLIN, /*!< System PLL input */
+ SYSCTL_MAIN_B_CLKSRC_SYSPLLOUT, /*!< System PLL output */
+ SYSCTL_MAIN_B_CLKSRC_RTC, /*!< RTC oscillator 32KHz output */
+} CHIP_SYSCTL_MAIN_B_CLKSRC_T;
+
+/**
+ * @brief Set main B system clock source
+ * @param src : Clock source for main B
+ * @return Nothing
+ */
+STATIC INLINE void Chip_Clock_SetMain_B_ClockSource(CHIP_SYSCTL_MAIN_B_CLKSRC_T src)
+{
+ LPC_SYSCTL->MAINCLKSELB = (uint32_t) src;
+}
+
+/**
+ * @brief Returns the main B clock source
+ * @return Returns which clock is used for the main B
+ */
+STATIC INLINE CHIP_SYSCTL_MAIN_B_CLKSRC_T Chip_Clock_GetMain_B_ClockSource(void)
+{
+ return (CHIP_SYSCTL_MAIN_B_CLKSRC_T) (LPC_SYSCTL->MAINCLKSELB);
+}
+
+/**
+ * @brief Return main B clock rate
+ * @return main B clock rate
+ */
+uint32_t Chip_Clock_GetMain_B_ClockRate(void);
+
+/**
+ * Clock sources for main system clock. This is a mix of both main clock A
+ * and B seelctions.
+ */
+typedef enum CHIP_SYSCTL_MAINCLKSRC {
+ SYSCTL_MAINCLKSRC_IRC = 0, /*!< Internal oscillator */
+ SYSCTL_MAINCLKSRCA_MAINOSC, /*!< Crystal (main) oscillator in */
+ SYSCTL_MAINCLKSRCA_SYSOSC = SYSCTL_MAINCLKSRCA_MAINOSC,
+ SYSCTL_MAINCLKSRCA_WDTOSC, /*!< Watchdog oscillator rate */
+ SYSCTL_MAINCLKSRC_SYSPLLIN = 5, /*!< System PLL input */
+ SYSCTL_MAINCLKSRC_SYSPLLOUT, /*!< System PLL output */
+ SYSCTL_MAINCLKSRC_RTC, /*!< RTC oscillator 32KHz output */
+} CHIP_SYSCTL_MAINCLKSRC_T;
+
+/**
+ * @brief Set main system clock source
+ * @param src : Main clock source
+ * @return Nothing
+ * @note This functions handles setup of both A and B main clock sources.
+ */
+void Chip_Clock_SetMainClockSource(CHIP_SYSCTL_MAINCLKSRC_T src);
+
+/**
+ * @brief Returns the main clock source
+ * @return Returns which clock is used for the main clock source
+ * @note This functions handles both A and B main clock sources.
+ */
+CHIP_SYSCTL_MAINCLKSRC_T Chip_Clock_GetMainClockSource(void);
+
+/**
+ * @brief Return main clock rate
+ * @return main clock rate
+ */
+uint32_t Chip_Clock_GetMainClockRate(void);
+
+/**
+ * @brief Return system clock rate
+ * @return system clock rate
+ */
+uint32_t Chip_Clock_GetSystemClockRate(void);
+
+/**
+ * Clock sources for USB (usb_clk)
+ */
+typedef enum CHIP_SYSCTL_USBCLKSRC {
+ SYSCTL_USBCLKSRC_IRC = 0, /*!< Internal oscillator */
+ SYSCTL_USBCLKSRC_MAINOSC, /*!< Crystal (main) oscillator in */
+ SYSCTL_USBCLKSRC_SYSOSC = SYSCTL_USBCLKSRC_MAINOSC,
+ SYSCTL_USBCLKSRC_PLLOUT, /*!< USB PLL out */
+ SYSCTL_USBCLKSRC_MAINSYSCLK, /*!< Main system clock (B) */
+} CHIP_SYSCTL_USBCLKSRC_T;
+
+/**
+ * @brief Set USB clock source and divider
+ * @param src : Clock source for USB
+ * @param div : divider for USB clock
+ * @return Nothing
+ * @note Use 0 to disable, or a divider value of 1 to 255. The USB clock
+ * rate is either the main system clock or USB PLL output clock divided
+ * by this value. This function will also toggle the clock source
+ * update register to update the clock source.
+ */
+STATIC INLINE void Chip_Clock_SetUSBClockSource(CHIP_SYSCTL_USBCLKSRC_T src, uint32_t div)
+{
+ LPC_SYSCTL->USBCLKSEL = (uint32_t) src;
+ LPC_SYSCTL->USBCLKDIV = div;
+}
+
+/**
+ * Clock sources for ADC asynchronous clock source select
+ */
+typedef enum CHIP_SYSCTL_ADCASYNCCLKSRC {
+ SYSCTL_ADCASYNCCLKSRC_IRC = 0, /*!< Internal oscillator */
+ SYSCTL_ADCASYNCCLKSRC_SYSPLLOUT, /*!< System PLL out */
+ SYSCTL_ADCASYNCCLKSRC_USBPLLOUT, /*!< USB PLL out */
+ SYSCTL_ADCASYNCCLKSRC_SCTPLLOUT /*!< SCT PLL out */
+} CHIP_SYSCTL_ADCASYNCCLKSRC_T;
+
+/**
+ * @brief Set the ADC asynchronous clock source
+ * @param src : ADC asynchronous clock source
+ * @return Nothing
+ */
+STATIC INLINE void Chip_Clock_SetADCASYNCSource(CHIP_SYSCTL_ADCASYNCCLKSRC_T src)
+{
+ LPC_SYSCTL->ADCASYNCCLKSEL = (uint32_t) src;
+}
+
+/**
+ * @brief Returns the ADC asynchronous clock source
+ * @return Returns which clock is used for the ADC asynchronous clock source
+ */
+STATIC INLINE CHIP_SYSCTL_ADCASYNCCLKSRC_T Chip_Clock_GetADCASYNCSource(void)
+{
+ return (CHIP_SYSCTL_ADCASYNCCLKSRC_T) (LPC_SYSCTL->ADCASYNCCLKSEL);
+}
+
+/**
+ * @brief Return ADC asynchronous clock rate
+ * @return ADC asynchronous clock rate (not including divider)
+ */
+uint32_t Chip_Clock_GetADCASYNCRate(void);
+
+/**
+ * Clock sources for CLKOUT
+ */
+typedef enum CHIP_SYSCTL_CLKOUTSRC {
+ SYSCTL_CLKOUTSRC_IRC = 0, /*!< Internal oscillator for CLKOUT */
+ SYSCTL_CLKOUTSRC_MAINOSC, /*!< Main oscillator for CLKOUT */
+ SYSCTL_CLKOUTSRC_SYSOSC = SYSCTL_CLKOUTSRC_MAINOSC,
+ SYSCTL_CLKOUTSRC_WDTOSC, /*!< Watchdog oscillator for CLKOUT */
+ SYSCTL_CLKOUTSRC_MAINSYSCLK, /*!< Main (B) system clock for CLKOUT */
+ SYSCTL_CLKOUTSRC_USBPLLOUT = 5, /*!< USB PLL out */
+ SYSCTL_CLKOUTSRC_SCTPLLOUT, /*!< SCT PLL out */
+ SYSCTL_CLKOUTSRC_RTC32K /*!< RTC 32 kHz output */
+} CHIP_SYSCTL_CLKOUTSRC_T;
+
+/**
+ * @brief Set CLKOUT clock source and divider
+ * @param src : Clock source for CLKOUT
+ * @param div : divider for CLKOUT clock
+ * @return Nothing
+ * @note Use 0 to disable, or a divider value of 1 to 255. The CLKOUT clock
+ * rate is the clock source divided by the divider. This function will
+ * also toggle the clock source update register to update the clock
+ * source.
+ */
+void Chip_Clock_SetCLKOUTSource(CHIP_SYSCTL_CLKOUTSRC_T src, uint32_t div);
+
+/**
+ * @}
+ */
+
+/** @defgroup CLOCK_15XX_CHIP_PLL: PLL setup functions
+ * @{
+ */
+
+/**
+ * Clock sources for system, USB, and SCT PLLs
+ */
+typedef enum CHIP_SYSCTL_PLLCLKSRC {
+ SYSCTL_PLLCLKSRC_IRC = 0, /*!< Internal oscillator in (may not work for USB) */
+ SYSCTL_PLLCLKSRC_MAINOSC, /*!< Crystal (main) oscillator in */
+ SYSCTL_PLLCLKSRC_SYSOSC = SYSCTL_PLLCLKSRC_MAINOSC,
+ SYSCTL_PLLCLKSRC_RESERVED1, /*!< Reserved */
+ SYSCTL_PLLCLKSRC_RESERVED2, /*!< Reserved */
+} CHIP_SYSCTL_PLLCLKSRC_T;
+
+/**
+ * @brief Set System PLL clock source
+ * @param src : Clock source for system PLL
+ * @return Nothing
+ */
+STATIC INLINE void Chip_Clock_SetSystemPLLSource(CHIP_SYSCTL_PLLCLKSRC_T src)
+{
+ LPC_SYSCTL->SYSPLLCLKSEL = (uint32_t) src;
+}
+
+/**
+ * @brief Set System PLL divider values
+ * @param msel : PLL feedback divider value. M = msel + 1.
+ * @param psel : PLL post divider value. P = (1<<psel).
+ * @return Nothing
+ * @note See the user manual for how to setup the PLL.
+ */
+STATIC INLINE void Chip_Clock_SetupSystemPLL(uint8_t msel, uint8_t psel)
+{
+ LPC_SYSCTL->SYSPLLCTRL = (msel & 0x3F) | ((psel & 0x3) << 6);
+}
+
+/**
+ * @brief Read System PLL lock status
+ * @return true of the PLL is locked. false if not locked
+ */
+STATIC INLINE bool Chip_Clock_IsSystemPLLLocked(void)
+{
+ return (bool) ((LPC_SYSCTL->SYSPLLSTAT & 1) != 0);
+}
+
+/**
+ * @brief Return System PLL input clock rate
+ * @return System PLL input clock rate
+ */
+uint32_t Chip_Clock_GetSystemPLLInClockRate(void);
+
+/**
+ * @brief Return System PLL output clock rate
+ * @return System PLL output clock rate
+ */
+uint32_t Chip_Clock_GetSystemPLLOutClockRate(void);
+
+/**
+ * @brief Set USB PLL clock source
+ * @param src : Clock source for USB PLL
+ * @return Nothing
+ */
+STATIC INLINE void Chip_Clock_SetUSBPLLSource(CHIP_SYSCTL_PLLCLKSRC_T src)
+{
+ LPC_SYSCTL->USBPLLCLKSEL = (uint32_t) src;
+}
+
+/**
+ * @brief Set USB PLL divider values
+ * @param msel : PLL feedback divider value. M = msel + 1.
+ * @param psel : PLL post divider value. P = (1<<psel).
+ * @return Nothing
+ * @note See the user manual for how to setup the PLL.
+ */
+STATIC INLINE void Chip_Clock_SetupUSBPLL(uint8_t msel, uint8_t psel)
+{
+ LPC_SYSCTL->USBPLLCTRL = (msel & 0x3F) | ((psel & 0x3) << 6);
+}
+
+/**
+ * @brief Read USB PLL lock status
+ * @return true of the PLL is locked. false if not locked
+ */
+STATIC INLINE bool Chip_Clock_IsUSBPLLLocked(void)
+{
+ return (bool) ((LPC_SYSCTL->USBPLLSTAT & 1) != 0);
+}
+
+/**
+ * @brief Return USB PLL input clock rate
+ * @return USB PLL input clock rate
+ */
+uint32_t Chip_Clock_GetUSBPLLInClockRate(void);
+
+/**
+ * @brief Return USB PLL output clock rate
+ * @return USB PLL output clock rate
+ */
+uint32_t Chip_Clock_GetUSBPLLOutClockRate(void);
+
+/**
+ * @brief Set SCT PLL clock source
+ * @param src : Clock source for SCT PLL
+ * @return Nothing
+ */
+STATIC INLINE void Chip_Clock_SetSCTPLLSource(CHIP_SYSCTL_PLLCLKSRC_T src)
+{
+ LPC_SYSCTL->SCTPLLCLKSEL = (uint32_t) src;
+}
+
+/**
+ * @brief Set SCT PLL divider values
+ * @param msel : PLL feedback divider value. M = msel + 1.
+ * @param psel : PLL post divider value. P = (1<<psel).
+ * @return Nothing
+ * @note See the user manual for how to setup the PLL.
+ */
+STATIC INLINE void Chip_Clock_SetupSCTPLL(uint8_t msel, uint8_t psel)
+{
+ LPC_SYSCTL->SCTPLLCTRL = (msel & 0x3F) | ((psel & 0x3) << 6);
+}
+
+/**
+ * @brief Read SCT PLL lock status
+ * @return true of the PLL is locked. false if not locked
+ */
+STATIC INLINE bool Chip_Clock_IsSCTPLLLocked(void)
+{
+ return (bool) ((LPC_SYSCTL->SCTPLLSTAT & 1) != 0);
+}
+
+/**
+ * @brief Return SCT PLL input clock rate
+ * @return SCT PLL input clock rate
+ */
+uint32_t Chip_Clock_GetSCTPLLInClockRate(void);
+
+/**
+ * @brief Return SCT PLL output clock rate
+ * @return SCT PLL output clock rate
+ */
+uint32_t Chip_Clock_GetSCTPLLOutClockRate(void);
+
+/**
+ * @}
+ */
+
+/** @defgroup CLOCK_15XX_CHIP_SUP: Clock support functions
+ * Functions in this group include oscillator control and rates, peripheral
+ * clock control, and peripheral dividers.
+ * @{
+ */
+
+/**
+ * @brief Set system clock divider
+ * @param div : divider for system clock
+ * @return Nothing
+ * @note Use 0 to disable, or a divider value of 1 to 255. The system clock
+ * rate is the main system clock divided by this value.
+ */
+STATIC INLINE void Chip_Clock_SetSysClockDiv(uint32_t div)
+{
+ LPC_SYSCTL->SYSAHBCLKDIV = div;
+}
+
+/**
+ * System and peripheral clocks
+ */
+typedef enum CHIP_SYSCTL_CLOCK {
+ /* Peripheral clock enables for SYSAHBCLKCTRL0 */
+ SYSCTL_CLOCK_SYS = 0, /*!< System clock */
+ SYSCTL_CLOCK_ROM, /*!< ROM clock */
+ SYSCTL_CLOCK_SRAM1 = 3, /*!< SRAM1 clock */
+ SYSCTL_CLOCK_SRAM2, /*!< SRAM2 clock */
+ SYSCTL_CLOCK_FLASH = 7, /*!< FLASH controller clock */
+ SYSCTL_CLOCK_EEPROM = 9, /*!< EEPROM controller clock */
+ SYSCTL_CLOCK_MUX = 11, /*!< Input mux clock */
+ SYSCTL_CLOCK_SWM, /*!< Switch matrix clock */
+ SYSCTL_CLOCK_IOCON, /*!< IOCON clock */
+ SYSCTL_CLOCK_GPIO0, /*!< GPIO0 clock */
+ SYSCTL_CLOCK_GPIO1, /*!< GPIO1 clock */
+ SYSCTL_CLOCK_GPIO2, /*!< GPIO2 clock */
+ SYSCTL_CLOCK_PININT = 18, /*!< PININT clock */
+ SYSCTL_CLOCK_GINT, /*!< grouped pin interrupt block clock */
+ SYSCTL_CLOCK_DMA, /*!< DMA clock */
+ SYSCTL_CLOCK_CRC, /*!< CRC clock */
+ SYSCTL_CLOCK_WDT, /*!< WDT clock */
+ SYSCTL_CLOCK_RTC, /*!< RTC clock */
+ SYSCTL_CLOCK_ADC0 = 27, /*!< ADC0 clock */
+ SYSCTL_CLOCK_ADC1, /*!< ADC1 clock */
+ SYSCTL_CLOCK_DAC, /*!< DAC clock */
+ SYSCTL_CLOCK_ACMP, /*!< ACMP clock */
+ /* Peripheral clock enables for SYSAHBCLKCTRL1 */
+ SYSCTL_CLOCK_MRT = 32, /*!< multi-rate timer clock */
+ SYSCTL_CLOCK_RIT, /*!< repetitive interrupt timer clock */
+ SYSCTL_CLOCK_SCT0, /*!< SCT0 clock */
+ SYSCTL_CLOCK_SCT1, /*!< SCT1 clock */
+ SYSCTL_CLOCK_SCT2, /*!< SCT2 clock */
+ SYSCTL_CLOCK_SCT3, /*!< SCT3 clock */
+ SYSCTL_CLOCK_SCTIPU, /*!< SCTIPU clock */
+ SYSCTL_CLOCK_CAN, /*!< CAN clock */
+ SYSCTL_CLOCK_SPI0 = 32 + 9, /*!< SPI0 clock */
+ SYSCTL_CLOCK_SPI1, /*!< SPI1 clock */
+ SYSCTL_CLOCK_I2C0 = 32 + 13, /*!< I2C0 clock */
+ SYSCTL_CLOCK_UART0 = 32 + 17, /*!< UART0 clock */
+ SYSCTL_CLOCK_UART1, /*!< UART1 clock */
+ SYSCTL_CLOCK_UART2, /*!< UART2 clock */
+ SYSCTL_CLOCK_QEI = 32 + 21, /*!< QEI clock */
+ SYSCTL_CLOCK_USB = 32 + 23, /*!< USB clock */
+} CHIP_SYSCTL_CLOCK_T;
+
+/**
+ * @brief Enable a system or peripheral clock
+ * @param clk : Clock to enable
+ * @return Nothing
+ */
+void Chip_Clock_EnablePeriphClock(CHIP_SYSCTL_CLOCK_T clk);
+
+/**
+ * @brief Disable a system or peripheral clock
+ * @param clk : Clock to disable
+ * @return Nothing
+ */
+void Chip_Clock_DisablePeriphClock(CHIP_SYSCTL_CLOCK_T clk);
+
+/**
+ * @brief Set system tick clock divider
+ * @param div : divider for system clock
+ * @return Nothing
+ * @note Use 0 to disable, or a divider value of 1 to 255. The system tick
+ * rate is the main system clock divided by this value. Use caution when using
+ * the CMSIS SysTick_Config() functions as they typically use SystemCoreClock
+ * for setup.
+ */
+STATIC INLINE void Chip_Clock_SetSysTickClockDiv(uint32_t div)
+{
+ LPC_SYSCTL->SYSTICKCLKDIV = div;
+}
+
+/**
+ * @brief Returns system tick clock divider
+ * @return system tick clock divider
+ */
+STATIC INLINE uint32_t Chip_Clock_GetSysTickClockDiv(void)
+{
+ return LPC_SYSCTL->SYSTICKCLKDIV;
+}
+
+/**
+ * @brief Returns the system tick rate as used with the system tick divider
+ * @return the system tick rate
+ */
+uint32_t Chip_Clock_GetSysTickClockRate(void);
+
+/**
+ * @brief Set IOCON glitch filter clock divider value
+ * @param div : value for IOCON filter divider
+ * @return Nothing
+ * @note Use 0 to disable, or a divider value of 1 to 255.
+ */
+STATIC INLINE void Chip_Clock_SetIOCONFiltClockDiv(uint32_t div)
+{
+ LPC_SYSCTL->IOCONCLKDIV = div;
+}
+
+/**
+ * @brief Return IOCON glitch filter clock divider value
+ * @return IOCON glitch filter clock divider value
+ */
+STATIC INLINE uint32_t Chip_Clock_GetIOCONFiltClockDiv(void)
+{
+ return LPC_SYSCTL->IOCONCLKDIV;
+}
+
+/**
+ * @brief Set Asynchronous ADC clock divider value
+ * @param div : value for UART fractional generator multiplier value
+ * @return Nothing
+ * @note Use 0 to disable, or a divider value of 1 to 255.
+ */
+STATIC INLINE void Chip_Clock_SetADCASYNCClockDiv(uint32_t div)
+{
+ LPC_SYSCTL->ADCASYNCCLKDIV = div;
+}
+
+/**
+ * @brief Return Asynchronous ADC clock divider value
+ * @return Asynchronous ADC clock divider value
+ */
+STATIC INLINE uint32_t Chip_Clock_GetADCASYNCClockDiv(void)
+{
+ return LPC_SYSCTL->ADCASYNCCLKDIV;
+}
+
+/**
+ * @brief Set UART base rate base rate (up to main clock rate) (all UARTs)
+ * @param rate : Desired rate for fractional divider/multipler output
+ * @param fEnable : true to use fractional clocking, false for integer clocking
+ * @return Actual rate generated
+ * @note All UARTs use the same base clock for their baud rate
+ * basis. This function is used to generate that clock, while the
+ * UART driver's SetBaud functions will attempt to get the closest
+ * baud rate from this base clock without altering it. This needs
+ * to be setup prior to individual UART setup.<br>
+ * UARTs need a base clock 16x faster than the baud rate, so if you
+ * need a 115.2Kbps baud rate, you will need a clock rate of at
+ * least (115.2K * 16). The UART base clock is generated from the
+ * main system clock, so fractional clocking may be the only
+ * possible choice when using a low main system clock frequency.
+ * Do not alter the FRGCTRL or UARTCLKDIV registers after this call.
+ */
+uint32_t Chip_Clock_SetUARTBaseClockRate(uint32_t rate, bool fEnable);
+
+/**
+ * @brief Get UART base rate (all UARTs)
+ * @return UART base rate in Hz
+ */
+uint32_t Chip_Clock_GetUARTBaseClockRate(void);
+
+/**
+ * @brief Set The UART Fractional Generator Divider (all UARTs)
+ * @param div : Fractional Generator Divider value, should be 0xFF
+ * @return Nothing
+ */
+STATIC INLINE void Chip_Clock_SetUARTFRGDivider(uint8_t div)
+{
+ LPC_SYSCTL->UARTCLKDIV = (uint32_t) div;
+}
+
+/**
+ * @brief Get The UART Fractional Generator Divider (all UARTs)
+ * @return Value of UART Fractional Generator Divider
+ */
+STATIC INLINE uint32_t Chip_Clock_GetUARTFRGDivider(void)
+{
+ return LPC_SYSCTL->UARTCLKDIV;
+}
+
+/**
+ * @brief Enable the RTC 32KHz output
+ * @return Nothing
+ * @note This clock can be used for the main clock directly, but
+ * do not use this clock with the system PLL.
+ */
+STATIC INLINE void Chip_Clock_EnableRTCOsc(void)
+{
+ LPC_SYSCTL->RTCOSCCTRL = 1;
+}
+
+/**
+ * @brief Disable the RTC 32KHz output
+ * @return Nothing
+ */
+STATIC INLINE void Chip_Clock_DisableRTCOsc(void)
+{
+ LPC_SYSCTL->RTCOSCCTRL = 0;
+}
+
+/**
+ * @brief Returns the main oscillator clock rate
+ * @return main oscillator clock rate in Hz
+ */
+STATIC INLINE uint32_t Chip_Clock_GetMainOscRate(void)
+{
+ return OscRateIn;
+}
+
+/**
+ * @brief Returns the internal oscillator (IRC) clock rate
+ * @return internal oscillator (IRC) clock rate in Hz
+ */
+STATIC INLINE uint32_t Chip_Clock_GetIntOscRate(void)
+{
+ return SYSCTL_IRC_FREQ;
+}
+
+/**
+ * @brief Returns the RTC clock rate
+ * @return RTC oscillator clock rate in Hz
+ */
+STATIC INLINE uint32_t Chip_Clock_GetRTCOscRate(void)
+{
+ return RTCOscRateIn;
+}
+
+/**
+ * @brief Return estimated watchdog oscillator rate
+ * @return Estimated watchdog oscillator rate
+ * @note This rate is accurate to plus or minus 40%.
+ */
+STATIC INLINE uint32_t Chip_Clock_GetWDTOSCRate(void)
+{
+ return SYSCTL_WDTOSC_FREQ;
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup CLOCK_15XX_CHIP_MISC: Misc clock functions
+ * @{
+ */
+
+/**
+ * @brief Bypass System Oscillator and set oscillator frequency range
+ * @param bypass : Flag to bypass oscillator
+ * @param highfr : Flag to set oscillator range from 15-25 MHz
+ * @return Nothing
+ * @note Sets the PLL input to bypass the oscillator. This would be
+ * used if an external clock that is not an oscillator is attached
+ * to the XTALIN pin.
+ */
+void Chip_Clock_SetPLLBypass(bool bypass, bool highfr);
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CLOCK_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/cmsis.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/cmsis.h
new file mode 100644
index 0000000..691ff19
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/cmsis.h
@@ -0,0 +1,185 @@
+/*
+ * @brief Basic CMSIS include file for LPC15xx
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __CMSIS_15XX_H_
+#define __CMSIS_15XX_H_
+
+#include "lpc_types.h"
+#include "sys_config.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup CMSIS_LPC15XX CHIP: LPC15xx CMSIS include file
+ * @ingroup CHIP_15XX_CMSIS_Drivers
+ * @{
+ */
+
+#if defined(__ARMCC_VERSION)
+// Kill warning "#pragma push with no matching #pragma pop"
+ #pragma diag_suppress 2525
+ #pragma push
+ #pragma anon_unions
+#elif defined(__CWCC__)
+ #pragma push
+ #pragma cpp_extensions on
+#elif defined(__GNUC__)
+/* anonymous unions are enabled by default */
+#elif defined(__IAR_SYSTEMS_ICC__)
+// #pragma push // FIXME not usable for IAR
+ #pragma language=extended
+#else
+ #error Not supported compiler type
+#endif
+
+/*
+ * ==========================================================================
+ * ---------- Interrupt Number Definition -----------------------------------
+ * ==========================================================================
+ */
+
+#if !defined(CHIP_LPC15XX)
+#error Incorrect or missing device variant (CHIP_LPC15XX)
+#endif
+
+/** @defgroup CMSIS_15XX_IRQ CHIP: LPC15xx peripheral interrupt numbers
+ * @{
+ */
+
+typedef enum IRQn {
+ Reset_IRQn = -15, /*!< Reset Vector, invoked on Power up and warm reset */
+ NonMaskableInt_IRQn = -14, /*!< Non maskable Interrupt, cannot be stopped or preempted */
+ HardFault_IRQn = -13, /*!< Hard Fault, all classes of Fault */
+ MemoryManagement_IRQn = -12, /*!< Memory Management, MPU mismatch, including Access Violation and No Match */
+ BusFault_IRQn = -11, /*!< Bus Fault, Pre-Fetch-, Memory Access Fault, other address/memory related Fault */
+ UsageFault_IRQn = -10, /*!< Usage Fault, i.e. Undef Instruction, Illegal State Transition */
+ SVCall_IRQn = -5, /*!< System Service Call via SVC instruction */
+ DebugMonitor_IRQn = -4, /*!< Debug Monitor */
+ PendSV_IRQn = -2, /*!< Pendable request for system service */
+ SysTick_IRQn = -1, /*!< System Tick Timer */
+
+ WDT_IRQn = 0, /*!< Watchdog timer Interrupt */
+ WWDT_IRQn = WDT_IRQn, /*!< Watchdog timer Interrupt alias for WDT_IRQn */
+ BOD_IRQn = 1, /*!< Brown Out Detect(BOD) Interrupt */
+ FMC_IRQn = 2, /*!< FLASH Interrupt */
+ FLASHEEPROM_IRQn = 3, /*!< EEPROM controller interrupt */
+ DMA_IRQn = 4, /*!< DMA Interrupt */
+ GINT0_IRQn = 5, /*!< GPIO group 0 Interrupt */
+ GINT1_IRQn = 6, /*!< GPIO group 1 Interrupt */
+ PIN_INT0_IRQn = 7, /*!< Pin Interrupt 0 */
+ PIN_INT1_IRQn = 8, /*!< Pin Interrupt 1 */
+ PIN_INT2_IRQn = 9, /*!< Pin Interrupt 2 */
+ PIN_INT3_IRQn = 10, /*!< Pin Interrupt 3 */
+ PIN_INT4_IRQn = 11, /*!< Pin Interrupt 4 */
+ PIN_INT5_IRQn = 12, /*!< Pin Interrupt 5 */
+ PIN_INT6_IRQn = 13, /*!< Pin Interrupt 6 */
+ PIN_INT7_IRQn = 14, /*!< Pin Interrupt 7 */
+ RITIMER_IRQn = 15, /*!< RITIMER interrupt */
+ SCT0_IRQn = 16, /*!< SCT0 interrupt */
+ SCT_IRQn = SCT0_IRQn, /*!< Optional alias for SCT0_IRQn */
+ SCT1_IRQn = 17, /*!< SCT1 interrupt */
+ SCT2_IRQn = 18, /*!< SCT2 interrupt */
+ SCT3_IRQn = 19, /*!< SCT3 interrupt */
+ MRT_IRQn = 20, /*!< MRT interrupt */
+ UART0_IRQn = 21, /*!< UART0 Interrupt */
+ UART1_IRQn = 22, /*!< UART1 Interrupt */
+ UART2_IRQn = 23, /*!< UART2 Interrupt */
+ I2C0_IRQn = 24, /*!< I2C0 Interrupt */
+ I2C_IRQn = I2C0_IRQn, /*!< Optional alias for I2C0_IRQn */
+ SPI0_IRQn = 25, /*!< SPI0 Interrupt */
+ SPI1_IRQn = 26, /*!< SPI1 Interrupt */
+ CAN_IRQn = 27, /*!< CAN Interrupt */
+ USB0_IRQn = 28, /*!< USB IRQ interrupt */
+ USB_IRQn = USB0_IRQn, /*!< Optional alias for USB0_IRQn */
+ USB0_FIQ_IRQn = 29, /*!< USB FIQ interrupt */
+ USB_FIQ_IRQn = USB0_FIQ_IRQn, /*!< Optional alias for USB0_FIQ_IRQn */
+ USB_WAKEUP_IRQn = 30, /*!< USB wake-up interrupt Interrupt */
+ ADC0_SEQA_IRQn = 31, /*!< ADC0_A sequencer Interrupt */
+ ADC0_A_IRQn = ADC0_SEQA_IRQn, /*!< Optional alias for ADC0_SEQA_IRQn */
+ ADC_A_IRQn = ADC0_SEQA_IRQn, /*!< Optional alias for ADC0_SEQA_IRQn */
+ ADC0_SEQB_IRQn = 32, /*!< ADC0_B sequencer Interrupt */
+ ADC0_B_IRQn = ADC0_SEQB_IRQn, /*!< Optional alias for ADC0_SEQB_IRQn */
+ ADC_B_IRQn = ADC0_SEQB_IRQn, /*!< Optional alias for ADC0_SEQB_IRQn */
+ ADC0_THCMP = 33, /*!< ADC0 threshold compare interrupt */
+ ADC0_OVR = 34, /*!< ADC0 overrun interrupt */
+ ADC1_SEQA_IRQn = 35, /*!< ADC1_A sequencer Interrupt */
+ ADC1_A_IRQn = ADC1_SEQA_IRQn, /*!< Optional alias for ADC1_SEQA_IRQn */
+ ADC1_SEQB_IRQn = 36, /*!< ADC1_B sequencer Interrupt */
+ ADC1_B_IRQn = ADC1_SEQB_IRQn, /*!< Optional alias for ADC1_SEQB_IRQn */
+ ADC1_THCMP = 37, /*!< ADC1 threshold compare interrupt */
+ ADC1_OVR = 38, /*!< ADC1 overrun interrupt */
+ DAC_IRQ = 39, /*!< DAC interrupt */
+ CMP0_IRQ = 40, /*!< Analog comparator 0 interrupt */
+ CMP_IRQn = CMP0_IRQ, /*!< Optional alias for CMP0_IRQ */
+ CMP1_IRQ = 41, /*!< Analog comparator 1 interrupt */
+ CMP2_IRQ = 42, /*!< Analog comparator 2 interrupt */
+ CMP3_IRQ = 43, /*!< Analog comparator 3 interrupt */
+ QEI_IRQn = 44, /*!< QEI interrupt */
+ RTC_ALARM_IRQn = 45, /*!< RTC alarm interrupt */
+ RTC_WAKE_IRQn = 46, /*!< RTC wake-up interrupt */
+} IRQn_Type;
+
+/**
+ * @}
+ */
+
+/*
+ * ==========================================================================
+ * ----------- Processor and Core Peripheral Section ------------------------
+ * ==========================================================================
+ */
+
+/** @defgroup CMSIS_15XX_COMMON CHIP: LPC15xx Cortex CMSIS definitions
+ * @{
+ */
+
+#define __CM3_REV 0x0201 /*!< Cortex-M3 Core Revision */
+#define __MPU_PRESENT 0 /*!< MPU present or not */
+#define __NVIC_PRIO_BITS 3 /*!< Number of Bits used for Priority Levels */
+#define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */
+#define __FPU_PRESENT 0 /*!< FPU present or not */
+
+/**
+ * @}
+ */
+
+#include "core_cm3.h" /*!< Cortex-M3 processor and core peripherals */
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CMSIS_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/core_cmFunc.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/core_cmFunc.h
new file mode 100644
index 0000000..139bc3c
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/core_cmFunc.h
@@ -0,0 +1,636 @@
+/**************************************************************************//**
+ * @file core_cmFunc.h
+ * @brief CMSIS Cortex-M Core Function Access Header File
+ * @version V3.20
+ * @date 25. February 2013
+ *
+ * @note
+ *
+ ******************************************************************************/
+/* Copyright (c) 2009 - 2013 ARM LIMITED
+
+ All rights reserved.
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ - Neither the name of ARM nor the names of its contributors may be used
+ to endorse or promote products derived from this software without
+ specific prior written permission.
+ *
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ ---------------------------------------------------------------------------*/
+
+
+#ifndef __CORE_CMFUNC_H
+#define __CORE_CMFUNC_H
+
+
+/* ########################### Core Function Access ########################### */
+/** \ingroup CMSIS_Core_FunctionInterface
+ \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
+ @{
+ */
+
+#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/
+/* ARM armcc specific functions */
+
+#if (__ARMCC_VERSION < 400677)
+ #error "Please use ARM Compiler Toolchain V4.0.677 or later!"
+#endif
+
+/* intrinsic void __enable_irq(); */
+/* intrinsic void __disable_irq(); */
+
+/** \brief Get Control Register
+
+ This function returns the content of the Control Register.
+
+ \return Control Register value
+ */
+__STATIC_INLINE uint32_t __get_CONTROL(void)
+{
+ register uint32_t __regControl __ASM("control");
+ return(__regControl);
+}
+
+
+/** \brief Set Control Register
+
+ This function writes the given value to the Control Register.
+
+ \param [in] control Control Register value to set
+ */
+__STATIC_INLINE void __set_CONTROL(uint32_t control)
+{
+ register uint32_t __regControl __ASM("control");
+ __regControl = control;
+}
+
+
+/** \brief Get IPSR Register
+
+ This function returns the content of the IPSR Register.
+
+ \return IPSR Register value
+ */
+__STATIC_INLINE uint32_t __get_IPSR(void)
+{
+ register uint32_t __regIPSR __ASM("ipsr");
+ return(__regIPSR);
+}
+
+
+/** \brief Get APSR Register
+
+ This function returns the content of the APSR Register.
+
+ \return APSR Register value
+ */
+__STATIC_INLINE uint32_t __get_APSR(void)
+{
+ register uint32_t __regAPSR __ASM("apsr");
+ return(__regAPSR);
+}
+
+
+/** \brief Get xPSR Register
+
+ This function returns the content of the xPSR Register.
+
+ \return xPSR Register value
+ */
+__STATIC_INLINE uint32_t __get_xPSR(void)
+{
+ register uint32_t __regXPSR __ASM("xpsr");
+ return(__regXPSR);
+}
+
+
+/** \brief Get Process Stack Pointer
+
+ This function returns the current value of the Process Stack Pointer (PSP).
+
+ \return PSP Register value
+ */
+__STATIC_INLINE uint32_t __get_PSP(void)
+{
+ register uint32_t __regProcessStackPointer __ASM("psp");
+ return(__regProcessStackPointer);
+}
+
+
+/** \brief Set Process Stack Pointer
+
+ This function assigns the given value to the Process Stack Pointer (PSP).
+
+ \param [in] topOfProcStack Process Stack Pointer value to set
+ */
+__STATIC_INLINE void __set_PSP(uint32_t topOfProcStack)
+{
+ register uint32_t __regProcessStackPointer __ASM("psp");
+ __regProcessStackPointer = topOfProcStack;
+}
+
+
+/** \brief Get Main Stack Pointer
+
+ This function returns the current value of the Main Stack Pointer (MSP).
+
+ \return MSP Register value
+ */
+__STATIC_INLINE uint32_t __get_MSP(void)
+{
+ register uint32_t __regMainStackPointer __ASM("msp");
+ return(__regMainStackPointer);
+}
+
+
+/** \brief Set Main Stack Pointer
+
+ This function assigns the given value to the Main Stack Pointer (MSP).
+
+ \param [in] topOfMainStack Main Stack Pointer value to set
+ */
+__STATIC_INLINE void __set_MSP(uint32_t topOfMainStack)
+{
+ register uint32_t __regMainStackPointer __ASM("msp");
+ __regMainStackPointer = topOfMainStack;
+}
+
+
+/** \brief Get Priority Mask
+
+ This function returns the current state of the priority mask bit from the Priority Mask Register.
+
+ \return Priority Mask value
+ */
+__STATIC_INLINE uint32_t __get_PRIMASK(void)
+{
+ register uint32_t __regPriMask __ASM("primask");
+ return(__regPriMask);
+}
+
+
+/** \brief Set Priority Mask
+
+ This function assigns the given value to the Priority Mask Register.
+
+ \param [in] priMask Priority Mask
+ */
+__STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
+{
+ register uint32_t __regPriMask __ASM("primask");
+ __regPriMask = (priMask);
+}
+
+
+#if (__CORTEX_M >= 0x03)
+
+/** \brief Enable FIQ
+
+ This function enables FIQ interrupts by clearing the F-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+#define __enable_fault_irq __enable_fiq
+
+
+/** \brief Disable FIQ
+
+ This function disables FIQ interrupts by setting the F-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+#define __disable_fault_irq __disable_fiq
+
+
+/** \brief Get Base Priority
+
+ This function returns the current value of the Base Priority register.
+
+ \return Base Priority register value
+ */
+__STATIC_INLINE uint32_t __get_BASEPRI(void)
+{
+ register uint32_t __regBasePri __ASM("basepri");
+ return(__regBasePri);
+}
+
+
+/** \brief Set Base Priority
+
+ This function assigns the given value to the Base Priority register.
+
+ \param [in] basePri Base Priority value to set
+ */
+__STATIC_INLINE void __set_BASEPRI(uint32_t basePri)
+{
+ register uint32_t __regBasePri __ASM("basepri");
+ __regBasePri = (basePri & 0xff);
+}
+
+
+/** \brief Get Fault Mask
+
+ This function returns the current value of the Fault Mask register.
+
+ \return Fault Mask register value
+ */
+__STATIC_INLINE uint32_t __get_FAULTMASK(void)
+{
+ register uint32_t __regFaultMask __ASM("faultmask");
+ return(__regFaultMask);
+}
+
+
+/** \brief Set Fault Mask
+
+ This function assigns the given value to the Fault Mask register.
+
+ \param [in] faultMask Fault Mask value to set
+ */
+__STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
+{
+ register uint32_t __regFaultMask __ASM("faultmask");
+ __regFaultMask = (faultMask & (uint32_t)1);
+}
+
+#endif /* (__CORTEX_M >= 0x03) */
+
+
+#if (__CORTEX_M == 0x04)
+
+/** \brief Get FPSCR
+
+ This function returns the current value of the Floating Point Status/Control register.
+
+ \return Floating Point Status/Control register value
+ */
+__STATIC_INLINE uint32_t __get_FPSCR(void)
+{
+#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
+ register uint32_t __regfpscr __ASM("fpscr");
+ return(__regfpscr);
+#else
+ return(0);
+#endif
+}
+
+
+/** \brief Set FPSCR
+
+ This function assigns the given value to the Floating Point Status/Control register.
+
+ \param [in] fpscr Floating Point Status/Control value to set
+ */
+__STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
+{
+#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
+ register uint32_t __regfpscr __ASM("fpscr");
+ __regfpscr = (fpscr);
+#endif
+}
+
+#endif /* (__CORTEX_M == 0x04) */
+
+
+#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/
+/* IAR iccarm specific functions */
+
+#include <cmsis_iar.h>
+
+
+#elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/
+/* TI CCS specific functions */
+
+#include <cmsis_ccs.h>
+
+
+#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/
+/* GNU gcc specific functions */
+
+/** \brief Enable IRQ Interrupts
+
+ This function enables IRQ interrupts by clearing the I-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_irq(void)
+{
+ __ASM volatile ("cpsie i" : : : "memory");
+}
+
+
+/** \brief Disable IRQ Interrupts
+
+ This function disables IRQ interrupts by setting the I-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_irq(void)
+{
+ __ASM volatile ("cpsid i" : : : "memory");
+}
+
+
+/** \brief Get Control Register
+
+ This function returns the content of the Control Register.
+
+ \return Control Register value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_CONTROL(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, control" : "=r" (result) );
+ return(result);
+}
+
+
+/** \brief Set Control Register
+
+ This function writes the given value to the Control Register.
+
+ \param [in] control Control Register value to set
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_CONTROL(uint32_t control)
+{
+ __ASM volatile ("MSR control, %0" : : "r" (control) : "memory");
+}
+
+
+/** \brief Get IPSR Register
+
+ This function returns the content of the IPSR Register.
+
+ \return IPSR Register value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_IPSR(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, ipsr" : "=r" (result) );
+ return(result);
+}
+
+
+/** \brief Get APSR Register
+
+ This function returns the content of the APSR Register.
+
+ \return APSR Register value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_APSR(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, apsr" : "=r" (result) );
+ return(result);
+}
+
+
+/** \brief Get xPSR Register
+
+ This function returns the content of the xPSR Register.
+
+ \return xPSR Register value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_xPSR(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, xpsr" : "=r" (result) );
+ return(result);
+}
+
+
+/** \brief Get Process Stack Pointer
+
+ This function returns the current value of the Process Stack Pointer (PSP).
+
+ \return PSP Register value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PSP(void)
+{
+ register uint32_t result;
+
+ __ASM volatile ("MRS %0, psp\n" : "=r" (result) );
+ return(result);
+}
+
+
+/** \brief Set Process Stack Pointer
+
+ This function assigns the given value to the Process Stack Pointer (PSP).
+
+ \param [in] topOfProcStack Process Stack Pointer value to set
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack)
+{
+ __ASM volatile ("MSR psp, %0\n" : : "r" (topOfProcStack) : "sp");
+}
+
+
+/** \brief Get Main Stack Pointer
+
+ This function returns the current value of the Main Stack Pointer (MSP).
+
+ \return MSP Register value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_MSP(void)
+{
+ register uint32_t result;
+
+ __ASM volatile ("MRS %0, msp\n" : "=r" (result) );
+ return(result);
+}
+
+
+/** \brief Set Main Stack Pointer
+
+ This function assigns the given value to the Main Stack Pointer (MSP).
+
+ \param [in] topOfMainStack Main Stack Pointer value to set
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack)
+{
+ __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : "sp");
+}
+
+
+/** \brief Get Priority Mask
+
+ This function returns the current state of the priority mask bit from the Priority Mask Register.
+
+ \return Priority Mask value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PRIMASK(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, primask" : "=r" (result) );
+ return(result);
+}
+
+
+/** \brief Set Priority Mask
+
+ This function assigns the given value to the Priority Mask Register.
+
+ \param [in] priMask Priority Mask
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
+{
+ __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory");
+}
+
+
+#if (__CORTEX_M >= 0x03)
+
+/** \brief Enable FIQ
+
+ This function enables FIQ interrupts by clearing the F-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_fault_irq(void)
+{
+ __ASM volatile ("cpsie f" : : : "memory");
+}
+
+
+/** \brief Disable FIQ
+
+ This function disables FIQ interrupts by setting the F-bit in the CPSR.
+ Can only be executed in Privileged modes.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_fault_irq(void)
+{
+ __ASM volatile ("cpsid f" : : : "memory");
+}
+
+
+/** \brief Get Base Priority
+
+ This function returns the current value of the Base Priority register.
+
+ \return Base Priority register value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_BASEPRI(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, basepri_max" : "=r" (result) );
+ return(result);
+}
+
+
+/** \brief Set Base Priority
+
+ This function assigns the given value to the Base Priority register.
+
+ \param [in] basePri Base Priority value to set
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_BASEPRI(uint32_t value)
+{
+ __ASM volatile ("MSR basepri, %0" : : "r" (value) : "memory");
+}
+
+
+/** \brief Get Fault Mask
+
+ This function returns the current value of the Fault Mask register.
+
+ \return Fault Mask register value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FAULTMASK(void)
+{
+ uint32_t result;
+
+ __ASM volatile ("MRS %0, faultmask" : "=r" (result) );
+ return(result);
+}
+
+
+/** \brief Set Fault Mask
+
+ This function assigns the given value to the Fault Mask register.
+
+ \param [in] faultMask Fault Mask value to set
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
+{
+ __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory");
+}
+
+#endif /* (__CORTEX_M >= 0x03) */
+
+
+#if (__CORTEX_M == 0x04)
+
+/** \brief Get FPSCR
+
+ This function returns the current value of the Floating Point Status/Control register.
+
+ \return Floating Point Status/Control register value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FPSCR(void)
+{
+#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
+ uint32_t result;
+
+ /* Empty asm statement works as a scheduling barrier */
+ __ASM volatile ("");
+ __ASM volatile ("VMRS %0, fpscr" : "=r" (result) );
+ __ASM volatile ("");
+ return(result);
+#else
+ return(0);
+#endif
+}
+
+
+/** \brief Set FPSCR
+
+ This function assigns the given value to the Floating Point Status/Control register.
+
+ \param [in] fpscr Floating Point Status/Control value to set
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
+{
+#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
+ /* Empty asm statement works as a scheduling barrier */
+ __ASM volatile ("");
+ __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc");
+ __ASM volatile ("");
+#endif
+}
+
+#endif /* (__CORTEX_M == 0x04) */
+
+
+#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/
+/* TASKING carm specific functions */
+
+/*
+ * The CMSIS functions have been implemented as intrinsics in the compiler.
+ * Please use "carm -?i" to get an up to date list of all instrinsics,
+ * Including the CMSIS ones.
+ */
+
+#endif
+
+/*@} end of CMSIS_Core_RegAccFunctions */
+
+
+#endif /* __CORE_CMFUNC_H */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/core_cmInstr.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/core_cmInstr.h
new file mode 100644
index 0000000..8946c2c
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/core_cmInstr.h
@@ -0,0 +1,688 @@
+/**************************************************************************//**
+ * @file core_cmInstr.h
+ * @brief CMSIS Cortex-M Core Instruction Access Header File
+ * @version V3.20
+ * @date 05. March 2013
+ *
+ * @note
+ *
+ ******************************************************************************/
+/* Copyright (c) 2009 - 2013 ARM LIMITED
+
+ All rights reserved.
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ - Neither the name of ARM nor the names of its contributors may be used
+ to endorse or promote products derived from this software without
+ specific prior written permission.
+ *
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ ---------------------------------------------------------------------------*/
+
+
+#ifndef __CORE_CMINSTR_H
+#define __CORE_CMINSTR_H
+
+
+/* ########################## Core Instruction Access ######################### */
+/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
+ Access to dedicated instructions
+ @{
+*/
+
+#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/
+/* ARM armcc specific functions */
+
+#if (__ARMCC_VERSION < 400677)
+ #error "Please use ARM Compiler Toolchain V4.0.677 or later!"
+#endif
+
+
+/** \brief No Operation
+
+ No Operation does nothing. This instruction can be used for code alignment purposes.
+ */
+#define __NOP __nop
+
+
+/** \brief Wait For Interrupt
+
+ Wait For Interrupt is a hint instruction that suspends execution
+ until one of a number of events occurs.
+ */
+#define __WFI __wfi
+
+
+/** \brief Wait For Event
+
+ Wait For Event is a hint instruction that permits the processor to enter
+ a low-power state until one of a number of events occurs.
+ */
+#define __WFE __wfe
+
+
+/** \brief Send Event
+
+ Send Event is a hint instruction. It causes an event to be signaled to the CPU.
+ */
+#define __SEV __sev
+
+
+/** \brief Instruction Synchronization Barrier
+
+ Instruction Synchronization Barrier flushes the pipeline in the processor,
+ so that all instructions following the ISB are fetched from cache or
+ memory, after the instruction has been completed.
+ */
+#define __ISB() __isb(0xF)
+
+
+/** \brief Data Synchronization Barrier
+
+ This function acts as a special kind of Data Memory Barrier.
+ It completes when all explicit memory accesses before this instruction complete.
+ */
+#define __DSB() __dsb(0xF)
+
+
+/** \brief Data Memory Barrier
+
+ This function ensures the apparent order of the explicit memory operations before
+ and after the instruction, without ensuring their completion.
+ */
+#define __DMB() __dmb(0xF)
+
+
+/** \brief Reverse byte order (32 bit)
+
+ This function reverses the byte order in integer value.
+
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#define __REV __rev
+
+
+/** \brief Reverse byte order (16 bit)
+
+ This function reverses the byte order in two unsigned short values.
+
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#ifndef __NO_EMBEDDED_ASM
+__attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(uint32_t value)
+{
+ rev16 r0, r0
+ bx lr
+}
+#endif
+
+/** \brief Reverse byte order in signed short value
+
+ This function reverses the byte order in a signed short value with sign extension to integer.
+
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#ifndef __NO_EMBEDDED_ASM
+__attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int32_t __REVSH(int32_t value)
+{
+ revsh r0, r0
+ bx lr
+}
+#endif
+
+
+/** \brief Rotate Right in unsigned value (32 bit)
+
+ This function Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
+
+ \param [in] value Value to rotate
+ \param [in] value Number of Bits to rotate
+ \return Rotated value
+ */
+#define __ROR __ror
+
+
+/** \brief Breakpoint
+
+ This function causes the processor to enter Debug state.
+ Debug tools can use this to investigate system state when the instruction at a particular address is reached.
+
+ \param [in] value is ignored by the processor.
+ If required, a debugger can use it to store additional information about the breakpoint.
+ */
+#define __BKPT(value) __breakpoint(value)
+
+
+#if (__CORTEX_M >= 0x03)
+
+/** \brief Reverse bit order of value
+
+ This function reverses the bit order of the given value.
+
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+#define __RBIT __rbit
+
+
+/** \brief LDR Exclusive (8 bit)
+
+ This function performs a exclusive LDR command for 8 bit value.
+
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+#define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr))
+
+
+/** \brief LDR Exclusive (16 bit)
+
+ This function performs a exclusive LDR command for 16 bit values.
+
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+#define __LDREXH(ptr) ((uint16_t) __ldrex(ptr))
+
+
+/** \brief LDR Exclusive (32 bit)
+
+ This function performs a exclusive LDR command for 32 bit values.
+
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+#define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr))
+
+
+/** \brief STR Exclusive (8 bit)
+
+ This function performs a exclusive STR command for 8 bit values.
+
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#define __STREXB(value, ptr) __strex(value, ptr)
+
+
+/** \brief STR Exclusive (16 bit)
+
+ This function performs a exclusive STR command for 16 bit values.
+
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#define __STREXH(value, ptr) __strex(value, ptr)
+
+
+/** \brief STR Exclusive (32 bit)
+
+ This function performs a exclusive STR command for 32 bit values.
+
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+#define __STREXW(value, ptr) __strex(value, ptr)
+
+
+/** \brief Remove the exclusive lock
+
+ This function removes the exclusive lock which is created by LDREX.
+
+ */
+#define __CLREX __clrex
+
+
+/** \brief Signed Saturate
+
+ This function saturates a signed value.
+
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (1..32)
+ \return Saturated value
+ */
+#define __SSAT __ssat
+
+
+/** \brief Unsigned Saturate
+
+ This function saturates an unsigned value.
+
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (0..31)
+ \return Saturated value
+ */
+#define __USAT __usat
+
+
+/** \brief Count leading zeros
+
+ This function counts the number of leading zeros of a data value.
+
+ \param [in] value Value to count the leading zeros
+ \return number of leading zeros in value
+ */
+#define __CLZ __clz
+
+#endif /* (__CORTEX_M >= 0x03) */
+
+
+
+#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/
+/* IAR iccarm specific functions */
+
+#include <cmsis_iar.h>
+
+
+#elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/
+/* TI CCS specific functions */
+
+#include <cmsis_ccs.h>
+
+
+#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/
+/* GNU gcc specific functions */
+
+/* Define macros for porting to both thumb1 and thumb2.
+ * For thumb1, use low register (r0-r7), specified by constrant "l"
+ * Otherwise, use general registers, specified by constrant "r" */
+#if defined (__thumb__) && !defined (__thumb2__)
+#define __CMSIS_GCC_OUT_REG(r) "=l" (r)
+#define __CMSIS_GCC_USE_REG(r) "l" (r)
+#else
+#define __CMSIS_GCC_OUT_REG(r) "=r" (r)
+#define __CMSIS_GCC_USE_REG(r) "r" (r)
+#endif
+
+/** \brief No Operation
+
+ No Operation does nothing. This instruction can be used for code alignment purposes.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __NOP(void)
+{
+ __ASM volatile ("nop");
+}
+
+
+/** \brief Wait For Interrupt
+
+ Wait For Interrupt is a hint instruction that suspends execution
+ until one of a number of events occurs.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __WFI(void)
+{
+ __ASM volatile ("wfi");
+}
+
+
+/** \brief Wait For Event
+
+ Wait For Event is a hint instruction that permits the processor to enter
+ a low-power state until one of a number of events occurs.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __WFE(void)
+{
+ __ASM volatile ("wfe");
+}
+
+
+/** \brief Send Event
+
+ Send Event is a hint instruction. It causes an event to be signaled to the CPU.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __SEV(void)
+{
+ __ASM volatile ("sev");
+}
+
+
+/** \brief Instruction Synchronization Barrier
+
+ Instruction Synchronization Barrier flushes the pipeline in the processor,
+ so that all instructions following the ISB are fetched from cache or
+ memory, after the instruction has been completed.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __ISB(void)
+{
+ __ASM volatile ("isb");
+}
+
+
+/** \brief Data Synchronization Barrier
+
+ This function acts as a special kind of Data Memory Barrier.
+ It completes when all explicit memory accesses before this instruction complete.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __DSB(void)
+{
+ __ASM volatile ("dsb");
+}
+
+
+/** \brief Data Memory Barrier
+
+ This function ensures the apparent order of the explicit memory operations before
+ and after the instruction, without ensuring their completion.
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __DMB(void)
+{
+ __ASM volatile ("dmb");
+}
+
+
+/** \brief Reverse byte order (32 bit)
+
+ This function reverses the byte order in integer value.
+
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __REV(uint32_t value)
+{
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
+ return __builtin_bswap32(value);
+#else
+ uint32_t result;
+
+ __ASM volatile ("rev %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
+ return(result);
+#endif
+}
+
+
+/** \brief Reverse byte order (16 bit)
+
+ This function reverses the byte order in two unsigned short values.
+
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __REV16(uint32_t value)
+{
+ uint32_t result;
+
+ __ASM volatile ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
+ return(result);
+}
+
+
+/** \brief Reverse byte order in signed short value
+
+ This function reverses the byte order in a signed short value with sign extension to integer.
+
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE int32_t __REVSH(int32_t value)
+{
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+ return (short)__builtin_bswap16(value);
+#else
+ uint32_t result;
+
+ __ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) );
+ return(result);
+#endif
+}
+
+
+/** \brief Rotate Right in unsigned value (32 bit)
+
+ This function Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
+
+ \param [in] value Value to rotate
+ \param [in] value Number of Bits to rotate
+ \return Rotated value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __ROR(uint32_t op1, uint32_t op2)
+{
+ return (op1 >> op2) | (op1 << (32 - op2));
+}
+
+
+/** \brief Breakpoint
+
+ This function causes the processor to enter Debug state.
+ Debug tools can use this to investigate system state when the instruction at a particular address is reached.
+
+ \param [in] value is ignored by the processor.
+ If required, a debugger can use it to store additional information about the breakpoint.
+ */
+#define __BKPT(value) __ASM volatile ("bkpt "#value)
+
+
+#if (__CORTEX_M >= 0x03)
+
+/** \brief Reverse bit order of value
+
+ This function reverses the bit order of the given value.
+
+ \param [in] value Value to reverse
+ \return Reversed value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
+{
+ uint32_t result;
+
+ __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) );
+ return(result);
+}
+
+
+/** \brief LDR Exclusive (8 bit)
+
+ This function performs a exclusive LDR command for 8 bit value.
+
+ \param [in] ptr Pointer to data
+ \return value of type uint8_t at (*ptr)
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint8_t __LDREXB(volatile uint8_t *addr)
+{
+ uint32_t result;
+
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+ __ASM volatile ("ldrexb %0, %1" : "=r" (result) : "Q" (*addr) );
+#else
+ /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
+ accepted by assembler. So has to use following less efficient pattern.
+ */
+ __ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
+#endif
+ return(result);
+}
+
+
+/** \brief LDR Exclusive (16 bit)
+
+ This function performs a exclusive LDR command for 16 bit values.
+
+ \param [in] ptr Pointer to data
+ \return value of type uint16_t at (*ptr)
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint16_t __LDREXH(volatile uint16_t *addr)
+{
+ uint32_t result;
+
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+ __ASM volatile ("ldrexh %0, %1" : "=r" (result) : "Q" (*addr) );
+#else
+ /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not
+ accepted by assembler. So has to use following less efficient pattern.
+ */
+ __ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) : "memory" );
+#endif
+ return(result);
+}
+
+
+/** \brief LDR Exclusive (32 bit)
+
+ This function performs a exclusive LDR command for 32 bit values.
+
+ \param [in] ptr Pointer to data
+ \return value of type uint32_t at (*ptr)
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __LDREXW(volatile uint32_t *addr)
+{
+ uint32_t result;
+
+ __ASM volatile ("ldrex %0, %1" : "=r" (result) : "Q" (*addr) );
+ return(result);
+}
+
+
+/** \brief STR Exclusive (8 bit)
+
+ This function performs a exclusive STR command for 8 bit values.
+
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr)
+{
+ uint32_t result;
+
+ __ASM volatile ("strexb %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) );
+ return(result);
+}
+
+
+/** \brief STR Exclusive (16 bit)
+
+ This function performs a exclusive STR command for 16 bit values.
+
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr)
+{
+ uint32_t result;
+
+ __ASM volatile ("strexh %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) );
+ return(result);
+}
+
+
+/** \brief STR Exclusive (32 bit)
+
+ This function performs a exclusive STR command for 32 bit values.
+
+ \param [in] value Value to store
+ \param [in] ptr Pointer to location
+ \return 0 Function succeeded
+ \return 1 Function failed
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr)
+{
+ uint32_t result;
+
+ __ASM volatile ("strex %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) );
+ return(result);
+}
+
+
+/** \brief Remove the exclusive lock
+
+ This function removes the exclusive lock which is created by LDREX.
+
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE void __CLREX(void)
+{
+ __ASM volatile ("clrex" ::: "memory");
+}
+
+
+/** \brief Signed Saturate
+
+ This function saturates a signed value.
+
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (1..32)
+ \return Saturated value
+ */
+#define __SSAT(ARG1,ARG2) \
+({ \
+ uint32_t __RES, __ARG1 = (ARG1); \
+ __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
+ __RES; \
+ })
+
+
+/** \brief Unsigned Saturate
+
+ This function saturates an unsigned value.
+
+ \param [in] value Value to be saturated
+ \param [in] sat Bit position to saturate to (0..31)
+ \return Saturated value
+ */
+#define __USAT(ARG1,ARG2) \
+({ \
+ uint32_t __RES, __ARG1 = (ARG1); \
+ __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \
+ __RES; \
+ })
+
+
+/** \brief Count leading zeros
+
+ This function counts the number of leading zeros of a data value.
+
+ \param [in] value Value to count the leading zeros
+ \return number of leading zeros in value
+ */
+__attribute__( ( always_inline ) ) __STATIC_INLINE uint8_t __CLZ(uint32_t value)
+{
+ uint32_t result;
+
+ __ASM volatile ("clz %0, %1" : "=r" (result) : "r" (value) );
+ return(result);
+}
+
+#endif /* (__CORTEX_M >= 0x03) */
+
+
+
+
+#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/
+/* TASKING carm specific functions */
+
+/*
+ * The CMSIS functions have been implemented as intrinsics in the compiler.
+ * Please use "carm -?i" to get an up to date list of all intrinsics,
+ * Including the CMSIS ones.
+ */
+
+#endif
+
+/*@}*/ /* end of group CMSIS_Core_InstructionInterface */
+
+#endif /* __CORE_CMINSTR_H */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/crc_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/crc_15xx.h
new file mode 100644
index 0000000..7d0f216
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/crc_15xx.h
@@ -0,0 +1,262 @@
+/*
+ * @brief LPC15xx Cyclic Redundancy Check (CRC) Engine driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licenser disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __CRC_15XX_H_
+#define __CRC_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup CRC_15XX CHIP: LPC15xx Cyclic Redundancy Check Engine driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief CRC register block structure
+ */
+typedef struct { /*!< CRC Structure */
+ __IO uint32_t MODE; /*!< CRC Mode Register */
+ __IO uint32_t SEED; /*!< CRC SEED Register */
+ union {
+ __I uint32_t SUM; /*!< CRC Checksum Register. */
+ __O uint32_t WRDATA32; /*!< CRC Data Register: write size 32-bit*/
+ __O uint16_t WRDATA16; /*!< CRC Data Register: write size 16-bit*/
+ __O uint8_t WRDATA8; /*!< CRC Data Register: write size 8-bit*/
+ };
+
+} LPC_CRC_T;
+
+/*
+ * @brief CRC MODE register description
+ */
+#define CRC_MODE_POLY_BITMASK ((0x03)) /** CRC polynomial Bit mask */
+#define CRC_MODE_POLY_CCITT (0x00) /** Select CRC-CCITT polynomial */
+#define CRC_MODE_POLY_CRC16 (0x01) /** Select CRC-16 polynomial */
+#define CRC_MODE_POLY_CRC32 (0x02) /** Select CRC-32 polynomial */
+#define CRC_MODE_WRDATA_BITMASK (0x03 << 2) /** CRC WR_Data Config Bit mask */
+#define CRC_MODE_WRDATA_BIT_RVS (1 << 2) /** Select Bit order reverse for WR_DATA (per byte) */
+#define CRC_MODE_WRDATA_CMPL (1 << 3) /** Select One's complement for WR_DATA */
+#define CRC_MODE_SUM_BITMASK (0x03 << 4) /** CRC Sum Config Bit mask */
+#define CRC_MODE_SUM_BIT_RVS (1 << 4) /** Select Bit order reverse for CRC_SUM */
+#define CRC_MODE_SUM_CMPL (1 << 5) /** Select One's complement for CRC_SUM */
+
+#define MODE_CFG_CCITT (0x00) /** Pre-defined mode word for default CCITT setup */
+#define MODE_CFG_CRC16 (0x15) /** Pre-defined mode word for default CRC16 setup */
+#define MODE_CFG_CRC32 (0x36) /** Pre-defined mode word for default CRC32 setup */
+
+#define CRC_SEED_CCITT (0x0000FFFF)/** Initial seed value for CCITT mode */
+#define CRC_SEED_CRC16 (0x00000000)/** Initial seed value for CRC16 mode */
+#define CRC_SEED_CRC32 (0xFFFFFFFF)/** Initial seed value for CRC32 mode */
+
+/**
+ * @brief CRC polynomial
+ */
+typedef enum IP_CRC_001_POLY {
+ CRC_POLY_CCITT = CRC_MODE_POLY_CCITT, /**< CRC-CCIT polynomial */
+ CRC_POLY_CRC16 = CRC_MODE_POLY_CRC16, /**< CRC-16 polynomial */
+ CRC_POLY_CRC32 = CRC_MODE_POLY_CRC32, /**< CRC-32 polynomial */
+ CRC_POLY_LAST,
+} CRC_POLY_T;
+
+/**
+ * @brief Initializes the CRC Engine
+ * @return Nothing
+ */
+void Chip_CRC_Init(void);
+
+/**
+ * @brief Deinitializes the CRC Engine
+ * @return Nothing
+ */
+void Chip_CRC_Deinit(void);
+
+/**
+ * @brief Set the polynomial used for the CRC calculation
+ * @param poly : The enumerated polynomial to be used
+ * @param flags : An Or'ed value of flags that setup the mode
+ * @return Nothing
+ * @note Flags for setting up the mode word include CRC_MODE_WRDATA_BIT_RVS,
+ * CRC_MODE_WRDATA_CMPL, CRC_MODE_SUM_BIT_RVS, and CRC_MODE_SUM_CMPL.
+ */
+STATIC INLINE void Chip_CRC_SetPoly(CRC_POLY_T poly, uint32_t flags)
+{
+ LPC_CRC->MODE = (uint32_t) poly | flags;
+}
+
+/**
+ * @brief Sets up the CRC engine for CRC16 mode
+ * @return Nothing
+ */
+STATIC INLINE void Chip_CRC_UseCRC16(void)
+{
+ LPC_CRC->MODE = MODE_CFG_CRC16;
+ LPC_CRC->SEED = CRC_SEED_CRC16;
+}
+
+/**
+ * @brief Sets up the CRC engine for CRC32 mode
+ * @return Nothing
+ */
+STATIC INLINE void Chip_CRC_UseCRC32(void)
+{
+ LPC_CRC->MODE = MODE_CFG_CRC32;
+ LPC_CRC->SEED = CRC_SEED_CRC32;
+}
+
+/**
+ * @brief Sets up the CRC engine for CCITT mode
+ * @return Nothing
+ */
+STATIC INLINE void Chip_CRC_UseCCITT(void)
+{
+ LPC_CRC->MODE = MODE_CFG_CCITT;
+ LPC_CRC->SEED = CRC_SEED_CCITT;
+}
+
+/**
+ * @brief Engage the CRC engine with defaults based on the polynomial to be used
+ * @param poly : The enumerated polynomial to be used
+ * @return Nothing
+ */
+void Chip_CRC_UseDefaultConfig(CRC_POLY_T poly);
+
+/**
+ * @brief Set the CRC Mode bits
+ * @param mode : Mode value
+ * @return Nothing
+ */
+STATIC INLINE void Chip_CRC_SetMode(uint32_t mode)
+{
+ LPC_CRC->MODE = mode;
+}
+
+/**
+ * @brief Get the CRC Mode bits
+ * @return The current value of the CRC Mode bits
+ */
+STATIC INLINE uint32_t Chip_CRC_GetMode(void)
+{
+ return LPC_CRC->MODE;
+}
+
+/**
+ * @brief Set the seed bits used by the CRC_SUM register
+ * @param seed : Seed value
+ * @return Nothing
+ */
+STATIC INLINE void Chip_CRC_SetSeed(uint32_t seed)
+{
+ LPC_CRC->SEED = seed;
+}
+
+/**
+ * @brief Get the CRC seed value
+ * @return Seed value
+ */
+STATIC INLINE uint32_t Chip_CRC_GetSeed(void)
+{
+ return LPC_CRC->SEED;
+}
+
+/**
+ * @brief Convenience function for writing 8-bit data to the CRC engine
+ * @param data : 8-bit data to write
+ * @return Nothing
+ */
+STATIC INLINE void Chip_CRC_Write8(uint8_t data)
+{
+ LPC_CRC->WRDATA8 = data;
+}
+
+/**
+ * @brief Convenience function for writing 16-bit data to the CRC engine
+ * @param data : 16-bit data to write
+ * @return Nothing
+ */
+STATIC INLINE void Chip_CRC_Write16(uint16_t data)
+{
+ LPC_CRC->WRDATA16 = data;
+}
+
+/**
+ * @brief Convenience function for writing 32-bit data to the CRC engine
+ * @param data : 32-bit data to write
+ * @return Nothing
+ */
+STATIC INLINE void Chip_CRC_Write32(uint32_t data)
+{
+ LPC_CRC->WRDATA32 = data;
+}
+
+/**
+ * @brief Gets the CRC Sum based on the Mode and Seed as previously configured
+ * @return CRC Checksum value
+ */
+STATIC INLINE uint32_t Chip_CRC_Sum(void)
+{
+ return LPC_CRC->SUM;
+}
+
+/**
+ * @brief Convenience function for computing a standard CCITT checksum from an 8-bit data block
+ * @param data : Pointer to the block of 8-bit data
+ * @param bytes : The number of bytes pointed to by data
+ * @return Check sum value
+ */
+uint32_t Chip_CRC_CRC8(const uint8_t *data, uint32_t bytes);
+
+/**
+ * @brief Convenience function for computing a standard CRC16 checksum from 16-bit data block
+ * @param data : Pointer to the block of 16-bit data
+ * @param hwords : The number of 16 byte entries pointed to by data
+ * @return Check sum value
+ */
+uint32_t Chip_CRC_CRC16(const uint16_t *data, uint32_t hwords);
+
+/**
+ * @brief Convenience function for computing a standard CRC32 checksum from 32-bit data block
+ * @param data : Pointer to the block of 32-bit data
+ * @param words : The number of 32-bit entries pointed to by data
+ * @return Check sum value
+ */
+uint32_t Chip_CRC_CRC32(const uint32_t *data, uint32_t words);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CRC_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/dac_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/dac_15xx.h
new file mode 100644
index 0000000..8a541fc
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/dac_15xx.h
@@ -0,0 +1,290 @@
+/*
+ * @brief LPC15xx D/A conversion driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __DAC_15XX_H_
+#define __DAC_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup DAC_15XX CHIP: LPC15xx D/A conversion driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief DAC register block structure
+ */
+typedef struct { /*!< DAC Structure */
+ __IO uint32_t VAL; /*!< DAC register. Holds the conversion data */
+ __IO uint32_t CTRL; /*!< DAC control register */
+ __IO uint32_t CNTVAL; /*!< DAC counter value register */
+} LPC_DAC_T;
+
+/** After this field is written with a
+ new VALUE, the voltage on the AOUT pin (with respect to VSSA)
+ is VALUE*((VREFP_DAC - VREFN)/4095) + VREFN */
+#define DAC_VALUE(n) ((uint32_t) ((n & 0x0FFF) << 4))
+
+/* Bit Definitions for DAC Control register */
+#define DAC_INT_DMA_FLAG (1 << 0)
+#define DAC_TRIG_SRC_MASK (0x7 << 1)
+#define DAC_TRIG_SRC_BIT (1 << 1)
+#define DAC_POLARITY (1 << 4)
+#define DAC_SYNC_BYPASS (1 << 5)
+#define DAC_TIM_ENA_BIT (1 << 6)
+#define DAC_DBLBUF_ENA (1 << 7)
+#define DAC_SHUTOFF_ENA (1 << 8)
+#define DAC_SHUTOFF_FLAG (1 << 9)
+#define DAC_DACCTRL_MASK ((uint32_t) 0xFF << 1)
+#define DAC_CTRL_UNUSED ((uint32_t) 0x7FFFF << 13)
+
+/** Value to reload interrupt/DMA timer */
+#define DAC_CNT_VALUE(n) ((uint32_t) ((n) & 0xffff))
+
+/**
+ * @brief Initial DAC configuration - Value to AOUT is 0
+ * @param pDAC : pointer to LPC_DAC_T
+ * @return Nothing
+ */
+void Chip_DAC_Init(LPC_DAC_T *pDAC);
+
+/**
+ * @brief Shutdown DAC
+ * @param pDAC : pointer to LPC_DAC_T
+ * @return Nothing
+ */
+void Chip_DAC_DeInit(LPC_DAC_T *pDAC);
+
+/**
+ * @brief Update value to DAC buffer
+ * @param pDAC : pointer to LPC_DAC_T
+ * @param dac_value : 12 bit input value for conversion
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DAC_UpdateValue(LPC_DAC_T *pDAC, uint32_t dac_value)
+{
+ pDAC->VAL = DAC_VALUE(dac_value);
+}
+
+/**
+ * @brief Get status for interrupt/DMA time out
+ * @param pDAC : pointer to LPC_DAC_T
+ * @return TRUE if interrupt/DMA flag is set else returns FALSE
+ */
+STATIC INLINE bool Chip_DAC_GetIntStatus(LPC_DAC_T *pDAC)
+{
+ return (pDAC->CTRL & DAC_INT_DMA_FLAG) != 0;
+}
+
+/**
+ * @brief Set Interrupt/DMA trigger source as Internal timer, enable timer before this call
+ * @param pDAC : pointer to LPC_DAC_T
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DAC_SetTrgSrcInternal(LPC_DAC_T *pDAC)
+{
+ pDAC->CTRL &= ~(DAC_CTRL_UNUSED | DAC_TRIG_SRC_BIT);
+}
+
+/**
+ * @brief Set Interrupt/DMA trigger source as External Pin
+ * @param pDAC : pointer to LPC_DAC_T
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DAC_SetTrgSrcExternal(LPC_DAC_T *pDAC)
+{
+ pDAC->CTRL = (pDAC->CTRL & ~DAC_CTRL_UNUSED) | DAC_TRIG_SRC_BIT;
+}
+
+/**
+ * @brief Set Polarity for external trigger pin
+ * @param pDAC : pointer to LPC_DAC_T
+ * @param falling_edge : If TRUE indicates that the trigger polarity is Falling edge
+ * else it is a Rising edge
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DAC_SetExtTriggerPolarity(LPC_DAC_T *pDAC, bool falling_edge)
+{
+ if (falling_edge) {
+ pDAC->CTRL = (pDAC->CTRL & ~DAC_CTRL_UNUSED) | DAC_POLARITY;
+ }
+ else {
+ pDAC->CTRL &= ~(DAC_CTRL_UNUSED | DAC_POLARITY );
+ }
+}
+
+/**
+ * @brief Enable Sync Bypass, only if external trigger is in sync with SysClk
+ * @param pDAC : pointer to LPC_DAC_T
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DAC_EnableSyncBypass(LPC_DAC_T *pDAC)
+{
+ pDAC->CTRL = (pDAC->CTRL & ~DAC_CTRL_UNUSED) | DAC_SYNC_BYPASS;
+}
+
+/**
+ * @brief Disable Sync Bypass
+ * @param pDAC : pointer to LPC_DAC_T
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DAC_DisableSyncBypass(LPC_DAC_T *pDAC)
+{
+ pDAC->CTRL &= ~(DAC_CTRL_UNUSED | DAC_SYNC_BYPASS);
+}
+
+/**
+ * @brief Enable Internal Timer, CNTVAL should be loaded before enabling timer
+ * @param pDAC : pointer to LPC_DAC_T
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DAC_EnableIntTimer(LPC_DAC_T *pDAC)
+{
+ pDAC->CTRL = (pDAC->CTRL & ~DAC_CTRL_UNUSED) | DAC_TIM_ENA_BIT;
+}
+
+/**
+ * @brief Disable Internal Timer
+ * @param pDAC : pointer to LPC_DAC_T
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DAC_DisableIntTimer(LPC_DAC_T *pDAC)
+{
+ pDAC->CTRL &= ~(DAC_CTRL_UNUSED | DAC_TIM_ENA_BIT);
+}
+
+/**
+ * @brief Enable DAC Double Buffer
+ * @param pDAC : pointer to LPC_DAC_T
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DAC_EnableDoubleBuffer(LPC_DAC_T *pDAC)
+{
+ pDAC->CTRL = (pDAC->CTRL & ~DAC_CTRL_UNUSED) | DAC_DBLBUF_ENA;
+}
+
+/**
+ * @brief Disable DAC Double Buffer
+ * @param pDAC : pointer to LPC_DAC_T
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DAC_DisableDoubleBuffer(LPC_DAC_T *pDAC)
+{
+ pDAC->CTRL &= ~(DAC_CTRL_UNUSED | DAC_DBLBUF_ENA);
+}
+
+/**
+ * @brief Enable DAC Shut Off
+ * @param pDAC : pointer to LPC_DAC_T
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DAC_EnableShutOff(LPC_DAC_T *pDAC)
+{
+ pDAC->CTRL = (pDAC->CTRL & ~DAC_CTRL_UNUSED) | DAC_SHUTOFF_ENA;
+}
+
+/**
+ * @brief Disable DAC Shut Off
+ * @param pDAC : pointer to LPC_DAC_T
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DAC_DisableShutOff(LPC_DAC_T *pDAC)
+{
+ pDAC->CTRL &= ~(DAC_CTRL_UNUSED | DAC_SHUTOFF_ENA);
+}
+
+/**
+ * @brief Get status of DAC Shut Off
+ * @param pDAC : pointer to LPC_DAC_T
+ * @return TRUE if DAC is shut off else returns FALSE
+ */
+STATIC INLINE bool Chip_DAC_GetShutOffStatus(LPC_DAC_T *pDAC)
+{
+ return (pDAC->CTRL & DAC_SHUTOFF_FLAG) != 0;
+}
+
+/**
+ * @brief Enables the DMA operation and controls DMA timer
+ * @param pDAC : pointer to LPC_DAC_T
+ * @param dacFlags : An Or'ed value of the following DAC values:
+ * - DAC_TRIG_SRC_BIT :set trigger source for Interrupt/DMA
+ * 0 - Internal timer trigger, 1 - External trigger
+ * - DAC_POLARITY :polarity of the trigger if it is external
+ * - DAC_SYNC_BYPASS :Synchronize selection is trigger is external
+ * - DAC_TIM_ENA_BIT :enable/disable internal timer
+ * - DAC_DBLBUF_ENA :enable/disable DAC double buffering feature
+ * - DAC_SHUTOFF_ENA :enable/disable DAC Shutoff Pin
+ * @return Nothing
+ * @note Pass an Or'ed value of the DAC flags to enable those options.
+ */
+STATIC INLINE void Chip_DAC_ConfigDMAConverterControl(LPC_DAC_T *pDAC, uint32_t dacFlags)
+{
+ uint32_t temp;
+
+ temp = pDAC->CTRL & ~(DAC_CTRL_UNUSED | DAC_DACCTRL_MASK);
+ pDAC->CTRL = temp | dacFlags;
+}
+
+/**
+ * @brief Set reload value for interrupt/DMA timer
+ * @param pDAC : pointer to LPC_DAC_T
+ * @param time_out : time out to reload for interrupt/DMA timer.
+ * time out rate will be SysClk/(time_out + 1)
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DAC_SetDMATimeOut(LPC_DAC_T *pDAC, uint32_t time_out)
+{
+ pDAC->CNTVAL = DAC_CNT_VALUE(time_out);
+}
+
+/**
+ * @brief Set reload value for interrupt/DMA timer to trigger periodic interrupts
+ * @param pDAC : pointer to LPC_DAC_T
+ * @param periodHz : Frequency of Timer interrupts in Hz
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DAC_SetReqInterval(LPC_DAC_T *pDAC, uint32_t periodHz)
+{
+ uint32_t time_out = Chip_Clock_GetSystemClockRate() / periodHz - 1;
+ pDAC->CNTVAL = DAC_CNT_VALUE(time_out);
+}
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __DAC_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/dma_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/dma_15xx.h
new file mode 100644
index 0000000..231a1a9
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/dma_15xx.h
@@ -0,0 +1,692 @@
+/*
+ * @brief LPC15xx DMA chip driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __DMA_15XX_H_
+#define __DMA_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup DMA_15XX CHIP: LPC15xx DMA Controller driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief DMA Controller shared registers structure
+ */
+typedef struct { /*!< DMA shared registers structure */
+ __IO uint32_t ENABLESET; /*!< DMA Channel Enable read and Set for all DMA channels */
+ __I uint32_t RESERVED0;
+ __O uint32_t ENABLECLR; /*!< DMA Channel Enable Clear for all DMA channels */
+ __I uint32_t RESERVED1;
+ __I uint32_t ACTIVE; /*!< DMA Channel Active status for all DMA channels */
+ __I uint32_t RESERVED2;
+ __I uint32_t BUSY; /*!< DMA Channel Busy status for all DMA channels */
+ __I uint32_t RESERVED3;
+ __IO uint32_t ERRINT; /*!< DMA Error Interrupt status for all DMA channels */
+ __I uint32_t RESERVED4;
+ __IO uint32_t INTENSET; /*!< DMA Interrupt Enable read and Set for all DMA channels */
+ __I uint32_t RESERVED5;
+ __O uint32_t INTENCLR; /*!< DMA Interrupt Enable Clear for all DMA channels */
+ __I uint32_t RESERVED6;
+ __IO uint32_t INTA; /*!< DMA Interrupt A status for all DMA channels */
+ __I uint32_t RESERVED7;
+ __IO uint32_t INTB; /*!< DMA Interrupt B status for all DMA channels */
+ __I uint32_t RESERVED8;
+ __O uint32_t SETVALID; /*!< DMA Set ValidPending control bits for all DMA channels */
+ __I uint32_t RESERVED9;
+ __O uint32_t SETTRIG; /*!< DMA Set Trigger control bits for all DMA channels */
+ __I uint32_t RESERVED10;
+ __O uint32_t ABORT; /*!< DMA Channel Abort control for all DMA channels */
+} LPC_DMA_COMMON_T;
+
+/**
+ * @brief DMA Controller shared registers structure
+ */
+typedef struct { /*!< DMA channel register structure */
+ __IO uint32_t CFG; /*!< DMA Configuration register */
+ __I uint32_t CTLSTAT; /*!< DMA Control and status register */
+ __IO uint32_t XFERCFG; /*!< DMA Transfer configuration register */
+ __I uint32_t RESERVED;
+} LPC_DMA_CHANNEL_T;
+
+/* DMA channel mapping - each channel is mapped to an individual peripheral
+ and direction or a DMA imput mux trigger */
+typedef enum {
+ DMAREQ_USART0_RX = 0, /*!< USART0 receive DMA channel */
+ DMA_CH0 = DMAREQ_USART0_RX,
+ DMAREQ_USART0_TX, /*!< USART0 transmit DMA channel */
+ DMA_CH1 = DMAREQ_USART0_TX,
+ DMAREQ_USART1_RX, /*!< USART1 receive DMA channel */
+ DMA_CH2 = DMAREQ_USART1_RX,
+ DMAREQ_USART1_TX, /*!< USART1 transmit DMA channel */
+ DMA_CH3 = DMAREQ_USART1_TX,
+ DMAREQ_USART2_RX, /*!< USART2 receive DMA channel */
+ DMA_CH4 = DMAREQ_USART2_RX,
+ DMAREQ_USART2_TX, /*!< USART2 transmit DMA channel */
+ DMA_CH5 = DMAREQ_USART2_TX,
+ DMAREQ_SPI0_RX, /*!< SSP0 receive DMA channel */
+ DMA_CH6 = DMAREQ_SPI0_RX,
+ DMAREQ_SPI0_TX, /*!< SSP0 transmit DMA channel */
+ DMA_CH7 = DMAREQ_SPI0_TX,
+ DMAREQ_SPI1_RX, /*!< SSP1 receive DMA channel */
+ DMA_CH8 = DMAREQ_SPI1_RX,
+ DMAREQ_SPI1_TX, /*!< SSP1 transmit DMA channel */
+ DMA_CH9 = DMAREQ_SPI1_TX,
+ DMAREQ_I2C0_SLV, /*!< I2C0 slave DMA channel */
+ DMA_CH10 = DMAREQ_I2C0_SLV,
+ DMAREQ_I2C0_MST, /*!< I2C0 master DMA channel */
+ DMA_CH11 = DMAREQ_I2C0_MST,
+ DMAREQ_I2C0_MONITOR, /*!< I2C0 monitor DMA channel */
+ DMA_CH12 = DMAREQ_I2C0_MONITOR,
+ DMAREQ_DAC_IRQ, /*!< DAC DMA channel */
+ DMA_CH13 = DMAREQ_DAC_IRQ,
+ DMAREQ_RESERVED_14,
+ DMA_CH14 = DMAREQ_RESERVED_14,
+ DMAREQ_RESERVED_15,
+ DMA_CH15 = DMAREQ_RESERVED_15,
+ DMAREQ_RESERVED_16,
+ DMA_CH16 = DMAREQ_RESERVED_16,
+ DMAREQ_RESERVED_17,
+ DMA_CH17 = DMAREQ_RESERVED_17
+} DMA_CHID_T;
+
+/* On LPC15xx, Max DMA channel is 18 */
+#define MAX_DMA_CHANNEL (DMA_CH17 + 1)
+
+/**
+ * @brief DMA Controller register block structure
+ */
+typedef struct { /*!< DMA Structure */
+ __IO uint32_t CTRL; /*!< DMA control register */
+ __I uint32_t INTSTAT; /*!< DMA Interrupt status register */
+ __IO uint32_t SRAMBASE; /*!< DMA SRAM address of the channel configuration table */
+ __I uint32_t RESERVED2[5];
+ LPC_DMA_COMMON_T DMACOMMON[1]; /*!< DMA shared channel (common) registers */
+ __I uint32_t RESERVED0[225];
+ LPC_DMA_CHANNEL_T DMACH[MAX_DMA_CHANNEL]; /*!< DMA channel registers */
+} LPC_DMA_T;
+
+/** @defgroup DMA_COMMONDRV_15XX CHIP: LPC15xx DMA Controller driver common functions
+ * @{
+ */
+
+/**
+ * @brief Initialize DMA controller
+ * @param pDMA : The base of DMA controller on the chip
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DMA_Init(LPC_DMA_T *pDMA)
+{
+ (void) pDMA;
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_DMA);
+ Chip_SYSCTL_PeriphReset(RESET_DMA);
+}
+
+/**
+ * @brief De-Initialize DMA controller
+ * @param pDMA : The base of DMA controller on the chip
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DMA_DeInit(LPC_DMA_T *pDMA)
+{
+ (void) pDMA;
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_DMA);
+}
+
+/**
+ * @brief Enable DMA controller
+ * @param pDMA : The base of DMA controller on the chip
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DMA_Enable(LPC_DMA_T *pDMA)
+{
+ pDMA->CTRL = 1;
+}
+
+/**
+ * @brief Disable DMA controller
+ * @param pDMA : The base of DMA controller on the chip
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DMA_Disable(LPC_DMA_T *pDMA)
+{
+ pDMA->CTRL = 0;
+}
+
+/* DMA interrupt status bits (common) */
+#define DMA_INTSTAT_ACTIVEINT 0x2 /*!< Summarizes whether any enabled interrupts are pending */
+#define DMA_INTSTAT_ACTIVEERRINT 0x4 /*!< Summarizes whether any error interrupts are pending */
+
+/**
+ * @brief Get pending interrupt or error interrupts
+ * @param pDMA : The base of DMA controller on the chip
+ * @return An Or'ed value of DMA_INTSTAT_* types
+ * @note If any DMA channels have an active interrupt or error interrupt
+ * pending, this functional will a common status that applies to all
+ * channels.
+ */
+STATIC INLINE uint32_t Chip_DMA_GetIntStatus(LPC_DMA_T *pDMA)
+{
+ return pDMA->INTSTAT;
+}
+
+/* DMA channel source/address/next descriptor */
+typedef struct {
+ uint32_t xfercfg; /*!< Transfer configuration (only used in linked lists and ping-pong configs) */
+ uint32_t source; /*!< DMA transfer source end address */
+ uint32_t dest; /*!< DMA transfer desintation end address */
+ uint32_t next; /*!< Link to next DMA descriptor, must be 16 byte aligned */
+} DMA_CHDESC_T;
+
+/* DMA SRAM table - this can be optionally used with the Chip_DMA_SetSRAMBase()
+ function if a DMA SRAM table is needed. */
+extern DMA_CHDESC_T Chip_DMA_Table[MAX_DMA_CHANNEL];
+
+/**
+ * @brief Set DMA controller SRAM base address
+ * @param pDMA : The base of DMA controller on the chip
+ * @param base : The base address where the DMA descriptors will be stored
+ * @return Nothing
+ * @note A 288 byte block of memory aligned on a 512 byte boundary must be
+ * provided for this function. It sets the base address used for
+ * DMA descriptor table (18 descriptors total that use 16 bytes each).<br>
+ *
+ * A pre-defined table with correct alignment can be used for this
+ * function by calling Chip_DMA_SetSRAMBase(LPC_DMA, DMA_ADDR(Chip_DMA_Table));
+ */
+STATIC INLINE void Chip_DMA_SetSRAMBase(LPC_DMA_T *pDMA, uint32_t base)
+{
+ pDMA->SRAMBASE = base;
+}
+
+/**
+ * @brief Returns DMA controller SRAM base address
+ * @param pDMA : The base of DMA controller on the chip
+ * @return The base address where the DMA descriptors are stored
+ */
+STATIC INLINE uint32_t Chip_DMA_GetSRAMBase(LPC_DMA_T *pDMA)
+{
+ return pDMA->SRAMBASE;
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup DMA_COMMON_15XX CHIP: LPC15xx DMA Controller driver common channel functions
+ * @{
+ */
+
+/**
+ * @brief Enables a single DMA channel
+ * @param pDMA : The base of DMA controller on the chip
+ * @param ch : DMA channel ID
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DMA_EnableChannel(LPC_DMA_T *pDMA, DMA_CHID_T ch)
+{
+ pDMA->DMACOMMON[0].ENABLESET = (1 << ch);
+}
+
+/**
+ * @brief Disables a single DMA channel
+ * @param pDMA : The base of DMA controller on the chip
+ * @param ch : DMA channel ID
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DMA_DisableChannel(LPC_DMA_T *pDMA, DMA_CHID_T ch)
+{
+ pDMA->DMACOMMON[0].ENABLECLR = (1 << ch);
+}
+
+/**
+ * @brief Returns all enabled DMA channels
+ * @param pDMA : The base of DMA controller on the chip
+ * @return An Or'ed value of all enabled DMA channels (0 - 17)
+ * @note A high values in bits 0 .. 17 in the return values indicates
+ * that the channel for that bit (bit 0 = channel 0, bit 1 -
+ * channel 1, etc.) is enabled. A low state is disabled.
+ */
+STATIC INLINE uint32_t Chip_DMA_GetEnabledChannels(LPC_DMA_T *pDMA)
+{
+ return pDMA->DMACOMMON[0].ENABLESET;
+}
+
+/**
+ * @brief Returns all active DMA channels
+ * @param pDMA : The base of DMA controller on the chip
+ * @return An Or'ed value of all active DMA channels (0 - 17)
+ * @note A high values in bits 0 .. 17 in the return values indicates
+ * that the channel for that bit (bit 0 = channel 0, bit 1 -
+ * channel 1, etc.) is active. A low state is inactive. A active
+ * channel indicates that a DMA operation has been started but
+ * not yet fully completed.
+ */
+STATIC INLINE uint32_t Chip_DMA_GetActiveChannels(LPC_DMA_T *pDMA)
+{
+ return pDMA->DMACOMMON[0].ACTIVE;
+}
+
+/**
+ * @brief Returns all busy DMA channels
+ * @param pDMA : The base of DMA controller on the chip
+ * @return An Or'ed value of all busy DMA channels (0 - 17)
+ * @note A high values in bits 0 .. 17 in the return values indicates
+ * that the channel for that bit (bit 0 = channel 0, bit 1 -
+ * channel 1, etc.) is busy. A low state is not busy. A DMA
+ * channel is considered busy when there is any operation
+ * related to that channel in the DMA controller�s internal
+ * pipeline.
+ */
+STATIC INLINE uint32_t Chip_DMA_GetBusyChannels(LPC_DMA_T *pDMA)
+{
+ return pDMA->DMACOMMON[0].BUSY;
+}
+
+/**
+ * @brief Returns pending error interrupt status for all DMA channels
+ * @param pDMA : The base of DMA controller on the chip
+ * @return An Or'ed value of all channels (0 - 17) error interrupt status
+ * @note A high values in bits 0 .. 17 in the return values indicates
+ * that the channel for that bit (bit 0 = channel 0, bit 1 -
+ * channel 1, etc.) has a pending error interrupt. A low state
+ * indicates no error interrupt.
+ */
+STATIC INLINE uint32_t Chip_DMA_GetErrorIntChannels(LPC_DMA_T *pDMA)
+{
+ return pDMA->DMACOMMON[0].ERRINT;
+}
+
+/**
+ * @brief Clears a pending error interrupt status for a single DMA channel
+ * @param pDMA : The base of DMA controller on the chip
+ * @param ch : DMA channel ID
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DMA_ClearErrorIntChannel(LPC_DMA_T *pDMA, DMA_CHID_T ch)
+{
+ pDMA->DMACOMMON[0].ERRINT = (1 << ch);
+}
+
+/**
+ * @brief Enables a single DMA channel's interrupt used in common DMA interrupt
+ * @param pDMA : The base of DMA controller on the chip
+ * @param ch : DMA channel ID
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DMA_EnableIntChannel(LPC_DMA_T *pDMA, DMA_CHID_T ch)
+{
+ pDMA->DMACOMMON[0].INTENSET = (1 << ch);
+}
+
+/**
+ * @brief Disables a single DMA channel's interrupt used in common DMA interrupt
+ * @param pDMA : The base of DMA controller on the chip
+ * @param ch : DMA channel ID
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DMA_DisableIntChannel(LPC_DMA_T *pDMA, DMA_CHID_T ch)
+{
+ pDMA->DMACOMMON[0].INTENCLR = (1 << ch);
+}
+
+/**
+ * @brief Returns all enabled interrupt channels
+ * @param pDMA : The base of DMA controller on the chip
+ * @return Nothing
+ * @note A high values in bits 0 .. 17 in the return values indicates
+ * that the channel for that bit (bit 0 = channel 0, bit 1 -
+ * channel 1, etc.) has an enabled interrupt for the channel.
+ * A low state indicates that the DMA channel will not contribute
+ * to the common DMA interrupt status.
+ */
+STATIC INLINE uint32_t Chip_DMA_GetEnableIntChannels(LPC_DMA_T *pDMA)
+{
+ return pDMA->DMACOMMON[0].INTENSET;
+}
+
+/**
+ * @brief Returns active A interrupt status for all channels
+ * @param pDMA : The base of DMA controller on the chip
+ * @return Nothing
+ * @note A high values in bits 0 .. 17 in the return values indicates
+ * that the channel for that bit (bit 0 = channel 0, bit 1 -
+ * channel 1, etc.) has an active A interrupt for the channel.
+ * A low state indicates that the A interrupt is not active.
+ */
+STATIC INLINE uint32_t Chip_DMA_GetActiveIntAChannels(LPC_DMA_T *pDMA)
+{
+ return pDMA->DMACOMMON[0].INTA;
+}
+
+/**
+ * @brief Clears active A interrupt status for a single channel
+ * @param pDMA : The base of DMA controller on the chip
+ * @param ch : DMA channel ID
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DMA_ClearActiveIntAChannel(LPC_DMA_T *pDMA, DMA_CHID_T ch)
+{
+ pDMA->DMACOMMON[0].INTA = (1 << ch);
+}
+
+/**
+ * @brief Returns active B interrupt status for all channels
+ * @param pDMA : The base of DMA controller on the chip
+ * @return Nothing
+ * @note A high values in bits 0 .. 17 in the return values indicates
+ * that the channel for that bit (bit 0 = channel 0, bit 1 -
+ * channel 1, etc.) has an active B interrupt for the channel.
+ * A low state indicates that the B interrupt is not active.
+ */
+STATIC INLINE uint32_t Chip_DMA_GetActiveIntBChannels(LPC_DMA_T *pDMA)
+{
+ return pDMA->DMACOMMON[0].INTB;
+}
+
+/**
+ * @brief Clears active B interrupt status for a single channel
+ * @param pDMA : The base of DMA controller on the chip
+ * @param ch : DMA channel ID
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DMA_ClearActiveIntBChannel(LPC_DMA_T *pDMA, DMA_CHID_T ch)
+{
+ pDMA->DMACOMMON[0].INTB = (1 << ch);
+}
+
+/**
+ * @brief Sets the VALIDPENDING control bit for a single channel
+ * @param pDMA : The base of DMA controller on the chip
+ * @param ch : DMA channel ID
+ * @return Nothing
+ * @note See the User Manual for more information for what this bit does.
+ *
+ */
+STATIC INLINE void Chip_DMA_SetValidChannel(LPC_DMA_T *pDMA, DMA_CHID_T ch)
+{
+ pDMA->DMACOMMON[0].SETVALID = (1 << ch);
+}
+
+/**
+ * @brief Sets the TRIG bit for a single channel
+ * @param pDMA : The base of DMA controller on the chip
+ * @param ch : DMA channel ID
+ * @return Nothing
+ * @note See the User Manual for more information for what this bit does.
+ */
+STATIC INLINE void Chip_DMA_SetTrigChannel(LPC_DMA_T *pDMA, DMA_CHID_T ch)
+{
+ pDMA->DMACOMMON[0].SETTRIG = (1 << ch);
+}
+
+/**
+ * @brief Aborts a DMA operation for a single channel
+ * @param pDMA : The base of DMA controller on the chip
+ * @param ch : DMA channel ID
+ * @return Nothing
+ * @note To abort a channel, the channel should first be disabled. Then wait
+ * until the channel is no longer busy by checking the corresponding
+ * bit in BUSY. Finally, abort the channel operation. This prevents the
+ * channel from restarting an incomplete operation when it is enabled
+ * again.
+ */
+STATIC INLINE void Chip_DMA_AbortChannel(LPC_DMA_T *pDMA, DMA_CHID_T ch)
+{
+ pDMA->DMACOMMON[0].ABORT = (1 << ch);
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup DMA_CHANNEL_15XX CHIP: LPC15xx DMA Controller driver channel specific functions
+ * @{
+ */
+
+/* Support macro for DMA_CHDESC_T */
+#define DMA_ADDR(addr) ((uint32_t) (addr))
+
+/* Support definitions for setting the configuration of a DMA channel. You
+ will need to get more information on these options from the User manual. */
+#define DMA_CFG_PERIPHREQEN (1 << 0) /*!< Enables Peripheral DMA requests */
+#define DMA_CFG_HWTRIGEN (1 << 1) /*!< Use hardware triggering via imput mux */
+#define DMA_CFG_TRIGPOL_LOW (0 << 4) /*!< Hardware trigger is active low or falling edge */
+#define DMA_CFG_TRIGPOL_HIGH (1 << 4) /*!< Hardware trigger is active high or rising edge */
+#define DMA_CFG_TRIGTYPE_EDGE (0 << 5) /*!< Hardware trigger is edge triggered */
+#define DMA_CFG_TRIGTYPE_LEVEL (1 << 5) /*!< Hardware trigger is level triggered */
+#define DMA_CFG_TRIGBURST_SNGL (0 << 6) /*!< Single transfer. Hardware trigger causes a single transfer */
+#define DMA_CFG_TRIGBURST_BURST (1 << 6) /*!< Burst transfer (see UM) */
+#define DMA_CFG_BURSTPOWER_1 (0 << 8) /*!< Set DMA burst size to 1 transfer */
+#define DMA_CFG_BURSTPOWER_2 (1 << 8) /*!< Set DMA burst size to 2 transfers */
+#define DMA_CFG_BURSTPOWER_4 (2 << 8) /*!< Set DMA burst size to 4 transfers */
+#define DMA_CFG_BURSTPOWER_8 (3 << 8) /*!< Set DMA burst size to 8 transfers */
+#define DMA_CFG_BURSTPOWER_16 (4 << 8) /*!< Set DMA burst size to 16 transfers */
+#define DMA_CFG_BURSTPOWER_32 (5 << 8) /*!< Set DMA burst size to 32 transfers */
+#define DMA_CFG_BURSTPOWER_64 (6 << 8) /*!< Set DMA burst size to 64 transfers */
+#define DMA_CFG_BURSTPOWER_128 (7 << 8) /*!< Set DMA burst size to 128 transfers */
+#define DMA_CFG_BURSTPOWER_256 (8 << 8) /*!< Set DMA burst size to 256 transfers */
+#define DMA_CFG_BURSTPOWER_512 (9 << 8) /*!< Set DMA burst size to 512 transfers */
+#define DMA_CFG_BURSTPOWER_1024 (10 << 8) /*!< Set DMA burst size to 1024 transfers */
+#define DMA_CFG_BURSTPOWER(n) ((n) << 8) /*!< Set DMA burst size to 2^n transfers, max n=10 */
+#define DMA_CFG_SRCBURSTWRAP (1 << 14) /*!< Source burst wrapping is enabled for this DMA channel */
+#define DMA_CFG_DSTBURSTWRAP (1 << 15) /*!< Destination burst wrapping is enabled for this DMA channel */
+#define DMA_CFG_CHPRIORITY(p) ((p) << 16) /*!< Sets DMA channel priority, min 0 (highest), max 3 (lowest) */
+
+/**
+ * @brief Setup a DMA channel configuration
+ * @param pDMA : The base of DMA controller on the chip
+ * @param ch : DMA channel ID
+ * @param cfg : An Or'ed value of DMA_CFG_* values that define the channel's configuration
+ * @return Nothing
+ * @note This function sets up all configurable options for the DMA channel.
+ * These options are usually set once for a channel and then unchanged.<br>
+ *
+ * The following example show how to configure the channel for peripheral
+ * DMA requests, burst transfer size of 1 (in 'transfers', not bytes),
+ * continuous reading of the same source address, incrementing destination
+ * address, and highest channel priority.<br>
+ * Example: Chip_DMA_SetupChannelConfig(pDMA, SSP0_RX_DMA,
+ * (DMA_CFG_PERIPHREQEN | DMA_CFG_TRIGBURST_BURST | DMA_CFG_BURSTPOWER_1 |
+ * DMA_CFG_SRCBURSTWRAP | DMA_CFG_CHPRIORITY(0)));<br>
+ *
+ * The following example show how to configure the channel for an external
+ * trigger from the imput mux with low edge polarity, a burst transfer size of 8,
+ * incrementing source and destination addresses, and lowest channel
+ * priority.<br>
+ * Example: Chip_DMA_SetupChannelConfig(pDMA, DMA_CH14,
+ * (DMA_CFG_HWTRIGEN | DMA_CFG_TRIGPOL_LOW | DMA_CFG_TRIGTYPE_EDGE |
+ * DMA_CFG_TRIGBURST_BURST | DMA_CFG_BURSTPOWER_8 |
+ * DMA_CFG_CHPRIORITY(3)));<br>
+ *
+ * For non-peripheral DMA triggering (DMA_CFG_HWTRIGEN definition), use the
+ * DMA input mux functions to configure the DMA trigger source for a DMA channel.
+ */
+STATIC INLINE void Chip_DMA_SetupChannelConfig(LPC_DMA_T *pDMA, DMA_CHID_T ch, uint32_t cfg)
+{
+ pDMA->DMACH[ch].CFG = cfg;
+}
+
+/* DMA channel control and status register definitions */
+#define DMA_CTLSTAT_VALIDPENDING (1 << 0) /*!< Valid pending flag for this channel */
+#define DMA_CTLSTAT_TRIG (1 << 2) /*!< Trigger flag. Indicates that the trigger for this channel is currently set */
+
+/**
+ * @brief Returns channel specific status flags
+ * @param pDMA : The base of DMA controller on the chip
+ * @param ch : DMA channel ID
+ * @return AN Or'ed value of DMA_CTLSTAT_VALIDPENDING and DMA_CTLSTAT_TRIG
+ */
+STATIC INLINE uint32_t Chip_DMA_GetChannelStatus(LPC_DMA_T *pDMA, DMA_CHID_T ch)
+{
+ return pDMA->DMACH[ch].CTLSTAT;
+}
+
+/* DMA channel transfer configuration registers definitions */
+#define DMA_XFERCFG_CFGVALID (1 << 0) /*!< Configuration Valid flag */
+#define DMA_XFERCFG_RELOAD (1 << 1) /*!< Indicates whether the channels control structure will be reloaded when the current descriptor is exhausted */
+#define DMA_XFERCFG_SWTRIG (1 << 2) /*!< Software Trigger */
+#define DMA_XFERCFG_CLRTRIG (1 << 3) /*!< Clear Trigger */
+#define DMA_XFERCFG_SETINTA (1 << 4) /*!< Set Interrupt flag A for this channel to fire when descriptor is complete */
+#define DMA_XFERCFG_SETINTB (1 << 5) /*!< Set Interrupt flag B for this channel to fire when descriptor is complete */
+#define DMA_XFERCFG_WIDTH_8 (0 << 8) /*!< 8-bit transfers are performed */
+#define DMA_XFERCFG_WIDTH_16 (1 << 8) /*!< 16-bit transfers are performed */
+#define DMA_XFERCFG_WIDTH_32 (2 << 8) /*!< 32-bit transfers are performed */
+#define DMA_XFERCFG_SRCINC_0 (0 << 12) /*!< DMA source address is not incremented after a transfer */
+#define DMA_XFERCFG_SRCINC_1 (1 << 12) /*!< DMA source address is incremented by 1 (width) after a transfer */
+#define DMA_XFERCFG_SRCINC_2 (2 << 12) /*!< DMA source address is incremented by 2 (width) after a transfer */
+#define DMA_XFERCFG_SRCINC_4 (3 << 12) /*!< DMA source address is incremented by 4 (width) after a transfer */
+#define DMA_XFERCFG_DSTINC_0 (0 << 14) /*!< DMA destination address is not incremented after a transfer */
+#define DMA_XFERCFG_DSTINC_1 (1 << 14) /*!< DMA destination address is incremented by 1 (width) after a transfer */
+#define DMA_XFERCFG_DSTINC_2 (2 << 14) /*!< DMA destination address is incremented by 2 (width) after a transfer */
+#define DMA_XFERCFG_DSTINC_4 (3 << 14) /*!< DMA destination address is incremented by 4 (width) after a transfer */
+#define DMA_XFERCFG_XFERCOUNT(n) ((n - 1) << 16) /*!< DMA transfer count in 'transfers', between (0)1 and (1023)1024 */
+
+/**
+ * @brief Setup a DMA channel transfer configuration
+ * @param pDMA : The base of DMA controller on the chip
+ * @param ch : DMA channel ID
+ * @param cfg : An Or'ed value of DMA_XFERCFG_* values that define the channel's transfer configuration
+ * @return Nothing
+ * @note This function sets up the transfer configuration for the DMA channel.<br>
+ *
+ * The following example show how to configure the channel's transfer for
+ * multiple transfer descriptors (ie, ping-pong), interrupt 'A' trigger on
+ * transfer descriptor completion, 128 byte size transfers, and source and
+ * destination address increment.<br>
+ * Example: Chip_DMA_SetupChannelTransfer(pDMA, SSP0_RX_DMA,
+ * (DMA_XFERCFG_CFGVALID | DMA_XFERCFG_RELOAD | DMA_XFERCFG_SETINTA |
+ * DMA_XFERCFG_WIDTH_8 | DMA_XFERCFG_SRCINC_1 | DMA_XFERCFG_DSTINC_1 |
+ * DMA_XFERCFG_XFERCOUNT(128)));<br>
+ */
+STATIC INLINE void Chip_DMA_SetupChannelTransfer(LPC_DMA_T *pDMA, DMA_CHID_T ch, uint32_t cfg)
+{
+ pDMA->DMACH[ch].XFERCFG = cfg;
+}
+
+/**
+ * @brief Set DMA transfer register interrupt bits (safe)
+ * @param pDMA : The base of DMA controller on the chip
+ * @param ch : DMA channel ID
+ * @param mask : Bits to set
+ * @return Nothing
+ * @note This function safely sets bits in the DMA channel specific XFERCFG
+ * register.
+ */
+void Chip_DMA_SetTranBits(LPC_DMA_T *pDMA, DMA_CHID_T ch, uint32_t mask);
+
+/**
+ * @brief Clear DMA transfer register interrupt bits (safe)
+ * @param pDMA : The base of DMA controller on the chip
+ * @param ch : DMA channel ID
+ * @param mask : Bits to clear
+ * @return Nothing
+ * @note This function safely clears bits in the DMA channel specific XFERCFG
+ * register.
+ */
+void Chip_DMA_ClearTranBits(LPC_DMA_T *pDMA, DMA_CHID_T ch, uint32_t mask);
+
+/**
+ * @brief Update the transfer size in an existing DMA channel transfer configuration
+ * @param pDMA : The base of DMA controller on the chip
+ * @param ch : DMA channel ID
+ * @param trans : Number of transfers to update the transfer configuration to (1 - 1023)
+ * @return Nothing
+ */
+void Chip_DMA_SetupChannelTransferSize(LPC_DMA_T *pDMA, DMA_CHID_T ch, uint32_t trans);
+
+/**
+ * @brief Sets a DMA channel configuration as valid
+ * @param pDMA : The base of DMA controller on the chip
+ * @param ch : DMA channel ID
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DMA_SetChannelValid(LPC_DMA_T *pDMA, DMA_CHID_T ch)
+{
+ Chip_DMA_SetTranBits(pDMA, ch, DMA_XFERCFG_CFGVALID);
+}
+
+/**
+ * @brief Sets a DMA channel configuration as invalid
+ * @param pDMA : The base of DMA controller on the chip
+ * @param ch : DMA channel ID
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DMA_SetChannelInValid(LPC_DMA_T *pDMA, DMA_CHID_T ch)
+{
+ Chip_DMA_ClearTranBits(pDMA, ch, DMA_XFERCFG_CFGVALID);
+}
+
+/**
+ * @brief Performs a software trigger of the DMA channel
+ * @param pDMA : The base of DMA controller on the chip
+ * @param ch : DMA channel ID
+ * @return Nothing
+ */
+STATIC INLINE void Chip_DMA_SWTriggerChannel(LPC_DMA_T *pDMA, DMA_CHID_T ch)
+{
+ Chip_DMA_SetTranBits(pDMA, ch, DMA_XFERCFG_SWTRIG);
+}
+
+/**
+ * @brief Sets up a DMA channel with the passed DMA transfer descriptor
+ * @param pDMA : The base of DMA controller on the chip
+ * @param ch : DMA channel ID
+ * @param desc : Pointer to DMA transfer descriptor
+ * @return false if the DMA channel was active, otherwise true
+ * @note This function will set the DMA descriptor in the SRAM table to the
+ * the passed descriptor. This function is only meant to be used when
+ * the DMA channel is not active and can be used to setup the
+ * initial transfer for a linked list or ping-pong buffer or just a
+ * single transfer without a next descriptor.<br>
+ *
+ * If using this function to write the initial transfer descriptor in
+ * a linked list or ping-pong buffer configuration, it should contain a
+ * non-NULL 'next' field pointer.
+ */
+bool Chip_DMA_SetupTranChannel(LPC_DMA_T *pDMA, DMA_CHID_T ch, DMA_CHDESC_T *desc);
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __DMA_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/eeprom.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/eeprom.h
new file mode 100644
index 0000000..ef718ce
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/eeprom.h
@@ -0,0 +1,70 @@
+/*
+ * @brief Common EEPROM support functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licenser disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __EEPROM_H_
+#define __EEPROM_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup COMMON_EEPROM CHIP: Common Chip EEPROM commands
+ * @ingroup CHIP_Common
+ * @{
+ */
+
+/**
+ * @brief Write data to EEPROM
+ * @param dstAdd : EEPROM address to be written to
+ * @param ptr : Pointer to buffer to write from
+ * @param byteswrt : Number of bytes to write to EEPROM
+ * @return An IAP response definition from iap.h
+ */
+uint8_t Chip_EEPROM_Write(uint32_t dstAdd, uint8_t *ptr, uint32_t byteswrt);
+
+/**
+ * @brief Read data from EEPROM
+ * @param srcAdd : EEPROM address to be read from
+ * @param ptr : Pointer to buffer to read to
+ * @param bytesrd : Number of bytes to read from EEPROM
+ * @return An IAP response definition from iap.h
+ */
+uint8_t Chip_EEPROM_Read(uint32_t srcAdd, uint8_t *ptr, uint32_t bytesrd);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __EEPROM_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/error.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/error.h
new file mode 100644
index 0000000..a75650e
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/error.h
@@ -0,0 +1,184 @@
+/*
+ * @brief Error code returned by Boot ROM drivers/library functions
+ * @ingroup Common
+ *
+ * This file contains unified error codes to be used across driver,
+ * middleware, applications, hal and demo software.
+ *
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2012
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __LPC_ERROR_H__
+#define __LPC_ERROR_H__
+
+/** Error code returned by Boot ROM drivers/library functions
+ *
+ * Error codes are a 32-bit value with :
+ * - The 16 MSB contains the peripheral code number
+ * - The 16 LSB contains an error code number associated to that peripheral
+ *
+ */
+typedef enum {
+ /**\b 0x00000000*/ LPC_OK = 0, /**< enum value returned on Success */
+ /**\b 0xFFFFFFFF*/ ERR_FAILED = -1, /**< enum value returned on general failure */
+ /**\b 0xFFFFFFFE*/ ERR_TIME_OUT = -2, /**< enum value returned on general timeout */
+ /**\b 0xFFFFFFFD*/ _ERR_BUSY = -3, /**< enum value returned when resource is busy */
+
+ /* ISP related errors */
+ ERR_ISP_BASE = 0x00000000,
+ /*0x00000001*/ ERR_ISP_INVALID_COMMAND = ERR_ISP_BASE + 1,
+ /*0x00000002*/ ERR_ISP_SRC_ADDR_ERROR, /* Source address not on word boundary */
+ /*0x00000003*/ ERR_ISP_DST_ADDR_ERROR, /* Destination address not on word or 256 byte boundary */
+ /*0x00000004*/ ERR_ISP_SRC_ADDR_NOT_MAPPED,
+ /*0x00000005*/ ERR_ISP_DST_ADDR_NOT_MAPPED,
+ /*0x00000006*/ ERR_ISP_COUNT_ERROR, /* Byte count is not multiple of 4 or is not a permitted value */
+ /*0x00000007*/ ERR_ISP_INVALID_SECTOR,
+ /*0x00000008*/ ERR_ISP_SECTOR_NOT_BLANK,
+ /*0x00000009*/ ERR_ISP_SECTOR_NOT_PREPARED_FOR_WRITE_OPERATION,
+ /*0x0000000A*/ ERR_ISP_COMPARE_ERROR,
+ /*0x0000000B*/ ERR_ISP_BUSY,/* Flash programming hardware interface is busy */
+ /*0x0000000C*/ ERR_ISP_PARAM_ERROR, /* Insufficient number of parameters */
+ /*0x0000000D*/ ERR_ISP_ADDR_ERROR, /* Address not on word boundary */
+ /*0x0000000E*/ ERR_ISP_ADDR_NOT_MAPPED,
+ /*0x0000000F*/ ERR_ISP_CMD_LOCKED, /* Command is locked */
+ /*0x00000010*/ ERR_ISP_INVALID_CODE,/* Unlock code is invalid */
+ /*0x00000011*/ ERR_ISP_INVALID_BAUD_RATE,
+ /*0x00000012*/ ERR_ISP_INVALID_STOP_BIT,
+ /*0x00000013*/ ERR_ISP_CODE_READ_PROTECTION_ENABLED,
+
+ /* ROM API related errors */
+ ERR_API_BASE = 0x00010000,
+ /**\b 0x00010001*/ ERR_API_INVALID_PARAMS = ERR_API_BASE + 1, /**< Invalid parameters*/
+ /**\b 0x00010002*/ ERR_API_INVALID_PARAM1, /**< PARAM1 is invalid */
+ /**\b 0x00010003*/ ERR_API_INVALID_PARAM2, /**< PARAM2 is invalid */
+ /**\b 0x00010004*/ ERR_API_INVALID_PARAM3, /**< PARAM3 is invalid */
+ /**\b 0x00010005*/ ERR_API_MOD_INIT,/**< API is called before module init */
+
+ /* SPIFI API related errors */
+ ERR_SPIFI_BASE = 0x00020000,
+ /*0x00020001*/ ERR_SPIFI_DEVICE_ERROR = ERR_SPIFI_BASE + 1,
+ /*0x00020002*/ ERR_SPIFI_INTERNAL_ERROR,
+ /*0x00020003*/ ERR_SPIFI_TIMEOUT,
+ /*0x00020004*/ ERR_SPIFI_OPERAND_ERROR,
+ /*0x00020005*/ ERR_SPIFI_STATUS_PROBLEM,
+ /*0x00020006*/ ERR_SPIFI_UNKNOWN_EXT,
+ /*0x00020007*/ ERR_SPIFI_UNKNOWN_ID,
+ /*0x00020008*/ ERR_SPIFI_UNKNOWN_TYPE,
+ /*0x00020009*/ ERR_SPIFI_UNKNOWN_MFG,
+
+ /* Security API related errors */
+ ERR_SEC_BASE = 0x00030000,
+ /*0x00030001*/ ERR_SEC_AES_WRONG_CMD = ERR_SEC_BASE + 1,
+ /*0x00030002*/ ERR_SEC_AES_NOT_SUPPORTED,
+ /*0x00030003*/ ERR_SEC_AES_KEY_ALREADY_PROGRAMMED,
+
+ /* USB device stack related errors */
+ ERR_USBD_BASE = 0x00040000,
+ /**\b 0x00040001*/ ERR_USBD_INVALID_REQ = ERR_USBD_BASE + 1,/**< invalid request */
+ /**\b 0x00040002*/ ERR_USBD_UNHANDLED, /**< Callback did not process the event */
+ /**\b 0x00040003*/ ERR_USBD_STALL, /**< Stall the endpoint on which the call back is called */
+ /**\b 0x00040004*/ ERR_USBD_SEND_ZLP, /**< Send ZLP packet on the endpoint on which the call back is called */
+ /**\b 0x00040005*/ ERR_USBD_SEND_DATA, /**< Send data packet on the endpoint on which the call back is called */
+ /**\b 0x00040006*/ ERR_USBD_BAD_DESC, /**< Bad descriptor*/
+ /**\b 0x00040007*/ ERR_USBD_BAD_CFG_DESC, /**< Bad config descriptor*/
+ /**\b 0x00040008*/ ERR_USBD_BAD_INTF_DESC, /**< Bad interface descriptor*/
+ /**\b 0x00040009*/ ERR_USBD_BAD_EP_DESC,/**< Bad endpoint descriptor*/
+ /**\b 0x0004000a*/ ERR_USBD_BAD_MEM_BUF,/**< Bad alignment of buffer passed. */
+ /**\b 0x0004000b*/ ERR_USBD_TOO_MANY_CLASS_HDLR,/**< Too many class handlers. */
+
+ /* CGU related errors */
+ ERR_CGU_BASE = 0x00050000,
+ /*0x00050001*/ ERR_CGU_NOT_IMPL = ERR_CGU_BASE + 1,
+ /*0x00050002*/ ERR_CGU_INVALID_PARAM,
+ /*0x00050003*/ ERR_CGU_INVALID_SLICE,
+ /*0x00050004*/ ERR_CGU_OUTPUT_GEN,
+ /*0x00050005*/ ERR_CGU_DIV_SRC,
+ /*0x00050006*/ ERR_CGU_DIV_VAL,
+ /*0x00050007*/ ERR_CGU_SRC,
+
+ /* I2C related errors */
+ ERR_I2C_BASE = 0x00060000,
+ /*0x00060001*/ ERR_I2C_NAK = ERR_I2C_BASE + 1,
+ /*0x00060002*/ ERR_I2C_BUFFER_OVERFLOW,
+ /*0x00060003*/ ERR_I2C_BYTE_COUNT_ERR,
+ /*0x00060004*/ ERR_I2C_LOSS_OF_ARBRITRATION,
+ /*0x00060005*/ ERR_I2C_SLAVE_NOT_ADDRESSED,
+ /*0x00060006*/ ERR_I2C_LOSS_OF_ARBRITRATION_NAK_BIT,
+ /*0x00060007*/ ERR_I2C_GENERAL_FAILURE,
+ /*0x00060008*/ ERR_I2C_REGS_SET_TO_DEFAULT,
+ /*0x00060009*/ ERR_I2C_TIMEOUT,
+ /*0x0006000A*/ ERR_I2C_BUFFER_UNDERFLOW,
+
+ /* UART related errors */
+ ERR_UART_BASE = 0x00080000,
+ /**\b 0x00080001*/ ERR_UART_RXD_BUSY = ERR_UART_BASE + 1, /*!< Receive is busy */
+ /**\b 0x00080002*/ ERR_UART_TXD_BUSY, /*!< Transmit is busy */
+ /**\b 0x00080003*/ ERR_UART_OVERRUN_FRAME_PARITY_NOISE, /*!< Overrun, Frame, Parity , Receive Noise error */
+ /**\b 0x00080004*/ ERR_UART_UNDERRUN, /*!< Underrun */
+ /**\b 0x00080005*/ ERR_UART_PARAM, /*!< Parameter error */
+
+ ERR_DMA_BASE = 0x000D0000,
+ /*0x000D0001*/ ERR_DMA_ERROR_INT = ERR_DMA_BASE + 1,
+ /*0x000D0002*/ ERR_DMA_CHANNEL_NUMBER,
+ /*0x000D0003*/ ERR_DMA_CHANNEL_DISABLED,
+ /*0x000D0004*/ ERR_DMA_BUSY,
+ /*0x000D0005*/ ERR_DMA_NOT_ALIGNMENT,
+ /*0x000D0006*/ ERR_DMA_PING_PONG_EN,
+ /*0x000D0007*/ ERR_DMA_CHANNEL_VALID_PENDING,
+
+ /* SPI related errors */
+ ERR_SPI_BASE = 0x000E0000,
+ /*0x000E0001*/ ERR_SPI_RXOVERRUN=ERR_SPI_BASE+1,
+ /*0x000E0002*/ ERR_SPI_TXUNDERRUN,
+ /*0x000E0003*/ ERR_SPI_SELNASSERT,
+ /*0x000E0004*/ ERR_SPI_SELNDEASSERT,
+ /*0x000E0005*/ ERR_SPI_CLKSTALL,
+ /*0x000E0006*/ ERR_SPI_PARAM,
+ /*0x000E0007*/ ERR_SPI_INVALID_LENGTH,
+
+ /* ADC related errors */
+ ERR_ADC_BASE = 0x000F0000,
+ /*0x000F0001*/ ERR_ADC_OVERRUN = ERR_ADC_BASE + 1,
+ /*0x000F0002*/ ERR_ADC_INVALID_CHANNEL,
+ /*0x000F0003*/ ERR_ADC_INVALID_SEQUENCE,
+ /*0x000F0004*/ ERR_ADC_INVALID_SETUP,
+ /*0x000F0005*/ ERR_ADC_PARAM,
+ /*0x000F0006*/ ERR_ADC_INVALID_LENGTH,
+ /*0x000F0007*/ ERR_ADC_NO_POWER
+} ErrorCode_t;
+
+#ifndef offsetof
+#define offsetof(s, m) (int) &(((s *) 0)->m)
+#endif
+
+#define COMPILE_TIME_ASSERT(pred) switch (0) { \
+ case 0: \
+ case pred:; }
+
+#endif /* __LPC_ERROR_H__ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/fmc_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/fmc_15xx.h
new file mode 100644
index 0000000..d14b20c
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/fmc_15xx.h
@@ -0,0 +1,116 @@
+/*
+ * @brief FLASH Memory Controller (FMC) registers and control functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __FMC_15XX_H_
+#define __FMC_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup FMC_15XX CHIP: LPC15xx FLASH Memory Controller driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief FLASH Memory Controller Unit register block structure
+ */
+typedef struct { /*!< FMC Structure */
+ __I uint32_t RESERVED1[7];
+ __IO uint32_t FMSSTART;
+ __IO uint32_t FMSSTOP;
+ __I uint32_t RESERVED2;
+ __I uint32_t FMSW[1];
+} LPC_FMC_T;
+
+/* Flash signature start and busy status bit */
+#define FMC_FLASHSIG_BUSY (1UL << 17)
+
+/**
+ * @brief Start computation of a signature for a FLASH memory range
+ * @param start : Starting FLASH address for computation, must be aligned on 16 byte boundary
+ * @param stop : Ending FLASH address for computation, must be aligned on 16 byte boundary
+ * @return Nothing
+ * @note Only bits 20..4 are used for the FLASH signature computation.
+ * Use the Chip_FMC_IsSignatureBusy() function to determine when the
+ * signature computation operation is complete and use the
+ * Chip_FMC_GetSignature() function to get the computed signature.
+ */
+STATIC INLINE void Chip_FMC_ComputeSignature(uint32_t start, uint32_t stop)
+{
+ LPC_FMC->FMSSTART = (start >> 4);
+ LPC_FMC->FMSSTOP = (stop >> 4) | FMC_FLASHSIG_BUSY;
+}
+
+/**
+ * @brief Start computation of a signature for a FLASH memory address and block count
+ * @param start : Starting FLASH address for computation, must be aligned on 16 byte boundary
+ * @param blocks : Number of 16 byte blocks used for computation
+ * @return Nothing
+ * @note Only bits 20..4 are used for the FLASH signature computation.
+ * Use the Chip_FMC_IsSignatureBusy() function to determine when the
+ * signature computation operation is complete and the
+ * Chip_FMC_GetSignature() function to get the computed signature.
+ */
+STATIC INLINE void Chip_FMC_ComputeSignatureBlocks(uint32_t start, uint32_t blocks)
+{
+ Chip_FMC_ComputeSignature(start, (start + (blocks * 16)));
+}
+
+/**
+ * @brief Check for signature geenration completion
+ * @return true if the signature computation is running, false if finished
+ */
+STATIC INLINE bool Chip_FMC_IsSignatureBusy(void)
+{
+ return (bool) ((LPC_FMC->FMSSTOP & FMC_FLASHSIG_BUSY) != 0);
+}
+
+/**
+ * @brief Returns the generated FLASH signature value
+ * @param index : Not used, must be 0
+ * @return the generated FLASH signature value
+ */
+STATIC INLINE uint32_t Chip_FMC_GetSignature(int index)
+{
+ return LPC_FMC->FMSW[index];
+}
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __FMC_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/gpio_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/gpio_15xx.h
new file mode 100644
index 0000000..7f38aa8
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/gpio_15xx.h
@@ -0,0 +1,471 @@
+/*
+ * @brief LPC15xx GPIO driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __GPIO_15XX_H_
+#define __GPIO_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup GPIO_15XX CHIP: LPC15xx GPIO driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief GPIO port register block structure
+ */
+typedef struct { /*!< GPIO_PORT Structure */
+ __IO uint8_t B[128][32]; /*!< Offset 0x0000: Byte pin registers ports 0 to n; pins PIOn_0 to PIOn_31 */
+ __IO uint32_t W[32][32]; /*!< Offset 0x1000: Word pin registers port 0 to n */
+ __IO uint32_t DIR[32]; /*!< Offset 0x2000: Direction registers port n */
+ __IO uint32_t MASK[32]; /*!< Offset 0x2080: Mask register port n */
+ __IO uint32_t PIN[32]; /*!< Offset 0x2100: Portpin register port n */
+ __IO uint32_t MPIN[32]; /*!< Offset 0x2180: Masked port register port n */
+ __IO uint32_t SET[32]; /*!< Offset 0x2200: Write: Set register for port n Read: output bits for port n */
+ __O uint32_t CLR[32]; /*!< Offset 0x2280: Clear port n */
+ __O uint32_t NOT[32]; /*!< Offset 0x2300: Toggle port n */
+} LPC_GPIO_T;
+
+/**
+ * @brief Initialize GPIO block
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @return Nothing
+ */
+void Chip_GPIO_Init(LPC_GPIO_T *pGPIO);
+
+/**
+ * @brief De-Initialize GPIO block
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @return Nothing
+ */
+void Chip_GPIO_DeInit(LPC_GPIO_T *pGPIO);
+
+/**
+ * @brief Set a GPIO port/bit state
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO port to set
+ * @param pin : GPIO pin to set
+ * @param setting : true for high, false for low
+ * @return Nothing
+ */
+STATIC INLINE void Chip_GPIO_WritePortBit(LPC_GPIO_T *pGPIO, uint32_t port, uint8_t pin, bool setting)
+{
+ pGPIO->B[port][pin] = setting;
+}
+
+/**
+ * @brief Set a GPIO pin state via the GPIO byte register
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO Port number where @a pin is located
+ * @param pin : GPIO pin to set
+ * @param setting : true for high, false for low
+ * @return Nothing
+ * @note This function replaces Chip_GPIO_WritePortBit()
+ */
+STATIC INLINE void Chip_GPIO_SetPinState(LPC_GPIO_T *pGPIO, uint8_t port, uint8_t pin, bool setting)
+{
+ pGPIO->B[port][pin] = setting;
+}
+
+/**
+ * @brief Read a GPIO state
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO port to read
+ * @param pin : GPIO pin to read
+ * @return true of the GPIO is high, false if low
+ * @note It is recommended to use the Chip_GPIO_GetPinState() function instead.
+ */
+STATIC INLINE bool Chip_GPIO_ReadPortBit(LPC_GPIO_T *pGPIO, uint32_t port, uint8_t pin)
+{
+ return (bool) pGPIO->B[port][pin];
+}
+
+/**
+ * @brief Get a GPIO pin state via the GPIO byte register
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO Port number where @a pin is located
+ * @param pin : GPIO pin to get state for
+ * @return true if the GPIO is high, false if low
+ * @note This function replaces Chip_GPIO_ReadPortBit()
+ */
+STATIC INLINE bool Chip_GPIO_GetPinState(LPC_GPIO_T *pGPIO, uint8_t port, uint8_t pin)
+{
+ return (bool) pGPIO->B[port][pin];
+}
+
+/**
+ * @brief Set a GPIO direction
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO port to set
+ * @param bit : GPIO bit to set
+ * @param setting : true for output, false for input
+ * @return Nothing
+ * @note It is recommended to use the Chip_GPIO_SetPinDIROutput(),
+ * Chip_GPIO_SetPinDIRInput() or Chip_GPIO_SetPinDIR() functions instead
+ * of this function.
+ */
+void Chip_GPIO_WriteDirBit(LPC_GPIO_T *pGPIO, uint32_t port, uint8_t bit, bool setting);
+
+/**
+ * @brief Set GPIO direction for a single GPIO pin to an output
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO Port number where @a pin is located
+ * @param pin : GPIO pin to set direction on as output
+ * @return Nothing
+ */
+STATIC INLINE void Chip_GPIO_SetPinDIROutput(LPC_GPIO_T *pGPIO, uint8_t port, uint8_t pin)
+{
+ pGPIO->DIR[port] |= 1UL << pin;
+}
+
+/**
+ * @brief Set GPIO direction for a single GPIO pin to an input
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO Port number where @a pin is located
+ * @param pin : GPIO pin to set direction on as input
+ * @return Nothing
+ */
+STATIC INLINE void Chip_GPIO_SetPinDIRInput(LPC_GPIO_T *pGPIO, uint8_t port, uint8_t pin)
+{
+ pGPIO->DIR[port] &= ~(1UL << pin);
+}
+
+/**
+ * @brief Set GPIO direction for a single GPIO pin
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO Port number where @a pin is located
+ * @param pin : GPIO pin to set direction for
+ * @param output : true for output, false for input
+ * @return Nothing
+ */
+void Chip_GPIO_SetPinDIR(LPC_GPIO_T *pGPIO, uint8_t port, uint8_t pin, bool output);
+
+/**
+ * @brief Read a GPIO direction (out or in)
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO port to read
+ * @param bit : GPIO bit to read
+ * @return true of the GPIO is an output, false if input
+ * @note It is recommended to use the Chip_GPIO_GetPinDIR() function instead.
+ */
+STATIC INLINE bool Chip_GPIO_ReadDirBit(LPC_GPIO_T *pGPIO, uint32_t port, uint8_t bit)
+{
+ return (bool) (((pGPIO->DIR[port]) >> bit) & 1);
+}
+
+/**
+ * @brief Get GPIO direction for a single GPIO pin
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO Port number where @a pin is located
+ * @param pin : GPIO pin to get direction for
+ * @return true if the GPIO is an output, false if input
+ */
+STATIC INLINE bool Chip_GPIO_GetPinDIR(LPC_GPIO_T *pGPIO, uint8_t port, uint8_t pin)
+{
+ return (bool) (((pGPIO->DIR[port]) >> pin) & 1);
+}
+
+/**
+ * @brief Set Direction for a GPIO port
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param portNum : port Number
+ * @param bitValue : GPIO bit to set
+ * @param out : Direction value, 0 = input, !0 = output
+ * @return None
+ * @note Bits set to '0' are not altered. It is recommended to use the
+ * Chip_GPIO_SetPortDIR() function instead.
+ */
+void Chip_GPIO_SetDir(LPC_GPIO_T *pGPIO, uint8_t portNum, uint32_t bitValue, uint8_t out);
+
+/**
+ * @brief Set GPIO direction for a all selected GPIO pins to an output
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO Port number where @a pin is located
+ * @param pinMask : GPIO pin mask to set direction on as output (bits 0..b for pins 0..n)
+ * @return Nothing
+ * @note Sets multiple GPIO pins to the output direction, each bit's position that is
+ * high sets the corresponding pin number for that bit to an output.
+ */
+STATIC INLINE void Chip_GPIO_SetPortDIROutput(LPC_GPIO_T *pGPIO, uint8_t port, uint32_t pinMask)
+{
+ pGPIO->DIR[port] |= pinMask;
+}
+
+/**
+ * @brief Set GPIO direction for a all selected GPIO pins to an input
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO Port number where @a pin is located
+ * @param pinMask : GPIO pin mask to set direction on as input (bits 0..b for pins 0..n)
+ * @return Nothing
+ * @note Sets multiple GPIO pins to the input direction, each bit's position that is
+ * high sets the corresponding pin number for that bit to an input.
+ */
+STATIC INLINE void Chip_GPIO_SetPortDIRInput(LPC_GPIO_T *pGPIO, uint8_t port, uint32_t pinMask)
+{
+ pGPIO->DIR[port] &= ~pinMask;
+}
+
+/**
+ * @brief Set GPIO direction for a all selected GPIO pins to an input or output
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO Port number where @a pin is located
+ * @param pinMask : GPIO pin mask to set direction on (bits 0..b for pins 0..n)
+ * @param outSet : Direction value, false = set as inputs, true = set as outputs
+ * @return Nothing
+ * @note Sets multiple GPIO pins to the input direction, each bit's position that is
+ * high sets the corresponding pin number for that bit to an input.
+ */
+void Chip_GPIO_SetPortDIR(LPC_GPIO_T *pGPIO, uint8_t port, uint32_t pinMask, bool outSet);
+
+/**
+ * @brief Get GPIO direction for a all GPIO pins
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO Port number where @a pin is located
+ * @return a bitfield containing the input and output states for each pin
+ * @note For pins 0..n, a high state in a bit corresponds to an output state for the
+ * same pin, while a low state corresponds to an input state.
+ */
+STATIC INLINE uint32_t Chip_GPIO_GetPortDIR(LPC_GPIO_T *pGPIO, uint8_t port)
+{
+ return pGPIO->DIR[port];
+}
+
+/**
+ * @brief Set GPIO port mask value for GPIO masked read and write
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : port Number
+ * @param mask : Mask value for read and write (only low bits are enabled)
+ * @return Nothing
+ * @note Controls which bits are set or unset when using the masked
+ * GPIO read and write functions. A low state indicates the pin is settable
+ * and readable via the masked write and read functions.
+ */
+STATIC INLINE void Chip_GPIO_SetPortMask(LPC_GPIO_T *pGPIO, uint8_t port, uint32_t mask)
+{
+ pGPIO->MASK[port] = mask;
+}
+
+/**
+ * @brief Get GPIO port mask value used for GPIO masked read and write
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : port Number
+ * @return Returns value set with the Chip_GPIO_SetPortMask() function.
+ * @note A high bit in the return value indicates that that GPIO pin for the
+ * port cannot be set using the masked write function.
+ */
+STATIC INLINE uint32_t Chip_GPIO_GetPortMask(LPC_GPIO_T *pGPIO, uint8_t port)
+{
+ return pGPIO->MASK[port];
+}
+
+/**
+ * @brief Set all GPIO raw pin states (regardless of masking)
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO Port number where @a pin is located
+ * @param value : Value to set all GPIO pin states (0..n) to
+ * @return Nothing
+ */
+STATIC INLINE void Chip_GPIO_SetPortValue(LPC_GPIO_T *pGPIO, uint8_t port, uint32_t value)
+{
+ pGPIO->PIN[port] = value;
+}
+
+/**
+ * @brief Get all GPIO raw pin states (regardless of masking)
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO Port number where @a pin is located
+ * @return Current (raw) state of all GPIO pins
+ */
+STATIC INLINE uint32_t Chip_GPIO_GetPortValue(LPC_GPIO_T *pGPIO, uint8_t port)
+{
+ return pGPIO->PIN[port];
+}
+
+/**
+ * @brief Set all GPIO pin states, but mask via the MASKP0 register
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO Port number where @a pin is located
+ * @param value : Value to set all GPIO pin states (0..n) to
+ * @return Nothing
+ */
+STATIC INLINE void Chip_GPIO_SetMaskedPortValue(LPC_GPIO_T *pGPIO, uint8_t port, uint32_t value)
+{
+ pGPIO->MPIN[port] = value;
+}
+
+/**
+ * @brief Get all GPIO pin statesm but mask via the MASKP0 register
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO Port number where @a pin is located
+ * @return Current (masked) state of all GPIO pins
+ */
+STATIC INLINE uint32_t Chip_GPIO_GetMaskedPortValue(LPC_GPIO_T *pGPIO, uint8_t port)
+{
+ return pGPIO->MPIN[port];
+}
+
+/**
+ * @brief Set a GPIO port/bit to the high state
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param portNum : port number
+ * @param bitValue : bit(s) in the port to set high
+ * @return None
+ * @note Any bit set as a '0' will not have it's state changed. This only
+ * applies to ports configured as an output. It is recommended to use the
+ * Chip_GPIO_SetPortOutHigh() function instead.
+ */
+STATIC INLINE void Chip_GPIO_SetValue(LPC_GPIO_T *pGPIO, uint8_t portNum, uint32_t bitValue)
+{
+ pGPIO->SET[portNum] = bitValue;
+}
+
+/**
+ * @brief Set selected GPIO output pins to the high state
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO Port number where @a pin is located
+ * @param pins : pins (0..n) to set high
+ * @return None
+ * @note Any bit set as a '0' will not have it's state changed. This only
+ * applies to ports configured as an output.
+ */
+STATIC INLINE void Chip_GPIO_SetPortOutHigh(LPC_GPIO_T *pGPIO, uint8_t port, uint32_t pins)
+{
+ pGPIO->SET[port] = pins;
+}
+
+/**
+ * @brief Set an individual GPIO output pin to the high state
+ * @param pGPIO : The base of GPIO peripheral on the chip'
+ * @param port : GPIO Port number where @a pin is located
+ * @param pin : pin number (0..n) to set high
+ * @return None
+ * @note Any bit set as a '0' will not have it's state changed. This only
+ * applies to ports configured as an output.
+ */
+STATIC INLINE void Chip_GPIO_SetPinOutHigh(LPC_GPIO_T *pGPIO, uint8_t port, uint8_t pin)
+{
+ pGPIO->SET[port] = (1 << pin);
+}
+
+/**
+ * @brief Set a GPIO port/bit to the low state
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param portNum : port number
+ * @param bitValue : bit(s) in the port to set low
+ * @return None
+ * @note Any bit set as a '0' will not have it's state changed. This only
+ * applies to ports configured as an output.
+ */
+STATIC INLINE void Chip_GPIO_ClearValue(LPC_GPIO_T *pGPIO, uint8_t portNum, uint32_t bitValue)
+{
+ pGPIO->CLR[portNum] = bitValue;
+}
+
+/**
+ * @brief Set selected GPIO output pins to the low state
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO Port number where @a pin is located
+ * @param pins : pins (0..n) to set low
+ * @return None
+ * @note Any bit set as a '0' will not have it's state changed. This only
+ * applies to ports configured as an output.
+ */
+STATIC INLINE void Chip_GPIO_SetPortOutLow(LPC_GPIO_T *pGPIO, uint8_t port, uint32_t pins)
+{
+ pGPIO->CLR[port] = pins;
+}
+
+/**
+ * @brief Set an individual GPIO output pin to the low state
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO Port number where @a pin is located
+ * @param pin : pin number (0..n) to set low
+ * @return None
+ * @note Any bit set as a '0' will not have it's state changed. This only
+ * applies to ports configured as an output.
+ */
+STATIC INLINE void Chip_GPIO_SetPinOutLow(LPC_GPIO_T *pGPIO, uint8_t port, uint8_t pin)
+{
+ pGPIO->CLR[port] = (1 << pin);
+}
+
+/**
+ * @brief Toggle selected GPIO output pins to the opposite state
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO Port number where @a pin is located
+ * @param pins : pins (0..n) to toggle
+ * @return None
+ * @note Any bit set as a '0' will not have it's state changed. This only
+ * applies to ports configured as an output.
+ */
+STATIC INLINE void Chip_GPIO_SetPortToggle(LPC_GPIO_T *pGPIO, uint8_t port, uint32_t pins)
+{
+ pGPIO->NOT[port] = pins;
+}
+
+/**
+ * @brief Toggle an individual GPIO output pin to the opposite state
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param port : GPIO Port number where @a pin is located
+ * @param pin : pin number (0..n) to toggle
+ * @return None
+ * @note Any bit set as a '0' will not have it's state changed. This only
+ * applies to ports configured as an output.
+ */
+STATIC INLINE void Chip_GPIO_SetPinToggle(LPC_GPIO_T *pGPIO, uint8_t port, uint8_t pin)
+{
+ pGPIO->NOT[port] = (1 << pin);
+}
+
+/**
+ * @brief Read current bit states for the selected port
+ * @param pGPIO : The base of GPIO peripheral on the chip
+ * @param portNum : port number to read
+ * @return Current value of GPIO port
+ * @note The current states of the bits for the port are read, regardless of
+ * whether the GPIO port bits are input or output.
+ */
+STATIC INLINE uint32_t Chip_GPIO_ReadValue(LPC_GPIO_T *pGPIO, uint8_t portNum)
+{
+ return pGPIO->PIN[portNum];
+}
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __GPIO_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/gpiogroup_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/gpiogroup_15xx.h
new file mode 100644
index 0000000..a8e5df8
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/gpiogroup_15xx.h
@@ -0,0 +1,226 @@
+/*
+ * @brief LPC15xx GPIO group driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __GPIOGROUP_15XX_H_
+#define __GPIOGROUP_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup GPIOGP_15XX CHIP: LPC15xx GPIO group driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief GPIO grouped interrupt register block structure
+ */
+typedef struct { /*!< GPIO_GROUP_INTn Structure */
+ __IO uint32_t CTRL; /*!< GPIO grouped interrupt control register */
+ __I uint32_t RESERVED0[7];
+ __IO uint32_t PORT_POL[8]; /*!< GPIO grouped interrupt port polarity register */
+ __IO uint32_t PORT_ENA[8]; /*!< GPIO grouped interrupt port m enable register */
+ uint32_t RESERVED1[1000];
+} LPC_GPIOGROUPINT_T;
+
+/**
+ * LPC15xx GPIO group bit definitions
+ */
+#define GPIOGR_INT (1 << 0) /*!< GPIO interrupt pending/clear bit */
+#define GPIOGR_COMB (1 << 1) /*!< GPIO interrupt OR(0)/AND(1) mode bit */
+#define GPIOGR_TRIG (1 << 2) /*!< GPIO interrupt edge(0)/level(1) mode bit */
+
+/**
+ * @brief Initialize GPIO group interrupt block
+ * @param pGPIO : The base of GPIO group 0 peripheral on the chip
+ * @return Nothing
+ */
+STATIC INLINE void Chip_GPIOGP_Init(LPC_GPIOGROUPINT_T *pGPIO)
+{
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_GINT);
+ Chip_SYSCTL_PeriphReset(RESET_GINT);
+}
+
+/**
+ * @brief De-Initialize GPIO group interrupt block
+ * @param pGPIO : The base of GPIO group 0 peripheral on the chip
+ * @return Nothing
+ */
+STATIC INLINE void Chip_GPIOGP_DeInit(LPC_GPIOGROUPINT_T *pGPIO)
+{
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_GINT);
+}
+
+/**
+ * @brief Clear interrupt pending status for the selected group
+ * @param pGPIOGPINT : Pointer to GPIO group register block
+ * @param group : GPIO group number
+ * @return None
+ */
+STATIC INLINE void Chip_GPIOGP_ClearIntStatus(LPC_GPIOGROUPINT_T *pGPIOGPINT, uint8_t group)
+{
+ uint32_t temp;
+
+ temp = pGPIOGPINT[group].CTRL;
+ pGPIOGPINT[group].CTRL = temp | GPIOGR_INT;
+}
+
+/**
+ * @brief Returns current GPIO group inetrrupt pending status
+ * @param pGPIOGPINT : Pointer to GPIO group register block
+ * @param group : GPIO group number
+ * @return true if the group interrupt is pending, otherwise false.
+ */
+STATIC INLINE bool Chip_GPIOGP_GetIntStatus(LPC_GPIOGROUPINT_T *pGPIOGPINT, uint8_t group)
+{
+ return (bool) ((pGPIOGPINT[group].CTRL & GPIOGR_INT) != 0);
+}
+
+/**
+ * @brief Selected GPIO group functionality for trigger on any pin in group (OR mode)
+ * @param pGPIOGPINT : Pointer to GPIO group register block
+ * @param group : GPIO group number
+ * @return None
+ */
+STATIC INLINE void Chip_GPIOGP_SelectOrMode(LPC_GPIOGROUPINT_T *pGPIOGPINT, uint8_t group)
+{
+ pGPIOGPINT[group].CTRL &= ~GPIOGR_COMB;
+}
+
+/**
+ * @brief Selected GPIO group functionality for trigger on all matching pins in group (AND mode)
+ * @param pGPIOGPINT : Pointer to GPIO group register block
+ * @param group : GPIO group number
+ * @return None
+ */
+STATIC INLINE void Chip_GPIOGP_SelectAndMode(LPC_GPIOGROUPINT_T *pGPIOGPINT, uint8_t group)
+{
+ pGPIOGPINT[group].CTRL |= GPIOGR_COMB;
+}
+
+/**
+ * @brief Selected GPIO group functionality edge trigger mode
+ * @param pGPIOGPINT : Pointer to GPIO group register block
+ * @param group : GPIO group number
+ * @return None
+ */
+STATIC INLINE void Chip_GPIOGP_SelectEdgeMode(LPC_GPIOGROUPINT_T *pGPIOGPINT, uint8_t group)
+{
+ pGPIOGPINT[group].CTRL &= ~GPIOGR_TRIG;
+}
+
+/**
+ * @brief Selected GPIO group functionality level trigger mode
+ * @param pGPIOGPINT : Pointer to GPIO group register block
+ * @param group : GPIO group number
+ * @return None
+ */
+STATIC INLINE void Chip_GPIOGP_SelectLevelMode(LPC_GPIOGROUPINT_T *pGPIOGPINT, uint8_t group)
+{
+ pGPIOGPINT[group].CTRL |= GPIOGR_TRIG;
+}
+
+/**
+ * @brief Set selected pins for the group and port to low level trigger
+ * @param pGPIOGPINT : Pointer to GPIO group register block
+ * @param group : GPIO group number
+ * @param port : GPIO port number
+ * @param pinMask : Or'ed value of pins to select for low level (bit 0 = pin 0, 1 = pin1, etc.)
+ * @return None
+ */
+STATIC INLINE void Chip_GPIOGP_SelectLowLevel(LPC_GPIOGROUPINT_T *pGPIOGPINT,
+ uint8_t group,
+ uint8_t port,
+ uint32_t pinMask)
+{
+ pGPIOGPINT[group].PORT_POL[port] &= ~pinMask;
+}
+
+/**
+ * @brief Set selected pins for the group and port to high level trigger
+ * @param pGPIOGPINT : Pointer to GPIO group register block
+ * @param group : GPIO group number
+ * @param port : GPIO port number
+ * @param pinMask : Or'ed value of pins to select for high level (bit 0 = pin 0, 1 = pin1, etc.)
+ * @return None
+ */
+STATIC INLINE void Chip_GPIOGP_SelectHighLevel(LPC_GPIOGROUPINT_T *pGPIOGPINT,
+ uint8_t group,
+ uint8_t port,
+ uint32_t pinMask)
+{
+ pGPIOGPINT[group].PORT_POL[port] |= pinMask;
+}
+
+/**
+ * @brief Disabled selected pins for the group interrupt
+ * @param pGPIOGPINT : Pointer to GPIO group register block
+ * @param group : GPIO group number
+ * @param port : GPIO port number
+ * @param pinMask : Or'ed value of pins to disable interrupt for (bit 0 = pin 0, 1 = pin1, etc.)
+ * @return None
+ * @note Disabled pins do not contrinute to the group interrupt.
+ */
+STATIC INLINE void Chip_GPIOGP_DisableGroupPins(LPC_GPIOGROUPINT_T *pGPIOGPINT,
+ uint8_t group,
+ uint8_t port,
+ uint32_t pinMask)
+{
+ pGPIOGPINT[group].PORT_ENA[port] &= ~pinMask;
+}
+
+/**
+ * @brief Enable selected pins for the group interrupt
+ * @param pGPIOGPINT : Pointer to GPIO group register block
+ * @param group : GPIO group number
+ * @param port : GPIO port number
+ * @param pinMask : Or'ed value of pins to enable interrupt for (bit 0 = pin 0, 1 = pin1, etc.)
+ * @return None
+ * @note Enabled pins contribute to the group interrupt.
+ */
+STATIC INLINE void Chip_GPIOGP_EnableGroupPins(LPC_GPIOGROUPINT_T *pGPIOGPINT,
+ uint8_t group,
+ uint8_t port,
+ uint32_t pinMask)
+{
+ pGPIOGPINT[group].PORT_ENA[port] |= pinMask;
+}
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __GPIOGROUP_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/i2c_common_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/i2c_common_15xx.h
new file mode 100644
index 0000000..1df6d55
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/i2c_common_15xx.h
@@ -0,0 +1,313 @@
+/*
+ * @brief LPC15xx I2C driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __I2C_COMMON_15XX_H_
+#define __I2C_COMMON_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup I2C_15XX CHIP: LPC15xx I2C driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief I2C register block structure
+ */
+typedef struct { /* I2C0 Structure */
+ __IO uint32_t CFG; /*!< I2C Configuration Register common for Master, Slave and Monitor */
+ __IO uint32_t STAT; /*!< I2C Status Register common for Master, Slave and Monitor */
+ __IO uint32_t INTENSET; /*!< I2C Interrupt Enable Set Register common for Master, Slave and Monitor */
+ __O uint32_t INTENCLR; /*!< I2C Interrupt Enable Clear Register common for Master, Slave and Monitor */
+ __IO uint32_t TIMEOUT; /*!< I2C Timeout value Register */
+ __IO uint32_t CLKDIV; /*!< I2C Clock Divider Register */
+ __I uint32_t INTSTAT; /*!< I2C Interrupt Status Register */
+ __I uint32_t RESERVED0;
+ __IO uint32_t MSTCTL; /*!< I2C Master Control Register */
+ __IO uint32_t MSTTIME; /*!< I2C Master Time Register for SCL */
+ __IO uint32_t MSTDAT; /*!< I2C Master Data Register */
+ __I uint32_t RESERVED1[5];
+ __IO uint32_t SLVCTL; /*!< I2C Slave Control Register */
+ __IO uint32_t SLVDAT; /*!< I2C Slave Data Register */
+ __IO uint32_t SLVADR[4]; /*!< I2C Slave Address Registers */
+ __IO uint32_t SLVQUAL0; /*!< I2C Slave Address Qualifier 0 Register */
+ __I uint32_t RESERVED2[9];
+ __I uint32_t MONRXDAT; /*!< I2C Monitor Data Register */
+} LPC_I2C_T;
+
+/*
+ * @brief I2C Configuration register Bit definition
+ */
+#define I2C_CFG_MSTEN (1 << 0) /*!< Master Enable/Disable Bit */
+#define I2C_CFG_SLVEN (1 << 1) /*!< Slave Enable/Disable Bit */
+#define I2C_CFG_MONEN (1 << 2) /*!< Monitor Enable/Disable Bit */
+#define I2C_CFG_TIMEOUTEN (1 << 3) /*!< Timeout Enable/Disable Bit */
+#define I2C_CFG_MONCLKSTR (1 << 4) /*!< Monitor Clock Stretching Bit */
+#define I2C_CFG_MASK ((uint32_t) 0x1F) /*!< Configuration register Mask */
+
+/*
+ * @brief I2C Status register Bit definition
+ */
+#define I2C_STAT_MSTPENDING (1 << 0) /*!< Master Pending Status Bit */
+#define I2C_STAT_MSTSTATE (0x7 << 1) /*!< Master State Code */
+#define I2C_STAT_MSTRARBLOSS (1 << 4) /*!< Master Arbitration Loss Bit */
+#define I2C_STAT_MSTSTSTPERR (1 << 6) /*!< Master Start Stop Error Bit */
+#define I2C_STAT_SLVPENDING (1 << 8) /*!< Slave Pending Status Bit */
+#define I2C_STAT_SLVSTATE (0x3 << 9) /*!< Slave State Code */
+#define I2C_STAT_SLVNOTSTR (1 << 11) /*!< Slave not stretching Clock Bit */
+#define I2C_STAT_SLVIDX (0x3 << 12) /*!< Slave Address Index */
+#define I2C_STAT_SLVSEL (1 << 14) /*!< Slave Selected Bit */
+#define I2C_STAT_SLVDESEL (1 << 15) /*!< Slave Deselect Bit */
+#define I2C_STAT_MONRDY (1 << 16) /*!< Monitor Ready Bit */
+#define I2C_STAT_MONOV (1 << 17) /*!< Monitor Overflow Flag */
+#define I2C_STAT_MONACTIVE (1 << 18) /*!< Monitor Active Flag */
+#define I2C_STAT_MONIDLE (1 << 19) /*!< Monitor Idle Flag */
+#define I2C_STAT_EVENTTIMEOUT (1 << 24) /*!< Event Timeout Interrupt Flag */
+#define I2C_STAT_SCLTIMEOUT (1 << 25) /*!< SCL Timeout Interrupt Flag */
+
+#define I2C_STAT_MSTCODE_IDLE (0) /*!< Master Idle State Code */
+#define I2C_STAT_MSTCODE_RXREADY (1) /*!< Master Receive Ready State Code */
+#define I2C_STAT_MSTCODE_TXREADY (2) /*!< Master Transmit Ready State Code */
+#define I2C_STAT_MSTCODE_NACKADR (3) /*!< Master NACK by slave on address State Code */
+#define I2C_STAT_MSTCODE_NACKDAT (4) /*!< Master NACK by slave on data State Code */
+
+#define I2C_STAT_SLVCODE_ADDR (0) /*!< Master Idle State Code */
+#define I2C_STAT_SLVCODE_RX (1) /*!< Received data is available Code */
+#define I2C_STAT_SLVCODE_TX (2) /*!< Data can be transmitted Code */
+
+/*
+ * @brief I2C Interrupt Enable Set register Bit definition
+ */
+#define I2C_INTENSET_MSTPENDING (1 << 0) /*!< Master Pending Interrupt Enable Bit */
+#define I2C_INTENSET_MSTRARBLOSS (1 << 4) /*!< Master Arbitration Loss Interrupt Enable Bit */
+#define I2C_INTENSET_MSTSTSTPERR (1 << 6) /*!< Master Start Stop Error Interrupt Enable Bit */
+#define I2C_INTENSET_SLVPENDING (1 << 8) /*!< Slave Pending Interrupt Enable Bit */
+#define I2C_INTENSET_SLVNOTSTR (1 << 11) /*!< Slave not stretching Clock Interrupt Enable Bit */
+#define I2C_INTENSET_SLVDESEL (1 << 15) /*!< Slave Deselect Interrupt Enable Bit */
+#define I2C_INTENSET_MONRDY (1 << 16) /*!< Monitor Ready Interrupt Enable Bit */
+#define I2C_INTENSET_MONOV (1 << 17) /*!< Monitor Overflow Interrupt Enable Bit */
+#define I2C_INTENSET_MONIDLE (1 << 19) /*!< Monitor Idle Interrupt Enable Bit */
+#define I2C_INTENSET_EVENTTIMEOUT (1 << 24) /*!< Event Timeout Interrupt Enable Bit */
+#define I2C_INTENSET_SCLTIMEOUT (1 << 25) /*!< SCL Timeout Interrupt Enable Bit */
+
+/*
+ * @brief I2C Interrupt Enable Clear register Bit definition
+ */
+#define I2C_INTENCLR_MSTPENDING (1 << 0) /*!< Master Pending Interrupt Clear Bit */
+#define I2C_INTENCLR_MSTRARBLOSS (1 << 4) /*!< Master Arbitration Loss Interrupt Clear Bit */
+#define I2C_INTENCLR_MSTSTSTPERR (1 << 6) /*!< Master Start Stop Error Interrupt Clear Bit */
+#define I2C_INTENCLR_SLVPENDING (1 << 8) /*!< Slave Pending Interrupt Clear Bit */
+#define I2C_INTENCLR_SLVNOTSTR (1 << 11) /*!< Slave not stretching Clock Interrupt Clear Bit */
+#define I2C_INTENCLR_SLVDESEL (1 << 15) /*!< Slave Deselect Interrupt Clear Bit */
+#define I2C_INTENCLR_MONRDY (1 << 16) /*!< Monitor Ready Interrupt Clear Bit */
+#define I2C_INTENCLR_MONOV (1 << 17) /*!< Monitor Overflow Interrupt Clear Bit */
+#define I2C_INTENCLR_MONIDLE (1 << 19) /*!< Monitor Idle Interrupt Clear Bit */
+#define I2C_INTENCLR_EVENTTIMEOUT (1 << 24) /*!< Event Timeout Interrupt Clear Bit */
+#define I2C_INTENCLR_SCLTIMEOUT (1 << 25) /*!< SCL Timeout Interrupt Clear Bit */
+
+/*
+ * @brief I2C TimeOut Value Macro
+ */
+#define I2C_TIMEOUT_VAL(n) (((uint32_t) ((n) - 1) & 0xFFF0) | 0x000F) /*!< Macro for Timeout value register */
+
+/*
+ * @brief I2C Interrupt Status register Bit definition
+ */
+#define I2C_INTSTAT_MSTPENDING (1 << 0) /*!< Master Pending Interrupt Status Bit */
+#define I2C_INTSTAT_MSTRARBLOSS (1 << 4) /*!< Master Arbitration Loss Interrupt Status Bit */
+#define I2C_INTSTAT_MSTSTSTPERR (1 << 6) /*!< Master Start Stop Error Interrupt Status Bit */
+#define I2C_INTSTAT_SLVPENDING (1 << 8) /*!< Slave Pending Interrupt Status Bit */
+#define I2C_INTSTAT_SLVNOTSTR (1 << 11) /*!< Slave not stretching Clock Interrupt Status Bit */
+#define I2C_INTSTAT_SLVDESEL (1 << 15) /*!< Slave Deselect Interrupt Status Bit */
+#define I2C_INTSTAT_MONRDY (1 << 16) /*!< Monitor Ready Interrupt Status Bit */
+#define I2C_INTSTAT_MONOV (1 << 17) /*!< Monitor Overflow Interrupt Status Bit */
+#define I2C_INTSTAT_MONIDLE (1 << 19) /*!< Monitor Idle Interrupt Status Bit */
+#define I2C_INTSTAT_EVENTTIMEOUT (1 << 24) /*!< Event Timeout Interrupt Status Bit */
+#define I2C_INTSTAT_SCLTIMEOUT (1 << 25) /*!< SCL Timeout Interrupt Status Bit */
+
+/*
+ * @brief I2C Master Control register Bit definition
+ */
+#define I2C_MSTCTL_MSTCONTINUE (1 << 0) /*!< Master Continue Bit */
+#define I2C_MSTCTL_MSTSTART (1 << 1) /*!< Master Start Control Bit */
+#define I2C_MSTCTL_MSTSTOP (1 << 2) /*!< Master Stop Control Bit */
+#define I2C_MSTCTL_MSTDMA (1 << 3) /*!< Master DMA Enable Bit */
+
+/*
+ * @brief I2C Master Time Register Field definition
+ */
+#define I2C_MSTTIME_MSTSCLLOW (0x07 << 0) /*!< Master SCL Low Time field */
+#define I2C_MSTTIME_MSTSCLHIGH (0x07 << 4) /*!< Master SCL High Time field */
+
+/*
+ * @brief I2C Master Data Mask
+ */
+#define I2C_MSTDAT_DATAMASK ((uint32_t) 0x00FF << 0) /*!< Master data mask */
+
+/*
+ * @brief I2C Slave Control register Bit definition
+ */
+#define I2C_SLVCTL_SLVCONTINUE (1 << 0) /*!< Slave Continue Bit */
+#define I2C_SLVCTL_SLVNACK (1 << 1) /*!< Slave NACK Bit */
+#define I2C_SLVCTL_SLVDMA (1 << 3) /*!< Slave DMA Enable Bit */
+
+/*
+ * @brief I2C Slave Data Mask
+ */
+#define I2C_SLVDAT_DATAMASK ((uint32_t) 0x00FF << 0) /*!< Slave data mask */
+
+/*
+ * @brief I2C Slave Address register Bit definition
+ */
+#define I2C_SLVADR_SADISABLE (1 << 0) /*!< Slave Address n Disable Bit */
+#define I2C_SLVADR_SLVADR (0x7F << 1) /*!< Slave Address field */
+#define I2C_SLVADR_MASK ((uint32_t) 0x00FF) /*!< Slave Address Mask */
+
+/*
+ * @brief I2C Slave Address Qualifier 0 Register Bit definition
+ */
+#define I2C_SLVQUAL_QUALMODE0 (1 << 0) /*!< Slave Qualifier Mode Enable Bit */
+#define I2C_SLVQUAL_SLVQUAL0 (0x7F << 1) /*!< Slave Qualifier Address for Address 0 */
+
+/*
+ * @brief I2C Monitor Data Register Bit definition
+ */
+#define I2C_MONRXDAT_DATA (0xFF << 0) /*!< Monitor Function Receive Data Field */
+#define I2C_MONRXDAT_MONSTART (1 << 8) /*!< Monitor Received Start Bit */
+#define I2C_MONRXDAT_MONRESTART (1 << 9) /*!< Monitor Received Repeated Start Bit */
+#define I2C_MONRXDAT_MONNACK (1 << 10) /*!< Monitor Received Nack Bit */
+
+/**
+ * @brief Initialize I2C Interface
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return Nothing
+ * @note This function enables the I2C clock for both the master and
+ * slave interfaces if the I2C channel.
+
+ */
+void Chip_I2C_Init(LPC_I2C_T *pI2C);
+
+/**
+ * @brief Shutdown I2C Interface
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return Nothing
+ * @note This function disables the I2C clock for both the master and
+ * slave interfaces if the I2C channel.
+ */
+void Chip_I2C_DeInit(LPC_I2C_T *pI2C);
+
+/**
+ * @brief Sets I2C Clock Divider registers
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @param clkdiv : Clock Divider value for I2C, value is between (1 - 65536)
+ * @return Nothing
+ * @note The clock to I2C block is determined by the following formula (I2C_PCLK
+ * is the frequency of the system clock): <br>
+ * I2C Clock Frequency = (I2C_PCLK)/clkdiv;
+ */
+static INLINE void Chip_I2C_SetClockDiv(LPC_I2C_T *pI2C, uint32_t clkdiv)
+{
+ if ((clkdiv >= 1) && (clkdiv <= 65536)) {
+ pI2C->CLKDIV = clkdiv - 1;
+ }
+ else {
+ pI2C->CLKDIV = 0;
+ }
+}
+
+/**
+ * @brief Get I2C Clock Divider registers
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return Clock Divider value
+ * @note Return the divider value for the I2C block
+ * It is the CLKDIV register value + 1
+ */
+static INLINE uint32_t Chip_I2C_GetClockDiv(LPC_I2C_T *pI2C)
+{
+ return (pI2C->CLKDIV & 0xFFFF) + 1;
+}
+
+/**
+ * @brief Enable I2C Interrupts
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @param intEn : ORed Value of I2C_INTENSET_* values to enable
+ * @return Nothing
+ */
+static INLINE void Chip_I2C_EnableInt(LPC_I2C_T *pI2C, uint32_t intEn)
+{
+ pI2C->INTENSET = intEn;
+}
+
+/**
+ * @brief Disable I2C Interrupts
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @param intClr : ORed Value of I2C_INTENSET_* values to disable
+ * @return Nothing
+ */
+static INLINE void Chip_I2C_DisableInt(LPC_I2C_T *pI2C, uint32_t intClr)
+{
+ pI2C->INTENCLR = intClr;
+}
+
+/**
+ * @brief Disable I2C Interrupts
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @param intClr : ORed Value of I2C_INTENSET_* values to disable
+ * @return Nothing
+ * @note It is recommended to use the Chip_I2C_DisableInt() function
+ * instead of this function.
+ */
+static INLINE void Chip_I2C_ClearInt(LPC_I2C_T *pI2C, uint32_t intClr)
+{
+ Chip_I2C_DisableInt(pI2C, intClr);
+}
+
+/**
+ * @brief Returns pending I2C Interrupts
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return All pending interrupts, mask with I2C_INTENSET_* to determine specific interrupts
+ */
+static INLINE uint32_t Chip_I2C_GetPendingInt(LPC_I2C_T *pI2C)
+{
+ return pI2C->INTSTAT;
+}
+
+/**
+ * @}
+ */
+
+ #ifdef __cplusplus
+}
+#endif
+
+#endif /* __I2C_COMMON_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/i2cm_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/i2cm_15xx.h
new file mode 100644
index 0000000..f2665ee
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/i2cm_15xx.h
@@ -0,0 +1,326 @@
+/*
+ * @brief LPC15xx I2C driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __I2CM_15XX_H_
+#define __I2CM_15XX_H_
+
+#include "i2c_common_15xx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup I2CM_15XX CHIP: LPC15xx I2C master-only driver
+ * @ingroup I2C_15XX
+ * This driver only works in master mode. To describe the I2C transactions
+ * following symbols are used in driver documentation.
+ *
+ * Key to symbols
+ * ==============
+ * S (1 bit) : Start bit
+ * P (1 bit) : Stop bit
+ * Rd/Wr (1 bit) : Read/Write bit. Rd equals 1, Wr equals 0.
+ * A, NA (1 bit) : Acknowledge and Not-Acknowledge bit.
+ * Addr (7 bits): I2C 7 bit address. Note that this can be expanded as usual to
+ * get a 10 bit I2C address.
+ * Data (8 bits): A plain data byte. Sometimes, I write DataLow, DataHigh
+ * for 16 bit data.
+ * [..]: Data sent by I2C device, as opposed to data sent by the host adapter.
+ * @{
+ */
+
+/** I2CM_15XX_STATUS_TYPES I2C master transfer status types
+ * @{
+ */
+
+#define I2CM_STATUS_OK 0x00 /*!< Requested Request was executed successfully. */
+#define I2CM_STATUS_ERROR 0x01 /*!< Unknown error condition. */
+#define I2CM_STATUS_NAK_ADR 0x02 /*!< No acknowledgement received from slave during address phase. */
+#define I2CM_STATUS_BUS_ERROR 0x03 /*!< I2C bus error */
+#define I2CM_STATUS_NAK_DAT 0x04 /*!< No acknowledgement received from slave during address phase. */
+#define I2CM_STATUS_ARBLOST 0x05 /*!< Arbitration lost. */
+#define I2CM_STATUS_BUSY 0xFF /*!< I2C transmistter is busy. */
+
+/**
+ * @}
+ */
+
+/**
+ * @brief Master transfer data structure definitions
+ */
+typedef struct {
+ const uint8_t *txBuff; /*!< Pointer to array of bytes to be transmitted */
+ uint8_t *rxBuff; /*!< Pointer memory where bytes received from I2C be stored */
+ uint16_t txSz; /*!< Number of bytes in transmit array,
+ if 0 only receive transfer will be carried on */
+ uint16_t rxSz; /*!< Number of bytes to received,
+ if 0 only transmission we be carried on */
+ uint16_t status; /*!< Status of the current I2C transfer */
+ uint8_t slaveAddr; /*!< 7-bit I2C Slave address */
+} I2CM_XFER_T;
+
+/**
+ * @brief Sets HIGH and LOW duty cycle registers
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @param sclH : Number of I2C_PCLK cycles for the SCL HIGH time value between (2 - 9).
+ * @param sclL : Number of I2C_PCLK cycles for the SCL LOW time value between (2 - 9).
+ * @return Nothing
+ * @note The I2C clock divider should be set to the appropriate value before calling this function
+ * The I2C baud is determined by the following formula: <br>
+ * I2C_bitFrequency = (I2C_PCLK)/(I2C_CLKDIV * (sclH + sclL)) <br>
+ * where I2C_PCLK is the frequency of the System clock and I2C_CLKDIV is I2C clock divider
+ */
+static INLINE void Chip_I2CM_SetDutyCycle(LPC_I2C_T *pI2C, uint16_t sclH, uint16_t sclL)
+{
+ pI2C->MSTTIME = (((sclH - 2) & 0x07) << 4) | ((sclL - 2) & 0x07);
+}
+
+/**
+ * @brief Set up bus speed for LPC_I2C controller
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @param busSpeed : I2C bus clock rate
+ * @return Nothing
+ * @note Per I2C specification the busSpeed should be
+ * @li 100000 for Standard mode
+ * @li 400000 for Fast mode
+ * @li 1000000 for Fast mode plus
+ * IOCON registers corresponding to I2C pads should be updated
+ * according to the bus mode.
+ */
+void Chip_I2CM_SetBusSpeed(LPC_I2C_T *pI2C, uint32_t busSpeed);
+
+/**
+ * @brief Enable I2C Master interface
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return Nothing
+ * @note
+ */
+static INLINE void Chip_I2CM_Enable(LPC_I2C_T *pI2C)
+{
+ pI2C->CFG = (pI2C->CFG & I2C_CFG_MASK) | I2C_CFG_MSTEN;
+}
+
+/**
+ * @brief Disable I2C Master interface
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return Nothing
+ * @note
+ */
+static INLINE void Chip_I2CM_Disable(LPC_I2C_T *pI2C)
+{
+ pI2C->CFG = (pI2C->CFG & I2C_CFG_MASK) & ~I2C_CFG_MSTEN;
+}
+
+/**
+ * @brief Get I2C Status
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return I2C Status register value
+ * @note This function returns the value of the status register.
+ */
+static INLINE uint32_t Chip_I2CM_GetStatus(LPC_I2C_T *pI2C)
+{
+ return pI2C->STAT;
+}
+
+/**
+ * @brief Clear I2C status bits (master)
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @param clrStatus : Status bit to clear, ORed Value of I2C_STAT_MSTRARBLOSS and I2C_STAT_MSTSTSTPERR
+ * @return Nothing
+ * @note This function clears selected status flags.
+ */
+static INLINE void Chip_I2CM_ClearStatus(LPC_I2C_T *pI2C, uint32_t clrStatus)
+{
+ /* Clear Master Arbitration Loss and Start, Stop Error */
+ pI2C->STAT = clrStatus & (I2C_STAT_MSTRARBLOSS | I2C_STAT_MSTSTSTPERR);
+}
+
+/**
+ * @brief Check if I2C Master is pending
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return Returns TRUE if the Master is pending else returns FALSE
+ * @note
+ */
+static INLINE bool Chip_I2CM_IsMasterPending(LPC_I2C_T *pI2C)
+{
+ return (pI2C->STAT & I2C_STAT_MSTPENDING) != 0;
+}
+
+/**
+ * @brief Get current state of the I2C Master
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return Master State Code, a value in the range of 0 - 4
+ * @note After the Master is pending this state code tells the reason
+ * for Master pending.
+ */
+static INLINE uint32_t Chip_I2CM_GetMasterState(LPC_I2C_T *pI2C)
+{
+ return (pI2C->STAT & I2C_STAT_MSTSTATE) >> 1;
+}
+
+/**
+ * @brief Transmit START or Repeat-START signal on I2C bus
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return Nothing
+ * @note This function sets the controller to transmit START condition when
+ * the bus becomes free. This should be called only when master is pending.
+ * The function writes a complete value to Master Control register, ORing is not advised.
+ */
+static INLINE void Chip_I2CM_SendStart(LPC_I2C_T *pI2C)
+{
+ pI2C->MSTCTL = I2C_MSTCTL_MSTSTART;
+}
+
+/**
+ * @brief Transmit STOP signal on I2C bus
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return Nothing
+ * @note This function sets the controller to transmit STOP condition.
+ * This should be called only when master is pending. The function writes a
+ * complete value to Master Control register, ORing is not advised.
+ */
+static INLINE void Chip_I2CM_SendStop(LPC_I2C_T *pI2C)
+{
+ pI2C->MSTCTL = I2C_MSTCTL_MSTSTOP;
+}
+
+/**
+ * @brief Master Continue transfer operation
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return Nothing
+ * @note This function sets the master controller to continue transmission.
+ * This should be called only when master is pending. The function writes a
+ * complete value to Master Control register, ORing is not advised.
+ */
+static INLINE void Chip_I2CM_MasterContinue(LPC_I2C_T *pI2C)
+{
+ pI2C->MSTCTL = I2C_MSTCTL_MSTCONTINUE;
+}
+
+/**
+ * @brief Transmit a single data byte through the I2C peripheral (master)
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @param data : Byte to transmit
+ * @return Nothing
+ * @note This function attempts to place a byte into the I2C Master
+ * Data Register
+ *
+ */
+static INLINE void Chip_I2CM_WriteByte(LPC_I2C_T *pI2C, uint8_t data)
+{
+ pI2C->MSTDAT = (uint32_t) data;
+}
+
+/**
+ * @brief Read a single byte data from the I2C peripheral (master)
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return A single byte of data read
+ * @note This function reads a byte from the I2C receive hold register
+ * regardless of I2C state.
+ */
+static INLINE uint8_t Chip_I2CM_ReadByte(LPC_I2C_T *pI2C)
+{
+ return (uint8_t) (pI2C->MSTDAT & I2C_MSTDAT_DATAMASK);
+}
+
+/**
+ * @brief Transfer state change handler
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @param xfer : Pointer to a I2CM_XFER_T structure see notes below
+ * @return Returns non-zero value on completion of transfer. The @a status
+ * member of @a xfer structure contains the current status of the
+ * transfer at the end of the call.
+ * @note
+ * The parameter @a xfer should be same as the one passed to Chip_I2CM_Xfer()
+ * routine. This function should be called from the I2C interrupt handler
+ * only when a master interrupt occurs.
+ */
+uint32_t Chip_I2CM_XferHandler(LPC_I2C_T *pI2C, I2CM_XFER_T *xfer);
+
+/**
+ * @brief Transmit and Receive data in master mode
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @param xfer : Pointer to a I2CM_XFER_T structure see notes below
+ * @return Nothing
+ * @note
+ * The parameter @a xfer should have its member @a slaveAddr initialized
+ * to the 7-Bit slave address to which the master will do the xfer, Bit0
+ * to bit6 should have the address and Bit8 is ignored. During the transfer
+ * no code (like event handler) must change the content of the memory
+ * pointed to by @a xfer. The member of @a xfer, @a txBuff and @a txSz be
+ * initialized to the memory from which the I2C must pick the data to be
+ * transfered to slave and the number of bytes to send respectively, similarly
+ * @a rxBuff and @a rxSz must have pointer to memroy where data received
+ * from slave be stored and the number of data to get from slave respectilvely.
+ * Following types of transfers are possible:
+ * - Write-only transfer: When @a rxSz member of @a xfer is set to 0.
+ *
+ * S Addr Wr [A] txBuff0 [A] txBuff1 [A] ... txBuffN [A] P
+ *
+ * - If I2CM_XFER_OPTION_IGNORE_NACK is set in @a options memeber
+ *
+ * S Addr Wr [A] txBuff0 [A or NA] ... txBuffN [A or NA] P
+ *
+ * - Read-only transfer: When @a txSz member of @a xfer is set to 0.
+ *
+ * S Addr Rd [A] [rxBuff0] A [rxBuff1] A ... [rxBuffN] NA P
+ *
+ * - If I2CM_XFER_OPTION_LAST_RX_ACK is set in @a options memeber
+ *
+ * S Addr Rd [A] [rxBuff0] A [rxBuff1] A ... [rxBuffN] A P
+ *
+ * - Read-Write transfer: When @a rxSz and @ txSz members of @a xfer are non-zero.
+ *
+ * S Addr Wr [A] txBuff0 [A] txBuff1 [A] ... txBuffN [A]
+ * S Addr Rd [A] [rxBuff0] A [rxBuff1] A ... [rxBuffN] NA P
+ *
+ */
+void Chip_I2CM_Xfer(LPC_I2C_T *pI2C, I2CM_XFER_T *xfer);
+
+/**
+ * @brief Transmit and Receive data in master mode
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @param xfer : Pointer to a I2CM_XFER_T structure see notes below
+ * @return Returns non-zero value on succesful completion of transfer.
+ * @note
+ * This function operates same as Chip_I2CM_Xfer(), but is a blocking call.
+ */
+uint32_t Chip_I2CM_XferBlocking(LPC_I2C_T *pI2C, I2CM_XFER_T *xfer);
+
+/**
+ * @}
+ */
+
+ #ifdef __cplusplus
+}
+#endif
+
+#endif /* __I2C_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/i2cs_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/i2cs_15xx.h
new file mode 100644
index 0000000..3b12321
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/i2cs_15xx.h
@@ -0,0 +1,338 @@
+/*
+ * @brief LPC15xx I2C slave driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __I2CS_15XX_H_
+#define __I2CS_15XX_H_
+
+#include "i2c_common_15xx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup I2CS_15XX CHIP: LPC15xx I2C slave-only driver
+ * @ingroup I2C_15XX
+ * This driver only works in slave mode.
+ * @{
+ */
+
+/** @brief I2C slave service start callback
+ * This callback is called from the I2C slave handler when an I2C slave address is
+ * received and needs servicing. It's used to indicate the start of a slave transfer
+ * that will happen on the slave bus.
+ */
+typedef void (*SlaveXferStart)(uint8_t addr);
+
+/** @brief I2C slave send data callback
+ * This callback is called from the I2C slave handler when an I2C slave address needs
+ * data to send. Return 0 to NACK the master and terminate the transfer, or return
+ * a non-0 value with the value to send in *data.
+ */
+typedef uint8_t (*SlaveXferSend)(uint8_t *data);
+
+/** @brief I2C slave receive data callback
+ * This callback is called from the I2C slave handler when an I2C slave address has
+ * receive data. Return 0 to NACK the master and terminate the transfer, or return
+ * a non-0 value to continue the transfer.
+ */
+typedef uint8_t (*SlaveXferRecv)(uint8_t data);
+
+/** @brief I2C slave service done callback
+ * This callback is called from the I2C slave handler when an I2C slave address is
+ * received and needs servicing. It's used to indicate the start of a slave transfer
+ * that will happen on the slave bus.
+ */
+typedef void (*SlaveXferDone)(void);
+
+/**
+ * Slave transfer are performed using 3 callbacks. These 3 callbacks handle most I2C
+ * slave transfer cases. When the slave is setup and a slave interrupt is receive
+ * and processed with the Chip_I2CS_XferHandler() function in the I2C interrupt handler,
+ * one of these 3 callbacks is called. The callbacks can be used for unsized transfers
+ * from the master.
+ *
+ * When an address is received, the SlaveXferAddr() callback is called with the
+ * received address. Only addresses enabled in the slave controller will be handled.
+ * The slave controller can support up to 4 slave addresses.
+ *
+ * If the master is going to perform a read operation, the SlaveXferSend() callback
+ * is called. Place the data byte to send in *data and return a non-0 value to the
+ * caller, or return 0 to NACK the master. (Note the master ACKS/NACKS to slave
+ * on reads, so this won't necessarily stop the slave transfer.)<br>
+ *
+ * If the master performs a write operation, the SlaveXferRecv() callback is called
+ * with the received data. Return a non-0 value to the caller, or return 0 to NACK
+ * the master.<br>
+ *
+ * Once the transfer completes, the SlaveXferDone() callback will be called.<br>
+ */
+typedef struct {
+ SlaveXferStart slaveStart; /*!< Called when an matching I2C slave address is received */
+ SlaveXferSend slaveSend; /*!< Called when a byte is needed to send to master */
+ SlaveXferRecv slaveRecv; /*!< Called when a byte is received from master */
+ SlaveXferDone slaveDone; /*!< Called when a slave transfer is complete */
+} I2CS_XFER_T;
+
+/**
+ * @brief Enable I2C slave interface
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return Nothing
+ * @note Do not call this function until the slave interface is fully configured.
+ */
+STATIC INLINE void Chip_I2CS_Enable(LPC_I2C_T *pI2C)
+{
+ pI2C->CFG = (pI2C->CFG & I2C_CFG_MASK) | I2C_CFG_SLVEN;
+}
+
+/**
+ * @brief Disable I2C slave interface
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return Nothing
+ */
+STATIC INLINE void Chip_I2CS_Disable(LPC_I2C_T *pI2C)
+{
+ pI2C->CFG = (pI2C->CFG & I2C_CFG_MASK) & ~I2C_CFG_SLVEN;
+}
+
+/**
+ * @brief Get I2C Status
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return I2C Status register value
+ * @note This function returns the value of the status register.
+ */
+STATIC INLINE uint32_t Chip_I2CS_GetStatus(LPC_I2C_T *pI2C)
+{
+ return pI2C->STAT;
+}
+
+/**
+ * @brief Clear I2C status bits (slave)
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @param clrStatus : Status bit to clear, must be I2C_STAT_SLVDESEL
+ * @return Nothing
+ * @note This function clears selected status flags.
+ */
+STATIC INLINE void Chip_I2CS_ClearStatus(LPC_I2C_T *pI2C, uint32_t clrStatus)
+{
+ pI2C->STAT = clrStatus & I2C_STAT_SLVDESEL;
+}
+
+/**
+ * @brief Check if I2C slave is pending
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return Returns TRUE if the slave is pending else returns FALSE
+ * @note
+ */
+STATIC INLINE bool Chip_I2CS_IsSlavePending(LPC_I2C_T *pI2C)
+{
+ return (pI2C->STAT & I2C_STAT_SLVPENDING) != 0;
+}
+
+/**
+ * @brief Check if I2C slave is selected
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return Returns TRUE if the slave is is selected, otherwise FALSE
+ * @note
+ */
+STATIC INLINE bool Chip_I2CS_IsSlaveSelected(LPC_I2C_T *pI2C)
+{
+ return (pI2C->STAT & I2C_STAT_SLVSEL) != 0;
+}
+
+/**
+ * @brief Check if I2C slave is deselected
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return Returns TRUE if the slave is is deselected, otherwise FALSE
+ * @note
+ */
+STATIC INLINE bool Chip_I2CS_IsSlaveDeSelected(LPC_I2C_T *pI2C)
+{
+ return (pI2C->STAT & I2C_STAT_SLVDESEL) != 0;
+}
+
+/**
+ * @brief Get current state of the I2C slave
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return slave State Code, a value of type I2C_STAT_SLVCODE_*
+ * @note After the slave is pending this state code tells the reason
+ * for slave pending.
+ */
+STATIC INLINE uint32_t Chip_I2CS_GetSlaveState(LPC_I2C_T *pI2C)
+{
+ return (pI2C->STAT & I2C_STAT_SLVSTATE) >> 9;
+}
+
+/**
+ * @brief Returns the current slave address match index
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return slave match index, 0 - 3
+ */
+STATIC INLINE uint32_t Chip_I2CS_GetSlaveMatchIndex(LPC_I2C_T *pI2C)
+{
+ return (pI2C->STAT & I2C_STAT_SLVIDX) >> 12;
+}
+
+/**
+ * @brief Slave Continue transfer operation (ACK)
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return Nothing
+ * @note This function sets the slave controller to continue transmission.
+ * This should be called only when slave is pending. The function writes a
+ * complete value to slave Control register, ORing is not advised.
+ */
+STATIC INLINE void Chip_I2CS_SlaveContinue(LPC_I2C_T *pI2C)
+{
+ pI2C->SLVCTL = I2C_SLVCTL_SLVCONTINUE;
+}
+
+/**
+ * @brief Slave NACK operation
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return Nothing
+ * @note This function sets the slave controller to NAK the master.
+ */
+STATIC INLINE void Chip_I2CS_SlaveNACK(LPC_I2C_T *pI2C)
+{
+ pI2C->SLVCTL = I2C_SLVCTL_SLVNACK;
+}
+
+/**
+ * @brief Transmit a single data byte through the I2C peripheral (slave)
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @param data : Byte to transmit
+ * @return Nothing
+ * @note This function attempts to place a byte into the I2C slave
+ * Data Register
+ *
+ */
+STATIC INLINE void Chip_I2CS_WriteByte(LPC_I2C_T *pI2C, uint8_t data)
+{
+ pI2C->SLVDAT = (uint32_t) data;
+}
+
+/**
+ * @brief Read a single byte data from the I2C peripheral (slave)
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @return A single byte of data read
+ * @note This function reads a byte from the I2C receive hold register
+ * regardless of I2C state.
+ */
+STATIC INLINE uint8_t Chip_I2CS_ReadByte(LPC_I2C_T *pI2C)
+{
+ return (uint8_t) (pI2C->SLVDAT & I2C_SLVDAT_DATAMASK);
+}
+
+/**
+ * @brief Set a I2C slave address for slave operation
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @param slvNum : Possible slave address number, between 0 - 3
+ * @param slvAddr : Slave Address for the index (7-bits, bit 7 = 0)
+ * @return Nothing
+ * @note Setting a slave address also enables the slave address. Do
+ * not 'pre-shift' the slave address.
+ */
+STATIC INLINE void Chip_I2CS_SetSlaveAddr(LPC_I2C_T *pI2C, uint8_t slvNum, uint8_t slvAddr)
+{
+ pI2C->SLVADR[slvNum] = (uint32_t) (slvAddr << 1);
+}
+
+/**
+ * @brief Return a I2C programmed slave address
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @param slvNum : Possible slave address number, between 0 - 3
+ * @return Nothing
+ */
+STATIC INLINE uint8_t Chip_I2CS_GetSlaveAddr(LPC_I2C_T *pI2C, uint8_t slvNum)
+{
+ return (pI2C->SLVADR[slvNum] >> 1) & 0x7F;
+}
+
+/**
+ * @brief Enable a I2C address
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @param slvNum : Possible slave address number, between 0 - 3
+ * @return Nothing
+ */
+STATIC INLINE void Chip_I2CS_EnableSlaveAddr(LPC_I2C_T *pI2C, uint8_t slvNum)
+{
+ pI2C->SLVADR[slvNum] = (pI2C->SLVADR[slvNum] & I2C_SLVADR_MASK) & ~I2C_SLVADR_SADISABLE;
+}
+
+/**
+ * @brief Disable a I2C address
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @param slvNum : Possible slave address number, between 0 - 3
+ * @return Nothing
+ */
+STATIC INLINE void Chip_I2CS_DisableSlaveAddr(LPC_I2C_T *pI2C, uint8_t slvNum)
+{
+ pI2C->SLVADR[slvNum] = (pI2C->SLVADR[slvNum] & I2C_SLVADR_MASK) | I2C_SLVADR_SADISABLE;
+}
+
+/**
+ * @brief Setup slave qialifier address
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @param extend : true to extend I2C slave detect address 0 range, or false to match to corresponding bits
+ * @param slvAddr : Slave address qualifier, see SLVQUAL0 register in User Manual
+ * @return Nothing
+ * @note Do not 'pre-shift' the slave address.
+ */
+STATIC INLINE void Chip_I2CS_SetSlaveQual0(LPC_I2C_T *pI2C, bool extend, uint8_t slvNum)
+{
+ slvNum = slvNum << 1;
+ if (extend) {
+ slvNum |= I2C_SLVQUAL_QUALMODE0;
+ }
+
+ pI2C->SLVQUAL0 = slvNum;
+}
+
+/**
+ * @brief Slave transfer state change handler
+ * @param pI2C : Pointer to selected I2C peripheral
+ * @param xfers : Pointer to a I2CS_MULTI_XFER_T structure see notes below
+ * @return Returns non-zero value on completion of transfer
+ * @note See @ref I2CS_XFER_T for more information on this function. When using
+ * this function, the I2C_INTENSET_SLVPENDING and I2C_INTENSET_SLVDESEL interrupts
+ * should be enabled and setup in the I2C interrupt handler to call this function
+ * when they fire.
+ */
+uint32_t Chip_I2CS_XferHandler(LPC_I2C_T *pI2C, const I2CS_XFER_T *xfers);
+
+/**
+ * @}
+ */
+
+ #ifdef __cplusplus
+}
+#endif
+
+#endif /* __I2CS_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/iap.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/iap.h
new file mode 100644
index 0000000..cbf53d8
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/iap.h
@@ -0,0 +1,184 @@
+/*
+ * @brief Common IAP support functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licenser disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __IAP_H_
+#define __IAP_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup COMMON_IAP CHIP: Common Chip ISP/IAP commands and return codes
+ * @ingroup CHIP_Common
+ * @{
+ */
+
+/* IAP command definitions */
+#define IAP_PREWRRITE_CMD 50 /*!< Prepare sector for write operation command */
+#define IAP_WRISECTOR_CMD 51 /*!< Write Sector command */
+#define IAP_ERSSECTOR_CMD 52 /*!< Erase Sector command */
+#define IAP_BLANK_CHECK_SECTOR_CMD 53 /*!< Blank check sector */
+#define IAP_REPID_CMD 54 /*!< Read PartID command */
+#define IAP_READ_BOOT_CODE_CMD 55 /*!< Read Boot code version */
+#define IAP_COMPARE_CMD 56 /*!< Compare two RAM address locations */
+#define IAP_REINVOKE_ISP_CMD 57 /*!< Reinvoke ISP */
+#define IAP_READ_UID_CMD 58 /*!< Read UID */
+#define IAP_ERASE_PAGE_CMD 59 /*!< Erase page */
+#define IAP_EEPROM_WRITE 61 /*!< EEPROM Write command */
+#define IAP_EEPROM_READ 62 /*!< EEPROM READ command */
+
+/* IAP response definitions */
+#define IAP_CMD_SUCCESS 0 /*!< Command is executed successfully */
+#define IAP_INVALID_COMMAND 1 /*!< Invalid command */
+#define IAP_SRC_ADDR_ERROR 2 /*!< Source address is not on word boundary */
+#define IAP_DST_ADDR_ERROR 3 /*!< Destination address is not on a correct boundary */
+#define IAP_SRC_ADDR_NOT_MAPPED 4 /*!< Source address is not mapped in the memory map */
+#define IAP_DST_ADDR_NOT_MAPPED 5 /*!< Destination address is not mapped in the memory map */
+#define IAP_COUNT_ERROR 6 /*!< Byte count is not multiple of 4 or is not a permitted value */
+#define IAP_INVALID_SECTOR 7 /*!< Sector number is invalid or end sector number is greater than start sector number */
+#define IAP_SECTOR_NOT_BLANK 8 /*!< Sector is not blank */
+#define IAP_SECTOR_NOT_PREPARED 9 /*!< Command to prepare sector for write operation was not executed */
+#define IAP_COMPARE_ERROR 10 /*!< Source and destination data not equal */
+#define IAP_BUSY 11 /*!< Flash programming hardware interface is busy */
+#define IAP_PARAM_ERROR 12 /*!< nsufficient number of parameters or invalid parameter */
+#define IAP_ADDR_ERROR 13 /*!< Address is not on word boundary */
+#define IAP_ADDR_NOT_MAPPED 14 /*!< Address is not mapped in the memory map */
+#define IAP_CMD_LOCKED 15 /*!< Command is locked */
+#define IAP_INVALID_CODE 16 /*!< Unlock code is invalid */
+#define IAP_INVALID_BAUD_RATE 17 /*!< Invalid baud rate setting */
+#define IAP_INVALID_STOP_BIT 18 /*!< Invalid stop bit setting */
+#define IAP_CRP_ENABLED 19 /*!< Code read protection enabled */
+
+/* IAP_ENTRY API function type */
+typedef void (*IAP_ENTRY_T)(unsigned int[5], unsigned int[4]);
+
+/**
+ * @brief Prepare sector for write operation
+ * @param strSector : Start sector number
+ * @param endSector : End sector number
+ * @return Status code to indicate the command is executed successfully or not
+ * @note This command must be executed before executing "Copy RAM to flash"
+ * or "Erase Sector" command.
+ * The end sector must be greater than or equal to start sector number
+ */
+uint8_t Chip_IAP_PreSectorForReadWrite(uint32_t strSector, uint32_t endSector);
+
+/**
+ * @brief Copy RAM to flash
+ * @param dstAdd : Destination flash address where data bytes are to be written
+ * @param srcAdd : Source flash address where data bytes are to be read
+ * @param byteswrt : Number of bytes to be written
+ * @return Status code to indicate the command is executed successfully or not
+ * @note The addresses should be a 256 byte boundary and the number of bytes
+ * should be 256 | 512 | 1024 | 4096
+ */
+uint8_t Chip_IAP_CopyRamToFlash(uint32_t dstAdd, uint32_t *srcAdd, uint32_t byteswrt);
+
+/**
+ * @brief Erase sector
+ * @param strSector : Start sector number
+ * @param endSector : End sector number
+ * @return Status code to indicate the command is executed successfully or not
+ * @note The end sector must be greater than or equal to start sector number
+ */
+uint8_t Chip_IAP_EraseSector(uint32_t strSector, uint32_t endSector);
+
+/**
+ * @brief Blank check a sector or multiples sector of on-chip flash memory
+ * @param strSector : Start sector number
+ * @param endSector : End sector number
+ * @return Offset of the first non blank word location if the status code is SECTOR_NOT_BLANK
+ * @note The end sector must be greater than or equal to start sector number
+ */
+// FIXME - There are two return value (result[0] & result[1]
+// Result0:Offset of the first non blank word location if the Status Code is
+// SECTOR_NOT_BLANK.
+// Result1:Contents of non blank word location.
+uint8_t Chip_IAP_BlankCheckSector(uint32_t strSector, uint32_t endSector);
+
+/**
+ * @brief Read part identification number
+ * @return Part identification number
+ */
+uint32_t Chip_IAP_ReadPID(void);
+
+/**
+ * @brief Read boot code version number
+ * @return Boot code version number
+ */
+uint8_t Chip_IAP_ReadBootCode(void);
+
+/**
+ * @brief Compare the memory contents at two locations
+ * @param dstAdd : Destination of the RAM address of data bytes to be compared
+ * @param srcAdd : Source of the RAM address of data bytes to be compared
+ * @param bytescmp : Number of bytes to be compared
+ * @return Offset of the first mismatch of the status code is COMPARE_ERROR
+ * @note The addresses should be a word boundary and number of bytes should be
+ * a multiply of 4
+ */
+uint8_t Chip_IAP_Compare(uint32_t dstAdd, uint32_t srcAdd, uint32_t bytescmp);
+
+/**
+ * @brief IAP reinvoke ISP to invoke the bootloader in ISP mode
+ * @return none
+ */
+uint8_t Chip_IAP_ReinvokeISP(void);
+
+/**
+ * @brief Read the unique ID
+ * @return Status code to indicate the command is executed successfully or not
+ */
+uint32_t Chip_IAP_ReadUID(void);
+
+/**
+ * @brief Erase a page or multiple papers of on-chip flash memory
+ * @param strPage : Start page number
+ * @param endPage : End page number
+ * @return Status code to indicate the command is executed successfully or not
+ * @note The page number must be greater than or equal to start page number
+ */
+// FIXME - There are four return value
+// Result0:The first 32-bit word (at the lowest address)
+// Result1:The second 32-bit word.
+// Result2:The third 32-bit word.
+// Result3:The fourth 32-bit word.
+uint8_t Chip_IAP_ErasePage(uint32_t strPage, uint32_t endPage);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __IAP_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/inmux_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/inmux_15xx.h
new file mode 100644
index 0000000..214e739
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/inmux_15xx.h
@@ -0,0 +1,315 @@
+/*
+ * @brief LPC15xx Input Mux Registers and Driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __INMUX_15XX_H_
+#define __INMUX_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup INMUX_15XX CHIP: LPC15xx Input Mux Registers and Driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief LPC15xx Input Mux Register Block Structure
+ */
+typedef struct { /*!< INMUX Structure */
+ __IO uint32_t SCT0_INMUX[7]; /*!< Input mux registers for SCT0 inputs */
+ __I uint32_t RESERVED1[1];
+ __IO uint32_t SCT1_INMUX[7]; /*!< Input mux registers for SCT1 inputs */
+ __I uint32_t RESERVED2[1];
+ __IO uint32_t SCT2_INMUX[3]; /*!< Input mux registers for SCT2 inputs */
+ __I uint32_t RESERVED3[5];
+ __IO uint32_t SCT3_INMUX[3]; /*!< Input mux registers for SCT3 inputs */
+ __I uint32_t RESERVED4[5];
+ __I uint32_t RESERVED4A[16];
+ __IO uint32_t PINTSEL[8]; /*!< Pin interrupt select registers */
+ __IO uint32_t DMA_ITRIG_INMUX[18]; /*!< Input mux register for DMA trigger inputs */
+ __I uint32_t RESERVED5[6];
+ __IO uint32_t DMA_INMUX[4]; /*!< Input mux register for DMA trigger inputs */
+ __I uint32_t RESERVED6[4];
+ __IO uint32_t FREQMEAS_REF; /*!< Clock selection for frequency measurement ref clock */
+ __IO uint32_t FREQMEAS_TARGET; /*!< Clock selection for frequency measurement target clock */
+} LPC_INMUX_T;
+
+/* SCT input mux mapping selections for SCT0 inputs 0-6 */
+typedef enum {
+ SCT0_INMUX_PIO0_2 = 0,
+ SCT0_INMUX_PIO0_3,
+ SCT0_INMUX_PIO0_17,
+ SCT0_INMUX_PIO0_30,
+ SCT0_INMUX_PIO1_6,
+ SCT0_INMUX_PIO1_7,
+ SCT0_INMUX_PIO1_12,
+ SCT0_INMUX_PIO1_13,
+ SCT0_INMUX_SCT1_OUT4,
+ SCT0_INMUX_SCT2_OUT4,
+ SCT0_INMUX_SCT2_OUT5,
+ SCT0_INMUX_ADC0_THCMP_IRQ,
+ SCT0_INMUX_ADC1_THCMP_IRQ,
+ SCT0_INMUX_ACMP0_OUT,
+ SCT0_INMUX_ACMP1_OUT,
+ SCT0_INMUX_ACMP2_OUT,
+ SCT0_INMUX_ACMP3_OUT,
+ SCT0_INMUX_SCTIPU_ABORT,
+ SCT0_INMUX_SCTIPU_SAMPLE0,
+ SCT0_INMUX_SCTIPU_SAMPLE1,
+ SCT0_INMUX_SCTIPU_SAMPLE2,
+ SCT0_INMUX_SCTIPU_SAMPLE3,
+ SCT0_INMUX_DEBUG_HALTED
+} SCT0_INMUX_T;
+
+/**
+ * @brief Selects an input source for SCT0 input 0 to 6
+ * @param input : SCT0 input to use, 0 - 6
+ * @param src : Source to map to the SCT input
+ * @return Nothing
+ */
+STATIC INLINE void Chip_INMUX_SelectSCT0Src(uint8_t input, SCT0_INMUX_T src)
+{
+ LPC_INMUX->SCT0_INMUX[input] = (uint32_t) src;
+}
+
+/* SCT input mux mapping selections for SCT1 inputs 0-6 */
+typedef enum {
+ SCT1_INMUX_PIO0_15 = 0,
+ SCT1_INMUX_PIO0_16,
+ SCT1_INMUX_PIO0_21,
+ SCT1_INMUX_PIO0_31,
+ SCT1_INMUX_PIO1_4,
+ SCT1_INMUX_PIO1_5,
+ SCT1_INMUX_PIO1_15,
+ SCT1_INMUX_PIO1_16,
+ SCT1_INMUX_SCT0_OUT4,
+ SCT1_INMUX_SCT3_OUT4,
+ SCT1_INMUX_SCT3_OUT5,
+ SCT1_INMUX_ADC0_THCMP_IRQ,
+ SCT1_INMUX_ADC1_THCMP_IRQ,
+ SCT1_INMUX_ACMP0_OUT,
+ SCT1_INMUX_ACMP1_OUT,
+ SCT1_INMUX_ACMP2_OUT,
+ SCT1_INMUX_ACMP3_OUT,
+ SCT1_INMUX_SCTIPU_ABORT,
+ SCT1_INMUX_SCTIPU_SAMPLE0,
+ SCT1_INMUX_SCTIPU_SAMPLE1,
+ SCT1_INMUX_SCTIPU_SAMPLE2,
+ SCT1_INMUX_SCTIPU_SAMPLE3,
+ SCT1_INMUX_DEBUG_HALTED
+} SCT1_INMUX_T;
+
+/**
+ * @brief Selects an input source for SCT1 input 0 to 6
+ * @param input : SCT1 input to use, 0 - 6
+ * @param src : Source to map to the SCT input
+ * @return Nothing
+ */
+STATIC INLINE void Chip_INMUX_SelectSCT1Src(uint8_t input, SCT1_INMUX_T src)
+{
+ LPC_INMUX->SCT1_INMUX[input] = (uint32_t) src;
+}
+
+/* SCT input mux mapping selections for SCT2 inputs 0-2 */
+typedef enum {
+ SCT2_INMUX_PIO0_4 = 0,
+ SCT2_INMUX_PIO0_27,
+ SCT2_INMUX_PIO1_18,
+ SCT2_INMUX_PIO1_19,
+ SCT2_INMUX_SCT0_OUT4,
+ SCT2_INMUX_SCT0_OUT5,
+ SCT2_INMUX_SCT0_OUT7,
+ SCT2_INMUX_SCT0_OUT8,
+ SCT2_INMUX_ADC0_THCMP_IRQ,
+ SCT2_INMUX_ADC1_THCMP_IRQ,
+ SCT2_INMUX_ACMP0_OUT,
+ SCT2_INMUX_ACMP1_OUT,
+ SCT2_INMUX_ACMP2_OUT,
+ SCT2_INMUX_ACMP3_OUT,
+ SCT2_INMUX_SCTIPU_ABORT,
+ SCT2_INMUX_SCTIPU_SAMPLE0,
+ SCT2_INMUX_SCTIPU_SAMPLE1,
+ SCT2_INMUX_SCTIPU_SAMPLE2,
+ SCT2_INMUX_SCTIPU_SAMPLE3,
+ SCT2_INMUX_USB_FRAME_TOGGLE,
+ SCT2_INMUX_DEBUG_HALTED
+} SCT2_INMUX_T;
+
+/**
+ * @brief Selects an input source for SCT2 input 0 to 2
+ * @param input : SCT2 input to use, 0 - 2
+ * @param src : Source to map to the SCT input
+ * @return Nothing
+ */
+STATIC INLINE void Chip_INMUX_SelectSCT2Src(uint8_t input, SCT2_INMUX_T src)
+{
+ LPC_INMUX->SCT2_INMUX[input] = (uint32_t) src;
+}
+
+/* SCT input mux mapping selections for SCT3 inputs 0-2 */
+typedef enum {
+ SCT3_INMUX_PIO0_7 = 0,
+ SCT3_INMUX_PIO1_11,
+ SCT3_INMUX_PIO1_21,
+ SCT3_INMUX_PIO1_22,
+ SCT3_INMUX_SCT1_OUT4,
+ SCT3_INMUX_SCT1_OUT5,
+ SCT3_INMUX_SCT1_OUT7,
+ SCT3_INMUX_SCT1_OUT8,
+ SCT3_INMUX_ADC0_THCMP_IRQ,
+ SCT3_INMUX_ADC1_THCMP_IRQ,
+ SCT3_INMUX_ACMP0_OUT,
+ SCT3_INMUX_ACMP1_OUT,
+ SCT3_INMUX_ACMP2_OUT,
+ SCT3_INMUX_ACMP3_OUT,
+ SCT3_INMUX_SCTIPU_ABORT3,
+ SCT3_INMUX_SCTIPU_SAMPLE0,
+ SCT3_INMUX_SCTIPU_SAMPLE1,
+ SCT3_INMUX_SCTIPU_SAMPLE2,
+ SCT3_INMUX_SCTIPU_SAMPLE3,
+ SCT3_INMUX_USB_FRAME_TOGGLE,
+ SCT3_INMUX_DEBUG_HALTED
+} SCT3_INMUX_T;
+
+/**
+ * @brief Selects an input source for SCT3 input 0 to 2
+ * @param input : SCT3 input to use, 0 - 2
+ * @param src : Source to map to the SCT input
+ * @return Nothing
+ */
+STATIC INLINE void Chip_INMUX_SelectSCT3Src(uint8_t input, SCT3_INMUX_T src)
+{
+ LPC_INMUX->SCT3_INMUX[input] = (uint32_t) src;
+}
+
+/**
+ * @brief GPIO Pin Interrupt Pin Select (sets PINTSEL register)
+ * @param pintSel : GPIO PINTSEL interrupt, should be: 0 to 7
+ * @param portNum : GPIO port number interrupt, should be: 0 to 1
+ * @param pinNum : GPIO pin number Interrupt, should be: 0 to 31
+ * @return Nothing
+ */
+STATIC INLINE void Chip_INMUX_PinIntSel(uint8_t pintSel, uint8_t portNum, uint8_t pinNum)
+{
+ LPC_INMUX->PINTSEL[pintSel] = (portNum * 32) + pinNum;
+}
+
+/* DMA triggers that can mapped to DMA channels */
+typedef enum {
+ DMATRIG_ADC0_SEQA_IRQ = 0, /*!< ADC0 sequencer A interrupt as trigger */
+ DMATRIG_ADC0_SEQB_IRQ, /*!< ADC0 sequencer B interrupt as trigger */
+ DMATRIG_ADC1_SEQA_IRQ, /*!< ADC1 sequencer A interrupt as trigger */
+ DMATRIG_ADC1_SEQB_IRQ, /*!< ADC1 sequencer B interrupt as trigger */
+ DMATRIG_SCT0_DMA0, /*!< SCT 0, DMA 0 as trigger */
+ DMATRIG_SCT0_DMA1, /*!< SCT 1, DMA 1 as trigger */
+ DMATRIG_SCT1_DMA0, /*!< SCT 0, DMA 0 as trigger */
+ DMATRIG_SCT1_DMA1, /*!< SCT 1, DMA 1 as trigger */
+ DMATRIG_SCT2_DMA0, /*!< SCT 2, DMA 0 as trigger */
+ DMATRIG_SCT2_DMA1, /*!< SCT 2, DMA 1 as trigger */
+ DMATRIG_SCT3_DMA0, /*!< SCT 3, DMA 0 as trigger */
+ DMATRIG_SCT3_DMA1, /*!< SCT 3, DMA 1 as trigger */
+ DMATRIG_ACMP0_OUT, /*!< Analog comparator 0 output as trigger */
+ DMATRIG_ACMP1_OUT, /*!< Analog comparator 1 output as trigger */
+ DMATRIG_ACMP2_OUT, /*!< Analog comparator 2 output as trigger */
+ DMATRIG_ACMP3_OUT, /*!< Analog comparator 3 output as trigger */
+ DMATRIG_OUTMUX0, /*!< DMA trigger tied to this source, Select with Chip_INMUX_SetDMAOutMux */
+ DMATRIG_OUTMUX1, /*!< DMA trigger tied to this source, Select with Chip_INMUX_SetDMAOutMux */
+ DMATRIG_OUTMUX2, /*!< DMA trigger tied to this source, Select with Chip_INMUX_SetDMAOutMux */
+ DMATRIG_OUTMUX3 /*!< DMA trigger tied to this source, Select with Chip_INMUX_SetDMAOutMux */
+} DMA_TRIGSRC_T;
+
+/**
+ * @brief Select a trigger source for a DMA channel
+ * @param ch : DMA channel number
+ * @param trig : Trigger source for the DMA channel
+ * @return Nothing
+ */
+STATIC INLINE void Chip_INMUX_SetDMATrigger(uint8_t ch, DMA_TRIGSRC_T trig)
+{
+ LPC_INMUX->DMA_ITRIG_INMUX[ch] = (uint32_t) trig;
+}
+
+/**
+ * @brief Selects a DMA trigger source for the DMATRIG_OUTMUXn IDs
+ * @param index : Select 0 to 3 to sets the source for DMATRIG_OUTMUX0 to DMATRIG_OUTMUX3
+ * @param dmaCh : DMA channel to select for DMATRIG_OUTMUXn source
+ * @return Nothing
+ * @note This function sets the DMA trigger (out) source used with the DMATRIG_OUTMUXn
+ * trigger source.
+ */
+STATIC INLINE void Chip_INMUX_SetDMAOutMux(uint8_t index, uint8_t dmaCh)
+{
+ LPC_INMUX->DMA_INMUX[index] = (uint32_t) dmaCh;
+}
+
+/* Freqeuency mearure reference and target clock sources */
+typedef enum {
+ FREQMSR_MAIN_OSC = 0, /*!< System oscillator */
+ FREQMSR_IRC, /*!< Internal RC (IRC) oscillator */
+ FREQMSR_WDOSC, /*!< Watchdog oscillator */
+ FREQMSR_32KHZOSC, /*!< 32KHz (RTC) oscillator rate */
+ FREQMSR_USB_FTOGGLE, /*!< USB FTOGGLE rate */
+ FREQMSR_PIO0_5, /*!< External pin PIO0_5 as input rate */
+ FREQMSR_PIO0_19, /*!< External pin PIO0_19 as input rate */
+ FREQMSR_PIO0_30, /*!< External pin PIO0_30 as input rate */
+ FREQMSR_PIO1_27 /*!< External pin PIO1_27 as input rate */
+} FREQMSR_SRC_T;
+
+/**
+ * @brief Selects a reference clock used with the frequency measure function
+ * @param ref : Frequency measure function reference clock
+ * @return Nothing
+ */
+STATIC INLINE void Chip_INMUX_SetFreqMeasRefClock(FREQMSR_SRC_T ref)
+{
+ LPC_INMUX->FREQMEAS_REF = (uint32_t) ref;
+}
+
+/**
+ * @brief Selects a target clock used with the frequency measure function
+ * @param targ : Frequency measure function reference clock
+ * @return Nothing
+ */
+STATIC INLINE void Chip_INMUX_SetFreqMeasTargClock(FREQMSR_SRC_T targ)
+{
+ LPC_INMUX->FREQMEAS_TARGET = (uint32_t) targ;
+}
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __INMUX_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/iocon_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/iocon_15xx.h
new file mode 100644
index 0000000..7435d74
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/iocon_15xx.h
@@ -0,0 +1,131 @@
+/*
+ * @brief LPC15xx IOCON driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __IOCON_15XX_H_
+#define __IOCON_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup IOCON_15XX CHIP: LPC15xx IO Control driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief LPC15XX IO Configuration Unit register block structure
+ */
+typedef struct { /*!< LPC15XX IOCON Structure */
+ __IO uint32_t PIO[3][32];
+} LPC_IOCON_T;
+
+/**
+ * @brief Array of IOCON pin definitions passed to Chip_IOCON_SetPinMuxing() must be in this format
+ */
+typedef struct {
+ uint32_t port : 8; /* Pin port */
+ uint32_t pin : 8; /* Pin number */
+ uint32_t modefunc : 16; /* Function and mode */
+} PINMUX_GRP_T;
+
+/**
+ * IOCON function and mode selection definitions
+ * See the User Manual for specific modes and functions supported by the
+ * various LPC15XX pins.
+ */
+#define IOCON_FUNC0 0x0 /*!< Selects pin function 0 */
+#define IOCON_FUNC1 0x1 /*!< Selects pin function 1 */
+#define IOCON_FUNC2 0x2 /*!< Selects pin function 2 */
+#define IOCON_MODE_INACT (0x0 << 3) /*!< No addition pin function */
+#define IOCON_MODE_PULLDOWN (0x1 << 3) /*!< Selects pull-down function */
+#define IOCON_MODE_PULLUP (0x2 << 3) /*!< Selects pull-up function */
+#define IOCON_MODE_REPEATER (0x3 << 3) /*!< Selects pin repeater function */
+#define IOCON_HYS_EN (0x1 << 5) /*!< Enables hysteresis */
+#define IOCON_INV_EN (0x1 << 6) /*!< Enables invert function on input */
+#define IOCON_ADMODE_EN (0x0 << 7) /*!< Enables analog input function (analog pins only) */
+#define IOCON_DIGMODE_EN (0x1 << 7) /*!< Enables digital function (analog pins only) */
+#define IOCON_SFI2C_EN (0x0 << 8) /*!< I2C standard mode/fast-mode */
+#define IOCON_STDI2C_EN (0x1 << 8) /*!< I2C standard I/O functionality */
+#define IOCON_FASTI2C_EN (0x2 << 8) /*!< I2C Fast-mode Plus */
+#define IOCON_OPENDRAIN_EN (0x1 << 10) /*!< Enables open-drain function */
+#define IOCON_S_MODE_0CLK (0x0 << 11) /*!< Bypass input filter */
+#define IOCON_S_MODE_1CLK (0x1 << 11) /*!< Input pulses shorter than 1 filter clock are rejected */
+#define IOCON_S_MODE_2CLK (0x2 << 11) /*!< Input pulses shorter than 2 filter clock2 are rejected */
+#define IOCON_S_MODE_3CLK (0x3 << 11) /*!< Input pulses shorter than 3 filter clock2 are rejected */
+#define IOCON_S_MODE(clks) ((clks) << 11) /*!< Select clocks for digital input filter mode */
+#define IOCON_CLKDIV(div) ((div) << 13) /*!< Select peripheral clock divider for input filter sampling clock, 2^n, n=0-6 */
+
+/**
+ * @brief Sets I/O Control pin mux
+ * @param pIOCON : The base of IOCON peripheral on the chip
+ * @param port : GPIO port to mux
+ * @param pin : GPIO pin to mux
+ * @param modefunc : OR'ed values or type IOCON_*
+ * @return Nothing
+ */
+STATIC INLINE void Chip_IOCON_PinMuxSet(LPC_IOCON_T *pIOCON, uint8_t port, uint8_t pin, uint32_t modefunc)
+{
+ pIOCON->PIO[port][pin] = modefunc;
+}
+
+/**
+ * @brief I/O Control pin mux
+ * @param pIOCON : The base of IOCON peripheral on the chip
+ * @param port : GPIO port to mux
+ * @param pin : GPIO pin to mux
+ * @param mode : OR'ed values or type IOCON_*
+ * @param func : Pin function, value of type IOCON_FUNC?
+ * @return Nothing
+ */
+STATIC INLINE void Chip_IOCON_PinMux(LPC_IOCON_T *pIOCON, uint8_t port, uint8_t pin, uint16_t mode, uint8_t func)
+{
+ Chip_IOCON_PinMuxSet(pIOCON, port, pin, (uint32_t) (mode | func));
+}
+
+/**
+ * @brief Set all I/O Control pin muxing
+ * @param pIOCON : The base of IOCON peripheral on the chip
+ * @param pinArray : Pointer to array of pin mux selections
+ * @param arrayLength : Number of entries in pinArray
+ * @return Nothing
+ */
+void Chip_IOCON_SetPinMuxing(LPC_IOCON_T *pIOCON, const PINMUX_GRP_T *pinArray, uint32_t arrayLength);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __IOCON_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/lpc_types.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/lpc_types.h
new file mode 100644
index 0000000..23dba12
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/lpc_types.h
@@ -0,0 +1,216 @@
+/*
+ * @brief Common types used in LPC functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2012
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __LPC_TYPES_H_
+#define __LPC_TYPES_H_
+
+#include <stdint.h>
+#include <stdbool.h>
+
+/** @defgroup LPC_Types CHIP: LPC Common Types
+ * @ingroup CHIP_Common
+ * @{
+ */
+
+/** @defgroup LPC_Types_Public_Types LPC Public Types
+ * @{
+ */
+
+/**
+ * @brief Boolean Type definition
+ */
+typedef enum {FALSE = 0, TRUE = !FALSE} Bool;
+
+/**
+ * @brief Boolean Type definition
+ */
+#if !defined(__cplusplus)
+// typedef enum {false = 0, true = !false} bool;
+#endif
+
+/**
+ * @brief Flag Status and Interrupt Flag Status type definition
+ */
+typedef enum {RESET = 0, SET = !RESET} FlagStatus, IntStatus, SetState;
+#define PARAM_SETSTATE(State) ((State == RESET) || (State == SET))
+
+/**
+ * @brief Functional State Definition
+ */
+typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
+#define PARAM_FUNCTIONALSTATE(State) ((State == DISABLE) || (State == ENABLE))
+
+/**
+ * @ Status type definition
+ */
+typedef enum {ERROR = 0, SUCCESS = !ERROR} Status;
+
+/**
+ * Read/Write transfer type mode (Block or non-block)
+ */
+typedef enum {
+ NONE_BLOCKING = 0, /**< None Blocking type */
+ BLOCKING, /**< Blocking type */
+} TRANSFER_BLOCK_T;
+
+/** Pointer to Function returning Void (any number of parameters) */
+//typedef void (*PFV)();
+
+/** Pointer to Function returning int32_t (any number of parameters) */
+//typedef int32_t (*PFI)();
+
+/**
+ * @}
+ */
+
+/** @defgroup LPC_Types_Public_Macros LPC Public Macros
+ * @{
+ */
+
+/* _BIT(n) sets the bit at position "n"
+ * _BIT(n) is intended to be used in "OR" and "AND" expressions:
+ * e.g., "(_BIT(3) | _BIT(7))".
+ */
+#undef _BIT
+/* Set bit macro */
+#define _BIT(n) (1 << (n))
+
+/* _SBF(f,v) sets the bit field starting at position "f" to value "v".
+ * _SBF(f,v) is intended to be used in "OR" and "AND" expressions:
+ * e.g., "((_SBF(5,7) | _SBF(12,0xF)) & 0xFFFF)"
+ */
+#undef _SBF
+/* Set bit field macro */
+#define _SBF(f, v) ((v) << (f))
+
+/* _BITMASK constructs a symbol with 'field_width' least significant
+ * bits set.
+ * e.g., _BITMASK(5) constructs '0x1F', _BITMASK(16) == 0xFFFF
+ * The symbol is intended to be used to limit the bit field width
+ * thusly:
+ * <a_register> = (any_expression) & _BITMASK(x), where 0 < x <= 32.
+ * If "any_expression" results in a value that is larger than can be
+ * contained in 'x' bits, the bits above 'x - 1' are masked off. When
+ * used with the _SBF example above, the example would be written:
+ * a_reg = ((_SBF(5,7) | _SBF(12,0xF)) & _BITMASK(16))
+ * This ensures that the value written to a_reg is no wider than
+ * 16 bits, and makes the code easier to read and understand.
+ */
+#undef _BITMASK
+/* Bitmask creation macro */
+#define _BITMASK(field_width) ( _BIT(field_width) - 1)
+
+/* NULL pointer */
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+/* Number of elements in an array */
+#define NELEMENTS(array) (sizeof(array) / sizeof(array[0]))
+
+/* Static data/function define */
+#define STATIC static
+/* External data/function define */
+#define EXTERN extern
+
+#if !defined(MAX)
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+#endif
+#if !defined(MIN)
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#endif
+
+/**
+ * @}
+ */
+
+/* Old Type Definition compatibility */
+/** @addtogroup LPC_Types_Public_Types
+ * @{
+ */
+
+/** LPC type for character type */
+typedef char CHAR;
+
+/** LPC type for 8 bit unsigned value */
+typedef uint8_t UNS_8;
+
+/** LPC type for 8 bit signed value */
+typedef int8_t INT_8;
+
+/** LPC type for 16 bit unsigned value */
+typedef uint16_t UNS_16;
+
+/** LPC type for 16 bit signed value */
+typedef int16_t INT_16;
+
+/** LPC type for 32 bit unsigned value */
+typedef uint32_t UNS_32;
+
+/** LPC type for 32 bit signed value */
+typedef int32_t INT_32;
+
+/** LPC type for 64 bit signed value */
+typedef int64_t INT_64;
+
+/** LPC type for 64 bit unsigned value */
+typedef uint64_t UNS_64;
+
+#ifdef __CODE_RED
+#define BOOL_32 bool
+#define BOOL_16 bool
+#define BOOL_8 bool
+#else
+/** 32 bit boolean type */
+typedef bool BOOL_32;
+
+/** 16 bit boolean type */
+typedef bool BOOL_16;
+
+/** 8 bit boolean type */
+typedef bool BOOL_8;
+#endif
+
+#ifdef __CC_ARM
+#define INLINE __inline
+#else
+#define INLINE inline
+#endif
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+#endif /* __LPC_TYPES_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/mrt_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/mrt_15xx.h
new file mode 100644
index 0000000..f153dc4
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/mrt_15xx.h
@@ -0,0 +1,339 @@
+/*
+ * @brief LPC15xx Multi-Rate Timer (MRT) registers and driver functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2012
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __MRT_15XX_H_
+#define __MRT_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup MRT_15XX CHIP: LPC15xx Multi-Rate Timer driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief LPC15xx MRT chip configuration
+ */
+#define MRT_CHANNELS_NUM (4)
+#define MRT_NO_IDLE_CHANNEL (0x40)
+
+/**
+ * @brief MRT register block structure
+ */
+typedef struct {
+ __IO uint32_t INTVAL; /*!< Timer interval register */
+ __O uint32_t TIMER; /*!< Timer register */
+ __IO uint32_t CTRL; /*!< Timer control register */
+ __IO uint32_t STAT; /*!< Timer status register */
+} LPC_MRT_CH_T;
+
+/**
+ * @brief MRT register block structure
+ */
+typedef struct {
+ LPC_MRT_CH_T CHANNEL[MRT_CHANNELS_NUM];
+ uint32_t unused[45];
+ __O uint32_t IDLE_CH;
+ __IO uint32_t IRQ_FLAG;
+} LPC_MRT_T;
+
+/**
+ * @brief MRT Interrupt Modes enum
+ */
+typedef enum MRT_MODE {
+ MRT_MODE_REPEAT = (0 << 1), /*!< MRT Repeat interrupt mode */
+ MRT_MODE_ONESHOT = (1 << 1) /*!< MRT One-shot interrupt mode */
+} MRT_MODE_T;
+
+/**
+ * @brief MRT register bit fields & masks
+ */
+/* MRT Time interval register bit fields */
+#define MRT_INTVAL_IVALUE (0x00FFFFFF) /* Maximum interval load value and mask */
+#define MRT_INTVAL_LOAD (0x80000000UL) /* Force immediate load of timer interval register bit */
+
+/* MRT Control register bit fields & masks */
+#define MRT_CTRL_INTEN_MASK (0x01)
+#define MRT_CTRL_MODE_MASK (0x06)
+
+/* MRT Status register bit fields & masks */
+#define MRT_STAT_INTFLAG (0x01)
+#define MRT_STAT_RUNNING (0x02)
+
+/* Pointer to individual MR register blocks */
+#define LPC_MRT_CH0 ((LPC_MRT_CH_T *) &LPC_MRT->CHANNEL[0])
+#define LPC_MRT_CH1 ((LPC_MRT_CH_T *) &LPC_MRT->CHANNEL[1])
+#define LPC_MRT_CH2 ((LPC_MRT_CH_T *) &LPC_MRT->CHANNEL[2])
+#define LPC_MRT_CH3 ((LPC_MRT_CH_T *) &LPC_MRT->CHANNEL[3])
+#define LPC_MRT_CH(ch) ((LPC_MRT_CH_T *) &LPC_MRT->CHANNEL[(ch)])
+
+/* Global interrupt flag register interrupt mask/clear values */
+#define MRT0_INTFLAG (1)
+#define MRT1_INTFLAG (2)
+#define MRT2_INTFLAG (4)
+#define MRT3_INTFLAG (8)
+#define MRTn_INTFLAG(ch) (1 << (ch))
+
+/**
+ * @brief Initializes the MRT
+ * @return Nothing
+ */
+STATIC INLINE void Chip_MRT_Init(void)
+{
+ /* Enable the clock to the register interface */
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_MRT);
+
+ /* Reset MRT */
+ Chip_SYSCTL_PeriphReset(RESET_MRT);
+}
+
+/**
+ * @brief De-initializes the MRT Channel
+ * @return Nothing
+ */
+STATIC INLINE void Chip_MRT_DeInit(void)
+{
+ /* Disable the clock to the MRT */
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_MRT);
+}
+
+/**
+ * @brief Returns a pointer to the register block for a MRT channel
+ * @param ch : MRT channel tog et register block for (0..3)
+ * @return Pointer to the MRT register block for the channel
+ */
+STATIC INLINE LPC_MRT_CH_T *Chip_MRT_GetRegPtr(uint8_t ch)
+{
+ return LPC_MRT_CH(ch);
+}
+
+/**
+ * @brief Returns the timer time interval value
+ * @param pMRT : Pointer to selected MRT Channel
+ * @return Timer time interval value (IVALUE)
+ */
+STATIC INLINE uint32_t Chip_MRT_GetInterval(LPC_MRT_CH_T *pMRT)
+{
+ return pMRT->INTVAL;
+}
+
+/**
+ * @brief Sets the timer time interval value
+ * @param pMRT : Pointer to selected MRT Channel
+ * @param interval : The interval timeout (31-bits)
+ * @return Nothing
+ * @note Setting bit 31 in timer time interval register causes the time interval value
+ * to load immediately, otherwise the time interval value will be loaded in
+ * next timer cycle.<br>
+ * Example: Chip_MRT_SetInterval(pMRT, 0x500 | MRT_INTVAL_LOAD); // Will load timer interval immediately<br>
+ * Example: Chip_MRT_SetInterval(pMRT, 0x500); // Will load timer interval after internal expires
+ */
+STATIC INLINE void Chip_MRT_SetInterval(LPC_MRT_CH_T *pMRT, uint32_t interval)
+{
+ pMRT->INTVAL = interval;
+}
+
+/**
+ * @brief Returns the current timer value
+ * @param pMRT : Pointer to selected MRT Channel
+ * @return The current timer value
+ */
+STATIC INLINE uint32_t Chip_MRT_GetTimer(LPC_MRT_CH_T *pMRT)
+{
+ return pMRT->TIMER;
+}
+
+/**
+ * @brief Returns true if the timer is enabled
+ * @param pMRT : Pointer to selected MRT Channel
+ * @return True if enabled, Flase if not enabled
+ */
+STATIC INLINE bool Chip_MRT_GetEnabled(LPC_MRT_CH_T *pMRT)
+{
+ return (bool) ((pMRT->CTRL & MRT_CTRL_INTEN_MASK) != 0);
+}
+
+/**
+ * @brief Enables the timer
+ * @param pMRT : Pointer to selected MRT Channel
+ * @return Nothing
+ */
+STATIC INLINE void Chip_MRT_SetEnabled(LPC_MRT_CH_T *pMRT)
+{
+ pMRT->CTRL |= MRT_CTRL_INTEN_MASK;
+}
+
+/**
+ * @brief Disables the timer
+ * @param pMRT : Pointer to selected MRT Channel
+ * @return Nothing
+ */
+STATIC INLINE void Chip_MRT_SetDisabled(LPC_MRT_CH_T *pMRT)
+{
+ pMRT->CTRL &= ~MRT_CTRL_INTEN_MASK;
+}
+
+/**
+ * @brief Returns the timer mode (repeat or one-shot)
+ * @param pMRT : Pointer to selected MRT Channel
+ * @return The current timer mode
+ */
+STATIC INLINE MRT_MODE_T Chip_MRT_GetMode(LPC_MRT_CH_T *pMRT)
+{
+ return (MRT_MODE_T) (pMRT->CTRL & MRT_CTRL_MODE_MASK);
+}
+
+/**
+ * @brief Sets the timer mode (repeat or one-shot)
+ * @param pMRT : Pointer to selected MRT Channel
+ * @param mode : Timer mode
+ * @return Nothing
+ */
+STATIC INLINE void Chip_MRT_SetMode(LPC_MRT_CH_T *pMRT, MRT_MODE_T mode)
+{
+ uint32_t reg;
+
+ reg = pMRT->CTRL & ~MRT_CTRL_MODE_MASK;
+ pMRT->CTRL = reg | (uint32_t) mode;
+}
+
+/**
+ * @brief Check if the timer is configured in repeat mode
+ * @param pMRT : Pointer to selected MRT Channel
+ * @return True if in repeat mode, False if in one-shot mode
+ */
+STATIC INLINE bool Chip_MRT_IsRepeatMode(LPC_MRT_CH_T *pMRT)
+{
+ return ((pMRT->CTRL & MRT_CTRL_MODE_MASK) != 0) ? false : true;
+}
+
+/**
+ * @brief Check if the timer is configured in one-shot mode
+ * @param pMRT : Pointer to selected MRT Channel
+ * @return True if in one-shot mode, False if in repeat mode
+ */
+STATIC INLINE bool Chip_MRT_IsOneShotMode(LPC_MRT_CH_T *pMRT)
+{
+ return ((pMRT->CTRL & MRT_CTRL_MODE_MASK) != 0) ? true : false;
+}
+
+/**
+ * @brief Check if the timer has an interrupt pending
+ * @param pMRT : Pointer to selected MRT Channel
+ * @return True if interrupt is pending, False if no interrupt is pending
+ */
+STATIC INLINE bool Chip_MRT_IntPending(LPC_MRT_CH_T *pMRT)
+{
+ return (bool) ((pMRT->STAT & MRT_STAT_INTFLAG) != 0);
+}
+
+/**
+ * @brief Clears the pending interrupt (if any)
+ * @param pMRT : Pointer to selected MRT Channel
+ * @return Nothing
+ */
+STATIC INLINE void Chip_MRT_IntClear(LPC_MRT_CH_T *pMRT)
+{
+ pMRT->STAT |= MRT_STAT_INTFLAG;
+}
+
+/**
+ * @brief Check if the timer is running
+ * @param pMRT : Pointer to selected MRT Channel
+ * @return True if running, False if stopped
+ */
+STATIC INLINE bool Chip_MRT_Running(LPC_MRT_CH_T *pMRT)
+{
+ return (bool) ((pMRT->STAT & MRT_STAT_RUNNING) != 0);
+}
+
+/**
+ * @brief Returns the IDLE channel value
+ * @return IDLE channel value (unshifted in bits 7..4)
+ */
+STATIC INLINE uint8_t Chip_MRT_GetIdleChannel(void)
+{
+ return (uint8_t) (LPC_MRT->IDLE_CH);
+}
+
+/**
+ * @brief Returns the IDLE channel value
+ * @return IDLE channel value (shifted in bits 3..0)
+ */
+STATIC INLINE uint8_t Chip_MRT_GetIdleChannelShifted(void)
+{
+ return (uint8_t) (Chip_MRT_GetIdleChannel() >> 4);
+}
+
+/**
+ * @brief Returns the interrupt pending status for all MRT channels
+ * @return IRQ pending channel bitfield(bit 0 = MRT0, bit 1 = MRT1, etc.)
+ */
+STATIC INLINE uint32_t Chip_MRT_GetIntPending(void)
+{
+ return LPC_MRT->IRQ_FLAG;
+}
+
+/**
+ * @brief Returns the interrupt pending status for a singel MRT channel
+ * @param ch : Channel to check pending interrupt status for
+ * @return IRQ pending channel number
+ */
+STATIC INLINE bool Chip_MRT_GetIntPendingByChannel(uint8_t ch)
+{
+ return (bool) (((LPC_MRT->IRQ_FLAG >> ch) & 1) != 0);
+}
+
+/**
+ * @brief Clears the interrupt pending status for one or more MRT channels
+ * @param mask : Channels to clear (bit 0 = MRT0, bit 1 = MRT1, etc.)
+ * @return Nothing
+ * @note Use this function to clear multiple interrupt pending states in
+ * a single call via the IRQ_FLAG register. Performs the same function for
+ * all MRT channels in a single call as the Chip_MRT_IntClear() does for a
+ * single channel.
+ */
+STATIC INLINE void Chip_MRT_ClearIntPending(uint32_t mask)
+{
+ LPC_MRT->IRQ_FLAG = mask;
+}
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MRT_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/pinint_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/pinint_15xx.h
new file mode 100644
index 0000000..842c9fc
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/pinint_15xx.h
@@ -0,0 +1,258 @@
+/*
+ * @brief LPC15xx Pin Interrupt and Pattern Match Registers and driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __PININT_15XX_H_
+#define __PININT_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup PININT_15XX CHIP: LPC15xx Pin Interrupt driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief LPC15xx Pin Interrupt and Pattern Match register block structure
+ */
+typedef struct { /*!< PIN_INT Structure */
+ __IO uint32_t ISEL; /*!< Pin Interrupt Mode register */
+ __IO uint32_t IENR; /*!< Pin Interrupt Enable (Rising) register */
+ __IO uint32_t SIENR; /*!< Set Pin Interrupt Enable (Rising) register */
+ __IO uint32_t CIENR; /*!< Clear Pin Interrupt Enable (Rising) register */
+ __IO uint32_t IENF; /*!< Pin Interrupt Enable Falling Edge / Active Level register */
+ __IO uint32_t SIENF; /*!< Set Pin Interrupt Enable Falling Edge / Active Level register */
+ __IO uint32_t CIENF; /*!< Clear Pin Interrupt Enable Falling Edge / Active Level address */
+ __IO uint32_t RISE; /*!< Pin Interrupt Rising Edge register */
+ __IO uint32_t FALL; /*!< Pin Interrupt Falling Edge register */
+ __IO uint32_t IST; /*!< Pin Interrupt Status register */
+} LPC_PIN_INT_T;
+
+/**
+ * LPC15xx Pin Interrupt channel values
+ */
+#define PININTCH0 (1 << 0)
+#define PININTCH1 (1 << 1)
+#define PININTCH2 (1 << 2)
+#define PININTCH3 (1 << 3)
+#define PININTCH4 (1 << 4)
+#define PININTCH5 (1 << 5)
+#define PININTCH6 (1 << 6)
+#define PININTCH7 (1 << 7)
+#define PININTCH(ch) (1 << (ch))
+
+/**
+ * @brief Initialize Pin interrupt block
+ * @param pPININT : The base address of Pin interrupt block
+ * @return Nothing
+ * @note This function should be used after the Chip_GPIO_Init() function.
+ */
+STATIC INLINE void Chip_PININT_Init(LPC_PIN_INT_T *pPININT)
+{
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_PININT);
+ Chip_SYSCTL_PeriphReset(RESET_PININT);
+}
+
+/**
+ * @brief De-Initialize Pin interrupt block
+ * @param pPININT : The base address of Pin interrupt block
+ * @return Nothing
+ */
+STATIC INLINE void Chip_PININT_DeInit(LPC_PIN_INT_T *pPININT)
+{
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_PININT);
+}
+
+/**
+ * @brief Configure the pins as edge sensitive in Pin interrupt block
+ * @param pPININT : The base address of Pin interrupt block
+ * @param pins : Pins (ORed value of PININTCH*)
+ * @return Nothing
+ */
+STATIC INLINE void Chip_PININT_SetPinModeEdge(LPC_PIN_INT_T *pPININT, uint32_t pins)
+{
+ pPININT->ISEL &= ~pins;
+}
+
+/**
+ * @brief Configure the pins as level sensitive in Pin interrupt block
+ * @param pPININT : The base address of Pin interrupt block
+ * @param pins : Pins (ORed value of PININTCH*)
+ * @return Nothing
+ */
+STATIC INLINE void Chip_PININT_SetPinModeLevel(LPC_PIN_INT_T *pPININT, uint32_t pins)
+{
+ pPININT->ISEL |= pins;
+}
+
+/**
+ * @brief Return current PININT rising edge or high level interrupt enable state
+ * @param pPININT : The base address of Pin interrupt block
+ * @return A bifield containing the high edge/level interrupt enables for each
+ * interrupt. Bit 0 = PININT0, 1 = PININT1, etc.
+ * For each bit, a 0 means the high edge/level interrupt is disabled, while a 1
+ * means it's enabled.
+ */
+STATIC INLINE uint32_t Chip_PININT_GetHighEnabled(LPC_PIN_INT_T *pPININT)
+{
+ return pPININT->IENR;
+}
+
+/**
+ * @brief Enable high edge/level PININT interrupts for pins
+ * @param pPININT : The base address of Pin interrupt block
+ * @param pins : Pins to enable (ORed value of PININTCH*)
+ * @return Nothing
+ */
+STATIC INLINE void Chip_PININT_EnableIntHigh(LPC_PIN_INT_T *pPININT, uint32_t pins)
+{
+ pPININT->SIENR = pins;
+}
+
+/**
+ * @brief Disable high edge/level PININT interrupts for pins
+ * @param pPININT : The base address of Pin interrupt block
+ * @param pins : Pins to disable (ORed value of PININTCH*)
+ * @return Nothing
+ */
+STATIC INLINE void Chip_PININT_DisableIntHigh(LPC_PIN_INT_T *pPININT, uint32_t pins)
+{
+ pPININT->CIENR = pins;
+}
+
+/**
+ * @brief Return current PININT falling edge or low level interrupt enable state
+ * @param pPININT : The base address of Pin interrupt block
+ * @return A bifield containing the low edge/level interrupt enables for each
+ * interrupt. Bit 0 = PININT0, 1 = PININT1, etc.
+ * For each bit, a 0 means the low edge/level interrupt is disabled, while a 1
+ * means it's enabled.
+ */
+STATIC INLINE uint32_t Chip_PININT_GetLowEnabled(LPC_PIN_INT_T *pPININT)
+{
+ return pPININT->IENF;
+}
+
+/**
+ * @brief Enable low edge/level PININT interrupts for pins
+ * @param pPININT : The base address of Pin interrupt block
+ * @param pins : Pins to enable (ORed value of PININTCH*)
+ * @return Nothing
+ */
+STATIC INLINE void Chip_PININT_EnableIntLow(LPC_PIN_INT_T *pPININT, uint32_t pins)
+{
+ pPININT->SIENF = pins;
+}
+
+/**
+ * @brief Disable low edge/level PININT interrupts for pins
+ * @param pPININT : The base address of Pin interrupt block
+ * @param pins : Pins to disable (ORed value of PININTCH*)
+ * @return Nothing
+ */
+STATIC INLINE void Chip_PININT_DisableIntLow(LPC_PIN_INT_T *pPININT, uint32_t pins)
+{
+ pPININT->CIENF = pins;
+}
+
+/**
+ * @brief Return pin states that have a detected latched high edge (RISE) state
+ * @param pPININT : The base address of Pin interrupt block
+ * @return PININT states (bit n = high) with a latched rise state detected
+ */
+STATIC INLINE uint32_t Chip_PININT_GetRiseStates(LPC_PIN_INT_T *pPININT)
+{
+ return pPININT->RISE;
+}
+
+/**
+ * @brief Clears pin states that had a latched high edge (RISE) state
+ * @param pPININT : The base address of Pin interrupt block
+ * @param pins : Pins with latched states to clear
+ * @return Nothing
+ */
+STATIC INLINE void Chip_PININT_ClearRiseStates(LPC_PIN_INT_T *pPININT, uint32_t pins)
+{
+ pPININT->RISE = pins;
+}
+
+/**
+ * @brief Return pin states that have a detected latched falling edge (FALL) state
+ * @param pPININT : The base address of Pin interrupt block
+ * @return PININT states (bit n = high) with a latched rise state detected
+ */
+STATIC INLINE uint32_t Chip_PININT_GetFallStates(LPC_PIN_INT_T *pPININT)
+{
+ return pPININT->FALL;
+}
+
+/**
+ * @brief Clears pin states that had a latched falling edge (FALL) state
+ * @param pPININT : The base address of Pin interrupt block
+ * @param pins : Pins with latched states to clear
+ * @return Nothing
+ */
+STATIC INLINE void Chip_PININT_ClearFallStates(LPC_PIN_INT_T *pPININT, uint32_t pins)
+{
+ pPININT->FALL = pins;
+}
+
+/**
+ * @brief Get interrupt status from Pin interrupt block
+ * @param pPININT : The base address of Pin interrupt block
+ * @return Interrupt status (bit n for PININTn = high means interrupt ie pending)
+ */
+STATIC INLINE uint32_t Chip_PININT_GetIntStatus(LPC_PIN_INT_T *pPININT)
+{
+ return pPININT->IST;
+}
+
+/**
+ * @brief Clear interrupt status in Pin interrupt block
+ * @param pPININT : The base address of Pin interrupt block
+ * @param pins : Pin interrupts to clear (ORed value of PININTCH*)
+ * @return Nothing
+ */
+STATIC INLINE void Chip_PININT_ClearIntStatus(LPC_PIN_INT_T *pPININT, uint32_t pins)
+{
+ pPININT->IST = pins;
+}
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __PININT_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/pmu_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/pmu_15xx.h
new file mode 100644
index 0000000..d68ba2f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/pmu_15xx.h
@@ -0,0 +1,285 @@
+/*
+ * @brief LPC15xx PMU chip driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __PMU_15XX_H_
+#define __PMU_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup PMU_15XX CHIP: LPC15xx PMU driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief LPC15xx Power Management Unit register block structure
+ */
+typedef struct {
+ __IO uint32_t PCON; /*!< Offset: 0x000 Power control Register (R/W) */
+ __IO uint32_t GPREG[5]; /*!< Offset: 0x004 General purpose Registers 0..4 (R/W) */
+} LPC_PMU_T;
+
+/**
+ * @brief LPC15xx low power mode type definitions
+ */
+typedef enum CHIP_PMU_MCUPOWER {
+ PMU_MCU_SLEEP = 0, /*!< Sleep mode */
+ PMU_MCU_DEEP_SLEEP, /*!< Deep Sleep mode */
+ PMU_MCU_POWER_DOWN, /*!< Power down mode */
+ PMU_MCU_DEEP_PWRDOWN /*!< Deep power down mode */
+} CHIP_PMU_MCUPOWER_T;
+
+/**
+ * PMU PCON register bit fields & masks
+ */
+#define PMU_PCON_PM_DEEPPOWERDOWN (0x1) /*!< ARM WFI enter Deep Power-down mode */
+#define PMU_PCON_NODPD (1 << 3) /*!< Disable deep power-down mode */
+#define PMU_PCON_SLEEPFLAG (1 << 8) /*!< Sleep mode flag */
+#define PMU_PCON_DPDFLAG (1 << 11) /*!< Deep power-down flag */
+
+/**
+ * PMU GPREG[4] register bit fields & masks
+ */
+#define PMU_GPREG4_WAKEUPHYS (1 << 0) /** Enable wake-up pin hysteresis */
+#define PMU_GPREG4_WAKEPAD_DISABLE (1 << 1) /** Disable the Wake-up */
+#define PMU_GPREG4_DATA ((uint32_t) 0x3fffff << 10) /** GP register 4 data field */
+
+/**
+ * @brief Write a value to a GPREG register
+ * @param pPMU : Pointer to PMU register block
+ * @param regIndex : Register index to write to, must be 0..3
+ * @param value : Value to write
+ * @return None
+ */
+STATIC INLINE void Chip_PMU_WriteGPREG(LPC_PMU_T *pPMU, uint8_t regIndex, uint32_t value)
+{
+ pPMU->GPREG[regIndex] = value;
+}
+
+/**
+ * @brief Write data to GPREG4 register
+ * @param pPMU : Pointer to PMU register block
+ * @param value : Data to be written to GPREG4
+ * @return None
+ */
+STATIC INLINE void Chip_PMU_WriteGPREG4(LPC_PMU_T *pPMU, uint32_t value)
+{
+ uint32_t reg;
+
+ reg = pPMU->GPREG[4] & ~PMU_GPREG4_DATA;
+ pPMU->GPREG[4] = reg | (value << 10);
+}
+
+/**
+ * @brief Read a value to a GPREG register
+ * @param pPMU : Pointer to PMU register block
+ * @param regIndex : Register index to read from, must be 0..3
+ * @return Value read from the GPREG register
+ */
+STATIC INLINE uint32_t Chip_PMU_ReadGPREG(LPC_PMU_T *pPMU, uint8_t regIndex)
+{
+ return pPMU->GPREG[regIndex];
+}
+
+/**
+ * @brief Enter MCU Sleep mode
+ * @param pPMU : Pointer to PMU register block
+ * @return None
+ * @note The sleep mode affects the ARM Cortex-M0+ core only. Peripherals
+ * and memories are active.
+ */
+void Chip_PMU_SleepState(LPC_PMU_T *pPMU);
+
+/**
+ * @brief Enter MCU Deep Sleep mode
+ * @param pPMU : Pointer to PMU register block
+ * @return None
+ * @note In Deep-sleep mode, the peripherals receive no internal clocks.
+ * The flash is in stand-by mode. The SRAM memory and all peripheral registers
+ * as well as the processor maintain their internal states. The WWDT, WKT,
+ * and BOD can remain active to wake up the system on an interrupt.
+ */
+void Chip_PMU_DeepSleepState(LPC_PMU_T *pPMU);
+
+/**
+ * @brief Enter MCU Power down mode
+ * @param pPMU : Pointer to PMU register block
+ * @return None
+ * @note In Power-down mode, the peripherals receive no internal clocks.
+ * The internal SRAM memory and all peripheral registers as well as the
+ * processor maintain their internal states. The flash memory is powered
+ * down. The WWDT, WKT, and BOD can remain active to wake up the system
+ * on an interrupt.
+ */
+void Chip_PMU_PowerDownState(LPC_PMU_T *pPMU);
+
+/**
+ * @brief Enter MCU Deep Power down mode
+ * @param pPMU : Pointer to PMU register block
+ * @return None
+ * @note For maximal power savings, the entire system is shut down
+ * except for the general purpose registers in the PMU and the self
+ * wake-up timer. Only the general purpose registers in the PMU maintain
+ * their internal states. The part can wake up on a pulse on the WAKEUP
+ * pin or when the self wake-up timer times out. On wake-up, the part
+ * reboots.
+ */
+void Chip_PMU_DeepPowerDownState(LPC_PMU_T *pPMU);
+
+/**
+ * @brief Place the MCU in a low power state
+ * @param pPMU : Pointer to PMU register block
+ * @param SleepMode : Sleep mode
+ * @return None
+ */
+void Chip_PMU_Sleep(LPC_PMU_T *pPMU, CHIP_PMU_MCUPOWER_T SleepMode);
+
+/**
+ * @brief Disables deep power-down mode
+ * @param pPMU : Pointer to PMU register block
+ * @return None
+ * @note Calling this functions prevents entry to Deep power-down
+ * mode. Once set, this can only be cleared by power-on reset.
+ */
+STATIC INLINE void Chip_PMU_DisableDeepPowerDown(LPC_PMU_T *pPMU)
+{
+ pPMU->PCON |= PMU_PCON_NODPD;
+}
+
+/**
+ * @brief Returns sleep/power-down flags
+ * @param pPMU : Pointer to PMU register block
+ * @return Or'ed values of PMU_PCON_SLEEPFLAG and PMU_PCON_DPDFLAG
+ * @note These indicate that the PMU is setup for entry into a low
+ * power state on the next WFI() instruction.
+ */
+STATIC INLINE uint32_t Chip_PMU_GetSleepFlags(LPC_PMU_T *pPMU)
+{
+ return pPMU->PCON & (PMU_PCON_SLEEPFLAG | PMU_PCON_DPDFLAG);
+}
+
+/**
+ * @brief Clears sleep/power-down flags
+ * @param pPMU : Pointer to PMU register block
+ * @param flags : Or'ed value of PMU_PCON_SLEEPFLAG and PMU_PCON_DPDFLAG
+ * @return Nothing
+ * @note Use this function to clear a low power state prior to calling
+ * WFI().
+ */
+STATIC INLINE void Chip_PMU_ClearSleepFlags(LPC_PMU_T *pPMU, uint32_t flags)
+{
+ pPMU->PCON |= (flags & (PMU_PCON_SLEEPFLAG | PMU_PCON_DPDFLAG));
+}
+
+/**
+ * @brief Returns Wakeup Hysterisis enable flag
+ * @param pPMU : Pointer to PMU register block
+ * @return TRUE if bit PMU_GPREG4_WAKEUPHYS is set else returns FALSE
+ * @note This indicate that whether wakeup hysterisis
+ * is enabled or not.
+ */
+STATIC INLINE bool Chip_PMU_GetWakeHysEnable(LPC_PMU_T *pPMU)
+{
+ return (pPMU->GPREG[4] & PMU_GPREG4_WAKEUPHYS) != 0;
+}
+
+/**
+ * @brief Sets Wakeup Hysterisis enable flag
+ * @param pPMU : Pointer to PMU register block
+ * @return Nothing
+ * @note Use this function to prevent enable wakeup hysterisis
+ * note that if Vcc goes below 2.2V then it might prevent wakeup
+ * if hysterisis is enabled
+ */
+STATIC INLINE void Chip_PMU_SetWakeHysEnable(LPC_PMU_T *pPMU)
+{
+ pPMU->GPREG[4] |= PMU_GPREG4_WAKEUPHYS;
+}
+
+/**
+ * @brief Clears Wakeup Hysterisis enable flag
+ * @param pPMU : Pointer to PMU register block
+ * @return Nothing
+ * @note Use this function to disable wakeup hysterisis
+ */
+STATIC INLINE void Chip_PMU_ClearWakeHysEnable(LPC_PMU_T *pPMU)
+{
+ pPMU->GPREG[4] &= ~PMU_GPREG4_WAKEUPHYS;
+}
+
+/**
+ * @brief Returns Wakeup Pad disable bit
+ * @param pPMU : Pointer to PMU register block
+ * @return TRUE if bit PMU_GPREG4_WAKEPAD_DISABLE is set else returns FALSE
+ * @note This indicate that whether wakeup hysterisis
+ * is enabled or not.
+ */
+STATIC INLINE bool Chip_PMU_GetWakePadDisable(LPC_PMU_T *pPMU)
+{
+ return (pPMU->GPREG[4] & PMU_GPREG4_WAKEPAD_DISABLE) != 0;
+}
+
+/**
+ * @brief Sets Wakeup pad disable bit
+ * @param pPMU : Pointer to PMU register block
+ * @return Nothing
+ * @note Use this function to disable the wakeup pin (P0.17)
+ * in which case RTC wakeup is the only option to wakeup from
+ * deep power down mode.
+ */
+STATIC INLINE void Chip_PMU_SetWakePadDisable(LPC_PMU_T *pPMU)
+{
+ pPMU->GPREG[4] |= PMU_GPREG4_WAKEPAD_DISABLE;
+}
+
+/**
+ * @brief Clears Wakeup pad disable bit
+ * @param pPMU : Pointer to PMU register block
+ * @return Nothing
+ * @note Use this function to enable the wakeup pin (P0.17)
+ * to wakeup from deep power down mode.
+ */
+STATIC INLINE void Chip_PMU_ClearWakePadDisable(LPC_PMU_T *pPMU)
+{
+ pPMU->GPREG[4] &= ~PMU_GPREG4_WAKEPAD_DISABLE;
+}
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __PMU_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/ring_buffer.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/ring_buffer.h
new file mode 100644
index 0000000..30412d9
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/ring_buffer.h
@@ -0,0 +1,188 @@
+/*
+ * @brief Common ring buffer support functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2012
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __RING_BUFFER_H_
+#define __RING_BUFFER_H_
+
+#include "lpc_types.h"
+
+/** @defgroup Ring_Buffer CHIP: Simple ring buffer implementation
+ * @ingroup CHIP_Common
+ * @{
+ */
+
+/**
+ * @brief Ring buffer structure
+ */
+typedef struct {
+ void *data;
+ int count;
+ int itemSz;
+ uint32_t head;
+ uint32_t tail;
+} RINGBUFF_T;
+
+/**
+ * @def RB_VHEAD(rb)
+ * volatile typecasted head index
+ */
+#define RB_VHEAD(rb) (*(volatile uint32_t *) &(rb)->head)
+
+/**
+ * @def RB_VTAIL(rb)
+ * volatile typecasted tail index
+ */
+#define RB_VTAIL(rb) (*(volatile uint32_t *) &(rb)->tail)
+
+/**
+ * @brief Initialize ring buffer
+ * @param RingBuff : Pointer to ring buffer to initialize
+ * @param buffer : Pointer to buffer to associate with RingBuff
+ * @param itemSize : Size of each buffer item size
+ * @param count : Size of ring buffer
+ * @note Memory pointed by @a buffer must have correct alignment of
+ * @a itemSize, and @a count must be a power of 2 and must at
+ * least be 2 or greater.
+ * @return Nothing
+ */
+int RingBuffer_Init(RINGBUFF_T *RingBuff, void *buffer, int itemSize, int count);
+
+/**
+ * @brief Resets the ring buffer to empty
+ * @param RingBuff : Pointer to ring buffer
+ * @return Nothing
+ */
+STATIC INLINE void RingBuffer_Flush(RINGBUFF_T *RingBuff)
+{
+ RingBuff->head = RingBuff->tail = 0;
+}
+
+/**
+ * @brief Return size the ring buffer
+ * @param RingBuff : Pointer to ring buffer
+ * @return Size of the ring buffer in bytes
+ */
+STATIC INLINE int RingBuffer_GetSize(RINGBUFF_T *RingBuff)
+{
+ return RingBuff->count;
+}
+
+/**
+ * @brief Return number of items in the ring buffer
+ * @param RingBuff : Pointer to ring buffer
+ * @return Number of items in the ring buffer
+ */
+STATIC INLINE int RingBuffer_GetCount(RINGBUFF_T *RingBuff)
+{
+ return RB_VHEAD(RingBuff) - RB_VTAIL(RingBuff);
+}
+
+/**
+ * @brief Return number of free items in the ring buffer
+ * @param RingBuff : Pointer to ring buffer
+ * @return Number of free items in the ring buffer
+ */
+STATIC INLINE int RingBuffer_GetFree(RINGBUFF_T *RingBuff)
+{
+ return RingBuff->count - RingBuffer_GetCount(RingBuff);
+}
+
+/**
+ * @brief Return number of items in the ring buffer
+ * @param RingBuff : Pointer to ring buffer
+ * @return 1 if the ring buffer is full, otherwise 0
+ */
+STATIC INLINE int RingBuffer_IsFull(RINGBUFF_T *RingBuff)
+{
+ return (RingBuffer_GetCount(RingBuff) >= RingBuff->count);
+}
+
+/**
+ * @brief Return empty status of ring buffer
+ * @param RingBuff : Pointer to ring buffer
+ * @return 1 if the ring buffer is empty, otherwise 0
+ */
+STATIC INLINE int RingBuffer_IsEmpty(RINGBUFF_T *RingBuff)
+{
+ return RB_VHEAD(RingBuff) == RB_VTAIL(RingBuff);
+}
+
+/**
+ * @brief Insert a single item into ring buffer
+ * @param RingBuff : Pointer to ring buffer
+ * @param data : pointer to item
+ * @return 1 when successfully inserted,
+ * 0 on error (Buffer not initialized using
+ * RingBuffer_Init() or attempted to insert
+ * when buffer is full)
+ */
+int RingBuffer_Insert(RINGBUFF_T *RingBuff, const void *data);
+
+/**
+ * @brief Insert an array of items into ring buffer
+ * @param RingBuff : Pointer to ring buffer
+ * @param data : Pointer to first element of the item array
+ * @param num : Number of items in the array
+ * @return number of items successfully inserted,
+ * 0 on error (Buffer not initialized using
+ * RingBuffer_Init() or attempted to insert
+ * when buffer is full)
+ */
+int RingBuffer_InsertMult(RINGBUFF_T *RingBuff, const void *data, int num);
+
+/**
+ * @brief Pop an item from the ring buffer
+ * @param RingBuff : Pointer to ring buffer
+ * @param data : Pointer to memory where popped item be stored
+ * @return 1 when item popped successfuly onto @a data,
+ * 0 When error (Buffer not initialized using
+ * RingBuffer_Init() or attempted to pop item when
+ * the buffer is empty)
+ */
+int RingBuffer_Pop(RINGBUFF_T *RingBuff, void *data);
+
+/**
+ * @brief Pop an array of items from the ring buffer
+ * @param RingBuff : Pointer to ring buffer
+ * @param data : Pointer to memory where popped items be stored
+ * @param num : Max number of items array @a data can hold
+ * @return Number of items popped onto @a data,
+ * 0 on error (Buffer not initialized using RingBuffer_Init()
+ * or attempted to pop when the buffer is empty)
+ */
+int RingBuffer_PopMult(RINGBUFF_T *RingBuff, void *data, int num);
+
+
+/**
+ * @}
+ */
+
+#endif /* __RING_BUFFER_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/ritimer_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/ritimer_15xx.h
new file mode 100644
index 0000000..ac5dd11
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/ritimer_15xx.h
@@ -0,0 +1,265 @@
+/*
+ * @brief LPC15xx RITimer driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __RITIMER_15XX_H_
+#define __RITIMER_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup RIT_15XX CHIP: LPC15xx Repetitive Interrupt Timer driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief Repetitive Interrupt Timer register block structure
+ */
+typedef struct { /*!< RITIMER Structure */
+ __IO uint32_t COMPVAL; /*!< Compare register */
+ __IO uint32_t MASK; /*!< Mask register. This register holds the 32-bit mask value. A 1 written to any bit will force a compare on the corresponding bit of the counter and compare register. */
+ __IO uint32_t CTRL; /*!< Control register */
+ __IO uint32_t COUNTER; /*!< 32-bit counter */
+ __IO uint32_t COMPVAL_H; /*!< Compare upper register */
+ __IO uint32_t MASK_H; /*!< Mask upper register */
+ __I uint32_t RESERVED0[1];
+ __IO uint32_t COUNTER_H; /*!< Counter upper register */
+} LPC_RITIMER_T;
+
+/*
+ * RIT control register
+ */
+/** Set by H/W when the counter value equals the masked compare value */
+#define RIT_CTRL_INT (1 << 0)
+/** Set timer enable clear to 0 when the counter value equals the masked compare value */
+#define RIT_CTRL_ENCLR (1 << 1)
+/** Set timer enable on debug */
+#define RIT_CTRL_ENBR (1 << 2)
+/** Set timer enable */
+#define RIT_CTRL_TEN (1 << 3)
+
+/**
+ * @brief Initialize the RIT
+ * @param pRITimer : RITimer peripheral selected
+ * @return None
+ * @note The timer will not br running after this call. Use
+ * Chip_RIT_Enable() to start the timer running.
+ */
+void Chip_RIT_Init(LPC_RITIMER_T *pRITimer);
+
+/**
+ * @brief Shutdown the RIT
+ * @param pRITimer : RITimer peripheral selected
+ * @return None
+ */
+void Chip_RIT_DeInit(LPC_RITIMER_T *pRITimer);
+
+/**
+ * @brief Safely sets CTRL register bits
+ * @param pRITimer : RITimer peripheral selected
+ * @param val : RIT bits to be set, one or more RIT_CTRL_* values
+ * @return None
+ */
+void Chip_RIT_SetCTRL(LPC_RITIMER_T *pRITimer, uint32_t val);
+
+/**
+ * @brief Safely clears CTRL register bits
+ * @param pRITimer : RITimer peripheral selected
+ * @param val : RIT bits to be cleared, one or more RIT_CTRL_* values
+ * @return None
+ */
+void Chip_RIT_ClearCTRL(LPC_RITIMER_T *pRITimer, uint32_t val);
+
+/**
+ * @brief Enable Timer
+ * @param pRITimer : RITimer peripheral selected
+ * @return None
+ */
+STATIC INLINE void Chip_RIT_Enable(LPC_RITIMER_T *pRITimer)
+{
+ Chip_RIT_SetCTRL(pRITimer, RIT_CTRL_TEN);
+}
+
+/**
+ * @brief Disable Timer
+ * @param pRITimer : RITimer peripheral selected
+ * @return None
+ */
+STATIC INLINE void Chip_RIT_Disable(LPC_RITIMER_T *pRITimer)
+{
+ Chip_RIT_ClearCTRL(pRITimer, RIT_CTRL_TEN);
+}
+
+/**
+ * @brief Enable timer debug mode
+ * @param pRITimer : RITimer peripheral selected
+ * @return None
+ * @note This function halts the repetitive timer when
+ * the processor is halted for debugging.
+ */
+STATIC INLINE void Chip_RIT_EnableDebug(LPC_RITIMER_T *pRITimer)
+{
+ Chip_RIT_SetCTRL(pRITimer, RIT_CTRL_ENBR);
+}
+
+/**
+ * @brief Disable timer debug mode
+ * @param pRITimer : RITimer peripheral selected
+ * @return None
+ * @note This function allows the repetitive timer to continue running
+ * when the processor is halted for debugging.
+ */
+STATIC INLINE void Chip_RIT_DisableDebug(LPC_RITIMER_T *pRITimer)
+{
+ Chip_RIT_ClearCTRL(pRITimer, RIT_CTRL_ENBR);
+}
+
+/**
+ * @brief Enables automatic counter clear on compare
+ * @param pRITimer : RITimer peripheral selected
+ * @return None
+ */
+STATIC INLINE void Chip_RIT_EnableCompClear(LPC_RITIMER_T *pRITimer)
+{
+ Chip_RIT_SetCTRL(pRITimer, RIT_CTRL_ENCLR);
+}
+
+/**
+ * @brief Disables automatic counter clear on compare
+ * @param pRITimer : RITimer peripheral selected
+ * @return None
+ */
+STATIC INLINE void Chip_RIT_DisableCompClear(LPC_RITIMER_T *pRITimer)
+{
+ Chip_RIT_ClearCTRL(pRITimer, RIT_CTRL_ENCLR);
+}
+
+/**
+ * @brief Check whether timer interrupt is pending
+ * @param pRITimer : RITimer peripheral selected
+ * @return true if the interrupt is pending, otherwise false
+ */
+STATIC INLINE bool Chip_RIT_GetIntStatus(LPC_RITIMER_T *pRITimer)
+{
+ return (bool) ((pRITimer->CTRL & RIT_CTRL_INT) != 0);
+}
+
+/**
+ * @brief Clears the timer interrupt pending state
+ * @param pRITimer : RITimer peripheral selected
+ * @return None
+ */
+STATIC INLINE void Chip_RIT_ClearIntStatus(LPC_RITIMER_T *pRITimer)
+{
+ Chip_RIT_SetCTRL(pRITimer, RIT_CTRL_INT);
+}
+
+/**
+ * @brief Set a tick value for the interrupt to time out
+ * @param pRITimer : RITimer peripheral selected
+ * @param val : value (in ticks) for the coounter compare value
+ * @return None
+ * @note The base timer tick rate can be determined by calling
+ * Chip_Clock_GetSystemClockRate().
+ */
+void Chip_RIT_SetCompareValue(LPC_RITIMER_T *pRITimer, uint64_t val);
+
+/**
+ * @brief Returns the current timer compare value
+ * @param pRITimer : RITimer peripheral selected
+ * @return the current timer compare value
+ */
+uint64_t Chip_RIT_GetCompareValue(LPC_RITIMER_T *pRITimer);
+
+/**
+ * @brief Sets a mask value used for bit based compare
+ * @param pRITimer : RITimer peripheral selected
+ * @param mask : Mask value for timer (see user manual)
+ * @return None
+ */
+void Chip_RIT_SetMaskValue(LPC_RITIMER_T *pRITimer, uint64_t mask);
+
+/**
+ * @brief Returns the mask value used for bit based compare
+ * @param pRITimer : RITimer peripheral selected
+ * @return the current mask value
+ */
+uint64_t Chip_RIT_GetMaskValue(LPC_RITIMER_T *pRITimer);
+
+/**
+ * @brief Sets the current timer Counter value
+ * @param pRITimer : RITimer peripheral selected
+ * @param count : Count value to set timer to
+ * @return Nothing
+ */
+void Chip_RIT_SetCounter(LPC_RITIMER_T *pRITimer, uint64_t count);
+
+/**
+ * @brief Returns the current timer Counter value
+ * @param pRITimer : RITimer peripheral selected
+ * @return the current timer counter value
+ */
+uint64_t Chip_RIT_GetCounter(LPC_RITIMER_T *pRITimer);
+
+/**
+ * @brief Set timer interval value in Hz (frequency)
+ * @param pRITimer : RITimer peripheral selected
+ * @param freq : timer interval value in Hz
+ * @return None
+ * @note Will not alter current counter value. Accuracy depends on
+ * base clock rate. Timer enable/disable state is not changed.
+ */
+void Chip_RIT_SetTimerIntervalHz(LPC_RITIMER_T *pRITimer, uint32_t freq);
+
+/**
+ * @brief Returns base clock rate for timer
+ * @param pRITimer : RITimer peripheral selected
+ * @return Value in Hz the timer is running at
+ * @note This returned value contains the base clock the timer uses.
+ * If you set the tick count to this return value with the
+ * Chip_RIT_SetCompareValue() function, you will get a 1Hz
+ * interval rate.
+ */
+STATIC INLINE uint32_t Chip_RIT_GetBaseClock(LPC_RITIMER_T *pRITimer)
+{
+ return Chip_Clock_GetSystemClockRate();
+}
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __RITIMER_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rom_adc_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rom_adc_15xx.h
new file mode 100644
index 0000000..7cfd30d
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rom_adc_15xx.h
@@ -0,0 +1,152 @@
+/*
+ * @brief LPC15xx ROM ADC API declarations and functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __ROM_ADC_15XX_H_
+#define __ROM_ADC_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup ADCROM_15XX CHIP: LPC15xx ADC ROM API declarations and functions
+ * @ingroup ROMAPI_15XX
+ * @{
+ */
+
+/**
+ * @brief ADC handle type
+ */
+typedef void *ADC_HANDLE_T;
+
+typedef void (*ADC_SEQ_CALLBK_T)(ADC_HANDLE_T handle);
+typedef void (*ADC_CALLBK_T)(ErrorCode_t error_code, uint32_t num_channel);
+
+/* Typedef for structure pointed by the ADC_HANDLE */
+typedef struct { /* block of RAM allocated by the application program */
+ uint32_t base_addr; /* adcr register base address */
+ uint32_t *seqa_buffer; /* adc buffer */
+ uint32_t *seqb_buffer; /* adc buffer */
+ uint32_t seqa_channel_num; /* number of ADC channels */
+ uint32_t seqb_channel_num; /* number of ADC channels */
+ uint32_t seqa_hwtrig;
+ uint32_t seqb_hwtrig;
+ uint32_t comp_flags;
+ uint32_t overrun_flags;
+ uint32_t thcmp_flags;
+ uint32_t error_code; /* error code */
+ ADC_SEQ_CALLBK_T seqa_callback; /* For interrupt, it's the end of the sequence A */
+ ADC_SEQ_CALLBK_T seqb_callback; /* For interrupt, it's the end of the sequence B */
+ ADC_CALLBK_T overrun_callback; /* For interrupt, it's the overrun */
+ ADC_CALLBK_T thcmp_callback; /* For interrupt, it's over the threshold */
+ uint32_t error_en; /* enable bits for error detection */
+ uint32_t thcmp_en; /* enable bits for thcmp detection */
+} ADC_DRIVER_T; /* HEADER_TypeDef *********************************/
+
+typedef struct {
+ uint32_t system_clock; /* System clock */
+ uint32_t adc_clock; /* ADC clock */
+ uint32_t async_mode;
+ uint32_t tenbit_mode;
+ uint32_t lpwr_mode;
+ uint32_t input_sel;
+ uint32_t seqa_ctrl;
+ uint32_t seqb_ctrl;
+ uint32_t thrsel;
+ uint32_t thr0_low;
+ uint32_t thr0_high;
+ uint32_t thr1_low;
+ uint32_t thr1_high;
+ uint32_t error_en;
+ uint32_t thcmp_en;
+ uint32_t channel_num;
+} ADC_CONFIG_T;
+
+typedef struct {
+ uint32_t dma_adc_num; /* DMA channel used for ADC data peripheral to memory transfer */
+ uint32_t dma_pinmux_num; /* H/W trigger number. */
+ uint32_t dma_handle; /* DMA handle passed to ADC */
+ ADC_CALLBK_T dma_done_callback_pt; /* DMA completion callback function */
+} ADC_DMA_CFG_T;
+
+typedef ErrorCode_t (*ADC_DMA_SETUP_T)(ADC_HANDLE_T handle, ADC_DMA_CFG_T *dma_cfg);
+
+typedef struct { /* params passed to adc driver function */
+ uint32_t *buffer; /* Considering supporting DMA and non-DMA mode, 32-bit buffer is needed for DMA */
+ uint32_t driver_mode; /* 0x00: Polling mode, function is blocked until transfer is finished. */
+ /* 0x01: Interrupt mode, function exit immediately, callback function is invoked when transfer is finished. */
+ /* 0x02: DMA mode, in case DMA block is available, data transferred by ADC is processed by DMA,
+ and max buffer size is the total number ADC channels, DMA req function is called for ADC DMA
+ channel setup, then SEQx completion also used as DMA callback function when that ADC conversion/DMA transfer
+ is finished. */
+ uint32_t seqa_hwtrig; /* H/W trigger for sequence A */
+ uint32_t seqb_hwtrig; /* H/W trigger for sequence B */
+ ADC_CONFIG_T *adc_cfg;
+ uint32_t comp_flags;
+ uint32_t overrun_flags;
+ uint32_t thcmp_flags;
+ ADC_DMA_CFG_T *dma_cfg;
+ ADC_SEQ_CALLBK_T seqa_callback_pt; /* SEQA callback function/the same callback on DMA completion if DMA is used for ADCx. */
+ ADC_SEQ_CALLBK_T seqb_callback_pt; /* SEQb callback function/the same callback on DMA completion if DMA is used for ADCx. */
+ ADC_CALLBK_T overrun_callback_pt; /* Overrun callback function */
+ ADC_CALLBK_T thcmp_callback_pt; /* THCMP callback function */
+ ADC_DMA_SETUP_T dma_setup_func_pt; /* ADC DMA channel setup function */
+} ADC_PARAM_T;
+
+/* Typedef Structure for ROM API's */
+typedef struct ADCD_API {
+ /* ADC Configuration functions */
+ uint32_t (*adc_get_mem_size)(void);
+ ADC_HANDLE_T (*adc_setup)(uint32_t base_addr, uint8_t *ram);
+ void (*adc_calibration)(ADC_HANDLE_T handle, ADC_CONFIG_T *set);
+ void (*adc_init)(ADC_HANDLE_T handle, ADC_CONFIG_T *set);
+
+ /* ADC Conversion Functions */
+ uint32_t (*adc_seqa_read)(ADC_HANDLE_T handle, ADC_PARAM_T *param);
+ uint32_t (*adc_seqb_read)(ADC_HANDLE_T handle, ADC_PARAM_T *param);
+
+ /* ADC Interrupt handlers */
+ void (*adc_seqa_isr)(ADC_HANDLE_T handle);
+ void (*adc_seqb_isr)(ADC_HANDLE_T handle);
+ void (*adc_ovr_isr)(ADC_HANDLE_T handle);
+ void (*adc_thcmp_isr)(ADC_HANDLE_T handle);
+
+ uint32_t (*adc_get_firmware_version)(void);
+} ADCD_API_T;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ROM_ADC_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rom_can_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rom_can_15xx.h
new file mode 100644
index 0000000..1076913
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rom_can_15xx.h
@@ -0,0 +1,159 @@
+/*
+ * @brief LPC15xx CAN ROM API declarations and functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __ROM_CAN_15XX_H_
+#define __ROM_CAN_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup CANROM_15XX CHIP: LPC15xx CAN ROM API declarations and functions
+ * @ingroup ROMAPI_15XX
+ * @{
+ */
+
+/* error status bits */
+#define CAN_ERROR_NONE 0x00000000UL
+#define CAN_ERROR_PASS 0x00000001UL
+#define CAN_ERROR_WARN 0x00000002UL
+#define CAN_ERROR_BOFF 0x00000004UL
+#define CAN_ERROR_STUF 0x00000008UL
+#define CAN_ERROR_FORM 0x00000010UL
+#define CAN_ERROR_ACK 0x00000020UL
+#define CAN_ERROR_BIT1 0x00000040UL
+#define CAN_ERROR_BIT0 0x00000080UL
+#define CAN_ERROR_CRC 0x00000100UL
+
+typedef void *CAN_HANDLE_T; /* define TYPE for CAN handle pointer */
+
+typedef struct _CAN_MSG_OBJ {
+ uint32_t mode_id;
+ uint32_t mask;
+ uint8_t data[8];
+ uint8_t dlc;
+ uint8_t msgobj;
+} CAN_MSG_OBJ;
+
+typedef struct _CAN_CALLBACKS {
+ void (*CAN_rx)(uint8_t msg_obj);
+ void (*CAN_tx)(uint8_t msg_obj);
+ void (*CAN_error)(uint32_t error_info);
+} CAN_CALLBACKS;
+
+typedef struct _CAN_CFG {
+ uint32_t clkdiv;
+ uint32_t btr;
+ uint32_t isr_ena;
+} CAN_CFG;
+
+typedef struct _CAN_ODCONSTENTRY {
+ uint16_t index;
+ uint8_t subindex;
+ uint8_t len;
+ uint32_t val;
+} CAN_ODCONSTENTRY;
+
+typedef struct _CAN_ODENTRY {
+ uint16_t index;
+ uint8_t subindex;
+ uint8_t entrytype_len;
+ uint8_t *val;
+} CAN_ODENTRY;
+
+typedef struct _CAN_CANOPENCFG {
+ uint8_t node_id;
+ uint8_t msgobj_rx;
+ uint8_t msgobj_tx;
+ uint8_t isr_handled;
+ uint32_t od_const_num;
+ CAN_ODCONSTENTRY *od_const_table;
+ uint32_t od_num;
+ CAN_ODENTRY *od_table;
+} CAN_CANOPENCFG;
+
+typedef struct _CANOPEN_CALLBACKS {
+ uint32_t (*CANOPEN_sdo_read)(uint16_t index, uint8_t subindex);
+ uint32_t (*CANOPEN_sdo_write)(uint16_t index, uint8_t subindex, uint8_t *dat_ptr);
+ uint32_t (*CANOPEN_sdo_seg_read)(uint16_t index, uint8_t subindex, uint8_t
+ openclose, uint8_t *length, uint8_t *data, uint8_t *last);
+ uint32_t (*CANOPEN_sdo_seg_write)(uint16_t index, uint8_t subindex, uint8_t
+ openclose, uint8_t length, uint8_t *data, uint8_t *fast_resp);
+ uint8_t (*CANOPEN_sdo_req)(uint8_t length_req, uint8_t *req_ptr, uint8_t
+ *length_resp, uint8_t *resp_ptr);
+} CANOPEN_CALLBACKS;
+
+typedef struct _CAN_API_INIT_PARAM_T {
+ uint32_t mem_base; /* Address of user-space memory area to use */
+ uint32_t can_reg_base; /* Address of start of CAN controller register area */
+ CAN_CFG *can_cfg;
+ CAN_CALLBACKS *callbacks;
+ CAN_CANOPENCFG *canopen_cfg;
+ CANOPEN_CALLBACKS *co_callbacks;
+} CAN_API_INIT_PARAM_T;
+
+/**
+ * @brief LPC15XX CAN ROM API structure
+ * The CAN profile API provides functions to configure and manage the CAN sub-system.
+ */
+typedef struct _CAND_API_T {
+ uint32_t (*hwCAN_GetMemSize)(CAN_API_INIT_PARAM_T *param);
+ ErrorCode_t (*hwCAN_Init)(CAN_HANDLE_T *phCan, CAN_API_INIT_PARAM_T *param);
+ void (*hwCAN_Isr)(CAN_HANDLE_T hCan);
+ void (*hwCAN_ConfigRxmsgobj)(CAN_HANDLE_T hCan, CAN_MSG_OBJ *msg_obj);
+ uint8_t (*hwCAN_MsgReceive)(CAN_HANDLE_T hCan, CAN_MSG_OBJ *msg_obj);
+ void (*hwCAN_MsgTransmit)(CAN_HANDLE_T hCan, CAN_MSG_OBJ *msg_obj);
+ void (*hwCAN_CANopenHandler)(CAN_HANDLE_T hCan);
+} CAND_API_T;
+
+uint32_t hwCAN_GetMemSize(CAN_API_INIT_PARAM_T *param);
+
+ErrorCode_t hwCAN_Init(CAN_HANDLE_T *phCan, CAN_API_INIT_PARAM_T *param);
+
+void hwCAN_Isr(CAN_HANDLE_T hCan);
+
+void hwCAN_ConfigRxmsgobj(CAN_HANDLE_T hCan, CAN_MSG_OBJ *msg_obj);
+
+uint8_t hwCAN_MsgReceive(CAN_HANDLE_T hCan, CAN_MSG_OBJ *msg_obj);
+
+void hwCAN_MsgTransmit(CAN_HANDLE_T hCan, CAN_MSG_OBJ *msg_obj);
+
+void hwCAN_CANopenHandler(CAN_HANDLE_T hCan);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ROM_CAN_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rom_dma_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rom_dma_15xx.h
new file mode 100644
index 0000000..e51250a
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rom_dma_15xx.h
@@ -0,0 +1,206 @@
+/*
+ * @brief LPC15xx DMA ROM API declarations and functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __ROM_DMA_15XX_H_
+#define __ROM_DMA_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup DMAROM_15XX CHIP: LPC15xx DMA ROM API declarations and functions
+ * @ingroup ROMAPI_15XX
+ * @{
+ */
+
+/* Bit definitions for DMA ROM Channel Configuration Structure */
+#define DMA_ROM_CH_EVENT_SWTRIG ((uint8_t) 0)
+#define DMA_ROM_CH_EVENT_PERIPH ((uint8_t) 1)
+#define DMA_ROM_CH_EVENT_HWTRIG ((uint8_t) 2)
+#define DMA_ROM_CH_HWTRIG_BURSTPOWER_1 ((uint8_t) 0 << 0)
+#define DMA_ROM_CH_HWTRIG_BURSTPOWER_2 ((uint8_t) 1 << 0)
+#define DMA_ROM_CH_HWTRIG_BURSTPOWER_4 ((uint8_t) 2 << 0)
+#define DMA_ROM_CH_HWTRIG_BURSTPOWER_8 ((uint8_t) 3 << 0)
+#define DMA_ROM_CH_HWTRIG_BURSTPOWER_16 ((uint8_t) 4 << 0)
+#define DMA_ROM_CH_HWTRIG_BURSTPOWER_32 ((uint8_t) 5 << 0)
+#define DMA_ROM_CH_HWTRIG_BURSTPOWER_64 ((uint8_t) 6 << 0)
+#define DMA_ROM_CH_HWTRIG_BURSTPOWER_128 ((uint8_t) 7 << 0)
+#define DMA_ROM_CH_HWTRIG_BURSTPOWER_256 ((uint8_t) 8 << 0)
+#define DMA_ROM_CH_HWTRIG_BURSTPOWER_512 ((uint8_t) 9 << 0)
+#define DMA_ROM_CH_HWTRIG_BURSTPOWER_1024 ((uint8_t) 10 << 0)
+#define DMA_ROM_CH_HWTRIG_SRC_WRAP_EN ((uint8_t) 1 << 4)
+#define DMA_ROM_CH_HWTRIG_DEST_WRAP_EN ((uint8_t) 1 << 5)
+#define DMA_ROM_CH_HWTRIG_BURST_EN ((uint8_t) 1 << 6)
+/* Bit definitions for DMA ROM Task Configuration Structure */
+#define DMA_ROM_TASK_CFG_PING_PONG_EN ((uint8_t) 1 << 0)
+#define DMA_ROM_TASK_CFG_SW_TRIGGER ((uint8_t) 1 << 1)
+#define DMA_ROM_TASK_CFG_CLR_TRIGGER ((uint8_t) 1 << 2)
+#define DMA_ROM_TASK_CFG_SEL_INTA ((uint8_t) 1 << 3)
+#define DMA_ROM_TASK_CFG_SEL_INTB ((uint8_t) 1 << 4)
+#define DMA_ROM_TASK_DATA_WIDTH_8 ((uint8_t) 0 )
+#define DMA_ROM_TASK_DATA_WIDTH_16 ((uint8_t) 1 )
+#define DMA_ROM_TASK_DATA_WIDTH_32 ((uint8_t) 2 )
+#define DMA_ROM_TASK_SRC_INC_0 ((uint8_t) 0 << 2)
+#define DMA_ROM_TASK_SRC_INC_1 ((uint8_t) 1 << 2)
+#define DMA_ROM_TASK_SRC_INC_2 ((uint8_t) 2 << 2)
+#define DMA_ROM_TASK_SRC_INC_4 ((uint8_t) 3 << 2)
+#define DMA_ROM_TASK_DEST_INC_0 ((uint8_t) 0 << 4)
+#define DMA_ROM_TASK_DEST_INC_1 ((uint8_t) 1 << 4)
+#define DMA_ROM_TASK_DEST_INC_2 ((uint8_t) 2 << 4)
+#define DMA_ROM_TASK_DEST_INC_4 ((uint8_t) 3 << 4)
+/**
+ * @brief DMA handle type
+ */
+typedef void *DMA_HANDLE_T;
+
+/**
+ * @brief DMA channel callback function type
+ * @param res0: error code
+ * @param res1: 0 = INTA is issued, 1 = INTB is issued
+ */
+typedef void (*CALLBK_T)(uint32_t res0, uint32_t res1);
+
+/**
+ * @brief DMA ROM drivers channel control structure
+ */
+typedef struct {
+ uint8_t event; /*!< event type selection for DMA transfer
+ - 0: software request
+ - 1: peripheral request
+ - 2: hardware trigger
+ - others: reserved */
+ uint8_t hd_trigger; /*!< In case hardware trigger is enabled, the trigger burst is setup here.
+ NOTE: Rising edge triggered is fixed
+ - bit0~bit3: burst size
+ - 0: burst size =1, 1: 2^1, 2: 2^2,... 10: 1024, others: reserved.
+ - bit4: Source Burst Wrap
+ - 0: Source burst wrapping is not enabled
+ - 1: Source burst wrapping is enabled
+ - bit5: Destination Burst Wrap
+ - 0: Destination burst wrapping is not enabled
+ - 1: Destination burst wrapping is enabled
+ - bit6: Trigger Burst
+ - 0: Hardware trigger cause a single transfer
+ - 1: Hardware trigger cause a burst transfer
+ - bit7: reserved */
+ uint8_t priority; /*!< priority level
+ - 0 -> 7: Highest priority -> Lowest priority.
+ - other: reserved. */
+ uint8_t reserved0;
+ CALLBK_T cb_func; /*!< callback function, Callback function is
+ only invoked when INTA or INTB is enabled. */
+} DMA_CHANNEL_T;
+
+/**
+ * @brief DMA ROM driver's TASK parameter structure
+ */
+typedef struct {
+ uint8_t ch_num; /*!< DMA channel number */
+ uint8_t config; /*!< configuration of this task
+ - bit0: Ping_Pong transfer
+ - 0: Not Ping_Pong transfer
+ - 1: Linked with previous task for Ping_Pong transfer
+ - bit1: Software Trigger.
+ - 0: the trigger for this channel is not set.
+ - 1: the trigger for this channel is set immediately.
+ - bit2: Clear Trigger
+ - 0: The trigger is not cleared when this task is finished.
+ - 1: The trigger is cleared when this task is finished.
+ - bit3: Select INTA
+ - 0: No IntA.
+ - 1: The IntB flag for this channel will be set when this task is finished.
+ bit4: Select INTB
+ 0: No IntB.
+ 1: The IntB flag for this channel will be set when this task is finished.
+ bit5~bit7: reserved
+ */
+
+ uint8_t data_type; /*!<
+ - bit0~bit1: Data width. 0: 8-bit, 1: 16-bit, 2: 32-bit, 3: reserved
+ - bit2~bit3: How is source address incremented?
+ - 0: The source address is not incremented for each transfer.
+ 1: The source address is incremented by the amount specified by Width for each transfer.
+ 2: The source address is incremented by 2 times the amount specified by Width for each transfer.
+ 3: The source address is incremented by 4 times the amount specified by Width for each transfer.
+ - bit4~bit5: How is the destination address incremented?
+ 0: The destination address is not incremented for each transfer.
+ 1: The destination address is incremented by the amount specified by Width for each transfer.
+ 2: The destination address is incremented by 2 times the amount specified by Width for each transfer.
+ 3: The destination address is incremented by 4 times the amount specified by Width for each transfer.
+ - bit6~bit7: reserved. */
+ uint8_t reserved0;
+ uint16_t data_length; /*!< 0: 1 transfer, 1: 2 transfer, ..., 1023: 1024 transfer. Others: reserved.*/
+ uint16_t reserved1;
+ uint32_t src; /*!< Source data end address */
+ uint32_t dst; /*!< Destination end address */
+ uint32_t task_addr; /*!< the address of RAM for saving this task.
+ (NOTE: each task need 16 bytes RAM for storing configuration,
+ and DMA API could set it according user input parameter,
+ but it is responsible of user to allocate this RAM space and
+ make sure that the base address must be 16-byte alignment.
+ And if user has setup the next_task(!=0), the dma_task_link
+ must be called for this task setup, otherwise unpredictable error will happen.) */
+} DMA_TASK_T;
+
+/**
+ * @brief DMA ROM API structure
+ * The DMA API handles DMA set-up and transfers.
+ */
+typedef struct DMAD_API {
+ /** DMA ISR routine */
+ void (*dma_isr)(DMA_HANDLE_T *handle);
+ /** Get memory size needed for DMA. */
+ uint32_t (*dma_get_mem_size)(void);
+ /** Set up DMA. */
+ DMA_HANDLE_T * (*dma_setup)(uint32_t base_addr, uint8_t * ram);
+ /** Enable DMA channel and set-up basic DMA transfer. */
+ ErrorCode_t (*dma_init)(DMA_HANDLE_T *handle, DMA_CHANNEL_T *channel, DMA_TASK_T *task);
+ /** Create linked transfer. */
+ ErrorCode_t (*dma_link)(DMA_HANDLE_T *handle, DMA_TASK_T *task, uint8_t valid);
+ /** Set a task to valid. */
+ ErrorCode_t (*dma_set_valid)(DMA_HANDLE_T *handle, uint8_t chl_num);
+ /** Pause DMA transfer on a given channel. */
+ ErrorCode_t (*dma_pause)(DMA_HANDLE_T *handle, uint8_t chl_num);
+ /** Resume DMA transfer. */
+ ErrorCode_t (*dma_unpause)(DMA_HANDLE_T *handle, uint8_t chl_num);
+ /** Cancel DMA transfer on a given channel.*/
+ ErrorCode_t (*dma_abort)(DMA_HANDLE_T *handle, uint8_t chl_num);
+} DMAD_API_T;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ROM_DMA_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rom_i2c_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rom_i2c_15xx.h
new file mode 100644
index 0000000..c9448eb
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rom_i2c_15xx.h
@@ -0,0 +1,124 @@
+/*
+ * @brief LPC15XX I2C ROM API declarations and functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __ROM_I2C_15XX_H_
+#define __ROM_I2C_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup CHIP_I2CROM_15XX CHIP: LPC15xx I2C ROM API declarations and functions
+ * @ingroup ROMAPI_15XX
+ * @{
+ */
+
+/**
+ * @brief LPC15XX I2C ROM driver handle structure
+ */
+typedef void *I2C_HANDLE_T;
+
+/**
+ * @brief LPC15XX I2C ROM driver callback function
+ */
+typedef void (*I2C_CALLBK_T)(uint32_t err_code, uint32_t n);
+
+/**
+ * LPC15XX I2C ROM driver parameter structure
+ */
+typedef struct I2C_PARAM {
+ uint32_t num_bytes_send; /*!< No. of bytes to send */
+ uint32_t num_bytes_rec; /*!< No. of bytes to receive */
+ uint8_t *buffer_ptr_send; /*!< Pointer to send buffer */
+ uint8_t *buffer_ptr_rec; /*!< Pointer to receive buffer */
+ I2C_CALLBK_T func_pt; /*!< Callback function */
+ uint8_t stop_flag; /*!< Stop flag */
+ uint8_t dummy[3];
+} I2C_PARAM_T;
+
+/**
+ * LPC15XX I2C ROM driver result structure
+ */
+typedef struct I2C_RESULT {
+ uint32_t n_bytes_sent; /*!< No. of bytes sent */
+ uint32_t n_bytes_recd; /*!< No. of bytes received */
+} I2C_RESULT_T;
+
+/**
+ * LPC15XX I2C ROM driver modes enum
+ */
+typedef enum CHIP_I2C_MODE {
+ IDLE, /*!< IDLE state */
+ MASTER_SEND, /*!< Master send state */
+ MASTER_RECEIVE, /*!< Master Receive state */
+ SLAVE_SEND, /*!< Slave send state */
+ SLAVE_RECEIVE /*!< Slave receive state */
+} CHIP_I2C_MODE_T;
+
+/**
+ * LPC15XX I2C ROM driver APIs structure
+ */
+typedef struct I2CD_API {
+ /*!< Interrupt Support Routine */
+ void (*i2c_isr_handler)(I2C_HANDLE_T *handle);
+ /*!< MASTER functions */
+ ErrorCode_t (*i2c_master_transmit_poll)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result);
+ ErrorCode_t (*i2c_master_receive_poll)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result);
+ ErrorCode_t (*i2c_master_tx_rx_poll)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result);
+ ErrorCode_t (*i2c_master_transmit_intr)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result);
+ ErrorCode_t (*i2c_master_receive_intr)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result);
+ ErrorCode_t (*i2c_master_tx_rx_intr)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result);
+
+ /*!< SLAVE functions */
+ ErrorCode_t (*i2c_slave_receive_poll)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result);
+ ErrorCode_t (*i2c_slave_transmit_poll)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result);
+ ErrorCode_t (*i2c_slave_receive_intr)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result);
+ ErrorCode_t (*i2c_slave_transmit_intr)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result);
+ ErrorCode_t (*i2c_set_slave_addr)(I2C_HANDLE_T *handle, uint32_t slave_addr_0_3, uint32_t slave_mask_0_3);
+
+ /*!< OTHER support functions */
+ uint32_t (*i2c_get_mem_size)(void);
+ I2C_HANDLE_T *(*i2c_setup)(uint32_t i2c_base_addr, uint32_t * start_of_ram);
+ ErrorCode_t (*i2c_set_bitrate)(I2C_HANDLE_T *handle, uint32_t p_clk_in_hz, uint32_t bitrate_in_bps);
+ uint32_t (*i2c_get_firmware_version)(void);
+ CHIP_I2C_MODE_T (*i2c_get_status)(I2C_HANDLE_T *handle);
+ ErrorCode_t (*i2c_set_timeout)(I2C_HANDLE_T *handle, uint32_t timeout);
+} I2CD_API_T;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ROM_I2C_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rom_pwr_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rom_pwr_15xx.h
new file mode 100644
index 0000000..48874e2
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rom_pwr_15xx.h
@@ -0,0 +1,117 @@
+/*
+ * @brief LPC15xx Power ROM API declarations and functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __ROM_PWR_15XX_H_
+#define __ROM_PWR_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup PWRROM_15XX CHIP: LPC15xx Power ROM API declarations and functions
+ * @ingroup ROMAPI_15XX
+ * @{
+ */
+
+/**
+ * @brief LPC15XX Power ROM APIs - set_pll mode options
+ */
+#define CPU_FREQ_EQU 0
+#define CPU_FREQ_LTE 1
+#define CPU_FREQ_GTE 2
+#define CPU_FREQ_APPROX 3
+
+/**
+ * @brief LPC15XX Power ROM APIs - set_pll response0 options
+ */
+#define PLL_CMD_SUCCESS 0
+#define PLL_INVALID_FREQ 1
+#define PLL_INVALID_MODE 2
+#define PLL_FREQ_NOT_FOUND 3
+#define PLL_NOT_LOCKED 4
+
+/**
+ * @brief LPC15XX Power ROM APIs - set_power mode options
+ */
+#define PWR_DEFAULT 0
+#define PWR_CPU_PERFORMANCE 1
+#define PWR_EFFICIENCY 2
+#define PWR_LOW_CURRENT 3
+
+/**
+ * @brief LPC15XX Power ROM APIs - set_power response0 options
+ */
+#define PWR_CMD_SUCCESS 0
+#define PWR_INVALID_FREQ 1
+#define PWR_INVALID_MODE 2
+
+/**
+ * @brief LPC15XX Power ROM APIs - power_mode_configure mode options
+ */
+#define PMU_SLEEP 0
+#define PMU_DEEP_SLEEP 1
+#define PMU_POWERDOWN 2
+#define PMU_DEEP_POWERDOWN 3
+
+/**
+ * @brief LPC15XX Power ROM APIs - power_mode_configure peripheral control bits
+ */
+#define PMU_PD_WDOSC (1 << 0)
+#define PMU_PD_BOD (1 << 1)
+#define PMU_PD_ACMP0 (1 << 2)
+#define PMU_PD_ACMP1 (1 << 3)
+#define PMU_PD_ACMP2 (1 << 4)
+#define PMU_PD_ACMP3 (1 << 5)
+#define PMU_PD_IREF (1 << 6)
+#define PMU_PD_TS (1 << 7)
+
+/**
+ * @brief LPC15xx Power ROM API structure
+ * The power profile API provides functions to configure the system clock and optimize the
+ * system setting for lowest power consumption.
+ */
+typedef struct PWRD_API {
+ void (*set_pll)(uint32_t cmd[], uint32_t resp[]); /*!< Set PLL function */
+ void (*set_power)(uint32_t cmd[], uint32_t resp[]); /*!< Set power function */
+ void (*power_mode_configure)(uint32_t power_mode, uint32_t peripheral_ctrl);/*!< Sets the chip is low power modes */
+ void (*set_aclkgate)(uint32_t aclkgate);
+ uint32_t (*get_aclkgate)(void);
+} PWRD_API_T;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ROM_PWR_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rom_spi_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rom_spi_15xx.h
new file mode 100644
index 0000000..08b9042
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rom_spi_15xx.h
@@ -0,0 +1,141 @@
+/*
+ * @brief LPC15xx SPI ROM API declarations and functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __ROM_SPI_15XX_H_
+#define __ROM_SPI_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup SPIROM_15XX CHIP: LPC15xx SPI ROM API declarations and functions
+ * @ingroup ROMAPI_15XX
+ * @{
+ */
+
+/**
+ * @brief SPI handle type
+ * The handle to the instance of the SPI driver. Each SPI has one handle, so there can be
+ * several handles for each SPI block. This handle is created by Init API and used by the
+ * transfer functions for the corresponding SPI block.
+ */
+typedef void *SPI_HANDLE_T;
+
+/**
+ * @brief SPI DMA configuration structure
+ */
+typedef struct {
+ uint32_t dma_txd_num; /*!< DMA channel number in case DMA mode is enabled. */
+ uint32_t dma_rxd_num; /*!< In order to do a SPI RX DMA, a SPI TX DMA is also needed to generated clock. */
+ DMA_HANDLE_T hDMA; /*!< DMA handle */
+} SPI_DMA_CFG_T;
+
+/**
+ * @brief SPI interrupt callback function type
+ * @param err_code: SPI error code
+ * @param n: In interrupt mode, this parameter indicates the number of SPI frames.
+ * In DMA mode, this parameter is always zero.
+ */
+typedef void (*SPI_CALLBK_T)(ErrorCode_t err_code, uint32_t n);
+
+/**
+ * @brief SPI DMA setup callback function type.
+ * To set up the DMA channel, the source address, destination address, DMA transfer
+ * length, DMA request information must be retrieved from the driver structure which has
+ * been originally passed from the ROM_SPI_PARAM_T structure.
+ * @param handle: SPI driver handle
+ * @param dma_cfg: DMA configuration.
+ */
+typedef ErrorCode_t (*SPI_DMA_REQ_T)(SPI_HANDLE_T handle, SPI_DMA_CFG_T *dma_cfg);
+
+/**
+ * @brief SPI configuration structure
+ */
+typedef struct {
+ uint32_t delay; /*!< Configures the delay between SSEL and data transfers and between frames. The
+ value is the content of the SPI DLY register. */
+ uint32_t divider; /*!< Clock divider value DIVVAL in the SPI DIV register. */
+ uint32_t config; /*!< Enable SPI, configure master/slave, configure signal phase and polarity. The
+ value is the content of the SPI CFG register. */
+ uint32_t error_en; /*!< Enables the receive overrun and transmit underrun error interrupts. */
+} SPI_CONFIG_T;
+
+/**
+ * @brief SPI configuration parameter structure
+ */
+typedef struct {
+ uint16_t *tx_buffer; /*!< Tx buffer */
+ uint16_t *rx_buffer; /*!< Rx buffer */
+ uint32_t size; /*!< size of the SPI transfer. A transfer can consist of several transmits of the
+ TXCTLDAT register and of several frames. */
+ uint32_t fsize_sel; /*!< write the contents of the SPI TXCTL register to select the data length and the
+ slave select lines. In slave mode, you need to only select the data length. */
+ uint32_t eof_flag; /*!< EOF flag. EOF( end of frame ) is needed if set. EOF delay will not be asserted without this flag. */
+ uint32_t tx_rx_flag; /*!< Tx & Rx mode flag. 0 is TX only, 1 is RX only, 0x2 is TX and RX */
+ uint32_t driver_mode; /*!< Driver mode.
+ - 0x00: Polling mode. Function is blocked until transfer is finished.
+ - 0x01: Interrupt mode. Function exits immediately and a call back function is invoked when the transfer has finished
+ - 0x02: DMA mode. Data transferred by SPI is processed by DMA.
+ The DMA_req function is called foe SPI DMA channel set up.
+ The callback function indicates when the transfer is complete. */
+ SPI_DMA_CFG_T *dma_cfg; /*!< DMA configuration */
+ SPI_CALLBK_T cb; /*!< SPI interrupt callback function */
+ SPI_DMA_REQ_T dma_cb; /*!< SPI DMA channel set-up call back function. */
+} SPI_PARAM_T;
+
+/**
+ * @brief SPI ROM API structure
+ * The SPI API handles SPI data transfer in master and slave modes.
+ */
+typedef struct {
+ /** Memory size for one SPI instance */
+ uint32_t (*spi_get_mem_size)(void);
+ /** Set up SPI instance and return handle*/
+ SPI_HANDLE_T (*spi_setup)(uint32_t base_addr, uint8_t *ram);
+ /** Set up SPI operating mode */
+ void (*spi_init)(SPI_HANDLE_T handle, SPI_CONFIG_T *set);
+ /** Send or receive data in master mode*/
+ uint32_t (*spi_master_transfer)(SPI_HANDLE_T handle, SPI_PARAM_T *param);
+ /** Send or receive data in slave mode*/
+ uint32_t (*spi_slave_transfer)(SPI_HANDLE_T handle, SPI_PARAM_T *param);
+ /** Interrupt service routine */
+ void (*spi_isr)(SPI_HANDLE_T handle);
+} SPID_API_T;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ROM_SPI_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rom_uart_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rom_uart_15xx.h
new file mode 100644
index 0000000..4e4777b
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rom_uart_15xx.h
@@ -0,0 +1,181 @@
+/*
+ * @brief LPC15XX UART ROM API declarations and functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __ROM_UART_15XX_H_
+#define __ROM_UART_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup UARTROM_15XX CHIP: LPC15xx UART ROM API declarations and functions
+ * @ingroup ROMAPI_15XX
+ * @{
+ */
+
+/**
+ * @brief UART ROM driver - UART errors in UART configuration used in uart_init function
+ */
+#define OVERRUN_ERR_EN (1 << 0) /*!< Bit 0: Enable overrun error */
+#define UNDERRUN_ERR_EN (1 << 1) /*!< Bit 1: Enable underrun error */
+#define FRAME_ERR_EN (1 << 2) /*!< Bit 2: enable frame error */
+#define PARITY_ERR_EN (1 << 3) /*!< Bit 3: enable parity error */
+#define RXNOISE_ERR_EN (1 << 4) /*!< Bit 4: enable receive noise error */
+
+/**
+ * Macros for UART errors
+ */
+/*!< Enable all the UART errors */
+#define ALL_ERR_EN (OVERRUN_ERR_EN | UNDERRUN_ERR_EN | FRAME_ERR_EN | PARITY_ERR_EN | \
+ RXNOISE_ERR_EN)
+/*!< Disable all the errors */
+#define NO_ERR_EN (0)
+
+/**
+ * Transfer mode values in UART parameter structure.
+ * Used in uart_get_line & uart_put_line function
+ */
+/*!< 0x00: uart_get_line: stop transfer when the buffer is full */
+/*!< 0x00: uart_put_line: stop transfer when the buffer is empty */
+#define TX_MODE_BUF_EMPTY (0x00)
+#define RX_MODE_BUF_FULL (0x00)
+/*!< 0x01: uart_get_line: stop transfer when CRLF are received */
+/*!< 0x01: uart_put_line: transfer stopped after reaching \0 and CRLF is sent out after that */
+#define TX_MODE_SZERO_SEND_CRLF (0x01)
+#define RX_MODE_CRLF_RECVD (0x01)
+/*!< 0x02: uart_get_line: stop transfer when LF are received */
+/*!< 0x02: uart_put_line: transfer stopped after reaching \0. And LF is sent out after that */
+#define TX_MODE_SZERO_SEND_LF (0x02)
+#define RX_MODE_LF_RECVD (0x02)
+/*!< 0x03: uart_get_line: RESERVED */
+/*!< 0x03: uart_put_line: transfer stopped after reaching \0 */
+#define TX_MODE_SZERO (0x03)
+
+/**
+ * @brief UART ROM driver modes
+ */
+#define DRIVER_MODE_POLLING (0x00) /*!< Polling mode */
+#define DRIVER_MODE_INTERRUPT (0x01) /*!< Interrupt mode */
+#define DRIVER_MODE_DMA (0x02) /*!< DMA mode */
+
+/**
+ * @brief UART ROM driver UART handle
+ */
+typedef void *UART_HANDLE_T;
+
+/**
+ * @brief UART ROM driver UART callback function
+ */
+typedef void (*UART_CALLBK_T)(uint32_t err_code, uint32_t n);
+
+/**
+ * @brief UART ROM driver UART DMA callback function
+ */
+typedef void (*UART_DMA_REQ_T)(uint32_t src_adr, uint32_t dst_adr, uint32_t size);
+
+/**
+ * @brief UART ROM driver configutaion structure
+ */
+typedef struct {
+ uint32_t sys_clk_in_hz; /*!< System clock in Hz */
+ uint32_t baudrate_in_hz; /*!< Baud rate in Hz */
+ uint8_t config; /*!< Configuration value */
+ /*!< bit1:0 Data Length: 00: 7 bits length, 01: 8 bits length, others: reserved */
+ /*!< bit3:2 Parity: 00: No Parity, 01: reserved, 10: Even, 11: Odd */
+ /*!< bit4: Stop Bit(s): 0: 1 Stop bit, 1: 2 Stop bits */
+ uint8_t sync_mod; /*!< Sync mode settings */
+ /*!< bit0: Mode: 0: Asynchronous mode, 1: Synchronous mode */
+ /*!< bit1: 0: Un_RXD is sampled on the falling edge of SCLK */
+ /*!< 1: Un_RXD is sampled on the rising edge of SCLK */
+ /*!< bit2: 0: Start and stop bits are transmitted as in asynchronous mode) */
+ /*!< 1: Start and stop bits are not transmitted) */
+ /*!< bit3: 0: The UART is a slave in Synchronous mode */
+ /*!< 1: The UART is a master in Synchronous mode */
+ uint16_t error_en; /*!< Errors to be enabled */
+ /*!< bit0: Overrun Errors Enabled */
+ /*!< bit1: Underrun Errors Enabled */
+ /*!< bit2: FrameErr Errors Enabled */
+ /*!< bit3: ParityErr Errors Enabled */
+ /*!< bit4: RxNoise Errors Enabled */
+} UART_CONFIG_T;
+
+/**
+ * @brief UART ROM driver parameter structure
+ */
+typedef struct {
+ uint8_t *buffer; /*!< Pointer to data buffer */
+ uint32_t size; /*!< Size of the buffer */
+ uint16_t transfer_mode; /*!< Transfer mode settings */
+ /*!< 0x00: uart_get_line: stop transfer when the buffer is full */
+ /*!< 0x00: uart_put_line: stop transfer when the buffer is empty */
+ /*!< 0x01: uart_get_line: stop transfer when CRLF are received */
+ /*!< 0x01: uart_put_line: transfer stopped after reaching \0 and CRLF is sent out after that */
+ /*!< 0x02: uart_get_line: stop transfer when LF are received */
+ /*!< 0x02: uart_put_line: transfer stopped after reaching \0 and LF is sent out after that */
+ /*!< 0x03: uart_get_line: RESERVED */
+ /*!< 0x03: uart_put_line: transfer stopped after reaching \0 */
+ uint8_t driver_mode; /*!< Driver mode */
+ /*!< 0x00: Polling mode, function blocked until transfer completes */
+ /*!< 0x01: Interrupt mode, function immediately returns, callback invoked when transfer completes */
+ /*!< 0x02: DMA mode, in case DMA block is available, DMA req function is called for UART DMA channel setup, then callback function indicate that transfer completes */
+ uint8_t dma_num; /*!< DMA channel number in case DMA mode is enabled */
+ UART_CALLBK_T callback_func_pt;
+ uint32_t dma; /* DMA handler */
+} UART_PARAM_T;
+
+/**
+ * @brief UART ROM driver APIs structure
+ */
+typedef struct UART_API {
+ /* UART Configuration functions */
+ uint32_t (*uart_get_mem_size)(void); /*!< Get the memory size needed by one Min UART instance */
+ UART_HANDLE_T (*uart_setup)(uint32_t base_addr, uint8_t *ram); /*!< Setup Min UART instance with provided memory and return the handle to this instance */
+ uint32_t (*uart_init)(UART_HANDLE_T handle, UART_CONFIG_T *set); /*!< Setup baud rate and operation mode for uart, then enable uart */
+
+ /* UART polling functions block until completed */
+ uint8_t (*uart_get_char)(UART_HANDLE_T handle); /*!< Receive one Char from uart. This functions is only returned after Char is received. In case Echo is enabled, the received data is sent out immediately */
+ void (*uart_put_char)(UART_HANDLE_T handle, uint8_t data); /*!< Send one Char through uart. This function is only returned after data is sent */
+ uint32_t (*uart_get_line)(UART_HANDLE_T handle, UART_PARAM_T *param); /*!< Receive multiple bytes from UART */
+ uint32_t (*uart_put_line)(UART_HANDLE_T handle, UART_PARAM_T *param); /*!< Send string (end with \0) or raw data through UART */
+
+ /* UART interrupt functions return immediately and callback when completed */
+ void (*uart_isr)(UART_HANDLE_T handle); /*!< UART interrupt service routine. To use this routine, the corresponding USART interrupt must be enabled. This function is invoked by the user ISR */
+} UARTD_API_T;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ROM_UART_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/romapi_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/romapi_15xx.h
new file mode 100644
index 0000000..874ca7b
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/romapi_15xx.h
@@ -0,0 +1,115 @@
+/*
+ * @brief LPC15xx ROM API declarations and functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __ROMAPI_15XX_H_
+#define __ROMAPI_15XX_H_
+
+#include "iap.h"
+#include "eeprom.h"
+#include "error.h"
+#include "rom_i2c_15xx.h"
+#include "rom_pwr_15xx.h"
+#include "rom_uart_15xx.h"
+#include "rom_can_15xx.h"
+#include "rom_dma_15xx.h"
+#include "rom_spi_15xx.h"
+#include "rom_adc_15xx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup ROMAPI_15XX CHIP: LPC15xx ROM API declarations and functions
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief LPC15XX High level ROM API structure
+ */
+typedef struct {
+ const uint32_t pUSBD; /*!< USBD API function table base address */
+ const uint32_t reserved0; /*!< Reserved */
+ const CAND_API_T *pCAND; /*!< C_CAN API function table base address */
+ const PWRD_API_T *pPWRD; /*!< Power API function table base address */
+ const uint32_t reserved1; /*!< Reserved */
+ const I2CD_API_T *pI2CD; /*!< I2C driver API function table base address */
+ const DMAD_API_T *pDMAD; /*!< DMA driver API function table base address */
+ const SPID_API_T *pSPID; /*!< I2C driver API function table base address */
+ const ADCD_API_T *pADCD; /*!< ADC driver API function table base address */
+ const UARTD_API_T *pUARTD; /*!< UART driver API function table base address */
+} LPC_ROM_API_T;
+
+/* Pointer to ROM API function address */
+#define LPC_ROM_API_BASE_LOC 0x03000200UL
+#define LPC_ROM_API (*(LPC_ROM_API_T * *) LPC_ROM_API_BASE_LOC)
+
+/* Pointer to @ref CAND_API_T functions in ROM */
+#define LPC_CAND_API ((LPC_ROM_API)->pCAND)
+
+/* Pointer to @ref PWRD_API_T functions in ROM */
+#define LPC_PWRD_API ((LPC_ROM_API)->pPWRD)
+
+/* Pointer to @ref I2CD_API_T functions in ROM */
+#define LPC_I2CD_API ((LPC_ROM_API)->pI2CD)
+
+/* Pointer to @ref DMAD_API_T functions in ROM for DMA */
+#define LPC_DMAD_API ((LPC_ROM_API)->pDMAD)
+
+/* Pointer to @ref SPID_API_T functions in ROM for DMA */
+#define LPC_SPID_API ((LPC_ROM_API)->pSPID)
+
+/* Pointer to @ref ADCD_API_T functions in ROM for pADCD */
+#define LPC_ADCD_API ((LPC_ROM_API)->pADCD)
+
+/* Pointer to @ref UARTD_API_T functions in ROM for UARTs */
+#define LPC_UARTD_API ((LPC_ROM_API)->pUARTD)
+
+/* Pointer to ROM IAP entry functions */
+#define IAP_ENTRY_LOCATION 0x03000205UL
+
+/**
+ * @brief LPC15XX IAP_ENTRY API function type
+ */
+static INLINE void iap_entry(unsigned int cmd_param[5], unsigned int status_result[4])
+{
+ ((IAP_ENTRY_T) IAP_ENTRY_LOCATION)(cmd_param, status_result);
+}
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ROMAPI_11U6X_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rtc_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rtc_15xx.h
new file mode 100644
index 0000000..5e60a1a
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/rtc_15xx.h
@@ -0,0 +1,308 @@
+/*
+ * @brief LPC15xx RTC chip driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __RTC_15XX_H_
+#define __RTC_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup RTC_15XX CHIP: LPC15xx RTC driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief LPC15xx Pin Interrupt and Pattern Match register block structure
+ */
+typedef struct { /*!< RTC */
+ __IO uint32_t CTRL; /*!< RTC control register */
+ __IO uint32_t MATCH; /*!< PRTC match (alarm) register */
+ __IO uint32_t COUNT; /*!< RTC counter register */
+ __IO uint32_t WAKE; /*!< RTC high-resolution/wake-up timer control register */
+} LPC_RTC_T;
+
+/* CTRL register defniitions */
+#define RTC_CTRL_SWRESET (1 << 0) /*!< Apply reset to RTC */
+#define RTC_CTRL_OFD (1 << 1) /*!< Oscillator fail detect status (failed bit) */
+#define RTC_CTRL_ALARM1HZ (1 << 2) /*!< RTC 1 Hz timer alarm flag status (match) bit */
+#define RTC_CTRL_WAKE1KHZ (1 << 3) /*!< RTC 1 kHz timer wake-up flag status (timeout) bit */
+#define RTC_CTRL_ALARMDPD_EN (1 << 4) /*!< RTC 1 Hz timer alarm for Deep power-down enable bit */
+#define RTC_CTRL_WAKEDPD_EN (1 << 5) /*!< RTC 1 kHz timer wake-up for Deep power-down enable bit */
+#define RTC_CTRL_RTC1KHZ_EN (1 << 6) /*!< RTC 1 kHz clock enable bit */
+#define RTC_CTRL_RTC_EN (1 << 7) /*!< RTC enable bit */
+
+/**
+ * @brief Initialize the RTC peripheral
+ * @param pRTC : RTC peripheral selected
+ * @return None
+ */
+STATIC INLINE void Chip_RTC_Init(LPC_RTC_T *pRTC)
+{
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_RTC);
+}
+
+/**
+ * @brief De-initialize the RTC peripheral
+ * @param pRTC : RTC peripheral selected
+ * @return None
+ */
+STATIC INLINE void Chip_RTC_DeInit(LPC_RTC_T *pRTC)
+{
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_RTC);
+}
+
+/**
+ * @brief Enable RTC options
+ * @param pRTC : The base address of RTC block
+ * @param flags : And OR'ed value of RTC_CTRL_* definitions to enable
+ * @return Nothing
+ * @note You can enable multiple RTC options at once using this function
+ * by OR'ing them together. It is recommended to only use the
+ * RTC_CTRL_ALARMDPD_EN, RTC_CTRL_WAKEDPD_EN, RTC_CTRL_RTC1KHZ_EN, and
+ * RTC_CTRL_RTC_EN flags with this function.
+ */
+STATIC INLINE void Chip_RTC_EnableOptions(LPC_RTC_T *pRTC, uint32_t flags)
+{
+ pRTC->CTRL |= flags;
+}
+
+/**
+ * @brief Disable RTC options
+ * @param pRTC : The base address of RTC block
+ * @param flags : And OR'ed value of RTC_CTRL_* definitions to disable
+ * @return Nothing
+ * @note You can enable multiple RTC options at once using this function
+ * by OR'ing them together. It is recommended to only use the
+ * RTC_CTRL_ALARMDPD_EN, RTC_CTRL_WAKEDPD_EN, RTC_CTRL_RTC1KHZ_EN, and
+ * RTC_CTRL_RTC_EN flags with this function.
+ */
+STATIC INLINE void Chip_RTC_DisableOptions(LPC_RTC_T *pRTC, uint32_t flags)
+{
+ pRTC->CTRL &= ~flags;
+}
+
+/**
+ * @brief Reset RTC
+ * @param pRTC : The base address of RTC block
+ * @return Nothing
+ * @note The RTC state will be returned to it's default.
+ */
+STATIC INLINE void Chip_RTC_Reset(LPC_RTC_T *pRTC)
+{
+ Chip_RTC_EnableOptions(pRTC, RTC_CTRL_SWRESET);
+ Chip_RTC_DisableOptions(pRTC, RTC_CTRL_SWRESET);
+}
+
+/**
+ * @brief Enables the RTC
+ * @param pRTC : The base address of RTC block
+ * @return Nothing
+ * @note You can also use Chip_RTC_EnableOptions() with the
+ * RTC_CTRL_RTC_EN flag to enable the RTC.
+ */
+STATIC INLINE void Chip_RTC_Enable(LPC_RTC_T *pRTC)
+{
+ Chip_RTC_EnableOptions(pRTC, RTC_CTRL_RTC_EN);
+}
+
+/**
+ * @brief Disables the RTC
+ * @param pRTC : The base address of RTC block
+ * @return Nothing
+ * @note You can also use Chip_RTC_DisableOptions() with the
+ * RTC_CTRL_RTC_EN flag to enable the RTC.
+ */
+STATIC INLINE void Chip_RTC_Disable(LPC_RTC_T *pRTC)
+{
+ Chip_RTC_DisableOptions(pRTC, RTC_CTRL_RTC_EN);
+}
+
+/**
+ * @brief Enables the RTC 1KHz high resolution timer
+ * @param pRTC : The base address of RTC block
+ * @return Nothing
+ * @note You can also use Chip_RTC_EnableOptions() with the
+ * RTC_CTRL_RTC1KHZ_EN flag to enable the high resolution
+ * timer.
+ */
+STATIC INLINE void Chip_RTC_Enable1KHZ(LPC_RTC_T *pRTC)
+{
+ Chip_RTC_EnableOptions(pRTC, RTC_CTRL_RTC1KHZ_EN);
+}
+
+/**
+ * @brief Disables the RTC 1KHz high resolution timer
+ * @param pRTC : The base address of RTC block
+ * @return Nothing
+ * @note You can also use Chip_RTC_DisableOptions() with the
+ * RTC_CTRL_RTC1KHZ_EN flag to disable the high resolution
+ * timer.
+ */
+STATIC INLINE void Chip_RTC_Disable1KHZ(LPC_RTC_T *pRTC)
+{
+ Chip_RTC_DisableOptions(pRTC, RTC_CTRL_RTC1KHZ_EN);
+}
+
+/**
+ * @brief Enables selected RTC wakeup events
+ * @param pRTC : The base address of RTC block
+ * @param ints : Wakeup events to enable
+ * @return Nothing
+ * @note Select either one or both (OR'ed) RTC_CTRL_ALARMDPD_EN
+ * and RTC_CTRL_WAKEDPD_EN values to enabled. You can also
+ * use Chip_RTC_EnableOptions() with the flags to enable
+ * the events.
+ */
+STATIC INLINE void Chip_RTC_EnableWakeup(LPC_RTC_T *pRTC, uint32_t ints)
+{
+ Chip_RTC_EnableOptions(pRTC, ints);
+}
+
+/**
+ * @brief Disables selected RTC wakeup events
+ * @param pRTC : The base address of RTC block
+ * @param ints : Wakeup events to disable
+ * @return Nothing
+ * @note Select either one or both (OR'ed) RTC_CTRL_ALARMDPD_EN
+ * and RTC_CTRL_WAKEDPD_EN values to disabled. You can also
+ * use Chip_RTC_DisableOptions() with the flags to disable
+ * the events.
+ */
+STATIC INLINE void Chip_RTC_DisableWakeup(LPC_RTC_T *pRTC, uint32_t ints)
+{
+ Chip_RTC_DisableOptions(pRTC, ints);
+}
+
+/**
+ * @brief Clears latched RTC statuses
+ * @param pRTC : The base address of RTC block
+ * @param stsMask : OR'ed status bits to clear
+ * @return Nothing
+ * @note Use and OR'ed stsMask value of RTC_CTRL_OFD, RTC_CTRL_ALARM1HZ,
+ * and RTC_CTRL_WAKE1KHZ to clear specific RTC states.
+ */
+STATIC INLINE uint32_t Chip_RTC_ClearStatus(LPC_RTC_T *pRTC, uint32_t stsMask)
+{
+ return pRTC->CTRL;
+}
+
+/**
+ * @brief Return RTC control/status register
+ * @param pRTC : The base address of RTC block
+ * @return The current RTC control/status register
+ * @note Mask the return value with a RTC_CTRL_* definitions to determine
+ * which bits are set. For example, mask the return value with
+ * RTC_CTRL_ALARM1HZ to determine if the alarm interrupt is pending.
+ */
+STATIC INLINE uint32_t Chip_RTC_GetStatus(LPC_RTC_T *pRTC)
+{
+ return pRTC->CTRL;
+}
+
+/**
+ * @brief Set RTC match value for alarm status/interrupt
+ * @param pRTC : The base address of RTC block
+ * @param count : Alarm event time
+ * @return Nothing
+ */
+STATIC INLINE void Chip_RTC_SetAlarm(LPC_RTC_T *pRTC, uint32_t count)
+{
+ pRTC->MATCH = count;
+}
+
+/**
+ * @brief Return the RTC match value used for alarm status/interrupt
+ * @param pRTC : The base address of RTC block
+ * @return Alarm event time
+ */
+STATIC INLINE uint32_t Chip_RTC_GetAlarm(LPC_RTC_T *pRTC)
+{
+ return pRTC->MATCH;
+}
+
+/**
+ * @brief Set RTC match count for 1 second timer count
+ * @param pRTC : The base address of RTC block
+ * @param count : Initial count to set
+ * @return Nothing
+ * @note Only write to this register when the RTC_CTRL_RTC_EN bit in
+ * the CTRL Register is 0. The counter increments one second
+ * after the RTC_CTRL_RTC_EN bit is set.
+ */
+STATIC INLINE void Chip_RTC_SetCount(LPC_RTC_T *pRTC, uint32_t count)
+{
+ pRTC->COUNT = count;
+}
+
+/**
+ * @brief Get current RTC 1 second timer count
+ * @param pRTC : The base address of RTC block
+ * @return current RTC 1 second timer count
+ */
+STATIC INLINE uint32_t Chip_RTC_GetCount(LPC_RTC_T *pRTC)
+{
+ return pRTC->COUNT;
+}
+
+/**
+ * @brief Set RTC wake count countdown value (in mS ticks)
+ * @param pRTC : The base address of RTC block
+ * @param count : wakeup time in milliSeconds
+ * @return Nothing
+ * @note A write pre-loads a start count value into the wake-up
+ * timer and initializes a count-down sequence.
+ */
+STATIC INLINE void Chip_RTC_SetWake(LPC_RTC_T *pRTC, uint16_t count)
+{
+ pRTC->WAKE = count;
+}
+
+/**
+ * @brief Get RTC wake count countdown value
+ * @param pRTC : The base address of RTC block
+ * @return current RTC wake count countdown value (in mS)
+ */
+STATIC INLINE uint16_t Chip_RTC_GetWake(LPC_RTC_T *pRTC)
+{
+ return pRTC->WAKE;
+}
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __RTC_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/sctipu_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/sctipu_15xx.h
new file mode 100644
index 0000000..d39bd6b
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/sctipu_15xx.h
@@ -0,0 +1,165 @@
+/*
+ * @brief LPC15xx SCTIPU driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __SCTIPU_15XX_H_
+#define __SCTIPU_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup SCTIPU_15XX CHIP: LPC15xx SCT Input Processing Unit (SCTIPU) driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief LPC15XX SCTIPU abort enable/source register block structure
+ */
+typedef struct { /*!< LPC15XX abort enable/source structure */
+ __IO uint32_t ABORT_ENABLE; /*!< SCTIPU abort enable register */
+ __IO uint32_t ABORT_SOURCE; /*!< SCTIPU abort source register */
+ __I uint32_t RESERVED[6];
+} LPC_SCTIPU_ABT_T;
+
+/**
+ * @brief LPC15XX SCTIPU register block structure
+ */
+typedef struct { /*!< LPC15XX SCTIPU Structure */
+ __IO uint32_t SAMPLE_CTRL; /*!< SCTIPU sample control register */
+ __I uint32_t RESERVED[7];
+ LPC_SCTIPU_ABT_T ABORT[4]; /*!< SCTIPU abort enable/source registers */
+} LPC_SCTIPU_T;
+
+/**
+ * @brief Initialize the SCTIPU
+ * @return Nothing
+ * @note Must be called prior to any other SCTIPU function. Sets up clocking and
+ * initial SCTIPU states.
+ */
+STATIC INLINE void Chip_SCTIPU_Init(void)
+{
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SCTIPU);
+ Chip_SYSCTL_PeriphReset(RESET_SCTIPU);
+}
+
+/**
+ * @brief De-Initialize the SCTIPU
+ * @return Nothing
+ */
+STATIC INLINE void Chip_SCTIPU_DeInit(void)
+{
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SCTIPU);
+}
+
+/**
+ * SCTIPU sample control register bit definitions
+ */
+#define SCTIPU_CTRL_INSEL(ch, src) ((src) << (ch)) /*!< Select SCTIPU sample (src) source for output channel ch */
+#define SCTIPU_CTRL_INSELMASK(ch) (1 << (ch)) /*!< SCTIPU sample (src) source mask for output channel ch */
+#define SCTIPU_CTRL_SAMPENA (0) /*!< Selects Sample_Enable_A as the latch/sample-enable control for the Sample_Output latch */
+#define SCTIPU_CTRL_SAMPENB (1) /*!< Selects Sample_Enable_A as the latch/sample-enable control for the Sample_Output latch */
+#define SCTIPU_CTRL_SAMPENC (2) /*!< Selects Sample_Enable_A as the latch/sample-enable control for the Sample_Output latch */
+#define SCTIPU_CTRL_SAMPEND (3) /*!< Selects Sample_Enable_A as the latch/sample-enable control for the Sample_Output latch */
+#define SCTIPU_CTRL_SAMPENDSEL(ch, src) ((src) << (2 + (ch * 2))) /*!< Select SCTIPU sample (src) source for output channel ch */
+#define SCTIPU_CTRL_SAMPENDMASK(ch) (0x3 << (2 + (ch * 2))) /*!< SCTIPU sample (src) source mask for output channel ch */
+#define SCTIPU_CTRL_LATCHENSEL(ch, ltc) ((ltc) << (12 + ch)) /*!< Select SCTIPU latched mode for output channel ch */
+#define SCTIPU_CTRL_LATCHENMASK(ch) (1 << (12 + ch)) /*!< SCTIPU latched mode mask for output channel ch */
+#define SCTIPU_RESERVED_BITS 0xFFFF0000
+
+/**
+ * @brief Sets up an configuration and input source for a SCTIPU output channel
+ * @param ch : SCTIPU channel, 0-3
+ * @param useb : 0 to use SAMPLE_IN_A for the channel, or 1 for SAMPLE_IN_B
+ * @param sampIn : Sample enable input, must be SCTIPU_CTRL_SAMPENA via SCTIPU_CTRL_SAMPEND
+ * @param useLatch : 0 to transparent mode. for the channel, or 1 for latched mode
+ * @return Nothing
+ * @note Example: Chip_SCTIPU_ConfigSample(0, true, SCTIPU_CTRL_SAMPENC, true);
+ */
+void Chip_SCTIPU_ConfigSample(uint8_t ch, uint8_t useb, uint8_t sampIn, uint8_t useLatch);
+
+/**
+ * SCTIPU abort enable sources
+ */
+#define SCTIPU_ABTENA_SCT_ABORT0 (1 << 0) /*!< Enable abort source SCT_ABORT0. Select pin from switch matrix */
+#define SCTIPU_ABTENA_SCT_ABORT1 (1 << 1) /*!< Enable abort source SCT_ABORT1. Select pin from switch matrix */
+#define SCTIPU_ABTENA_SCT0_OUT9 (1 << 2) /*!< Enable abort source SCT0_OUT9 */
+#define SCTIPU_ABTENA_ADC0_THCMP_IRQ (1 << 3) /*!< Enable abort source ADC0_THCMP_IRQ */
+#define SCTIPU_ABTENA_ADC1_THCMP_IRQ (1 << 4) /*!< Enable abort source ADC1_THCMP_IRQ */
+#define SCTIPU_ABTENA_ACMP0_O (1 << 5) /*!< Enable abort source ACMP0_O */
+#define SCTIPU_ABTENA_ACMP1_O (1 << 6) /*!< Enable abort source ACMP1_O */
+#define SCTIPU_ABTENA_ACMP2_O (1 << 7) /*!< Enable abort source ACMP2_O */
+#define SCTIPU_ABTENA_ACMP3_O (1 << 8) /*!< Enable abort source ACMP3_O */
+
+/**
+ * @brief Selects multiple abort input enables that will be enabled to contribute to the ORed output
+ * @param ch : SCTIPU channel, 0-3
+ * @param srcAbort : Or'ed values of SCTIPU_ABTENA_* defintions used for OR'ed abort enables
+ * @return Nothing
+ * @note Example: Chip_SCTIPU_ConfigSample(0, SCTIPU_ABTENA_ACMP0_O | SCTIPU_ABTENA_ACMP1_O);<br>
+ */
+STATIC INLINE void Chip_SCTIPU_AbortInputEnable(uint8_t ch, uint32_t srcAbort)
+{
+ LPC_SCTIPU->ABORT[ch].ABORT_ENABLE = srcAbort;
+}
+
+/**
+ * @brief Gets the activated SCT abort sources
+ * @param ch : SCTIPU channel, 0-3
+ * @return Nothing
+ * @note To determine if a source is active, mask the return value with a
+ * SCTIPU_ABTENA_* definition.
+ */
+STATIC INLINE uint32_t Chip_SCTIPU_GetActiveAbortSrc(uint8_t ch)
+{
+ return LPC_SCTIPU->ABORT[ch].ABORT_SOURCE;
+}
+
+/**
+ * @brief Clears activated SCT abort sources
+ * @param ch : SCTIPU channel, 0-3
+ * @param srcClear : Or'ed values of SCTIPU_ABTENA_* defintions used for clearing activated states
+ * @return Nothing
+ */
+STATIC INLINE void Chip_SCTIPU_ClearActiveAbortSrc(uint8_t ch, uint32_t srcClear)
+{
+ LPC_SCTIPU->ABORT[ch].ABORT_SOURCE = srcClear;
+}
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SCTIPU_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/spi_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/spi_15xx.h
new file mode 100644
index 0000000..01ba963
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/spi_15xx.h
@@ -0,0 +1,634 @@
+/*
+ * @brief LPC15xx SPI driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __SPI_15XX_H_
+#define __SPI_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup SPI_15XX CHIP: LPC15xx SPI driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+/**
+ * @brief SPI register block structure
+ */
+typedef struct { /*!< SPI Structure */
+ __IO uint32_t CFG; /*!< SPI Configuration register*/
+ __IO uint32_t DLY; /*!< SPI Delay register*/
+ __IO uint32_t STAT; /*!< SPI Status. register*/
+ __IO uint32_t INTENSET; /*!< SPI Interrupt Enable.Set register*/
+ __O uint32_t INTENCLR; /*!< SPI Interrupt Enable Clear. register*/
+ __I uint32_t RXDAT; /*!< SPI Receive Data register*/
+ __IO uint32_t TXDATCTL; /*!< SPI Transmit Data with Control register*/
+ __IO uint32_t TXDAT; /*!< SPI Transmit Data register*/
+ __IO uint32_t TXCTRL; /*!< SPI Transmit Control register*/
+ __IO uint32_t DIV; /*!< SPI clock Divider register*/
+ __I uint32_t INTSTAT; /*!< SPI Interrupt Status register*/
+} LPC_SPI_T;
+
+/**
+ * Macro defines for SPI Configuration register
+ */
+/* SPI CFG Register BitMask */
+#define SPI_CFG_BITMASK ((uint32_t) 0xFBD)
+/** SPI enable */
+#define SPI_CFG_SPI_EN ((uint32_t) (1 << 0))
+/** SPI Slave Mode Select */
+#define SPI_CFG_SLAVE_EN ((uint32_t) (0 << 2))
+/** SPI Master Mode Select */
+#define SPI_CFG_MASTER_EN ((uint32_t) (1 << 2))
+/** SPI MSB First mode enable */
+#define SPI_CFG_MSB_FIRST_EN ((uint32_t) (0 << 3)) /*Data will be transmitted and received in standard order (MSB first).*/
+/** SPI LSB First mode enable */
+#define SPI_CFG_LSB_FIRST_EN ((uint32_t) (1 << 3))/*Data will be transmitted and received in reverse order (LSB first).*/
+/** SPI Clock Phase Select*/
+#define SPI_CFG_CPHA_FIRST ((uint32_t) (0 << 4)) /*Capture data on the first edge, Change data on the following edge*/
+#define SPI_CFG_CPHA_SECOND ((uint32_t) (1 << 4)) /*Change data on the first edge, Capture data on the following edge*/
+/** SPI Clock Polarity Select*/
+#define SPI_CFG_CPOL_LO ((uint32_t) (0 << 5)) /* The rest state of the clock (between frames) is low.*/
+#define SPI_CFG_CPOL_HI ((uint32_t) (1 << 5)) /* The rest state of the clock (between frames) is high.*/
+/** SPI control 1 loopback mode enable */
+#define SPI_CFG_LBM_EN ((uint32_t) (1 << 7))
+/** SPI SSEL0 Polarity Select*/
+#define SPI_CFG_SPOL0_LO ((uint32_t) (0 << 8)) /* SSEL0 is active Low */
+#define SPI_CFG_SPOL0_HI ((uint32_t) (1 << 8)) /* SSEL0 is active High */
+/** SPI SSEL1 Polarity Select*/
+#define SPI_CFG_SPOL1_LO ((uint32_t) (0 << 9)) /* SSEL1 is active Low */
+#define SPI_CFG_SPOL1_HI ((uint32_t) (1 << 9)) /* SSEL1 is active High */
+/** SPI SSEL2 Polarity Select*/
+/** Note that SSEL2, SSEL3 is only available on SPI0 not on SPI1 */
+#define SPI_CFG_SPOL2_LO ((uint32_t) (0 << 10)) /* SSEL2 is active Low */
+#define SPI_CFG_SPOL2_HI ((uint32_t) (1 << 10)) /* SSEL2 is active High */
+/** SPI SSEL3 Polarity Select*/
+#define SPI_CFG_SPOL3_LO ((uint32_t) (0 << 11)) /* SSEL3 is active Low */
+#define SPI_CFG_SPOL3_HI ((uint32_t) (1 << 11)) /* SSEL3 is active High */
+
+/**
+ * Macro defines for SPI Delay register
+ */
+/** SPI DLY Register Mask */
+#define SPI_DLY_BITMASK ((uint32_t) 0xFFFF)
+/** Controls the amount of time between SSEL assertion and the beginning of a data frame. */
+#define SPI_DLY_PRE_DELAY(n) ((uint32_t) ((n) & 0x0F)) /* Time Unit: SPI clock time */
+/** Controls the amount of time between the end of a data frame and SSEL deassertion. */
+#define SPI_DLY_POST_DELAY(n) ((uint32_t) (((n) & 0x0F) << 4)) /* Time Unit: SPI clock time */
+/** Controls the minimum amount of time between adjacent data frames. */
+#define SPI_DLY_FRAME_DELAY(n) ((uint32_t) (((n) & 0x0F) << 8)) /* Time Unit: SPI clock time */
+/** Controls the minimum amount of time that the SSEL is deasserted between transfers. */
+#define SPI_DLY_TRANSFER_DELAY(n) ((uint32_t) (((n) & 0x0F) << 12)) /* Time Unit: SPI clock time */
+
+/**
+ * Macro defines for SPI Status register
+ */
+/* SPI STAT Register BitMask */
+#define SPI_STAT_BITMASK ((uint32_t) 0x1FF)
+/* Receiver Ready Flag */
+#define SPI_STAT_RXRDY ((uint32_t) (1 << 0)) /* Data is ready for read */
+/* Transmitter Ready Flag */
+#define SPI_STAT_TXRDY ((uint32_t) (1 << 1)) /* Data may be written to transmit buffer */
+/* Receiver Overrun interrupt flag */
+#define SPI_STAT_RXOV ((uint32_t) (1 << 2)) /* Data comes while receiver buffer is in used */
+/* Transmitter Underrun interrupt flag (In Slave Mode only) */
+#define SPI_STAT_TXUR ((uint32_t) (1 << 3)) /* There is no data to be sent in the next input clock */
+/* Slave Select Assert */
+#define SPI_STAT_SSA ((uint32_t) (1 << 4)) /* There is SSEL transition from deasserted to asserted */
+/* Slave Select Deassert */
+#define SPI_STAT_SSD ((uint32_t) (1 << 5)) /* There is SSEL transition from asserted to deasserted */
+/* Stalled status flag */
+#define SPI_STAT_STALLED ((uint32_t) (1 << 6)) /* SPI is currently in a stall condition. */
+/* End Transfer flag. */
+#define SPI_STAT_EOT ((uint32_t) (1 << 7)) /* The current frame is the last frame of the current transfer. */
+/* Master Idle status flag. */
+#define SPI_STAT_MSTIDLE ((uint32_t) (1 << 8)) /* SPI master function is fully idle. */
+
+/* Clear RXOV Flag */
+#define SPI_STAT_CLR_RXOV ((uint32_t) (1 << 2))
+/* Clear TXUR Flag */
+#define SPI_STAT_CLR_TXUR ((uint32_t) (1 << 3))
+/* Clear SSA Flag */
+#define SPI_STAT_CLR_SSA ((uint32_t) (1 << 4))
+/* Clear SSD Flag */
+#define SPI_STAT_CLR_SSD ((uint32_t) (1 << 5))
+/*Force an end to the current transfer */
+#define SPI_STAT_FORCE_EOT ((uint32_t) (1 << 7))
+
+/**
+ * Macro defines for SPI Interrupt Enable read and Set register
+ */
+/* SPI INTENSET Register BitMask */
+#define SPI_INTENSET_BITMASK ((uint32_t) 0x3F)
+/** Enable Interrupt when receiver data is available */
+#define SPI_INTENSET_RXRDYEN ((uint32_t) (1 << 0))
+/** Enable Interrupt when the transmitter holding register is available. */
+#define SPI_INTENSET_TXRDYEN ((uint32_t) (1 << 1))
+/** Enable Interrupt when a receiver overrun occurs */
+#define SPI_INTENSET_RXOVEN ((uint32_t) (1 << 2))
+/** Enable Interrupt when a transmitter underrun occurs (In Slave Mode Only)*/
+#define SPI_INTENSET_TXUREN ((uint32_t) (1 << 3))
+/** Enable Interrupt when the Slave Select is asserted.*/
+#define SPI_INTENSET_SSAEN ((uint32_t) (1 << 4))
+/** Enable Interrupt when the Slave Select is deasserted..*/
+#define SPI_INTENSET_SSDEN ((uint32_t) (1 << 5))
+
+/**
+ * Macro defines for SPI Interrupt Enable Clear register
+ */
+/* SPI INTENCLR Register BitMask */
+#define SPI_INTENCLR_BITMASK ((uint32_t) 0x3F)
+/** Disable Interrupt when receiver data is available */
+#define SPI_INTENCLR_RXRDYEN ((uint32_t) (1 << 0))
+/** Disable Interrupt when the transmitter holding register is available. */
+#define SPI_INTENCLR_TXRDYEN ((uint32_t) (1 << 1))
+/** Disable Interrupt when a receiver overrun occurs */
+#define SPI_INTENCLR_RXOVEN ((uint32_t) (1 << 2))
+/** Disable Interrupt when a transmitter underrun occurs (In Slave Mode Only)*/
+#define SPI_INTENCLR_TXUREN ((uint32_t) (1 << 3))
+/** Disable Interrupt when the Slave Select is asserted.*/
+#define SPI_INTENCLR_SSAEN ((uint32_t) (1 << 4))
+/** Disable Interrupt when the Slave Select is deasserted..*/
+#define SPI_INTENCLR_SSDEN ((uint32_t) (1 << 5))
+
+/**
+ * Macro defines for SPI Receiver Data register
+ */
+/* SPI RXDAT Register BitMask */
+#define SPI_RXDAT_BITMASK ((uint32_t) 0x1FFFFF)
+/** Receiver Data */
+#define SPI_RXDAT_DATA(n) ((uint32_t) ((n) & 0xFFFF))
+/** The state of SSEL0 pin */
+#define SPI_RXDAT_RXSSEL0_ACTIVE ((uint32_t) (0 << 16)) /* SSEL0 is in active state */
+#define SPI_RXDAT_RXSSEL0_INACTIVE ((uint32_t) (1 << 16)) /* SSEL0 is in inactive state */
+#define SPI_RXDAT_RXSSEL0_FLAG ((uint32_t) (1 << 16)) /* SSEL0 Rx Flag */
+/** The state of SSEL1 pin */
+#define SPI_RXDAT_RXSSEL1_ACTIVE ((uint32_t) (0 << 17)) /* SSEL1 is in active state */
+#define SPI_RXDAT_RXSSEL1_INACTIVE ((uint32_t) (1 << 17)) /* SSEL1 is in inactive state */
+#define SPI_RXDAT_RXSSEL1_FLAG ((uint32_t) (1 << 17)) /* SSEL1 Rx Flag */
+/** The state of SSEL2 pin */
+#define SPI_RXDAT_RXSSEL2_ACTIVE ((uint32_t) (0 << 18)) /* SSEL2 is in active state */
+#define SPI_RXDAT_RXSSEL2_INACTIVE ((uint32_t) (1 << 18)) /* SSEL2 is in inactive state */
+#define SPI_RXDAT_RXSSEL2_FLAG ((uint32_t) (1 << 18)) /* SSEL2 Rx Flag */
+/** The state of SSEL3 pin */
+#define SPI_RXDAT_RXSSEL3_ACTIVE ((uint32_t) (0 << 19)) /* SSEL3 is in active state */
+#define SPI_RXDAT_RXSSEL3_INACTIVE ((uint32_t) (1 << 19)) /* SSEL3 is in inactive state */
+#define SPI_RXDAT_RXSSEL3_FLAG ((uint32_t) (1 << 19)) /* SSEL3 Rx Flag */
+/** Start of Transfer flag */
+#define SPI_RXDAT_SOT ((uint32_t) (1 << 20)) /* This is the first frame received after SSEL is asserted */
+
+/**
+ * Macro defines for SPI Transmitter Data and Control register
+ */
+/* SPI TXDATCTL Register BitMask */
+#define SPI_TXDATCTL_BITMASK ((uint32_t) 0xF7FFFFF)
+/* SPI Transmit Data */
+#define SPI_TXDATCTL_DATA(n) ((uint32_t) ((n) & 0xFFFF))
+/*Assert/Deassert SSEL0 pin*/
+#define SPI_TXDATCTL_ASSERT_SSEL0 ((uint32_t) (0 << 16))
+#define SPI_TXDATCTL_DEASSERT_SSEL0 ((uint32_t) (1 << 16))
+/*Assert/Deassert SSEL1 pin*/
+#define SPI_TXDATCTL_ASSERT_SSEL1 ((uint32_t) (0 << 17))
+#define SPI_TXDATCTL_DEASSERT_SSEL1 ((uint32_t) (1 << 17))
+/*Assert/Deassert SSEL2 pin*/
+/** Note that SSEL2, SSEL3 is only available on SPI0 not on SPI1 */
+#define SPI_TXDATCTL_ASSERT_SSEL2 ((uint32_t) (0 << 18))
+#define SPI_TXDATCTL_DEASSERT_SSEL2 ((uint32_t) (1 << 18))
+/*Assert/Deassert SSEL3 pin*/
+#define SPI_TXDATCTL_ASSERT_SSEL3 ((uint32_t) (0 << 19))
+#define SPI_TXDATCTL_DEASSERT_SSEL3 ((uint32_t) (1 << 19))
+/* Mask for Slave Select bits */
+#define SPI_TXDATCTL_SSEL_MASK ((uint32_t) (0x0F0000))
+
+/** End of Transfer flag (TRANSFER_DELAY is applied after sending the current frame) */
+#define SPI_TXDATCTL_EOT ((uint32_t) (1 << 20)) /* This is the last frame of the current transfer */
+/** End of Frame flag (FRAME_DELAY is applied after sending the current part) */
+#define SPI_TXDATCTL_EOF ((uint32_t) (1 << 21)) /* This is the last part of the current frame */
+/** Receive Ignore Flag */
+#define SPI_TXDATCTL_RXIGNORE ((uint32_t) (1 << 22)) /* Received data is ignored */
+/** Transmit Data Length */
+#define SPI_TXDATCTL_LEN(n) ((uint32_t) (((n) & 0x0F) << 24)) /* Frame Length -1 */
+
+/**
+ * Macro defines for SPI Transmitter Data Register
+ */
+/* SPI Transmit Data */
+#define SPI_TXDAT_DATA(n) ((uint32_t) ((n) & 0xFFFF))
+
+/**
+ * Macro defines for SPI Transmitter Control register
+ */
+/* SPI TXDATCTL Register BitMask */
+#define SPI_TXCTL_BITMASK ((uint32_t) 0xF7F0000)
+/*Assert/Deassert SSEL0 pin*/
+#define SPI_TXCTL_ASSERT_SSEL0 ((uint32_t) (0 << 16))
+#define SPI_TXCTL_DEASSERT_SSEL0 ((uint32_t) (1 << 16))
+/*Assert/Deassert SSEL1 pin*/
+#define SPI_TXCTL_ASSERT_SSEL1 ((uint32_t) (0 << 17))
+#define SPI_TXCTL_DEASSERT_SSEL1 ((uint32_t) (1 << 17))
+/*Assert/Deassert SSEL2 pin*/
+/** Note that SSEL2, SSEL3 is only available on SPI0 not on SPI1 */
+#define SPI_TXCTL_ASSERT_SSEL2 ((uint32_t) (0 << 18))
+#define SPI_TXCTL_DEASSERT_SSEL2 ((uint32_t) (1 << 18))
+/*Assert/Deassert SSEL3 pin*/
+#define SPI_TXCTL_ASSERT_SSEL3 ((uint32_t) (0 << 19))
+#define SPI_TXCTL_DEASSERT_SSEL3 ((uint32_t) (1 << 19))
+/** End of Transfer flag (TRANSFER_DELAY is applied after sending the current frame) */
+#define SPI_TXCTL_EOT ((uint32_t) (1 << 20)) /* This is the last frame of the current transfer */
+/** End of Frame flag (FRAME_DELAY is applied after sending the current part) */
+#define SPI_TXCTL_EOF ((uint32_t) (1 << 21)) /* This is the last part of the current frame */
+/** Receive Ignore Flag */
+#define SPI_TXCTL_RXIGNORE ((uint32_t) (1 << 22)) /* Received data is ignored */
+/** Transmit Data Length */
+#define SPI_TXCTL_LEN(n) ((uint32_t) (((n) & 0x0F) << 24)) /* Frame Length -1 */
+
+/**
+ * Macro defines for SPI Divider register
+ */
+/** Rate divider value (In Master Mode only)*/
+#define SPI_DIV_VAL(n) ((uint32_t) ((n) & 0xFFFF)) /* SPI_CLK = PCLK/(DIV_VAL+1)*/
+
+/**
+ * Macro defines for SPI Interrupt Status register
+ */
+/* SPI INTSTAT Register Bitmask */
+#define SPI_INTSTAT_BITMASK ((uint32_t) 0x3F)
+/* Receiver Ready Flag */
+#define SPI_INTSTAT_RXRDY ((uint32_t) (1 << 0)) /* Data is ready for read */
+/* Transmitter Ready Flag */
+#define SPI_INTSTAT_TXRDY ((uint32_t) (1 << 1)) /* Data may be written to transmit buffer */
+/* Receiver Overrun interrupt flag */
+#define SPI_INTSTAT_RXOV ((uint32_t) (1 << 2)) /* Data comes while receiver buffer is in used */
+/* Transmitter Underrun interrupt flag (In Slave Mode only) */
+#define SPI_INTSTAT_TXUR ((uint32_t) (1 << 3)) /* There is no data to be sent in the next input clock */
+/* Slave Select Assert */
+#define SPI_INTSTAT_SSA ((uint32_t) (1 << 4)) /* There is SSEL transition from deasserted to asserted */
+/* Slave Select Deassert */
+#define SPI_INTSTAT_SSD ((uint32_t) (1 << 5)) /* There is SSEL transition from asserted to deasserted */
+
+/** @brief SPI Mode*/
+typedef enum {
+ SPI_MODE_MASTER = SPI_CFG_MASTER_EN, /* Master Mode */
+ SPI_MODE_SLAVE = SPI_CFG_SLAVE_EN /* Slave Mode */
+} SPI_MODE_T;
+
+/** @brief SPI Clock Mode*/
+typedef enum IP_SPI_CLOCK_MODE {
+ SPI_CLOCK_CPHA0_CPOL0 = SPI_CFG_CPOL_LO | SPI_CFG_CPHA_FIRST, /**< CPHA = 0, CPOL = 0 */
+ SPI_CLOCK_CPHA0_CPOL1 = SPI_CFG_CPOL_HI | SPI_CFG_CPHA_FIRST, /**< CPHA = 0, CPOL = 1 */
+ SPI_CLOCK_CPHA1_CPOL0 = SPI_CFG_CPOL_LO | SPI_CFG_CPHA_SECOND, /**< CPHA = 1, CPOL = 0 */
+ SPI_CLOCK_CPHA1_CPOL1 = SPI_CFG_CPOL_HI | SPI_CFG_CPHA_SECOND, /**< CPHA = 1, CPOL = 1 */
+ SPI_CLOCK_MODE0 = SPI_CLOCK_CPHA0_CPOL0,/**< alias */
+ SPI_CLOCK_MODE1 = SPI_CLOCK_CPHA1_CPOL0,/**< alias */
+ SPI_CLOCK_MODE2 = SPI_CLOCK_CPHA0_CPOL1,/**< alias */
+ SPI_CLOCK_MODE3 = SPI_CLOCK_CPHA1_CPOL1,/**< alias */
+} SPI_CLOCK_MODE_T;
+
+/** @brief SPI Data Order Mode*/
+typedef enum IP_SPI_DATA_ORDER {
+ SPI_DATA_MSB_FIRST = SPI_CFG_MSB_FIRST_EN, /* Standard Order */
+ SPI_DATA_LSB_FIRST = SPI_CFG_LSB_FIRST_EN, /* Reverse Order */
+} SPI_DATA_ORDER_T;
+
+/**
+ * @brief SPI Configure Struct
+ */
+typedef struct {
+ SPI_MODE_T Mode; /* Mode Select */
+ SPI_CLOCK_MODE_T ClockMode; /* CPHA CPOL Select */
+ SPI_DATA_ORDER_T DataOrder; /* MSB/LSB First */
+ uint32_t SSELPol; /* SSEL Polarity Select */
+ uint16_t ClkDiv; /* SPI Clock Divider Value */
+} SPI_CFG_T;
+
+/**
+ * @brief SPI Delay Configure Struct
+ */
+typedef struct {
+ uint8_t PreDelay; /* Pre-delay value in SPI clock time */
+ uint8_t PostDelay; /* Post-delay value in SPI clock time */
+ uint8_t FrameDelay; /* Delay value between frames of a transfer in SPI clock time */
+ uint8_t TransferDelay; /* Delay value between transfers in SPI clock time */
+} SPI_DELAY_CONFIG_T;
+
+/**
+ * @brief SPI data setup structure
+ */
+typedef struct {
+ uint16_t *pTx; /**< Pointer to data buffer*/
+ uint32_t TxCnt;/* Transmit Counter */
+ uint16_t *pRx; /**< Pointer to data buffer*/
+ uint32_t RxCnt;/* Transmit Counter */
+ uint32_t Length; /**< Data Length*/
+ uint32_t ssel; /**< Slave select bits */
+ uint16_t DataSize; /** < The size of a frame (1-16)*/
+} SPI_DATA_SETUP_T;
+
+/**
+ * @brief Set the SPI Config register
+ * @param pSPI : The base SPI peripheral on the chip
+ * @param pConfig : SPI Configuration
+ * @return Nothing
+ */
+void Chip_SPI_SetConfig(LPC_SPI_T *pSPI, SPI_CFG_T *pConfig);
+
+/**
+ * @brief Calculate the divider for SPI clock
+ * @param pSPI : The base of SPI peripheral on the chip
+ * @param bitRate : Expected clock rate
+ * @return Divider value
+ */
+uint32_t Chip_SPI_CalClkRateDivider(LPC_SPI_T *pSPI, uint32_t bitRate);
+
+/**
+ * @brief Config SPI Delay parameters
+ * @param pSPI : The base of SPI peripheral on the chip
+ * @param pConfig : SPI Delay Configure Struct
+ * @return Nothing
+ * @note The SPI delays are setup
+ */
+void Chip_SPI_DelayConfig(LPC_SPI_T *pSPI, SPI_DELAY_CONFIG_T *pConfig);
+
+/**
+ * @brief SPI Initialization
+ * @param pSPI : The base SPI peripheral on the chip
+ * @return Nothing
+ */
+void Chip_SPI_Init(LPC_SPI_T *pSPI);
+
+/**
+ * @brief Disable SPI operation
+ * @param pSPI : The base of SPI peripheral on the chip
+ * @return Nothing
+ * @note The SPI controller is disabled
+ */
+void Chip_SPI_DeInit(LPC_SPI_T *pSPI);
+
+/**
+ * @brief Enable/Disable SPI interrupt
+ * @param pSPI : The base SPI peripheral on the chip
+ * @param IntMask : Interrupt mask
+ * @param NewState : ENABLE or DISABLE interrupt
+ * @return Nothing
+ */
+void Chip_SPI_Int_Cmd(LPC_SPI_T *pSPI, uint32_t IntMask, FunctionalState NewState);
+
+/**
+ * @brief Enable SPI peripheral
+ * @param pSPI : The base of SPI peripheral on the chip
+ * @return Nothing
+ */
+STATIC INLINE void Chip_SPI_Enable(LPC_SPI_T *pSPI)
+{
+ pSPI->CFG |= SPI_CFG_SPI_EN;
+}
+
+/**
+ * @brief Disable SPI peripheral
+ * @param pSPI : The base of SPI peripheral on the chip
+ * @return Nothing
+ */
+STATIC INLINE void Chip_SPI_Disable(LPC_SPI_T *pSPI)
+{
+ pSPI->CFG &= (~SPI_CFG_SPI_EN) & SPI_CFG_BITMASK;
+}
+
+/**
+ * @brief Enable loopback mode
+ * @param pSPI : The base of SPI peripheral on the chip
+ * @return Nothing
+ * @note Serial input is taken from the serial output (MOSI or MISO) rather
+ * than the serial input pin
+ */
+STATIC INLINE void Chip_SPI_EnableLoopBack(LPC_SPI_T *pSPI)
+{
+ pSPI->CFG |= SPI_CFG_LBM_EN;
+}
+
+/**
+ * @brief Disable loopback mode
+ * @param pSPI : The base of SPI peripheral on the chip
+ * @return Nothing
+ * @note Serial input is taken from the serial input pin
+ */
+STATIC INLINE void Chip_SPI_DisableLoopBack(LPC_SPI_T *pSPI)
+{
+ pSPI->CFG &= (~SPI_CFG_LBM_EN) & SPI_CFG_BITMASK;
+}
+
+/**
+ * @brief Get the current status of SPI controller
+ * @param pSPI : The base of SPI peripheral on the chip
+ * @return SPI Status (Or-ed bit value of SPI_STAT_*)
+ */
+STATIC INLINE uint32_t Chip_SPI_GetStatus(LPC_SPI_T *pSPI)
+{
+ return pSPI->STAT;
+}
+
+/**
+ * @brief Clear SPI status
+ * @param pSPI : The base of SPI peripheral on the chip
+ * @param Flag : Clear Flag (Or-ed bit value of SPI_STAT_CLR_*)
+ * @return Nothing
+ */
+STATIC INLINE void Chip_SPI_ClearStatus(LPC_SPI_T *pSPI, uint32_t Flag)
+{
+ pSPI->STAT = (Flag & SPI_STAT_BITMASK);
+}
+
+/**
+ * @brief Set control information including SSEL, EOT, EOF RXIGNORE and FLEN
+ * @param pSPI : The base of SPI peripheral on the chip
+ * @param len : Data size (1-16)
+ * @param Flag : Flag control (Or-ed values of SPI_TXCTL_*)
+ * @note The control information has no effect unless data is later written to TXDAT
+ * @return Nothing
+ */
+STATIC INLINE void Chip_SPI_SetControlInfo(LPC_SPI_T *pSPI, uint8_t len, uint32_t Flag)
+{
+ pSPI->TXCTRL = (Flag & SPI_TXCTL_BITMASK) | SPI_TXDATCTL_LEN(len - 1);
+}
+
+/**
+ * @brief Send the first Frame of a transfer (Rx Ignore)
+ * @param pSPI : The base of SPI peripheral on the chip
+ * @param Data : Transmit data
+ * @param DataSize : Data Size (1-16)
+ * @param ssel : ORed value of Slave Select bits
+ * @return Nothing
+ */
+STATIC INLINE void Chip_SPI_SendFirstFrame_RxIgnore(LPC_SPI_T *pSPI, uint16_t Data, uint8_t DataSize, uint32_t ssel)
+{
+ pSPI->TXDATCTL = (ssel & SPI_TXDATCTL_SSEL_MASK) | SPI_TXDATCTL_EOF | SPI_TXDATCTL_RXIGNORE | SPI_TXDATCTL_LEN(
+ DataSize - 1) | SPI_TXDATCTL_DATA(Data);
+}
+
+/**
+ * @brief Send the first Frame of a transfer
+ * @param pSPI : The base of SPI peripheral on the chip
+ * @param Data : Transmit data
+ * @param DataSize : Data Size (1-16)
+ * @param ssel : ORed value of Slave Select bits
+ * @return Nothing
+ */
+STATIC INLINE void Chip_SPI_SendFirstFrame(LPC_SPI_T *pSPI, uint16_t Data, uint8_t DataSize, uint32_t ssel)
+{
+ pSPI->TXDATCTL =
+ (ssel & SPI_TXDATCTL_SSEL_MASK) | SPI_TXDATCTL_EOF | SPI_TXDATCTL_LEN(DataSize - 1) | SPI_TXDATCTL_DATA(Data);
+}
+
+/**
+ * @brief Send the middle Frame of a transfer
+ * @param pSPI : The base of SPI peripheral on the chip
+ * @param Data : Transmit data
+ * @return Nothing
+ */
+STATIC INLINE void Chip_SPI_SendMidFrame(LPC_SPI_T *pSPI, uint16_t Data)
+{
+ pSPI->TXDAT = SPI_TXDAT_DATA(Data);
+}
+
+/**
+ * @brief Send the last Frame of a transfer (Rx Ignore)
+ * @param pSPI : The base of SPI peripheral on the chip
+ * @param Data : Transmit data
+ * @param DataSize : Data Size (1-16)
+ * @param ssel : ORed value of Slave Select bits
+ * @return Nothing
+ */
+STATIC INLINE void Chip_SPI_SendLastFrame_RxIgnore(LPC_SPI_T *pSPI, uint16_t Data, uint8_t DataSize, uint32_t ssel)
+{
+ pSPI->TXDATCTL = (ssel & SPI_TXDATCTL_SSEL_MASK) | SPI_TXDATCTL_EOF | SPI_TXDATCTL_EOT | SPI_TXDATCTL_RXIGNORE |
+ SPI_TXDATCTL_LEN(DataSize - 1) | SPI_TXDATCTL_DATA(Data);
+}
+
+/**
+ * @brief Send the last Frame of a transfer
+ * @param pSPI : The base of SPI peripheral on the chip
+ * @param Data : Transmit data
+ * @param DataSize : Data Size (1-16)
+ * @param ssel : ORed value of Slave Select bits
+ * @return Nothing
+ */
+STATIC INLINE void Chip_SPI_SendLastFrame(LPC_SPI_T *pSPI, uint16_t Data, uint8_t DataSize, uint32_t ssel)
+{
+ pSPI->TXDATCTL = (ssel & SPI_TXDATCTL_SSEL_MASK) | SPI_TXDATCTL_EOF | SPI_TXDATCTL_EOT |
+ SPI_TXDATCTL_LEN(DataSize - 1) | SPI_TXDATCTL_DATA(Data);
+}
+
+/**
+ * @brief Read data received
+ * @param pSPI : The base of SPI peripheral on the chip
+ * @return Receive data
+ */
+STATIC INLINE uint16_t Chip_SPI_ReceiveFrame(LPC_SPI_T *pSPI)
+{
+ return SPI_RXDAT_DATA(pSPI->RXDAT);
+}
+
+/**
+ * @brief Read and return Rx Slave Select and Start of transfer flags
+ * @param pSPI : The base of SPI peripheral on the chip
+ * @return Rx Slave Select and Start of transfer flags
+ */
+STATIC INLINE uint16_t Chip_SPI_GetReceiveInfo(LPC_SPI_T *pSPI)
+{
+ return pSPI->RXDAT &
+ (SPI_RXDAT_RXSSEL0_FLAG | SPI_RXDAT_RXSSEL0_FLAG | SPI_RXDAT_RXSSEL0_FLAG | SPI_RXDAT_RXSSEL0_FLAG |
+ SPI_RXDAT_SOT);
+}
+
+/**
+ * @brief Get the current Interrupt status of SPI controller
+ * @param pSPI : The base of SPI peripheral on the chip
+ * @return SPI Interrupt Status (Or-ed bit value of SPI_INTSTAT_*)
+ */
+STATIC INLINE uint32_t Chip_SPI_GetIntStatus(LPC_SPI_T *pSPI)
+{
+ return pSPI->INTSTAT;
+}
+
+/**
+ * @brief SPI Interrupt Read/Write
+ * @param pSPI : The base SPI peripheral on the chip
+ * @param xf_setup : Pointer to a SPI_DATA_SETUP_T structure that contains specified
+ * information about transmit/receive data configuration
+ * @return SUCCESS or ERROR
+ */
+Status Chip_SPI_Int_RWFrames(LPC_SPI_T *pSPI, SPI_DATA_SETUP_T *xf_setup);
+
+/**
+ * @brief SPI Polling Read/Write in blocking mode
+ * @param pSPI : The base SPI peripheral on the chip
+ * @param pXfSetup : Pointer to a SPI_DATA_SETUP_T structure that contains specified
+ * information about transmit/receive data configuration
+ * @return Actual data length has been transferred
+ * @note
+ * This function can be used in both master and slave mode. It starts with writing phase and after that,
+ * a reading phase is generated to read any data available in RX_FIFO. All needed information is prepared
+ * through xf_setup param.
+ */
+uint32_t Chip_SPI_RWFrames_Blocking(LPC_SPI_T *pSPI, SPI_DATA_SETUP_T *pXfSetup);
+
+/**
+ * @brief SPI Polling Write in blocking mode
+ * @param pSPI : The base SPI peripheral on the chip
+ * @param pXfSetup :Pointer to a SPI_DATA_SETUP_T structure that contains specified
+ * information about transmit/receive data configuration
+ * @return Actual data length has been transferred
+ * @note
+ * This function can be used in both master and slave mode. First, a writing operation will send
+ * the needed data. After that, a dummy reading operation is generated to clear data buffer
+ */
+uint32_t Chip_SPI_WriteFrames_Blocking(LPC_SPI_T *pSPI, SPI_DATA_SETUP_T *pXfSetup);
+
+/**
+ * @brief SPI Polling Read in blocking mode
+ * @param pSPI : The base SPI peripheral on the chip
+ * @param pXfSetup :Pointer to a SPI_DATA_SETUP_T structure that contains specified
+ * information about transmit/receive data configuration
+ * @return Actual data length has been read
+ * @note
+ * This function can be used in both master and slave mode. First, a writing operation will send
+ * the needed data. After that, a dummy reading operation is generated to clear data buffer
+ */
+uint32_t Chip_SPI_ReadFrames_Blocking(LPC_SPI_T *pSPI, SPI_DATA_SETUP_T *pXfSetup);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SPI_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/stopwatch.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/stopwatch.h
new file mode 100644
index 0000000..8e5f9cc
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/stopwatch.h
@@ -0,0 +1,137 @@
+/*
+ * @brief Common stopwatch support
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __STOPWATCH_H_
+#define __STOPWATCH_H_
+
+#include "cmsis.h"
+
+/** @defgroup Stop_Watch CHIP: Stopwatch primitives.
+ * @ingroup CHIP_Common
+ * @{
+ */
+
+/**
+ * @brief Initialize stopwatch
+ * @return Nothing
+ */
+void StopWatch_Init(void);
+
+/**
+ * @brief Start a stopwatch
+ * @return Current cycle count
+ */
+uint32_t StopWatch_Start(void);
+
+/**
+ * @brief Returns number of ticks elapsed since stopwatch was started
+ * @param startTime : Time returned by StopWatch_Start().
+ * @return Number of ticks elapsed since stopwatch was started
+ */
+STATIC INLINE uint32_t StopWatch_Elapsed(uint32_t startTime)
+{
+ return StopWatch_Start() - startTime;
+}
+
+/**
+ * @brief Returns number of ticks per second of the stopwatch timer
+ * @return Number of ticks per second of the stopwatch timer
+ */
+uint32_t StopWatch_TicksPerSecond(void);
+
+/**
+ * @brief Converts from stopwatch ticks to mS.
+ * @param ticks : Duration in ticks to convert to mS.
+ * @return Number of mS in given number of ticks
+ */
+uint32_t StopWatch_TicksToMs(uint32_t ticks);
+
+/**
+ * @brief Converts from stopwatch ticks to uS.
+ * @param ticks : Duration in ticks to convert to uS.
+ * @return Number of uS in given number of ticks
+ */
+uint32_t StopWatch_TicksToUs(uint32_t ticks);
+
+/**
+ * @brief Converts from mS to stopwatch ticks.
+ * @param mS : Duration in mS to convert to ticks.
+ * @return Number of ticks in given number of mS
+ */
+uint32_t StopWatch_MsToTicks(uint32_t mS);
+
+/**
+ * @brief Converts from uS to stopwatch ticks.
+ * @param uS : Duration in uS to convert to ticks.
+ * @return Number of ticks in given number of uS
+ */
+uint32_t StopWatch_UsToTicks(uint32_t uS);
+
+/**
+ * @brief Delays the given number of ticks using stopwatch primitives
+ * @param ticks : Number of ticks to delay
+ * @return Nothing
+ */
+STATIC INLINE void StopWatch_DelayTicks(uint32_t ticks)
+{
+ uint32_t startTime = StopWatch_Start();
+ while (StopWatch_Elapsed(startTime) < ticks) {}
+}
+
+/**
+ * @brief Delays the given number of mS using stopwatch primitives
+ * @param mS : Number of mS to delay
+ * @return Nothing
+ */
+STATIC INLINE void StopWatch_DelayMs(uint32_t mS)
+{
+ uint32_t ticks = StopWatch_MsToTicks(mS);
+ uint32_t startTime = StopWatch_Start();
+ while (StopWatch_Elapsed(startTime) < ticks) {}
+}
+
+/**
+ * @brief Delays the given number of uS using stopwatch primitives
+ * @param uS : Number of uS to delay
+ * @return Nothing
+ */
+STATIC INLINE void StopWatch_DelayUs(uint32_t uS)
+{
+ uint32_t ticks = StopWatch_UsToTicks(uS);
+ uint32_t startTime = StopWatch_Start();
+ while (StopWatch_Elapsed(startTime) < ticks) {}
+}
+
+/**
+ * @}
+ */
+
+#endif /* __STOPWATCH_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/swm_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/swm_15xx.h
new file mode 100644
index 0000000..79db869
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/swm_15xx.h
@@ -0,0 +1,274 @@
+/*
+ * @brief LPC15xx Switch Matrix driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __SWM_15XX_H_
+#define __SWM_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup SWM_15XX CHIP: LPC15xx Switch Matrix Driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief LPC15XX Switch Matrix register block structure
+ */
+typedef struct {
+ __IO uint32_t PINASSIGN[16]; /*!< Pin Assignment register array */
+ __I uint32_t RESERVED0[96];
+ __IO uint32_t PINENABLE[2]; /*!< fixed pin enable/disable registers */
+} LPC_SWM_T;
+
+/**
+ * @brief LPC15XX Switch Matrix Movable pins
+ */
+typedef enum CHIP_SWM_PIN_MOVABLE {
+ SWM_UART0_TXD_O = 0x00, /*!< PINASSIGN0 - UART0 TXD Output */
+ SWM_UART0_RXD_I = 0x01, /*!< PINASSIGN0 - UART0 RXD Input */
+ SWM_UART0_RTS_O = 0x02, /*!< PINASSIGN0 - UART0 RTS Output */
+ SWM_UART0_CTS_I = 0x03, /*!< PINASSIGN0 - UART0 CTS Input */
+ SWM_UART0_SCLK_IO = 0x10, /*!< PINASSIGN1 - UART0 SCLK I/O */
+ SWM_UART1_TXD_O = 0x11, /*!< PINASSIGN1 - UART1 TXD Output */
+ SWM_UART1_RXD_I = 0x12, /*!< PINASSIGN1 - UART1 RXD Input */
+ SWM_UART1_RTS_O = 0x13, /*!< PINASSIGN1 - UART1 RTS Output */
+ SWM_UART1_CTS_I = 0x20, /*!< PINASSIGN2 - UART1 CTS Input */
+ SWM_UART1_SCLK_IO = 0x21, /*!< PINASSIGN2 - UART1 SCLK I/O */
+ SWM_UART2_TXD_O = 0x22, /*!< PINASSIGN2 - UART2 TXD Output */
+ SWM_UART2_RXD_I = 0x23, /*!< PINASSIGN2 - UART2 RXD Input */
+ SWM_UART2_SCLK_IO = 0x30, /*!< PINASSIGN3 - UART2 SCLK I/O */
+ SWM_SSP0_SCK_IO = 0x31, /*!< PINASSIGN3 - SSP0 SCK I/O */
+ SWM_SPI0_SCK_IO = SWM_SSP0_SCK_IO,
+ SWM_SSP0_MOSI_IO = 0x32, /*!< PINASSIGN3 - SSP0 MOSI I/O */
+ SWM_SPI0_MOSI_IO = SWM_SSP0_MOSI_IO,
+ SWM_SSP0_MISO_IO = 0x33, /*!< PINASSIGN3 - SSP0 MISO I/O */
+ SWM_SPI0_MISO_IO = SWM_SSP0_MISO_IO,
+ SWM_SSP0_SSELSN_0_IO = 0x40,
+ SWM_SPI0_SSELSN_0_IO = SWM_SSP0_SSELSN_0_IO,
+ SWM_SSP0_SSELSN_1_IO = 0x41,
+ SWM_SPI0_SSELSN_1_IO = SWM_SSP0_SSELSN_1_IO,
+ SWM_SSP0_SSELSN_2_IO = 0x42,
+ SWM_SPI0_SSELSN_2_IO = SWM_SSP0_SSELSN_2_IO,
+ SWM_SSP0_SSELSN_3_IO = 0x43,
+ SWM_SPI0_SSELSN_3_IO = SWM_SSP0_SSELSN_3_IO,
+ SWM_SSP1_SCK_IO = 0x50, /*!< PINASSIGN5 - SPI1 SCK I/O */
+ SWM_SPI1_SCK_IO = SWM_SSP1_SCK_IO,
+ SWM_SSP1_MOSI_IO = 0x51, /*!< PINASSIGN5 - SPI1 MOSI I/O */
+ SWM_SPI1_MOSI_IO = SWM_SSP1_MOSI_IO,
+ SWM_SSP1_MISO_IO = 0x52, /*!< PINASSIGN5 - SPI1 MISO I/O */
+ SWM_SPI1_MISO_IO = SWM_SSP1_MISO_IO,
+ SWM_SSP1_SSELSN_0_IO = 0x53, /*!< PINASSIGN5 - SPI1 SSEL I/O */
+ SWM_SPI1_SSELSN_0_IO = SWM_SSP1_SSELSN_0_IO,
+ SWM_SSP1_SSELSN_1_IO = 0x60,
+ SWM_SPI1_SSELSN_1_IO = SWM_SSP1_SSELSN_1_IO,
+ SWM_CAN_TD1_O = 0x61,
+ SWM_CAN_RD1_I = 0x62,
+ SWM_USB_VBUS_I = 0x70,
+ SWM_SCT0_OUT0_O = 0x71,
+ SWM_SCT0_OUT1_O = 0x72,
+ SWM_SCT0_OUT2_O = 0x73,
+ SWM_SCT1_OUT0_O = 0x80,
+ SWM_SCT1_OUT1_O = 0x81,
+ SWM_SCT1_OUT2_O = 0x82,
+ SWM_SCT2_OUT0_O = 0x83,
+ SWM_SCT2_OUT1_O = 0x90,
+ SWM_SCT2_OUT2_O = 0x91,
+ SWM_SCT3_OUT0_O = 0x92,
+ SWM_SCT3_OUT1_O = 0x93,
+ SWM_SCT3_OUT2_O = 0xA0,
+ SWM_SCT_ABORT0_I = 0xA1,
+ SWM_SCT_ABORT1_I = 0xA2,
+ SWM_ADC0_PIN_TRIG0_I = 0xA3,
+ SWM_ADC0_PIN_TRIG1_I = 0xB0,
+ SWM_ADC1_PIN_TRIG0_I = 0xB1,
+ SWM_ADC1_PIN_TRIG1_I = 0xB2,
+ SWM_DAC_PIN_TRIG_I = 0xB3,
+ SWM_DAC_SHUTOFF_I = 0xC0,
+ SWM_ACMP0_OUT_O = 0xC1,
+ SWM_ACMP1_OUT_O = 0xC2,
+ SWM_ACMP2_OUT_O = 0xC3,
+ SWM_ACMP3_OUT_O = 0xD0,
+ SWM_CLK_OUT_O = 0xD1,
+ SWM_ROSC0_O = 0xD2,
+ SWM_ROSC_RST0_I = 0xD3,
+ SWM_USB_FRAME_TOG_O = 0xE0,
+ SWM_QEI0_PHA_I = 0xE1,
+ SWM_QEI0_PHB_I = 0xE2,
+ SWM_QEI0_IDX_I = 0xE3,
+ SWM_GPIO_INT_BMATCH_O = 0xF0,
+ SWM_SWO_O = 0xF1,
+} CHIP_SWM_PIN_MOVABLE_T;
+
+/**
+ * @brief LPC15XX Switch Matrix Fixed pins
+ */
+typedef enum CHIP_SWM_PIN_FIXED {
+ SWM_FIXED_ADC0_0 = 0x00, /*!< ADC0_0 fixed pin enable/disable on pin P0_8 */
+ SWM_FIXED_ADC0_1 = 0x01, /*!< ADC0_1 fixed pin enable/disable on pin P0_7 */
+ SWM_FIXED_ADC0_2 = 0x02, /*!< ADC0_2 fixed pin enable/disable on pin P0_6 */
+ SWM_FIXED_ADC0_3 = 0x03, /*!< ADC0_3 fixed pin enable/disable on pin P0_5 */
+ SWM_FIXED_ADC0_4 = 0x04, /*!< ADC0_4 fixed pin enable/disable on pin P0_4 */
+ SWM_FIXED_ADC0_5 = 0x05, /*!< ADC0_5 fixed pin enable/disable on pin P0_3 */
+ SWM_FIXED_ADC0_6 = 0x06, /*!< ADC0_6 fixed pin enable/disable on pin P0_2 */
+ SWM_FIXED_ADC0_7 = 0x07, /*!< ADC0_7 fixed pin enable/disable on pin P0_1 */
+ SWM_FIXED_ADC0_8 = 0x08, /*!< ADC0_8 fixed pin enable/disable on pin P1_0 */
+ SWM_FIXED_ADC0_9 = 0x09, /*!< ADC0_9 fixed pin enable/disable on pin P0_31 */
+ SWM_FIXED_ADC0_10 = 0x0A, /*!< ADC0_10 fixed pin enable/disable on pin P0_0 */
+ SWM_FIXED_ADC0_11 = 0x0B, /*!< ADC0_11 fixed pin enable/disable on pin P0_30 */
+ SWM_FIXED_ADC1_0 = 0x0C, /*!< ADC1_0 fixed pin enable/disable/disable on pin P1_1 */
+ SWM_FIXED_ADC1_1 = 0x0D, /*!< ADC1_1 fixed pin enable/disable on pin P0_9 */
+ SWM_FIXED_ADC1_2 = 0x0E, /*!< ADC1_2 fixed pin enable/disable on pin P0_10 */
+ SWM_FIXED_ADC1_3 = 0x0F, /*!< ADC1_3 fixed pin enable/disable on pin P0_11 */
+ SWM_FIXED_ADC1_4 = 0x10, /*!< ADC1_4 fixed pin enable/disable on pin P1_2 */
+ SWM_FIXED_ADC1_5 = 0x11, /*!< ADC1_5 fixed pin enable/disable on pin P1_3 */
+ SWM_FIXED_ADC1_6 = 0x12, /*!< ADC1_6 fixed pin enable/disable on pin P0_13 */
+ SWM_FIXED_ADC1_7 = 0x13, /*!< ADC1_7 fixed pin enable/disable on pin P0_14 */
+ SWM_FIXED_ADC1_8 = 0x14, /*!< ADC1_8 fixed pin enable/disable on pin P0_15 */
+ SWM_FIXED_ADC1_9 = 0x15, /*!< ADC1_9 fixed pin enable/disable on pin P0_16 */
+ SWM_FIXED_ADC1_10 = 0x16, /*!< ADC1_10 fixed pin enable/disable on pin P1_4 */
+ SWM_FIXED_ADC1_11 = 0x17, /*!< ADC1_11 fixed pin enable/disable on pin P1_5 */
+ SWM_FIXED_DAC_OUT = 0x18, /*!< DAC_OUT fixed pin enable/disable on pin P0_12 */
+ SWM_FIXED_ACMP_I1 = 0x19, /*!< ACMP input 1 (common input) fixed pin enable/disable on pin P0_27 */
+ SWM_FIXED_ACMP_I2 = 0x1A, /*!< ACMP input 1 (common input) fixed pin enable/disable on pin P1_6 */
+ SWM_FIXED_ACMP0_I3 = 0x1B, /*!< ACMP comparator 0 input 3 fixed pin enable/disable on pin P0_26 */
+ SWM_FIXED_ACMP0_I4 = 0x1C, /*!< ACMP comparator 0 input 4 fixed pin enable/disable on pin P0_25 */
+ SWM_FIXED_ACMP1_I3 = 0x1D, /*!< ACMP comparator 1 input 3 fixed pin enable/disable on pin P0_28 */
+ SWM_FIXED_ACMP1_I4 = 0x1E, /*!< ACMP comparator 1 input 4 fixed pin enable/disable on pin P1_10 */
+ SWM_FIXED_ACMP2_I3 = 0x1F, /*!< ACMP comparator 2 input 3 fixed pin enable/disable on pin P0_29 */
+ SWM_FIXED_ACMP2_I4 = 0x80, /*!< ACMP comparator 2 input 4 fixed pin enable/disable on pin P1_9 */
+ SWM_FIXED_ACMP3_I3 = 0x81, /*!< ACMP comparator 3 input 3 fixed pin enable/disable on pin P1_8 */
+ SWM_FIXED_ACMP3_I4 = 0x82, /*!< ACMP comparator 3 input 4 fixed pin enable/disable on pin P1_7 */
+ SWM_FIXED_I2C0_SDA = 0x83, /*!< I2C0_SDA fixed pin enable/disable on pin P0_23 */
+ SWM_FIXED_I2C0_SCL = 0x84, /*!< I2C0_SCL fixed pin enable/disable on pin P0_22 */
+ SWM_FIXED_SCT0_OUT3 = 0x85, /*!< SCT0_OUT3 fixed pin enable/disable on pin P0_0 */
+ SWM_FIXED_SCT0_OUT4 = 0x86, /*!< SCT0_OUT4 fixed pin enable/disable on pin P0_1 */
+ SWM_FIXED_SCT0_OUT5 = 0x87, /*!< SCT0_OUT5 fixed pin enable/disable on pin P0_18 */
+ SWM_FIXED_SCT0_OUT6 = 0x88, /*!< SCT0_OUT6 fixed pin enable/disable on pin P0_24 */
+ SWM_FIXED_SCT0_OUT7 = 0x89, /*!< SCT0_OUT7 fixed pin enable/disable on pin P1_14 */
+ SWM_FIXED_SCT1_OUT3 = 0x8A, /*!< SCT1_OUT3 fixed pin enable/disable on pin P0_2 */
+ SWM_FIXED_SCT1_OUT4 = 0x8B, /*!< SCT1_OUT4 fixed pin enable/disable on pin P0_3 */
+ SWM_FIXED_SCT1_OUT5 = 0x8C, /*!< SCT1_OUT5 fixed pin enable/disable on pin P0_14 */
+ SWM_FIXED_SCT1_OUT6 = 0x8D, /*!< SCT1_OUT6 fixed pin enable/disable on pin P0_20 */
+ SWM_FIXED_SCT1_OUT7 = 0x8E, /*!< SCT1_OUT7 fixed pin enable/disable on pin P1_17 */
+ SWM_FIXED_SCT2_OUT3 = 0x8F, /*!< SCT2_OUT3 fixed pin enable/disable on pin P0_6 */
+ SWM_FIXED_SCT2_OUT4 = 0x90, /*!< SCT2_OUT4 fixed pin enable/disable on pin P0_29 */
+ SWM_FIXED_SCT2_OUT5 = 0x91, /*!< SCT2_OUT5 fixed pin enable/disable on pin P1_20 */
+ SWM_FIXED_SCT3_OUT3 = 0x92, /*!< SCT3_OUT3 fixed pin enable/disable on pin P0_26 */
+ SWM_FIXED_SCT3_OUT4 = 0x93, /*!< SCT3_OUT4 fixed pin enable/disable on pin P1_8 */
+ SWM_FIXED_SCT3_OUT5 = 0x94, /*!< SCT3_OUT5 fixed pin enable/disable on pin P1_24 */
+ SWM_FIXED_RESETN = 0x95, /*!< RESETN fixed pin enable/disable on pin P0_21 */
+ SWM_FIXED_SWCLK_TCK = 0x96, /*!< SWCLK_TCK fixed pin enable/disable on pin P0_19 */
+ SWM_FIXED_SWDIO = 0x97, /*!< SWDIO fixed pin enable/disable on pin P0_20 */
+} CHIP_SWM_PIN_FIXED_T;
+
+/**
+ * @brief Initialize the SWM module
+ * @return Nothing
+ * @note This function only enables the SWM clock.
+ */
+STATIC INLINE void Chip_SWM_Init(void)
+{
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
+}
+
+/**
+ * @brief Deinitialise the SWM module
+ * @return Nothing
+ * @note This function only disables the SWM clock.
+ */
+STATIC INLINE void Chip_SWM_Deinit(void)
+{
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM);
+}
+
+/**
+ * @brief Assign movable pin function to physical pin in Switch Matrix
+ * @param movable : Movable pin function
+ * @param assign : Physical pin to be assigned
+ * @return Nothing
+ */
+void Chip_SWM_MovablePinAssign(CHIP_SWM_PIN_MOVABLE_T movable, uint8_t assign);
+
+/**
+ * @brief Assign movable pin function to port and pin in the Switch Matrix
+ * @param movable : Movable pin function
+ * @param port : Port number
+ * @param pin : Pin number
+ * @return Nothing
+ * @note This function does the same thing as Chip_SWM_MovablePinAssign()
+ * except works with a port and pin number instead of a physical
+ * pin number.
+ */
+STATIC INLINE void Chip_SWM_MovablePortPinAssign(CHIP_SWM_PIN_MOVABLE_T movable, uint8_t port, uint8_t pin)
+{
+ Chip_SWM_MovablePinAssign(movable, ((port * 32) + pin));
+}
+
+/**
+ * @brief Enables a fixed function pin in the Switch Matrix
+ * @param pin : Pin to be enabled
+ * @return Nothing
+ */
+void Chip_SWM_EnableFixedPin(CHIP_SWM_PIN_FIXED_T pin);
+
+/**
+ * @brief Disables a fixed function pin in the Switch Matrix
+ * @param pin : Pin to be disabled
+ * @return Nothing
+ */
+void Chip_SWM_DisableFixedPin(CHIP_SWM_PIN_FIXED_T pin);
+
+/**
+ * @brief Enables or disables a fixed function pin in the Switch Matrix
+ * @param pin : Pin to be enabled or disabled
+ * @param enable : True to enable the pin, False to disable the pin
+ * @return Nothing
+ */
+void Chip_SWM_FixedPinEnable(CHIP_SWM_PIN_FIXED_T pin, bool enable);
+
+/**
+ * @brief Tests whether a fixed function pin is enabled or disabled in the Switch Matrix
+ * @param pin : The pin to test whether it is enabled or disabled
+ * @return True if the pin is enabled, False if disabled
+ */
+bool Chip_SWM_IsFixedPinEnabled(CHIP_SWM_PIN_FIXED_T pin);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SWM_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/sys_config.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/sys_config.h
new file mode 100644
index 0000000..a36207d
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/sys_config.h
@@ -0,0 +1,36 @@
+/*
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __SYS_CONFIG_H_
+#define __SYS_CONFIG_H_
+
+/* LPC15xx chip familiy is suppored */
+#define CHIP_LPC15XX
+
+#endif /* __SYS_CONFIG_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/sysctl_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/sysctl_15xx.h
new file mode 100644
index 0000000..a31d9c5
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/sysctl_15xx.h
@@ -0,0 +1,619 @@
+/*
+ * @brief LPC15XX System Control registers and control functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __SYSCTL_15XX_H_
+#define __SYSCTL_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup SYSCTL_15XX CHIP: LPC15xx System Control block driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief LPC15XX System Control block structure
+ */
+typedef struct { /*!< SYSCTL Structure */
+ __IO uint32_t SYSMEMREMAP; /*!< System Memory remap register */
+ __I uint32_t RESERVED0[2];
+ __IO uint32_t AHBBUFEN0;
+ __IO uint32_t AHBBUFEN1;
+ __IO uint32_t SYSTCKCAL; /*!< System tick counter calibration register */
+ __I uint32_t RESERVED1[1];
+ __IO uint32_t NMISRC; /*!< NMI source control register */
+ __I uint32_t RESERVED2[8];
+ __IO uint32_t SYSRSTSTAT; /*!< System Reset Status register */
+ __IO uint32_t PRESETCTRL[2]; /*!< Peripheral reset Control registers */
+ __I uint32_t PIOPORCAP[3]; /*!< POR captured PIO status registers */
+ __I uint32_t RESERVED3[10];
+ __IO uint32_t MAINCLKSELA; /*!< Main clock source A select register */
+ __IO uint32_t MAINCLKSELB; /*!< Main clock source B select register */
+ __IO uint32_t USBCLKSEL; /*!< USB clock source select register */
+ __IO uint32_t ADCASYNCCLKSEL; /*!< ADC asynchronous clock source select register */
+ __I uint32_t RESERVED4[1];
+ __IO uint32_t CLKOUTSEL[2]; /*!< Clock out source select registers */
+ __I uint32_t RESERVED5[1];
+ __IO uint32_t SYSPLLCLKSEL; /*!< System PLL clock source select register */
+ __IO uint32_t USBPLLCLKSEL; /*!< USB PLL clock source select register */
+ __IO uint32_t SCTPLLCLKSEL; /*!< SCT PLL clock source select register */
+ __I uint32_t RESERVED6[5];
+ __IO uint32_t SYSAHBCLKDIV; /*!< System Clock divider register */
+ __IO uint32_t SYSAHBCLKCTRL[2];/*!< System clock control registers */
+ __IO uint32_t SYSTICKCLKDIV; /*!< SYSTICK clock divider */
+ __IO uint32_t UARTCLKDIV; /*!< UART clock divider register */
+ __IO uint32_t IOCONCLKDIV; /*!< programmable glitch filter divider registers for IOCON */
+ __IO uint32_t TRACECLKDIV; /*!< ARM trace clock divider register */
+ __I uint32_t RESERVED7[4];
+ __IO uint32_t USBCLKDIV; /*!< USB clock source divider register */
+ __IO uint32_t ADCASYNCCLKDIV; /*!< Asynchronous ADC clock divider */
+ __I uint32_t RESERVED8[1];
+ __IO uint32_t CLKOUTDIV; /*!< Clock out divider register */
+ __I uint32_t RESERVED9[9];
+ __IO uint32_t FREQMECTRL; /*!< Frequency measure register */
+ __IO uint32_t FLASHCFG; /*!< Flash configuration register */
+ __IO uint32_t FRGCTRL; /*!< USART fractional baud rate generator control register */
+ __IO uint32_t USBCLKCTRL; /*!< USB clock control register */
+ __I uint32_t USBCLKST; /*!< USB clock status register */
+ __I uint32_t RESERVED10[19];
+ __IO uint32_t BODCTRL; /*!< Brown Out Detect register */
+ __I uint32_t IRCCTRL;
+ __IO uint32_t SYSOSCCTRL; /*!< System Oscillator control register */
+ __I uint32_t RESERVED11[1];
+ __IO uint32_t RTCOSCCTRL; /*!< RTC Oscillator control register */
+ __I uint32_t RESERVED12[1];
+ __IO uint32_t SYSPLLCTRL; /*!< System PLL control register */
+ __I uint32_t SYSPLLSTAT; /*!< System PLL status register */
+ __IO uint32_t USBPLLCTRL; /*!< USB PLL control register */
+ __I uint32_t USBPLLSTAT; /*!< USB PLL status register */
+ __IO uint32_t SCTPLLCTRL; /*!< SCT PLL control register */
+ __I uint32_t SCTPLLSTAT; /*!< SCT PLL status register */
+ __I uint32_t RESERVED13[21];
+ __IO uint32_t PDWAKECFG; /*!< Power down states in wake up from deep sleep register */
+ __IO uint32_t PDRUNCFG; /*!< Power configuration register*/
+ __I uint32_t RESERVED14[3];
+ __IO uint32_t STARTERP[2]; /*!< Start logic interrupt wake-up enable registers */
+ __I uint32_t RESERVED15[117];
+ __I uint32_t JTAG_IDCODE; /*!< JTAG ID code register */
+ __I uint32_t DEVICEID[2]; /*!< Device ID registers */
+} LPC_SYSCTL_T;
+
+/**
+ * System memory remap modes used to remap interrupt vectors
+ */
+typedef enum CHIP_SYSCTL_BOOT_MODE_REMAP {
+ REMAP_BOOT_LOADER_MODE = 0, /*!< Interrupt vectors are re-mapped to Boot ROM */
+ REMAP_USER_RAM_MODE, /*!< Interrupt vectors are re-mapped to Static RAM */
+ REMAP_USER_FLASH_MODE /*!< Interrupt vectors are not re-mapped and reside in Flash */
+} CHIP_SYSCTL_BOOT_MODE_REMAP_T;
+
+/**
+ * @brief Re-map interrupt vectors
+ * @param remap : system memory map value
+ * @return Nothing
+ */
+STATIC INLINE void Chip_SYSCTL_Map(CHIP_SYSCTL_BOOT_MODE_REMAP_T remap)
+{
+ LPC_SYSCTL->SYSMEMREMAP = (uint32_t) remap;
+}
+
+/**
+ * Peripheral reset identifiers, not available on all devices
+ */
+typedef enum {
+ /* PRESETCTRL0 resets */
+ RESET_FLASH = 7, /*!< FLASH controller reset control */
+ RESET_EEPROM = 9, /*!< EEPROM controller reset control */
+ RESET_MUX = 11, /*!< Input mux reset control */
+ RESET_IOCON = 13, /*!< IOCON reset control */
+ RESET_PININT = 18, /*!< Pin interrupt (PINT) reset reset control */
+ RESET_GINT, /*!< Grouped interrupt (GINT) reset control */
+ RESET_DMA, /*!< DMA reset control */
+ RESET_CRC, /*!< CRC reset control */
+ RESET_ADC0 = 27, /*!< ADC0 reset control */
+ RESET_ADC1, /*!< ADC1 reset control */
+ RESET_ACMP = 30, /*!< Analog Comparator (all 4 ACMP) reset control */
+ RESET_MRT = 32 + 0, /*!< Multi-rate timer (MRT) reset control */
+ RESET_RIT, /*!< Repetitive interrupt timer (RIT) reset control */
+ RESET_SCT0, /*!< State configurable timer 0 (SCT0) reset control */
+ RESET_SCT1, /*!< State configurable timer 1 (SCT1) reset control */
+ RESET_SCT2, /*!< State configurable timer 2 (SCT2) reset control */
+ RESET_SCT3, /*!< State configurable timer 3 (SCT3) reset control */
+ RESET_SCTIPU, /*!< State configurable timer IPU (SCTIPU) reset control */
+ RESET_CAN, /*!< CAN reset control */
+ RESET_SPI0 = 32 + 9, /*!< SPI0 reset control */
+ RESET_SPI1, /*!< SPI1 reset control */
+ RESET_I2C0 = 32 + 13, /*!< I2C0 reset control */
+ RESET_UART0 = 32 + 17, /*!< UART0 reset control */
+ RESET_UART1, /*!< UART1 reset control */
+ RESET_UART2, /*!< UART2 reset control */
+ RESET_QEI0 = 32 + 21, /*!< QEI0 reset control */
+ RESET_USB = 32 + 23 /*!< USB reset control */
+} CHIP_SYSCTL_PERIPH_RESET_T;
+
+/**
+ * @brief Assert reset for a peripheral
+ * @param periph : Peripheral to assert reset for
+ * @return Nothing
+ * @note The peripheral will stay in reset until reset is de-asserted. Call
+ * Chip_SYSCTL_DeassertPeriphReset() to de-assert the reset.
+ */
+void Chip_SYSCTL_AssertPeriphReset(CHIP_SYSCTL_PERIPH_RESET_T periph);
+
+/**
+ * @brief De-assert reset for a peripheral
+ * @param periph : Peripheral to de-assert reset for
+ * @return Nothing
+ */
+void Chip_SYSCTL_DeassertPeriphReset(CHIP_SYSCTL_PERIPH_RESET_T periph);
+
+/**
+ * @brief Resets a peripheral
+ * @param periph : Peripheral to reset
+ * @return Nothing
+ */
+STATIC INLINE void Chip_SYSCTL_PeriphReset(CHIP_SYSCTL_PERIPH_RESET_T periph)
+{
+ Chip_SYSCTL_AssertPeriphReset(periph);
+ Chip_SYSCTL_DeassertPeriphReset(periph);
+}
+
+/**
+ * System reset status
+ */
+#define SYSCTL_RST_POR (1 << 0) /*!< POR reset status */
+#define SYSCTL_RST_EXTRST (1 << 1) /*!< External reset status */
+#define SYSCTL_RST_WDT (1 << 2) /*!< Watchdog reset status */
+#define SYSCTL_RST_BOD (1 << 3) /*!< Brown-out detect reset status */
+#define SYSCTL_RST_SYSRST (1 << 4) /*!< software system reset status */
+
+/**
+ * @brief Get system reset status
+ * @return An Or'ed value of SYSCTL_RST_*
+ * @note This function returns the detected reset source(s). Mask with an
+ * SYSCTL_RST_* value to determine if a reset has occurred.
+ */
+STATIC INLINE uint32_t Chip_SYSCTL_GetSystemRSTStatus(void)
+{
+ return LPC_SYSCTL->SYSRSTSTAT;
+}
+
+/**
+ * @brief Clear system reset status
+ * @param reset : An Or'ed value of SYSCTL_RST_* statuses to clear
+ * @return Nothing
+ */
+STATIC INLINE void Chip_SYSCTL_ClearSystemRSTStatus(uint32_t reset)
+{
+ LPC_SYSCTL->SYSRSTSTAT = reset;
+}
+
+/**
+ * @brief Read POR captured PIO status at reset
+ * @param index : POR register index 0, 1, or 2
+ * @return captured POR PIO status for ports 0, 1, or 2
+ */
+STATIC INLINE uint32_t Chip_SYSCTL_GetPORPIOStatus(int index)
+{
+ return LPC_SYSCTL->PIOPORCAP[index];
+}
+
+/**
+ * Brown-out detector reset level
+ */
+typedef enum CHIP_SYSCTL_BODRSTLVL {
+ SYSCTL_BODRSTLVL_RESERVED0,
+ SYSCTL_BODRSTLVL_RESERVED1,
+ SYSCTL_BODRSTLVL_2_34V, /*!< Brown-out reset at 2.34v */
+ SYSCTL_BODRSTLVL_2_64V, /*!< Brown-out reset at 2.64v */
+} CHIP_SYSCTL_BODRSTLVL_T;
+
+/**
+ * Brown-out detector interrupt level
+ */
+typedef enum CHIP_SYSCTL_BODRINTVAL {
+ SYSCTL_BODINTVAL_RESERVED0,
+ SYSCTL_BODINTVAL_RESERVED1,
+ SYSCTL_BODINTVAL_2_55V, /*!< Brown-out interrupt at 2.55v */
+ SYSCTL_BODINTVAL_2_83V, /*!< Brown-out interrupt at 2.83v */
+} CHIP_SYSCTL_BODRINTVAL_T;
+
+/**
+ * @brief Set brown-out detection interrupt and reset levels
+ * @param rstlvl : Brown-out detector reset level
+ * @param intlvl : Brown-out interrupt level
+ * @return Nothing
+ * @note Brown-out detection reset will be disabled upon exiting this function.
+ * Use Chip_SYSCTL_EnableBODReset() to re-enable.
+ */
+STATIC INLINE void Chip_SYSCTL_SetBODLevels(CHIP_SYSCTL_BODRSTLVL_T rstlvl,
+ CHIP_SYSCTL_BODRINTVAL_T intlvl)
+{
+ LPC_SYSCTL->BODCTRL = ((uint32_t) rstlvl) | (((uint32_t) intlvl) << 2);
+}
+
+/**
+ * @brief Enable brown-out detection reset
+ * @return Nothing
+ */
+STATIC INLINE void Chip_SYSCTL_EnableBODReset(void)
+{
+ LPC_SYSCTL->BODCTRL |= (1 << 4);
+}
+
+/**
+ * @brief Disable brown-out detection reset
+ * @return Nothing
+ */
+STATIC INLINE void Chip_SYSCTL_DisableBODReset(void)
+{
+ LPC_SYSCTL->BODCTRL &= ~(1 << 4);
+}
+
+/**
+ * @brief Set System tick timer calibration value
+ * @param sysCalVal : System tick timer calibration value
+ * @return Nothing
+ */
+STATIC INLINE void Chip_SYSCTL_SetSYSTCKCAL(uint32_t sysCalVal)
+{
+ LPC_SYSCTL->SYSTCKCAL = sysCalVal;
+}
+
+/**
+ * Non-Maskable Interrupt Enable/Disable value
+ */
+#define SYSCTL_NMISRC_ENABLE (1UL << 31) /*!< Enable the Non-Maskable Interrupt (NMI) source */
+
+/**
+ * @brief Set source for non-maskable interrupt (NMI)
+ * @param intsrc : IRQ number to assign to the NMI
+ * @return Nothing
+ * @note The NMI source will be disabled upon exiting this function. Use the
+ * Chip_SYSCTL_EnableNMISource() function to enable the NMI source.
+ */
+STATIC INLINE void Chip_SYSCTL_SetNMISource(uint32_t intsrc)
+{
+ LPC_SYSCTL->NMISRC = 0; /* Disable first */
+ LPC_SYSCTL->NMISRC = intsrc;
+}
+
+/**
+ * @brief Enable interrupt used for NMI source
+ * @return Nothing
+ */
+STATIC INLINE void Chip_SYSCTL_EnableNMISource(void)
+{
+ LPC_SYSCTL->NMISRC |= SYSCTL_NMISRC_ENABLE;
+}
+
+/**
+ * @brief Disable interrupt used for NMI source
+ * @return Nothing
+ */
+STATIC INLINE void Chip_SYSCTL_DisableNMISource(void)
+{
+ LPC_SYSCTL->NMISRC &= ~(SYSCTL_NMISRC_ENABLE);
+}
+
+/**
+ * @brief Starts a frequency measurement cycle
+ * @return Nothing
+ * @note This function is meant to be used with the Chip_INMUX_SetFreqMeasRefClock()
+ * and Chip_INMUX_SetFreqMeasTargClock() functions.
+ */
+STATIC INLINE void Chip_SYSCTL_StartFreqMeas(void)
+{
+ LPC_SYSCTL->FREQMECTRL = 0;
+ LPC_SYSCTL->FREQMECTRL = (1UL << 31);
+}
+
+/**
+ * @brief Indicates when a frequency measurement cycle is complete
+ * @return true if a measurement cycle is active, otherwise false
+ */
+STATIC INLINE bool Chip_SYSCTL_IsFreqMeasComplete(void)
+{
+ return (bool) ((LPC_SYSCTL->FREQMECTRL & (1UL << 31)) == 0);
+}
+
+/**
+ * @brief Returns the raw capture value for a frequency measurement cycle
+ * @return raw cpature value (this is not a frequency)
+ */
+STATIC INLINE uint32_t Chip_SYSCTL_GetRawFreqMeasCapval(void)
+{
+ return LPC_SYSCTL->FREQMECTRL & 0x3FFF;
+}
+
+/**
+ * @brief Returns the computed value for a frequency measurement cycle
+ * @param refClockRate : Reference clock rate used during the frequency measurement cycle
+ * @return Computed cpature value
+ */
+uint32_t Chip_SYSCTL_GetCompFreqMeas(uint32_t refClockRate);
+
+/**
+ * @brief FLASH Access time definitions
+ */
+typedef enum {
+ SYSCTL_FLASHTIM_25MHZ_CPU = 0, /*!< Flash accesses use 1 CPU clocks. Use for up to 25 MHz CPU clock*/
+ SYSCTL_FLASHTIM_55MHZ_CPU = 1, /*!< Flash accesses use 2 CPU clocks. Use for up to 55 MHz CPU clock*/
+ SYSCTL_FLASHTIM_72MHZ_CPU = 2, /*!< Flash accesses use 3 CPU clocks. Use for up to 72 MHz CPU clock*/
+} SYSCTL_FLASHTIM_T;
+
+/**
+ * @brief Set FLASH access time in clocks
+ * @param clks : Clock cycles for FLASH access (minus 1)
+ * @return Nothing
+ */
+STATIC INLINE void Chip_FMC_SetFLASHAccess(SYSCTL_FLASHTIM_T clks)
+{
+ uint32_t tmp = LPC_SYSCTL->FLASHCFG & (~(0x3 << 12));
+
+ /* Don't alter other bits */
+ LPC_SYSCTL->FLASHCFG = tmp | ((clks & 0x03) << 12);
+}
+
+/**
+ * @brief Setup USB clock control
+ * @param ap_clk : USB need_clock signal control (0 or 1)
+ * @param pol_clk : USB need_clock polarity for triggering the USB wake-up interrupt (0 or 1)
+ * @return Nothing
+ * @note See the USBCLKCTRL register in the user manual for these settings.
+ */
+STATIC INLINE void Chip_SYSCTL_SetUSBCLKCTRL(uint32_t ap_clk, uint32_t pol_clk)
+{
+ LPC_SYSCTL->USBCLKCTRL = ap_clk | (pol_clk << 1);
+}
+
+/**
+ * @brief Returns the status of the USB need_clock signal
+ * @return true if USB need_clock status is high, otherwise false
+ */
+STATIC INLINE bool Chip_SYSCTL_GetUSBCLKStatus(void)
+{
+ return (bool) ((LPC_SYSCTL->USBCLKST & 0x1) != 0);
+}
+
+/**
+ * Peripheral interrupt wakeup events on STARTERP0 only
+ */
+#define SYSCTL_ERP0_WAKEUP_WDTINT (1 << 0) /*!< WWDT interrupt wake-up */
+#define SYSCTL_ERP0_WAKEUP_BODINT (1 << 1) /*!< Brown out detector interrupt wake-up */
+#define SYSCTL_ERP0_WAKEUP_GINT0INT (1 << 5) /*!< Group interrupt 0 wake-up */
+#define SYSCTL_ERP0_WAKEUP_GINT1INT (1 << 6) /*!< Group interrupt 1 wake-up */
+#define SYSCTL_ERP0_WAKEUP_PINT0INT (1 << 7) /*!< GPIO pin interrupt 0 wake-up */
+#define SYSCTL_ERP0_WAKEUP_PINT1INT (1 << 8) /*!< GPIO pin interrupt 1 wake-up */
+#define SYSCTL_ERP0_WAKEUP_PINT2INT (1 << 9) /*!< GPIO pin interrupt 2 wake-up */
+#define SYSCTL_ERP0_WAKEUP_PINT3INT (1 << 10) /*!< GPIO pin interrupt 3 wake-up */
+#define SYSCTL_ERP0_WAKEUP_PINT4INT (1 << 11) /*!< GPIO pin interrupt 4 wake-up */
+#define SYSCTL_ERP0_WAKEUP_PINT5INT (1 << 12) /*!< GPIO pin interrupt 5 wake-up */
+#define SYSCTL_ERP0_WAKEUP_PINT6INT (1 << 13) /*!< GPIO pin interrupt 6 wake-up */
+#define SYSCTL_ERP0_WAKEUP_PINT7INT (1 << 14) /*!< GPIO pin interrupt 7 wake-up */
+#define SYSCTL_ERP0_WAKEUP_USART0INT (1 << 21) /*!< USART0 interrupt wake-up */
+#define SYSCTL_ERP0_WAKEUP_USART1INT (1 << 22) /*!< USART1 interrupt wake-up */
+#define SYSCTL_ERP0_WAKEUP_USART2INT (1 << 23) /*!< USART2 interrupt wake-up */
+#define SYSCTL_ERP0_WAKEUP_I2CINT (1 << 24) /*!< I2C interrupt wake-up */
+#define SYSCTL_ERP0_WAKEUP_SPI0INT (1 << 25) /*!< SPI0 interrupt wake-up */
+#define SYSCTL_ERP0_WAKEUP_SPI1INT (1 << 26) /*!< SPI1 interrupt wake-up */
+#define SYSCTL_ERP0_WAKEUP_USB_WAKEUP (1 << 30) /*!< USB need_clock signal wake-up */
+
+/**
+ * @brief Enables a peripheral's wakeup logic (STARTERP0 only)
+ * @param periphmask : OR'ed values of SYSCTL_ERP0_* for wakeup
+ * @return Nothing
+ * @note Use this function only with definitions of type SYSCTL_ERP0_*. Do
+ * not use or mix with SYSCTL_ERP1_* definitions.
+ */
+STATIC INLINE void Chip_SYSCTL_EnableERP0PeriphWakeup(uint32_t periphmask)
+{
+ LPC_SYSCTL->STARTERP[0] |= periphmask;
+}
+
+/**
+ * @brief Disables a peripheral's wakeup logic (STARTERP0 only)
+ * @param periphmask : OR'ed values of SYSCTL_ERP0_* for wakeup
+ * @return Nothing
+ * @note Use this function only with definitions of type SYSCTL_ERP0_*. Do
+ * not use or mix with SYSCTL_ERP1_* definitions.
+ */
+STATIC INLINE void Chip_SYSCTL_DisableERP0PeriphWakeup(uint32_t periphmask)
+{
+ LPC_SYSCTL->STARTERP[0] &= ~periphmask;
+}
+
+/**
+ * Peripheral interrupt wakeup events on STARTERP1 only
+ */
+#define SYSCTL_ERP1_WAKEUP_ACMP0INT (1 << 8) /*!< Analog comparator 0 interrupt wake-up */
+#define SYSCTL_ERP1_WAKEUP_ACMP1INT (1 << 9) /*!< Analog comparator 1 interrupt wake-up */
+#define SYSCTL_ERP1_WAKEUP_ACMP2INT (1 << 10) /*!< Analog comparator 2 interrupt wake-up */
+#define SYSCTL_ERP1_WAKEUP_ACMP3INT (1 << 11) /*!< Analog comparator 3 interrupt wake-up */
+#define SYSCTL_ERP1_WAKEUP_RTCALARMINT (1 << 13) /*!< RTC alarm interrupt wake-up */
+#define SYSCTL_ERP1_WAKEUP_RTCWAKEINT (1 << 14) /*!< RTC wake (1KHz wake) interrupt wake-up */
+
+/**
+ * @brief Enables a peripheral's wakeup logic (STARTERP0 only)
+ * @param periphmask : OR'ed values of SYSCTL_ERP1_* for wakeup
+ * @return Nothing
+ * @note Use this function only with definitions of type SYSCTL_ERP1_*. Do
+ * not use or mix with SYSCTL_ERP1_* definitions.
+ */
+STATIC INLINE void Chip_SYSCTL_EnableERP1PeriphWakeup(uint32_t periphmask)
+{
+ LPC_SYSCTL->STARTERP[1] |= periphmask;
+}
+
+/**
+ * @brief Disables a peripheral's wakeup logic (STARTERP1 only)
+ * @param periphmask : OR'ed values of SYSCTL_ERP1_* for wakeup
+ * @return Nothing
+ * @note Use this function only with definitions of type SYSCTL_ERP1_*. Do
+ * not use or mix with SYSCTL_ERP1_* definitions.
+ */
+STATIC INLINE void Chip_SYSCTL_DisableERP1PeriphWakeup(uint32_t periphmask)
+{
+ LPC_SYSCTL->STARTERP[1] &= ~periphmask;
+}
+
+/**
+ * Deep sleep to wakeup setup values
+ */
+#define SYSCTL_SLPWAKE_TBD0_PD (1 << 0) /*!< TBD0 wake-up configuration */
+#define SYSCTL_SLPWAKE_TBD1_PD (1 << 1) /*!< TBD1 wake-up configuration */
+#define SYSCTL_SLPWAKE_TBD2_PD (1 << 2) /*!< TBD2 wake-up configuration */
+#define SYSCTL_SLPWAKE_IRCOUT_PD (1 << 3) /*!< IRC oscillator output wake-up configuration */
+#define SYSCTL_SLPWAKE_IRC_PD (1 << 4) /*!< IRC oscillator power-down wake-up configuration */
+#define SYSCTL_SLPWAKE_FLASH_PD (1 << 5) /*!< Flash wake-up configuration */
+#define SYSCTL_SLPWAKE_EEPROM_PD (1 << 6) /*!< EEPROM wake-up configuration */
+#define SYSCTL_SLPWAKE_BOD_PD (1 << 8) /*!< BOD wake-up configuration */
+#define SYSCTL_SLPWAKE_USBPHY_PD (1 << 9) /*!< USB PHY wake-up configuration */
+#define SYSCTL_SLPWAKE_ADC0_PD (1 << 10) /*!< ADC0 wake-up configuration */
+#define SYSCTL_SLPWAKE_ADC1_PD (1 << 11) /*!< ADC1 wake-up configuration */
+#define SYSCTL_SLPWAKE_DAC_PD (1 << 12) /*!< DAC wake-up configuration */
+#define SYSCTL_SLPWAKE_ACMP0_PD (1 << 13) /*!< ACMP0 wake-up configuration */
+#define SYSCTL_SLPWAKE_ACMP1_PD (1 << 14) /*!< ACMP0 wake-up configuration */
+#define SYSCTL_SLPWAKE_ACMP2_PD (1 << 15) /*!< ACMP0 wake-up configuration */
+#define SYSCTL_SLPWAKE_ACMP3_PD (1 << 16) /*!< ACMP0 wake-up configuration */
+#define SYSCTL_SLPWAKE_IREF_PD (1 << 17) /*!< Internal voltage reference wake-up configuration */
+#define SYSCTL_SLPWAKE_TS_PD (1 << 18) /*!< Temperature sensor wake-up configuration */
+#define SYSCTL_SLPWAKE_VDDADIV_PD (1 << 19) /*!< VDDA divider wake-up configuration */
+#define SYSCTL_SLPWAKE_WDTOSC_PD (1 << 20) /*!< Watchdog oscillator wake-up configuration */
+#define SYSCTL_SLPWAKE_SYSOSC_PD (1 << 21) /*!< System oscillator wake-up configuration */
+#define SYSCTL_SLPWAKE_SYSPLL_PD (1 << 22) /*!< System PLL wake-up configuration */
+#define SYSCTL_SLPWAKE_USBPLL_PD (1 << 23) /*!< USB PLL wake-up configuration */
+#define SYSCTL_SLPWAKE_SCTPLL_PD (1 << 24) /*!< SCT PLL wake-up configuration */
+
+/**
+ * @brief Setup wakeup behaviour from deep sleep
+ * @param wakeupmask : OR'ed values of SYSCTL_SLPWAKE_* values (high is powered down)
+ * @return Nothing
+ * @note This must be setup prior to using deep sleep. See the user manual
+ * (PDWAKECFG register) for more info on setting this up. This function selects
+ * which peripherals are powered up on exit from deep sleep.
+ * This function should only be called once with all options for wakeup
+ * in that call.
+ */
+void Chip_SYSCTL_SetWakeup(uint32_t wakeupmask);
+
+/**
+ * @brief Return current wakeup mask
+ * @return OR'ed values of SYSCTL_SLPWAKE_* values
+ * @note A high state indicates the peripehral will powerup on wakeup.
+ */
+STATIC INLINE uint32_t Chip_SYSCTL_GetWakeup(void)
+{
+ return LPC_SYSCTL->PDWAKECFG;
+}
+
+/**
+ * Power down configuration values
+ */
+#define SYSCTL_POWERDOWN_TBD0_PD (1 << 0) /*!< TBD0 wake-up power down */
+#define SYSCTL_POWERDOWN_TBD1_PD (1 << 1) /*!< TBD1 wake-up power down */
+#define SYSCTL_POWERDOWN_TBD2_PD (1 << 2) /*!< TBD2 wake-up power down */
+#define SYSCTL_POWERDOWN_IRCOUT_PD (1 << 3) /*!< IRC oscillator output wake-up power down */
+#define SYSCTL_POWERDOWN_IRC_PD (1 << 4) /*!< IRC oscillator power-down wake-up power down */
+#define SYSCTL_POWERDOWN_FLASH_PD (1 << 5) /*!< Flash wake-up power down */
+#define SYSCTL_POWERDOWN_EEPROM_PD (1 << 6) /*!< EEPROM wake-up power down */
+#define SYSCTL_POWERDOWN_BOD_PD (1 << 8) /*!< BOD wake-up power down */
+#define SYSCTL_POWERDOWN_USBPHY_PD (1 << 9) /*!< USB PHY wake-up power down */
+#define SYSCTL_POWERDOWN_ADC0_PD (1 << 10) /*!< ADC0 wake-up power down */
+#define SYSCTL_POWERDOWN_ADC1_PD (1 << 11) /*!< ADC1 wake-up power down */
+#define SYSCTL_POWERDOWN_DAC_PD (1 << 12) /*!< DAC wake-up power down */
+#define SYSCTL_POWERDOWN_ACMP0_PD (1 << 13) /*!< ACMP0 wake-up power down */
+#define SYSCTL_POWERDOWN_ACMP1_PD (1 << 14) /*!< ACMP0 wake-up power down */
+#define SYSCTL_POWERDOWN_ACMP2_PD (1 << 15) /*!< ACMP0 wake-up power down */
+#define SYSCTL_POWERDOWN_ACMP3_PD (1 << 16) /*!< ACMP0 wake-up power down */
+#define SYSCTL_POWERDOWN_IREF_PD (1 << 17) /*!< Internal voltage reference wake-up power down */
+#define SYSCTL_POWERDOWN_TS_PD (1 << 18) /*!< Temperature sensor wake-up power down */
+#define SYSCTL_POWERDOWN_VDDADIV_PD (1 << 19) /*!< VDDA divider wake-up power down */
+#define SYSCTL_POWERDOWN_WDTOSC_PD (1 << 20) /*!< Watchdog oscillator wake-up power down */
+#define SYSCTL_POWERDOWN_SYSOSC_PD (1 << 21) /*!< System oscillator wake-up power down */
+#define SYSCTL_POWERDOWN_SYSPLL_PD (1 << 22) /*!< System PLL wake-up power down */
+#define SYSCTL_POWERDOWN_USBPLL_PD (1 << 23) /*!< USB PLL wake-up power down */
+#define SYSCTL_POWERDOWN_SCTPLL_PD (1 << 24) /*!< SCT PLL wake-up power down */
+
+/**
+ * @brief Power down one or more blocks or peripherals
+ * @param powerdownmask : OR'ed values of SYSCTL_POWERDOWN_* values
+ * @return Nothing
+ */
+void Chip_SYSCTL_PowerDown(uint32_t powerdownmask);
+
+/**
+ * @brief Power up one or more blocks or peripherals
+ * @param powerupmask : OR'ed values of SYSCTL_POWERDOWN_* values
+ * @return Nothing
+ */
+void Chip_SYSCTL_PowerUp(uint32_t powerupmask);
+
+/**
+ * @brief Get power status
+ * @return OR'ed values of SYSCTL_POWERDOWN_* values
+ * @note A high state indicates the peripheral is powered down.
+ */
+STATIC INLINE uint32_t Chip_SYSCTL_GetPowerStates(void)
+{
+ return LPC_SYSCTL->PDRUNCFG;
+}
+
+/**
+ * @brief Return the JTAG ID code
+ * @return the JTAG ID code
+ */
+STATIC INLINE uint32_t Chip_SYSCTL_GetJTAGIDCode(void)
+{
+ return LPC_SYSCTL->JTAG_IDCODE;
+}
+
+/**
+ * @brief Return the device ID
+ * @param index : Index of device ID to get, 0 or 1
+ * @return the device ID
+ */
+STATIC INLINE uint32_t Chip_SYSCTL_GetDeviceID(int index)
+{
+ return LPC_SYSCTL->DEVICEID[index];
+}
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*!< __SYSCTL_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/uart_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/uart_15xx.h
new file mode 100644
index 0000000..8b0bb72
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/uart_15xx.h
@@ -0,0 +1,436 @@
+/*
+ * @brief LPC15XX USART0/1/2 driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __UART_15XX_H_
+#define __UART_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "ring_buffer.h"
+
+/** @defgroup UART_15XX CHIP: LPC15xx USART Driver (UARTS 0/1/2)
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief UART register block structure
+ */
+typedef struct {
+ __IO uint32_t CFG; /*!< Configuration register */
+ __IO uint32_t CTRL; /*!< Control register */
+ __IO uint32_t STAT; /*!< Status register */
+ __IO uint32_t INTENSET; /*!< Interrupt Enable read and set register */
+ __O uint32_t INTENCLR; /*!< Interrupt Enable clear register */
+ __I uint32_t RXDATA; /*!< Receive Data register */
+ __I uint32_t RXDATA_STAT; /*!< Receive Data with status register */
+ __IO uint32_t TXDATA; /*!< Transmit data register */
+ __IO uint32_t BRG; /*!< Baud Rate Generator register */
+ __IO uint32_t INTSTAT; /*!< Interrupt status register */
+} LPC_USART_T;
+
+/**
+ * @brief UART CFG register definitions
+ */
+#define UART_CFG_ENABLE (0x01 << 0)
+#define UART_CFG_DATALEN_7 (0x00 << 2) /*!< UART 7 bit length mode */
+#define UART_CFG_DATALEN_8 (0x01 << 2) /*!< UART 8 bit length mode */
+#define UART_CFG_DATALEN_9 (0x02 << 2) /*!< UART 9 bit length mode */
+#define UART_CFG_PARITY_NONE (0x00 << 4) /*!< No parity */
+#define UART_CFG_PARITY_EVEN (0x02 << 4) /*!< Even parity */
+#define UART_CFG_PARITY_ODD (0x03 << 4) /*!< Odd parity */
+#define UART_CFG_STOPLEN_1 (0x00 << 6) /*!< UART One Stop Bit Select */
+#define UART_CFG_STOPLEN_2 (0x01 << 6) /*!< UART Two Stop Bits Select */
+#define UART_MODE_32K (0x01 << 7) /*!< Selects the 32 kHz clock from the RTC oscillator as the clock source to the BRG */
+#define UART_CFG_CTSEN (0x01 << 9) /*!< CTS enable bit */
+#define UART_CFG_SYNCEN (0x01 << 11) /*!< Synchronous mode enable bit */
+#define UART_CFG_CLKPOL (0x01 << 12) /*!< Un_RXD rising edge sample enable bit */
+#define UART_CFG_SYNCMST (0x01 << 14) /*!< Select master mode (synchronous mode) enable bit */
+#define UART_CFG_LOOP (0x01 << 15) /*!< Loopback mode enable bit */
+
+/**
+ * @brief UART CTRL register definitions
+ */
+#define UART_CTRL_TXBRKEN (0x01 << 1) /*!< Continuous break enable bit */
+#define UART_CTRL_ADDRDET (0x01 << 2) /*!< Address detect mode enable bit */
+#define UART_CTRL_TXDIS (0x01 << 6) /*!< Transmit disable bit */
+#define UART_CTRL_CC (0x01 << 8) /*!< Continuous Clock mode enable bit */
+#define UART_CTRL_CLRCC (0x01 << 9) /*!< Clear Continuous Clock bit */
+
+/**
+ * @brief UART STAT register definitions
+ */
+#define UART_STAT_RXRDY (0x01 << 0) /*!< Receiver ready */
+#define UART_STAT_RXIDLE (0x01 << 1) /*!< Receiver idle */
+#define UART_STAT_TXRDY (0x01 << 2) /*!< Transmitter ready for data */
+#define UART_STAT_TXIDLE (0x01 << 3) /*!< Transmitter idle */
+#define UART_STAT_CTS (0x01 << 4) /*!< Status of CTS signal */
+#define UART_STAT_DELTACTS (0x01 << 5) /*!< Change in CTS state */
+#define UART_STAT_TXDISINT (0x01 << 6) /*!< Transmitter disabled */
+#define UART_STAT_OVERRUNINT (0x01 << 8) /*!< Overrun Error interrupt flag. */
+#define UART_STAT_RXBRK (0x01 << 10) /*!< Received break */
+#define UART_STAT_DELTARXBRK (0x01 << 11) /*!< Change in receive break detection */
+#define UART_STAT_START (0x01 << 12) /*!< Start detected */
+#define UART_STAT_FRM_ERRINT (0x01 << 13) /*!< Framing Error interrupt flag */
+#define UART_STAT_PAR_ERRINT (0x01 << 14) /*!< Parity Error interrupt flag */
+#define UART_STAT_RXNOISEINT (0x01 << 15) /*!< Received Noise interrupt flag */
+
+/**
+ * @brief UART INTENSET/INTENCLR register definitions
+ */
+#define UART_INTEN_RXRDY (0x01 << 0) /*!< Receive Ready interrupt */
+#define UART_INTEN_TXRDY (0x01 << 2) /*!< Transmit Ready interrupt */
+#define UART_INTEN_DELTACTS (0x01 << 5) /*!< Change in CTS state interrupt */
+#define UART_INTEN_TXDIS (0x01 << 6) /*!< Transmitter disable interrupt */
+#define UART_INTEN_OVERRUN (0x01 << 8) /*!< Overrun error interrupt */
+#define UART_INTEN_DELTARXBRK (0x01 << 11) /*!< Change in receiver break detection interrupt */
+#define UART_INTEN_START (0x01 << 12) /*!< Start detect interrupt */
+#define UART_INTEN_FRAMERR (0x01 << 13) /*!< Frame error interrupt */
+#define UART_INTEN_PARITYERR (0x01 << 14) /*!< Parity error interrupt */
+#define UART_INTEN_RXNOISE (0x01 << 15) /*!< Received noise interrupt */
+
+/**
+ * @brief Enable the UART
+ * @param pUART : Pointer to selected UARTx peripheral
+ * @return Nothing
+ */
+STATIC INLINE void Chip_UART_Enable(LPC_USART_T *pUART)
+{
+ pUART->CFG |= UART_CFG_ENABLE;
+}
+
+/**
+ * @brief Disable the UART
+ * @param pUART : Pointer to selected UARTx peripheral
+ * @return Nothing
+ */
+STATIC INLINE void Chip_UART_Disable(LPC_USART_T *pUART)
+{
+ pUART->CFG &= ~UART_CFG_ENABLE;
+}
+
+/**
+ * @brief Enable transmission on UART TxD pin
+ * @param pUART : Pointer to selected pUART peripheral
+ * @return Nothing
+ */
+STATIC INLINE void Chip_UART_TXEnable(LPC_USART_T *pUART)
+{
+ pUART->CTRL &= ~UART_CTRL_TXDIS;
+}
+
+/**
+ * @brief Disable transmission on UART TxD pin
+ * @param pUART : Pointer to selected pUART peripheral
+ * @return Nothing
+ */
+STATIC INLINE void Chip_UART_TXDisable(LPC_USART_T *pUART)
+{
+ pUART->CTRL |= UART_CTRL_TXDIS;
+}
+
+/**
+ * @brief Transmit a single data byte through the UART peripheral
+ * @param pUART : Pointer to selected UART peripheral
+ * @param data : Byte to transmit
+ * @return Nothing
+ * @note This function attempts to place a byte into the UART transmit
+ * holding register regard regardless of UART state.
+ */
+STATIC INLINE void Chip_UART_SendByte(LPC_USART_T *pUART, uint8_t data)
+{
+ pUART->TXDATA = (uint32_t) data;
+}
+
+/**
+ * @brief Read a single byte data from the UART peripheral
+ * @param pUART : Pointer to selected UART peripheral
+ * @return A single byte of data read
+ * @note This function reads a byte from the UART receive FIFO or
+ * receive hold register regard regardless of UART state. The
+ * FIFO status should be read first prior to using this function
+ */
+STATIC INLINE uint32_t Chip_UART_ReadByte(LPC_USART_T *pUART)
+{
+ /* Strip off undefined reserved bits, keep 9 lower bits */
+ return (uint32_t) (pUART->RXDATA & 0x000001FF);
+}
+
+/**
+ * @brief Enable UART interrupts
+ * @param pUART : Pointer to selected UART peripheral
+ * @param intMask : OR'ed Interrupts to enable
+ * @return Nothing
+ * @note Use an OR'ed value of UART_INTEN_* definitions with this function
+ * to enable specific UART interrupts.
+ */
+STATIC INLINE void Chip_UART_IntEnable(LPC_USART_T *pUART, uint32_t intMask)
+{
+ pUART->INTENSET = intMask;
+}
+
+/**
+ * @brief Disable UART interrupts
+ * @param pUART : Pointer to selected UART peripheral
+ * @param intMask : OR'ed Interrupts to disable
+ * @return Nothing
+ * @note Use an OR'ed value of UART_INTEN_* definitions with this function
+ * to disable specific UART interrupts.
+ */
+STATIC INLINE void Chip_UART_IntDisable(LPC_USART_T *pUART, uint32_t intMask)
+{
+ pUART->INTENCLR = intMask;
+}
+
+/**
+ * @brief Returns UART interrupts that are enabled
+ * @param pUART : Pointer to selected UART peripheral
+ * @return Returns the enabled UART interrupts
+ * @note Use an OR'ed value of UART_INTEN_* definitions with this function
+ * to determine which interrupts are enabled. You can check
+ * for multiple enabled bits if needed.
+ */
+STATIC INLINE uint32_t Chip_UART_GetIntsEnabled(LPC_USART_T *pUART)
+{
+ return pUART->INTENSET;
+}
+
+/**
+ * @brief Get UART interrupt status
+ * @param pUART : The base of UART peripheral on the chip
+ * @return The Interrupt status register of UART
+ * @note Multiple interrupts may be pending. Mask the return value
+ * with one or more UART_INTEN_* definitions to determine
+ * pending interrupts.
+ */
+STATIC INLINE uint32_t Chip_UART_GetIntStatus(LPC_USART_T *pUART)
+{
+ return pUART->INTSTAT;
+}
+
+/**
+ * @brief Configure data width, parity and stop bits
+ * @param pUART : Pointer to selected pUART peripheral
+ * @param config : UART configuration, OR'ed values of select UART_CFG_* defines
+ * @return Nothing
+ * @note Select OR'ed config options for the UART from the UART_CFG_PARITY_*,
+ * UART_CFG_STOPLEN_*, and UART_CFG_DATALEN_* definitions. For example,
+ * a configuration of 8 data bits, 1 stop bit, and even (enabled) parity would be
+ * (UART_CFG_DATALEN_8 | UART_CFG_STOPLEN_1 | UART_CFG_PARITY_EVEN). Will not
+ * alter other bits in the CFG register.
+ */
+STATIC INLINE void Chip_UART_ConfigData(LPC_USART_T *pUART, uint32_t config)
+{
+ uint32_t reg;
+
+ reg = pUART->CFG & ~((0x3 << 2) | (0x3 << 4) | (0x1 << 6));
+ pUART->CFG = reg | config;
+}
+
+/**
+ * @brief Get the UART status register
+ * @param pUART : Pointer to selected UARTx peripheral
+ * @return UART status register
+ * @note Multiple statuses may be pending. Mask the return value
+ * with one or more UART_STAT_* definitions to determine
+ * statuses.
+ */
+STATIC INLINE uint32_t Chip_UART_GetStatus(LPC_USART_T *pUART)
+{
+ return pUART->STAT;
+}
+
+/**
+ * @brief Clear the UART status register
+ * @param pUART : Pointer to selected UARTx peripheral
+ * @param stsMask : OR'ed statuses to disable
+ * @return Nothing
+ * @note Multiple interrupts may be pending. Mask the return value
+ * with one or more UART_INTEN_* definitions to determine
+ * pending interrupts.
+ */
+STATIC INLINE void Chip_UART_ClearStatus(LPC_USART_T *pUART, uint32_t stsMask)
+{
+ pUART->STAT = stsMask;
+}
+
+/**
+ * @brief Initialize the UART peripheral
+ * @param pUART : The base of UART peripheral on the chip
+ * @return Nothing
+ */
+void Chip_UART_Init(LPC_USART_T *pUART);
+
+/**
+ * @brief Deinitialize the UART peripheral
+ * @param pUART : The base of UART peripheral on the chip
+ * @return Nothing
+ */
+void Chip_UART_DeInit(LPC_USART_T *pUART);
+
+/**
+ * @brief Transmit a byte array through the UART peripheral (non-blocking)
+ * @param pUART : Pointer to selected UART peripheral
+ * @param data : Pointer to bytes to transmit
+ * @param numBytes : Number of bytes to transmit
+ * @return The actual number of bytes placed into the FIFO
+ * @note This function places data into the transmit FIFO until either
+ * all the data is in the FIFO or the FIFO is full. This function
+ * will not block in the FIFO is full. The actual number of bytes
+ * placed into the FIFO is returned. This function ignores errors.
+ */
+int Chip_UART_Send(LPC_USART_T *pUART, const void *data, int numBytes);
+
+/**
+ * @brief Read data through the UART peripheral (non-blocking)
+ * @param pUART : Pointer to selected UART peripheral
+ * @param data : Pointer to bytes array to fill
+ * @param numBytes : Size of the passed data array
+ * @return The actual number of bytes read
+ * @note This function reads data from the receive FIFO until either
+ * all the data has been read or the passed buffer is completely full.
+ * This function will not block. This function ignores errors.
+ */
+int Chip_UART_Read(LPC_USART_T *pUART, void *data, int numBytes);
+
+/**
+ * @brief Set baud rate for UART
+ * @param pUART : The base of UART peripheral on the chip
+ * @param baudrate: Baud rate to be set
+ * @return Nothing
+ */
+void Chip_UART_SetBaud(LPC_USART_T *pUART, uint32_t baudrate);
+
+/**
+ * @brief Set baud rate for UART using RTC32K oscillator
+ * @param pUART : The base of UART peripheral on the chip
+ * @param baudrate: Baud rate to be set
+ * @return Nothing
+ * @note Since the baud rate is divided from the 32KHz oscillator,
+ * this function should only be used with baud rates less
+ * than or equal to 9600 baud. Don't expect any accuracy.
+ */
+void Chip_UART_SetBaudWithRTC32K(LPC_USART_T *pUART, uint32_t baudrate);
+
+/**
+ * @brief Transmit a byte array through the UART peripheral (blocking)
+ * @param pUART : Pointer to selected UART peripheral
+ * @param data : Pointer to data to transmit
+ * @param numBytes : Number of bytes to transmit
+ * @return The number of bytes transmitted
+ * @note This function will send or place all bytes into the transmit
+ * FIFO. This function will block until the last bytes are in the FIFO.
+ */
+int Chip_UART_SendBlocking(LPC_USART_T *pUART, const void *data, int numBytes);
+
+/**
+ * @brief Read data through the UART peripheral (blocking)
+ * @param pUART : Pointer to selected UART peripheral
+ * @param data : Pointer to data array to fill
+ * @param numBytes : Size of the passed data array
+ * @return The size of the dat array
+ * @note This function reads data from the receive FIFO until the passed
+ * buffer is completely full. The function will block until full.
+ * This function ignores errors.
+ */
+int Chip_UART_ReadBlocking(LPC_USART_T *pUART, void *data, int numBytes);
+
+/**
+ * @brief UART receive-only interrupt handler for ring buffers
+ * @param pUART : Pointer to selected UART peripheral
+ * @param pRB : Pointer to ring buffer structure to use
+ * @return Nothing
+ * @note If ring buffer support is desired for the receive side
+ * of data transfer, the UART interrupt should call this
+ * function for a receive based interrupt status.
+ */
+void Chip_UART_RXIntHandlerRB(LPC_USART_T *pUART, RINGBUFF_T *pRB);
+
+/**
+ * @brief UART transmit-only interrupt handler for ring buffers
+ * @param pUART : Pointer to selected UART peripheral
+ * @param pRB : Pointer to ring buffer structure to use
+ * @return Nothing
+ * @note If ring buffer support is desired for the transmit side
+ * of data transfer, the UART interrupt should call this
+ * function for a transmit based interrupt status.
+ */
+void Chip_UART_TXIntHandlerRB(LPC_USART_T *pUART, RINGBUFF_T *pRB);
+
+/**
+ * @brief Populate a transmit ring buffer and start UART transmit
+ * @param pUART : Pointer to selected UART peripheral
+ * @param pRB : Pointer to ring buffer structure to use
+ * @param data : Pointer to buffer to move to ring buffer
+ * @param count : Number of bytes to move
+ * @return The number of bytes placed into the ring buffer
+ * @note Will move the data into the TX ring buffer and start the
+ * transfer. If the number of bytes returned is less than the
+ * number of bytes to send, the ring buffer is considered full.
+ */
+uint32_t Chip_UART_SendRB(LPC_USART_T *pUART, RINGBUFF_T *pRB, const void *data, int count);
+
+/**
+ * @brief Copy data from a receive ring buffer
+ * @param pUART : Pointer to selected UART peripheral
+ * @param pRB : Pointer to ring buffer structure to use
+ * @param data : Pointer to buffer to fill from ring buffer
+ * @param bytes : Size of the passed buffer in bytes
+ * @return The number of bytes placed into the ring buffer
+ * @note Will move the data from the RX ring buffer up to the
+ * the maximum passed buffer size. Returns 0 if there is
+ * no data in the ring buffer.
+ */
+int Chip_UART_ReadRB(LPC_USART_T *pUART, RINGBUFF_T *pRB, void *data, int bytes);
+
+/**
+ * @brief UART receive/transmit interrupt handler for ring buffers
+ * @param pUART : Pointer to selected UART peripheral
+ * @param pRXRB : Pointer to transmit ring buffer
+ * @param pTXRB : Pointer to receive ring buffer
+ * @return Nothing
+ * @note This provides a basic implementation of the UART IRQ
+ * handler for support of a ring buffer implementation for
+ * transmit and receive.
+ */
+void Chip_UART_IRQRBHandler(LPC_USART_T *pUART, RINGBUFF_T *pRXRB, RINGBUFF_T *pTXRB);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UART_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd.h
new file mode 100644
index 0000000..20faabd
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd.h
@@ -0,0 +1,704 @@
+/***********************************************************************
+* $Id:: mw_usbd.h 575 2012-11-20 01:35:56Z usb10131 $
+*
+* Project: USB device ROM Stack
+*
+* Description:
+* USB Definitions.
+*
+***********************************************************************
+* Copyright(C) 2011, NXP Semiconductor
+* All rights reserved.
+*
+* Software that is described herein is for illustrative purposes only
+* which provides customers with programming information regarding the
+* products. This software is supplied "AS IS" without any warranties.
+* NXP Semiconductors assumes no responsibility or liability for the
+* use of the software, conveys no license or title under any patent,
+* copyright, or mask work right to the product. NXP Semiconductors
+* reserves the right to make changes in the software without
+* notification. NXP Semiconductors also make no representation or
+* warranty that such application will be suitable for the specified
+* use without further testing or modification.
+**********************************************************************/
+
+#ifndef __USBD_H__
+#define __USBD_H__
+
+/** \file
+ * \brief Common definitions and declarations for the USB stack.
+ *
+ * Common definitions and declarations for the USB stack.
+ * \addtogroup USBD_Core
+ * @{
+ */
+
+#include "lpc_types.h"
+
+#if defined(__GNUC__)
+/* As per http://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html#Attribute-Syntax,
+6.29 Attributes Syntax
+"An attribute specifier list may appear as part of a struct, union or
+enum specifier. It may go either immediately after the struct, union
+or enum keyword, or after the closing brace. The former syntax is
+preferred. Where attribute specifiers follow the closing brace, they
+are considered to relate to the structure, union or enumerated type
+defined, not to any enclosing declaration the type specifier appears
+in, and the type defined is not complete until after the attribute
+specifiers."
+So use POST_PACK immediately after struct keyword
+*/
+#define PRE_PACK
+#define POST_PACK __attribute__((__packed__))
+#define ALIGNED(n) __attribute__((aligned (n)))
+
+#elif defined(__arm)
+#define PRE_PACK __packed
+#define POST_PACK
+#define ALIGNED(n) __align(n)
+
+#elif defined(__ICCARM__)
+#define PRE_PACK __packed
+#define POST_PACK
+#define PRAGMA_ALIGN_4096 _Pragma("data_alignment=4096")
+#define PRAGMA_ALIGN_2048 _Pragma("data_alignment=2048")
+#define PRAGMA_ALIGN_256 _Pragma("data_alignment=256")
+#define PRAGMA_ALIGN_128 _Pragma("data_alignment=128")
+#define PRAGMA_ALIGN_64 _Pragma("data_alignment=64")
+#define PRAGMA_ALIGN_48 _Pragma("data_alignment=48")
+#define PRAGMA_ALIGN_32 _Pragma("data_alignment=32")
+#define PRAGMA_ALIGN_4 _Pragma("data_alignment=4")
+#define ALIGNED(n) PRAGMA_ALIGN_##n
+
+#pragma diag_suppress=Pe021
+#endif
+
+/** Structure to pack lower and upper byte to form 16 bit word. */
+PRE_PACK struct POST_PACK _WB_T
+{
+ uint8_t L; /**< lower byte */
+ uint8_t H; /**< upper byte */
+};
+/** Structure to pack lower and upper byte to form 16 bit word.*/
+typedef struct _WB_T WB_T;
+
+/** Union of \ref _WB_T struct and 16 bit word.*/
+PRE_PACK union POST_PACK __WORD_BYTE
+{
+ uint16_t W; /**< data member to do 16 bit access */
+ WB_T WB; /**< data member to do 8 bit access */
+} ;
+/** Union of \ref _WB_T struct and 16 bit word.*/
+typedef union __WORD_BYTE WORD_BYTE;
+
+/** bmRequestType.Dir defines
+ * @{
+ */
+/** Request from host to device */
+#define REQUEST_HOST_TO_DEVICE 0
+/** Request from device to host */
+#define REQUEST_DEVICE_TO_HOST 1
+/** @} */
+
+/** bmRequestType.Type defines
+ * @{
+ */
+/** Standard Request */
+#define REQUEST_STANDARD 0
+/** Class Request */
+#define REQUEST_CLASS 1
+/** Vendor Request */
+#define REQUEST_VENDOR 2
+/** Reserved Request */
+#define REQUEST_RESERVED 3
+/** @} */
+
+/** bmRequestType.Recipient defines
+ * @{
+ */
+/** Request to device */
+#define REQUEST_TO_DEVICE 0
+/** Request to interface */
+#define REQUEST_TO_INTERFACE 1
+/** Request to endpoint */
+#define REQUEST_TO_ENDPOINT 2
+/** Request to other */
+#define REQUEST_TO_OTHER 3
+/** @} */
+
+/** Structure to define 8 bit USB request.*/
+PRE_PACK struct POST_PACK _BM_T
+{
+ uint8_t Recipient : 5; /**< Recipient type. */
+ uint8_t Type : 2; /**< Request type. */
+ uint8_t Dir : 1; /**< Direction type. */
+};
+/** Structure to define 8 bit USB request.*/
+typedef struct _BM_T BM_T;
+
+/** Union of \ref _BM_T struct and 8 bit byte.*/
+PRE_PACK union POST_PACK _REQUEST_TYPE
+{
+ uint8_t B; /**< byte wide access memeber */
+ BM_T BM; /**< bitfield structure access memeber */
+} ;
+/** Union of \ref _BM_T struct and 8 bit byte.*/
+typedef union _REQUEST_TYPE REQUEST_TYPE;
+
+/** USB Standard Request Codes
+ * @{
+ */
+/** GET_STATUS request */
+#define USB_REQUEST_GET_STATUS 0
+/** CLEAR_FEATURE request */
+#define USB_REQUEST_CLEAR_FEATURE 1
+/** SET_FEATURE request */
+#define USB_REQUEST_SET_FEATURE 3
+/** SET_ADDRESS request */
+#define USB_REQUEST_SET_ADDRESS 5
+/** GET_DESCRIPTOR request */
+#define USB_REQUEST_GET_DESCRIPTOR 6
+/** SET_DESCRIPTOR request */
+#define USB_REQUEST_SET_DESCRIPTOR 7
+/** GET_CONFIGURATION request */
+#define USB_REQUEST_GET_CONFIGURATION 8
+/** SET_CONFIGURATION request */
+#define USB_REQUEST_SET_CONFIGURATION 9
+/** GET_INTERFACE request */
+#define USB_REQUEST_GET_INTERFACE 10
+/** SET_INTERFACE request */
+#define USB_REQUEST_SET_INTERFACE 11
+/** SYNC_FRAME request */
+#define USB_REQUEST_SYNC_FRAME 12
+/** @} */
+
+/** USB GET_STATUS Bit Values
+ * @{
+ */
+/** SELF_POWERED status*/
+#define USB_GETSTATUS_SELF_POWERED 0x01
+/** REMOTE_WAKEUP capable status*/
+#define USB_GETSTATUS_REMOTE_WAKEUP 0x02
+/** ENDPOINT_STALL status*/
+#define USB_GETSTATUS_ENDPOINT_STALL 0x01
+/** @} */
+
+/** USB Standard Feature selectors
+ * @{
+ */
+/** ENDPOINT_STALL feature*/
+#define USB_FEATURE_ENDPOINT_STALL 0
+/** REMOTE_WAKEUP feature*/
+#define USB_FEATURE_REMOTE_WAKEUP 1
+/** TEST_MODE feature*/
+#define USB_FEATURE_TEST_MODE 2
+/** @} */
+
+/** USB Default Control Pipe Setup Packet*/
+PRE_PACK struct POST_PACK _USB_SETUP_PACKET
+{
+ REQUEST_TYPE bmRequestType; /**< This bitmapped field identifies the characteristics
+ of the specific request. \sa _BM_T.
+ */
+ uint8_t bRequest; /**< This field specifies the particular request. The
+ Type bits in the bmRequestType field modify the meaning
+ of this field. \sa USBD_REQUEST.
+ */
+ WORD_BYTE wValue; /**< Used to pass a parameter to the device, specific
+ to the request.
+ */
+ WORD_BYTE wIndex; /**< Used to pass a parameter to the device, specific
+ to the request. The wIndex field is often used in
+ requests to specify an endpoint or an interface.
+ */
+ uint16_t wLength; /**< This field specifies the length of the data
+ transferred during the second phase of the control
+ transfer.
+ */
+} ;
+/** USB Default Control Pipe Setup Packet*/
+typedef struct _USB_SETUP_PACKET USB_SETUP_PACKET;
+
+
+/** USB Descriptor Types
+ * @{
+ */
+/** Device descriptor type */
+#define USB_DEVICE_DESCRIPTOR_TYPE 1
+/** Configuration descriptor type */
+#define USB_CONFIGURATION_DESCRIPTOR_TYPE 2
+/** String descriptor type */
+#define USB_STRING_DESCRIPTOR_TYPE 3
+/** Interface descriptor type */
+#define USB_INTERFACE_DESCRIPTOR_TYPE 4
+/** Endpoint descriptor type */
+#define USB_ENDPOINT_DESCRIPTOR_TYPE 5
+/** Device qualifier descriptor type */
+#define USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE 6
+/** Other speed configuration descriptor type */
+#define USB_OTHER_SPEED_CONFIG_DESCRIPTOR_TYPE 7
+/** Interface power descriptor type */
+#define USB_INTERFACE_POWER_DESCRIPTOR_TYPE 8
+/** OTG descriptor type */
+#define USB_OTG_DESCRIPTOR_TYPE 9
+/** Debug descriptor type */
+#define USB_DEBUG_DESCRIPTOR_TYPE 10
+/** Interface association descriptor type */
+#define USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE 11
+/** @} */
+
+/** USB Device Classes
+ * @{
+ */
+/** Reserved device class */
+#define USB_DEVICE_CLASS_RESERVED 0x00
+/** Audio device class */
+#define USB_DEVICE_CLASS_AUDIO 0x01
+/** Communications device class */
+#define USB_DEVICE_CLASS_COMMUNICATIONS 0x02
+/** Human interface device class */
+#define USB_DEVICE_CLASS_HUMAN_INTERFACE 0x03
+/** monitor device class */
+#define USB_DEVICE_CLASS_MONITOR 0x04
+/** physical interface device class */
+#define USB_DEVICE_CLASS_PHYSICAL_INTERFACE 0x05
+/** power device class */
+#define USB_DEVICE_CLASS_POWER 0x06
+/** Printer device class */
+#define USB_DEVICE_CLASS_PRINTER 0x07
+/** Storage device class */
+#define USB_DEVICE_CLASS_STORAGE 0x08
+/** Hub device class */
+#define USB_DEVICE_CLASS_HUB 0x09
+/** miscellaneous device class */
+#define USB_DEVICE_CLASS_MISCELLANEOUS 0xEF
+/** Application device class */
+#define USB_DEVICE_CLASS_APP 0xFE
+/** Vendor specific device class */
+#define USB_DEVICE_CLASS_VENDOR_SPECIFIC 0xFF
+/** @} */
+
+/** bmAttributes in Configuration Descriptor
+ * @{
+ */
+/** Power field mask */
+#define USB_CONFIG_POWERED_MASK 0x40
+/** Bus powered */
+#define USB_CONFIG_BUS_POWERED 0x80
+/** Self powered */
+#define USB_CONFIG_SELF_POWERED 0xC0
+/** remote wakeup */
+#define USB_CONFIG_REMOTE_WAKEUP 0x20
+/** @} */
+
+/** bMaxPower in Configuration Descriptor */
+#define USB_CONFIG_POWER_MA(mA) ((mA)/2)
+
+/** bEndpointAddress in Endpoint Descriptor
+ * @{
+ */
+/** Endopint address mask */
+#define USB_ENDPOINT_DIRECTION_MASK 0x80
+/** Macro to convert OUT endopint number to endpoint address value. */
+#define USB_ENDPOINT_OUT(addr) ((addr) | 0x00)
+/** Macro to convert IN endopint number to endpoint address value. */
+#define USB_ENDPOINT_IN(addr) ((addr) | 0x80)
+/** @} */
+
+/** bmAttributes in Endpoint Descriptor
+ * @{
+ */
+/** Endopint type mask */
+#define USB_ENDPOINT_TYPE_MASK 0x03
+/** Control Endopint type */
+#define USB_ENDPOINT_TYPE_CONTROL 0x00
+/** isochronous Endopint type */
+#define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01
+/** bulk Endopint type */
+#define USB_ENDPOINT_TYPE_BULK 0x02
+/** interrupt Endopint type */
+#define USB_ENDPOINT_TYPE_INTERRUPT 0x03
+/** Endopint sync type mask */
+#define USB_ENDPOINT_SYNC_MASK 0x0C
+/** no synchronization Endopint */
+#define USB_ENDPOINT_SYNC_NO_SYNCHRONIZATION 0x00
+/** Asynchronous sync Endopint */
+#define USB_ENDPOINT_SYNC_ASYNCHRONOUS 0x04
+/** Adaptive sync Endopint */
+#define USB_ENDPOINT_SYNC_ADAPTIVE 0x08
+/** Synchronous sync Endopint */
+#define USB_ENDPOINT_SYNC_SYNCHRONOUS 0x0C
+/** Endopint usage type mask */
+#define USB_ENDPOINT_USAGE_MASK 0x30
+/** Endopint data usage type */
+#define USB_ENDPOINT_USAGE_DATA 0x00
+/** Endopint feedback usage type */
+#define USB_ENDPOINT_USAGE_FEEDBACK 0x10
+/** Endopint implicit feedback usage type */
+#define USB_ENDPOINT_USAGE_IMPLICIT_FEEDBACK 0x20
+/** Endopint reserved usage type */
+#define USB_ENDPOINT_USAGE_RESERVED 0x30
+/** @} */
+
+/** Control endopint EP0's maximum packet size in high-speed mode.*/
+#define USB_ENDPOINT_0_HS_MAXP 64
+/** Control endopint EP0's maximum packet size in low-speed mode.*/
+#define USB_ENDPOINT_0_LS_MAXP 8
+/** Bulk endopint's maximum packet size in high-speed mode.*/
+#define USB_ENDPOINT_BULK_HS_MAXP 512
+
+/** USB Standard Device Descriptor */
+PRE_PACK struct POST_PACK _USB_DEVICE_DESCRIPTOR
+{
+ uint8_t bLength; /**< Size of this descriptor in bytes. */
+ uint8_t bDescriptorType; /**< DEVICE Descriptor Type. */
+ uint16_t bcdUSB; /**< BUSB Specification Release Number in
+ Binary-Coded Decimal (i.e., 2.10 is 210H).
+ This field identifies the release of the USB
+ Specification with which the device and its
+ descriptors are compliant.
+ */
+ uint8_t bDeviceClass; /**< Class code (assigned by the USB-IF).
+ If this field is reset to zero, each interface
+ within a configuration specifies its own
+ class information and the various
+ interfaces operate independently.\n
+ If this field is set to a value between 1 and
+ FEH, the device supports different class
+ specifications on different interfaces and
+ the interfaces may not operate
+ independently. This value identifies the
+ class definition used for the aggregate
+ interfaces. \n
+ If this field is set to FFH, the device class
+ is vendor-specific.
+ */
+ uint8_t bDeviceSubClass; /**< Subclass code (assigned by the USB-IF).
+ These codes are qualified by the value of
+ the bDeviceClass field. \n
+ If the bDeviceClass field is reset to zero,
+ this field must also be reset to zero. \n
+ If the bDeviceClass field is not set to FFH,
+ all values are reserved for assignment by
+ the USB-IF.
+ */
+ uint8_t bDeviceProtocol; /**< Protocol code (assigned by the USB-IF).
+ These codes are qualified by the value of
+ the bDeviceClass and the
+ bDeviceSubClass fields. If a device
+ supports class-specific protocols on a
+ device basis as opposed to an interface
+ basis, this code identifies the protocols
+ that the device uses as defined by the
+ specification of the device class. \n
+ If this field is reset to zero, the device
+ does not use class-specific protocols on a
+ device basis. However, it may use classspecific
+ protocols on an interface basis. \n
+ If this field is set to FFH, the device uses a
+ vendor-specific protocol on a device basis.
+ */
+ uint8_t bMaxPacketSize0; /**< Maximum packet size for endpoint zero
+ (only 8, 16, 32, or 64 are valid). For HS devices
+ is fixed to 64.
+ */
+
+ uint16_t idVendor; /**< Vendor ID (assigned by the USB-IF). */
+ uint16_t idProduct; /**< Product ID (assigned by the manufacturer). */
+ uint16_t bcdDevice; /**< Device release number in binary-coded decimal. */
+ uint8_t iManufacturer; /**< Index of string descriptor describing manufacturer. */
+ uint8_t iProduct; /**< Index of string descriptor describing product. */
+ uint8_t iSerialNumber; /**< Index of string descriptor describing the deviceÂ’s
+ serial number.
+ */
+ uint8_t bNumConfigurations; /**< Number of possible configurations. */
+} ;
+/** USB Standard Device Descriptor */
+typedef struct _USB_DEVICE_DESCRIPTOR USB_DEVICE_DESCRIPTOR;
+
+/** USB 2.0 Device Qualifier Descriptor */
+PRE_PACK struct POST_PACK _USB_DEVICE_QUALIFIER_DESCRIPTOR
+{
+ uint8_t bLength; /**< Size of descriptor */
+ uint8_t bDescriptorType; /**< Device Qualifier Type */
+ uint16_t bcdUSB; /**< USB specification version number (e.g., 0200H for V2.00) */
+ uint8_t bDeviceClass; /**< Class Code */
+ uint8_t bDeviceSubClass; /**< SubClass Code */
+ uint8_t bDeviceProtocol; /**< Protocol Code */
+ uint8_t bMaxPacketSize0; /**< Maximum packet size for other speed */
+ uint8_t bNumConfigurations; /**< Number of Other-speed Configurations */
+ uint8_t bReserved; /**< Reserved for future use, must be zero */
+} ;
+/** USB 2.0 Device Qualifier Descriptor */
+typedef struct _USB_DEVICE_QUALIFIER_DESCRIPTOR USB_DEVICE_QUALIFIER_DESCRIPTOR;
+
+/** USB Standard Configuration Descriptor */
+PRE_PACK struct POST_PACK _USB_CONFIGURATION_DESCRIPTOR
+{
+ uint8_t bLength; /**< Size of this descriptor in bytes */
+ uint8_t bDescriptorType; /**< CONFIGURATION Descriptor Type*/
+ uint16_t wTotalLength; /**< Total length of data returned for this
+ configuration. Includes the combined length
+ of all descriptors (configuration, interface,
+ endpoint, and class- or vendor-specific)
+ returned for this configuration.*/
+ uint8_t bNumInterfaces; /**< Number of interfaces supported by this configuration*/
+ uint8_t bConfigurationValue; /**< Value to use as an argument to the
+ SetConfiguration() request to select this
+ configuration. */
+ uint8_t iConfiguration; /**< Index of string descriptor describing this
+ configuration*/
+ uint8_t bmAttributes; /**< Configuration characteristics \n
+ D7: Reserved (set to one)\n
+ D6: Self-powered \n
+ D5: Remote Wakeup \n
+ D4...0: Reserved (reset to zero) \n
+ D7 is reserved and must be set to one for
+ historical reasons. \n
+ A device configuration that uses power from
+ the bus and a local source reports a non-zero
+ value in bMaxPower to indicate the amount of
+ bus power required and sets D6. The actual
+ power source at runtime may be determined
+ using the GetStatus(DEVICE) request (see
+ USB 2.0 spec Section 9.4.5). \n
+ If a device configuration supports remote
+ wakeup, D5 is set to one.*/
+ uint8_t bMaxPower; /**< Maximum power consumption of the USB
+ device from the bus in this specific
+ configuration when the device is fully
+ operational. Expressed in 2 mA units
+ (i.e., 50 = 100 mA). \n
+ Note: A device configuration reports whether
+ the configuration is bus-powered or selfpowered.
+ Device status reports whether the
+ device is currently self-powered. If a device is
+ disconnected from its external power source, it
+ updates device status to indicate that it is no
+ longer self-powered. \n
+ A device may not increase its power draw
+ from the bus, when it loses its external power
+ source, beyond the amount reported by its
+ configuration. \n
+ If a device can continue to operate when
+ disconnected from its external power source, it
+ continues to do so. If the device cannot
+ continue to operate, it fails operations it can
+ no longer support. The USB System Software
+ may determine the cause of the failure by
+ checking the status and noting the loss of the
+ deviceÂ’s power source.*/
+} ;
+/** USB Standard Configuration Descriptor */
+typedef struct _USB_CONFIGURATION_DESCRIPTOR USB_CONFIGURATION_DESCRIPTOR;
+
+/** USB Standard Interface Association Descriptor */
+PRE_PACK struct POST_PACK _USB_IAD_DESCRIPTOR
+{
+ uint8_t bLength; /**< Size of this descriptor in bytes*/
+ uint8_t bDescriptorType; /**< INTERFACE ASSOCIATION Descriptor Type*/
+ uint8_t bFirstInterface; /**< Interface number of the first interface that is
+ associated with this function.*/
+ uint8_t bInterfaceCount; /**< Number of contiguous interfaces that are
+ associated with this function. */
+ uint8_t bFunctionClass; /**< Class code (assigned by USB-IF). \n
+ A value of zero is not allowed in this descriptor.
+ If this field is FFH, the function class is vendorspecific.
+ All other values are reserved for assignment by
+ the USB-IF.*/
+ uint8_t bFunctionSubClass; /**< Subclass code (assigned by USB-IF). \n
+ If the bFunctionClass field is not set to FFH all
+ values are reserved for assignment by the USBIF.*/
+ uint8_t bFunctionProtocol; /**< Protocol code (assigned by the USB). \n
+ These codes are qualified by the values of the
+ bFunctionClass and bFunctionSubClass fields.*/
+ uint8_t iFunction; /**< Index of string descriptor describing this function.*/
+} ;
+/** USB Standard Interface Association Descriptor */
+typedef struct _USB_IAD_DESCRIPTOR USB_IAD_DESCRIPTOR;
+
+/** USB Standard Interface Descriptor */
+PRE_PACK struct POST_PACK _USB_INTERFACE_DESCRIPTOR
+{
+ uint8_t bLength; /**< Size of this descriptor in bytes*/
+ uint8_t bDescriptorType; /**< INTERFACE Descriptor Type*/
+ uint8_t bInterfaceNumber; /**< Number of this interface. Zero-based
+ value identifying the index in the array of
+ concurrent interfaces supported by this
+ configuration.*/
+ uint8_t bAlternateSetting; /**< Value used to select this alternate setting
+ for the interface identified in the prior field*/
+ uint8_t bNumEndpoints; /**< Number of endpoints used by this
+ interface (excluding endpoint zero). If this
+ value is zero, this interface only uses the
+ Default Control Pipe.*/
+ uint8_t bInterfaceClass; /**< Class code (assigned by the USB-IF). \n
+ A value of zero is reserved for future
+ standardization. \n
+ If this field is set to FFH, the interface
+ class is vendor-specific. \n
+ All other values are reserved for
+ assignment by the USB-IF.*/
+ uint8_t bInterfaceSubClass; /**< Subclass code (assigned by the USB-IF). \n
+ These codes are qualified by the value of
+ the bInterfaceClass field. \n
+ If the bInterfaceClass field is reset to zero,
+ this field must also be reset to zero. \n
+ If the bInterfaceClass field is not set to
+ FFH, all values are reserved for
+ assignment by the USB-IF.*/
+ uint8_t bInterfaceProtocol; /**< Protocol code (assigned by the USB). \n
+ These codes are qualified by the value of
+ the bInterfaceClass and the
+ bInterfaceSubClass fields. If an interface
+ supports class-specific requests, this code
+ identifies the protocols that the device
+ uses as defined by the specification of the
+ device class. \n
+ If this field is reset to zero, the device
+ does not use a class-specific protocol on
+ this interface. \n
+ If this field is set to FFH, the device uses
+ a vendor-specific protocol for this
+ interface.*/
+ uint8_t iInterface; /**< Index of string descriptor describing this interface*/
+} ;
+/** USB Standard Interface Descriptor */
+typedef struct _USB_INTERFACE_DESCRIPTOR USB_INTERFACE_DESCRIPTOR;
+
+/** USB Standard Endpoint Descriptor */
+PRE_PACK struct POST_PACK _USB_ENDPOINT_DESCRIPTOR
+{
+ uint8_t bLength; /**< Size of this descriptor in bytes*/
+ uint8_t bDescriptorType; /**< ENDPOINT Descriptor Type*/
+ uint8_t bEndpointAddress; /**< The address of the endpoint on the USB device
+ described by this descriptor. The address is
+ encoded as follows: \n
+ Bit 3...0: The endpoint number \n
+ Bit 6...4: Reserved, reset to zero \n
+ Bit 7: Direction, ignored for control endpoints
+ 0 = OUT endpoint
+ 1 = IN endpoint. \n \sa USBD_ENDPOINT_ADR_Type*/
+ uint8_t bmAttributes; /**< This field describes the endpointÂ’s attributes when it is
+ configured using the bConfigurationValue. \n
+ Bits 1..0: Transfer Type
+ \li 00 = Control
+ \li 01 = Isochronous
+ \li 10 = Bulk
+ \li 11 = Interrupt \n
+ If not an isochronous endpoint, bits 5..2 are reserved
+ and must be set to zero. If isochronous, they are
+ defined as follows: \n
+ Bits 3..2: Synchronization Type
+ \li 00 = No Synchronization
+ \li 01 = Asynchronous
+ \li 10 = Adaptive
+ \li 11 = Synchronous \n
+ Bits 5..4: Usage Type
+ \li 00 = Data endpoint
+ \li 01 = Feedback endpoint
+ \li 10 = Implicit feedback Data endpoint
+ \li 11 = Reserved \n
+ Refer to Chapter 5 of USB 2.0 specification for more information. \n
+ All other bits are reserved and must be reset to zero.
+ Reserved bits must be ignored by the host.
+ \n \sa USBD_EP_ATTR_Type*/
+ uint16_t wMaxPacketSize; /**< Maximum packet size this endpoint is capable of
+ sending or receiving when this configuration is
+ selected. \n
+ For isochronous endpoints, this value is used to
+ reserve the bus time in the schedule, required for the
+ per-(micro)frame data payloads. The pipe may, on an
+ ongoing basis, actually use less bandwidth than that
+ reserved. The device reports, if necessary, the actual
+ bandwidth used via its normal, non-USB defined
+ mechanisms. \n
+ For all endpoints, bits 10..0 specify the maximum
+ packet size (in bytes). \n
+ For high-speed isochronous and interrupt endpoints: \n
+ Bits 12..11 specify the number of additional transaction
+ opportunities per microframe: \n
+ \li 00 = None (1 transaction per microframe)
+ \li 01 = 1 additional (2 per microframe)
+ \li 10 = 2 additional (3 per microframe)
+ \li 11 = Reserved \n
+ Bits 15..13 are reserved and must be set to zero.*/
+ uint8_t bInterval; /**< Interval for polling endpoint for data transfers.
+ Expressed in frames or microframes depending on the
+ device operating speed (i.e., either 1 millisecond or
+ 125 µs units).
+ \li For full-/high-speed isochronous endpoints, this value
+ must be in the range from 1 to 16. The bInterval value
+ is used as the exponent for a \f$ 2^(bInterval-1) \f$ value; e.g., a
+ bInterval of 4 means a period of 8 (\f$ 2^(4-1) \f$).
+ \li For full-/low-speed interrupt endpoints, the value of
+ this field may be from 1 to 255.
+ \li For high-speed interrupt endpoints, the bInterval value
+ is used as the exponent for a \f$ 2^(bInterval-1) \f$ value; e.g., a
+ bInterval of 4 means a period of 8 (\f$ 2^(4-1) \f$) . This value
+ must be from 1 to 16.
+ \li For high-speed bulk/control OUT endpoints, the
+ bInterval must specify the maximum NAK rate of the
+ endpoint. A value of 0 indicates the endpoint never
+ NAKs. Other values indicate at most 1 NAK each
+ bInterval number of microframes. This value must be
+ in the range from 0 to 255. \n
+ Refer to Chapter 5 of USB 2.0 specification for more information.
+ */
+} ;
+/** USB Standard Endpoint Descriptor */
+typedef struct _USB_ENDPOINT_DESCRIPTOR USB_ENDPOINT_DESCRIPTOR;
+
+/** USB String Descriptor */
+PRE_PACK struct POST_PACK _USB_STRING_DESCRIPTOR
+{
+ uint8_t bLength; /**< Size of this descriptor in bytes*/
+ uint8_t bDescriptorType; /**< STRING Descriptor Type*/
+ uint16_t bString/*[]*/; /**< UNICODE encoded string */
+} ;
+/** USB String Descriptor */
+typedef struct _USB_STRING_DESCRIPTOR USB_STRING_DESCRIPTOR;
+
+/** USB Common Descriptor */
+PRE_PACK struct POST_PACK _USB_COMMON_DESCRIPTOR
+{
+ uint8_t bLength; /**< Size of this descriptor in bytes*/
+ uint8_t bDescriptorType; /**< Descriptor Type*/
+} ;
+/** USB Common Descriptor */
+typedef struct _USB_COMMON_DESCRIPTOR USB_COMMON_DESCRIPTOR;
+
+/** USB Other Speed Configuration */
+PRE_PACK struct POST_PACK _USB_OTHER_SPEED_CONFIGURATION
+{
+ uint8_t bLength; /**< Size of descriptor*/
+ uint8_t bDescriptorType; /**< Other_speed_Configuration Type*/
+ uint16_t wTotalLength; /**< Total length of data returned*/
+ uint8_t bNumInterfaces; /**< Number of interfaces supported by this speed configuration*/
+ uint8_t bConfigurationValue; /**< Value to use to select configuration*/
+ uint8_t IConfiguration; /**< Index of string descriptor*/
+ uint8_t bmAttributes; /**< Same as Configuration descriptor*/
+ uint8_t bMaxPower; /**< Same as Configuration descriptor*/
+} ;
+/** USB Other Speed Configuration */
+typedef struct _USB_OTHER_SPEED_CONFIGURATION USB_OTHER_SPEED_CONFIGURATION;
+
+/** \ingroup USBD_Core
+ * USB device stack/module handle.
+ */
+typedef void* USBD_HANDLE_T;
+
+#define WBVAL(x) ((x) & 0xFF),(((x) >> 8) & 0xFF)
+#define B3VAL(x) ((x) & 0xFF),(((x) >> 8) & 0xFF),(((x) >> 16) & 0xFF)
+
+#define USB_DEVICE_DESC_SIZE (sizeof(USB_DEVICE_DESCRIPTOR))
+#define USB_CONFIGURATION_DESC_SIZE (sizeof(USB_CONFIGURATION_DESCRIPTOR))
+#define USB_INTERFACE_DESC_SIZE (sizeof(USB_INTERFACE_DESCRIPTOR))
+#define USB_INTERFACE_ASSOC_DESC_SIZE (sizeof(USB_IAD_DESCRIPTOR))
+#define USB_ENDPOINT_DESC_SIZE (sizeof(USB_ENDPOINT_DESCRIPTOR))
+#define USB_DEVICE_QUALI_SIZE (sizeof(USB_DEVICE_QUALIFIER_DESCRIPTOR))
+#define USB_OTHER_SPEED_CONF_SIZE (sizeof(USB_OTHER_SPEED_CONFIGURATION))
+
+/** @}*/
+
+#endif /* __USBD_H__ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_adc.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_adc.h
new file mode 100644
index 0000000..4b8e885
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_adc.h
@@ -0,0 +1,377 @@
+/***********************************************************************
+* $Id:: mw_usbd_audio.h 165 2011-04-14 17:41:11Z usb10131 $
+*
+* Project: USB device ROM Stack
+*
+* Description:
+* USB Audio Device Class Definitions.
+*
+***********************************************************************
+* Copyright(C) 2011, NXP Semiconductor
+* All rights reserved.
+*
+* Software that is described herein is for illustrative purposes only
+* which provides customers with programming information regarding the
+* products. This software is supplied "AS IS" without any warranties.
+* NXP Semiconductors assumes no responsibility or liability for the
+* use of the software, conveys no license or title under any patent,
+* copyright, or mask work right to the product. NXP Semiconductors
+* reserves the right to make changes in the software without
+* notification. NXP Semiconductors also make no representation or
+* warranty that such application will be suitable for the specified
+* use without further testing or modification.
+**********************************************************************/
+#ifndef __AUDIO_H__
+#define __AUDIO_H__
+
+
+/* Audio Interface Subclass Codes */
+#define AUDIO_SUBCLASS_UNDEFINED 0x00
+#define AUDIO_SUBCLASS_AUDIOCONTROL 0x01
+#define AUDIO_SUBCLASS_AUDIOSTREAMING 0x02
+#define AUDIO_SUBCLASS_MIDISTREAMING 0x03
+
+/* Audio Interface Protocol Codes */
+#define AUDIO_PROTOCOL_UNDEFINED 0x00
+
+
+/* Audio Descriptor Types */
+#define AUDIO_UNDEFINED_DESCRIPTOR_TYPE 0x20
+#define AUDIO_DEVICE_DESCRIPTOR_TYPE 0x21
+#define AUDIO_CONFIGURATION_DESCRIPTOR_TYPE 0x22
+#define AUDIO_STRING_DESCRIPTOR_TYPE 0x23
+#define AUDIO_INTERFACE_DESCRIPTOR_TYPE 0x24
+#define AUDIO_ENDPOINT_DESCRIPTOR_TYPE 0x25
+
+
+/* Audio Control Interface Descriptor Subtypes */
+#define AUDIO_CONTROL_UNDEFINED 0x00
+#define AUDIO_CONTROL_HEADER 0x01
+#define AUDIO_CONTROL_INPUT_TERMINAL 0x02
+#define AUDIO_CONTROL_OUTPUT_TERMINAL 0x03
+#define AUDIO_CONTROL_MIXER_UNIT 0x04
+#define AUDIO_CONTROL_SELECTOR_UNIT 0x05
+#define AUDIO_CONTROL_FEATURE_UNIT 0x06
+#define AUDIO_CONTROL_PROCESSING_UNIT 0x07
+#define AUDIO_CONTROL_EXTENSION_UNIT 0x08
+
+/* Audio Streaming Interface Descriptor Subtypes */
+#define AUDIO_STREAMING_UNDEFINED 0x00
+#define AUDIO_STREAMING_GENERAL 0x01
+#define AUDIO_STREAMING_FORMAT_TYPE 0x02
+#define AUDIO_STREAMING_FORMAT_SPECIFIC 0x03
+
+/* Audio Endpoint Descriptor Subtypes */
+#define AUDIO_ENDPOINT_UNDEFINED 0x00
+#define AUDIO_ENDPOINT_GENERAL 0x01
+
+
+/* Audio Descriptor Sizes */
+#define AUDIO_CONTROL_INTERFACE_DESC_SZ(n) 0x08+n
+#define AUDIO_STREAMING_INTERFACE_DESC_SIZE 0x07
+#define AUDIO_INPUT_TERMINAL_DESC_SIZE 0x0C
+#define AUDIO_OUTPUT_TERMINAL_DESC_SIZE 0x09
+#define AUDIO_MIXER_UNIT_DESC_SZ(p,n) 0x0A+p+n
+#define AUDIO_SELECTOR_UNIT_DESC_SZ(p) 0x06+p
+#define AUDIO_FEATURE_UNIT_DESC_SZ(ch,n) 0x07+(ch+1)*n
+#define AUDIO_PROCESSING_UNIT_DESC_SZ(p,n,x) 0x0D+p+n+x
+#define AUDIO_EXTENSION_UNIT_DESC_SZ(p,n) 0x0D+p+n
+#define AUDIO_STANDARD_ENDPOINT_DESC_SIZE 0x09
+#define AUDIO_STREAMING_ENDPOINT_DESC_SIZE 0x07
+
+
+/* Audio Processing Unit Process Types */
+#define AUDIO_UNDEFINED_PROCESS 0x00
+#define AUDIO_UP_DOWN_MIX_PROCESS 0x01
+#define AUDIO_DOLBY_PROLOGIC_PROCESS 0x02
+#define AUDIO_3D_STEREO_PROCESS 0x03
+#define AUDIO_REVERBERATION_PROCESS 0x04
+#define AUDIO_CHORUS_PROCESS 0x05
+#define AUDIO_DYN_RANGE_COMP_PROCESS 0x06
+
+
+/* Audio Request Codes */
+#define AUDIO_REQUEST_UNDEFINED 0x00
+#define AUDIO_REQUEST_SET_CUR 0x01
+#define AUDIO_REQUEST_GET_CUR 0x81
+#define AUDIO_REQUEST_SET_MIN 0x02
+#define AUDIO_REQUEST_GET_MIN 0x82
+#define AUDIO_REQUEST_SET_MAX 0x03
+#define AUDIO_REQUEST_GET_MAX 0x83
+#define AUDIO_REQUEST_SET_RES 0x04
+#define AUDIO_REQUEST_GET_RES 0x84
+#define AUDIO_REQUEST_SET_MEM 0x05
+#define AUDIO_REQUEST_GET_MEM 0x85
+#define AUDIO_REQUEST_GET_STAT 0xFF
+
+
+/* Audio Control Selector Codes */
+#define AUDIO_CONTROL_UNDEFINED 0x00 /* Common Selector */
+
+/* Terminal Control Selectors */
+#define AUDIO_COPY_PROTECT_CONTROL 0x01
+
+/* Feature Unit Control Selectors */
+#define AUDIO_MUTE_CONTROL 0x01
+#define AUDIO_VOLUME_CONTROL 0x02
+#define AUDIO_BASS_CONTROL 0x03
+#define AUDIO_MID_CONTROL 0x04
+#define AUDIO_TREBLE_CONTROL 0x05
+#define AUDIO_GRAPHIC_EQUALIZER_CONTROL 0x06
+#define AUDIO_AUTOMATIC_GAIN_CONTROL 0x07
+#define AUDIO_DELAY_CONTROL 0x08
+#define AUDIO_BASS_BOOST_CONTROL 0x09
+#define AUDIO_LOUDNESS_CONTROL 0x0A
+
+/* Processing Unit Control Selectors: */
+#define AUDIO_ENABLE_CONTROL 0x01 /* Common Selector */
+#define AUDIO_MODE_SELECT_CONTROL 0x02 /* Common Selector */
+
+/* - Up/Down-mix Control Selectors */
+/* AUDIO_ENABLE_CONTROL 0x01 Common Selector */
+/* AUDIO_MODE_SELECT_CONTROL 0x02 Common Selector */
+
+/* - Dolby Prologic Control Selectors */
+/* AUDIO_ENABLE_CONTROL 0x01 Common Selector */
+/* AUDIO_MODE_SELECT_CONTROL 0x02 Common Selector */
+
+/* - 3D Stereo Extender Control Selectors */
+/* AUDIO_ENABLE_CONTROL 0x01 Common Selector */
+#define AUDIO_SPACIOUSNESS_CONTROL 0x02
+
+/* - Reverberation Control Selectors */
+/* AUDIO_ENABLE_CONTROL 0x01 Common Selector */
+#define AUDIO_REVERB_LEVEL_CONTROL 0x02
+#define AUDIO_REVERB_TIME_CONTROL 0x03
+#define AUDIO_REVERB_FEEDBACK_CONTROL 0x04
+
+/* - Chorus Control Selectors */
+/* AUDIO_ENABLE_CONTROL 0x01 Common Selector */
+#define AUDIO_CHORUS_LEVEL_CONTROL 0x02
+#define AUDIO_SHORUS_RATE_CONTROL 0x03
+#define AUDIO_CHORUS_DEPTH_CONTROL 0x04
+
+/* - Dynamic Range Compressor Control Selectors */
+/* AUDIO_ENABLE_CONTROL 0x01 Common Selector */
+#define AUDIO_COMPRESSION_RATE_CONTROL 0x02
+#define AUDIO_MAX_AMPL_CONTROL 0x03
+#define AUDIO_THRESHOLD_CONTROL 0x04
+#define AUDIO_ATTACK_TIME_CONTROL 0x05
+#define AUDIO_RELEASE_TIME_CONTROL 0x06
+
+/* Extension Unit Control Selectors */
+/* AUDIO_ENABLE_CONTROL 0x01 Common Selector */
+
+/* Endpoint Control Selectors */
+#define AUDIO_SAMPLING_FREQ_CONTROL 0x01
+#define AUDIO_PITCH_CONTROL 0x02
+
+
+/* Audio Format Specific Control Selectors */
+
+/* MPEG Control Selectors */
+#define AUDIO_MPEG_CONTROL_UNDEFINED 0x00
+#define AUDIO_MPEG_DUAL_CHANNEL_CONTROL 0x01
+#define AUDIO_MPEG_SECOND_STEREO_CONTROL 0x02
+#define AUDIO_MPEG_MULTILINGUAL_CONTROL 0x03
+#define AUDIO_MPEG_DYN_RANGE_CONTROL 0x04
+#define AUDIO_MPEG_SCALING_CONTROL 0x05
+#define AUDIO_MPEG_HILO_SCALING_CONTROL 0x06
+
+/* AC-3 Control Selectors */
+#define AUDIO_AC3_CONTROL_UNDEFINED 0x00
+#define AUDIO_AC3_MODE_CONTROL 0x01
+#define AUDIO_AC3_DYN_RANGE_CONTROL 0x02
+#define AUDIO_AC3_SCALING_CONTROL 0x03
+#define AUDIO_AC3_HILO_SCALING_CONTROL 0x04
+
+
+/* Audio Format Types */
+#define AUDIO_FORMAT_TYPE_UNDEFINED 0x00
+#define AUDIO_FORMAT_TYPE_I 0x01
+#define AUDIO_FORMAT_TYPE_II 0x02
+#define AUDIO_FORMAT_TYPE_III 0x03
+
+
+/* Audio Format Type Descriptor Sizes */
+#define AUDIO_FORMAT_TYPE_I_DESC_SZ(n) 0x08+(n*3)
+#define AUDIO_FORMAT_TYPE_II_DESC_SZ(n) 0x09+(n*3)
+#define AUDIO_FORMAT_TYPE_III_DESC_SZ(n) 0x08+(n*3)
+#define AUDIO_FORMAT_MPEG_DESC_SIZE 0x09
+#define AUDIO_FORMAT_AC3_DESC_SIZE 0x0A
+
+
+/* Audio Data Format Codes */
+
+/* Audio Data Format Type I Codes */
+#define AUDIO_FORMAT_TYPE_I_UNDEFINED 0x0000
+#define AUDIO_FORMAT_PCM 0x0001
+#define AUDIO_FORMAT_PCM8 0x0002
+#define AUDIO_FORMAT_IEEE_FLOAT 0x0003
+#define AUDIO_FORMAT_ALAW 0x0004
+#define AUDIO_FORMAT_MULAW 0x0005
+
+/* Audio Data Format Type II Codes */
+#define AUDIO_FORMAT_TYPE_II_UNDEFINED 0x1000
+#define AUDIO_FORMAT_MPEG 0x1001
+#define AUDIO_FORMAT_AC3 0x1002
+
+/* Audio Data Format Type III Codes */
+#define AUDIO_FORMAT_TYPE_III_UNDEFINED 0x2000
+#define AUDIO_FORMAT_IEC1937_AC3 0x2001
+#define AUDIO_FORMAT_IEC1937_MPEG1_L1 0x2002
+#define AUDIO_FORMAT_IEC1937_MPEG1_L2_3 0x2003
+#define AUDIO_FORMAT_IEC1937_MPEG2_NOEXT 0x2003
+#define AUDIO_FORMAT_IEC1937_MPEG2_EXT 0x2004
+#define AUDIO_FORMAT_IEC1937_MPEG2_L1_LS 0x2005
+#define AUDIO_FORMAT_IEC1937_MPEG2_L2_3 0x2006
+
+
+/* Predefined Audio Channel Configuration Bits */
+#define AUDIO_CHANNEL_M 0x0000 /* Mono */
+#define AUDIO_CHANNEL_L 0x0001 /* Left Front */
+#define AUDIO_CHANNEL_R 0x0002 /* Right Front */
+#define AUDIO_CHANNEL_C 0x0004 /* Center Front */
+#define AUDIO_CHANNEL_LFE 0x0008 /* Low Freq. Enhance. */
+#define AUDIO_CHANNEL_LS 0x0010 /* Left Surround */
+#define AUDIO_CHANNEL_RS 0x0020 /* Right Surround */
+#define AUDIO_CHANNEL_LC 0x0040 /* Left of Center */
+#define AUDIO_CHANNEL_RC 0x0080 /* Right of Center */
+#define AUDIO_CHANNEL_S 0x0100 /* Surround */
+#define AUDIO_CHANNEL_SL 0x0200 /* Side Left */
+#define AUDIO_CHANNEL_SR 0x0400 /* Side Right */
+#define AUDIO_CHANNEL_T 0x0800 /* Top */
+
+
+/* Feature Unit Control Bits */
+#define AUDIO_CONTROL_MUTE 0x0001
+#define AUDIO_CONTROL_VOLUME 0x0002
+#define AUDIO_CONTROL_BASS 0x0004
+#define AUDIO_CONTROL_MID 0x0008
+#define AUDIO_CONTROL_TREBLE 0x0010
+#define AUDIO_CONTROL_GRAPHIC_EQUALIZER 0x0020
+#define AUDIO_CONTROL_AUTOMATIC_GAIN 0x0040
+#define AUDIO_CONTROL_DEALY 0x0080
+#define AUDIO_CONTROL_BASS_BOOST 0x0100
+#define AUDIO_CONTROL_LOUDNESS 0x0200
+
+/* Processing Unit Control Bits: */
+#define AUDIO_CONTROL_ENABLE 0x0001 /* Common Bit */
+#define AUDIO_CONTROL_MODE_SELECT 0x0002 /* Common Bit */
+
+/* - Up/Down-mix Control Bits */
+/* AUDIO_CONTROL_ENABLE 0x0001 Common Bit */
+/* AUDIO_CONTROL_MODE_SELECT 0x0002 Common Bit */
+
+/* - Dolby Prologic Control Bits */
+/* AUDIO_CONTROL_ENABLE 0x0001 Common Bit */
+/* AUDIO_CONTROL_MODE_SELECT 0x0002 Common Bit */
+
+/* - 3D Stereo Extender Control Bits */
+/* AUDIO_CONTROL_ENABLE 0x0001 Common Bit */
+#define AUDIO_CONTROL_SPACIOUSNESS 0x0002
+
+/* - Reverberation Control Bits */
+/* AUDIO_CONTROL_ENABLE 0x0001 Common Bit */
+#define AUDIO_CONTROL_REVERB_TYPE 0x0002
+#define AUDIO_CONTROL_REVERB_LEVEL 0x0004
+#define AUDIO_CONTROL_REVERB_TIME 0x0008
+#define AUDIO_CONTROL_REVERB_FEEDBACK 0x0010
+
+/* - Chorus Control Bits */
+/* AUDIO_CONTROL_ENABLE 0x0001 Common Bit */
+#define AUDIO_CONTROL_CHORUS_LEVEL 0x0002
+#define AUDIO_CONTROL_SHORUS_RATE 0x0004
+#define AUDIO_CONTROL_CHORUS_DEPTH 0x0008
+
+/* - Dynamic Range Compressor Control Bits */
+/* AUDIO_CONTROL_ENABLE 0x0001 Common Bit */
+#define AUDIO_CONTROL_COMPRESSION_RATE 0x0002
+#define AUDIO_CONTROL_MAX_AMPL 0x0004
+#define AUDIO_CONTROL_THRESHOLD 0x0008
+#define AUDIO_CONTROL_ATTACK_TIME 0x0010
+#define AUDIO_CONTROL_RELEASE_TIME 0x0020
+
+/* Extension Unit Control Bits */
+/* AUDIO_CONTROL_ENABLE 0x0001 Common Bit */
+
+/* Endpoint Control Bits */
+#define AUDIO_CONTROL_SAMPLING_FREQ 0x01
+#define AUDIO_CONTROL_PITCH 0x02
+#define AUDIO_MAX_PACKETS_ONLY 0x80
+
+
+/* Audio Terminal Types */
+
+/* USB Terminal Types */
+#define AUDIO_TERMINAL_USB_UNDEFINED 0x0100
+#define AUDIO_TERMINAL_USB_STREAMING 0x0101
+#define AUDIO_TERMINAL_USB_VENDOR_SPECIFIC 0x01FF
+
+/* Input Terminal Types */
+#define AUDIO_TERMINAL_INPUT_UNDEFINED 0x0200
+#define AUDIO_TERMINAL_MICROPHONE 0x0201
+#define AUDIO_TERMINAL_DESKTOP_MICROPHONE 0x0202
+#define AUDIO_TERMINAL_PERSONAL_MICROPHONE 0x0203
+#define AUDIO_TERMINAL_OMNI_DIR_MICROPHONE 0x0204
+#define AUDIO_TERMINAL_MICROPHONE_ARRAY 0x0205
+#define AUDIO_TERMINAL_PROCESSING_MIC_ARRAY 0x0206
+
+/* Output Terminal Types */
+#define AUDIO_TERMINAL_OUTPUT_UNDEFINED 0x0300
+#define AUDIO_TERMINAL_SPEAKER 0x0301
+#define AUDIO_TERMINAL_HEADPHONES 0x0302
+#define AUDIO_TERMINAL_HEAD_MOUNTED_AUDIO 0x0303
+#define AUDIO_TERMINAL_DESKTOP_SPEAKER 0x0304
+#define AUDIO_TERMINAL_ROOM_SPEAKER 0x0305
+#define AUDIO_TERMINAL_COMMUNICATION_SPEAKER 0x0306
+#define AUDIO_TERMINAL_LOW_FREQ_SPEAKER 0x0307
+
+/* Bi-directional Terminal Types */
+#define AUDIO_TERMINAL_BIDIRECTIONAL_UNDEFINED 0x0400
+#define AUDIO_TERMINAL_HANDSET 0x0401
+#define AUDIO_TERMINAL_HEAD_MOUNTED_HANDSET 0x0402
+#define AUDIO_TERMINAL_SPEAKERPHONE 0x0403
+#define AUDIO_TERMINAL_SPEAKERPHONE_ECHOSUPRESS 0x0404
+#define AUDIO_TERMINAL_SPEAKERPHONE_ECHOCANCEL 0x0405
+
+/* Telephony Terminal Types */
+#define AUDIO_TERMINAL_TELEPHONY_UNDEFINED 0x0500
+#define AUDIO_TERMINAL_PHONE_LINE 0x0501
+#define AUDIO_TERMINAL_TELEPHONE 0x0502
+#define AUDIO_TERMINAL_DOWN_LINE_PHONE 0x0503
+
+/* External Terminal Types */
+#define AUDIO_TERMINAL_EXTERNAL_UNDEFINED 0x0600
+#define AUDIO_TERMINAL_ANALOG_CONNECTOR 0x0601
+#define AUDIO_TERMINAL_DIGITAL_AUDIO_INTERFACE 0x0602
+#define AUDIO_TERMINAL_LINE_CONNECTOR 0x0603
+#define AUDIO_TERMINAL_LEGACY_AUDIO_CONNECTOR 0x0604
+#define AUDIO_TERMINAL_SPDIF_INTERFACE 0x0605
+#define AUDIO_TERMINAL_1394_DA_STREAM 0x0606
+#define AUDIO_TERMINAL_1394_DA_STREAM_TRACK 0x0607
+
+/* Embedded Function Terminal Types */
+#define AUDIO_TERMINAL_EMBEDDED_UNDEFINED 0x0700
+#define AUDIO_TERMINAL_CALIBRATION_NOISE 0x0701
+#define AUDIO_TERMINAL_EQUALIZATION_NOISE 0x0702
+#define AUDIO_TERMINAL_CD_PLAYER 0x0703
+#define AUDIO_TERMINAL_DAT 0x0704
+#define AUDIO_TERMINAL_DCC 0x0705
+#define AUDIO_TERMINAL_MINI_DISK 0x0706
+#define AUDIO_TERMINAL_ANALOG_TAPE 0x0707
+#define AUDIO_TERMINAL_PHONOGRAPH 0x0708
+#define AUDIO_TERMINAL_VCR_AUDIO 0x0709
+#define AUDIO_TERMINAL_VIDEO_DISC_AUDIO 0x070A
+#define AUDIO_TERMINAL_DVD_AUDIO 0x070B
+#define AUDIO_TERMINAL_TV_TUNER_AUDIO 0x070C
+#define AUDIO_TERMINAL_SATELLITE_RECEIVER_AUDIO 0x070D
+#define AUDIO_TERMINAL_CABLE_TUNER_AUDIO 0x070E
+#define AUDIO_TERMINAL_DSS_AUDIO 0x070F
+#define AUDIO_TERMINAL_RADIO_RECEIVER 0x0710
+#define AUDIO_TERMINAL_RADIO_TRANSMITTER 0x0711
+#define AUDIO_TERMINAL_MULTI_TRACK_RECORDER 0x0712
+#define AUDIO_TERMINAL_SYNTHESIZER 0x0713
+
+
+#endif /* __AUDIO_H__ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_cdc.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_cdc.h
new file mode 100644
index 0000000..010e941
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_cdc.h
@@ -0,0 +1,249 @@
+/***********************************************************************
+* $Id:: mw_usbd_cdc.h 165 2011-04-14 17:41:11Z usb10131 $
+*
+* Project: USB device ROM Stack
+*
+* Description:
+* USB Communication Device Class User module Definitions.
+*
+***********************************************************************
+* Copyright(C) 2011, NXP Semiconductor
+* All rights reserved.
+*
+* Software that is described herein is for illustrative purposes only
+* which provides customers with programming information regarding the
+* products. This software is supplied "AS IS" without any warranties.
+* NXP Semiconductors assumes no responsibility or liability for the
+* use of the software, conveys no license or title under any patent,
+* copyright, or mask work right to the product. NXP Semiconductors
+* reserves the right to make changes in the software without
+* notification. NXP Semiconductors also make no representation or
+* warranty that such application will be suitable for the specified
+* use without further testing or modification.
+**********************************************************************/
+#ifndef __CDC_H
+#define __CDC_H
+
+#include "usbd.h"
+
+/*----------------------------------------------------------------------------
+ * Definitions based on usbcdc11.pdf (www.usb.org)
+ *---------------------------------------------------------------------------*/
+/* Communication device class specification version 1.10 */
+#define CDC_V1_10 0x0110
+
+/* Communication interface class code */
+/* (usbcdc11.pdf, 4.2, Table 15) */
+#define CDC_COMMUNICATION_INTERFACE_CLASS 0x02
+
+/* Communication interface class subclass codes */
+/* (usbcdc11.pdf, 4.3, Table 16) */
+#define CDC_DIRECT_LINE_CONTROL_MODEL 0x01
+#define CDC_ABSTRACT_CONTROL_MODEL 0x02
+#define CDC_TELEPHONE_CONTROL_MODEL 0x03
+#define CDC_MULTI_CHANNEL_CONTROL_MODEL 0x04
+#define CDC_CAPI_CONTROL_MODEL 0x05
+#define CDC_ETHERNET_NETWORKING_CONTROL_MODEL 0x06
+#define CDC_ATM_NETWORKING_CONTROL_MODEL 0x07
+
+/* Communication interface class control protocol codes */
+/* (usbcdc11.pdf, 4.4, Table 17) */
+#define CDC_PROTOCOL_COMMON_AT_COMMANDS 0x01
+
+/* Data interface class code */
+/* (usbcdc11.pdf, 4.5, Table 18) */
+#define CDC_DATA_INTERFACE_CLASS 0x0A
+
+/* Data interface class protocol codes */
+/* (usbcdc11.pdf, 4.7, Table 19) */
+#define CDC_PROTOCOL_ISDN_BRI 0x30
+#define CDC_PROTOCOL_HDLC 0x31
+#define CDC_PROTOCOL_TRANSPARENT 0x32
+#define CDC_PROTOCOL_Q921_MANAGEMENT 0x50
+#define CDC_PROTOCOL_Q921_DATA_LINK 0x51
+#define CDC_PROTOCOL_Q921_MULTIPLEXOR 0x52
+#define CDC_PROTOCOL_V42 0x90
+#define CDC_PROTOCOL_EURO_ISDN 0x91
+#define CDC_PROTOCOL_V24_RATE_ADAPTATION 0x92
+#define CDC_PROTOCOL_CAPI 0x93
+#define CDC_PROTOCOL_HOST_BASED_DRIVER 0xFD
+#define CDC_PROTOCOL_DESCRIBED_IN_PUFD 0xFE
+
+/* Type values for bDescriptorType field of functional descriptors */
+/* (usbcdc11.pdf, 5.2.3, Table 24) */
+#define CDC_CS_INTERFACE 0x24
+#define CDC_CS_ENDPOINT 0x25
+
+/* Type values for bDescriptorSubtype field of functional descriptors */
+/* (usbcdc11.pdf, 5.2.3, Table 25) */
+#define CDC_HEADER 0x00
+#define CDC_CALL_MANAGEMENT 0x01
+#define CDC_ABSTRACT_CONTROL_MANAGEMENT 0x02
+#define CDC_DIRECT_LINE_MANAGEMENT 0x03
+#define CDC_TELEPHONE_RINGER 0x04
+#define CDC_REPORTING_CAPABILITIES 0x05
+#define CDC_UNION 0x06
+#define CDC_COUNTRY_SELECTION 0x07
+#define CDC_TELEPHONE_OPERATIONAL_MODES 0x08
+#define CDC_USB_TERMINAL 0x09
+#define CDC_NETWORK_CHANNEL 0x0A
+#define CDC_PROTOCOL_UNIT 0x0B
+#define CDC_EXTENSION_UNIT 0x0C
+#define CDC_MULTI_CHANNEL_MANAGEMENT 0x0D
+#define CDC_CAPI_CONTROL_MANAGEMENT 0x0E
+#define CDC_ETHERNET_NETWORKING 0x0F
+#define CDC_ATM_NETWORKING 0x10
+
+/* CDC class-specific request codes */
+/* (usbcdc11.pdf, 6.2, Table 46) */
+/* see Table 45 for info about the specific requests. */
+#define CDC_SEND_ENCAPSULATED_COMMAND 0x00
+#define CDC_GET_ENCAPSULATED_RESPONSE 0x01
+#define CDC_SET_COMM_FEATURE 0x02
+#define CDC_GET_COMM_FEATURE 0x03
+#define CDC_CLEAR_COMM_FEATURE 0x04
+#define CDC_SET_AUX_LINE_STATE 0x10
+#define CDC_SET_HOOK_STATE 0x11
+#define CDC_PULSE_SETUP 0x12
+#define CDC_SEND_PULSE 0x13
+#define CDC_SET_PULSE_TIME 0x14
+#define CDC_RING_AUX_JACK 0x15
+#define CDC_SET_LINE_CODING 0x20
+#define CDC_GET_LINE_CODING 0x21
+#define CDC_SET_CONTROL_LINE_STATE 0x22
+#define CDC_SEND_BREAK 0x23
+#define CDC_SET_RINGER_PARMS 0x30
+#define CDC_GET_RINGER_PARMS 0x31
+#define CDC_SET_OPERATION_PARMS 0x32
+#define CDC_GET_OPERATION_PARMS 0x33
+#define CDC_SET_LINE_PARMS 0x34
+#define CDC_GET_LINE_PARMS 0x35
+#define CDC_DIAL_DIGITS 0x36
+#define CDC_SET_UNIT_PARAMETER 0x37
+#define CDC_GET_UNIT_PARAMETER 0x38
+#define CDC_CLEAR_UNIT_PARAMETER 0x39
+#define CDC_GET_PROFILE 0x3A
+#define CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40
+#define CDC_SET_ETHERNET_PMP_FILTER 0x41
+#define CDC_GET_ETHERNET_PMP_FILTER 0x42
+#define CDC_SET_ETHERNET_PACKET_FILTER 0x43
+#define CDC_GET_ETHERNET_STATISTIC 0x44
+#define CDC_SET_ATM_DATA_FORMAT 0x50
+#define CDC_GET_ATM_DEVICE_STATISTICS 0x51
+#define CDC_SET_ATM_DEFAULT_VC 0x52
+#define CDC_GET_ATM_VC_STATISTICS 0x53
+
+/* Communication feature selector codes */
+/* (usbcdc11.pdf, 6.2.2..6.2.4, Table 47) */
+#define CDC_ABSTRACT_STATE 0x01
+#define CDC_COUNTRY_SETTING 0x02
+
+/* Feature Status returned for ABSTRACT_STATE Selector */
+/* (usbcdc11.pdf, 6.2.3, Table 48) */
+#define CDC_IDLE_SETTING (1 << 0)
+#define CDC_DATA_MULTPLEXED_STATE (1 << 1)
+
+
+/* Control signal bitmap values for the SetControlLineState request */
+/* (usbcdc11.pdf, 6.2.14, Table 51) */
+#define CDC_DTE_PRESENT (1 << 0)
+#define CDC_ACTIVATE_CARRIER (1 << 1)
+
+/* CDC class-specific notification codes */
+/* (usbcdc11.pdf, 6.3, Table 68) */
+/* see Table 67 for Info about class-specific notifications */
+#define CDC_NOTIFICATION_NETWORK_CONNECTION 0x00
+#define CDC_RESPONSE_AVAILABLE 0x01
+#define CDC_AUX_JACK_HOOK_STATE 0x08
+#define CDC_RING_DETECT 0x09
+#define CDC_NOTIFICATION_SERIAL_STATE 0x20
+#define CDC_CALL_STATE_CHANGE 0x28
+#define CDC_LINE_STATE_CHANGE 0x29
+#define CDC_CONNECTION_SPEED_CHANGE 0x2A
+
+/* UART state bitmap values (Serial state notification). */
+/* (usbcdc11.pdf, 6.3.5, Table 69) */
+#define CDC_SERIAL_STATE_OVERRUN (1 << 6) /* receive data overrun error has occurred */
+#define CDC_SERIAL_STATE_PARITY (1 << 5) /* parity error has occurred */
+#define CDC_SERIAL_STATE_FRAMING (1 << 4) /* framing error has occurred */
+#define CDC_SERIAL_STATE_RING (1 << 3) /* state of ring signal detection */
+#define CDC_SERIAL_STATE_BREAK (1 << 2) /* state of break detection */
+#define CDC_SERIAL_STATE_TX_CARRIER (1 << 1) /* state of transmission carrier */
+#define CDC_SERIAL_STATE_RX_CARRIER (1 << 0) /* state of receiver carrier */
+
+
+/*----------------------------------------------------------------------------
+ * Structures based on usbcdc11.pdf (www.usb.org)
+ *---------------------------------------------------------------------------*/
+
+/* Header functional descriptor */
+/* (usbcdc11.pdf, 5.2.3.1) */
+/* This header must precede any list of class-specific descriptors. */
+PRE_PACK struct POST_PACK _CDC_HEADER_DESCRIPTOR{
+ uint8_t bFunctionLength; /* size of this descriptor in bytes */
+ uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */
+ uint8_t bDescriptorSubtype; /* Header functional descriptor subtype */
+ uint16_t bcdCDC; /* USB CDC specification release version */
+};
+typedef struct _CDC_HEADER_DESCRIPTOR CDC_HEADER_DESCRIPTOR;
+
+/* Call management functional descriptor */
+/* (usbcdc11.pdf, 5.2.3.2) */
+/* Describes the processing of calls for the communication class interface. */
+PRE_PACK struct POST_PACK _CDC_CALL_MANAGEMENT_DESCRIPTOR {
+ uint8_t bFunctionLength; /* size of this descriptor in bytes */
+ uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */
+ uint8_t bDescriptorSubtype; /* call management functional descriptor subtype */
+ uint8_t bmCapabilities; /* capabilities that this configuration supports */
+ uint8_t bDataInterface; /* interface number of the data class interface used for call management (optional) */
+};
+typedef struct _CDC_CALL_MANAGEMENT_DESCRIPTOR CDC_CALL_MANAGEMENT_DESCRIPTOR;
+
+/* Abstract control management functional descriptor */
+/* (usbcdc11.pdf, 5.2.3.3) */
+/* Describes the command supported by the communication interface class with the Abstract Control Model subclass code. */
+PRE_PACK struct POST_PACK _CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR {
+ uint8_t bFunctionLength; /* size of this descriptor in bytes */
+ uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */
+ uint8_t bDescriptorSubtype; /* abstract control management functional descriptor subtype */
+ uint8_t bmCapabilities; /* capabilities supported by this configuration */
+};
+typedef struct _CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR;
+
+/* Union functional descriptors */
+/* (usbcdc11.pdf, 5.2.3.8) */
+/* Describes the relationship between a group of interfaces that can be considered to form a functional unit. */
+PRE_PACK struct POST_PACK _CDC_UNION_DESCRIPTOR {
+ uint8_t bFunctionLength; /* size of this descriptor in bytes */
+ uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */
+ uint8_t bDescriptorSubtype; /* union functional descriptor subtype */
+ uint8_t bMasterInterface; /* interface number designated as master */
+};
+typedef struct _CDC_UNION_DESCRIPTOR CDC_UNION_DESCRIPTOR;
+
+/* Union functional descriptors with one slave interface */
+/* (usbcdc11.pdf, 5.2.3.8) */
+PRE_PACK struct POST_PACK _CDC_UNION_1SLAVE_DESCRIPTOR {
+ CDC_UNION_DESCRIPTOR sUnion; /* Union functional descriptor */
+ uint8_t bSlaveInterfaces[1]; /* Slave interface 0 */
+};
+typedef struct _CDC_UNION_1SLAVE_DESCRIPTOR CDC_UNION_1SLAVE_DESCRIPTOR;
+
+/* Line coding structure */
+/* Format of the data returned when a GetLineCoding request is received */
+/* (usbcdc11.pdf, 6.2.13) */
+PRE_PACK struct POST_PACK _CDC_LINE_CODING {
+ uint32_t dwDTERate; /* Data terminal rate in bits per second */
+ uint8_t bCharFormat; /* Number of stop bits */
+ uint8_t bParityType; /* Parity bit type */
+ uint8_t bDataBits; /* Number of data bits */
+};
+typedef struct _CDC_LINE_CODING CDC_LINE_CODING;
+
+/* Notification header */
+/* Data sent on the notification endpoint must follow this header. */
+/* see USB_SETUP_PACKET in file usb.h */
+typedef USB_SETUP_PACKET CDC_NOTIFICATION_HEADER;
+
+#endif /* __CDC_H */
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_cdcuser.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_cdcuser.h
new file mode 100644
index 0000000..92568e8
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_cdcuser.h
@@ -0,0 +1,529 @@
+/***********************************************************************
+* $Id:: mw_usbd_cdcuser.h 331 2012-08-09 18:54:34Z usb10131 $
+*
+* Project: USB device ROM Stack
+*
+* Description:
+* USB Communication Device Class User module Definitions.
+*
+***********************************************************************
+* Copyright(C) 2011, NXP Semiconductor
+* All rights reserved.
+*
+* Software that is described herein is for illustrative purposes only
+* which provides customers with programming information regarding the
+* products. This software is supplied "AS IS" without any warranties.
+* NXP Semiconductors assumes no responsibility or liability for the
+* use of the software, conveys no license or title under any patent,
+* copyright, or mask work right to the product. NXP Semiconductors
+* reserves the right to make changes in the software without
+* notification. NXP Semiconductors also make no representation or
+* warranty that such application will be suitable for the specified
+* use without further testing or modification.
+**********************************************************************/
+#ifndef __CDCUSER_H__
+#define __CDCUSER_H__
+
+#include "error.h"
+#include "usbd.h"
+#include "usbd_cdc.h"
+
+/** \file
+ * \brief Communication Device Class (CDC) API structures and function prototypes.
+ *
+ * Definition of functions exported by ROM based CDC function driver.
+ *
+ */
+
+/** \ingroup Group_USBD
+ * @defgroup USBD_CDC Communication Device Class (CDC) Function Driver
+ * \section Sec_CDCModDescription Module Description
+ * CDC Class Function Driver module. This module contains an internal implementation of the USB CDC Class.
+ *
+ * User applications can use this class driver instead of implementing the CDC-ACM class manually
+ * via the low-level USBD_HW and USBD_Core APIs.
+ *
+ * This module is designed to simplify the user code by exposing only the required interface needed to interface with
+ * Devices using the USB CDC-ACM Class.
+ */
+
+/*----------------------------------------------------------------------------
+ We need a buffer for incoming data on USB port because USB receives
+ much faster than UART transmits
+ *---------------------------------------------------------------------------*/
+/* Buffer masks */
+#define CDC_BUF_SIZE (128) /* Output buffer in bytes (power 2) */
+ /* large enough for file transfer */
+#define CDC_BUF_MASK (CDC_BUF_SIZE-1ul)
+
+/** \brief Communication Device Class function driver initialization parameter data structure.
+ * \ingroup USBD_CDC
+ *
+ * \details This data structure is used to pass initialization parameters to the
+ * Communication Device Class function driver's init function.
+ *
+ */
+typedef struct USBD_CDC_INIT_PARAM
+{
+ /* memory allocation params */
+ uint32_t mem_base; /**< Base memory location from where the stack can allocate
+ data and buffers. \note The memory address set in this field
+ should be accessible by USB DMA controller. Also this value
+ should be aligned on 4 byte boundary.
+ */
+ uint32_t mem_size; /**< The size of memory buffer which stack can use.
+ \note The \em mem_size should be greater than the size
+ returned by USBD_CDC_API::GetMemSize() routine.*/
+ /** Pointer to the control interface descriptor within the descriptor
+ * array (\em high_speed_desc) passed to Init() through \ref USB_CORE_DESCS_T
+ * structure. The stack assumes both HS and FS use same BULK endpoints.
+ */
+ uint8_t* cif_intf_desc;
+ /** Pointer to the data interface descriptor within the descriptor
+ * array (\em high_speed_desc) passed to Init() through \ref USB_CORE_DESCS_T
+ * structure. The stack assumes both HS and FS use same BULK endpoints.
+ */
+ uint8_t* dif_intf_desc;
+
+ /* user defined functions */
+
+ /* required functions */
+ /**
+ * Communication Interface Class specific get request call-back function.
+ *
+ * This function is provided by the application software. This function gets called
+ * when host sends CIC management element get requests.
+ * \note Applications implementing Abstract Control Model subclass can set this
+ * param to NULL. As the default driver parses ACM requests and calls the
+ * individual ACM call-back routines defined in this structure. For all other subclasses
+ * this routine should be provided by the application.
+ * \n
+ * The setup packet data (\em pSetup) is passed to the call-back so that application
+ * can extract the CIC request type and other associated data. By default the stack
+ * will assign \em pBuffer pointer to \em EP0Buff allocated at init. The application
+ * code can directly write data into this buffer as long as data is less than 64 byte.
+ * If more data has to be sent then application code should update \em pBuffer pointer
+ * and length accordingly.
+ *
+ *
+ * \param[in] hCdc Handle to CDC function driver.
+ * \param[in] pSetup Pointer to setup packet received from host.
+ * \param[in, out] pBuffer Pointer to a pointer of data buffer containing request data.
+ * Pointer-to-pointer is used to implement zero-copy buffers.
+ * See \ref USBD_ZeroCopy for more details on zero-copy concept.
+ * \param[in, out] length Amount of data to be sent back to host.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*CIC_GetRequest)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t* length);
+
+ /**
+ * Communication Interface Class specific set request call-back function.
+ *
+ * This function is provided by the application software. This function gets called
+ * when host sends a CIC management element requests.
+ * \note Applications implementing Abstract Control Model subclass can set this
+ * param to NULL. As the default driver parses ACM requests and calls the
+ * individual ACM call-back routines defined in this structure. For all other subclasses
+ * this routine should be provided by the application.
+ * \n
+ * The setup packet data (\em pSetup) is passed to the call-back so that application can
+ * extract the CIC request type and other associated data. If a set request has data associated,
+ * then this call-back is called twice.
+ * -# First when setup request is received, at this time application code could update
+ * \em pBuffer pointer to point to the intended destination. The length param is set to 0
+ * so that application code knows this is first time. By default the stack will
+ * assign \em pBuffer pointer to \em EP0Buff allocated at init. Note, if data length is
+ * greater than 64 bytes and application code doesn't update \em pBuffer pointer the
+ * stack will send STALL condition to host.
+ * -# Second when the data is received from the host. This time the length param is set
+ * with number of data bytes received.
+ *
+ * \param[in] hCdc Handle to CDC function driver.
+ * \param[in] pSetup Pointer to setup packet received from host.
+ * \param[in, out] pBuffer Pointer to a pointer of data buffer containing request data.
+ * Pointer-to-pointer is used to implement zero-copy buffers.
+ * See \ref USBD_ZeroCopy for more details on zero-copy concept.
+ * \param[in] length Amount of data copied to destination buffer.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*CIC_SetRequest)( USBD_HANDLE_T hCdc, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t length);
+
+ /**
+ * Communication Device Class specific BULK IN endpoint handler.
+ *
+ * The application software should provide the BULK IN endpoint handler.
+ * Applications should transfer data depending on the communication protocol type set in descriptors.
+ * \n
+ * \note
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] data Pointer to the data which will be passed when callback function is called by the stack.
+ * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*CDC_BulkIN_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event);
+
+ /**
+ * Communication Device Class specific BULK OUT endpoint handler.
+ *
+ * The application software should provide the BULK OUT endpoint handler.
+ * Applications should transfer data depending on the communication protocol type set in descriptors.
+ * \n
+ * \note
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] data Pointer to the data which will be passed when callback function is called by the stack.
+ * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*CDC_BulkOUT_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event);
+
+ /**
+ * Abstract control model(ACM) subclass specific SEND_ENCAPSULATED_COMMAND request call-back function.
+ *
+ * This function is provided by the application software. This function gets called
+ * when host sends a SEND_ENCAPSULATED_COMMAND set request.
+ *
+ * \param[in] hCdc Handle to CDC function driver.
+ * \param[in] buffer Pointer to the command buffer.
+ * \param[in] len Length of the command buffer.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*SendEncpsCmd) (USBD_HANDLE_T hCDC, uint8_t* buffer, uint16_t len);
+
+ /**
+ * Abstract control model(ACM) subclass specific GET_ENCAPSULATED_RESPONSE request call-back function.
+ *
+ * This function is provided by the application software. This function gets called
+ * when host sends a GET_ENCAPSULATED_RESPONSE request.
+ *
+ * \param[in] hCdc Handle to CDC function driver.
+ * \param[in, out] buffer Pointer to a pointer of data buffer containing response data.
+ * Pointer-to-pointer is used to implement zero-copy buffers.
+ * See \ref USBD_ZeroCopy for more details on zero-copy concept.
+ * \param[in, out] len Amount of data to be sent back to host.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*GetEncpsResp) (USBD_HANDLE_T hCDC, uint8_t** buffer, uint16_t* len);
+
+ /**
+ * Abstract control model(ACM) subclass specific SET_COMM_FEATURE request call-back function.
+ *
+ * This function is provided by the application software. This function gets called
+ * when host sends a SET_COMM_FEATURE set request.
+ *
+ * \param[in] hCdc Handle to CDC function driver.
+ * \param[in] feature Communication feature type. See usbcdc11.pdf, section 6.2.4, Table 47.
+ * \param[in] buffer Pointer to the settings buffer for the specified communication feature.
+ * \param[in] len Length of the request buffer.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*SetCommFeature) (USBD_HANDLE_T hCDC, uint16_t feature, uint8_t* buffer, uint16_t len);
+
+ /**
+ * Abstract control model(ACM) subclass specific GET_COMM_FEATURE request call-back function.
+ *
+ * This function is provided by the application software. This function gets called
+ * when host sends a GET_ENCAPSULATED_RESPONSE request.
+ *
+ * \param[in] hCdc Handle to CDC function driver.
+ * \param[in] feature Communication feature type. See usbcdc11.pdf, section 6.2.4, Table 47.
+ * \param[in, out] buffer Pointer to a pointer of data buffer containing current settings
+ * for the communication feature.
+ * Pointer-to-pointer is used to implement zero-copy buffers.
+ * \param[in, out] len Amount of data to be sent back to host.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*GetCommFeature) (USBD_HANDLE_T hCDC, uint16_t feature, uint8_t** pBuffer, uint16_t* len);
+
+ /**
+ * Abstract control model(ACM) subclass specific CLEAR_COMM_FEATURE request call-back function.
+ *
+ * This function is provided by the application software. This function gets called
+ * when host sends a CLEAR_COMM_FEATURE request. In the call-back the application
+ * should Clears the settings for a particular communication feature.
+ *
+ * \param[in] hCdc Handle to CDC function driver.
+ * \param[in] feature Communication feature type. See usbcdc11.pdf, section 6.2.4, Table 47.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*ClrCommFeature) (USBD_HANDLE_T hCDC, uint16_t feature);
+
+ /**
+ * Abstract control model(ACM) subclass specific SET_CONTROL_LINE_STATE request call-back function.
+ *
+ * This function is provided by the application software. This function gets called
+ * when host sends a SET_CONTROL_LINE_STATE request. RS-232 signal used to tell the DCE
+ * device the DTE device is now present
+ *
+ * \param[in] hCdc Handle to CDC function driver.
+ * \param[in] state The state value uses bitmap values defined in usbcdc11.pdf,
+ * section 6.2.14, Table 51.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*SetCtrlLineState) (USBD_HANDLE_T hCDC, uint16_t state);
+
+ /**
+ * Abstract control model(ACM) subclass specific SEND_BREAK request call-back function.
+ *
+ * This function is provided by the application software. This function gets called
+ * when host sends a SEND_BREAK request.
+ *
+ * \param[in] hCdc Handle to CDC function driver.
+ * \param[in] mstime Duration of Break signal in milliseconds. If mstime is FFFFh, then
+ * the application should send break until another SendBreak request is received
+ * with the wValue of 0000h.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*SendBreak) (USBD_HANDLE_T hCDC, uint16_t mstime);
+
+ /**
+ * Abstract control model(ACM) subclass specific SET_LINE_CODING request call-back function.
+ *
+ * This function is provided by the application software. This function gets called
+ * when host sends a SET_LINE_CODING request. The application should configure the device
+ * per DTE rate, stop-bits, parity, and number-of-character bits settings provided in
+ * command buffer. See usbcdc11.pdf, section 6.2.13, table 50 for detail of the command buffer.
+ *
+ * \param[in] hCdc Handle to CDC function driver.
+ * \param[in] line_coding Pointer to the CDC_LINE_CODING command buffer.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*SetLineCode) (USBD_HANDLE_T hCDC, CDC_LINE_CODING* line_coding);
+
+ /**
+ * Optional Communication Device Class specific INTERRUPT IN endpoint handler.
+ *
+ * The application software should provide the INT IN endpoint handler.
+ * Applications should transfer data depending on the communication protocol type set in descriptors.
+ * \n
+ * \note
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] data Pointer to the data which will be passed when callback function is called by the stack.
+ * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*CDC_InterruptEP_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event);
+
+ /**
+ * Optional user override-able function to replace the default CDC class handler.
+ *
+ * The application software could override the default EP0 class handler with their
+ * own by providing the handler function address as this data member of the parameter
+ * structure. Application which like the default handler should set this data member
+ * to zero before calling the USBD_CDC_API::Init().
+ * \n
+ * \note
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] data Pointer to the data which will be passed when callback function is called by the stack.
+ * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*CDC_Ep0_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event);
+
+} USBD_CDC_INIT_PARAM_T;
+
+/** \brief CDC class API functions structure.
+ * \ingroup USBD_CDC
+ *
+ * This module exposes functions which interact directly with USB device controller hardware.
+ *
+ */
+typedef struct USBD_CDC_API
+{
+ /** \fn uint32_t GetMemSize(USBD_CDC_INIT_PARAM_T* param)
+ * Function to determine the memory required by the CDC function driver module.
+ *
+ * This function is called by application layer before calling pUsbApi->CDC->Init(), to allocate memory used
+ * by CDC function driver module. The application should allocate the memory which is accessible by USB
+ * controller/DMA controller.
+ * \note Some memory areas are not accessible by all bus masters.
+ *
+ * \param[in] param Structure containing CDC function driver module initialization parameters.
+ * \return Returns the required memory size in bytes.
+ */
+ uint32_t (*GetMemSize)(USBD_CDC_INIT_PARAM_T* param);
+
+ /** \fn ErrorCode_t init(USBD_HANDLE_T hUsb, USBD_CDC_INIT_PARAM_T* param)
+ * Function to initialize CDC function driver module.
+ *
+ * This function is called by application layer to initialize CDC function driver module.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in, out] param Structure containing CDC function driver module initialization parameters.
+ * \return Returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success
+ * \retval ERR_USBD_BAD_MEM_BUF Memory buffer passed is not 4-byte
+ * aligned or smaller than required.
+ * \retval ERR_API_INVALID_PARAM2 Either CDC_Write() or CDC_Read() or
+ * CDC_Verify() callbacks are not defined.
+ * \retval ERR_USBD_BAD_INTF_DESC Wrong interface descriptor is passed.
+ * \retval ERR_USBD_BAD_EP_DESC Wrong endpoint descriptor is passed.
+ */
+ ErrorCode_t (*init)(USBD_HANDLE_T hUsb, USBD_CDC_INIT_PARAM_T* param, USBD_HANDLE_T* phCDC);
+
+ /** \fn ErrorCode_t SendNotification(USBD_HANDLE_T hCdc, uint8_t bNotification, uint16_t data)
+ * Function to send CDC class notifications to host.
+ *
+ * This function is called by application layer to send CDC class notifications to host.
+ * See usbcdc11.pdf, section 6.3, Table 67 for various notification types the CDC device can send.
+ * \note The current version of the driver only supports following notifications allowed by ACM subclass:
+ * CDC_NOTIFICATION_NETWORK_CONNECTION, CDC_RESPONSE_AVAILABLE, CDC_NOTIFICATION_SERIAL_STATE.
+ * \n
+ * For all other notifications application should construct the notification buffer appropriately
+ * and call hw->USB_WriteEP() for interrupt endpoint associated with the interface.
+ *
+ * \param[in] hCdc Handle to CDC function driver.
+ * \param[in] bNotification Notification type allowed by ACM subclass. Should be CDC_NOTIFICATION_NETWORK_CONNECTION,
+ * CDC_RESPONSE_AVAILABLE or CDC_NOTIFICATION_SERIAL_STATE. For all other types ERR_API_INVALID_PARAM2
+ * is returned. See usbcdc11.pdf, section 3.6.2.1, table 5.
+ * \param[in] data Data associated with notification.
+ * \n For CDC_NOTIFICATION_NETWORK_CONNECTION a non-zero data value is interpreted as connected state.
+ * \n For CDC_RESPONSE_AVAILABLE this parameter is ignored.
+ * \n For CDC_NOTIFICATION_SERIAL_STATE the data should use bitmap values defined in usbcdc11.pdf,
+ * section 6.3.5, Table 69.
+ * \return Returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success
+ * \retval ERR_API_INVALID_PARAM2 If unsupported notification type is passed.
+ *
+ */
+ ErrorCode_t (*SendNotification)(USBD_HANDLE_T hCdc, uint8_t bNotification, uint16_t data);
+
+} USBD_CDC_API_T;
+
+/*-----------------------------------------------------------------------------
+ * Private functions & structures prototypes
+ *-----------------------------------------------------------------------------*/
+/** @cond ADVANCED_API */
+
+typedef struct _CDC_CTRL_T
+{
+ USB_CORE_CTRL_T* pUsbCtrl;
+ /* notification buffer */
+ uint8_t notice_buf[12];
+ CDC_LINE_CODING line_coding;
+ uint8_t pad0;
+
+ uint8_t cif_num; /* control interface number */
+ uint8_t dif_num; /* data interface number */
+ uint8_t epin_num; /* BULK IN endpoint number */
+ uint8_t epout_num; /* BULK OUT endpoint number */
+ uint8_t epint_num; /* Interrupt IN endpoint number */
+ uint8_t pad[3];
+ /* user defined functions */
+ ErrorCode_t (*SendEncpsCmd) (USBD_HANDLE_T hCDC, uint8_t* buffer, uint16_t len);
+ ErrorCode_t (*GetEncpsResp) (USBD_HANDLE_T hCDC, uint8_t** buffer, uint16_t* len);
+ ErrorCode_t (*SetCommFeature) (USBD_HANDLE_T hCDC, uint16_t feature, uint8_t* buffer, uint16_t len);
+ ErrorCode_t (*GetCommFeature) (USBD_HANDLE_T hCDC, uint16_t feature, uint8_t** pBuffer, uint16_t* len);
+ ErrorCode_t (*ClrCommFeature) (USBD_HANDLE_T hCDC, uint16_t feature);
+ ErrorCode_t (*SetCtrlLineState) (USBD_HANDLE_T hCDC, uint16_t state);
+ ErrorCode_t (*SendBreak) (USBD_HANDLE_T hCDC, uint16_t state);
+ ErrorCode_t (*SetLineCode) (USBD_HANDLE_T hCDC, CDC_LINE_CODING* line_coding);
+
+ /* virtual functions */
+ ErrorCode_t (*CIC_GetRequest)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t* length);
+ ErrorCode_t (*CIC_SetRequest)( USBD_HANDLE_T hCdc, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t length);
+
+} USB_CDC_CTRL_T;
+
+/* structure used by old ROM drivers, needed for workaround */
+typedef struct _CDC0_CTRL_T {
+ USB_CORE_CTRL_T *pUsbCtrl;
+ /* notification buffer */
+ uint8_t notice_buf[12];
+ CDC_LINE_CODING line_coding;
+
+ uint8_t cif_num; /* control interface number */
+ uint8_t dif_num; /* data interface number */
+ uint8_t epin_num; /* BULK IN endpoint number */
+ uint8_t epout_num; /* BULK OUT endpoint number */
+ uint8_t epint_num; /* Interrupt IN endpoint number */
+ /* user defined functions */
+ ErrorCode_t (*SendEncpsCmd)(USBD_HANDLE_T hCDC, uint8_t *buffer, uint16_t len);
+ ErrorCode_t (*GetEncpsResp)(USBD_HANDLE_T hCDC, uint8_t * *buffer, uint16_t *len);
+ ErrorCode_t (*SetCommFeature)(USBD_HANDLE_T hCDC, uint16_t feature, uint8_t *buffer, uint16_t len);
+ ErrorCode_t (*GetCommFeature)(USBD_HANDLE_T hCDC, uint16_t feature, uint8_t * *pBuffer, uint16_t *len);
+ ErrorCode_t (*ClrCommFeature)(USBD_HANDLE_T hCDC, uint16_t feature);
+ ErrorCode_t (*SetCtrlLineState)(USBD_HANDLE_T hCDC, uint16_t state);
+ ErrorCode_t (*SendBreak)(USBD_HANDLE_T hCDC, uint16_t state);
+ ErrorCode_t (*SetLineCode)(USBD_HANDLE_T hCDC, CDC_LINE_CODING *line_coding);
+
+ /* virtual functions */
+ ErrorCode_t (*CIC_GetRequest)(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t * *pBuffer, uint16_t *length);
+ ErrorCode_t (*CIC_SetRequest)(USBD_HANDLE_T hCdc, USB_SETUP_PACKET *pSetup, uint8_t * *pBuffer, uint16_t length);
+
+} USB_CDC0_CTRL_T;
+
+typedef ErrorCode_t (*CIC_SetRequest_t)(USBD_HANDLE_T hCdc, USB_SETUP_PACKET *pSetup, uint8_t * *pBuffer, uint16_t length);
+
+/** @cond DIRECT_API */
+extern uint32_t mwCDC_GetMemSize(USBD_CDC_INIT_PARAM_T* param);
+extern ErrorCode_t mwCDC_init(USBD_HANDLE_T hUsb, USBD_CDC_INIT_PARAM_T* param, USBD_HANDLE_T* phCDC);
+extern ErrorCode_t mwCDC_SendNotification (USBD_HANDLE_T hCdc, uint8_t bNotification, uint16_t data);
+/** @endcond */
+
+/** @endcond */
+
+
+
+
+
+#endif /* __CDCUSER_H__ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_core.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_core.h
new file mode 100644
index 0000000..5ff60ff
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_core.h
@@ -0,0 +1,585 @@
+/***********************************************************************
+* $Id:: mw_usbd_core.h 331 2012-08-09 18:54:34Z usb10131 $
+*
+* Project: USB device ROM Stack
+*
+* Description:
+* USB core controller structure definitions and function prototypes.
+*
+***********************************************************************
+* Copyright(C) 2011, NXP Semiconductor
+* All rights reserved.
+*
+* Software that is described herein is for illustrative purposes only
+* which provides customers with programming information regarding the
+* products. This software is supplied "AS IS" without any warranties.
+* NXP Semiconductors assumes no responsibility or liability for the
+* use of the software, conveys no license or title under any patent,
+* copyright, or mask work right to the product. NXP Semiconductors
+* reserves the right to make changes in the software without
+* notification. NXP Semiconductors also make no representation or
+* warranty that such application will be suitable for the specified
+* use without further testing or modification.
+**********************************************************************/
+#ifndef __MW_USBD_CORE_H__
+#define __MW_USBD_CORE_H__
+
+#include "error.h"
+#include "usbd.h"
+#include "app_usbd_cfg.h"
+
+/** \file
+ * \brief ROM API for USB device stack.
+ *
+ * Definition of functions exported by core layer of ROM based USB device stack.
+ *
+ */
+
+/** \ingroup Group_USBD
+ * @defgroup USBD_Core USB Core Layer
+ * \section Sec_CoreModDescription Module Description
+ * The USB Core Layer implements the device abstraction defined in the <em> Universal Serial Bus Specification, </em>
+ * for applications to interact with the USB device interface on the device. The software in this layer responds to
+ * standard requests and returns standard descriptors. In current stack the Init() routine part of
+ * \ref USBD_HW_API_T structure initializes both hardware layer and core layer.
+ */
+
+
+/* function pointer types */
+
+/** \ingroup USBD_Core
+ * \typedef USB_CB_T
+ * \brief USB device stack's event callback function type.
+ *
+ * The USB device stack exposes several event triggers through callback to application layer. The
+ * application layer can register methods to be called when such USB event happens.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx Other error conditions.
+ *
+ */
+typedef ErrorCode_t (*USB_CB_T) (USBD_HANDLE_T hUsb);
+
+/** \ingroup USBD_Core
+ * \typedef USB_PARAM_CB_T
+ * \brief USB device stack's event callback function type.
+ *
+ * The USB device stack exposes several event triggers through callback to application layer. The
+ * application layer can register methods to be called when such USB event happens.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] param1 Extra information related to the event.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+typedef ErrorCode_t (*USB_PARAM_CB_T) (USBD_HANDLE_T hUsb, uint32_t param1);
+
+/** \ingroup USBD_Core
+ * \typedef USB_EP_HANDLER_T
+ * \brief USBD setup request and endpoint event handler type.
+ *
+ * The application layer should define the custom class's EP0 handler with function signature.
+ * The stack calls all the registered class handlers on any EP0 event before going through default
+ * handling of the event. This gives the class handlers to implement class specific request handlers
+ * and also to override the default stack handling for a particular event targeted to the interface.
+ * If an event is not handled by the callback the function should return ERR_USBD_UNHANDLED. For all
+ * other return codes the stack assumes that callback has taken care of the event and hence will not
+ * process the event any further and issues a STALL condition on EP0 indicating error to the host.
+ * \n
+ * For endpoint interrupt handler the return value is ignored by the stack.
+ * \n
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] data Pointer to the data which will be passed when callback function is called by the stack.
+ * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+typedef ErrorCode_t (*USB_EP_HANDLER_T)(USBD_HANDLE_T hUsb, void* data, uint32_t event);
+
+
+/** \ingroup USBD_Core
+ * \brief USB descriptors data structure.
+ * \ingroup USBD_Core
+ *
+ * \details This structure is used as part of USB device stack initialization
+ * parameter structure \ref USBD_API_INIT_PARAM_T. This structure contains
+ * pointers to various descriptor arrays needed by the stack. These descriptors
+ * are reported to USB host as part of enumerations process.
+ *
+ * \note All descriptor pointers assigned in this structure should be on 4 byte
+ * aligned address boundary.
+ */
+typedef struct _USB_CORE_DESCS_T
+{
+ uint8_t *device_desc; /**< Pointer to USB device descriptor */
+ uint8_t *string_desc; /**< Pointer to array of USB string descriptors */
+ uint8_t *full_speed_desc; /**< Pointer to USB device configuration descriptor
+ * when device is operating in full speed mode.
+ */
+ uint8_t *high_speed_desc; /**< Pointer to USB device configuration descriptor
+ * when device is operating in high speed mode. For
+ * full-speed only implementation this pointer should
+ * be same as full_speed_desc.
+ */
+ uint8_t *device_qualifier; /**< Pointer to USB device qualifier descriptor. For
+ * full-speed only implementation this pointer should
+ * be set to null (0).
+ */
+} USB_CORE_DESCS_T;
+
+/** \brief USB device stack initialization parameter data structure.
+ * \ingroup USBD_Core
+ *
+ * \details This data structure is used to pass initialization parameters to the
+ * USB device stack's init function.
+ *
+ */
+typedef struct USBD_API_INIT_PARAM
+{
+ uint32_t usb_reg_base; /**< USB device controller's base register address. */
+ uint32_t mem_base; /**< Base memory location from where the stack can allocate
+ data and buffers. \note The memory address set in this field
+ should be accessible by USB DMA controller. Also this value
+ should be aligned on 2048 byte boundary.
+ */
+ uint32_t mem_size; /**< The size of memory buffer which stack can use.
+ \note The \em mem_size should be greater than the size
+ returned by USBD_HW_API::GetMemSize() routine.*/
+ uint8_t max_num_ep; /**< max number of endpoints supported by the USB device
+ controller instance (specified by \em usb_reg_base field)
+ to which this instance of stack is attached.
+ */
+ uint8_t pad0[3];
+ /* USB Device Events Callback Functions */
+ /** Event for USB interface reset. This event fires when the USB host requests that the device
+ * reset its interface. This event fires after the control endpoint has been automatically
+ * configured by the library.
+ * \n
+ * \note This event is called from USB_ISR context and hence is time-critical. Having delays in this
+ * callback will prevent the device from enumerating correctly or operate properly.
+ *
+ */
+ USB_CB_T USB_Reset_Event;
+
+ /** Event for USB suspend. This event fires when the USB host suspends the device by halting its
+ * transmission of Start Of Frame pulses to the device. This is generally hooked in order to move
+ * the device over to a low power state until the host wakes up the device.
+ * \n
+ * \note This event is called from USB_ISR context and hence is time-critical. Having delays in this
+ * callback will cause other system issues.
+ */
+ USB_CB_T USB_Suspend_Event;
+
+ /** Event for USB wake up or resume. This event fires when a the USB device interface is suspended
+ * and the host wakes up the device by supplying Start Of Frame pulses. This is generally
+ * hooked to pull the user application out of a low power state and back into normal operating
+ * mode.
+ * \n
+ * \note This event is called from USB_ISR context and hence is time-critical. Having delays in this
+ * callback will cause other system issues.
+ *
+ */
+ USB_CB_T USB_Resume_Event;
+
+ /** Reserved parameter should be set to zero. */
+ USB_CB_T reserved_sbz;
+
+ /** Event for USB Start Of Frame detection, when enabled. This event fires at the start of each USB
+ * frame, once per millisecond in full-speed mode or once per 125 microseconds in high-speed mode,
+ * and is synchronized to the USB bus.
+ *
+ * This event is time-critical; it is run once per millisecond (full-speed mode) and thus long handlers
+ * will significantly degrade device performance. This event should only be enabled when needed to
+ * reduce device wake-ups.
+ *
+ * \note This event is not normally active - it must be manually enabled and disabled via the USB interrupt
+ * register.
+ * \n\n
+ */
+ USB_CB_T USB_SOF_Event;
+
+ /** Event for remote wake-up configuration, when enabled. This event fires when the USB host
+ * request the device to configure itself for remote wake-up capability. The USB host sends
+ * this request to device which report remote wake-up capable in their device descriptors,
+ * before going to low-power state. The application layer should implement this callback if
+ * they have any special on board circuit to trigger remote wake up event. Also application
+ * can use this callback to differentiate the following SUSPEND event is caused by cable plug-out
+ * or host SUSPEND request. The device can wake-up host only after receiving this callback and
+ * remote wake-up feature is enabled by host. To signal remote wake-up the device has to generate
+ * resume signaling on bus by calling usapi.hw->WakeUp() routine.
+ *
+ * \n\n
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] param1 When 0 - Clear the wake-up configuration, 1 - Enable the wake-up configuration.
+ * \return The call back should return \ref ErrorCode_t type to indicate success or error condition.
+ */
+ USB_PARAM_CB_T USB_WakeUpCfg;
+
+ /** Reserved parameter should be set to zero. */
+ USB_PARAM_CB_T USB_Power_Event;
+
+ /** Event for error condition. This event fires when USB device controller detect
+ * an error condition in the system.
+ *
+ * \n\n
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] param1 USB device interrupt status register.
+ * \return The call back should return \ref ErrorCode_t type to indicate success or error condition.
+ */
+ USB_PARAM_CB_T USB_Error_Event;
+
+ /* USB Core Events Callback Functions */
+ /** Event for USB configuration number changed. This event fires when a the USB host changes the
+ * selected configuration number. On receiving configuration change request from host, the stack
+ * enables/configures the endpoints needed by the new configuration before calling this callback
+ * function.
+ * \n
+ * \note This event is called from USB_ISR context and hence is time-critical. Having delays in this
+ * callback will prevent the device from enumerating correctly or operate properly.
+ *
+ */
+ USB_CB_T USB_Configure_Event;
+
+ /** Event for USB interface setting changed. This event fires when a the USB host changes the
+ * interface setting to one of alternate interface settings. On receiving interface change
+ * request from host, the stack enables/configures the endpoints needed by the new alternate
+ * interface setting before calling this callback function.
+ * \n
+ * \note This event is called from USB_ISR context and hence is time-critical. Having delays in this
+ * callback will prevent the device from enumerating correctly or operate properly.
+ *
+ */
+ USB_CB_T USB_Interface_Event;
+
+ /** Event for USB feature changed. This event fires when a the USB host send set/clear feature
+ * request. The stack handles this request for USB_FEATURE_REMOTE_WAKEUP, USB_FEATURE_TEST_MODE
+ * and USB_FEATURE_ENDPOINT_STALL features only. On receiving feature request from host, the
+ * stack handle the request appropriately and then calls this callback function.
+ * \n
+ * \note This event is called from USB_ISR context and hence is time-critical. Having delays in this
+ * callback will prevent the device from enumerating correctly or operate properly.
+ *
+ */
+ USB_CB_T USB_Feature_Event;
+
+ /* cache and MMU translation functions */
+ /** Reserved parameter for future use. should be set to zero. */
+ uint32_t (* virt_to_phys)(void* vaddr);
+ /** Reserved parameter for future use. should be set to zero. */
+ void (* cache_flush)(uint32_t* start_adr, uint32_t* end_adr);
+
+} USBD_API_INIT_PARAM_T;
+
+
+/** \brief USBD stack Core API functions structure.
+ * \ingroup USBD_Core
+ *
+ * \details This module exposes functions which interact directly with USB device stack's core layer.
+ * The application layer uses this component when it has to implement custom class function driver or
+ * standard class function driver which is not part of the current USB device stack.
+ * The functions exposed by this interface are to register class specific EP0 handlers and corresponding
+ * utility functions to manipulate EP0 state machine of the stack. This interface also exposes
+ * function to register custom endpoint interrupt handler.
+ *
+ */
+typedef struct USBD_CORE_API
+{
+ /** \fn ErrorCode_t RegisterClassHandler(USBD_HANDLE_T hUsb, USB_EP_HANDLER_T pfn, void* data)
+ * Function to register class specific EP0 event handler with USB device stack.
+ *
+ * The application layer uses this function when it has to register the custom class's EP0 handler.
+ * The stack calls all the registered class handlers on any EP0 event before going through default
+ * handling of the event. This gives the class handlers to implement class specific request handlers
+ * and also to override the default stack handling for a particular event targeted to the interface.
+ * Check \ref USB_EP_HANDLER_T for more details on how the callback function should be implemented. Also
+ * application layer could use this function to register EP0 handler which responds to vendor specific
+ * requests.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] pfn Class specific EP0 handler function.
+ * \param[in] data Pointer to the data which will be passed when callback function is called by the stack.
+ * \return Returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success
+ * \retval ERR_USBD_TOO_MANY_CLASS_HDLR(0x0004000c) The number of class handlers registered is
+ greater than the number of handlers allowed by the stack.
+ *
+ */
+ ErrorCode_t (*RegisterClassHandler)(USBD_HANDLE_T hUsb, USB_EP_HANDLER_T pfn, void* data);
+
+ /** \fn ErrorCode_t RegisterEpHandler(USBD_HANDLE_T hUsb, uint32_t ep_index, USB_EP_HANDLER_T pfn, void* data)
+ * Function to register interrupt/event handler for the requested endpoint with USB device stack.
+ *
+ * The application layer uses this function to register the endpoint event handler.
+ * The stack calls all the registered endpoint handlers when
+ * - USB_EVT_OUT or USB_EVT_OUT_NAK events happen for OUT endpoint.
+ * - USB_EVT_IN or USB_EVT_IN_NAK events happen for IN endpoint.
+ * Check USB_EP_HANDLER_T for more details on how the callback function should be implemented.
+ * \note By default endpoint _NAK events are not enabled. Application should call \ref USBD_HW_API_T::EnableEvent
+ * for the corresponding endpoint.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] ep_index Endpoint index. Computed as
+ * - For OUT endpoints = 2 * endpoint number eg. for EP2_OUT it is 4.
+ * - For IN endopoints = (2 * endpoint number) + 1 eg. for EP2_IN it is 5.
+ * \param[in] pfn Endpoint event handler function.
+ * \param[in] data Pointer to the data which will be passed when callback function is called by the stack.
+ * \return Returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success
+ * \retval ERR_API_INVALID_PARAM2 ep_index is outside the boundary ( < 2 * USBD_API_INIT_PARAM_T::max_num_ep).
+ *
+ */
+ ErrorCode_t (*RegisterEpHandler)(USBD_HANDLE_T hUsb, uint32_t ep_index, USB_EP_HANDLER_T pfn, void* data);
+
+ /** \fn void SetupStage(USBD_HANDLE_T hUsb)
+ * Function to set EP0 state machine in setup state.
+ *
+ * This function is called by USB stack and the application layer to
+ * set the EP0 state machine in setup state. This function will read
+ * the setup packet received from USB host into stack's buffer.
+ * \n
+ * \note This interface is provided to users to invoke this function in other
+ * scenarios which are not handle by current stack. In most user applications
+ * this function is not called directly.Also this function can be used by
+ * users who are selectively modifying the USB device stack's standard handlers
+ * through callback interface exposed by the stack.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \return Nothing.
+ */
+ void (*SetupStage )(USBD_HANDLE_T hUsb);
+
+ /** \fn void DataInStage(USBD_HANDLE_T hUsb)
+ * Function to set EP0 state machine in data_in state.
+ *
+ * This function is called by USB stack and the application layer to
+ * set the EP0 state machine in data_in state. This function will write
+ * the data present in EP0Data buffer to EP0 FIFO for transmission to host.
+ * \n
+ * \note This interface is provided to users to invoke this function in other
+ * scenarios which are not handle by current stack. In most user applications
+ * this function is not called directly.Also this function can be used by
+ * users who are selectively modifying the USB device stack's standard handlers
+ * through callback interface exposed by the stack.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \return Nothing.
+ */
+ void (*DataInStage)(USBD_HANDLE_T hUsb);
+
+ /** \fn void DataOutStage(USBD_HANDLE_T hUsb)
+ * Function to set EP0 state machine in data_out state.
+ *
+ * This function is called by USB stack and the application layer to
+ * set the EP0 state machine in data_out state. This function will read
+ * the control data (EP0 out packets) received from USB host into EP0Data buffer.
+ * \n
+ * \note This interface is provided to users to invoke this function in other
+ * scenarios which are not handle by current stack. In most user applications
+ * this function is not called directly.Also this function can be used by
+ * users who are selectively modifying the USB device stack's standard handlers
+ * through callback interface exposed by the stack.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \return Nothing.
+ */
+ void (*DataOutStage)(USBD_HANDLE_T hUsb);
+
+ /** \fn void StatusInStage(USBD_HANDLE_T hUsb)
+ * Function to set EP0 state machine in status_in state.
+ *
+ * This function is called by USB stack and the application layer to
+ * set the EP0 state machine in status_in state. This function will send
+ * zero length IN packet on EP0 to host, indicating positive status.
+ * \n
+ * \note This interface is provided to users to invoke this function in other
+ * scenarios which are not handle by current stack. In most user applications
+ * this function is not called directly.Also this function can be used by
+ * users who are selectively modifying the USB device stack's standard handlers
+ * through callback interface exposed by the stack.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \return Nothing.
+ */
+ void (*StatusInStage)(USBD_HANDLE_T hUsb);
+ /** \fn void StatusOutStage(USBD_HANDLE_T hUsb)
+ * Function to set EP0 state machine in status_out state.
+ *
+ * This function is called by USB stack and the application layer to
+ * set the EP0 state machine in status_out state. This function will read
+ * the zero length OUT packet received from USB host on EP0.
+ * \n
+ * \note This interface is provided to users to invoke this function in other
+ * scenarios which are not handle by current stack. In most user applications
+ * this function is not called directly.Also this function can be used by
+ * users who are selectively modifying the USB device stack's standard handlers
+ * through callback interface exposed by the stack.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \return Nothing.
+ */
+ void (*StatusOutStage)(USBD_HANDLE_T hUsb);
+
+ /** \fn void StallEp0(USBD_HANDLE_T hUsb)
+ * Function to set EP0 state machine in stall state.
+ *
+ * This function is called by USB stack and the application layer to
+ * generate STALL signaling on EP0 endpoint. This function will also
+ * reset the EP0Data buffer.
+ * \n
+ * \note This interface is provided to users to invoke this function in other
+ * scenarios which are not handle by current stack. In most user applications
+ * this function is not called directly.Also this function can be used by
+ * users who are selectively modifying the USB device stack's standard handlers
+ * through callback interface exposed by the stack.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \return Nothing.
+ */
+ void (*StallEp0)(USBD_HANDLE_T hUsb);
+
+} USBD_CORE_API_T;
+
+/*-----------------------------------------------------------------------------
+ * Private functions & structures prototypes
+ *-----------------------------------------------------------------------------*/
+
+ /** @cond ADVANCED_API */
+
+/* forward declaration */
+struct _USB_CORE_CTRL_T;
+typedef struct _USB_CORE_CTRL_T USB_CORE_CTRL_T;
+
+/* USB device Speed status defines */
+#define USB_FULL_SPEED 0
+#define USB_HIGH_SPEED 1
+
+/* USB Endpoint Data Structure */
+typedef struct _USB_EP_DATA
+{
+ uint8_t *pData;
+ uint16_t Count;
+ uint16_t pad0;
+} USB_EP_DATA;
+
+
+/* USB core controller data structure */
+struct _USB_CORE_CTRL_T
+{
+ /* override-able function pointers ~ c++ style virtual functions*/
+ USB_CB_T USB_EvtSetupHandler;
+ USB_CB_T USB_EvtOutHandler;
+ USB_PARAM_CB_T USB_ReqVendor;
+ USB_CB_T USB_ReqGetStatus;
+ USB_CB_T USB_ReqGetDescriptor;
+ USB_CB_T USB_ReqGetConfiguration;
+ USB_CB_T USB_ReqSetConfiguration;
+ USB_CB_T USB_ReqGetInterface;
+ USB_CB_T USB_ReqSetInterface;
+ USB_PARAM_CB_T USB_ReqSetClrFeature;
+
+ /* USB Device Events Callback Functions */
+ USB_CB_T USB_Reset_Event;
+ USB_CB_T USB_Suspend_Event;
+ USB_CB_T USB_Resume_Event;
+ USB_CB_T USB_SOF_Event;
+ USB_PARAM_CB_T USB_Power_Event;
+ USB_PARAM_CB_T USB_Error_Event;
+ USB_PARAM_CB_T USB_WakeUpCfg;
+
+ /* USB Core Events Callback Functions */
+ USB_CB_T USB_Configure_Event;
+ USB_CB_T USB_Interface_Event;
+ USB_CB_T USB_Feature_Event;
+
+ /* cache and MMU translation functions */
+ uint32_t (* virt_to_phys)(void* vaddr);
+ void (* cache_flush)(uint32_t* start_adr, uint32_t* end_adr);
+
+ /* event handlers for endpoints. */
+ USB_EP_HANDLER_T ep_event_hdlr[2 * USB_MAX_EP_NUM];
+ void* ep_hdlr_data[2 * USB_MAX_EP_NUM];
+
+ /* USB class handlers */
+ USB_EP_HANDLER_T ep0_hdlr_cb[USB_MAX_IF_NUM];
+ void* ep0_cb_data[USB_MAX_IF_NUM];
+ uint8_t num_ep0_hdlrs;
+ /* USB Core data Variables */
+ uint8_t max_num_ep; /* max number of endpoints supported by the HW */
+ uint8_t device_speed;
+ uint8_t num_interfaces;
+ uint8_t device_addr;
+ uint8_t config_value;
+ uint16_t device_status;
+ uint8_t *device_desc;
+ uint8_t *string_desc;
+ uint8_t *full_speed_desc;
+ uint8_t *high_speed_desc;
+ uint8_t *device_qualifier;
+ uint32_t ep_mask;
+ uint32_t ep_halt;
+ uint32_t ep_stall;
+ uint8_t alt_setting[USB_MAX_IF_NUM];
+ /* HW driver data pointer */
+ void* hw_data;
+
+ /* USB Endpoint 0 Data Info */
+ USB_EP_DATA EP0Data;
+
+ /* USB Endpoint 0 Buffer */
+ //ALIGNED(4)
+ uint8_t EP0Buf[64];
+
+ /* USB Setup Packet */
+ //ALIGNED(4)
+ USB_SETUP_PACKET SetupPacket;
+
+};
+
+/* USB Core Functions */
+extern void mwUSB_InitCore(USB_CORE_CTRL_T* pCtrl, USB_CORE_DESCS_T* pdescr, USBD_API_INIT_PARAM_T* param);
+extern void mwUSB_ResetCore(USBD_HANDLE_T hUsb);
+
+/* inline functions */
+static INLINE void USB_SetSpeedMode(USB_CORE_CTRL_T* pCtrl, uint8_t mode)
+{
+ pCtrl->device_speed = mode;
+}
+
+static INLINE bool USB_IsConfigured(USBD_HANDLE_T hUsb)
+{
+ USB_CORE_CTRL_T* pCtrl = (USB_CORE_CTRL_T*) hUsb;
+ return (bool) (pCtrl->config_value != 0);
+}
+
+/** @cond DIRECT_API */
+/* midleware API */
+extern ErrorCode_t mwUSB_RegisterClassHandler(USBD_HANDLE_T hUsb, USB_EP_HANDLER_T pfn, void* data);
+extern ErrorCode_t mwUSB_RegisterEpHandler(USBD_HANDLE_T hUsb, uint32_t ep_index, USB_EP_HANDLER_T pfn, void* data);
+extern void mwUSB_SetupStage (USBD_HANDLE_T hUsb);
+extern void mwUSB_DataInStage(USBD_HANDLE_T hUsb);
+extern void mwUSB_DataOutStage(USBD_HANDLE_T hUsb);
+extern void mwUSB_StatusInStage(USBD_HANDLE_T hUsb);
+extern void mwUSB_StatusOutStage(USBD_HANDLE_T hUsb);
+extern void mwUSB_StallEp0(USBD_HANDLE_T hUsb);
+extern ErrorCode_t mwUSB_RegisterClassHandler(USBD_HANDLE_T hUsb, USB_EP_HANDLER_T pfn, void* data);
+extern ErrorCode_t mwUSB_RegisterEpHandler(USBD_HANDLE_T hUsb, uint32_t ep_index, USB_EP_HANDLER_T pfn, void* data);
+extern void mwUSB_SetupStage (USBD_HANDLE_T hUsb);
+extern void mwUSB_DataInStage(USBD_HANDLE_T hUsb);
+extern void mwUSB_DataOutStage(USBD_HANDLE_T hUsb);
+extern void mwUSB_StatusInStage(USBD_HANDLE_T hUsb);
+extern void mwUSB_StatusOutStage(USBD_HANDLE_T hUsb);
+extern void mwUSB_StallEp0(USBD_HANDLE_T hUsb);
+/** @endcond */
+
+/** @endcond */
+
+#endif /* __MW_USBD_CORE_H__ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_desc.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_desc.h
new file mode 100644
index 0000000..c03f942
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_desc.h
@@ -0,0 +1,48 @@
+/***********************************************************************
+* $Id:: mw_usbd_desc.h 165 2011-04-14 17:41:11Z usb10131 $
+*
+* Project: USB device ROM Stack
+*
+* Description:
+* USB Descriptors Definitions.
+*
+***********************************************************************
+* Copyright(C) 2011, NXP Semiconductor
+* All rights reserved.
+*
+* Software that is described herein is for illustrative purposes only
+* which provides customers with programming information regarding the
+* products. This software is supplied "AS IS" without any warranties.
+* NXP Semiconductors assumes no responsibility or liability for the
+* use of the software, conveys no license or title under any patent,
+* copyright, or mask work right to the product. NXP Semiconductors
+* reserves the right to make changes in the software without
+* notification. NXP Semiconductors also make no representation or
+* warranty that such application will be suitable for the specified
+* use without further testing or modification.
+**********************************************************************/
+
+#ifndef __USBDESC_H__
+#define __USBDESC_H__
+
+#include "usbd.h"
+
+#define WBVAL(x) ((x) & 0xFF),(((x) >> 8) & 0xFF)
+#define B3VAL(x) ((x) & 0xFF),(((x) >> 8) & 0xFF),(((x) >> 16) & 0xFF)
+
+#define USB_DEVICE_DESC_SIZE (sizeof(USB_DEVICE_DESCRIPTOR))
+#define USB_CONFIGUARTION_DESC_SIZE (sizeof(USB_CONFIGURATION_DESCRIPTOR))
+#define USB_INTERFACE_DESC_SIZE (sizeof(USB_INTERFACE_DESCRIPTOR))
+#define USB_ENDPOINT_DESC_SIZE (sizeof(USB_ENDPOINT_DESCRIPTOR))
+#define USB_DEVICE_QUALI_SIZE (sizeof(USB_DEVICE_QUALIFIER_DESCRIPTOR))
+#define USB_OTHER_SPEED_CONF_SIZE (sizeof(USB_OTHER_SPEED_CONFIGURATION))
+
+//#define HID_DESC_SIZE (sizeof(HID_DESCRIPTOR))
+//#define HID_REPORT_DESC_SIZE (sizeof(HID_ReportDescriptor))
+
+extern const uint8_t HID_ReportDescriptor[];
+extern const uint16_t HID_ReportDescSize;
+extern const uint16_t HID_DescOffset;
+
+
+#endif /* __USBDESC_H__ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_dfu.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_dfu.h
new file mode 100644
index 0000000..52134eb
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_dfu.h
@@ -0,0 +1,120 @@
+/***********************************************************************
+* $Id:: mw_usbd_dfu.h 331 2012-08-09 18:54:34Z usb10131 $
+*
+* Project: USB device ROM Stack
+*
+* Description:
+* Device Firmware Upgrade (DFU) module.
+*
+***********************************************************************
+* Copyright(C) 2011, NXP Semiconductor
+* All rights reserved.
+*
+* Software that is described herein is for illustrative purposes only
+* which provides customers with programming information regarding the
+* products. This software is supplied "AS IS" without any warranties.
+* NXP Semiconductors assumes no responsibility or liability for the
+* use of the software, conveys no license or title under any patent,
+* copyright, or mask work right to the product. NXP Semiconductors
+* reserves the right to make changes in the software without
+* notification. NXP Semiconductors also make no representation or
+* warranty that such application will be suitable for the specified
+* use without further testing or modification.
+**********************************************************************/
+#ifndef __MW_USBD_DFU_H__
+#define __MW_USBD_DFU_H__
+
+#include "usbd.h"
+
+/** \file
+ * \brief Device Firmware Upgrade (DFU) class descriptors.
+ *
+ * Definition of DFU class descriptors and their bit defines.
+ *
+ */
+
+/**
+ * If USB device is only DFU capable, DFU Interface number is always 0.
+ * if USB device is (DFU + Other Class (Audio/Mass Storage/HID), DFU
+ * Interface number should also be 0 in this implementation.
+ */
+#define USB_DFU_IF_NUM 0x0
+
+#define USB_DFU_DESCRIPTOR_TYPE 0x21
+#define USB_DFU_DESCRIPTOR_SIZE 9
+#define USB_DFU_SUBCLASS 0x01
+
+/* DFU class-specific requests (Section 3, DFU Rev 1.1) */
+#define USB_REQ_DFU_DETACH 0x00
+#define USB_REQ_DFU_DNLOAD 0x01
+#define USB_REQ_DFU_UPLOAD 0x02
+#define USB_REQ_DFU_GETSTATUS 0x03
+#define USB_REQ_DFU_CLRSTATUS 0x04
+#define USB_REQ_DFU_GETSTATE 0x05
+#define USB_REQ_DFU_ABORT 0x06
+
+#define DFU_STATUS_OK 0x00
+#define DFU_STATUS_errTARGET 0x01
+#define DFU_STATUS_errFILE 0x02
+#define DFU_STATUS_errWRITE 0x03
+#define DFU_STATUS_errERASE 0x04
+#define DFU_STATUS_errCHECK_ERASED 0x05
+#define DFU_STATUS_errPROG 0x06
+#define DFU_STATUS_errVERIFY 0x07
+#define DFU_STATUS_errADDRESS 0x08
+#define DFU_STATUS_errNOTDONE 0x09
+#define DFU_STATUS_errFIRMWARE 0x0a
+#define DFU_STATUS_errVENDOR 0x0b
+#define DFU_STATUS_errUSBR 0x0c
+#define DFU_STATUS_errPOR 0x0d
+#define DFU_STATUS_errUNKNOWN 0x0e
+#define DFU_STATUS_errSTALLEDPKT 0x0f
+
+enum dfu_state {
+ DFU_STATE_appIDLE = 0,
+ DFU_STATE_appDETACH = 1,
+ DFU_STATE_dfuIDLE = 2,
+ DFU_STATE_dfuDNLOAD_SYNC = 3,
+ DFU_STATE_dfuDNBUSY = 4,
+ DFU_STATE_dfuDNLOAD_IDLE = 5,
+ DFU_STATE_dfuMANIFEST_SYNC = 6,
+ DFU_STATE_dfuMANIFEST = 7,
+ DFU_STATE_dfuMANIFEST_WAIT_RST= 8,
+ DFU_STATE_dfuUPLOAD_IDLE = 9,
+ DFU_STATE_dfuERROR = 10
+};
+
+#define DFU_EP0_NONE 0
+#define DFU_EP0_UNHANDLED 1
+#define DFU_EP0_STALL 2
+#define DFU_EP0_ZLP 3
+#define DFU_EP0_DATA 4
+
+#define USB_DFU_CAN_DOWNLOAD (1 << 0)
+#define USB_DFU_CAN_UPLOAD (1 << 1)
+#define USB_DFU_MANIFEST_TOL (1 << 2)
+#define USB_DFU_WILL_DETACH (1 << 3)
+
+PRE_PACK struct POST_PACK _USB_DFU_FUNC_DESCRIPTOR {
+ uint8_t bLength;
+ uint8_t bDescriptorType;
+ uint8_t bmAttributes;
+ uint16_t wDetachTimeOut;
+ uint16_t wTransferSize;
+ uint16_t bcdDFUVersion;
+};
+typedef struct _USB_DFU_FUNC_DESCRIPTOR USB_DFU_FUNC_DESCRIPTOR;
+
+PRE_PACK struct POST_PACK _DFU_STATUS {
+ uint8_t bStatus;
+ uint8_t bwPollTimeout[3];
+ uint8_t bState;
+ uint8_t iString;
+};
+typedef struct _DFU_STATUS DFU_STATUS_T;
+
+#define DFU_FUNC_DESC_SIZE sizeof(USB_DFU_FUNC_DESCRIPTOR)
+#define DFU_GET_STATUS_SIZE 0x6
+
+
+#endif /* __MW_USBD_DFU_H__ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_dfuuser.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_dfuuser.h
new file mode 100644
index 0000000..61cd666
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_dfuuser.h
@@ -0,0 +1,270 @@
+/***********************************************************************
+* $Id:: mw_usbd_dfuuser.h 331 2012-08-09 18:54:34Z usb10131 $
+*
+* Project: USB device ROM Stack
+*
+* Description:
+* Device Firmware Upgrade Class Custom User Module Definitions.
+*
+***********************************************************************
+* Copyright(C) 2011, NXP Semiconductor
+* All rights reserved.
+*
+* Software that is described herein is for illustrative purposes only
+* which provides customers with programming information regarding the
+* products. This software is supplied "AS IS" without any warranties.
+* NXP Semiconductors assumes no responsibility or liability for the
+* use of the software, conveys no license or title under any patent,
+* copyright, or mask work right to the product. NXP Semiconductors
+* reserves the right to make changes in the software without
+* notification. NXP Semiconductors also make no representation or
+* warranty that such application will be suitable for the specified
+* use without further testing or modification.
+**********************************************************************/
+
+#ifndef __DFUUSER_H__
+#define __DFUUSER_H__
+
+#include "usbd.h"
+#include "usbd_dfu.h"
+#include "usbd_core.h"
+
+/** \file
+ * \brief Device Firmware Upgrade (DFU) API structures and function prototypes.
+ *
+ * Definition of functions exported by ROM based DFU function driver.
+ *
+ */
+
+
+/** \ingroup Group_USBD
+ * @defgroup USBD_DFU Device Firmware Upgrade (DFU) Class Function Driver
+ * \section Sec_MSCModDescription Module Description
+ * DFU Class Function Driver module. This module contains an internal implementation of the USB DFU Class.
+ * User applications can use this class driver instead of implementing the DFU class manually
+ * via the low-level USBD_HW and USBD_Core APIs.
+ *
+ * This module is designed to simplify the user code by exposing only the required interface needed to interface with
+ * Devices using the USB DFU Class.
+ */
+
+/** \brief USB descriptors data structure.
+ * \ingroup USBD_DFU
+ *
+ * \details This module exposes functions which interact directly with USB device stack's core layer.
+ * The application layer uses this component when it has to implement custom class function driver or
+ * standard class function driver which is not part of the current USB device stack.
+ * The functions exposed by this interface are to register class specific EP0 handlers and corresponding
+ * utility functions to manipulate EP0 state machine of the stack. This interface also exposes
+ * function to register custom endpoint interrupt handler.
+ *
+ */
+typedef struct USBD_DFU_INIT_PARAM
+{
+ /* memory allocation params */
+ uint32_t mem_base; /**< Base memory location from where the stack can allocate
+ data and buffers. \note The memory address set in this field
+ should be accessible by USB DMA controller. Also this value
+ should be aligned on 4 byte boundary.
+ */
+ uint32_t mem_size; /**< The size of memory buffer which stack can use.
+ \note The \em mem_size should be greater than the size
+ returned by USBD_DFU_API::GetMemSize() routine.*/
+ /* DFU paramas */
+ uint16_t wTransferSize; /**< DFU transfer block size in number of bytes.
+ This value should match the value set in DFU descriptor
+ provided as part of the descriptor array
+ (\em high_speed_desc) passed to Init() through
+ \ref USB_CORE_DESCS_T structure. */
+
+ uint16_t pad;
+ /** Pointer to the DFU interface descriptor within the descriptor
+ * array (\em high_speed_desc) passed to Init() through \ref USB_CORE_DESCS_T
+ * structure.
+ */
+ uint8_t* intf_desc;
+ /* user defined functions */
+ /**
+ * DFU Write callback function.
+ *
+ * This function is provided by the application software. This function gets called
+ * when host sends a write command. For application using zero-copy buffer scheme
+ * this function is called for the first time with \em length parameter set to 0.
+ * The application code should update the buffer pointer.
+ *
+ * \param[in] block_num Destination start address.
+ * \param[in, out] src Pointer to a pointer to the source of data. Pointer-to-pointer
+ * is used to implement zero-copy buffers. See \ref USBD_ZeroCopy
+ * for more details on zero-copy concept.
+ * \param[out] bwPollTimeout Pointer to a 3 byte buffer which the callback implementer
+ * should fill with the amount of minimum time, in milliseconds,
+ * that the host should wait before sending a subsequent
+ * DFU_GETSTATUS request.
+ * \param[in] length Number of bytes to be written.
+ * \return Returns DFU_STATUS_ values defined in mw_usbd_dfu.h.
+ *
+ */
+ uint8_t (*DFU_Write)( uint32_t block_num, uint8_t** src, uint32_t length, uint8_t* bwPollTimeout);
+
+ /**
+ * DFU Read callback function.
+ *
+ * This function is provided by the application software. This function gets called
+ * when host sends a read command.
+ *
+ * \param[in] block_num Destination start address.
+ * \param[in, out] dst Pointer to a pointer to the source of data. Pointer-to-pointer
+ * is used to implement zero-copy buffers. See \ref USBD_ZeroCopy
+ * for more details on zero-copy concept.
+ * \param[in] length Amount of data copied to destination buffer.
+ * \return Returns
+ * - DFU_STATUS_ values defined in mw_usbd_dfu.h to return error conditions.
+ * - 0 if there is no more data to be read. Stack will send EOF frame and set
+ * DFU state-machine to dfuIdle state.
+ * - length of the data copied, should be greater than or equal to 16. If the data copied
+ * is less than DFU \em wTransferSize the stack will send EOF frame and
+ * goes to dfuIdle state.
+ *
+ */
+ uint32_t (*DFU_Read)( uint32_t block_num, uint8_t** dst, uint32_t length);
+
+ /**
+ * DFU done callback function.
+ *
+ * This function is provided by the application software. This function gets called
+ * after firmware download completes.
+ *
+ * \return Nothing.
+ *
+ */
+ void (*DFU_Done)(void);
+
+ /**
+ * DFU detach callback function.
+ *
+ * This function is provided by the application software. This function gets called
+ * after USB_REQ_DFU_DETACH is received. Applications which set USB_DFU_WILL_DETACH
+ * bit in DFU descriptor should define this function. As part of this function
+ * application can call Connect() routine to disconnect and then connect back with
+ * host. For application which rely on WinUSB based host application should use this
+ * feature since USB reset can be invoked only by kernel drivers on Windows host.
+ * By implementing this feature host doen't have to issue reset instead the device
+ * has to do it automatically by disconnect and connect procedure.
+ *
+ * \param[in] hUsb Handle DFU control structure.
+ * \return Nothing.
+ *
+ */
+ void (*DFU_Detach)(USBD_HANDLE_T hUsb);
+
+ /**
+ * Optional user override-able function to replace the default DFU class handler.
+ *
+ * The application software could override the default EP0 class handler with their
+ * own by providing the handler function address as this data member of the parameter
+ * structure. Application which like the default handler should set this data member
+ * to zero before calling the USBD_DFU_API::Init().
+ * \n
+ * \note
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] data Pointer to the data which will be passed when callback function is called by the stack.
+ * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*DFU_Ep0_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event);
+
+} USBD_DFU_INIT_PARAM_T;
+
+
+/** \brief DFU class API functions structure.
+ * \ingroup USBD_DFU
+ *
+ * This module exposes functions which interact directly with USB device controller hardware.
+ *
+ */
+typedef struct USBD_DFU_API
+{
+ /** \fn uint32_t GetMemSize(USBD_DFU_INIT_PARAM_T* param)
+ * Function to determine the memory required by the DFU function driver module.
+ *
+ * This function is called by application layer before calling pUsbApi->dfu->Init(), to allocate memory used
+ * by DFU function driver module. The application should allocate the memory which is accessible by USB
+ * controller/DMA controller.
+ * \note Some memory areas are not accessible by all bus masters.
+ *
+ * \param[in] param Structure containing DFU function driver module initialization parameters.
+ * \return Returns the required memory size in bytes.
+ */
+ uint32_t (*GetMemSize)(USBD_DFU_INIT_PARAM_T* param);
+
+ /** \fn ErrorCode_t init(USBD_HANDLE_T hUsb, USBD_DFU_INIT_PARAM_T* param)
+ * Function to initialize DFU function driver module.
+ *
+ * This function is called by application layer to initialize DFU function driver module.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in, out] param Structure containing DFU function driver module initialization parameters.
+ * \return Returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success
+ * \retval ERR_USBD_BAD_MEM_BUF Memory buffer passed is not 4-byte aligned or smaller than required.
+ * \retval ERR_API_INVALID_PARAM2 Either DFU_Write() or DFU_Done() or DFU_Read() call-backs are not defined.
+ * \retval ERR_USBD_BAD_DESC
+ * - USB_DFU_DESCRIPTOR_TYPE is not defined immediately after
+ * interface descriptor.
+ * - wTransferSize in descriptor doesn't match the value passed
+ * in param->wTransferSize.
+ * - DFU_Detach() is not defined while USB_DFU_WILL_DETACH is set
+ * in DFU descriptor.
+ * \retval ERR_USBD_BAD_INTF_DESC Wrong interface descriptor is passed.
+ */
+ ErrorCode_t (*init)(USBD_HANDLE_T hUsb, USBD_DFU_INIT_PARAM_T* param, uint32_t init_state);
+
+} USBD_DFU_API_T;
+
+/*-----------------------------------------------------------------------------
+ * Private functions & structures prototypes
+ *-----------------------------------------------------------------------------*/
+/** @cond ADVANCED_API */
+
+typedef struct _USBD_DFU_CTRL_T
+{
+ /*ALIGNED(4)*/ DFU_STATUS_T dfu_req_get_status;
+ uint16_t pad;
+ uint8_t dfu_state;
+ uint8_t dfu_status;
+ uint8_t download_done;
+ uint8_t if_num; /* interface number */
+
+ uint8_t* xfr_buf;
+ USB_DFU_FUNC_DESCRIPTOR* dfu_desc;
+
+ USB_CORE_CTRL_T* pUsbCtrl;
+ /* user defined functions */
+ /* return DFU_STATUS_ values defined in mw_usbd_dfu.h */
+ uint8_t (*DFU_Write)( uint32_t block_num, uint8_t** src, uint32_t length, uint8_t* bwPollTimeout);
+ /* return
+ * DFU_STATUS_ : values defined in mw_usbd_dfu.h in case of errors
+ * 0 : If end of memory reached
+ * length : Amount of data copied to destination buffer
+ */
+ uint32_t (*DFU_Read)( uint32_t block_num, uint8_t** dst, uint32_t length);
+ /* callback called after download is finished */
+ void (*DFU_Done)(void);
+ /* callback called after USB_REQ_DFU_DETACH is recived */
+ void (*DFU_Detach)(USBD_HANDLE_T hUsb);
+
+} USBD_DFU_CTRL_T;
+
+/** @cond DIRECT_API */
+uint32_t mwDFU_GetMemSize(USBD_DFU_INIT_PARAM_T* param);
+extern ErrorCode_t mwDFU_init(USBD_HANDLE_T hUsb, USBD_DFU_INIT_PARAM_T* param, uint32_t init_state);
+/** @endcond */
+
+/** @endcond */
+
+#endif /* __DFUUSER_H__ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_hid.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_hid.h
new file mode 100644
index 0000000..5d801ac
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_hid.h
@@ -0,0 +1,430 @@
+/***********************************************************************
+* $Id: mw_usbd_hid.h.rca 1.2 Tue Nov 1 11:45:07 2011 nlv09221 Experimental $
+*
+* Project: USB device ROM Stack
+*
+* Description:
+* HID Definitions.
+*
+***********************************************************************
+* Copyright(C) 2011, NXP Semiconductor
+* All rights reserved.
+*
+* Software that is described herein is for illustrative purposes only
+* which provides customers with programming information regarding the
+* products. This software is supplied "AS IS" without any warranties.
+* NXP Semiconductors assumes no responsibility or liability for the
+* use of the software, conveys no license or title under any patent,
+* copyright, or mask work right to the product. NXP Semiconductors
+* reserves the right to make changes in the software without
+* notification. NXP Semiconductors also make no representation or
+* warranty that such application will be suitable for the specified
+* use without further testing or modification.
+**********************************************************************/
+#ifndef __HID_H__
+#define __HID_H__
+
+#include "usbd.h"
+
+/** \file
+ * \brief Common definitions and declarations for the library USB HID Class driver.
+ *
+ * Common definitions and declarations for the library USB HID Class driver.
+ * \addtogroup USBD_HID
+ * @{
+ */
+
+
+/** HID Subclass Codes
+ * @{
+ */
+/** Descriptor Subclass value indicating that the device or interface does not implement a HID boot protocol. */
+#define HID_SUBCLASS_NONE 0x00
+/** Descriptor Subclass value indicating that the device or interface implements a HID boot protocol. */
+#define HID_SUBCLASS_BOOT 0x01
+/** @} */
+
+/** HID Protocol Codes
+ * @{
+ */
+/** Descriptor Protocol value indicating that the device or interface does not belong to a HID boot protocol. */
+#define HID_PROTOCOL_NONE 0x00
+/** Descriptor Protocol value indicating that the device or interface belongs to the Keyboard HID boot protocol. */
+#define HID_PROTOCOL_KEYBOARD 0x01
+/** Descriptor Protocol value indicating that the device or interface belongs to the Mouse HID boot protocol. */
+#define HID_PROTOCOL_MOUSE 0x02
+/** @} */
+
+
+
+/** Descriptor Types
+ * @{
+ */
+/** Descriptor header type value, to indicate a HID class HID descriptor. */
+#define HID_HID_DESCRIPTOR_TYPE 0x21
+/** Descriptor header type value, to indicate a HID class HID report descriptor. */
+#define HID_REPORT_DESCRIPTOR_TYPE 0x22
+/** Descriptor header type value, to indicate a HID class HID Physical descriptor. */
+#define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23
+/** @} */
+
+
+/** \brief HID class-specific HID Descriptor.
+ *
+ * Type define for the HID class-specific HID descriptor, to describe the HID device's specifications. Refer to the HID
+ * specification for details on the structure elements.
+ *
+ */
+PRE_PACK struct POST_PACK _HID_DESCRIPTOR {
+ uint8_t bLength; /**< Size of the descriptor, in bytes. */
+ uint8_t bDescriptorType; /**< Type of HID descriptor. */
+ uint16_t bcdHID; /**< BCD encoded version that the HID descriptor and device complies to. */
+ uint8_t bCountryCode; /**< Country code of the localized device, or zero if universal. */
+ uint8_t bNumDescriptors; /**< Total number of HID report descriptors for the interface. */
+
+ PRE_PACK struct POST_PACK _HID_DESCRIPTOR_LIST {
+ uint8_t bDescriptorType; /**< Type of HID report. */
+ uint16_t wDescriptorLength; /**< Length of the associated HID report descriptor, in bytes. */
+ } DescriptorList[1]; /**< Array of one or more descriptors */
+} ;
+/** HID class-specific HID Descriptor. */
+typedef struct _HID_DESCRIPTOR HID_DESCRIPTOR;
+
+#define HID_DESC_SIZE sizeof(HID_DESCRIPTOR)
+
+/** HID Request Codes
+ * @{
+ */
+#define HID_REQUEST_GET_REPORT 0x01
+#define HID_REQUEST_GET_IDLE 0x02
+#define HID_REQUEST_GET_PROTOCOL 0x03
+#define HID_REQUEST_SET_REPORT 0x09
+#define HID_REQUEST_SET_IDLE 0x0A
+#define HID_REQUEST_SET_PROTOCOL 0x0B
+/** @} */
+
+/** HID Report Types
+ * @{
+ */
+#define HID_REPORT_INPUT 0x01
+#define HID_REPORT_OUTPUT 0x02
+#define HID_REPORT_FEATURE 0x03
+/** @} */
+
+
+/** Usage Pages
+ * @{
+ */
+#define HID_USAGE_PAGE_UNDEFINED 0x00
+#define HID_USAGE_PAGE_GENERIC 0x01
+#define HID_USAGE_PAGE_SIMULATION 0x02
+#define HID_USAGE_PAGE_VR 0x03
+#define HID_USAGE_PAGE_SPORT 0x04
+#define HID_USAGE_PAGE_GAME 0x05
+#define HID_USAGE_PAGE_DEV_CONTROLS 0x06
+#define HID_USAGE_PAGE_KEYBOARD 0x07
+#define HID_USAGE_PAGE_LED 0x08
+#define HID_USAGE_PAGE_BUTTON 0x09
+#define HID_USAGE_PAGE_ORDINAL 0x0A
+#define HID_USAGE_PAGE_TELEPHONY 0x0B
+#define HID_USAGE_PAGE_CONSUMER 0x0C
+#define HID_USAGE_PAGE_DIGITIZER 0x0D
+#define HID_USAGE_PAGE_UNICODE 0x10
+#define HID_USAGE_PAGE_ALPHANUMERIC 0x14
+/** @} */
+
+
+/** Generic Desktop Page (0x01)
+ * @{
+ */
+#define HID_USAGE_GENERIC_POINTER 0x01
+#define HID_USAGE_GENERIC_MOUSE 0x02
+#define HID_USAGE_GENERIC_JOYSTICK 0x04
+#define HID_USAGE_GENERIC_GAMEPAD 0x05
+#define HID_USAGE_GENERIC_KEYBOARD 0x06
+#define HID_USAGE_GENERIC_KEYPAD 0x07
+#define HID_USAGE_GENERIC_X 0x30
+#define HID_USAGE_GENERIC_Y 0x31
+#define HID_USAGE_GENERIC_Z 0x32
+#define HID_USAGE_GENERIC_RX 0x33
+#define HID_USAGE_GENERIC_RY 0x34
+#define HID_USAGE_GENERIC_RZ 0x35
+#define HID_USAGE_GENERIC_SLIDER 0x36
+#define HID_USAGE_GENERIC_DIAL 0x37
+#define HID_USAGE_GENERIC_WHEEL 0x38
+#define HID_USAGE_GENERIC_HATSWITCH 0x39
+#define HID_USAGE_GENERIC_COUNTED_BUFFER 0x3A
+#define HID_USAGE_GENERIC_BYTE_COUNT 0x3B
+#define HID_USAGE_GENERIC_MOTION_WAKEUP 0x3C
+#define HID_USAGE_GENERIC_VX 0x40
+#define HID_USAGE_GENERIC_VY 0x41
+#define HID_USAGE_GENERIC_VZ 0x42
+#define HID_USAGE_GENERIC_VBRX 0x43
+#define HID_USAGE_GENERIC_VBRY 0x44
+#define HID_USAGE_GENERIC_VBRZ 0x45
+#define HID_USAGE_GENERIC_VNO 0x46
+#define HID_USAGE_GENERIC_SYSTEM_CTL 0x80
+#define HID_USAGE_GENERIC_SYSCTL_POWER 0x81
+#define HID_USAGE_GENERIC_SYSCTL_SLEEP 0x82
+#define HID_USAGE_GENERIC_SYSCTL_WAKE 0x83
+#define HID_USAGE_GENERIC_SYSCTL_CONTEXT_MENU 0x84
+#define HID_USAGE_GENERIC_SYSCTL_MAIN_MENU 0x85
+#define HID_USAGE_GENERIC_SYSCTL_APP_MENU 0x86
+#define HID_USAGE_GENERIC_SYSCTL_HELP_MENU 0x87
+#define HID_USAGE_GENERIC_SYSCTL_MENU_EXIT 0x88
+#define HID_USAGE_GENERIC_SYSCTL_MENU_SELECT 0x89
+#define HID_USAGE_GENERIC_SYSCTL_MENU_RIGHT 0x8A
+#define HID_USAGE_GENERIC_SYSCTL_MENU_LEFT 0x8B
+#define HID_USAGE_GENERIC_SYSCTL_MENU_UP 0x8C
+#define HID_USAGE_GENERIC_SYSCTL_MENU_DOWN 0x8D
+/** @} */
+
+/** Simulation Controls Page (0x02)
+ * @{
+ */
+#define HID_USAGE_SIMULATION_RUDDER 0xBA
+#define HID_USAGE_SIMULATION_THROTTLE 0xBB
+/** @} */
+
+/* Virtual Reality Controls Page (0x03) */
+/* ... */
+
+/* Sport Controls Page (0x04) */
+/* ... */
+
+/* Game Controls Page (0x05) */
+/* ... */
+
+/* Generic Device Controls Page (0x06) */
+/* ... */
+
+/** Keyboard/Keypad Page (0x07)
+ * @{
+ */
+/** Error "keys" */
+#define HID_USAGE_KEYBOARD_NOEVENT 0x00
+#define HID_USAGE_KEYBOARD_ROLLOVER 0x01
+#define HID_USAGE_KEYBOARD_POSTFAIL 0x02
+#define HID_USAGE_KEYBOARD_UNDEFINED 0x03
+
+/** Letters */
+#define HID_USAGE_KEYBOARD_aA 0x04
+#define HID_USAGE_KEYBOARD_zZ 0x1D
+
+/** Numbers */
+#define HID_USAGE_KEYBOARD_ONE 0x1E
+#define HID_USAGE_KEYBOARD_ZERO 0x27
+
+#define HID_USAGE_KEYBOARD_RETURN 0x28
+#define HID_USAGE_KEYBOARD_ESCAPE 0x29
+#define HID_USAGE_KEYBOARD_DELETE 0x2A
+
+/** Funtion keys */
+#define HID_USAGE_KEYBOARD_F1 0x3A
+#define HID_USAGE_KEYBOARD_F12 0x45
+
+#define HID_USAGE_KEYBOARD_PRINT_SCREEN 0x46
+
+/** Modifier Keys */
+#define HID_USAGE_KEYBOARD_LCTRL 0xE0
+#define HID_USAGE_KEYBOARD_LSHFT 0xE1
+#define HID_USAGE_KEYBOARD_LALT 0xE2
+#define HID_USAGE_KEYBOARD_LGUI 0xE3
+#define HID_USAGE_KEYBOARD_RCTRL 0xE4
+#define HID_USAGE_KEYBOARD_RSHFT 0xE5
+#define HID_USAGE_KEYBOARD_RALT 0xE6
+#define HID_USAGE_KEYBOARD_RGUI 0xE7
+#define HID_USAGE_KEYBOARD_SCROLL_LOCK 0x47
+#define HID_USAGE_KEYBOARD_NUM_LOCK 0x53
+#define HID_USAGE_KEYBOARD_CAPS_LOCK 0x39
+/** @} */
+
+/* ... */
+
+/** LED Page (0x08)
+ * @{
+ */
+#define HID_USAGE_LED_NUM_LOCK 0x01
+#define HID_USAGE_LED_CAPS_LOCK 0x02
+#define HID_USAGE_LED_SCROLL_LOCK 0x03
+#define HID_USAGE_LED_COMPOSE 0x04
+#define HID_USAGE_LED_KANA 0x05
+#define HID_USAGE_LED_POWER 0x06
+#define HID_USAGE_LED_SHIFT 0x07
+#define HID_USAGE_LED_DO_NOT_DISTURB 0x08
+#define HID_USAGE_LED_MUTE 0x09
+#define HID_USAGE_LED_TONE_ENABLE 0x0A
+#define HID_USAGE_LED_HIGH_CUT_FILTER 0x0B
+#define HID_USAGE_LED_LOW_CUT_FILTER 0x0C
+#define HID_USAGE_LED_EQUALIZER_ENABLE 0x0D
+#define HID_USAGE_LED_SOUND_FIELD_ON 0x0E
+#define HID_USAGE_LED_SURROUND_FIELD_ON 0x0F
+#define HID_USAGE_LED_REPEAT 0x10
+#define HID_USAGE_LED_STEREO 0x11
+#define HID_USAGE_LED_SAMPLING_RATE_DETECT 0x12
+#define HID_USAGE_LED_SPINNING 0x13
+#define HID_USAGE_LED_CAV 0x14
+#define HID_USAGE_LED_CLV 0x15
+#define HID_USAGE_LED_RECORDING_FORMAT_DET 0x16
+#define HID_USAGE_LED_OFF_HOOK 0x17
+#define HID_USAGE_LED_RING 0x18
+#define HID_USAGE_LED_MESSAGE_WAITING 0x19
+#define HID_USAGE_LED_DATA_MODE 0x1A
+#define HID_USAGE_LED_BATTERY_OPERATION 0x1B
+#define HID_USAGE_LED_BATTERY_OK 0x1C
+#define HID_USAGE_LED_BATTERY_LOW 0x1D
+#define HID_USAGE_LED_SPEAKER 0x1E
+#define HID_USAGE_LED_HEAD_SET 0x1F
+#define HID_USAGE_LED_HOLD 0x20
+#define HID_USAGE_LED_MICROPHONE 0x21
+#define HID_USAGE_LED_COVERAGE 0x22
+#define HID_USAGE_LED_NIGHT_MODE 0x23
+#define HID_USAGE_LED_SEND_CALLS 0x24
+#define HID_USAGE_LED_CALL_PICKUP 0x25
+#define HID_USAGE_LED_CONFERENCE 0x26
+#define HID_USAGE_LED_STAND_BY 0x27
+#define HID_USAGE_LED_CAMERA_ON 0x28
+#define HID_USAGE_LED_CAMERA_OFF 0x29
+#define HID_USAGE_LED_ON_LINE 0x2A
+#define HID_USAGE_LED_OFF_LINE 0x2B
+#define HID_USAGE_LED_BUSY 0x2C
+#define HID_USAGE_LED_READY 0x2D
+#define HID_USAGE_LED_PAPER_OUT 0x2E
+#define HID_USAGE_LED_PAPER_JAM 0x2F
+#define HID_USAGE_LED_REMOTE 0x30
+#define HID_USAGE_LED_FORWARD 0x31
+#define HID_USAGE_LED_REVERSE 0x32
+#define HID_USAGE_LED_STOP 0x33
+#define HID_USAGE_LED_REWIND 0x34
+#define HID_USAGE_LED_FAST_FORWARD 0x35
+#define HID_USAGE_LED_PLAY 0x36
+#define HID_USAGE_LED_PAUSE 0x37
+#define HID_USAGE_LED_RECORD 0x38
+#define HID_USAGE_LED_ERROR 0x39
+#define HID_USAGE_LED_SELECTED_INDICATOR 0x3A
+#define HID_USAGE_LED_IN_USE_INDICATOR 0x3B
+#define HID_USAGE_LED_MULTI_MODE_INDICATOR 0x3C
+#define HID_USAGE_LED_INDICATOR_ON 0x3D
+#define HID_USAGE_LED_INDICATOR_FLASH 0x3E
+#define HID_USAGE_LED_INDICATOR_SLOW_BLINK 0x3F
+#define HID_USAGE_LED_INDICATOR_FAST_BLINK 0x40
+#define HID_USAGE_LED_INDICATOR_OFF 0x41
+#define HID_USAGE_LED_FLASH_ON_TIME 0x42
+#define HID_USAGE_LED_SLOW_BLINK_ON_TIME 0x43
+#define HID_USAGE_LED_SLOW_BLINK_OFF_TIME 0x44
+#define HID_USAGE_LED_FAST_BLINK_ON_TIME 0x45
+#define HID_USAGE_LED_FAST_BLINK_OFF_TIME 0x46
+#define HID_USAGE_LED_INDICATOR_COLOR 0x47
+#define HID_USAGE_LED_RED 0x48
+#define HID_USAGE_LED_GREEN 0x49
+#define HID_USAGE_LED_AMBER 0x4A
+#define HID_USAGE_LED_GENERIC_INDICATOR 0x4B
+/** @} */
+
+/* Button Page (0x09)
+ */
+/* There is no need to label these usages. */
+
+/* Ordinal Page (0x0A)
+ */
+/* There is no need to label these usages. */
+
+/** Telephony Device Page (0x0B)
+ * @{
+ */
+#define HID_USAGE_TELEPHONY_PHONE 0x01
+#define HID_USAGE_TELEPHONY_ANSWERING_MACHINE 0x02
+#define HID_USAGE_TELEPHONY_MESSAGE_CONTROLS 0x03
+#define HID_USAGE_TELEPHONY_HANDSET 0x04
+#define HID_USAGE_TELEPHONY_HEADSET 0x05
+#define HID_USAGE_TELEPHONY_KEYPAD 0x06
+#define HID_USAGE_TELEPHONY_PROGRAMMABLE_BUTTON 0x07
+/** @} */
+/* ... */
+
+/** Consumer Page (0x0C)
+ * @{
+ */
+#define HID_USAGE_CONSUMER_CONTROL 0x01
+#define HID_USAGE_CONSUMER_FAST_FORWARD 0xB3
+#define HID_USAGE_CONSUMER_REWIND 0xB4
+#define HID_USAGE_CONSUMER_PLAY_PAUSE 0xCD
+#define HID_USAGE_CONSUMER_VOLUME_INCREMENT 0xE9
+#define HID_USAGE_CONSUMER_VOLUME_DECREMENT 0xEA
+/** @} */
+/* ... */
+
+/* and others ... */
+
+
+/** HID Report Item Macros
+ * @{
+ */
+/** Main Items */
+#define HID_Input(x) 0x81,x
+#define HID_Output(x) 0x91,x
+#define HID_Feature(x) 0xB1,x
+#define HID_Collection(x) 0xA1,x
+#define HID_EndCollection 0xC0
+
+/** Data (Input, Output, Feature) */
+#define HID_Data 0<<0
+#define HID_Constant 1<<0
+#define HID_Array 0<<1
+#define HID_Variable 1<<1
+#define HID_Absolute 0<<2
+#define HID_Relative 1<<2
+#define HID_NoWrap 0<<3
+#define HID_Wrap 1<<3
+#define HID_Linear 0<<4
+#define HID_NonLinear 1<<4
+#define HID_PreferredState 0<<5
+#define HID_NoPreferred 1<<5
+#define HID_NoNullPosition 0<<6
+#define HID_NullState 1<<6
+#define HID_NonVolatile 0<<7
+#define HID_Volatile 1<<7
+
+/** Collection Data */
+#define HID_Physical 0x00
+#define HID_Application 0x01
+#define HID_Logical 0x02
+#define HID_Report 0x03
+#define HID_NamedArray 0x04
+#define HID_UsageSwitch 0x05
+#define HID_UsageModifier 0x06
+
+/** Global Items */
+#define HID_UsagePage(x) 0x05,x
+#define HID_UsagePageVendor(x) 0x06,x,0xFF
+#define HID_LogicalMin(x) 0x15,x
+#define HID_LogicalMinS(x) 0x16,(x&0xFF),((x>>8)&0xFF)
+#define HID_LogicalMinL(x) 0x17,(x&0xFF),((x>>8)&0xFF),((x>>16)&0xFF),((x>>24)&0xFF)
+#define HID_LogicalMax(x) 0x25,x
+#define HID_LogicalMaxS(x) 0x26,(x&0xFF),((x>>8)&0xFF)
+#define HID_LogicalMaxL(x) 0x27,(x&0xFF),((x>>8)&0xFF),((x>>16)&0xFF),((x>>24)&0xFF)
+#define HID_PhysicalMin(x) 0x35,x
+#define HID_PhysicalMinS(x) 0x36,(x&0xFF),((x>>8)&0xFF)
+#define HID_PhysicalMinL(x) 0x37,(x&0xFF),((x>>8)&0xFF),((x>>16)&0xFF),((x>>24)&0xFF)
+#define HID_PhysicalMax(x) 0x45,x
+#define HID_PhysicalMaxS(x) 0x46,(x&0xFF),((x>>8)&0xFF)
+#define HID_PhysicalMaxL(x) 0x47,(x&0xFF),((x>>8)&0xFF),((x>>16)&0xFF),((x>>24)&0xFF)
+#define HID_UnitExponent(x) 0x55,x
+#define HID_Unit(x) 0x65,x
+#define HID_UnitS(x) 0x66,(x&0xFF),((x>>8)&0xFF)
+#define HID_UnitL(x) 0x67,(x&0xFF),((x>>8)&0xFF),((x>>16)&0xFF),((x>>24)&0xFF)
+#define HID_ReportSize(x) 0x75,x
+#define HID_ReportID(x) 0x85,x
+#define HID_ReportCount(x) 0x95,x
+#define HID_Push 0xA0
+#define HID_Pop 0xB0
+
+/** Local Items */
+#define HID_Usage(x) 0x09,x
+#define HID_UsageMin(x) 0x19,x
+#define HID_UsageMax(x) 0x29,x
+/** @} */
+
+/** @} */
+
+#endif /* __HID_H__ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_hiduser.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_hiduser.h
new file mode 100644
index 0000000..c00ccac
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_hiduser.h
@@ -0,0 +1,421 @@
+/***********************************************************************
+* $Id:: mw_usbd_hiduser.h 331 2012-08-09 18:54:34Z usb10131 $
+*
+* Project: USB device ROM Stack
+*
+* Description:
+* HID Custom User Module Definitions.
+*
+***********************************************************************
+* Copyright(C) 2011, NXP Semiconductor
+* All rights reserved.
+*
+* Software that is described herein is for illustrative purposes only
+* which provides customers with programming information regarding the
+* products. This software is supplied "AS IS" without any warranties.
+* NXP Semiconductors assumes no responsibility or liability for the
+* use of the software, conveys no license or title under any patent,
+* copyright, or mask work right to the product. NXP Semiconductors
+* reserves the right to make changes in the software without
+* notification. NXP Semiconductors also make no representation or
+* warranty that such application will be suitable for the specified
+* use without further testing or modification.
+**********************************************************************/
+
+#ifndef __HIDUSER_H__
+#define __HIDUSER_H__
+
+#include "usbd.h"
+#include "usbd_hid.h"
+#include "usbd_core.h"
+
+/** \file
+ * \brief Human Interface Device (HID) API structures and function prototypes.
+ *
+ * Definition of functions exported by ROM based HID function driver.
+ *
+ */
+
+/** \ingroup Group_USBD
+ * @defgroup USBD_HID HID Class Function Driver
+ * \section Sec_HIDModDescription Module Description
+ * HID Class Function Driver module. This module contains an internal implementation of the USB HID Class.
+ * User applications can use this class driver instead of implementing the HID class manually
+ * via the low-level HW and core APIs.
+ *
+ * This module is designed to simplify the user code by exposing only the required interface needed to interface with
+ * Devices using the USB HID Class.
+ */
+
+/** \brief HID report descriptor data structure.
+ * \ingroup USBD_HID
+ *
+ * \details This structure is used as part of HID function driver initialization
+ * parameter structure \ref USBD_HID_INIT_PARAM. This structure contains
+ * details of a report type supported by the application. An application
+ * can support multiple report types as a single HID device. The application
+ * should define this report type data structure per report it supports and
+ * the array of report types to USBD_HID_API::init() through \ref USBD_HID_INIT_PARAM
+ * structure.
+ *
+ * \note All descriptor pointers assigned in this structure should be on 4 byte
+ * aligned address boundary.
+ *
+ */
+typedef struct _HID_REPORT_T {
+ uint16_t len; /**< Size of the report descriptor in bytes. */
+ uint8_t idle_time; /**< This value is used by stack to respond to Set_Idle &
+ GET_Idle requests for the specified report ID. The value
+ of this field specified the rate at which duplicate reports
+ are generated for the specified Report ID. For example, a
+ device with two input reports could specify an idle rate of
+ 20 milliseconds for report ID 1 and 500 milliseconds for
+ report ID 2.
+ */
+ uint8_t __pad; /**< Padding space. */
+ uint8_t* desc; /**< Report descriptor. */
+} USB_HID_REPORT_T;
+
+/** \brief USB descriptors data structure.
+ * \ingroup USBD_HID
+ *
+ * \details This module exposes functions which interact directly with USB device stack's core layer.
+ * The application layer uses this component when it has to implement custom class function driver or
+ * standard class function driver which is not part of the current USB device stack.
+ * The functions exposed by this interface are to register class specific EP0 handlers and corresponding
+ * utility functions to manipulate EP0 state machine of the stack. This interface also exposes
+ * function to register custom endpoint interrupt handler.
+ *
+ */
+typedef struct USBD_HID_INIT_PARAM
+{
+ /* memory allocation params */
+ uint32_t mem_base; /**< Base memory location from where the stack can allocate
+ data and buffers. \note The memory address set in this field
+ should be accessible by USB DMA controller. Also this value
+ should be aligned on 4 byte boundary.
+ */
+ uint32_t mem_size; /**< The size of memory buffer which stack can use.
+ \note The \em mem_size should be greater than the size
+ returned by USBD_HID_API::GetMemSize() routine.*/
+ /* HID paramas */
+ uint8_t max_reports; /**< Number of HID reports supported by this instance
+ of HID class driver.
+ */
+ uint8_t pad[3];
+ uint8_t* intf_desc; /**< Pointer to the HID interface descriptor within the
+ descriptor array (\em high_speed_desc) passed to Init()
+ through \ref USB_CORE_DESCS_T structure.
+ */
+ USB_HID_REPORT_T* report_data; /**< Pointer to an array of HID report descriptor
+ data structure (\ref USB_HID_REPORT_T). The number
+ of elements in the array should be same a \em max_reports
+ value. The stack uses this array to respond to
+ requests received for various HID report descriptor
+ information. \note This array should be of global scope.
+ */
+
+ /* user defined functions */
+ /* required functions */
+ /**
+ * HID get report callback function.
+ *
+ * This function is provided by the application software. This function gets called
+ * when host sends a HID_REQUEST_GET_REPORT request. The setup packet data (\em pSetup)
+ * is passed to the callback so that application can extract the report ID, report
+ * type and other information need to generate the report. \note HID reports are sent
+ * via interrupt IN endpoint also. This function is called only when report request
+ * is received on control endpoint. Application should implement \em HID_EpIn_Hdlr to
+ * send reports to host via interrupt IN endpoint.
+ *
+ *
+ * \param[in] hHid Handle to HID function driver.
+ * \param[in] pSetup Pointer to setup packet received from host.
+ * \param[in, out] pBuffer Pointer to a pointer of data buffer containing report data.
+ * Pointer-to-pointer is used to implement zero-copy buffers.
+ * See \ref USBD_ZeroCopy for more details on zero-copy concept.
+ * \param[in] length Amount of data copied to destination buffer.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*HID_GetReport)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t* length);
+
+ /**
+ * HID set report callback function.
+ *
+ * This function is provided by the application software. This function gets called
+ * when host sends a HID_REQUEST_SET_REPORT request. The setup packet data (\em pSetup)
+ * is passed to the callback so that application can extract the report ID, report
+ * type and other information need to modify the report. An application might choose
+ * to ignore input Set_Report requests as meaningless. Alternatively these reports
+ * could be used to reset the origin of a control (that is, current position should
+ * report zero).
+ *
+ * \param[in] hHid Handle to HID function driver.
+ * \param[in] pSetup Pointer to setup packet received from host.
+ * \param[in, out] pBuffer Pointer to a pointer of data buffer containing report data.
+ * Pointer-to-pointer is used to implement zero-copy buffers.
+ * See \ref USBD_ZeroCopy for more details on zero-copy concept.
+ * \param[in] length Amount of data copied to destination buffer.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*HID_SetReport)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t length);
+
+ /* optional functions */
+
+ /**
+ * Optional callback function to handle HID_GetPhysDesc request.
+ *
+ * The application software could provide this callback HID_GetPhysDesc handler to
+ * handle get physical descriptor requests sent by the host. When host requests
+ * Physical Descriptor set 0, application should return a special descriptor
+ * identifying the number of descriptor sets and their sizes. A Get_Descriptor
+ * request with the Physical Index equal to 1 should return the first Physical
+ * Descriptor set. A device could possibly have alternate uses for its items.
+ * These can be enumerated by issuing subsequent Get_Descriptor requests while
+ * incrementing the Descriptor Index. A device should return the last descriptor
+ * set to requests with an index greater than the last number defined in the HID
+ * descriptor.
+ * \note Applications which don't have physical descriptor should set this data member
+ * to zero before calling the USBD_HID_API::Init().
+ * \n
+ *
+ * \param[in] hHid Handle to HID function driver.
+ * \param[in] pSetup Pointer to setup packet received from host.
+ * \param[in] pBuf Pointer to a pointer of data buffer containing physical descriptor
+ * data. If the physical descriptor is in USB accessible memory area
+ * application could just update the pointer or else it should copy
+ * the descriptor to the address pointed by this pointer.
+ * \param[in] length Amount of data copied to destination buffer or descriptor length.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*HID_GetPhysDesc)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuf, uint16_t* length);
+
+ /**
+ * Optional callback function to handle HID_REQUEST_SET_IDLE request.
+ *
+ * The application software could provide this callback to handle HID_REQUEST_SET_IDLE
+ * requests sent by the host. This callback is provided to applications to adjust
+ * timers associated with various reports, which are sent to host over interrupt
+ * endpoint. The setup packet data (\em pSetup) is passed to the callback so that
+ * application can extract the report ID, report type and other information need
+ * to modify the report's idle time.
+ * \note Applications which don't send reports on Interrupt endpoint or don't
+ * have idle time between reports should set this data member to zero before
+ * calling the USBD_HID_API::Init().
+ * \n
+ *
+ * \param[in] hHid Handle to HID function driver.
+ * \param[in] pSetup Pointer to setup packet received from host.
+ * \param[in] idleTime Idle time to be set for the specified report.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*HID_SetIdle)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t idleTime);
+
+ /**
+ * Optional callback function to handle HID_REQUEST_SET_PROTOCOL request.
+ *
+ * The application software could provide this callback to handle HID_REQUEST_SET_PROTOCOL
+ * requests sent by the host. This callback is provided to applications to adjust
+ * modes of their code between boot mode and report mode.
+ * \note Applications which don't support protocol modes should set this data member
+ * to zero before calling the USBD_HID_API::Init().
+ * \n
+ *
+ * \param[in] hHid Handle to HID function driver.
+ * \param[in] pSetup Pointer to setup packet received from host.
+ * \param[in] protocol Protocol mode.
+ * 0 = Boot Protocol
+ * 1 = Report Protocol
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*HID_SetProtocol)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t protocol);
+
+ /**
+ * Optional Interrupt IN endpoint event handler.
+ *
+ * The application software could provide Interrupt IN endpoint event handler.
+ * Application which send reports to host on interrupt endpoint should provide
+ * an endpoint event handler through this data member. This data member is
+ * ignored if the interface descriptor \em intf_desc doesn't have any IN interrupt
+ * endpoint descriptor associated.
+ * \n
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] data Handle to HID function driver.
+ * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details.
+ * \return The call back should return \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*HID_EpIn_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event);
+ /**
+ * Optional Interrupt OUT endpoint event handler.
+ *
+ * The application software could provide Interrupt OUT endpoint event handler.
+ * Application which receives reports from host on interrupt endpoint should provide
+ * an endpoint event handler through this data member. This data member is
+ * ignored if the interface descriptor \em intf_desc doesn't have any OUT interrupt
+ * endpoint descriptor associated.
+ * \n
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] data Handle to HID function driver.
+ * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details.
+ * \return The call back should return \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*HID_EpOut_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event);
+
+ /* user override-able function */
+ /**
+ * Optional user override-able function to replace the default HID_GetReportDesc handler.
+ *
+ * The application software could override the default HID_GetReportDesc handler with their
+ * own by providing the handler function address as this data member of the parameter
+ * structure. Application which like the default handler should set this data member
+ * to zero before calling the USBD_HID_API::Init() and also provide report data array
+ * \em report_data field.
+ * \n
+ * \note
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] data Pointer to the data which will be passed when callback function is called by the stack.
+ * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*HID_GetReportDesc)(USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuf, uint16_t* length);
+ /**
+ * Optional user override-able function to replace the default HID class handler.
+ *
+ * The application software could override the default EP0 class handler with their
+ * own by providing the handler function address as this data member of the parameter
+ * structure. Application which like the default handler should set this data member
+ * to zero before calling the USBD_HID_API::Init().
+ * \n
+ * \note
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] data Pointer to the data which will be passed when callback function is called by the stack.
+ * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*HID_Ep0_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event);
+
+} USBD_HID_INIT_PARAM_T;
+
+/** \brief HID class API functions structure.
+ * \ingroup USBD_HID
+ *
+ * This structure contains pointers to all the function exposed by HID function driver module.
+ *
+ */
+typedef struct USBD_HID_API
+{
+ /** \fn uint32_t GetMemSize(USBD_HID_INIT_PARAM_T* param)
+ * Function to determine the memory required by the HID function driver module.
+ *
+ * This function is called by application layer before calling pUsbApi->hid->Init(), to allocate memory used
+ * by HID function driver module. The application should allocate the memory which is accessible by USB
+ * controller/DMA controller.
+ * \note Some memory areas are not accessible by all bus masters.
+ *
+ * \param[in] param Structure containing HID function driver module initialization parameters.
+ * \return Returns the required memory size in bytes.
+ */
+ uint32_t (*GetMemSize)(USBD_HID_INIT_PARAM_T* param);
+
+ /** \fn ErrorCode_t init(USBD_HANDLE_T hUsb, USBD_HID_INIT_PARAM_T* param)
+ * Function to initialize HID function driver module.
+ *
+ * This function is called by application layer to initialize HID function driver
+ * module. On successful initialization the function returns a handle to HID
+ * function driver module in passed param structure.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in, out] param Structure containing HID function driver module
+ * initialization parameters.
+ * \return Returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success
+ * \retval ERR_USBD_BAD_MEM_BUF Memory buffer passed is not 4-byte
+ * aligned or smaller than required.
+ * \retval ERR_API_INVALID_PARAM2 Either HID_GetReport() or HID_SetReport()
+ * callback are not defined.
+ * \retval ERR_USBD_BAD_DESC HID_HID_DESCRIPTOR_TYPE is not defined
+ * immediately after interface descriptor.
+ * \retval ERR_USBD_BAD_INTF_DESC Wrong interface descriptor is passed.
+ * \retval ERR_USBD_BAD_EP_DESC Wrong endpoint descriptor is passed.
+ */
+ ErrorCode_t (*init)(USBD_HANDLE_T hUsb, USBD_HID_INIT_PARAM_T* param);
+
+} USBD_HID_API_T;
+
+/*-----------------------------------------------------------------------------
+ * Private functions & structures prototypes
+ *-----------------------------------------------------------------------------*/
+/** @cond ADVANCED_API */
+
+typedef struct _HID_CTRL_T {
+ /* pointer to controller */
+ USB_CORE_CTRL_T* pUsbCtrl;
+ /* descriptor pointers */
+ uint8_t* hid_desc;
+ USB_HID_REPORT_T* report_data;
+
+ uint8_t protocol;
+ uint8_t if_num; /* interface number */
+ uint8_t epin_adr; /* IN interrupt endpoint */
+ uint8_t epout_adr; /* OUT interrupt endpoint */
+
+ /* user defined functions */
+ ErrorCode_t (*HID_GetReport)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t* length);
+ ErrorCode_t (*HID_SetReport)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t length);
+ ErrorCode_t (*HID_GetPhysDesc)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuf, uint16_t* length);
+ ErrorCode_t (*HID_SetIdle)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t idleTime);
+ ErrorCode_t (*HID_SetProtocol)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t protocol);
+
+ /* virtual overridable functions */
+ ErrorCode_t (*HID_GetReportDesc)(USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuf, uint16_t* length);
+
+}USB_HID_CTRL_T;
+
+/** @cond DIRECT_API */
+extern uint32_t mwHID_GetMemSize(USBD_HID_INIT_PARAM_T* param);
+extern ErrorCode_t mwHID_init(USBD_HANDLE_T hUsb, USBD_HID_INIT_PARAM_T* param);
+/** @endcond */
+
+/** @endcond */
+
+#endif /* __HIDUSER_H__ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_hw.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_hw.h
new file mode 100644
index 0000000..b7e0f10
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_hw.h
@@ -0,0 +1,457 @@
+/***********************************************************************
+* $Id:: mw_usbd_hw.h 331 2012-08-09 18:54:34Z usb10131 $
+*
+* Project: USB device ROM Stack
+*
+* Description:
+* USB Hardware Function prototypes.
+*
+***********************************************************************
+* Copyright(C) 2011, NXP Semiconductor
+* All rights reserved.
+*
+* Software that is described herein is for illustrative purposes only
+* which provides customers with programming information regarding the
+* products. This software is supplied "AS IS" without any warranties.
+* NXP Semiconductors assumes no responsibility or liability for the
+* use of the software, conveys no license or title under any patent,
+* copyright, or mask work right to the product. NXP Semiconductors
+* reserves the right to make changes in the software without
+* notification. NXP Semiconductors also make no representation or
+* warranty that such application will be suitable for the specified
+* use without further testing or modification.
+**********************************************************************/
+#ifndef __USBHW_H__
+#define __USBHW_H__
+
+#include "error.h"
+#include "usbd.h"
+#include "usbd_core.h"
+
+/** \file
+ * \brief USB Hardware Function prototypes.
+ *
+ * Definition of functions exported by ROM based Device Controller Driver (DCD).
+ *
+ */
+
+/** \ingroup Group_USBD
+ * @defgroup USBD_HW USB Device Controller Driver
+ * \section Sec_HWModDescription Module Description
+ * The Device Controller Driver Layer implements the routines to deal directly with the hardware.
+ */
+
+/** \ingroup USBD_HW
+* USB Endpoint/class handler Callback Events.
+*
+*/
+enum USBD_EVENT_T {
+ USB_EVT_SETUP =1, /**< 1 Setup Packet received */
+ USB_EVT_OUT, /**< 2 OUT Packet received */
+ USB_EVT_IN, /**< 3 IN Packet sent */
+ USB_EVT_OUT_NAK, /**< 4 OUT Packet - Not Acknowledged */
+ USB_EVT_IN_NAK, /**< 5 IN Packet - Not Acknowledged */
+ USB_EVT_OUT_STALL, /**< 6 OUT Packet - Stalled */
+ USB_EVT_IN_STALL, /**< 7 IN Packet - Stalled */
+ USB_EVT_OUT_DMA_EOT, /**< 8 DMA OUT EP - End of Transfer */
+ USB_EVT_IN_DMA_EOT, /**< 9 DMA IN EP - End of Transfer */
+ USB_EVT_OUT_DMA_NDR, /**< 10 DMA OUT EP - New Descriptor Request */
+ USB_EVT_IN_DMA_NDR, /**< 11 DMA IN EP - New Descriptor Request */
+ USB_EVT_OUT_DMA_ERR, /**< 12 DMA OUT EP - Error */
+ USB_EVT_IN_DMA_ERR, /**< 13 DMA IN EP - Error */
+ USB_EVT_RESET, /**< 14 Reset event recieved */
+ USB_EVT_SOF, /**< 15 Start of Frame event */
+ USB_EVT_DEV_STATE, /**< 16 Device status events */
+ USB_EVT_DEV_ERROR /**< 17 Device error events */
+};
+
+/**
+ * \brief Hardware API functions structure.
+ * \ingroup USBD_HW
+ *
+ * This module exposes functions which interact directly with USB device controller hardware.
+ *
+ */
+typedef struct USBD_HW_API
+{
+ /** \fn uint32_t GetMemSize(USBD_API_INIT_PARAM_T* param)
+ * Function to determine the memory required by the USB device stack's DCD and core layers.
+ *
+ * This function is called by application layer before calling pUsbApi->hw->Init(), to allocate memory used
+ * by DCD and core layers. The application should allocate the memory which is accessible by USB
+ * controller/DMA controller.
+ * \note Some memory areas are not accessible by all bus masters.
+ *
+ * \param[in] param Structure containing USB device stack initialization parameters.
+ * \return Returns the required memory size in bytes.
+ */
+ uint32_t (*GetMemSize)(USBD_API_INIT_PARAM_T* param);
+
+ /** \fn ErrorCode_t Init(USBD_HANDLE_T* phUsb, USB_CORE_DESCS_T* pDesc, USBD_API_INIT_PARAM_T* param)
+ * Function to initialize USB device stack's DCD and core layers.
+ *
+ * This function is called by application layer to initialize USB hardware and core layers.
+ * On successful initialization the function returns a handle to USB device stack which should
+ * be passed to the rest of the functions.
+ *
+ * \param[in,out] phUsb Pointer to the USB device stack handle of type USBD_HANDLE_T.
+ * \param[in] pDesc Structure containing pointers to various descriptor arrays needed by the stack.
+ * These descriptors are reported to USB host as part of enumerations process.
+ * \param[in] param Structure containing USB device stack initialization parameters.
+ * \return Returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK(0) On success
+ * \retval ERR_USBD_BAD_MEM_BUF(0x0004000b) When insufficient memory buffer is passed or memory
+ * is not aligned on 2048 boundary.
+ */
+ ErrorCode_t (*Init)(USBD_HANDLE_T* phUsb, USB_CORE_DESCS_T* pDesc, USBD_API_INIT_PARAM_T* param);
+
+ /** \fn void Connect(USBD_HANDLE_T hUsb, uint32_t con)
+ * Function to make USB device visible/invisible on the USB bus.
+ *
+ * This function is called after the USB initialization. This function uses the soft connect
+ * feature to make the device visible on the USB bus. This function is called only after the
+ * application is ready to handle the USB data. The enumeration process is started by the
+ * host after the device detection. The driver handles the enumeration process according to
+ * the USB descriptors passed in the USB initialization function.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] con States whether to connect (1) or to disconnect (0).
+ * \return Nothing.
+ */
+ void (*Connect)(USBD_HANDLE_T hUsb, uint32_t con);
+
+ /** \fn void ISR(USBD_HANDLE_T hUsb)
+ * Function to USB device controller interrupt events.
+ *
+ * When the user application is active the interrupt handlers are mapped in the user flash
+ * space. The user application must provide an interrupt handler for the USB interrupt and
+ * call this function in the interrupt handler routine. The driver interrupt handler takes
+ * appropriate action according to the data received on the USB bus.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \return Nothing.
+ */
+ void (*ISR)(USBD_HANDLE_T hUsb);
+
+ /** \fn void Reset(USBD_HANDLE_T hUsb)
+ * Function to Reset USB device stack and hardware controller.
+ *
+ * Reset USB device stack and hardware controller. Disables all endpoints except EP0.
+ * Clears all pending interrupts and resets endpoint transfer queues.
+ * This function is called internally by pUsbApi->hw->init() and from reset event.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \return Nothing.
+ */
+ void (*Reset)(USBD_HANDLE_T hUsb);
+
+ /** \fn void ForceFullSpeed(USBD_HANDLE_T hUsb, uint32_t cfg)
+ * Function to force high speed USB device to operate in full speed mode.
+ *
+ * This function is useful for testing the behavior of current device when connected
+ * to a full speed only hosts.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] cfg When 1 - set force full-speed or
+ * 0 - clear force full-speed.
+ * \return Nothing.
+ */
+ void (*ForceFullSpeed )(USBD_HANDLE_T hUsb, uint32_t cfg);
+
+ /** \fn void WakeUpCfg(USBD_HANDLE_T hUsb, uint32_t cfg)
+ * Function to configure USB device controller to wake-up host on remote events.
+ *
+ * This function is called by application layer to configure the USB device controller
+ * to wakeup on remote events. It is recommended to call this function from users's
+ * USB_WakeUpCfg() callback routine registered with stack.
+ * \note User's USB_WakeUpCfg() is registered with stack by setting the USB_WakeUpCfg member
+ * of USBD_API_INIT_PARAM_T structure before calling pUsbApi->hw->Init() routine.
+ * Certain USB device controllers needed to keep some clocks always on to generate
+ * resume signaling through pUsbApi->hw->WakeUp(). This hook is provided to support
+ * such controllers. In most controllers cases this is an empty routine.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] cfg When 1 - Configure controller to wake on remote events or
+ * 0 - Configure controller not to wake on remote events.
+ * \return Nothing.
+ */
+ void (*WakeUpCfg)(USBD_HANDLE_T hUsb, uint32_t cfg);
+
+ /** \fn void SetAddress(USBD_HANDLE_T hUsb, uint32_t adr)
+ * Function to set USB address assigned by host in device controller hardware.
+ *
+ * This function is called automatically when USB_REQUEST_SET_ADDRESS request is received
+ * by the stack from USB host.
+ * This interface is provided to users to invoke this function in other scenarios which are not
+ * handle by current stack. In most user applications this function is not called directly.
+ * Also this function can be used by users who are selectively modifying the USB device stack's
+ * standard handlers through callback interface exposed by the stack.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] adr USB bus Address to which the device controller should respond. Usually
+ * assigned by the USB host.
+ * \return Nothing.
+ */
+ void (*SetAddress)(USBD_HANDLE_T hUsb, uint32_t adr);
+
+ /** \fn void Configure(USBD_HANDLE_T hUsb, uint32_t cfg)
+ * Function to configure device controller hardware with selected configuration.
+ *
+ * This function is called automatically when USB_REQUEST_SET_CONFIGURATION request is received
+ * by the stack from USB host.
+ * This interface is provided to users to invoke this function in other scenarios which are not
+ * handle by current stack. In most user applications this function is not called directly.
+ * Also this function can be used by users who are selectively modifying the USB device stack's
+ * standard handlers through callback interface exposed by the stack.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] cfg Configuration index.
+ * \return Nothing.
+ */
+ void (*Configure)(USBD_HANDLE_T hUsb, uint32_t cfg);
+
+ /** \fn void ConfigEP(USBD_HANDLE_T hUsb, USB_ENDPOINT_DESCRIPTOR *pEPD)
+ * Function to configure USB Endpoint according to descriptor.
+ *
+ * This function is called automatically when USB_REQUEST_SET_CONFIGURATION request is received
+ * by the stack from USB host. All the endpoints associated with the selected configuration
+ * are configured.
+ * This interface is provided to users to invoke this function in other scenarios which are not
+ * handle by current stack. In most user applications this function is not called directly.
+ * Also this function can be used by users who are selectively modifying the USB device stack's
+ * standard handlers through callback interface exposed by the stack.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] pEPD Endpoint descriptor structure defined in USB 2.0 specification.
+ * \return Nothing.
+ */
+ void (*ConfigEP)(USBD_HANDLE_T hUsb, USB_ENDPOINT_DESCRIPTOR *pEPD);
+
+ /** \fn void DirCtrlEP(USBD_HANDLE_T hUsb, uint32_t dir)
+ * Function to set direction for USB control endpoint EP0.
+ *
+ * This function is called automatically by the stack on need basis.
+ * This interface is provided to users to invoke this function in other scenarios which are not
+ * handle by current stack. In most user applications this function is not called directly.
+ * Also this function can be used by users who are selectively modifying the USB device stack's
+ * standard handlers through callback interface exposed by the stack.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] cfg When 1 - Set EP0 in IN transfer mode
+ * 0 - Set EP0 in OUT transfer mode
+ * \return Nothing.
+ */
+ void (*DirCtrlEP)(USBD_HANDLE_T hUsb, uint32_t dir);
+
+ /** \fn void EnableEP(USBD_HANDLE_T hUsb, uint32_t EPNum)
+ * Function to enable selected USB endpoint.
+ *
+ * This function enables interrupts on selected endpoint.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] EPNum Endpoint number as per USB specification.
+ * ie. An EP1_IN is represented by 0x81 number.
+ * \return Nothing.
+ */
+ void (*EnableEP)(USBD_HANDLE_T hUsb, uint32_t EPNum);
+
+ /** \fn void DisableEP(USBD_HANDLE_T hUsb, uint32_t EPNum)
+ * Function to disable selected USB endpoint.
+ *
+ * This function disables interrupts on selected endpoint.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] EPNum Endpoint number as per USB specification.
+ * ie. An EP1_IN is represented by 0x81 number.
+ * \return Nothing.
+ */
+ void (*DisableEP)(USBD_HANDLE_T hUsb, uint32_t EPNum);
+
+ /** \fn void ResetEP(USBD_HANDLE_T hUsb, uint32_t EPNum)
+ * Function to reset selected USB endpoint.
+ *
+ * This function flushes the endpoint buffers and resets data toggle logic.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] EPNum Endpoint number as per USB specification.
+ * ie. An EP1_IN is represented by 0x81 number.
+ * \return Nothing.
+ */
+ void (*ResetEP)(USBD_HANDLE_T hUsb, uint32_t EPNum);
+
+ /** \fn void SetStallEP(USBD_HANDLE_T hUsb, uint32_t EPNum)
+ * Function to STALL selected USB endpoint.
+ *
+ * Generates STALL signaling for requested endpoint.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] EPNum Endpoint number as per USB specification.
+ * ie. An EP1_IN is represented by 0x81 number.
+ * \return Nothing.
+ */
+ void (*SetStallEP)(USBD_HANDLE_T hUsb, uint32_t EPNum);
+
+ /** \fn void ClrStallEP(USBD_HANDLE_T hUsb, uint32_t EPNum)
+ * Function to clear STALL state for the requested endpoint.
+ *
+ * This function clears STALL state for the requested endpoint.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] EPNum Endpoint number as per USB specification.
+ * ie. An EP1_IN is represented by 0x81 number.
+ * \return Nothing.
+ */
+ void (*ClrStallEP)(USBD_HANDLE_T hUsb, uint32_t EPNum);
+
+ /** \fn ErrorCode_t SetTestMode(USBD_HANDLE_T hUsb, uint8_t mode)
+ * Function to set high speed USB device controller in requested test mode.
+ *
+ * USB-IF requires the high speed device to be put in various test modes
+ * for electrical testing. This USB device stack calls this function whenever
+ * it receives USB_REQUEST_CLEAR_FEATURE request for USB_FEATURE_TEST_MODE.
+ * Users can put the device in test mode by directly calling this function.
+ * Returns ERR_USBD_INVALID_REQ when device controller is full-speed only.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] mode Test mode defined in USB 2.0 electrical testing specification.
+ * \return Returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK(0) - On success
+ * \retval ERR_USBD_INVALID_REQ(0x00040001) - Invalid test mode or
+ * Device controller is full-speed only.
+ */
+ ErrorCode_t (*SetTestMode)(USBD_HANDLE_T hUsb, uint8_t mode);
+
+ /** \fn uint32_t ReadEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData)
+ * Function to read data received on the requested endpoint.
+ *
+ * This function is called by USB stack and the application layer to read the data
+ * received on the requested endpoint.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] EPNum Endpoint number as per USB specification.
+ * ie. An EP1_IN is represented by 0x81 number.
+ * \param[in,out] pData Pointer to the data buffer where data is to be copied.
+ * \return Returns the number of bytes copied to the buffer.
+ */
+ uint32_t (*ReadEP)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData);
+
+ /** \fn uint32_t ReadReqEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t len)
+ * Function to queue read request on the specified endpoint.
+ *
+ * This function is called by USB stack and the application layer to queue a read request
+ * on the specified endpoint.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] EPNum Endpoint number as per USB specification.
+ * ie. An EP1_IN is represented by 0x81 number.
+ * \param[in,out] pData Pointer to the data buffer where data is to be copied. This buffer
+ * address should be accessible by USB DMA master.
+ * \param[in] len Length of the buffer passed.
+ * \return Returns the length of the requested buffer.
+ */
+ uint32_t (*ReadReqEP)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t len);
+
+ /** \fn uint32_t ReadSetupPkt(USBD_HANDLE_T hUsb, uint32_t EPNum, uint32_t *pData)
+ * Function to read setup packet data received on the requested endpoint.
+ *
+ * This function is called by USB stack and the application layer to read setup packet data
+ * received on the requested endpoint.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] EPNum Endpoint number as per USB specification.
+ * ie. An EP0_IN is represented by 0x80 number.
+ * \param[in,out] pData Pointer to the data buffer where data is to be copied.
+ * \return Returns the number of bytes copied to the buffer.
+ */
+ uint32_t (*ReadSetupPkt)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint32_t *pData);
+
+ /** \fn uint32_t WriteEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t cnt)
+ * Function to write data to be sent on the requested endpoint.
+ *
+ * This function is called by USB stack and the application layer to send data
+ * on the requested endpoint.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] EPNum Endpoint number as per USB specification.
+ * ie. An EP1_IN is represented by 0x81 number.
+ * \param[in] pData Pointer to the data buffer from where data is to be copied.
+ * \param[in] cnt Number of bytes to write.
+ * \return Returns the number of bytes written.
+ */
+ uint32_t (*WriteEP)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t cnt);
+
+ /** \fn void WakeUp(USBD_HANDLE_T hUsb)
+ * Function to generate resume signaling on bus for remote host wakeup.
+ *
+ * This function is called by application layer to remotely wakeup host controller
+ * when system is in suspend state. Application should indicate this remote wakeup
+ * capability by setting USB_CONFIG_REMOTE_WAKEUP in bmAttributes of Configuration
+ * Descriptor. Also this routine will generate resume signalling only if host
+ * enables USB_FEATURE_REMOTE_WAKEUP by sending SET_FEATURE request before suspending
+ * the bus.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \return Nothing.
+ */
+ void (*WakeUp)(USBD_HANDLE_T hUsb);
+
+ /** \fn void EnableEvent(USBD_HANDLE_T hUsb, uint32_t EPNum, uint32_t event_type, uint32_t enable)
+ * Function to enable/disable selected USB event.
+ *
+ * This function enables interrupts on selected endpoint.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] EPNum Endpoint number corresponding to the event.
+ * ie. An EP1_IN is represented by 0x81 number. For device events
+ * set this param to 0x0.
+ * \param[in] event_type Type of endpoint event. See \ref USBD_EVENT_T for more details.
+ * \param[in] enable 1 - enable event, 0 - disable event.
+ * \return Returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK(0) - On success
+ * \retval ERR_USBD_INVALID_REQ(0x00040001) - Invalid event type.
+ */
+ ErrorCode_t (*EnableEvent)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint32_t event_type, uint32_t enable);
+
+} USBD_HW_API_T;
+
+/*-----------------------------------------------------------------------------
+ * Private functions & structures prototypes used by stack internally
+ *-----------------------------------------------------------------------------*/
+/** @cond DIRECT_API */
+
+/* Driver functions */
+uint32_t hwUSB_GetMemSize(USBD_API_INIT_PARAM_T* param);
+ErrorCode_t hwUSB_Init(USBD_HANDLE_T* phUsb, USB_CORE_DESCS_T* pDesc, USBD_API_INIT_PARAM_T* param);
+void hwUSB_Connect(USBD_HANDLE_T hUsb, uint32_t con);
+void hwUSB_ISR(USBD_HANDLE_T hUsb);
+
+/* USB Hardware Functions */
+extern void hwUSB_Reset(USBD_HANDLE_T hUsb);
+extern void hwUSB_ForceFullSpeed (USBD_HANDLE_T hUsb, uint32_t con);
+extern void hwUSB_WakeUpCfg(USBD_HANDLE_T hUsb, uint32_t cfg);
+extern void hwUSB_SetAddress(USBD_HANDLE_T hUsb, uint32_t adr);
+extern void hwUSB_Configure(USBD_HANDLE_T hUsb, uint32_t cfg);
+extern void hwUSB_ConfigEP(USBD_HANDLE_T hUsb, USB_ENDPOINT_DESCRIPTOR *pEPD);
+extern void hwUSB_DirCtrlEP(USBD_HANDLE_T hUsb, uint32_t dir);
+extern void hwUSB_EnableEP(USBD_HANDLE_T hUsb, uint32_t EPNum);
+extern void hwUSB_DisableEP(USBD_HANDLE_T hUsb, uint32_t EPNum);
+extern void hwUSB_ResetEP(USBD_HANDLE_T hUsb, uint32_t EPNum);
+extern void hwUSB_SetStallEP(USBD_HANDLE_T hUsb, uint32_t EPNum);
+extern void hwUSB_ClrStallEP(USBD_HANDLE_T hUsb, uint32_t EPNum);
+extern ErrorCode_t hwUSB_SetTestMode(USBD_HANDLE_T hUsb, uint8_t mode); /* for FS only devices return ERR_USBD_INVALID_REQ */
+extern uint32_t hwUSB_ReadEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData);
+extern uint32_t hwUSB_ReadReqEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t len);
+extern uint32_t hwUSB_ReadSetupPkt(USBD_HANDLE_T hUsb, uint32_t, uint32_t *);
+extern uint32_t hwUSB_WriteEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t cnt);
+
+/* generate resume signaling on the bus */
+extern void hwUSB_WakeUp(USBD_HANDLE_T hUsb);
+extern ErrorCode_t hwUSB_EnableEvent(USBD_HANDLE_T hUsb, uint32_t EPNum, uint32_t event_type, uint32_t enable);
+/* TODO implement following routines
+- function to program TD and queue them to ep Qh
+*/
+
+/** @endcond */
+
+
+#endif /* __USBHW_H__ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_msc.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_msc.h
new file mode 100644
index 0000000..d17e150
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_msc.h
@@ -0,0 +1,119 @@
+/***********************************************************************
+* $Id:: mw_usbd_msc.h 331 2012-08-09 18:54:34Z usb10131 $
+*
+* Project: USB device ROM Stack
+*
+* Description:
+* Mass Storage Class definitions.
+*
+***********************************************************************
+* Copyright(C) 2011, NXP Semiconductor
+* All rights reserved.
+*
+* Software that is described herein is for illustrative purposes only
+* which provides customers with programming information regarding the
+* products. This software is supplied "AS IS" without any warranties.
+* NXP Semiconductors assumes no responsibility or liability for the
+* use of the software, conveys no license or title under any patent,
+* copyright, or mask work right to the product. NXP Semiconductors
+* reserves the right to make changes in the software without
+* notification. NXP Semiconductors also make no representation or
+* warranty that such application will be suitable for the specified
+* use without further testing or modification.
+**********************************************************************/
+
+#ifndef __MSC_H__
+#define __MSC_H__
+
+#include "usbd.h"
+
+/** \file
+ * \brief Mass Storage class (MSC) descriptors.
+ *
+ * Definition of MSC class descriptors and their bit defines.
+ *
+ */
+
+/* MSC Subclass Codes */
+#define MSC_SUBCLASS_RBC 0x01
+#define MSC_SUBCLASS_SFF8020I_MMC2 0x02
+#define MSC_SUBCLASS_QIC157 0x03
+#define MSC_SUBCLASS_UFI 0x04
+#define MSC_SUBCLASS_SFF8070I 0x05
+#define MSC_SUBCLASS_SCSI 0x06
+
+/* MSC Protocol Codes */
+#define MSC_PROTOCOL_CBI_INT 0x00
+#define MSC_PROTOCOL_CBI_NOINT 0x01
+#define MSC_PROTOCOL_BULK_ONLY 0x50
+
+
+/* MSC Request Codes */
+#define MSC_REQUEST_RESET 0xFF
+#define MSC_REQUEST_GET_MAX_LUN 0xFE
+
+
+/* MSC Bulk-only Stage */
+#define MSC_BS_CBW 0 /* Command Block Wrapper */
+#define MSC_BS_DATA_OUT 1 /* Data Out Phase */
+#define MSC_BS_DATA_IN 2 /* Data In Phase */
+#define MSC_BS_DATA_IN_LAST 3 /* Data In Last Phase */
+#define MSC_BS_DATA_IN_LAST_STALL 4 /* Data In Last Phase with Stall */
+#define MSC_BS_CSW 5 /* Command Status Wrapper */
+#define MSC_BS_ERROR 6 /* Error */
+
+
+/* Bulk-only Command Block Wrapper */
+PRE_PACK struct POST_PACK _MSC_CBW
+{
+ uint32_t dSignature;
+ uint32_t dTag;
+ uint32_t dDataLength;
+ uint8_t bmFlags;
+ uint8_t bLUN;
+ uint8_t bCBLength;
+ uint8_t CB[16];
+} ;
+typedef struct _MSC_CBW MSC_CBW;
+
+/* Bulk-only Command Status Wrapper */
+PRE_PACK struct POST_PACK _MSC_CSW
+{
+ uint32_t dSignature;
+ uint32_t dTag;
+ uint32_t dDataResidue;
+ uint8_t bStatus;
+} ;
+typedef struct _MSC_CSW MSC_CSW;
+
+#define MSC_CBW_Signature 0x43425355
+#define MSC_CSW_Signature 0x53425355
+
+
+/* CSW Status Definitions */
+#define CSW_CMD_PASSED 0x00
+#define CSW_CMD_FAILED 0x01
+#define CSW_PHASE_ERROR 0x02
+
+
+/* SCSI Commands */
+#define SCSI_TEST_UNIT_READY 0x00
+#define SCSI_REQUEST_SENSE 0x03
+#define SCSI_FORMAT_UNIT 0x04
+#define SCSI_INQUIRY 0x12
+#define SCSI_MODE_SELECT6 0x15
+#define SCSI_MODE_SENSE6 0x1A
+#define SCSI_START_STOP_UNIT 0x1B
+#define SCSI_MEDIA_REMOVAL 0x1E
+#define SCSI_READ_FORMAT_CAPACITIES 0x23
+#define SCSI_READ_CAPACITY 0x25
+#define SCSI_READ10 0x28
+#define SCSI_WRITE10 0x2A
+#define SCSI_VERIFY10 0x2F
+#define SCSI_READ12 0xA8
+#define SCSI_WRITE12 0xAA
+#define SCSI_MODE_SELECT10 0x55
+#define SCSI_MODE_SENSE10 0x5A
+
+
+#endif /* __MSC_H__ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_mscuser.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_mscuser.h
new file mode 100644
index 0000000..1010707
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_mscuser.h
@@ -0,0 +1,270 @@
+/***********************************************************************
+* $Id:: mw_usbd_mscuser.h 577 2012-11-20 01:42:04Z usb10131 $
+*
+* Project: USB device ROM Stack
+*
+* Description:
+* Mass Storage Class Custom User Module definitions.
+*
+***********************************************************************
+* Copyright(C) 2011, NXP Semiconductor
+* All rights reserved.
+*
+* Software that is described herein is for illustrative purposes only
+* which provides customers with programming information regarding the
+* products. This software is supplied "AS IS" without any warranties.
+* NXP Semiconductors assumes no responsibility or liability for the
+* use of the software, conveys no license or title under any patent,
+* copyright, or mask work right to the product. NXP Semiconductors
+* reserves the right to make changes in the software without
+* notification. NXP Semiconductors also make no representation or
+* warranty that such application will be suitable for the specified
+* use without further testing or modification.
+**********************************************************************/
+#ifndef __MSCUSER_H__
+#define __MSCUSER_H__
+
+#include "error.h"
+#include "usbd.h"
+#include "usbd_msc.h"
+#include "usbd_core.h"
+#include "app_usbd_cfg.h"
+
+/** \file
+ * \brief Mass Storage Class (MSC) API structures and function prototypes.
+ *
+ * Definition of functions exported by ROM based MSC function driver.
+ *
+ */
+
+/** \ingroup Group_USBD
+ * @defgroup USBD_MSC Mass Storage Class (MSC) Function Driver
+ * \section Sec_MSCModDescription Module Description
+ * MSC Class Function Driver module. This module contains an internal implementation of the USB MSC Class.
+ * User applications can use this class driver instead of implementing the MSC class manually
+ * via the low-level USBD_HW and USBD_Core APIs.
+ *
+ * This module is designed to simplify the user code by exposing only the required interface needed to interface with
+ * Devices using the USB MSC Class.
+ */
+
+/** \brief Mass Storage class function driver initialization parameter data structure.
+ * \ingroup USBD_MSC
+ *
+ * \details This data structure is used to pass initialization parameters to the
+ * Mass Storage class function driver's init function.
+ *
+ */
+typedef struct USBD_MSC_INIT_PARAM
+{
+ /* memory allocation params */
+ uint32_t mem_base; /**< Base memory location from where the stack can allocate
+ data and buffers. \note The memory address set in this field
+ should be accessible by USB DMA controller. Also this value
+ should be aligned on 4 byte boundary.
+ */
+ uint32_t mem_size; /**< The size of memory buffer which stack can use.
+ \note The \em mem_size should be greater than the size
+ returned by USBD_MSC_API::GetMemSize() routine.*/
+ /* mass storage params */
+ uint8_t* InquiryStr; /**< Pointer to the 28 character string. This string is
+ sent in response to the SCSI Inquiry command. \note The data
+ pointed by the pointer should be of global scope.
+ */
+ uint32_t BlockCount; /**< Number of blocks present in the mass storage device */
+ uint32_t BlockSize; /**< Block size in number of bytes */
+ uint32_t MemorySize; /**< Memory size in number of bytes */
+ /** Pointer to the interface descriptor within the descriptor
+ * array (\em high_speed_desc) passed to Init() through \ref USB_CORE_DESCS_T
+ * structure. The stack assumes both HS and FS use same BULK endpoints.
+ */
+
+ uint8_t* intf_desc;
+ /* user defined functions */
+
+ /**
+ * MSC Write callback function.
+ *
+ * This function is provided by the application software. This function gets called
+ * when host sends a write command.
+ *
+ * \param[in] offset Destination start address.
+ * \param[in, out] src Pointer to a pointer to the source of data. Pointer-to-pointer
+ * is used to implement zero-copy buffers. See \ref USBD_ZeroCopy
+ * for more details on zero-copy concept.
+ * \param[in] length Number of bytes to be written.
+ * \return Nothing.
+ *
+ */
+ void (*MSC_Write)( uint32_t offset, uint8_t** src, uint32_t length, uint32_t high_offset);
+ /**
+ * MSC Read callback function.
+ *
+ * This function is provided by the application software. This function gets called
+ * when host sends a read command.
+ *
+ * \param[in] offset Source start address.
+ * \param[in, out] dst Pointer to a pointer to the source of data. The MSC function drivers
+ * implemented in stack are written with zero-copy model. Meaning the stack doesn't make an
+ * extra copy of buffer before writing/reading data from USB hardware FIFO. Hence the
+ * parameter is pointer to a pointer containing address buffer (<em>uint8_t** dst</em>).
+ * So that the user application can update the buffer pointer instead of copying data to
+ * address pointed by the parameter. /note The updated buffer address should be accessible
+ * by USB DMA master. If user doesn't want to use zero-copy model, then the user should copy
+ * data to the address pointed by the passed buffer pointer parameter and shouldn't change
+ * the address value. See \ref USBD_ZeroCopy for more details on zero-copy concept.
+ * \param[in] length Number of bytes to be read.
+ * \return Nothing.
+ *
+ */
+ void (*MSC_Read)( uint32_t offset, uint8_t** dst, uint32_t length, uint32_t high_offset);
+ /**
+ * MSC Verify callback function.
+ *
+ * This function is provided by the application software. This function gets called
+ * when host sends a verify command. The callback function should compare the buffer
+ * with the destination memory at the requested offset and
+ *
+ * \param[in] offset Destination start address.
+ * \param[in] buf Buffer containing the data sent by the host.
+ * \param[in] length Number of bytes to verify.
+ * \return Returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK If data in the buffer matches the data at destination
+ * \retval ERR_FAILED At least one byte is different.
+ *
+ */
+ ErrorCode_t (*MSC_Verify)( uint32_t offset, uint8_t buf[], uint32_t length, uint32_t high_offset);
+ /**
+ * Optional callback function to optimize MSC_Write buffer transfer.
+ *
+ * This function is provided by the application software. This function gets called
+ * when host sends SCSI_WRITE10/SCSI_WRITE12 command. The callback function should
+ * update the \em buff_adr pointer so that the stack transfers the data directly
+ * to the target buffer. /note The updated buffer address should be accessible
+ * by USB DMA master. If user doesn't want to use zero-copy model, then the user
+ * should not update the buffer pointer. See \ref USBD_ZeroCopy for more details
+ * on zero-copy concept.
+ *
+ * \param[in] offset Destination start address.
+ * \param[in,out] buf Buffer containing the data sent by the host.
+ * \param[in] length Number of bytes to write.
+ * \return Nothing.
+ *
+ */
+ void (*MSC_GetWriteBuf)( uint32_t offset, uint8_t** buff_adr, uint32_t length, uint32_t high_offset);
+
+ /**
+ * Optional user override-able function to replace the default MSC class handler.
+ *
+ * The application software could override the default EP0 class handler with their
+ * own by providing the handler function address as this data member of the parameter
+ * structure. Application which like the default handler should set this data member
+ * to zero before calling the USBD_MSC_API::Init().
+ * \n
+ * \note
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in] data Pointer to the data which will be passed when callback function is called by the stack.
+ * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details.
+ * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success.
+ * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line.
+ * \retval ERR_USBD_xxx For other error conditions.
+ *
+ */
+ ErrorCode_t (*MSC_Ep0_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event);
+
+ uint64_t MemorySize64;
+
+} USBD_MSC_INIT_PARAM_T;
+
+/** \brief MSC class API functions structure.
+ * \ingroup USBD_MSC
+ *
+ * This module exposes functions which interact directly with USB device controller hardware.
+ *
+ */
+typedef struct USBD_MSC_API
+{
+ /** \fn uint32_t GetMemSize(USBD_MSC_INIT_PARAM_T* param)
+ * Function to determine the memory required by the MSC function driver module.
+ *
+ * This function is called by application layer before calling pUsbApi->msc->Init(), to allocate memory used
+ * by MSC function driver module. The application should allocate the memory which is accessible by USB
+ * controller/DMA controller.
+ * \note Some memory areas are not accessible by all bus masters.
+ *
+ * \param[in] param Structure containing MSC function driver module initialization parameters.
+ * \return Returns the required memory size in bytes.
+ */
+ uint32_t (*GetMemSize)(USBD_MSC_INIT_PARAM_T* param);
+
+ /** \fn ErrorCode_t init(USBD_HANDLE_T hUsb, USBD_MSC_INIT_PARAM_T* param)
+ * Function to initialize MSC function driver module.
+ *
+ * This function is called by application layer to initialize MSC function driver module.
+ *
+ * \param[in] hUsb Handle to the USB device stack.
+ * \param[in, out] param Structure containing MSC function driver module initialization parameters.
+ * \return Returns \ref ErrorCode_t type to indicate success or error condition.
+ * \retval LPC_OK On success
+ * \retval ERR_USBD_BAD_MEM_BUF Memory buffer passed is not 4-byte
+ * aligned or smaller than required.
+ * \retval ERR_API_INVALID_PARAM2 Either MSC_Write() or MSC_Read() or
+ * MSC_Verify() callbacks are not defined.
+ * \retval ERR_USBD_BAD_INTF_DESC Wrong interface descriptor is passed.
+ * \retval ERR_USBD_BAD_EP_DESC Wrong endpoint descriptor is passed.
+ */
+ ErrorCode_t (*init)(USBD_HANDLE_T hUsb, USBD_MSC_INIT_PARAM_T* param);
+
+} USBD_MSC_API_T;
+
+/*-----------------------------------------------------------------------------
+ * Private functions & structures prototypes
+ *-----------------------------------------------------------------------------*/
+/** @cond ADVANCED_API */
+
+typedef struct _MSC_CTRL_T
+{
+ /* If it's a USB HS, the max packet is 512, if it's USB FS,
+ the max packet is 64. Use 512 for both HS and FS. */
+ /*ALIGNED(4)*/ uint8_t BulkBuf[USB_HS_MAX_BULK_PACKET]; /* Bulk In/Out Buffer */
+ /*ALIGNED(4)*/MSC_CBW CBW; /* Command Block Wrapper */
+ /*ALIGNED(4)*/MSC_CSW CSW; /* Command Status Wrapper */
+
+ USB_CORE_CTRL_T* pUsbCtrl;
+
+ uint64_t Offset; /* R/W Offset */
+ uint32_t Length; /* R/W Length */
+ uint32_t BulkLen; /* Bulk In/Out Length */
+ uint8_t* rx_buf;
+
+ uint8_t BulkStage; /* Bulk Stage */
+ uint8_t if_num; /* interface number */
+ uint8_t epin_num; /* BULK IN endpoint number */
+ uint8_t epout_num; /* BULK OUT endpoint number */
+ uint32_t MemOK; /* Memory OK */
+
+ uint8_t* InquiryStr;
+ uint32_t BlockCount;
+ uint32_t BlockSize;
+ uint64_t MemorySize;
+ /* user defined functions */
+ void (*MSC_Write)( uint32_t offset, uint8_t** src, uint32_t length, uint32_t high_offset);
+ void (*MSC_Read)( uint32_t offset, uint8_t** dst, uint32_t length, uint32_t high_offset);
+ ErrorCode_t (*MSC_Verify)( uint32_t offset, uint8_t src[], uint32_t length, uint32_t high_offset);
+ /* optional call back for MSC_Write optimization */
+ void (*MSC_GetWriteBuf)( uint32_t offset, uint8_t** buff_adr, uint32_t length, uint32_t high_offset);
+
+
+}USB_MSC_CTRL_T;
+
+/** @cond DIRECT_API */
+extern uint32_t mwMSC_GetMemSize(USBD_MSC_INIT_PARAM_T* param);
+extern ErrorCode_t mwMSC_init(USBD_HANDLE_T hUsb, USBD_MSC_INIT_PARAM_T* param);
+/** @endcond */
+
+/** @endcond */
+
+
+#endif /* __MSCUSER_H__ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_rom_api.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_rom_api.h
new file mode 100644
index 0000000..b00bb52
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd/usbd_rom_api.h
@@ -0,0 +1,92 @@
+/***********************************************************************
+* $Id:: mw_usbd_rom_api.h 331 2012-08-09 18:54:34Z usb10131 $
+*
+* Project: USB device ROM Stack
+*
+* Description:
+* ROM API Module definitions.
+*
+***********************************************************************
+* Copyright(C) 2011, NXP Semiconductor
+* All rights reserved.
+*
+* Software that is described herein is for illustrative purposes only
+* which provides customers with programming information regarding the
+* products. This software is supplied "AS IS" without any warranties.
+* NXP Semiconductors assumes no responsibility or liability for the
+* use of the software, conveys no license or title under any patent,
+* copyright, or mask work right to the product. NXP Semiconductors
+* reserves the right to make changes in the software without
+* notification. NXP Semiconductors also make no representation or
+* warranty that such application will be suitable for the specified
+* use without further testing or modification.
+**********************************************************************/
+#ifndef __MW_USBD_ROM_API_H
+#define __MW_USBD_ROM_API_H
+/** \file
+ * \brief ROM API for USB device stack.
+ *
+ * Definition of functions exported by ROM based USB device stack.
+ *
+ */
+
+#include "error.h"
+#include "usbd.h"
+#include "usbd_hw.h"
+#include "usbd_core.h"
+#include "usbd_mscuser.h"
+#include "usbd_dfuuser.h"
+#include "usbd_hiduser.h"
+#include "usbd_cdcuser.h"
+
+/** \brief Main USBD API functions structure.
+ * \ingroup Group_USBD
+ *
+ * This structure contains pointer to various USB Device stack's sub-module
+ * function tables. This structure is used as main entry point to access
+ * various methods (grouped in sub-modules) exposed by ROM based USB device
+ * stack.
+ *
+ */
+typedef struct USBD_API
+{
+ const USBD_HW_API_T* hw; /**< Pointer to function table which exposes functions
+ which interact directly with USB device stack's core
+ layer.*/
+ const USBD_CORE_API_T* core; /**< Pointer to function table which exposes functions
+ which interact directly with USB device controller
+ hardware.*/
+ const USBD_MSC_API_T* msc; /**< Pointer to function table which exposes functions
+ provided by MSC function driver module.
+ */
+ const USBD_DFU_API_T* dfu; /**< Pointer to function table which exposes functions
+ provided by DFU function driver module.
+ */
+ const USBD_HID_API_T* hid; /**< Pointer to function table which exposes functions
+ provided by HID function driver module.
+ */
+ const USBD_CDC_API_T* cdc; /**< Pointer to function table which exposes functions
+ provided by CDC-ACM function driver module.
+ */
+ const uint32_t* reserved6; /**< Reserved for future function driver module.
+ */
+ const uint32_t version; /**< Version identifier of USB ROM stack. The version is
+ defined as 0x0CHDMhCC where each nibble represents version
+ number of the corresponding component.
+ CC - 7:0 - 8bit core version number
+ h - 11:8 - 4bit hardware interface version number
+ M - 15:12 - 4bit MSC class module version number
+ D - 19:16 - 4bit DFU class module version number
+ H - 23:20 - 4bit HID class module version number
+ C - 27:24 - 4bit CDC class module version number
+ H - 31:28 - 4bit reserved
+ */
+
+} USBD_API_T;
+
+/* Applications using USBD ROM API should define this instance. The pointer should be assigned a value computed based on chip definitions. */
+extern const USBD_API_T* g_pUsbApi;
+#define USBD_API g_pUsbApi
+
+#endif /*__MW_USBD_ROM_API_H*/
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd_15xx.h
new file mode 100644
index 0000000..e41b55e
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/usbd_15xx.h
@@ -0,0 +1,72 @@
+/*
+ * @brief LPC15xx USB device register block
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __USBD_15XX_H_
+#define __USBD_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup USBD_15XX CHIP: LPC15xx USB Device driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief USB device register block structure
+ */
+typedef struct { /*!< USB Structure */
+ __IO uint32_t DEVCMDSTAT; /*!< USB Device Command/Status register */
+ __IO uint32_t _INFO; /*!< USB Info register */
+ __IO uint32_t EPLISTSTART; /*!< USB EP Command/Status List start address */
+ __IO uint32_t DATABUFSTART; /*!< USB Data buffer start address */
+ __IO uint32_t LPM; /*!< Link Power Management register */
+ __IO uint32_t EPSKIP; /*!< USB Endpoint skip */
+ __IO uint32_t EPINUSE; /*!< USB Endpoint Buffer in use */
+ __IO uint32_t EPBUFCFG; /*!< USB Endpoint Buffer Configuration register */
+ __IO uint32_t INTSTAT; /*!< USB interrupt status register */
+ __IO uint32_t INTEN; /*!< USB interrupt enable register */
+ __IO uint32_t INTSETSTAT; /*!< USB set interrupt status register */
+ __IO uint32_t INTROUTING; /*!< USB interrupt routing register */
+ __I uint32_t RESERVED0[1];
+ __I uint32_t EPTOGGLE; /*!< USB Endpoint toggle register */
+} LPC_USB_T;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __USBD_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/wwdt_15xx.h b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/wwdt_15xx.h
new file mode 100644
index 0000000..a48f77a
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/inc/wwdt_15xx.h
@@ -0,0 +1,222 @@
+/*
+ * @brief LPC15xx WWDT chip driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __WWDT_15XX_H_
+#define __WWDT_15XX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup WWDT_15XX CHIP: LPC15xx Windowed Watchdog driver
+ * @ingroup CHIP_15XX_Drivers
+ * @{
+ */
+
+/**
+ * @brief Windowed Watchdog register block structure
+ */
+typedef struct { /*!< WWDT Structure */
+ __IO uint32_t MOD; /*!< Watchdog mode register. This register contains the basic mode and status of the Watchdog Timer. */
+ __IO uint32_t TC; /*!< Watchdog timer constant register. This register determines the time-out value. */
+ __O uint32_t FEED; /*!< Watchdog feed sequence register. Writing 0xAA followed by 0x55 to this register reloads the Watchdog timer with the value contained in WDTC. */
+ __I uint32_t TV; /*!< Watchdog timer value register. This register reads out the current value of the Watchdog timer. */
+ __IO uint32_t RESERVED;
+ __IO uint32_t WARNINT; /*!< Watchdog warning interrupt register. This register contains the Watchdog warning interrupt compare value. */
+ __IO uint32_t WINDOW; /*!< Watchdog timer window register. This register contains the Watchdog window value. */
+} LPC_WWDT_T;
+
+/**
+ * @brief Watchdog Mode register definitions
+ */
+/** Watchdog Mode Bitmask */
+#define WWDT_WDMOD_BITMASK ((uint32_t) 0x1F)
+/** WWDT interrupt enable bit */
+#define WWDT_WDMOD_WDEN ((uint32_t) (1 << 0))
+/** WWDT interrupt enable bit */
+#define WWDT_WDMOD_WDRESET ((uint32_t) (1 << 1))
+/** WWDT time out flag bit */
+#define WWDT_WDMOD_WDTOF ((uint32_t) (1 << 2))
+/** WDT Time Out flag bit */
+#define WWDT_WDMOD_WDINT ((uint32_t) (1 << 3))
+/** WWDT Protect flag bit */
+#define WWDT_WDMOD_WDPROTECT ((uint32_t) (1 << 4))
+/** WWDT lock bit */
+#define WWDT_WDMOD_LOCK ((uint32_t) (1 << 5))
+
+/**
+ * @brief Initialize the Watchdog timer
+ * @param pWWDT : The base of WatchDog Timer peripheral on the chip
+ * @return None
+ */
+void Chip_WWDT_Init(LPC_WWDT_T *pWWDT);
+
+/**
+ * @brief Shutdown the Watchdog timer
+ * @param pWWDT : The base of WatchDog Timer peripheral on the chip
+ * @return None
+ */
+STATIC INLINE void Chip_WWDT_DeInit(LPC_WWDT_T *pWWDT)
+{
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_WDT);
+}
+
+/**
+ * @brief Set WDT timeout constant value used for feed
+ * @param pWWDT : The base of WatchDog Timer peripheral on the chip
+ * @param timeout : WDT timeout in ticks, between WWDT_TICKS_MIN and WWDT_TICKS_MAX
+ * @return none
+ */
+STATIC INLINE void Chip_WWDT_SetTimeOut(LPC_WWDT_T *pWWDT, uint32_t timeout)
+{
+ pWWDT->TC = timeout;
+}
+
+/**
+ * @brief Feed watchdog timer
+ * @param pWWDT : The base of WatchDog Timer peripheral on the chip
+ * @return None
+ * @note If this function isn't called, a watchdog timer warning will occur.
+ * After the warning, a timeout will occur if a feed has happened.
+ */
+STATIC INLINE void Chip_WWDT_Feed(LPC_WWDT_T *pWWDT)
+{
+ pWWDT->FEED = 0xAA;
+ pWWDT->FEED = 0x55;
+}
+
+/**
+ * @brief Set WWDT warning interrupt
+ * @param pWWDT : The base of WatchDog Timer peripheral on the chip
+ * @param timeout : WDT warning in ticks, between 0 and 1023
+ * @return None
+ * @note This is the number of ticks after the watchdog interrupt that the
+ * warning interrupt will be generated.
+ */
+STATIC INLINE void Chip_WWDT_SetWarning(LPC_WWDT_T *pWWDT, uint32_t timeout)
+{
+ pWWDT->WARNINT = timeout;
+}
+
+/**
+ * @brief Set WWDT window time
+ * @param pWWDT : The base of WatchDog Timer peripheral on the chip
+ * @param timeout : WDT timeout in ticks, between WWDT_TICKS_MIN and WWDT_TICKS_MAX
+ * @return None
+ * @note The watchdog timer must be fed between the timeout from the Chip_WWDT_SetTimeOut()
+ * function and this function, with this function defining the last tick before the
+ * watchdog window interrupt occurs.
+ */
+STATIC INLINE void Chip_WWDT_SetWindow(LPC_WWDT_T *pWWDT, uint32_t timeout)
+{
+ pWWDT->WINDOW = timeout;
+}
+
+/**
+ * @brief Enable watchdog timer options
+ * @param pWWDT : The base of WatchDog Timer peripheral on the chip
+ * @param options : An or'ed set of options of values
+ * WWDT_WDMOD_WDEN, WWDT_WDMOD_WDRESET, and WWDT_WDMOD_WDPROTECT
+ * @return None
+ * @note You can enable more than one option at once (ie, WWDT_WDMOD_WDRESET |
+ * WWDT_WDMOD_WDPROTECT), but use the WWDT_WDMOD_WDEN after all other options
+ * are set (or unset) with no other options. If WWDT_WDMOD_LOCK is used, it cannot
+ * be unset.
+ */
+STATIC INLINE void Chip_WWDT_SetOption(LPC_WWDT_T *pWWDT, uint32_t options)
+{
+ pWWDT->MOD |= options;
+}
+
+/**
+ * @brief Disable/clear watchdog timer options
+ * @param pWWDT : The base of WatchDog Timer peripheral on the chip
+ * @param options : An or'ed set of options of values
+ * WWDT_WDMOD_WDEN, WWDT_WDMOD_WDRESET, and WWDT_WDMOD_WDPROTECT
+ * @return None
+ * @note You can disable more than one option at once (ie, WWDT_WDMOD_WDRESET |
+ * WWDT_WDMOD_WDTOF).
+ */
+STATIC INLINE void Chip_WWDT_UnsetOption(LPC_WWDT_T *pWWDT, uint32_t options)
+{
+ pWWDT->MOD &= (~options) & WWDT_WDMOD_BITMASK;
+}
+
+/**
+ * @brief Enable WWDT activity
+ * @param pWWDT : The base of WatchDog Timer peripheral on the chip
+ * @return None
+ */
+STATIC INLINE void Chip_WWDT_Start(LPC_WWDT_T *pWWDT)
+{
+ Chip_WWDT_SetOption(pWWDT, WWDT_WDMOD_WDEN);
+ Chip_WWDT_Feed(pWWDT);
+}
+
+/**
+ * @brief Read WWDT status flag
+ * @param pWWDT : The base of WatchDog Timer peripheral on the chip
+ * @return Watchdog status, an Or'ed value of WWDT_WDMOD_*
+ */
+STATIC INLINE uint32_t Chip_WWDT_GetStatus(LPC_WWDT_T *pWWDT)
+{
+ return pWWDT->MOD;
+}
+
+/**
+ * @brief Clear WWDT interrupt status flags
+ * @param pWWDT : The base of WatchDog Timer peripheral on the chip
+ * @param status : Or'ed value of status flag(s) that you want to clear, should be:
+ * - WWDT_WDMOD_WDTOF: Clear watchdog timeout flag
+ * - WWDT_WDMOD_WDINT: Clear watchdog warning flag
+ * @return None
+ */
+void Chip_WWDT_ClearStatusFlag(LPC_WWDT_T *pWWDT, uint32_t status);
+
+/**
+ * @brief Get the current value of WDT
+ * @param pWWDT : The base of WatchDog Timer peripheral on the chip
+ * @return current value of WDT
+ */
+STATIC INLINE uint32_t Chip_WWDT_GetCurrentCount(LPC_WWDT_T *pWWDT)
+{
+ return pWWDT->TV;
+}
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WWDT_15XX_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/acmp_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/acmp_15xx.c
new file mode 100644
index 0000000..96ffc37
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/acmp_15xx.c
@@ -0,0 +1,146 @@
+/*
+ * @brief LPC15xx Analog comparator driver
+ *
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Initializes the ACMP */
+void Chip_ACMP_Init(LPC_CMP_T *pACMP)
+{
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_ACMP0_PD | SYSCTL_POWERDOWN_ACMP1_PD |
+ SYSCTL_POWERDOWN_ACMP2_PD | SYSCTL_POWERDOWN_ACMP3_PD);
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_ACMP);
+ Chip_SYSCTL_PeriphReset(RESET_ACMP);
+}
+
+/* De-initializes the ACMP */
+void Chip_ACMP_Deinit(LPC_CMP_T *pACMP)
+{
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_ACMP);
+ Chip_SYSCTL_PowerDown(SYSCTL_POWERDOWN_ACMP0_PD | SYSCTL_POWERDOWN_ACMP1_PD |
+ SYSCTL_POWERDOWN_ACMP2_PD | SYSCTL_POWERDOWN_ACMP3_PD);
+}
+
+/*Sets up ACMP edge selection */
+void Chip_ACMP_SetIntEdgeSelection(LPC_CMP_T *pACMP, uint8_t index, CHIP_ACMP_EDGESEL_T edgeSel)
+{
+ /* Make sure interrupt flag is not set during read OR/AND and write operation */
+ uint32_t reg = (pACMP->ACMP[index].CMP & ~ACMP_INTFLAG_BIT) & ~ACMP_INTEDGE_MASK;
+
+ pACMP->ACMP[index].CMP = reg | (uint32_t) edgeSel;
+}
+
+/*Selects positive voltage input */
+void Chip_ACMP_SetPosVoltRef(LPC_CMP_T *pACMP, uint8_t index, CHIP_ACMP_POS_INPUT_T Posinput)
+{
+ /* Make sure interrupt flag is not set during read OR/AND and write operation */
+ uint32_t reg = (pACMP->ACMP[index].CMP & ~ACMP_INTFLAG_BIT) & ~ACMP_COMPVPSEL_MASK;
+
+ /* Select positive input */
+ pACMP->ACMP[index].CMP = reg | (uint32_t) Posinput;
+}
+
+/*Selects negative voltage input */
+void Chip_ACMP_SetNegVoltRef(LPC_CMP_T *pACMP, uint8_t index, CHIP_ACMP_NEG_INPUT_T Neginput)
+{
+ /* Make sure interrupt flag is not set during read OR/AND and write operation */
+ uint32_t reg = (pACMP->ACMP[index].CMP & ~ACMP_INTFLAG_BIT) & ~ACMP_COMPVMSEL_MASK;
+
+ /* Select negative input */
+ pACMP->ACMP[index].CMP = reg | (uint32_t) Neginput;
+}
+
+/*Selects hysteresis level */
+void Chip_ACMP_SetHysteresis(LPC_CMP_T *pACMP, uint8_t index, CHIP_ACMP_HYS_T hys)
+{
+ /* Make sure interrupt flag is not set during read OR/AND and write operation */
+ uint32_t reg = (pACMP->ACMP[index].CMP & ~ACMP_INTFLAG_BIT) & ~ACMP_HYSTERESIS_MASK;
+
+ pACMP->ACMP[index].CMP = reg | (uint32_t) hys;
+}
+
+/*Helper function for setting up ACMP voltage settings */
+void Chip_ACMP_SetupACMPRefs(LPC_CMP_T *pACMP, uint8_t index, CHIP_ACMP_POS_INPUT_T Posinput,
+ CHIP_ACMP_NEG_INPUT_T Neginput, CHIP_ACMP_HYS_T hys)
+{
+ /* Make sure interrupt flag is not set during read OR/AND and write operation */
+ uint32_t reg = (pACMP->ACMP[index].CMP & ~ACMP_INTFLAG_BIT) & ~(ACMP_HYSTERESIS_MASK |
+ ACMP_COMPVMSEL_MASK | ACMP_COMPVPSEL_MASK);
+
+ pACMP->ACMP[index].CMP = reg | (uint32_t) Posinput | (uint32_t) Neginput | (uint32_t) hys;
+}
+
+/*Helper function for setting up ACMP interrupt settings */
+void Chip_ACMP_SetupACMPInt(LPC_CMP_T *pACMP, uint8_t index, bool level,
+ bool invert, CHIP_ACMP_EDGESEL_T edgeSel)
+{
+ /* Make sure interrupt flag is not set during read OR/AND and write operation */
+ uint32_t reg = (pACMP->ACMP[index].CMP & ~ACMP_INTFLAG_BIT) & ~(ACMP_INTPOL_BIT |
+ ACMP_INTTYPE_BIT | ACMP_INTEDGE_MASK);
+ /* For Level triggered interrupt, invert sets the polarity
+ For edge triggered interrupt edgeSel sets the edge type */
+ if (level) {
+ reg |= ACMP_INTTYPE_BIT;
+ if (invert) {
+ reg |= ACMP_INTPOL_BIT;
+ }
+ }
+ else {
+ reg |= (uint32_t) edgeSel;
+ }
+
+ pACMP->ACMP[index].CMP = reg;
+}
+
+/*Sets up voltage ladder */
+void Chip_ACMP_SetupVoltLadder(LPC_CMP_T *pACMP, uint8_t index, uint32_t ladsel, bool ladrefVDDCMP)
+{
+ /* Make sure interrupt flag is not set during read OR/AND and write operation */
+ uint32_t reg = (pACMP->ACMP[index].CMP & ~ACMP_INTFLAG_BIT) & ~(ACMP_LADSEL_MASK | ACMP_LADREF_BIT);
+
+ /* Setup voltage ladder and ladder reference */
+ if (!ladrefVDDCMP) {
+ reg |= ACMP_LADREF_BIT;
+ }
+ pACMP->ACMP[index].CMP = reg | (ladsel << 24);
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/adc_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/adc_15xx.c
new file mode 100644
index 0000000..213099f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/adc_15xx.c
@@ -0,0 +1,229 @@
+/*
+ * @brief LPC15xx ADC driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Set ADC interrupt bits (safe) */
+void Chip_ADC_SetIntBits(LPC_ADC_T *pADC, uint32_t intMask)
+{
+ uint32_t temp;
+
+ /* Read and write values may not be the same, write 0 to
+ undefined bits */
+ temp = pADC->INTEN & 0x07FFFFFF;
+
+ pADC->INTEN = temp | intMask;
+}
+
+/* Clear ADC interrupt bits (safe) */
+void Chip_ADC_ClearIntBits(LPC_ADC_T *pADC, uint32_t intMask)
+{
+ uint32_t temp;
+
+ /* Read and write values may not be the same, write 0 to
+ undefined bits */
+ temp = pADC->INTEN & 0x07FFFFFF;
+
+ pADC->INTEN = temp & ~intMask;
+}
+
+/* Set ADC threshold selection bits (safe) */
+void Chip_ADC_SetTHRSELBits(LPC_ADC_T *pADC, uint32_t mask)
+{
+ uint32_t temp;
+
+ /* Read and write values may not be the same, write 0 to
+ undefined bits */
+ temp = pADC->CHAN_THRSEL & 0x00000FFF;
+
+ pADC->CHAN_THRSEL = temp | mask;
+}
+
+/* Clear ADC threshold selection bits (safe) */
+void Chip_ADC_ClearTHRSELBits(LPC_ADC_T *pADC, uint32_t mask)
+{
+ uint32_t temp;
+
+ /* Read and write values may not be the same, write 0 to
+ undefined bits */
+ temp = pADC->CHAN_THRSEL & 0x00000FFF;
+
+ pADC->CHAN_THRSEL = temp & ~mask;
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Initialize the ADC peripheral */
+void Chip_ADC_Init(LPC_ADC_T *pADC, uint32_t flags)
+{
+ /* Power up ADC and enable ADC base clock */
+ if (pADC == LPC_ADC0) {
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_ADC0_PD);
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_ADC0);
+ Chip_SYSCTL_PeriphReset(RESET_ADC0);
+ }
+ else {
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_ADC1_PD);
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_ADC1);
+ Chip_SYSCTL_PeriphReset(RESET_ADC1);
+ }
+
+ /* Disable ADC interrupts */
+ pADC->INTEN = 0;
+
+ /* Set ADC control options */
+ pADC->CTRL = flags;
+}
+
+/* Shutdown ADC */
+void Chip_ADC_DeInit(LPC_ADC_T *pADC)
+{
+ pADC->INTEN = 0;
+ pADC->CTRL = 0;
+
+ /* Stop ADC clock and then power down ADC */
+ if (pADC == LPC_ADC0) {
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_ADC0);
+ Chip_SYSCTL_PowerDown(SYSCTL_POWERDOWN_ADC0_PD);
+ }
+ else {
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_ADC1);
+ Chip_SYSCTL_PowerDown(SYSCTL_POWERDOWN_ADC1_PD);
+ }
+}
+
+/* Set ADC clock rate */
+void Chip_ADC_SetClockRate(LPC_ADC_T *pADC, uint32_t rate)
+{
+ uint32_t div;
+
+ /* Get ADC clock source to determine base ADC rate. IN sychronous mode,
+ the ADC base clock comes from the system clock. In ASYNC mode, it
+ comes from the ASYNC ADC clock and this function doesn't work. */
+ div = Chip_Clock_GetSystemClockRate() / rate;
+ if (div == 0) {
+ div = 1;
+ }
+
+ Chip_ADC_SetDivider(pADC, (uint8_t) div - 1);
+}
+
+/* Start ADC calibration */
+void Chip_ADC_StartCalibration(LPC_ADC_T *pADC)
+{
+ /* Set calibration mode */
+ pADC->CTRL |= ADC_CR_CALMODEBIT;
+
+ /* Clear ASYNC bit */
+ pADC->CTRL &= ~ADC_CR_ASYNMODE;
+
+ /* Setup ADC for about 500KHz (per UM) */
+ Chip_ADC_SetClockRate(pADC, 500000);
+
+ /* Clearn low power bit */
+ pADC->CTRL &= ~ADC_CR_LPWRMODEBIT;
+
+ /* Calibration is only complete when ADC_CR_CALMODEBIT bit has cleared */
+}
+
+/* Helper function for safely setting ADC sequencer register bits */
+void Chip_ADC_SetSequencerBits(LPC_ADC_T *pADC, ADC_SEQ_IDX_T seqIndex, uint32_t bits)
+{
+ uint32_t temp;
+
+ /* Read sequencer register and mask off bits 20..25 */
+ temp = pADC->SEQ_CTRL[seqIndex] & ~(0x3F << 20);
+
+ /* OR in passed bits */
+ pADC->SEQ_CTRL[seqIndex] = temp | bits;
+}
+
+/* Helper function for safely clearing ADC sequencer register bits */
+void Chip_ADC_ClearSequencerBits(LPC_ADC_T *pADC, ADC_SEQ_IDX_T seqIndex, uint32_t bits)
+{
+ uint32_t temp;
+
+ /* Read sequencer register and mask off bits 20..25 */
+ temp = pADC->SEQ_CTRL[seqIndex] & ~(0x3F << 20);
+
+ /* OR in passed bits */
+ pADC->SEQ_CTRL[seqIndex] = temp & ~bits;
+}
+
+/* Enable interrupts in ADC (sequencers A/B and overrun) */
+void Chip_ADC_EnableInt(LPC_ADC_T *pADC, uint32_t intMask)
+{
+ Chip_ADC_SetIntBits(pADC, intMask);
+}
+
+/* Disable interrupts in ADC (sequencers A/B and overrun) */
+void Chip_ADC_DisableInt(LPC_ADC_T *pADC, uint32_t intMask)
+{
+ Chip_ADC_ClearIntBits(pADC, intMask);
+}
+
+/* Enable a threshold event interrupt in ADC */
+void Chip_ADC_SetThresholdInt(LPC_ADC_T *pADC, uint8_t ch, ADC_INTEN_THCMP_T thInt)
+{
+ int shiftIndex = 3 + (ch * 2);
+
+ /* Clear current bits first */
+ Chip_ADC_ClearIntBits(pADC, (ADC_INTEN_CMP_MASK << shiftIndex));
+
+ /* Set new threshold interrupt type */
+ Chip_ADC_SetIntBits(pADC, ((uint32_t) thInt << shiftIndex));
+}
+
+/* Select threshold 0 values for comparison for selected channels */
+void Chip_ADC_SelectTH0Channels(LPC_ADC_T *pADC, uint32_t channels)
+{
+ Chip_ADC_ClearTHRSELBits(pADC, channels);
+}
+
+/* Select threshold 1 value for comparison for selected channels */
+void Chip_ADC_SelectTH1Channels(LPC_ADC_T *pADC, uint32_t channels)
+{
+ Chip_ADC_SetTHRSELBits(pADC, channels);
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/chip_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/chip_15xx.c
new file mode 100644
index 0000000..17e5f7d
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/chip_15xx.c
@@ -0,0 +1,85 @@
+/*
+ * @brief LPC15xx Miscellaneous chip specific functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/* System Clock Frequency (Core Clock) */
+uint32_t SystemCoreClock;
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Update system core clock rate, should be called if the system has
+ a clock rate change */
+void SystemCoreClockUpdate(void)
+{
+ /* CPU core speed */
+ SystemCoreClock = Chip_Clock_GetSystemClockRate();
+}
+
+void Chip_USB_Init(void)
+{
+ /* Set USB PLL input to main oscillator */
+ Chip_Clock_SetUSBPLLSource(SYSCTL_PLLCLKSRC_MAINOSC);
+ /* Setup USB PLL (FCLKIN = 12MHz) * 4 = 48MHz
+ MSEL = 3 (this is pre-decremented), PSEL = 1 (for P = 2)
+ FCLKOUT = FCLKIN * (MSEL + 1) = 12MHz * 4 = 48MHz
+ FCCO = FCLKOUT * 2 * P = 48MHz * 2 * 2 = 192MHz (within FCCO range) */
+ Chip_Clock_SetupUSBPLL(3, 1);
+
+ /* Powerup USB PLL */
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_USBPLL_PD);
+
+ /* Wait for PLL to lock */
+ while (!Chip_Clock_IsUSBPLLLocked()) {}
+
+ /* enable USB main clock */
+ Chip_Clock_SetUSBClockSource(SYSCTL_USBCLKSRC_PLLOUT, 1);
+ /* Enable AHB clock to the USB block. */
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_USB);
+ /* power UP USB Phy */
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_USBPHY_PD);
+ /* Reset USB block */
+ Chip_SYSCTL_PeriphReset(RESET_USB);
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/clock_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/clock_15xx.c
new file mode 100644
index 0000000..81b34b2
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/clock_15xx.c
@@ -0,0 +1,403 @@
+/*
+ * @brief LPC15XX System clock control functions
+ *
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Compute a PLL frequency */
+STATIC uint32_t Chip_Clock_GetPLLFreq(uint32_t PLLReg, uint32_t inputRate)
+{
+ uint32_t msel = ((PLLReg & 0x3F) + 1);
+
+ return inputRate * msel;
+}
+
+/* Return a PLL input (common) */
+STATIC uint32_t Chip_Clock_GetPLLInClockRate(uint32_t reg)
+{
+ uint32_t clkRate;
+
+ switch ((CHIP_SYSCTL_PLLCLKSRC_T) (reg & 0x3)) {
+ case SYSCTL_PLLCLKSRC_IRC:
+ clkRate = Chip_Clock_GetIntOscRate();
+ break;
+
+ case SYSCTL_PLLCLKSRC_MAINOSC:
+ clkRate = Chip_Clock_GetMainOscRate();
+ break;
+
+ default:
+ clkRate = 0;
+ }
+
+ return clkRate;
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Return System PLL input clock rate */
+uint32_t Chip_Clock_GetSystemPLLInClockRate(void)
+{
+ return Chip_Clock_GetPLLInClockRate(LPC_SYSCTL->SYSPLLCLKSEL);
+}
+
+/* Return System PLL output clock rate */
+uint32_t Chip_Clock_GetSystemPLLOutClockRate(void)
+{
+ return Chip_Clock_GetPLLFreq(LPC_SYSCTL->SYSPLLCTRL,
+ Chip_Clock_GetSystemPLLInClockRate());
+}
+
+/* Return USB PLL input clock rate */
+uint32_t Chip_Clock_GetUSBPLLInClockRate(void)
+{
+ return Chip_Clock_GetPLLInClockRate(LPC_SYSCTL->USBPLLCLKSEL);
+}
+
+/* Return USB PLL output clock rate */
+uint32_t Chip_Clock_GetUSBPLLOutClockRate(void)
+{
+ return Chip_Clock_GetPLLFreq(LPC_SYSCTL->USBPLLCTRL,
+ Chip_Clock_GetUSBPLLInClockRate());
+}
+
+/* Return SCT PLL input clock rate */
+uint32_t Chip_Clock_GetSCTPLLInClockRate(void)
+{
+ return Chip_Clock_GetPLLInClockRate(LPC_SYSCTL->SCTPLLCLKSEL);
+}
+
+/* Return SCT PLL output clock rate */
+uint32_t Chip_Clock_GetSCTPLLOutClockRate(void)
+{
+ return Chip_Clock_GetPLLFreq(LPC_SYSCTL->SCTPLLCTRL,
+ Chip_Clock_GetSCTPLLInClockRate());
+}
+
+/* Return main A clock rate */
+uint32_t Chip_Clock_GetMain_A_ClockRate(void)
+{
+ uint32_t clkRate = 0;
+
+ switch (Chip_Clock_GetMain_A_ClockSource()) {
+ case SYSCTL_MAIN_A_CLKSRC_IRC:
+ clkRate = Chip_Clock_GetIntOscRate();
+ break;
+
+ case SYSCTL_MAIN_A_CLKSRCA_MAINOSC:
+ clkRate = Chip_Clock_GetMainOscRate();
+ break;
+
+ case SYSCTL_MAIN_A_CLKSRCA_WDTOSC:
+ clkRate = Chip_Clock_GetWDTOSCRate();
+ break;
+
+ default:
+ clkRate = 0;
+ break;
+ }
+
+ return clkRate;
+}
+
+/* Return main B clock rate */
+uint32_t Chip_Clock_GetMain_B_ClockRate(void)
+{
+ uint32_t clkRate = 0;
+
+ switch (Chip_Clock_GetMain_B_ClockSource()) {
+ case SYSCTL_MAIN_B_CLKSRC_MAINCLKSELA:
+ clkRate = Chip_Clock_GetMain_A_ClockRate();
+ break;
+
+ case SYSCTL_MAIN_B_CLKSRC_SYSPLLIN:
+ clkRate = Chip_Clock_GetSystemPLLInClockRate();
+ break;
+
+ case SYSCTL_MAIN_B_CLKSRC_SYSPLLOUT:
+ clkRate = Chip_Clock_GetSystemPLLOutClockRate();
+ break;
+
+ case SYSCTL_MAIN_B_CLKSRC_RTC:
+ clkRate = Chip_Clock_GetRTCOscRate();
+ break;
+ }
+
+ return clkRate;
+}
+
+/* Set main system clock source */
+void Chip_Clock_SetMainClockSource(CHIP_SYSCTL_MAINCLKSRC_T src)
+{
+ uint32_t clkSrc = (uint32_t) src;
+
+ if (clkSrc >= 4) {
+ /* Main B source only, not using main A */
+ Chip_Clock_SetMain_B_ClockSource((CHIP_SYSCTL_MAIN_B_CLKSRC_T) (clkSrc - 4));
+ }
+ else {
+ /* Select main A clock source and set main B source to use main A */
+ Chip_Clock_SetMain_A_ClockSource((CHIP_SYSCTL_MAIN_A_CLKSRC_T) clkSrc);
+ Chip_Clock_SetMain_B_ClockSource(SYSCTL_MAIN_B_CLKSRC_MAINCLKSELA);
+ }
+}
+
+/* Returns the main clock source */
+CHIP_SYSCTL_MAINCLKSRC_T Chip_Clock_GetMainClockSource(void)
+{
+ CHIP_SYSCTL_MAIN_B_CLKSRC_T srcB;
+ uint32_t clkSrc;
+
+ /* Get main B clock source */
+ srcB = Chip_Clock_GetMain_B_ClockSource();
+ if (srcB == SYSCTL_MAIN_B_CLKSRC_MAINCLKSELA) {
+ /* Using source A, so return source A */
+ clkSrc = (uint32_t) Chip_Clock_GetMain_A_ClockSource();
+ }
+ else {
+ /* Using source B */
+ clkSrc = 4 + (uint32_t) srcB;
+ }
+
+ return (CHIP_SYSCTL_MAINCLKSRC_T) clkSrc;
+}
+
+/* Return main clock rate */
+uint32_t Chip_Clock_GetMainClockRate(void)
+{
+ uint32_t clkRate;
+
+ if (Chip_Clock_GetMain_B_ClockSource() == SYSCTL_MAIN_B_CLKSRC_MAINCLKSELA) {
+ /* Return main A clock rate */
+ clkRate = Chip_Clock_GetMain_A_ClockRate();
+ }
+ else {
+ /* Return main B clock rate */
+ clkRate = Chip_Clock_GetMain_B_ClockRate();
+ }
+
+ return clkRate;
+}
+
+/* Return ADC asynchronous clock rate */
+uint32_t Chip_Clock_GetADCASYNCRate(void)
+{
+ uint32_t clkRate = 0;
+
+ switch (Chip_Clock_GetADCASYNCSource()) {
+ case SYSCTL_ADCASYNCCLKSRC_IRC:
+ clkRate = Chip_Clock_GetIntOscRate();
+ break;
+
+ case SYSCTL_ADCASYNCCLKSRC_SYSPLLOUT:
+ clkRate = Chip_Clock_GetSystemPLLOutClockRate();
+ break;
+
+ case SYSCTL_ADCASYNCCLKSRC_USBPLLOUT:
+ clkRate = Chip_Clock_GetUSBPLLOutClockRate();
+ break;
+
+ case SYSCTL_ADCASYNCCLKSRC_SCTPLLOUT:
+ clkRate = Chip_Clock_GetSCTPLLOutClockRate();
+ break;
+ }
+
+ return clkRate;
+}
+
+/**
+ * @brief Set CLKOUT clock source and divider
+ * @param src : Clock source for CLKOUT
+ * @param div : divider for CLKOUT clock
+ * @return Nothing
+ * @note Use 0 to disable, or a divider value of 1 to 255. The CLKOUT clock
+ * rate is the clock source divided by the divider. This function will
+ * also toggle the clock source update register to update the clock
+ * source.
+ */
+void Chip_Clock_SetCLKOUTSource(CHIP_SYSCTL_CLKOUTSRC_T src, uint32_t div)
+{
+ uint32_t srcClk = (uint32_t) src;
+
+ /* Use a clock A source? */
+ if (src >= 4) {
+ /* Not using a CLKOUT A source */
+ LPC_SYSCTL->CLKOUTSEL[1] = srcClk - 4;
+ }
+ else {
+ /* Using a clock A source, select A and then switch B to A */
+ LPC_SYSCTL->CLKOUTSEL[0] = srcClk;
+ LPC_SYSCTL->CLKOUTSEL[1] = 0;
+ }
+
+ LPC_SYSCTL->CLKOUTDIV = div;
+}
+
+/* Enable a system or peripheral clock */
+void Chip_Clock_EnablePeriphClock(CHIP_SYSCTL_CLOCK_T clk)
+{
+ uint32_t clkEnab = (uint32_t) clk;
+
+ if (clkEnab >= 32) {
+ LPC_SYSCTL->SYSAHBCLKCTRL[1] |= (1 << (clkEnab - 32));
+ }
+ else {
+ LPC_SYSCTL->SYSAHBCLKCTRL[0] |= (1 << clkEnab);
+ }
+}
+
+/* Disable a system or peripheral clock */
+void Chip_Clock_DisablePeriphClock(CHIP_SYSCTL_CLOCK_T clk)
+{
+ uint32_t clkEnab = (uint32_t) clk;
+
+ if (clkEnab >= 32) {
+ LPC_SYSCTL->SYSAHBCLKCTRL[1] &= ~(1 << (clkEnab - 32));
+ }
+ else {
+ LPC_SYSCTL->SYSAHBCLKCTRL[0] &= ~(1 << clkEnab);
+ }
+}
+
+/* Returns the system tick rate as used with the system tick divider */
+uint32_t Chip_Clock_GetSysTickClockRate(void)
+{
+ uint32_t sysRate, div;
+
+ div = Chip_Clock_GetSysTickClockDiv();
+
+ /* If divider is 0, the system tick clock is disabled */
+ if (div == 0) {
+ sysRate = 0;
+ }
+ else {
+ sysRate = Chip_Clock_GetMainClockRate() / div;
+ }
+
+ return sysRate;
+}
+
+/* Get UART base rate */
+uint32_t Chip_Clock_GetUARTBaseClockRate(void)
+{
+ uint64_t inclk;
+ uint32_t div;
+
+ div = (uint32_t) Chip_Clock_GetUARTFRGDivider();
+ if (div == 0) {
+ /* Divider is 0 so UART clock is disabled */
+ inclk = 0;
+ }
+ else {
+ uint32_t mult, divmult;
+
+ /* Input clock into FRG block is the divided main system clock */
+ inclk = (uint64_t) (Chip_Clock_GetMainClockRate() / div);
+
+ divmult = LPC_SYSCTL->FRGCTRL & 0xFFFF;
+ if ((divmult & 0xFF) == 0xFF) {
+ /* Fractional part is enabled, get multiplier */
+ mult = (divmult >> 8) & 0xFF;
+
+ /* Get fractional error */
+ inclk = (inclk * 256) / (uint64_t) (256 + mult);
+ }
+ }
+
+ return (uint32_t) inclk;
+}
+
+/* Set UART base rate */
+uint32_t Chip_Clock_SetUARTBaseClockRate(uint32_t rate, bool fEnable)
+{
+ uint32_t div, inclk;
+
+ /* Input clock into FRG block is the main system cloock */
+ inclk = Chip_Clock_GetMainClockRate();
+
+ /* Get integer divider for coarse rate */
+ div = inclk / rate;
+ if (div == 0) {
+ div = 1;
+ }
+
+ /* Approximated rate with only integer divider */
+ Chip_Clock_SetUARTFRGDivider((uint8_t) div);
+
+ if (fEnable) {
+ uint32_t err;
+ uint64_t uart_fra_multiplier;
+
+ err = inclk - (rate * div);
+ uart_fra_multiplier = ((uint64_t) err * 256) / (uint64_t) (rate * div);
+
+ /* Enable fractional divider and set multiplier */
+ LPC_SYSCTL->FRGCTRL = 0xFF | ((uart_fra_multiplier & 0xFF) << 8);
+ }
+ else {
+ /* Disable fractional generator and use integer divider only */
+ LPC_SYSCTL->FRGCTRL = 0;
+ }
+
+ return Chip_Clock_GetUARTBaseClockRate();
+}
+
+/* Bypass System Oscillator and set oscillator frequency range */
+void Chip_Clock_SetPLLBypass(bool bypass, bool highfr)
+{
+ uint32_t ctrl = 0;
+
+ if (bypass) {
+ ctrl |= (1 << 0);
+ }
+ if (highfr) {
+ ctrl |= (1 << 1);
+ }
+
+ LPC_SYSCTL->SYSOSCCTRL = ctrl;
+}
+
+/* Return system clock rate */
+uint32_t Chip_Clock_GetSystemClockRate(void)
+{
+ /* No point in checking for divide by 0 */
+ return Chip_Clock_GetMainClockRate() / LPC_SYSCTL->SYSAHBCLKDIV;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/crc_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/crc_15xx.c
new file mode 100644
index 0000000..5b23c0b
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/crc_15xx.c
@@ -0,0 +1,118 @@
+/*
+ * @brief LPC15xx Cyclic Redundancy Check (CRC) Engine driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licenser disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Initialize CRC engine */
+void Chip_CRC_Init(void)
+{
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_CRC);
+ Chip_SYSCTL_PeriphReset(RESET_CRC);
+}
+
+/* De-initialize CRC engine */
+void Chip_CRC_Deinit(void)
+{
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_CRC);
+}
+
+/* Sets up the CRC engine with defaults based on the polynomial to be used */
+void Chip_CRC_UseDefaultConfig(CRC_POLY_T poly)
+{
+ switch (poly) {
+ case CRC_POLY_CRC16:
+ Chip_CRC_UseCRC16();
+ break;
+
+ case CRC_POLY_CRC32:
+ Chip_CRC_UseCRC32();
+ break;
+
+ case CRC_POLY_CCITT:
+ default:
+ Chip_CRC_UseCCITT();
+ break;
+ }
+}
+
+/* configure CRC engine and compute CCITT checksum from 8-bit data */
+uint32_t Chip_CRC_CRC8(const uint8_t *data, uint32_t bytes)
+{
+ Chip_CRC_UseCCITT();
+ while (bytes > 0) {
+ Chip_CRC_Write8(*data);
+ data++;
+ bytes--;
+ }
+
+ return Chip_CRC_Sum();
+}
+
+/* Convenience function for computing a standard CRC16 checksum from 16-bit data block */
+uint32_t Chip_CRC_CRC16(const uint16_t *data, uint32_t hwords)
+{
+ Chip_CRC_UseCRC16();
+ while (hwords > 0) {
+ Chip_CRC_Write16(*data);
+ data++;
+ hwords--;
+ }
+
+ return Chip_CRC_Sum();
+}
+
+/* Convenience function for computing a standard CRC32 checksum from 32-bit data block */
+uint32_t Chip_CRC_CRC32(const uint32_t *data, uint32_t words)
+{
+ Chip_CRC_UseCRC32();
+ while (words > 0) {
+ Chip_CRC_Write32(*data);
+ data++;
+ words--;
+ }
+
+ return Chip_CRC_Sum();
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/dac_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/dac_15xx.c
new file mode 100644
index 0000000..08781b8
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/dac_15xx.c
@@ -0,0 +1,62 @@
+/*
+ * @brief LPC15xx D/A conversion driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Initialize the DAC peripheral */
+void Chip_DAC_Init(LPC_DAC_T *pDAC)
+{
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_DAC_PD);
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_DAC);
+}
+
+/* Shutdown DAC peripheral */
+void Chip_DAC_DeInit(LPC_DAC_T *pDAC)
+{
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_DAC);
+ Chip_SYSCTL_PowerDown(SYSCTL_POWERDOWN_DAC_PD);
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/dma_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/dma_15xx.c
new file mode 100644
index 0000000..f72f9e9
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/dma_15xx.c
@@ -0,0 +1,115 @@
+/*
+ * @brief LPC15xx DMA chip driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/* DMA SRAM table - this can be optionally used with the Chip_DMA_SetSRAMBase()
+ function if a DMA SRAM table is needed. This table is correctly aligned for
+ the DMA controller. */
+#if defined(__CC_ARM)
+/* Keil alignement to 512 bytes */
+__align(512) DMA_CHDESC_T Chip_DMA_Table[MAX_DMA_CHANNEL];
+#endif /* defined (__CC_ARM) */
+
+/* IAR support */
+#if defined(__ICCARM__)
+/* IAR EWARM alignement to 512 bytes */
+#pragma data_alignment=512
+DMA_CHDESC_T Chip_DMA_Table[MAX_DMA_CHANNEL];
+#endif /* defined (__ICCARM__) */
+
+#if defined( __GNUC__ )
+/* GNU alignement to 512 bytes */
+DMA_CHDESC_T Chip_DMA_Table[MAX_DMA_CHANNEL] __attribute__ ((aligned(512)));
+#endif /* defined (__GNUC__) */
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set DMA transfer register interrupt bits (safe) */
+void Chip_DMA_SetTranBits(LPC_DMA_T *pDMA, DMA_CHID_T ch, uint32_t mask)
+{
+ uint32_t temp;
+
+ /* Read and write values may not be the same, write 0 to
+ undefined bits */
+ temp = pDMA->DMACH[ch].XFERCFG & ~0xFC000CC0;
+
+ pDMA->DMACH[ch].XFERCFG = temp | mask;
+}
+
+/* Clear DMA transfer register interrupt bits (safe) */
+void Chip_DMA_ClearTranBits(LPC_DMA_T *pDMA, DMA_CHID_T ch, uint32_t mask)
+{
+ uint32_t temp;
+
+ /* Read and write values may not be the same, write 0 to
+ undefined bits */
+ temp = pDMA->DMACH[ch].XFERCFG & ~0xFC000CC0;
+
+ pDMA->DMACH[ch].XFERCFG = temp & ~mask;
+}
+
+/* Update the transfer size in an existing DMA channel transfer configuration */
+void Chip_DMA_SetupChannelTransferSize(LPC_DMA_T *pDMA, DMA_CHID_T ch, uint32_t trans)
+{
+ Chip_DMA_ClearTranBits(pDMA, ch, (0x3FF << 16));
+ Chip_DMA_SetTranBits(pDMA, ch, DMA_XFERCFG_XFERCOUNT(trans));
+}
+
+/* Sets up a DMA channel with the passed DMA transfer descriptor */
+bool Chip_DMA_SetupTranChannel(LPC_DMA_T *pDMA, DMA_CHID_T ch, DMA_CHDESC_T *desc)
+{
+ bool good = false;
+ DMA_CHDESC_T *pDesc = (DMA_CHDESC_T *) pDMA->SRAMBASE;
+
+ if ((Chip_DMA_GetActiveChannels(pDMA) & (1 << ch)) == 0) {
+ /* Channel is not active, so update the descriptor */
+ pDesc[ch] = *desc;
+
+ good = true;
+ }
+
+ return good;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/eeprom.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/eeprom.c
new file mode 100644
index 0000000..3c987c1
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/eeprom.c
@@ -0,0 +1,79 @@
+/*
+ * @brief Common EEPROM support functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+#include "eeprom.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Write data to EEPROM */
+uint8_t Chip_EEPROM_Write(uint32_t dstAdd, uint8_t *ptr, uint32_t byteswrt)
+{
+ uint32_t command[5], result[4];
+
+ command[0] = IAP_EEPROM_WRITE;
+ command[1] = dstAdd;
+ command[2] = (uint32_t) ptr;
+ command[3] = byteswrt;
+ command[4] = SystemCoreClock / 1000;
+ iap_entry(command, result);
+
+ return result[0];
+}
+
+/* Read data from EEPROM */
+uint8_t Chip_EEPROM_Read(uint32_t srcAdd, uint8_t *ptr, uint32_t bytesrd)
+{
+ uint32_t command[5], result[4];
+
+ command[0] = IAP_EEPROM_READ;
+ command[1] = srcAdd;
+ command[2] = (uint32_t) ptr;
+ command[3] = bytesrd;
+ command[4] = SystemCoreClock / 1000;
+ iap_entry(command, result);
+
+ return result[0];
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/gpio_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/gpio_15xx.c
new file mode 100644
index 0000000..4205037
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/gpio_15xx.c
@@ -0,0 +1,112 @@
+/*
+ * @brief LPC15xx GPIO driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Initialize GPIO block */
+void Chip_GPIO_Init(LPC_GPIO_T *pGPIO)
+{
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_GPIO0);
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_GPIO1);
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_GPIO2);
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_MUX);
+
+ Chip_SYSCTL_PeriphReset(RESET_MUX);
+}
+
+/* De-Initialize GPIO block */
+void Chip_GPIO_DeInit(LPC_GPIO_T *pGPIO)
+{
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_GPIO0);
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_GPIO1);
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_GPIO2);
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_MUX);
+}
+
+/* Set a GPIO direction */
+void Chip_GPIO_WriteDirBit(LPC_GPIO_T *pGPIO, uint32_t port, uint8_t bit, bool setting)
+{
+ if (setting) {
+ pGPIO->DIR[port] |= 1UL << bit;
+ }
+ else {
+ pGPIO->DIR[port] &= ~(1UL << bit);
+ }
+}
+
+/* Set Direction for a GPIO port */
+void Chip_GPIO_SetDir(LPC_GPIO_T *pGPIO, uint8_t portNum, uint32_t bitValue, uint8_t out)
+{
+ if (out) {
+ pGPIO->DIR[portNum] |= bitValue;
+ }
+ else {
+ pGPIO->DIR[portNum] &= ~bitValue;
+ }
+}
+
+/* Set GPIO direction for a single GPIO pin */
+void Chip_GPIO_SetPinDIR(LPC_GPIO_T *pGPIO, uint8_t port, uint8_t pin, bool output)
+{
+ if (output) {
+ Chip_GPIO_SetPinDIROutput(pGPIO, port, pin);
+ }
+ else {
+ Chip_GPIO_SetPinDIRInput(pGPIO, port, pin);
+ }
+}
+
+/* Set GPIO direction for a all selected GPIO pins to an input or output */
+void Chip_GPIO_SetPortDIR(LPC_GPIO_T *pGPIO, uint8_t port, uint32_t pinMask, bool outSet)
+{
+ if (outSet) {
+ Chip_GPIO_SetPortDIROutput(pGPIO, port, pinMask);
+ }
+ else {
+ Chip_GPIO_SetPortDIRInput(pGPIO, port, pinMask);
+ }
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/i2c_common_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/i2c_common_15xx.c
new file mode 100644
index 0000000..8adfe7f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/i2c_common_15xx.c
@@ -0,0 +1,65 @@
+/*
+ * @brief LPC15xx I2C Common driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Initializes the LPC_I2C peripheral */
+void Chip_I2C_Init(LPC_I2C_T *pI2C)
+{
+ /* Enable I2C clock */
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_I2C0);
+
+ /* Peripheral reset control to I2C */
+ Chip_SYSCTL_PeriphReset(RESET_I2C0);
+}
+
+/* Shuts down the I2C controller block */
+void Chip_I2C_DeInit(LPC_I2C_T *pI2C)
+{
+ /* Disable I2C clock */
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_I2C0);
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/i2cm_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/i2cm_15xx.c
new file mode 100644
index 0000000..3d31e14
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/i2cm_15xx.c
@@ -0,0 +1,178 @@
+/*
+ * @brief LPC15xx I2C master driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up bus speed for LPC_I2C interface */
+void Chip_I2CM_SetBusSpeed(LPC_I2C_T *pI2C, uint32_t busSpeed)
+{
+ uint32_t scl = Chip_Clock_GetMainClockRate() / (Chip_I2C_GetClockDiv(pI2C) * busSpeed);
+ Chip_I2CM_SetDutyCycle(pI2C, (scl >> 1), (scl - (scl >> 1)));
+}
+
+/* Master transfer state change handler handler */
+uint32_t Chip_I2CM_XferHandler(LPC_I2C_T *pI2C, I2CM_XFER_T *xfer)
+{
+ uint32_t status = Chip_I2CM_GetStatus(pI2C);
+ /* Master Lost Arbitration */
+ if (status & I2C_STAT_MSTRARBLOSS) {
+ /* Set transfer status as Arbitration Lost */
+ xfer->status = I2CM_STATUS_ARBLOST;
+ /* Clear Status Flags */
+ Chip_I2CM_ClearStatus(pI2C, I2C_STAT_MSTRARBLOSS);
+ }
+ /* Master Start Stop Error */
+ else if (status & I2C_STAT_MSTSTSTPERR) {
+ /* Set transfer status as Bus Error */
+ xfer->status = I2CM_STATUS_BUS_ERROR;
+ /* Clear Status Flags */
+ Chip_I2CM_ClearStatus(pI2C, I2C_STAT_MSTSTSTPERR);
+ }
+ /* Master is Pending */
+ else if (status & I2C_STAT_MSTPENDING) {
+ /* Branch based on Master State Code */
+ switch (Chip_I2CM_GetMasterState(pI2C)) {
+ /* Master idle */
+ case I2C_STAT_MSTCODE_IDLE:
+ /* Do Nothing */
+ break;
+
+ /* Receive data is available */
+ case I2C_STAT_MSTCODE_RXREADY:
+ /* Read Data */
+ *xfer->rxBuff++ = pI2C->MSTDAT;
+ xfer->rxSz--;
+ if (xfer->rxSz) {
+ /* Set Continue if there is more data to read */
+ Chip_I2CM_MasterContinue(pI2C);
+ }
+ else {
+ /* Set transfer status as OK */
+ xfer->status = I2CM_STATUS_OK;
+ /* No data to read send Stop */
+ Chip_I2CM_SendStop(pI2C);
+ }
+ break;
+
+ /* Master Transmit available */
+ case I2C_STAT_MSTCODE_TXREADY:
+ if (xfer->txSz) {
+ /* If Tx data available transmit data and continue */
+ pI2C->MSTDAT = *xfer->txBuff++;
+ xfer->txSz--;
+ Chip_I2CM_MasterContinue(pI2C);
+ }
+ else {
+ /* If receive queued after transmit then initiate master receive transfer*/
+ if (xfer->rxSz) {
+ /* Write Address and RW bit to data register */
+ Chip_I2CM_WriteByte(pI2C, (xfer->slaveAddr << 1) | 0x1);
+ /* Enter to Master Transmitter mode */
+ Chip_I2CM_SendStart(pI2C);
+ }
+ else {
+ /* If no receive queued then set transfer status as OK */
+ xfer->status = I2CM_STATUS_OK;
+ /* Send Stop */
+ Chip_I2CM_SendStop(pI2C);
+ }
+ }
+ break;
+
+ case I2C_STAT_MSTCODE_NACKADR:
+ /* Set transfer status as NACK on address */
+ xfer->status = I2CM_STATUS_NAK_ADR;
+ Chip_I2CM_SendStop(pI2C);
+ break;
+
+ case I2C_STAT_MSTCODE_NACKDAT:
+ /* Set transfer status as NACK on data */
+ xfer->status = I2CM_STATUS_NAK_DAT;
+ Chip_I2CM_SendStop(pI2C);
+ break;
+
+ default:
+ /* Default case should not occur*/
+ xfer->status = I2CM_STATUS_ERROR;
+ break;
+ }
+ }
+ else {
+ /* Default case should not occur */
+ xfer->status = I2CM_STATUS_ERROR;
+ }
+ return xfer->status != I2CM_STATUS_BUSY;
+}
+
+/* Transmit and Receive data in master mode */
+void Chip_I2CM_Xfer(LPC_I2C_T *pI2C, I2CM_XFER_T *xfer)
+{
+ /* set the transfer status as busy */
+ xfer->status = I2CM_STATUS_BUSY;
+ /* Clear controller state. */
+ Chip_I2CM_ClearStatus(pI2C, I2C_STAT_MSTRARBLOSS | I2C_STAT_MSTSTSTPERR);
+ /* Write Address and RW bit to data register */
+ Chip_I2CM_WriteByte(pI2C, (xfer->slaveAddr << 1) | (xfer->txSz == 0));
+ /* Enter to Master Transmitter mode */
+ Chip_I2CM_SendStart(pI2C);
+}
+
+/* Transmit and Receive data in master mode */
+uint32_t Chip_I2CM_XferBlocking(LPC_I2C_T *pI2C, I2CM_XFER_T *xfer)
+{
+ uint32_t ret = 0;
+ /* start transfer */
+ Chip_I2CM_Xfer(pI2C, xfer);
+
+ while (ret == 0) {
+ /* wait for status change interrupt */
+ while (!Chip_I2CM_IsMasterPending(pI2C)) {}
+ /* call state change handler */
+ ret = Chip_I2CM_XferHandler(pI2C, xfer);
+ }
+ return ret;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/i2cs_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/i2cs_15xx.c
new file mode 100644
index 0000000..95c491f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/i2cs_15xx.c
@@ -0,0 +1,98 @@
+/*
+ * @brief LPC15xx I2C slave driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Slave transfer state change handler */
+uint32_t Chip_I2CS_XferHandler(LPC_I2C_T *pI2C, const I2CS_XFER_T *xfers)
+{
+ uint32_t done = 0;
+
+ uint8_t data;
+ uint32_t state;
+
+ /* transfer complete? */
+ if ((Chip_I2C_GetPendingInt(pI2C) & I2C_INTENSET_SLVDESEL) != 0) {
+ Chip_I2CS_ClearStatus(pI2C, I2C_STAT_SLVDESEL);
+ xfers->slaveDone();
+ }
+ else {
+ /* Determine the current I2C slave state */
+ state = Chip_I2CS_GetSlaveState(pI2C);
+
+ switch (state) {
+ case I2C_STAT_SLVCODE_ADDR: /* Slave address received */
+ /* Get slave address that needs servicing */
+ data = Chip_I2CS_GetSlaveAddr(pI2C, Chip_I2CS_GetSlaveMatchIndex(pI2C));
+
+ /* Call address callback */
+ xfers->slaveStart(data);
+ break;
+
+ case I2C_STAT_SLVCODE_RX: /* Data byte received */
+ /* Get received data */
+ data = Chip_I2CS_ReadByte(pI2C);
+ done = xfers->slaveRecv(data);
+ break;
+
+ case I2C_STAT_SLVCODE_TX: /* Get byte that needs to be sent */
+ /* Get data to send */
+ done = xfers->slaveSend(&data);
+ Chip_I2CS_WriteByte(pI2C, data);
+ break;
+ }
+ }
+
+ if (done == 0) {
+ Chip_I2CS_SlaveContinue(pI2C);
+ }
+ else {
+ Chip_I2CS_SlaveNACK(pI2C);
+ }
+
+ return done;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/iap.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/iap.c
new file mode 100644
index 0000000..0edcf95
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/iap.c
@@ -0,0 +1,175 @@
+/*
+ * @brief Common FLASH support functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Prepare sector for write operation */
+uint8_t Chip_IAP_PreSectorForReadWrite(uint32_t strSector, uint32_t endSector)
+{
+ uint32_t command[5], result[4];
+
+ command[0] = IAP_PREWRRITE_CMD;
+ command[1] = strSector;
+ command[2] = endSector;
+ iap_entry(command, result);
+
+ return result[0];
+}
+
+/* Copy RAM to flash */
+uint8_t Chip_IAP_CopyRamToFlash(uint32_t dstAdd, uint32_t *srcAdd, uint32_t byteswrt)
+{
+ uint32_t command[5], result[4];
+
+ command[0] = IAP_WRISECTOR_CMD;
+ command[1] = dstAdd;
+ command[2] = (uint32_t) srcAdd;
+ command[3] = byteswrt;
+ command[4] = SystemCoreClock / 1000;
+ iap_entry(command, result);
+
+ return result[0];
+}
+
+/* Erase sector */
+uint8_t Chip_IAP_EraseSector(uint32_t strSector, uint32_t endSector)
+{
+ uint32_t command[5], result[4];
+
+ command[0] = IAP_ERSSECTOR_CMD;
+ command[1] = strSector;
+ command[2] = endSector;
+ command[3] = SystemCoreClock / 1000;
+ iap_entry(command, result);
+
+ return result[0];
+}
+
+/* Blank check sector */
+uint8_t Chip_IAP_BlankCheckSector(uint32_t strSector, uint32_t endSector)
+{
+ uint32_t command[5], result[4];
+
+ command[0] = IAP_BLANK_CHECK_SECTOR_CMD;
+ command[1] = strSector;
+ command[2] = endSector;
+ iap_entry(command, result);
+
+ return result[0];
+}
+
+/* Read part identification number */
+uint32_t Chip_IAP_ReadPID()
+{
+ uint32_t command[5], result[4];
+
+ command[0] = IAP_REPID_CMD;
+ iap_entry(command, result);
+
+ return result[1];
+}
+
+/* Read boot code version number */
+uint8_t Chip_IAP_ReadBootCode()
+{
+ uint32_t command[5], result[4];
+
+ command[0] = IAP_READ_BOOT_CODE_CMD;
+ iap_entry(command, result);
+
+ return result[0];
+}
+
+/* IAP compare */
+uint8_t Chip_IAP_Compare(uint32_t dstAdd, uint32_t srcAdd, uint32_t bytescmp)
+{
+ uint32_t command[5], result[4];
+
+ command[0] = IAP_COMPARE_CMD;
+ command[1] = dstAdd;
+ command[2] = srcAdd;
+ command[3] = bytescmp;
+ iap_entry(command, result);
+
+ return result[0];
+}
+
+/* Reinvoke ISP */
+uint8_t Chip_IAP_ReinvokeISP()
+{
+ uint32_t command[5], result[4];
+
+ command[0] = IAP_REINVOKE_ISP_CMD;
+ iap_entry(command, result);
+
+ return result[0];
+}
+
+/* Read the unique ID */
+uint32_t Chip_IAP_ReadUID()
+{
+ uint32_t command[5], result[4];
+
+ command[0] = IAP_READ_UID_CMD;
+ iap_entry(command, result);
+
+ return result[1];
+}
+
+/* Erase page */
+uint8_t Chip_IAP_ErasePage(uint32_t strPage, uint32_t endPage)
+{
+ uint32_t command[5], result[4];
+
+ command[0] = IAP_ERASE_PAGE_CMD;
+ command[1] = strPage;
+ command[2] = endPage;
+ command[3] = SystemCoreClock / 1000;
+ iap_entry(command, result);
+
+ return result[0];
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/iocon_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/iocon_15xx.c
new file mode 100644
index 0000000..364d80c
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/iocon_15xx.c
@@ -0,0 +1,56 @@
+/*
+ * @brief LPC15xx IOCON driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set all I/O Control pin muxing */
+void Chip_IOCON_SetPinMuxing(LPC_IOCON_T *pIOCON, const PINMUX_GRP_T *pinArray, uint32_t arrayLength)
+{
+ uint32_t ix;
+
+ for (ix = 0; ix < arrayLength; ix++ ) {
+ Chip_IOCON_PinMuxSet(pIOCON, pinArray[ix].port, pinArray[ix].pin, pinArray[ix].modefunc);
+ }
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/pinint_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/pinint_15xx.c
new file mode 100644
index 0000000..e5e893c
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/pinint_15xx.c
@@ -0,0 +1,48 @@
+/*
+ * @brief LPC15xx Pin Interrupt driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licenser disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/pmu_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/pmu_15xx.c
new file mode 100644
index 0000000..74ca29a
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/pmu_15xx.c
@@ -0,0 +1,103 @@
+/*
+ * @brief LPC15xx PMU chip driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Enter MCU Sleep mode */
+void Chip_PMU_SleepState(LPC_PMU_T *pPMU)
+{
+ Chip_PMU_ClearSleepFlags(LPC_PMU, PMU_PCON_SLEEPFLAG | PMU_PCON_DPDFLAG);
+ /* Enter sleep mode */
+ __WFI();
+}
+
+/* Enter MCU Deep Sleep mode */
+void Chip_PMU_DeepSleepState(LPC_PMU_T *pPMU)
+{
+ Chip_PMU_ClearSleepFlags(LPC_PMU, PMU_PCON_SLEEPFLAG | PMU_PCON_DPDFLAG);
+ SCB->SCR |= (1UL << SCB_SCR_SLEEPDEEP_Pos);
+ /* Enter deep sleep mode */
+ __WFI();
+}
+
+/* Enter MCU Power down mode */
+void Chip_PMU_PowerDownState(LPC_PMU_T *pPMU)
+{
+ Chip_PMU_ClearSleepFlags(LPC_PMU, PMU_PCON_SLEEPFLAG | PMU_PCON_DPDFLAG);
+ SCB->SCR |= (1UL << SCB_SCR_SLEEPDEEP_Pos);
+ // There seems to be no difference between Deep sleep and power down mode, use ROM API
+ /* Enter power down mode */
+ __WFI();
+}
+
+/* Enter MCU Deep Power down mode */
+void Chip_PMU_DeepPowerDownState(LPC_PMU_T *pPMU)
+{
+ Chip_PMU_ClearSleepFlags(LPC_PMU, PMU_PCON_SLEEPFLAG | PMU_PCON_DPDFLAG);
+ SCB->SCR |= (1UL << SCB_SCR_SLEEPDEEP_Pos);
+ pPMU->PCON = PMU_PCON_PM_DEEPPOWERDOWN;
+ /* Enter deep power down mode */
+ __WFI();
+}
+
+/* Put some of the peripheral in sleep mode */
+void Chip_PMU_Sleep(LPC_PMU_T *pPMU, CHIP_PMU_MCUPOWER_T SleepMode)
+{
+ if (SleepMode == PMU_MCU_DEEP_SLEEP) {
+ Chip_PMU_DeepSleepState(pPMU);
+ }
+ else if (SleepMode == PMU_MCU_POWER_DOWN) {
+ Chip_PMU_PowerDownState(pPMU);
+ }
+ else if (SleepMode == PMU_MCU_DEEP_PWRDOWN) {
+ Chip_PMU_DeepPowerDownState(pPMU);
+ }
+ else {
+ /* PMU_MCU_SLEEP */
+ Chip_PMU_SleepState(pPMU);
+ }
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/ring_buffer.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/ring_buffer.c
new file mode 100644
index 0000000..d18f02a
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/ring_buffer.c
@@ -0,0 +1,167 @@
+/*
+ * @brief Common ring buffer support functions
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2012
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include <string.h>
+#include "ring_buffer.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+#define RB_INDH(rb) ((rb)->head & ((rb)->count - 1))
+#define RB_INDT(rb) ((rb)->tail & ((rb)->count - 1))
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Initialize ring buffer */
+int RingBuffer_Init(RINGBUFF_T *RingBuff, void *buffer, int itemSize, int count)
+{
+ RingBuff->data = buffer;
+ RingBuff->count = count;
+ RingBuff->itemSz = itemSize;
+ RingBuff->head = RingBuff->tail = 0;
+
+ return 1;
+}
+
+/* Insert a single item into Ring Buffer */
+int RingBuffer_Insert(RINGBUFF_T *RingBuff, const void *data)
+{
+ uint8_t *ptr = RingBuff->data;
+
+ /* We cannot insert when queue is full */
+ if (RingBuffer_IsFull(RingBuff))
+ return 0;
+
+ ptr += RB_INDH(RingBuff) * RingBuff->itemSz;
+ memcpy(ptr, data, RingBuff->itemSz);
+ RingBuff->head++;
+
+ return 1;
+}
+
+/* Insert multiple items into Ring Buffer */
+int RingBuffer_InsertMult(RINGBUFF_T *RingBuff, const void *data, int num)
+{
+ uint8_t *ptr = RingBuff->data;
+ int cnt1, cnt2;
+
+ /* We cannot insert when queue is full */
+ if (RingBuffer_IsFull(RingBuff))
+ return 0;
+
+ /* Calculate the segment lengths */
+ cnt1 = cnt2 = RingBuffer_GetFree(RingBuff);
+ if (RB_INDH(RingBuff) + cnt1 >= RingBuff->count)
+ cnt1 = RingBuff->count - RB_INDH(RingBuff);
+ cnt2 -= cnt1;
+
+ cnt1 = MIN(cnt1, num);
+ num -= cnt1;
+
+ cnt2 = MIN(cnt2, num);
+ num -= cnt2;
+
+ /* Write segment 1 */
+ ptr += RB_INDH(RingBuff) * RingBuff->itemSz;
+ memcpy(ptr, data, cnt1 * RingBuff->itemSz);
+ RingBuff->head += cnt1;
+
+ /* Write segment 2 */
+ ptr = (uint8_t *) RingBuff->data + RB_INDH(RingBuff) * RingBuff->itemSz;
+ data = (const uint8_t *) data + cnt1 * RingBuff->itemSz;
+ memcpy(ptr, data, cnt2 * RingBuff->itemSz);
+ RingBuff->head += cnt2;
+
+ return cnt1 + cnt2;
+}
+
+/* Pop single item from Ring Buffer */
+int RingBuffer_Pop(RINGBUFF_T *RingBuff, void *data)
+{
+ uint8_t *ptr = RingBuff->data;
+
+ /* We cannot pop when queue is empty */
+ if (RingBuffer_IsEmpty(RingBuff))
+ return 0;
+
+ ptr += RB_INDT(RingBuff) * RingBuff->itemSz;
+ memcpy(data, ptr, RingBuff->itemSz);
+ RingBuff->tail++;
+
+ return 1;
+}
+
+/* Pop multiple items from Ring buffer */
+int RingBuffer_PopMult(RINGBUFF_T *RingBuff, void *data, int num)
+{
+ uint8_t *ptr = RingBuff->data;
+ int cnt1, cnt2;
+
+ /* We cannot insert when queue is empty */
+ if (RingBuffer_IsEmpty(RingBuff))
+ return 0;
+
+ /* Calculate the segment lengths */
+ cnt1 = cnt2 = RingBuffer_GetCount(RingBuff);
+ if (RB_INDT(RingBuff) + cnt1 >= RingBuff->count)
+ cnt1 = RingBuff->count - RB_INDT(RingBuff);
+ cnt2 -= cnt1;
+
+ cnt1 = MIN(cnt1, num);
+ num -= cnt1;
+
+ cnt2 = MIN(cnt2, num);
+ num -= cnt2;
+
+ /* Write segment 1 */
+ ptr += RB_INDT(RingBuff) * RingBuff->itemSz;
+ memcpy(data, ptr, cnt1 * RingBuff->itemSz);
+ RingBuff->tail += cnt1;
+
+ /* Write segment 2 */
+ ptr = (uint8_t *) RingBuff->data + RB_INDT(RingBuff) * RingBuff->itemSz;
+ data = (uint8_t *) data + cnt1 * RingBuff->itemSz;
+ memcpy(data, ptr, cnt2 * RingBuff->itemSz);
+ RingBuff->tail += cnt2;
+
+ return cnt1 + cnt2;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/ritimer_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/ritimer_15xx.c
new file mode 100644
index 0000000..09bbe32
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/ritimer_15xx.c
@@ -0,0 +1,152 @@
+/*
+ * @brief LPC15xx RITimer driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Initialize the RIT */
+void Chip_RIT_Init(LPC_RITIMER_T *pRITimer)
+{
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_RIT);
+ Chip_SYSCTL_PeriphReset(RESET_RIT);
+ pRITimer->CTRL = 0x04;
+}
+
+/* DeInitialize the RIT */
+void Chip_RIT_DeInit(LPC_RITIMER_T *pRITimer)
+{
+ pRITimer->CTRL = 0x00;
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_RIT);
+}
+
+/* Safely sets CTRL register bits */
+void Chip_RIT_SetCTRL(LPC_RITIMER_T *pRITimer, uint32_t val)
+{
+ uint32_t reg;
+
+ reg = pRITimer->CTRL & 0xF;
+ pRITimer->CTRL = reg | val;
+}
+
+/* Safely clears CTRL register bits */
+void Chip_RIT_ClearCTRL(LPC_RITIMER_T *pRITimer, uint32_t val)
+{
+ uint32_t reg;
+
+ reg = pRITimer->CTRL & 0xF;
+ pRITimer->CTRL = reg & ~val;
+}
+
+/* Set a tick value for the interrupt to time out */
+void Chip_RIT_SetCompareValue(LPC_RITIMER_T *pRITimer, uint64_t val)
+{
+ pRITimer->COMPVAL = (uint32_t) val;
+ pRITimer->COMPVAL_H = (uint32_t) (val >> 32);
+}
+
+/* Returns the current timer compare value */
+uint64_t Chip_RIT_GetCompareValue(LPC_RITIMER_T *pRITimer)
+{
+ uint64_t val;
+
+ val = (uint64_t) pRITimer->COMPVAL_H;
+ val = val << 32;
+ val |= (uint64_t) pRITimer->COMPVAL;
+
+ return val;
+}
+
+/* Sets a mask value used for bit based compare */
+void Chip_RIT_SetMaskValue(LPC_RITIMER_T *pRITimer, uint64_t mask)
+{
+ pRITimer->MASK = (uint32_t) mask;
+ pRITimer->MASK_H = (uint32_t) (mask >> 32);
+}
+
+/* Returns the mask value used for bit based compare */
+uint64_t Chip_RIT_GetMaskValue(LPC_RITIMER_T *pRITimer)
+{
+ uint64_t val;
+
+ val = (uint64_t) pRITimer->MASK_H;
+ val = val << 32;
+ val |= (uint64_t) pRITimer->MASK;
+
+ return val;
+}
+
+/* Sets the current timer Counter value */
+void Chip_RIT_SetCounter(LPC_RITIMER_T *pRITimer, uint64_t count)
+{
+ pRITimer->COUNTER = (uint32_t) count;
+ pRITimer->COUNTER_H = (uint32_t) (count >> 32);
+}
+
+/* Returns the current timer Counter value */
+uint64_t Chip_RIT_GetCounter(LPC_RITIMER_T *pRITimer)
+{
+ uint64_t val;
+
+ val = (uint64_t) pRITimer->COUNTER_H;
+ val = val << 32;
+ val |= (uint64_t) pRITimer->COUNTER;
+
+ return val;
+}
+
+/* Set timer interval value in Hz (frequency) */
+void Chip_RIT_SetTimerIntervalHz(LPC_RITIMER_T *pRITimer, uint32_t freq)
+{
+ uint64_t cmp_value;
+
+ /* Determine approximate compare value based on clock rate and passed interval */
+ cmp_value = (uint64_t) Chip_Clock_GetSystemClockRate();
+ cmp_value = cmp_value / (uint64_t) freq;
+
+ /* Set timer compare value and periodic mode */
+ Chip_RIT_SetCompareValue(pRITimer, cmp_value);
+ Chip_RIT_EnableCompClear(pRITimer);
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/rtc_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/rtc_15xx.c
new file mode 100644
index 0000000..f504580
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/rtc_15xx.c
@@ -0,0 +1,48 @@
+/*
+ * @brief LPC15xx RTC chip driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/sctipu_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/sctipu_15xx.c
new file mode 100644
index 0000000..d0d4042
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/sctipu_15xx.c
@@ -0,0 +1,63 @@
+/*
+ * @brief LPC15xx SCTIPU driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Sets up an configuration and input source for a SCTIPU output channel */
+void Chip_SCTIPU_ConfigSample(uint8_t ch, uint8_t useb, uint8_t sampIn, uint8_t useLatch)
+{
+ uint32_t reg;
+
+ /* Get current sample control register states and mask off channel
+ specific bits. Set reserved bits states to 0. */
+ reg = LPC_SCTIPU->SAMPLE_CTRL & ~(SCTIPU_CTRL_INSELMASK(ch) |
+ SCTIPU_CTRL_SAMPENDMASK(ch) | SCTIPU_CTRL_LATCHENMASK(ch) |
+ SCTIPU_RESERVED_BITS);
+
+ /* Setup channel specific configuration */
+ reg |= SCTIPU_CTRL_INSEL(ch, useb) | SCTIPU_CTRL_SAMPENDSEL(ch, sampIn) |
+ SCTIPU_CTRL_LATCHENSEL(ch, useLatch);
+ LPC_SCTIPU->SAMPLE_CTRL = reg;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/spi_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/spi_15xx.c
new file mode 100644
index 0000000..4d490ee
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/spi_15xx.c
@@ -0,0 +1,307 @@
+/*
+ * @brief LPC15xx SPI driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+STATIC void SPI_Send_Data_RxIgnore(LPC_SPI_T *pSPI,
+ SPI_DATA_SETUP_T *pXfSetup)
+{
+ if (pXfSetup->TxCnt == (pXfSetup->Length - 1)) {
+ Chip_SPI_SendLastFrame_RxIgnore(pSPI, pXfSetup->pTx[pXfSetup->TxCnt], pXfSetup->DataSize, pXfSetup->ssel);
+ }
+ else {
+ Chip_SPI_SendMidFrame(pSPI, pXfSetup->pTx[pXfSetup->TxCnt]);
+ }
+
+ pXfSetup->TxCnt++;
+}
+
+STATIC void SPI_Send_Data(LPC_SPI_T *pSPI,
+ SPI_DATA_SETUP_T *pXfSetup)
+{
+ if (pXfSetup->TxCnt == (pXfSetup->Length - 1)) {
+ Chip_SPI_SendLastFrame(pSPI, pXfSetup->pTx[pXfSetup->TxCnt], pXfSetup->DataSize, pXfSetup->ssel);
+ }
+ else {
+ Chip_SPI_SendMidFrame(pSPI, pXfSetup->pTx[pXfSetup->TxCnt]);
+ }
+
+ pXfSetup->TxCnt++;
+}
+
+STATIC void SPI_Send_Dummy(LPC_SPI_T *pSPI,
+ SPI_DATA_SETUP_T *pXfSetup)
+{
+ if (pXfSetup->RxCnt == (pXfSetup->Length - 1)) {
+ Chip_SPI_SendLastFrame(pSPI, 0x55, pXfSetup->DataSize, pXfSetup->ssel);
+ }
+ else {
+ Chip_SPI_SendMidFrame(pSPI, 0x55);
+ }
+}
+
+STATIC void SPI_Receive_Data(LPC_SPI_T *pSPI,
+ SPI_DATA_SETUP_T *pXfSetup)
+{
+ pXfSetup->pRx[pXfSetup->RxCnt] = Chip_SPI_ReceiveFrame(pSPI);
+ pXfSetup->RxCnt++;
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Calculate the Clock Rate Divider for SPI Peripheral */
+uint32_t Chip_SPI_CalClkRateDivider(LPC_SPI_T *pSPI, uint32_t bitRate)
+{
+ uint32_t SPIClk;
+ uint32_t DivVal;
+
+ /* Get SPI clock rate */
+ SPIClk = Chip_Clock_GetSystemClockRate(); /*The peripheral clock for both SPIs is the system clock*/
+
+ DivVal = SPIClk / bitRate;
+
+ return DivVal - 1;
+}
+
+/* Set SPI Config register */
+void Chip_SPI_SetConfig(LPC_SPI_T *pSPI, SPI_CFG_T *pConfig)
+{
+ uint32_t EnStat = pSPI->CFG & SPI_CFG_SPI_EN;
+
+ /* Disable before update CFG register */
+ if (EnStat) {
+ Chip_SPI_Disable(pSPI);
+ }
+
+ /* SPI Configure */
+ pSPI->CFG = ((uint32_t) pConfig->ClockMode) | ((uint32_t) pConfig->DataOrder) | ((uint32_t) pConfig->Mode) |
+ ((uint32_t) pConfig->SSELPol);
+
+ /* Rate Divider setting */
+ pSPI->DIV = SPI_DIV_VAL(pConfig->ClkDiv);
+
+ /* Clear status flag*/
+ Chip_SPI_ClearStatus(
+ pSPI,
+ SPI_STAT_CLR_RXOV | SPI_STAT_CLR_TXUR | SPI_STAT_CLR_SSA | SPI_STAT_CLR_SSD |
+ SPI_STAT_FORCE_EOT);
+
+ /* Return the previous state */
+ if (EnStat) {
+ Chip_SPI_Enable(pSPI);
+ }
+}
+
+void Chip_SPI_Init(LPC_SPI_T *pSPI)
+{
+ if (pSPI == LPC_SPI1) {
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SPI1);
+ Chip_SYSCTL_PeriphReset(RESET_SPI1);
+ }
+ else {
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SPI0);
+ Chip_SYSCTL_PeriphReset(RESET_SPI0);
+ }
+}
+
+/* De-initializes the SPI peripheral */
+void Chip_SPI_DeInit(LPC_SPI_T *pSPI)
+{
+ Chip_SPI_Disable(pSPI);
+
+ Chip_Clock_DisablePeriphClock((pSPI == LPC_SPI1) ? SYSCTL_CLOCK_SPI1 : SYSCTL_CLOCK_SPI0);
+}
+
+/* Configure SPI Delay parameters */
+void Chip_SPI_DelayConfig(LPC_SPI_T *pSPI, SPI_DELAY_CONFIG_T *pConfig)
+{
+ pSPI->DLY = SPI_DLY_PRE_DELAY(pConfig->PreDelay);
+ pSPI->DLY |= SPI_DLY_POST_DELAY(pConfig->PostDelay);
+ pSPI->DLY |= SPI_DLY_FRAME_DELAY(pConfig->FrameDelay);
+ if (pConfig->TransferDelay) {
+ pSPI->DLY |= SPI_DLY_TRANSFER_DELAY(pConfig->TransferDelay - 1);
+ }
+}
+
+/* Disable/Enable Interrupt */
+void Chip_SPI_Int_Cmd(LPC_SPI_T *pSPI, uint32_t IntMask, FunctionalState NewState)
+{
+ if (NewState == ENABLE) {
+ pSPI->INTENSET |= (IntMask & SPI_INTENSET_BITMASK);
+ }
+ else {
+ pSPI->INTENCLR = (IntMask & SPI_INTENCLR_BITMASK);
+ }
+}
+
+/*Send and Receive SPI Data */
+uint32_t Chip_SPI_RWFrames_Blocking(LPC_SPI_T *pSPI, SPI_DATA_SETUP_T *pXfSetup)
+{
+ uint32_t Status;
+ /* Clear status */
+ Chip_SPI_ClearStatus(
+ pSPI,
+ SPI_STAT_CLR_RXOV | SPI_STAT_CLR_TXUR | SPI_STAT_CLR_SSA | SPI_STAT_CLR_SSD |
+ SPI_STAT_FORCE_EOT);
+ Chip_SPI_SetControlInfo(pSPI, pXfSetup->DataSize, pXfSetup->ssel | SPI_TXCTL_EOF);
+ pXfSetup->TxCnt = pXfSetup->RxCnt = 0;
+ while ((pXfSetup->TxCnt < pXfSetup->Length) ||
+ (pXfSetup->RxCnt < pXfSetup->Length)) {
+ Status = Chip_SPI_GetStatus(pSPI);
+
+ /* In case of TxReady */
+ if ((Status & SPI_STAT_TXRDY) && (pXfSetup->TxCnt < pXfSetup->Length)) {
+ SPI_Send_Data(pSPI, pXfSetup);
+ }
+
+ /*In case of Rx ready */
+ if ((Status & SPI_STAT_RXRDY) && (pXfSetup->RxCnt < pXfSetup->Length)) {
+ SPI_Receive_Data(pSPI, pXfSetup);
+ }
+ }
+ /* Check error */
+ if (Chip_SPI_GetStatus(pSPI) & (SPI_STAT_RXOV | SPI_STAT_TXUR)) {
+ return 0;
+ }
+ return pXfSetup->TxCnt;
+}
+
+uint32_t Chip_SPI_WriteFrames_Blocking(LPC_SPI_T *pSPI, SPI_DATA_SETUP_T *pXfSetup)
+{
+ /* Clear status */
+ Chip_SPI_ClearStatus(
+ pSPI,
+ SPI_STAT_CLR_RXOV | SPI_STAT_CLR_TXUR | SPI_STAT_CLR_SSA | SPI_STAT_CLR_SSD |
+ SPI_STAT_FORCE_EOT);
+ Chip_SPI_SetControlInfo(pSPI, pXfSetup->DataSize, pXfSetup->ssel | SPI_TXCTL_EOF | SPI_TXCTL_RXIGNORE);
+ pXfSetup->TxCnt = pXfSetup->RxCnt = 0;
+ while (pXfSetup->TxCnt < pXfSetup->Length) {
+ /* Wait for TxReady */
+ while (!(Chip_SPI_GetStatus(pSPI) & SPI_STAT_TXRDY)) {}
+
+ SPI_Send_Data_RxIgnore(pSPI, pXfSetup);
+
+ }
+
+ /* Make sure the last frame sent completely*/
+ while (!(Chip_SPI_GetStatus(pSPI) & SPI_STAT_SSD)) {}
+ Chip_SPI_ClearStatus(pSPI, SPI_STAT_CLR_SSD);
+
+ /* Check overrun error */
+ if (Chip_SPI_GetStatus(pSPI) & SPI_STAT_TXUR) {
+ return 0;
+ }
+ return pXfSetup->TxCnt;
+}
+
+uint32_t Chip_SPI_ReadFrames_Blocking(LPC_SPI_T *pSPI, SPI_DATA_SETUP_T *pXfSetup)
+{
+ /* Clear status */
+ Chip_SPI_ClearStatus(
+ pSPI,
+ SPI_STAT_CLR_RXOV | SPI_STAT_CLR_TXUR | SPI_STAT_CLR_SSA | SPI_STAT_CLR_SSD |
+ SPI_STAT_FORCE_EOT);
+ Chip_SPI_SetControlInfo(pSPI, pXfSetup->DataSize, pXfSetup->ssel | SPI_TXCTL_EOF);
+ pXfSetup->TxCnt = pXfSetup->RxCnt = 0;
+ while (pXfSetup->RxCnt < pXfSetup->Length) {
+ /* Wait for TxReady */
+ while (!(Chip_SPI_GetStatus(pSPI) & SPI_STAT_TXRDY)) {}
+
+ SPI_Send_Dummy(pSPI, pXfSetup);
+
+ /* Wait for receive data */
+ while (!(Chip_SPI_GetStatus(pSPI) & SPI_STAT_RXRDY)) {}
+
+ SPI_Receive_Data(pSPI, pXfSetup);
+
+ }
+ /* Check overrun error */
+ if (Chip_SPI_GetStatus(pSPI) & (SPI_STAT_RXOV | SPI_STAT_TXUR)) {
+ return 0;
+ }
+ return pXfSetup->RxCnt;
+}
+
+/* SPI Interrupt Read/Write with 8-bit frame width */
+Status Chip_SPI_Int_RWFrames(LPC_SPI_T *pSPI, SPI_DATA_SETUP_T *pXfSetup)
+{
+ uint32_t Status;
+
+ Status = Chip_SPI_GetStatus(pSPI);
+ /* Check error in STAT register */
+ if (Status & (SPI_STAT_RXOV | SPI_STAT_TXUR)) {
+ /* Clear errors */
+ Chip_SPI_ClearStatus(pSPI, SPI_STAT_CLR_RXOV | SPI_STAT_CLR_TXUR);
+ return ERROR;
+ }
+
+ if (pXfSetup->TxCnt == 0) {
+ if (pXfSetup->pRx == NULL) {
+ Chip_SPI_SetControlInfo(pSPI, pXfSetup->DataSize, pXfSetup->ssel | SPI_TXCTL_EOF | SPI_TXCTL_RXIGNORE);
+ }
+ else {
+ Chip_SPI_SetControlInfo(pSPI, pXfSetup->DataSize, pXfSetup->ssel | SPI_TXCTL_EOF);
+ }
+ }
+
+ if (pXfSetup->pRx == NULL) {
+ if ((Status & SPI_STAT_TXRDY) && (pXfSetup->TxCnt < pXfSetup->Length)) {
+ SPI_Send_Data_RxIgnore(pSPI, pXfSetup);
+ }
+ }
+ else {
+ /* check if Tx ready */
+ if ((Status & SPI_STAT_TXRDY) && (pXfSetup->TxCnt < pXfSetup->Length)) {
+ SPI_Send_Data(pSPI, pXfSetup);
+ }
+
+ /* check if RX FIFO contains data */
+ if ((Status & SPI_STAT_RXRDY) && (pXfSetup->RxCnt < pXfSetup->Length)) {
+ SPI_Receive_Data(pSPI, pXfSetup);
+ }
+ }
+
+ return SUCCESS;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/stopwatch_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/stopwatch_15xx.c
new file mode 100644
index 0000000..751ead2
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/stopwatch_15xx.c
@@ -0,0 +1,106 @@
+/*
+ * @brief LPC15xx specific stopwatch implementation
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+#include "stopwatch.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* Precompute these to optimize runtime */
+static uint32_t ticksPerSecond;
+static uint32_t ticksPerMs;
+static uint32_t ticksPerUs;
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Initialize stopwatch */
+void StopWatch_Init(void)
+{
+ /* Use Repetitive Interrupt Timer (RIT) */
+ Chip_RIT_Init(LPC_RITIMER);
+ Chip_RIT_SetCompareValue(LPC_RITIMER, (uint32_t) 0xFFFFFFFF);
+ Chip_RIT_EnableCompClear(LPC_RITIMER);
+ Chip_RIT_Enable(LPC_RITIMER);
+
+ /* Pre-compute tick rate. */
+ ticksPerSecond = Chip_Clock_GetSystemClockRate();
+ ticksPerMs = ticksPerSecond / 1000;
+ ticksPerUs = ticksPerSecond / 1000000;
+}
+
+/* Start a stopwatch */
+uint32_t StopWatch_Start(void)
+{
+ /* Return the current timer count. */
+ return (uint32_t) Chip_RIT_GetCounter(LPC_RITIMER);
+}
+
+/* Returns number of ticks per second of the stopwatch timer */
+uint32_t StopWatch_TicksPerSecond(void)
+{
+ return ticksPerSecond;
+}
+
+/* Converts from stopwatch ticks to mS. */
+uint32_t StopWatch_TicksToMs(uint32_t ticks)
+{
+ return ticks / ticksPerMs;
+}
+
+/* Converts from stopwatch ticks to uS. */
+uint32_t StopWatch_TicksToUs(uint32_t ticks)
+{
+ return ticks / ticksPerUs;
+}
+
+/* Converts from mS to stopwatch ticks. */
+uint32_t StopWatch_MsToTicks(uint32_t mS)
+{
+ return mS * ticksPerMs;
+}
+
+/* Converts from uS to stopwatch ticks. */
+uint32_t StopWatch_UsToTicks(uint32_t uS)
+{
+ return uS * ticksPerUs;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/swm_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/swm_15xx.c
new file mode 100644
index 0000000..6a58c0b
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/swm_15xx.c
@@ -0,0 +1,107 @@
+/*
+ * @brief LPC15xx Switch Matrix driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licenser disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+#define PINASSIGN_IDX(movable) (((movable) >> 4))
+#define PINSHIFT(movable) (8 * ((movable) & (0xF)))
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Assign movable pin function to physical pin in Switch Matrix */
+void Chip_SWM_MovablePinAssign(CHIP_SWM_PIN_MOVABLE_T movable, uint8_t pin)
+{
+ uint32_t temp;
+ int pinshift = PINSHIFT(movable), regIndex = PINASSIGN_IDX(movable);
+
+ temp = LPC_SWM->PINASSIGN[regIndex] & (~(0xFF << pinshift));
+ LPC_SWM->PINASSIGN[regIndex] = temp | (pin << pinshift);
+}
+
+/* Enables a fixed function pin in the Switch Matrix */
+void Chip_SWM_EnableFixedPin(CHIP_SWM_PIN_FIXED_T pin)
+{
+ uint32_t regOff, pinPos;
+
+ pinPos = ((uint32_t) pin) & 0x1F;
+ regOff = ((uint32_t) pin) >> 7;
+
+ /* Set low to enable fixed pin */
+ LPC_SWM->PINENABLE[regOff] &= ~(1 << pinPos);
+}
+
+/* Disables a fixed function pin in the Switch Matrix */
+void Chip_SWM_DisableFixedPin(CHIP_SWM_PIN_FIXED_T pin)
+{
+ uint32_t regOff, pinPos;
+
+ pinPos = ((uint32_t) pin) & 0x1F;
+ regOff = ((uint32_t) pin) >> 7;
+
+ /* Set low to enable fixed pin */
+ LPC_SWM->PINENABLE[regOff] |= (1 << pinPos);
+}
+
+/* Enables or disables a fixed function pin in the Switch Matrix */
+void Chip_SWM_FixedPinEnable(CHIP_SWM_PIN_FIXED_T pin, bool enable)
+{
+ if (enable) {
+ Chip_SWM_EnableFixedPin(pin);
+ }
+ else {
+ Chip_SWM_DisableFixedPin(pin);
+ }
+}
+
+/* Tests whether a fixed function pin is enabled or disabled in the Switch Matrix */
+bool Chip_SWM_IsFixedPinEnabled(CHIP_SWM_PIN_FIXED_T pin)
+{
+ uint32_t regOff, pinPos;
+
+ pinPos = ((uint32_t) pin) & 0x1F;
+ regOff = ((uint32_t) pin) >> 7;
+
+ return (bool) ((LPC_SWM->PINENABLE[regOff] & (1 << pinPos)) == 0);
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/sysctl_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/sysctl_15xx.c
new file mode 100644
index 0000000..1e651a0
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/sysctl_15xx.c
@@ -0,0 +1,120 @@
+/*
+ * @brief LPC15XX System Control functions
+ *
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* PDWAKECFG register mask */
+#define PDWAKEUPUSEMASK 0x00000000
+#define PDWAKEUPMASKTMP 0x01FFFF78
+
+/* PDRUNCFG register mask */
+#define PDRUNCFGUSEMASK 0x00000000
+#define PDRUNCFGMASKTMP 0x01FFFF78
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Returns the computed value for a frequency measurement cycle */
+uint32_t Chip_SYSCTL_GetCompFreqMeas(uint32_t refClockRate)
+{
+ uint32_t capval, clkrate = 0;
+
+ /* Get raw capture value */
+ capval = Chip_SYSCTL_GetRawFreqMeasCapval();
+
+ /* Limit CAPVAL check */
+ if (capval > 2) {
+ clkrate = ((capval - 2) * refClockRate) / 0x4000;
+ }
+
+ return clkrate;
+}
+
+/* De-assert reset for a peripheral */
+void Chip_SYSCTL_AssertPeriphReset(CHIP_SYSCTL_PERIPH_RESET_T periph)
+{
+ if (periph >= 32) {
+ LPC_SYSCTL->PRESETCTRL[1] |= (1 << ((uint32_t) periph - 32));
+ }
+ else {
+ LPC_SYSCTL->PRESETCTRL[0] |= (1 << (uint32_t) periph);
+ }
+}
+
+/* Assert reset for a peripheral */
+void Chip_SYSCTL_DeassertPeriphReset(CHIP_SYSCTL_PERIPH_RESET_T periph)
+{
+ if (periph >= 32) {
+ LPC_SYSCTL->PRESETCTRL[1] &= ~(1 << ((uint32_t) periph - 32));
+ }
+ else {
+ LPC_SYSCTL->PRESETCTRL[0] &= ~(1 << (uint32_t) periph);
+ }
+}
+
+/* Setup wakeup behaviour from deep sleep */
+void Chip_SYSCTL_SetWakeup(uint32_t wakeupmask)
+{
+ /* Update new value */
+ LPC_SYSCTL->PDWAKECFG = PDWAKEUPUSEMASK | (wakeupmask & PDWAKEUPMASKTMP);
+}
+
+/* Power down one or more blocks or peripherals */
+void Chip_SYSCTL_PowerDown(uint32_t powerdownmask)
+{
+ uint32_t pdrun;
+
+ pdrun = LPC_SYSCTL->PDRUNCFG & PDRUNCFGMASKTMP;
+ pdrun |= (powerdownmask & PDRUNCFGMASKTMP);
+
+ LPC_SYSCTL->PDRUNCFG = (pdrun | PDRUNCFGUSEMASK);
+}
+
+/* Power up one or more blocks or peripherals */
+void Chip_SYSCTL_PowerUp(uint32_t powerupmask)
+{
+ uint32_t pdrun;
+
+ pdrun = LPC_SYSCTL->PDRUNCFG & PDRUNCFGMASKTMP;
+ pdrun &= ~(powerupmask & PDRUNCFGMASKTMP);
+
+ LPC_SYSCTL->PDRUNCFG = (pdrun | PDRUNCFGUSEMASK);
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/sysinit_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/sysinit_15xx.c
new file mode 100644
index 0000000..10fe092
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/sysinit_15xx.c
@@ -0,0 +1,134 @@
+/*
+ * @brief LPC15xx Chip specific SystemInit
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Clock and PLL initialization based on the internal oscillator */
+void Chip_SetupIrcClocking(void)
+{
+ volatile int i;
+
+ /* Powerup main IRC (likely already powered up) */
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_IRC_PD);
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_IRCOUT_PD);
+
+ /* Set system PLL input to IRC */
+ Chip_Clock_SetSystemPLLSource(SYSCTL_PLLCLKSRC_IRC);
+
+ /* Power down PLL to change the PLL divider ratio */
+ Chip_SYSCTL_PowerDown(SYSCTL_POWERDOWN_SYSPLL_PD);
+
+ /* Setup PLL for main oscillator rate (FCLKIN = 12MHz) * 6 = 72MHz
+ MSEL = 5 (this is pre-decremented), PSEL = 1 (for P = 2)
+ FCLKOUT = FCLKIN * (MSEL + 1) = 12MHz * 6 = 72MHz
+ FCCO = FCLKOUT * 2 * P = 72MHz * 2 * 2 = 288MHz (within FCCO range) */
+ Chip_Clock_SetupSystemPLL(5, 2);
+
+ /* Powerup system PLL */
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_SYSPLL_PD);
+
+ /* Wait for PLL to lock */
+ while (!Chip_Clock_IsSystemPLLLocked()) {}
+
+ /* Set system clock divider to 1 */
+ Chip_Clock_SetSysClockDiv(1);
+
+ /* Setup FLASH access timing for 72MHz */
+ Chip_FMC_SetFLASHAccess(SYSCTL_FLASHTIM_72MHZ_CPU);
+
+ /* Set main clock source to the system PLL. This will drive 72MHz
+ for the main clock */
+ Chip_Clock_SetMainClockSource(SYSCTL_MAINCLKSRC_SYSPLLOUT);
+}
+
+/* Clock and PLL initialization based on the external oscillator */
+void Chip_SetupXtalClocking(void)
+{
+ volatile int i;
+
+ /* Powerup main oscillator */
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_SYSOSC_PD);
+
+ /* Wait 200us for OSC to be stablized, no status
+ indication, dummy wait. */
+ for (i = 0; i < 0x200; i++) {}
+
+ /* Set system PLL input to main oscillator */
+ Chip_Clock_SetSystemPLLSource(SYSCTL_PLLCLKSRC_MAINOSC);
+
+ /* Power down PLL to change the PLL divider ratio */
+ Chip_SYSCTL_PowerDown(SYSCTL_POWERDOWN_SYSPLL_PD);
+
+ /* Setup PLL for main oscillator rate (FCLKIN = 12MHz) * 6 = 72MHz
+ MSEL = 5 (this is pre-decremented), PSEL = 1 (for P = 2)
+ FCLKOUT = FCLKIN * (MSEL + 1) = 12MHz * 6 = 72MHz
+ FCCO = FCLKOUT * 2 * P = 72MHz * 2 * 2 = 288MHz (within FCCO range) */
+ Chip_Clock_SetupSystemPLL(5, 2);
+
+ /* Powerup system PLL */
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_SYSPLL_PD);
+
+ /* Wait for PLL to lock */
+ while (!Chip_Clock_IsSystemPLLLocked()) {}
+
+ /* Set system clock divider to 1 */
+ Chip_Clock_SetSysClockDiv(1);
+
+ /* Setup FLASH access timing for 72MHz */
+ Chip_FMC_SetFLASHAccess(SYSCTL_FLASHTIM_72MHZ_CPU);
+
+ /* Set main clock source to the system PLL. This will drive 72MHz
+ for the main clock */
+ Chip_Clock_SetMainClockSource(SYSCTL_MAINCLKSRC_SYSPLLOUT);
+}
+
+/* Set up and initialize hardware prior to call to main */
+void Chip_SystemInit(void)
+{
+ /* Initial internal clocking */
+ Chip_SetupIrcClocking();
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/uart_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/uart_15xx.c
new file mode 100644
index 0000000..9bef30b
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/uart_15xx.c
@@ -0,0 +1,241 @@
+/*
+ * @brief LPC15XX USART0 driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licenser disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Return UART clock ID from the UART register address */
+static CHIP_SYSCTL_CLOCK_T getUARTClockID(LPC_USART_T *pUART)
+{
+ if (pUART == LPC_USART0) {
+ return SYSCTL_CLOCK_UART0;
+ }
+ else if (pUART == LPC_USART1) {
+ return SYSCTL_CLOCK_UART1;
+ }
+
+ return SYSCTL_CLOCK_UART2;
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Initialize the UART peripheral */
+void Chip_UART_Init(LPC_USART_T *pUART)
+{
+ /* Enable USART clock */
+ Chip_Clock_EnablePeriphClock(getUARTClockID(pUART));
+
+ /* UART reset */
+ if (pUART == LPC_USART0) {
+ /* Peripheral reset control to USART0 */
+ Chip_SYSCTL_PeriphReset(RESET_UART0);
+ }
+ else if (pUART == LPC_USART1) {
+ /* Peripheral reset control to USART1 */
+ Chip_SYSCTL_PeriphReset(RESET_UART1);
+ }
+ else {
+ /* Peripheral reset control to USART2 */
+ Chip_SYSCTL_PeriphReset(RESET_UART2);
+ }
+}
+
+/* Initialize the UART peripheral */
+void Chip_UART_DeInit(LPC_USART_T *pUART)
+{
+ /* Disable USART clock */
+ Chip_Clock_DisablePeriphClock(getUARTClockID(pUART));
+}
+
+/* Transmit a byte array through the UART peripheral (non-blocking) */
+int Chip_UART_Send(LPC_USART_T *pUART, const void *data, int numBytes)
+{
+ int sent = 0;
+ uint8_t *p8 = (uint8_t *) data;
+
+ /* Send until the transmit FIFO is full or out of bytes */
+ while ((sent < numBytes) &&
+ ((Chip_UART_GetStatus(pUART) & UART_STAT_TXRDY) != 0)) {
+ Chip_UART_SendByte(pUART, *p8);
+ p8++;
+ sent++;
+ }
+
+ return sent;
+}
+
+/* Transmit a byte array through the UART peripheral (blocking) */
+int Chip_UART_SendBlocking(LPC_USART_T *pUART, const void *data, int numBytes)
+{
+ int pass, sent = 0;
+ uint8_t *p8 = (uint8_t *) data;
+
+ while (numBytes > 0) {
+ pass = Chip_UART_Send(pUART, p8, numBytes);
+ numBytes -= pass;
+ sent += pass;
+ p8 += pass;
+ }
+
+ return sent;
+}
+
+/* Read data through the UART peripheral (non-blocking) */
+int Chip_UART_Read(LPC_USART_T *pUART, void *data, int numBytes)
+{
+ int readBytes = 0;
+ uint8_t *p8 = (uint8_t *) data;
+
+ /* Send until the transmit FIFO is full or out of bytes */
+ while ((readBytes < numBytes) &&
+ ((Chip_UART_GetStatus(pUART) & UART_STAT_RXRDY) != 0)) {
+ *p8 = Chip_UART_ReadByte(pUART);
+ p8++;
+ readBytes++;
+ }
+
+ return readBytes;
+}
+
+/* Read data through the UART peripheral (blocking) */
+int Chip_UART_ReadBlocking(LPC_USART_T *pUART, void *data, int numBytes)
+{
+ int pass, readBytes = 0;
+ uint8_t *p8 = (uint8_t *) data;
+
+ while (readBytes < numBytes) {
+ pass = Chip_UART_Read(pUART, p8, numBytes);
+ numBytes -= pass;
+ readBytes += pass;
+ p8 += pass;
+ }
+
+ return readBytes;
+}
+
+/* Set baud rate for UART */
+void Chip_UART_SetBaud(LPC_USART_T *pUART, uint32_t baudrate)
+{
+ uint32_t baudRateGenerator;
+ baudRateGenerator = Chip_Clock_GetUARTBaseClockRate() / (16 * baudrate);
+ pUART->BRG = baudRateGenerator - 1; /* baud rate */
+}
+
+/* Set baud rate for UART using RTC32K oscillator */
+void Chip_UART_SetBaudWithRTC32K(LPC_USART_T *pUART, uint32_t baudrate)
+{
+ /* Simple integer divide */
+ pUART->BRG = (Chip_Clock_GetRTCOscRate() / (3 * baudrate)) - 1;
+
+ pUART->CFG |= UART_MODE_32K;
+}
+
+/* UART receive-only interrupt handler for ring buffers */
+void Chip_UART_RXIntHandlerRB(LPC_USART_T *pUART, RINGBUFF_T *pRB)
+{
+ /* New data will be ignored if data not popped in time */
+ while ((Chip_UART_GetStatus(pUART) & UART_STAT_RXRDY) != 0) {
+ uint8_t ch = Chip_UART_ReadByte(pUART);
+ RingBuffer_Insert(pRB, &ch);
+ }
+}
+
+/* UART transmit-only interrupt handler for ring buffers */
+void Chip_UART_TXIntHandlerRB(LPC_USART_T *pUART, RINGBUFF_T *pRB)
+{
+ uint8_t ch;
+
+ /* Fill FIFO until full or until TX ring buffer is empty */
+ while (((Chip_UART_GetStatus(pUART) & UART_STAT_TXRDY) != 0) &&
+ RingBuffer_Pop(pRB, &ch)) {
+ Chip_UART_SendByte(pUART, ch);
+ }
+}
+
+/* Populate a transmit ring buffer and start UART transmit */
+uint32_t Chip_UART_SendRB(LPC_USART_T *pUART, RINGBUFF_T *pRB, const void *data, int count)
+{
+ uint32_t ret;
+ uint8_t *p8 = (uint8_t *) data;
+
+ /* Don't let UART transmit ring buffer change in the UART IRQ handler */
+ Chip_UART_IntDisable(pUART, UART_INTEN_TXRDY);
+
+ /* Move as much data as possible into transmit ring buffer */
+ ret = RingBuffer_InsertMult(pRB, p8, count);
+ Chip_UART_TXIntHandlerRB(pUART, pRB);
+
+ /* Add additional data to transmit ring buffer if possible */
+ ret += RingBuffer_InsertMult(pRB, (p8 + ret), (count - ret));
+
+ /* Enable UART transmit interrupt */
+ Chip_UART_IntEnable(pUART, UART_INTEN_TXRDY);
+
+ return ret;
+}
+
+/* Copy data from a receive ring buffer */
+int Chip_UART_ReadRB(LPC_USART_T *pUART, RINGBUFF_T *pRB, void *data, int bytes)
+{
+ (void) pUART;
+
+ return RingBuffer_PopMult(pRB, (uint8_t *) data, bytes);
+}
+
+/* UART receive/transmit interrupt handler for ring buffers */
+void Chip_UART_IRQRBHandler(LPC_USART_T *pUART, RINGBUFF_T *pRXRB, RINGBUFF_T *pTXRB)
+{
+ /* Handle transmit interrupt if enabled */
+ if ((Chip_UART_GetStatus(pUART) & UART_STAT_TXRDY) != 0) {
+ Chip_UART_TXIntHandlerRB(pUART, pTXRB);
+
+ /* Disable transmit interrupt if the ring buffer is empty */
+ if (RingBuffer_IsEmpty(pTXRB)) {
+ Chip_UART_IntDisable(pUART, UART_INTEN_TXRDY);
+ }
+ }
+
+ /* Handle receive interrupt */
+ Chip_UART_RXIntHandlerRB(pUART, pRXRB);
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/wwdt_15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/wwdt_15xx.c
new file mode 100644
index 0000000..756d688
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/lpc_chip_15xx/src/wwdt_15xx.c
@@ -0,0 +1,72 @@
+/*
+ * @brief LPC15xx WWDT chip driver
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "chip.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Initialize the Watchdog timer */
+void Chip_WWDT_Init(LPC_WWDT_T *pWWDT)
+{
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_WDT);
+
+ /* Disable watchdog */
+ pWWDT->MOD = 0;
+ pWWDT->TC = 0xFF;
+ pWWDT->WARNINT = 0x3FF;
+ pWWDT->WINDOW = 0xFFFFFF;
+}
+
+/* Clear WWDT interrupt status flags */
+void Chip_WWDT_ClearStatusFlag(LPC_WWDT_T *pWWDT, uint32_t status)
+{
+ if (status & WWDT_WDMOD_WDTOF) {
+ pWWDT->MOD &= (~WWDT_WDMOD_WDTOF) & WWDT_WDMOD_BITMASK;
+ }
+
+ if (status & WWDT_WDMOD_WDINT) {
+ pWWDT->MOD |= WWDT_WDMOD_WDINT;
+ }
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_acmp/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_acmp/.cproject
new file mode 100644
index 0000000..621936e
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_acmp/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.2077960505">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.2077960505" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.2077960505" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.2077960505." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.124763609" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1042366724" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_acmp}/Debug" id="com.crt.advproject.builder.exe.debug.599443720" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1069233388" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.364743510" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.2137889838" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.608842195" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1553091585" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.376281414" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.684100394" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.812998635" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.655761040" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.583565274" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.115236193" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.814436759" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.563172328" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1759396731" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1143369328" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.596177347" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1769667990" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.558456604" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.754676055" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1841757184" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1417647619" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_acmp_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1431450469" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.561046847" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1896270843" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.928362389" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.309271647" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1246393496" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1777174164" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.913176004">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.913176004" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.913176004" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.913176004." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.1572014217" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.757266255" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_acmp}/Release" id="com.crt.advproject.builder.exe.release.1773759727" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.2114253439" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.1972563474" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.961462891" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.675187733" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.25150011" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.776871355" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.5890465" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1012890235" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1880263274" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.978824606" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1105471364" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1408098517" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1671009613" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.735799091" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.462914436" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.42353649" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.1857609898" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.957875148" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1866905824" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.189874990" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.551832062" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_acmp_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.916848084" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1858076635" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1988158050" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.703134734" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.471237001" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1195266373" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1808116611" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_acmp.com.crt.advproject.projecttype.exe.1619211293" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_acmp/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_acmp/.project
new file mode 100644
index 0000000..027b6b6
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_acmp/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_acmp</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_acmp/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_acmp/example/readme.dox
new file mode 100644
index 0000000..f11fa09
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_acmp/example/readme.dox
@@ -0,0 +1,62 @@
+/*
+ * @brief Analog Comparator example.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_ACMP LPC15xx Analog Comparator example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * The ACMP example demonstrates using the analog comparator.<br>
+ *
+ * This example configures the positive voltage input as the voltage
+ * found on ADC1_1/PIN0.9, which is trimmed through the potentiometer.
+ * The negative voltage input is obtained from the voltage ladder, the
+ * voltage ladder output is set to around 50% of Vdd.
+ * Adjust the POT up and down to adjust the voltage into the analog
+ * comparator. When the voltage crosses the negative voltage input,
+ * a CMP IRQ is fired. Based on which side of the voltage is in
+ * reference to the bandgap, the LED state will change.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_acmp/example/src/acmp.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_acmp/example/src/acmp.c
new file mode 100644
index 0000000..3b21e0a
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_acmp/example/src/acmp.c
@@ -0,0 +1,124 @@
+/*
+ * @brief Analog Comparator example.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* Example uses ACMP #3 */
+#define CMP_INDEX 3
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* ACMP Pin mux function - note that SystemInit() may already setup your
+ pin muxing at system startup */
+static void Init_ACMP_PinMux(void)
+{
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+ /* Disables pullups/pulldowns and disable digital mode */
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 9, (IOCON_MODE_INACT | IOCON_ADMODE_EN));
+
+ /* Assign ADC1_1 to PIO0_9 via SWM (fixed pin) */
+ Chip_SWM_EnableFixedPin(SWM_FIXED_ADC1_1);
+#else
+ /* Configure your own ACMP pin muxing here if needed */
+#warning "No ACMP pin muxing defined"
+#endif
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Analog comparator interrupt handler sub-routine
+ * @return Nothing
+ */
+void ACMP3_IRQHandler(void)
+{
+ /* Clear the interrupt */
+ Chip_ACMP_ClearIntFlag(LPC_CMP, CMP_INDEX);
+}
+
+/**
+ * @brief Main program body
+ * @return Does not return
+ */
+int main(void)
+{
+ /* initialize the board */
+ SystemCoreClockUpdate();
+ Board_Init();
+ Board_LED_Set(0, false);
+
+ /* initialize the ACMP */
+ Chip_ACMP_Init(LPC_CMP);
+
+ /* Setup board specific ACMP pin muxing */
+ Init_ACMP_PinMux();
+
+ /* Positive and negative references, no hysteresis */
+ Chip_ACMP_SetupACMPRefs(LPC_CMP, CMP_INDEX, ACMP_POSIN_ADCIN_1, ACMP_NEGIN_VREF_DIV, ACMP_HYS_NONE);
+ /* Edge triggered interrupt on both edges*/
+ Chip_ACMP_SetupACMPInt(LPC_CMP, CMP_INDEX, false, false, ACMP_EDGESEL_BOTH);
+ Chip_ACMP_EnableCompInt(LPC_CMP, CMP_INDEX);
+ Chip_ACMP_SetupVoltLadder(LPC_CMP, CMP_INDEX, 0x15, false);
+ Chip_ACMP_EnableVoltLadder(LPC_CMP, CMP_INDEX);
+ /* Setup Comparator Filter register to bypass filter and use SysClk without any division */
+ Chip_ACMP_SetCompFiltReg(LPC_CMP, CMP_INDEX, ACMP_SMODE_0, ACMP_CLKDIV_1);
+ /* Enable Comparator */
+ Chip_ACMP_EnableComp(LPC_CMP, CMP_INDEX);
+
+ /* Enable the Interrupt for the compare output */
+ NVIC_EnableIRQ(CMP3_IRQ);
+
+ while (1) {
+ /* Enter low power mode until interrupt */
+ __WFI();
+
+ if (Chip_ACMP_GetCompStatus(LPC_CMP, CMP_INDEX)) {
+ Board_LED_Set(0, true);
+ }
+ else {
+ Board_LED_Set(0, false);
+ }
+ }
+
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_acmp/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_acmp/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_acmp/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_acmp/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_acmp/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_acmp/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc/.cproject
new file mode 100644
index 0000000..102c1c2
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.727776717">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.727776717" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.727776717" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.727776717." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.493847850" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1844346062" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_adc}/Debug" id="com.crt.advproject.builder.exe.debug.1450083634" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1566081800" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1943269496" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.2049097495" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.460594564" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.966270771" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.2119529860" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1335464284" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.297022922" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.596979671" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.766726985" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.828718979" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1851641417" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.249162893" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1049025690" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1124176069" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1611090306" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1177212028" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1829170507" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.867196721" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1991293428" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.246593332" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_adc_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.572151638" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1723596139" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1675850207" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1328132558" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.176576703" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1410868517" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.704617171" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.28508846">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.28508846" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.28508846" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.28508846." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.75025787" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.2042328430" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_adc}/Release" id="com.crt.advproject.builder.exe.release.902660096" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.966780364" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.2119193470" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.1543738445" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.444841057" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1055967762" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.355172197" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1244664954" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.707723257" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1068183509" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1958296149" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.935968023" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.671252326" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.248190167" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1682415298" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1978589287" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.975766912" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.1409846654" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.2014045230" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1369882914" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.250657803" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1595101553" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_adc_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.529481342" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1638243493" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.2023081634" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.872628374" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1522126811" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1109696979" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.24407688" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_adc.com.crt.advproject.projecttype.exe.402796611" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc/.project
new file mode 100644
index 0000000..ecfb28c
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_adc</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc/example/readme.dox
new file mode 100644
index 0000000..409239e
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc/example/readme.dox
@@ -0,0 +1,65 @@
+/*
+ * @brief LPC15xx ADC example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_ADC LPC15xx ADC example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * The LPC15xx ADC example shows how to use the ADC to perform
+ * a sequence of conversions and monitor a threshold crossing.<br>
+ *
+ * ADC0 is configured to monitor the internal temperature sensor on
+ * ADC0 channel 0. It is setup to be triggered periodically by the
+ * sysTick interrupt.<br>
+ *
+ * ADC1 is configured to monitor an analog input signal on ADC1. The
+ * ADC channel used may vary per board. It is setup to be triggered
+ * periodically by the sysTick interrupt with optional threshold
+ * support.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * To use this example, ADC1 channel 1 needs to be connected to an
+ * analog source.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc/example/src/adc.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc/example/src/adc.c
new file mode 100644
index 0000000..e155d4b
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc/example/src/adc.c
@@ -0,0 +1,289 @@
+/*
+ * @brief LPC15xx ADC example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include <stdio.h>
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+static volatile int ticks;
+static bool sequence0Complete, sequence1Complete, threshold1Crossed;
+
+#define TICKRATE_HZ (100) /* 100 ticks per second */
+
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+/* ADC is connected to the pot on LPCXPresso base boards */
+#define BOARD_ADC_CH 1
+
+#else
+#warning "Using ADC channel 8 for this example, please select for your board"
+#define BOARD_ADC_CH 8
+#endif
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+void showValudeADC(LPC_ADC_T *pADC)
+{
+ int index, j;
+ uint32_t rawSample;
+
+ if (pADC == LPC_ADC0) {
+ index = 0;
+ }
+ else {
+ index = 1;
+ }
+
+ /* Get raw sample data for channels 0-11 */
+ for (j = 0; j < 12; j++) {
+ rawSample = Chip_ADC_GetDataReg(pADC, j);
+
+ /* Show some ADC data */
+ if ((rawSample & (ADC_DR_OVERRUN | ADC_SEQ_GDAT_DATAVALID)) != 0) {
+ DEBUGOUT("ADC%d_%d: Sample value = 0x%x (Data sample %d)\r\n", index, j,
+ ADC_DR_RESULT(rawSample), j);
+
+ /* Threshold events are only on ADC1 */
+ if (index == 1) {
+ DEBUGOUT("ADC%d_%d: Threshold range = 0x%x\r\n", index, j,
+ ADC_DR_THCMPRANGE(rawSample));
+ DEBUGOUT("ADC%d_%d: Threshold cross = 0x%x\r\n", index, j,
+ ADC_DR_THCMPCROSS(rawSample));
+ }
+ }
+ }
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle interrupt from SysTick timer
+ * @return Nothing
+ */
+void SysTick_Handler(void)
+{
+ static uint32_t count;
+
+ /* Every 1/2 second */
+ count++;
+ if (count >= (TICKRATE_HZ / 2)) {
+ count = 0;
+
+ /* Manual start for ADC1 conversion sequence A */
+ Chip_ADC_StartSequencer(LPC_ADC0, ADC_SEQA_IDX);
+ Chip_ADC_StartSequencer(LPC_ADC1, ADC_SEQA_IDX);
+ }
+}
+
+/**
+ * @brief Handle interrupt from ADC0 sequencer A
+ * @return Nothing
+ */
+void ADC0A_IRQHandler(void)
+{
+ uint32_t pending;
+
+ /* Get pending interrupts */
+ pending = Chip_ADC_GetFlags(LPC_ADC0);
+
+ /* Sequence A completion interrupt */
+ if (pending & ADC_FLAGS_SEQA_INT_MASK) {
+ sequence0Complete = true;
+ }
+
+ /* Clear any pending interrupts */
+ Chip_ADC_ClearFlags(LPC_ADC0, pending);
+}
+
+/**
+ * @brief Handle interrupt from ADC1 sequencer A
+ * @return Nothing
+ */
+void ADC1A_IRQHandler(void)
+{
+ uint32_t pending;
+
+ /* Get pending interrupts */
+ pending = Chip_ADC_GetFlags(LPC_ADC1);
+
+ /* Sequence A completion interrupt */
+ if (pending & ADC_FLAGS_SEQA_INT_MASK) {
+ sequence1Complete = true;
+ }
+
+ /* Clear Sequence A completion interrupt */
+ Chip_ADC_ClearFlags(LPC_ADC1, ADC_FLAGS_SEQA_INT_MASK);
+}
+
+/**
+ * @brief Handle threshold interrupt from ADC1
+ * @return Nothing
+ */
+void ADC1_THCMP_IRQHandler(void)
+{
+ uint32_t pending;
+
+ /* Get pending interrupts */
+ pending = Chip_ADC_GetFlags(LPC_ADC1);
+
+ /* Threshold crossing interrupt on ADC input channel */
+ if (pending & ADC_FLAGS_THCMP_MASK(BOARD_ADC_CH)) {
+ threshold1Crossed = true;
+ }
+
+ /* Clear threshold interrupt */
+ Chip_ADC_ClearFlags(LPC_ADC1, ADC_FLAGS_THCMP_MASK(BOARD_ADC_CH));
+}
+
+/**
+ * @brief main routine for ADC example
+ * @return Function should not exit
+ */
+int main(void)
+{
+ SystemCoreClockUpdate();
+ Board_Init();
+ DEBUGSTR("ADC sequencer demo\r\n");
+
+ /* Setup ADC for 12-bit mode and normal power */
+ Chip_ADC_Init(LPC_ADC0, 0);
+ Chip_ADC_Init(LPC_ADC1, 0);
+
+ /* Setup for maximum ADC clock rate */
+ Chip_ADC_SetClockRate(LPC_ADC0, ADC_MAX_SAMPLE_RATE);
+ Chip_ADC_SetClockRate(LPC_ADC1, ADC_MAX_SAMPLE_RATE);
+
+ /* For ADC0, seqeucner A will be used without threshold events.
+ It will be triggered manually by the sysTick interrupt and
+ only monitor the internal temperature sensor. */
+ Chip_ADC_SetupSequencer(LPC_ADC0, ADC_SEQA_IDX, (ADC_SEQ_CTRL_CHANSEL(0) |
+ ADC_SEQ_CTRL_MODE_EOS));
+
+ /* Power up the internal temperature sensor */
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_TS_PD);
+
+ /* For ADC0, select temperature sensor for channel 0 on ADC0 */
+ Chip_ADC_SetADC0Input(LPC_ADC0, ADC_INSEL_TS);
+
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+ /* Use higher voltage trim for both ADCs */
+ Chip_ADC_SetTrim(LPC_ADC0, ADC_TRIM_VRANGE_HIGHV);
+ Chip_ADC_SetTrim(LPC_ADC1, ADC_TRIM_VRANGE_HIGHV);
+
+ /* For ADC1, seqeucner A will be used with threshold events.
+ It will be triggered manually by the sysTick interrupt and
+ only monitors the ADC1 input. */
+ Chip_ADC_SetupSequencer(LPC_ADC1, ADC_SEQA_IDX,
+ (ADC_SEQ_CTRL_CHANSEL(BOARD_ADC_CH) | ADC_SEQ_CTRL_MODE_EOS));
+
+ /* Disables pullups/pulldowns and disable digital mode */
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 9, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+
+ /* Assign ADC1_1 to PIO0_9 via SWM (fixed pin) */
+ Chip_SWM_EnableFixedPin(SWM_FIXED_ADC1_1);
+
+#else
+#warning "No ADC setup for this example"
+#endif
+
+ /* Need to do a calibration after initialization and trim */
+ Chip_ADC_StartCalibration(LPC_ADC0);
+ Chip_ADC_StartCalibration(LPC_ADC1);
+ while (!(Chip_ADC_IsCalibrationDone(LPC_ADC0))) {}
+ while (!(Chip_ADC_IsCalibrationDone(LPC_ADC1))) {}
+
+ /* Setup threshold 0 low and high values to about 25% and 75% of max for
+ ADC1 only */
+ Chip_ADC_SetThrLowValue(LPC_ADC1, 0, ((1 * 0xFFF) / 4));
+ Chip_ADC_SetThrHighValue(LPC_ADC1, 0, ((3 * 0xFFF) / 4));
+
+ /* Clear all pending interrupts */
+ Chip_ADC_ClearFlags(LPC_ADC0, Chip_ADC_GetFlags(LPC_ADC0));
+ Chip_ADC_ClearFlags(LPC_ADC1, Chip_ADC_GetFlags(LPC_ADC1));
+
+ /* Enable sequence A completion interrupts for ADC0 */
+ Chip_ADC_EnableInt(LPC_ADC0, ADC_INTEN_SEQA_ENABLE);
+
+ /* Enable sequence A completion and threshold crossing interrupts for ADC1_1 */
+ Chip_ADC_EnableInt(LPC_ADC1, ADC_INTEN_SEQA_ENABLE |
+ ADC_INTEN_CMP_ENABLE(ADC_INTEN_CMP_CROSSTH, BOARD_ADC_CH));
+
+ /* Use threshold 0 for ADC channel and enable threshold interrupt mode for
+ channel as crossing */
+ Chip_ADC_SelectTH0Channels(LPC_ADC1, ADC_THRSEL_CHAN_SEL_THR1(BOARD_ADC_CH));
+ Chip_ADC_SetThresholdInt(LPC_ADC1, BOARD_ADC_CH, ADC_INTEN_THCMP_CROSSING);
+
+ /* Enable related ADC NVIC interrupts */
+ NVIC_EnableIRQ(ADC0_SEQA_IRQn);
+ NVIC_EnableIRQ(ADC1_SEQA_IRQn);
+ NVIC_EnableIRQ(ADC1_THCMP);
+
+ /* Enable sequencers */
+ Chip_ADC_EnableSequencer(LPC_ADC0, ADC_SEQA_IDX);
+ Chip_ADC_EnableSequencer(LPC_ADC1, ADC_SEQA_IDX);
+
+ /* This example uses the periodic sysTick to manually trigger the ADC,
+ but a periodic timer can be used in a match configuration to start
+ an ADC sequence without software intervention. */
+ SysTick_Config(Chip_Clock_GetSysTickClockRate() / TICKRATE_HZ);
+
+ /* Endless loop */
+ while (1) {
+ /* Sleep until something happens */
+ __WFI();
+
+ if (threshold1Crossed) {
+ threshold1Crossed = false;
+ DEBUGSTR("********ADC1 threshold event********\r\n");
+ }
+
+ /* Is a conversion sequence complete? */
+ if (sequence0Complete) {
+ showValudeADC(LPC_ADC0);
+ }
+ if (sequence1Complete) {
+ showValudeADC(LPC_ADC1);
+ }
+ }
+
+ /* Should not run to here */
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc_rom/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc_rom/.cproject
new file mode 100644
index 0000000..7c13118
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc_rom/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1703070450">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1703070450" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1703070450" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1703070450." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.17521432" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1387850053" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_adc_rom}/Debug" id="com.crt.advproject.builder.exe.debug.862709278" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.548637794" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1888366979" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.326580919" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.263330111" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1182229297" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.518152910" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1265924135" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.357720266" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1831109122" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.1007234673" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1575331593" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1927163936" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.347939617" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1758671126" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.751489696" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.637413385" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1995408752" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.286278241" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1006867647" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.728180160" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1185465941" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_adc_rom_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.385884453" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.228085190" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1100884634" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.254169986" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1617202374" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.71170748" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.945938258" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.502605343">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.502605343" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.502605343" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.502605343." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.192772093" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1358539722" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_adc_rom}/Release" id="com.crt.advproject.builder.exe.release.1878165540" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.2004440699" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.404258652" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.21197281" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.201782288" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.954019456" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1108958347" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.2018778447" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1086268088" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1921236245" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.541359037" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1086041611" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1687808508" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1552472427" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1720721549" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1216240724" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1595240055" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.1823298645" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1198499322" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.143277973" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.330286978" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.5446218" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_adc_rom_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.490948039" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1986910327" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.347440462" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.228349365" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1384198396" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.654486063" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.577622178" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_adc_rom.com.crt.advproject.projecttype.exe.1002357696" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc_rom/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc_rom/.project
new file mode 100644
index 0000000..84d9d3e
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc_rom/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_adc_rom</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc_rom/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc_rom/example/readme.dox
new file mode 100644
index 0000000..0d211ac
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc_rom/example/readme.dox
@@ -0,0 +1,65 @@
+/*
+ * @brief LPC15xx ADC ROM example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_ADC_ROM LPC15xx ADC ROM example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * The LPC15xx ADC ROM example shows how to use the ADC ROM API to perform
+ * a sequence of conversions and monitor a threshold crossing.<br>
+ *
+ * ADC0 is configured to monitor the internal temperature sensor on
+ * ADC0 channel 0. It is setup to be triggered periodically by the
+ * sysTick interrupt.<br>
+ *
+ * ADC1 is configured to monitor an analog input signal on ADC1. The
+ * ADC channel used may vary per board. It is setup to be triggered
+ * periodically by the sysTick interrupt with optional threshold
+ * support.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * To use this example, ADC1 channel 1 needs to be connected to an
+ * analog source.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc_rom/example/src/adc_rom.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc_rom/example/src/adc_rom.c
new file mode 100644
index 0000000..bd17489
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc_rom/example/src/adc_rom.c
@@ -0,0 +1,297 @@
+/*
+ * @brief LPC15xx ADC example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include <stdio.h>
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+#define TICKRATE_HZ (100) /* 100 SysTicks per second */
+
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+/* ADC is connected to the pot on LPCXPresso base boards */
+#define BOARD_ADC_CH 1
+/* ADC Clock set to 36MHz for this board as SysClk is 72MHz and max ADC clock is 50MHz*/
+#define ADC_CLOCK_RATE (36000000)
+
+#else
+#warning "Using ADC channel 8 for this example, please select for your board. Also setup ADC Clock"
+#define BOARD_ADC_CH 8
+#endif
+
+/* RAM Block Sizes for ADC ROM API */
+#define RAMBLOCK_H 60
+#define BUFFER_SIZE 12
+
+static volatile int ticks;
+static bool sequence0Complete, sequence1Complete, threshold1Crossed;
+
+static uint32_t size_in_bytes;
+static const ADCD_API_T *pAdcApi; /* define pointer to type API function addr table */
+static ADC_HANDLE_T adc_handle[2]; /* handle to ADC API */
+static ADC_PARAM_T param[2]; /* Param Structure for ADC ROM API */
+static ADC_CONFIG_T adc_cfg[2]; /* Config Structure for ADC ROM API */
+static uint32_t start_of_ram_block[2][RAMBLOCK_H]; /* RAM Block */
+static uint32_t adc_buffer[2][BUFFER_SIZE]; /* Buffer for ADC data */
+static ErrorCode_t err_code;
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+void showValudeADC(LPC_ADC_T *pADC)
+{
+ uint32_t rawSample;
+
+ if (pADC == LPC_ADC0) {
+ rawSample = adc_buffer[0][0];
+ DEBUGOUT("ADC%d_%d: Sample value = 0x%x (Data sample %d)\r\n", 0, 0, rawSample, 0);
+ }
+ else {
+ rawSample = adc_buffer[1][BOARD_ADC_CH];
+ DEBUGOUT("ADC%d_%d: Sample value = 0x%x (Data sample %d)\r\n", 1, BOARD_ADC_CH, rawSample, BOARD_ADC_CH);
+ }
+}
+
+void adc_seq0_callback(ADC_HANDLE_T handle)
+{
+ ADC_DRIVER_T *driver = (ADC_DRIVER_T *) handle;
+
+ if ((ErrorCode_t) driver->error_code == LPC_OK) {
+ if (driver->comp_flags & 0x01) {
+ sequence0Complete = true;
+ }
+ }
+}
+
+void adc_seq1_callback(ADC_HANDLE_T handle)
+{
+ ADC_DRIVER_T *driver = (ADC_DRIVER_T *) handle;
+
+ if ((ErrorCode_t) driver->error_code == LPC_OK) {
+ if (driver->comp_flags & (1 << BOARD_ADC_CH)) {
+ sequence1Complete = true;
+ }
+ }
+}
+
+void adc_thcmp_callback(ErrorCode_t error_code, uint32_t num_channel)
+{
+ if (error_code == LPC_OK) {
+ if (num_channel & (1 << BOARD_ADC_CH)) {
+ threshold1Crossed = true;
+ }
+ }
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle interrupt from SysTick timer
+ * @return Nothing
+ */
+void SysTick_Handler(void)
+{
+ static uint32_t count;
+
+ /* Every 1/2 second */
+ count++;
+ if (count >= (TICKRATE_HZ / 2)) {
+ count = 0;
+ /* ADC0 Param for SEQA read */
+ param[0].buffer = (uint32_t *) adc_buffer[0];
+ param[0].driver_mode = 0x01;/* Interrupt Mode */
+ param[0].seqa_hwtrig = 0;
+ param[0].adc_cfg = &adc_cfg[0]; /* ADC0 Config */
+ param[0].comp_flags = 0;
+ param[0].seqa_callback_pt = adc_seq0_callback; /* Call back for SeqA Interrupt */
+ /* ADC1 Param for SEQA read */
+ param[1].buffer = (uint32_t *) adc_buffer[1];
+ param[1].driver_mode = 0x01;/* Interrupt Mode */
+ param[1].seqa_hwtrig = 0;
+ param[1].adc_cfg = &adc_cfg[1]; /* ADC1 Config */
+ param[1].comp_flags = 0;
+ param[1].seqa_callback_pt = adc_seq1_callback; /* Call back for SeqA Interrupt */
+ param[1].thcmp_callback_pt = adc_thcmp_callback;/* Call back for Threshold Compare Interrupt */
+ err_code = LPC_OK;
+ err_code |= (ErrorCode_t) pAdcApi->adc_seqa_read(adc_handle[0], ¶m[0]);
+ err_code |= (ErrorCode_t) pAdcApi->adc_seqa_read(adc_handle[1], ¶m[1]);
+ if (err_code != LPC_OK) {
+ Board_LED_Toggle(0);
+ }
+ }
+}
+
+/**
+ * @brief Handle interrupt from ADC0 sequencer A
+ * @return Nothing
+ */
+void ADC0A_IRQHandler(void)
+{
+ pAdcApi->adc_seqa_isr(adc_handle[0]);
+}
+
+/**
+ * @brief Handle interrupt from ADC1 sequencer A
+ * @return Nothing
+ */
+void ADC1A_IRQHandler(void)
+{
+ pAdcApi->adc_seqa_isr(adc_handle[1]);
+}
+
+/**
+ * @brief Handle threshold interrupt from ADC1
+ * @return Nothing
+ */
+void ADC1_THCMP_IRQHandler(void)
+{
+ pAdcApi->adc_thcmp_isr(adc_handle[1]);
+}
+
+/**
+ * @brief main routine for ADC example
+ * @return Function should not exit
+ */
+int main(void)
+{
+ SystemCoreClockUpdate();
+ Board_Init();
+ DEBUGSTR("ADC ROM sequencer demo\r\n");
+
+ /* Power up, enable clock and reset ADC0 */
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_ADC0_PD);
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_ADC0);
+ Chip_SYSCTL_PeriphReset(RESET_ADC0);
+ /* Power up, enable clock and reset ADC1 */
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_ADC1_PD);
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_ADC1);
+ Chip_SYSCTL_PeriphReset(RESET_ADC1);
+ /* Power up the internal temperature sensor */
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_TS_PD);
+
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+ /* Disables pullups/pulldowns and disable digital mode */
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 9, (IOCON_MODE_INACT | IOCON_ADMODE_EN));
+
+ /* Assign ADC1_1 to PIO0_9 via SWM (fixed pin) */
+ Chip_SWM_EnableFixedPin(SWM_FIXED_ADC1_1);
+
+#else
+#warning "No ADC setup for this example"
+#endif
+ /* Initialize ROM API base address for ADC */
+ pAdcApi = LPC_ADCD_API;
+ size_in_bytes = pAdcApi->adc_get_mem_size();
+ if (size_in_bytes / 4 > RAMBLOCK_H) {
+ /* Adjust RAMBLOCK size in this case */
+ return 1;
+ }
+ /* ADC Handle Setup*/
+ adc_handle[0] = pAdcApi->adc_setup(LPC_ADC0_BASE, (uint8_t *) start_of_ram_block[0]);
+ adc_handle[1] = pAdcApi->adc_setup(LPC_ADC1_BASE, (uint8_t *) start_of_ram_block[1]);
+ /* ADC0 Config */
+ adc_cfg[0].system_clock = SystemCoreClock; /* System clock */
+ adc_cfg[0].adc_clock = 500000; /* ADC clock set to 500KHz for calibration*/
+ /* ADC1 Config */
+ adc_cfg[1].system_clock = SystemCoreClock; /* System clock */
+ adc_cfg[1].adc_clock = 500000; /* ADC clock set to 500KHz for calibration*/
+ pAdcApi->adc_calibration(adc_handle[0], &adc_cfg[0]);
+ pAdcApi->adc_calibration(adc_handle[1], &adc_cfg[1]);
+
+ /* ADC0 Config for Init */
+ adc_cfg[0].system_clock = SystemCoreClock; /* System clock */
+ adc_cfg[0].adc_clock = ADC_CLOCK_RATE; /* ADC clock */
+ adc_cfg[0].async_mode = 0; /* Synchronous mode */
+ adc_cfg[0].tenbit_mode = 0; /* 12 Bit ADC mode */
+ adc_cfg[0].lpwr_mode = 0; /* Disable low power mode */
+ adc_cfg[0].input_sel = ADC_INSEL_TS;
+ adc_cfg[0].seqa_ctrl = (ADC_SEQ_CTRL_CHANSEL(0) | ADC_SEQ_CTRL_MODE_EOS);
+ adc_cfg[0].channel_num = 1; /* Channel number is one higher than the maximum channel number used */
+ /* ADC1 Config for Init */
+ adc_cfg[1].system_clock = SystemCoreClock; /* System clock */
+ adc_cfg[1].adc_clock = ADC_CLOCK_RATE; /* ADC clock */
+ adc_cfg[1].async_mode = 0; /* Synchronous mode */
+ adc_cfg[1].tenbit_mode = 0; /* 12 Bit ADC mode */
+ adc_cfg[1].lpwr_mode = 0; /* Disable low power mode */
+ adc_cfg[1].seqa_ctrl = (ADC_SEQ_CTRL_CHANSEL(BOARD_ADC_CH) | ADC_SEQ_CTRL_MODE_EOS);
+ adc_cfg[1].thrsel = 0;
+ adc_cfg[1].thr0_low = ((1 * 0xFFF) / 4) << 4;
+ adc_cfg[1].thr0_high = ((3 * 0xFFF) / 4) << 4;
+ adc_cfg[1].thcmp_en = ADC_INTEN_CMP_ENABLE(ADC_INTEN_CMP_CROSSTH, BOARD_ADC_CH);
+ adc_cfg[1].channel_num = BOARD_ADC_CH + 1; /* Channel number is one higher than the maximum channel number used */
+ pAdcApi->adc_init(adc_handle[0], &adc_cfg[0]);
+ pAdcApi->adc_init(adc_handle[1], &adc_cfg[1]);
+
+ /* When using ADC ROM API's lower the priority of ADC Sequence completion interrupt when compared to the threshold interrupt*/
+ NVIC_SetPriority(ADC1_SEQA_IRQn, 1);
+ /* Enable related ADC NVIC interrupts */
+ NVIC_EnableIRQ(ADC0_SEQA_IRQn);
+ NVIC_EnableIRQ(ADC1_SEQA_IRQn);
+ NVIC_EnableIRQ(ADC1_THCMP);
+
+ /* This example uses the periodic sysTick to manually trigger the ADC,
+ but a periodic timer can be used in a match configuration to start
+ an ADC sequence without software intervention. */
+ SysTick_Config(Chip_Clock_GetSysTickClockRate() / TICKRATE_HZ);
+
+ /* Endless loop */
+ while (1) {
+ /* Sleep until something happens */
+ __WFI();
+
+ if (threshold1Crossed) {
+ threshold1Crossed = false;
+ DEBUGSTR("********ADC1 threshold event********\r\n");
+ }
+
+ /* Is a conversion sequence complete? */
+ if (sequence0Complete) {
+ sequence0Complete = false;
+ showValudeADC(LPC_ADC0);
+ }
+ if (sequence1Complete) {
+ sequence1Complete = false;
+ showValudeADC(LPC_ADC1);
+ }
+ }
+
+ /* Should not run to here */
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc_rom/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc_rom/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc_rom/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc_rom/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc_rom/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_adc_rom/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_blinky/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_blinky/.cproject
new file mode 100644
index 0000000..325e099
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_blinky/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.433773938">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.433773938" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.433773938" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.433773938." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.1161893392" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.514342721" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_blinky}/Debug" id="com.crt.advproject.builder.exe.debug.517147802" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.380042505" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1612012951" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.83092293" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1591767386" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1360450036" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.148784807" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.726124235" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1924489270" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1183002917" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.1538400561" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.415161864" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.975679134" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1196686745" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1835821663" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.247406338" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.980097960" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1467262905" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1137509193" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.2080930841" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.547314107" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1416067711" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_blinky_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.378632416" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1652352510" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.184604063" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.752663130" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1039949291" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.277341229" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1867359762" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.764732643">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.764732643" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.764732643" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.764732643." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.2055469182" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.619605896" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_blinky}/Release" id="com.crt.advproject.builder.exe.release.1931878160" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.1502621316" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.1095022184" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.2104711298" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.935365886" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.655636641" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1002692362" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.501045128" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1716535850" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.134675335" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1481692152" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.422796437" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1130381580" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.977811313" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.765487665" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1596516685" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.631740999" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.1365843898" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1161224852" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1749017165" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.482608269" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1459775839" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_blinky_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.54941496" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1152226642" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1867757590" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.399025796" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1368372634" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.478470097" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.370336992" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_blinky.com.crt.advproject.projecttype.exe.628726787" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_blinky/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_blinky/.project
new file mode 100644
index 0000000..79e1771
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_blinky/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_blinky</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_blinky/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_blinky/example/readme.dox
new file mode 100644
index 0000000..a43e795
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_blinky/example/readme.dox
@@ -0,0 +1,54 @@
+/*
+ * @brief Blinky example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_BLINKY LPC15xx Simple blinky example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * The blinky example flashes an LED in a periodic rate.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_blinky/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_blinky/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_blinky/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_blinky/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_blinky/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_blinky/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_blinky/example/src/systick.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_blinky/example/src/systick.c
new file mode 100644
index 0000000..704c1f3
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_blinky/example/src/systick.c
@@ -0,0 +1,96 @@
+/*
+ * @brief Blinky example using timers and sysTick
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include <stdio.h>
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+#define TICKRATE_HZ1 (15) /* 15 ticks per second */
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle interrupt from SysTick timer
+ * @return Nothing
+ */
+void SysTick_Handler(void)
+{
+ Board_LED_Toggle(0);
+ Board_LED_Toggle(1);
+}
+
+/**
+ * @brief main routine for blinky example
+ * @return Function should not exit.
+ */
+int main(void)
+{
+ uint32_t sysTickRate;
+
+ SystemCoreClockUpdate();
+ Board_Init();
+ Board_LED_Set(0, false);
+ Board_LED_Set(1, true);
+
+ /* The sysTick counter only has 24 bits of precision, so it will
+ overflow quickly with a fast core clock. You can alter the
+ sysTick divider to generate slower sysTick clock rates. */
+ Chip_Clock_SetSysTickClockDiv(1);
+
+ /* A SysTick divider is present that scales the sysTick rate down
+ from the core clock. Using the SystemCoreClock variable as a
+ rate reference for the SysTick_Config() function won't work,
+ so get the sysTick rate by calling Chip_Clock_GetSysTickClockRate() */
+ sysTickRate = Chip_Clock_GetSysTickClockRate();
+
+ /* Enable and setup SysTick Timer at a periodic rate */
+ SysTick_Config(sysTickRate / TICKRATE_HZ1);
+
+ /* LEDs toggle in interrupt handlers */
+ while (1) {
+ __WFI();
+ }
+
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_clkout/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_clkout/.cproject
new file mode 100644
index 0000000..a1d5c3f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_clkout/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.2019457845">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.2019457845" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.2019457845" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.2019457845." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.993734496" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1156057561" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_clkout}/Debug" id="com.crt.advproject.builder.exe.debug.919700449" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.598415589" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1394163654" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.447798664" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1875288566" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1494894843" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1705552060" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.956962101" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.825953872" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.409415186" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.460152228" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.184758596" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1497513843" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.732648293" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.723958802" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1581746571" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1762222782" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1386074045" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.203420060" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1603604775" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1140985892" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1152471160" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_clkout_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1473476090" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.2086187107" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.530995081" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1936515134" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.872243342" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.986323780" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.973348269" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.1623817380">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.1623817380" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.1623817380" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.1623817380." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.1143309044" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1858146420" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_clkout}/Release" id="com.crt.advproject.builder.exe.release.837255575" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.920815477" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.981649375" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.1229441757" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.299672894" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.137122375" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1741942206" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.2134041725" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1100892381" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.226581090" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.2023943401" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1691414485" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.475295113" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1463849815" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.470044434" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1939519743" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.807448144" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.442647489" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.708041083" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.167592723" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1777703665" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.525915328" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_clkout_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1904383591" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.462710688" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.728212103" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.187145351" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.596917913" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1233470578" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.483978179" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_clkout.com.crt.advproject.projecttype.exe.1903312394" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_clkout/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_clkout/.project
new file mode 100644
index 0000000..ffee730
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_clkout/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_clkout</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_clkout/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_clkout/example/readme.dox
new file mode 100644
index 0000000..6d194b9
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_clkout/example/readme.dox
@@ -0,0 +1,57 @@
+/*
+ * @brief CLKOUT example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_CLKOUT LPC15xx Clock output example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * This example shows how to use the SYSCTL driver to driver a specific
+ * clock source on the CLKOUT pin. To use this example, you'll need to
+ * connect an oscilloscope to the CLKOUT pin on your board. See the
+ * comments in the code for mapped pins for supported boards.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_clkout/example/src/clkout.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_clkout/example/src/clkout.c
new file mode 100644
index 0000000..dc5fd24
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_clkout/example/src/clkout.c
@@ -0,0 +1,133 @@
+/*
+ * @brief CLKOUT example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include <stdio.h>
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+static volatile uint32_t ticks100;
+
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+/* Use this pin for clockout */
+#define CLKOUT_PORT 1
+#define CLKOUT_PIN 0
+
+#else
+#error "No port/pin defined for the LPC15xx CLKOUT example"
+#endif
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle interrupt from SysTick timer
+ * @return Nothing
+ */
+void SysTick_Handler(void)
+{
+ ticks100++;
+ if ((ticks100 % 100) == 0) {
+ Board_LED_Toggle(0);
+ }
+}
+
+/**
+ * @brief main routine for CLKOUT example
+ * @return Function should not exit.
+ */
+int main(void)
+{
+ CHIP_SYSCTL_CLKOUTSRC_T clkoutClks;
+
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ Board_LED_Set(0, false);
+
+ /* Enable and setup SysTick Timer at a 100Hz rate */
+ SysTick_Config(Chip_Clock_GetSysTickClockRate() / 100);
+
+ /* Enable the power to the WDT */
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_WDTOSC_PD);
+ /* Setup SCT PLL */
+ Chip_SYSCTL_PowerDown(SYSCTL_POWERDOWN_SCTPLL_PD);
+ Chip_Clock_SetSCTPLLSource(SYSCTL_PLLCLKSRC_MAINOSC);
+ Chip_Clock_SetupSCTPLL(5, 2);
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_SCTPLL_PD);
+ /* Wait for PLL to lock */
+ while (!Chip_Clock_IsSCTPLLLocked()) {}
+ /* Enable RTC Oscillator */
+ Chip_Clock_EnableRTCOsc();
+
+ /* Enable SWM clocking prior to switch matrix operations */
+ Chip_SWM_Init();
+ Chip_GPIO_Init(LPC_GPIO);
+
+ /* Setup pin as CLKOUT */
+ Chip_SWM_MovablePortPinAssign(SWM_CLK_OUT_O, CLKOUT_PORT, CLKOUT_PIN);
+
+ /* Configure as a digital pin with no pullups/pulldowns */
+ Chip_IOCON_PinMuxSet(LPC_IOCON, CLKOUT_PORT, CLKOUT_PIN,
+ (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+
+ /* Cycle through all clock sources for the CLKOUT pin */
+ while (1) {
+ for (clkoutClks = SYSCTL_CLKOUTSRC_IRC;
+ clkoutClks <= SYSCTL_CLKOUTSRC_RTC32K; clkoutClks++) {
+
+ /* Setup CLKOUT pin for specific clock with a divider of 1 */
+ Chip_Clock_SetCLKOUTSource(clkoutClks, 1);
+
+ /* Wait 5 seconds */
+ ticks100 = 0;
+ while (ticks100 < 500) {
+ __WFI();
+ }
+ }
+ }
+
+ /* Disable CLKOUT pin by setting divider to 0 */
+ Chip_Clock_SetCLKOUTSource(SYSCTL_CLKOUTSRC_MAINSYSCLK, 0);
+
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_clkout/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_clkout/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_clkout/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_clkout/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_clkout/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_clkout/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_crc/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_crc/.cproject
new file mode 100644
index 0000000..69aa8c6
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_crc/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1784639090">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1784639090" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1784639090" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1784639090." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.833470053" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1128675664" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_crc}/Debug" id="com.crt.advproject.builder.exe.debug.1447710235" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.824368" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.285406499" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.2005817638" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.2037252701" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.2006218874" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.2091200773" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.2049349149" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.183651376" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.778316435" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.523909632" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.89130347" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.785489854" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1964729033" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1213120347" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1150151223" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.2025716955" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.605934073" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.168078147" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.216646928" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.508413795" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.301286981" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_crc_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1837679216" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1940430728" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.89909338" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.106494807" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.511125374" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1874802626" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.448922288" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.1804969998">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.1804969998" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.1804969998" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.1804969998." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.800786588" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1624615496" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_crc}/Release" id="com.crt.advproject.builder.exe.release.791135383" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.1600758624" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.1846190264" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.504735725" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.262063005" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1096438046" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1721736637" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.96837346" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.776699770" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1034208212" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1580218863" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1086012885" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1374472250" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.2120591264" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.23389389" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.932490333" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1761364221" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.731711495" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1100674041" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1034743235" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.33553810" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.605429171" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_crc_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1296303818" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.925530230" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1926640747" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1392822053" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1178429971" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.939847669" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1844198336" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_crc.com.crt.advproject.projecttype.exe.1214741866" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_crc/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_crc/.project
new file mode 100644
index 0000000..06f3fc2
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_crc/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_crc</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_crc/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_crc/example/readme.dox
new file mode 100644
index 0000000..39bc13e
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_crc/example/readme.dox
@@ -0,0 +1,58 @@
+/*
+ * @brief Cyclic Redundancy Check (CRC) generator example.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_CRC LPC15xx Cyclic Redundancy Check (CRC) generator example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * The CRC example demonstrates using the CRC engine for 8-bit, 16-bit, and
+ * 32-bit CRC computation. The CRC engine will continuously run via CRC
+ * computations and verify the CRC checksum. The system tick is used to
+ * occasionally introduce CRC errors into the expected data. The board LED
+ * will turn on for an error and turn off for no errors.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_crc/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_crc/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_crc/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_crc/example/src/crc.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_crc/example/src/crc.c
new file mode 100644
index 0000000..85d2f1f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_crc/example/src/crc.c
@@ -0,0 +1,114 @@
+/*
+ * @brief Cyclic Redundancy Check (CRC) generator example.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* CRC data test patterns */
+static const uint8_t bytes[] = {0x38, 0x38, 0x38, 0x38};
+static const uint16_t words[] = {0x3534, 0x3534, 0x3534, 0x3534};
+static const uint32_t dwords[] = {0x33323130, 0x33323130, 0x33323130, 0x33323130};
+static const uint32_t expect[] = {0x56AB, 0x7A89, 0xD7D6, 0x7D27, 0xA6669D7D};
+
+#define TICKRATE_HZ (10) /* 10 ticks per second */
+static volatile uint32_t ticks;
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle interrupt from SysTick timer
+ * @return Nothing
+ */
+void SysTick_Handler(void)
+{
+ ticks++;
+ __SEV();
+}
+
+/**
+ * @brief Application main function
+ * @return Does not return
+ * @note This function will not return.
+ */
+int main(void)
+{
+ uint32_t result[6], gencrc;
+
+ /* Board Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ /* Chip Initialization */
+ Chip_CRC_Init();
+
+ /* Enable SysTick Timer */
+ SysTick_Config(SystemCoreClock / TICKRATE_HZ);
+
+ /* Loop tests with occasional forced error */
+ while (1) {
+ result[0] = Chip_CRC_CRC8(&bytes[0], 1);
+ result[1] = Chip_CRC_CRC8(bytes, (sizeof(bytes) / sizeof(bytes[0])));
+ result[2] = Chip_CRC_CRC16(&words[0], 1);
+ if (ticks % 2 == 0) {
+ /* introduce bit errors on every other tick */
+ result[2] -= 1;
+ }
+ result[3] = Chip_CRC_CRC16(words, (sizeof(words) / sizeof(words[0])));
+ result[4] = Chip_CRC_CRC32(&dwords[0], 1);
+ result[5] = Chip_CRC_CRC32(dwords, (sizeof(dwords) / sizeof(dwords[0])));
+
+ gencrc = Chip_CRC_CRC32((uint32_t *) result, 5);
+ result[0] = Chip_CRC_CRC32((uint32_t *) expect, 5);
+ if (result[0] != gencrc) {
+ Board_LED_Set(0, true);
+ }
+ else {
+ Board_LED_Set(0, false);
+ }
+
+ /* Wait for tick */
+ __WFE();
+ }
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_crc/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_crc/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_crc/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dac/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dac/.cproject
new file mode 100644
index 0000000..1551e11
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dac/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1897530449">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1897530449" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1897530449" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1897530449." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.499851668" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.793601521" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_dac}/Debug" id="com.crt.advproject.builder.exe.debug.1541691663" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1516622051" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1481258799" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.924248469" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.712298592" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.31189354" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.443029785" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1486887074" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.807975139" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1974978546" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.1259848540" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.398939195" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1352497343" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1810379518" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.14590678" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1088689502" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.415337111" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.2130588122" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1326166205" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.481209887" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1382270077" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1141491516" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_dac_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1217067730" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.336947454" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.420586099" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.815856021" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.618158866" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1961572742" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1732883694" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.1252955601">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.1252955601" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.1252955601" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.1252955601." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.717055594" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1100263495" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_dac}/Release" id="com.crt.advproject.builder.exe.release.236705643" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.318528641" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.1718018480" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.2078965731" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.365955870" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1371500878" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.38439290" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1246814114" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1831983979" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1333432834" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.501632581" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.363212590" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1774725819" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.21070437" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.888020026" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1313802422" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1300550905" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.302112562" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1105703777" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.25669987" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1317764654" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1440919763" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_dac_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.2043240531" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1701672863" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1268604355" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.982835281" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1555032472" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.603743195" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.800571248" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_dac.com.crt.advproject.projecttype.exe.1156675774" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dac/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dac/.project
new file mode 100644
index 0000000..d6155ad
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dac/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_dac</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dac/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dac/example/readme.dox
new file mode 100644
index 0000000..502a9c0
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dac/example/readme.dox
@@ -0,0 +1,62 @@
+/*
+ * @brief Digital to Analog Converter example.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_DAC LPC15xx Digital to Analog Converter example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * The DAC example demonstrates using the Digital to Analog Converter.<br>
+ *
+ * This example uses the DAC to produce a stepped saw tooth waveform at 100Hz.
+ * It uses the internal timer as a trigger source for generating DAC interrupts
+ * The timer is set up to generate interrupts at 2KHz i.e. 20 DAC output samples
+ * for every sawtooth waveform. At the occurrence of the DAC interrupt the DAC input
+ * register is updated with an incremented value and the value is reset after it
+ * crosses the 12bit boundary for DAC input. P0.12 is the set up as the DAC output
+ * By connecting an oscilloscope to P0.12 and ground you will notice a stepped sawtooth
+ * waveform at 100Hz.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dac/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dac/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dac/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dac/example/src/dac.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dac/example/src/dac.c
new file mode 100644
index 0000000..677cd6b
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dac/example/src/dac.c
@@ -0,0 +1,126 @@
+/*
+ * @brief Digital to Analog converter example.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* DAC internal timer reload value to generate interrupts at 2KHz or 0.5ms*/
+#define DAC_TIM_RELOAD ((uint32_t) 0x8C9F)
+/* Increments for DAC input at every interrupt to generate a saw tooth wave of 100Hz*/
+#define DAC_IN_UPDATE ((uint32_t) 215)
+
+static volatile uint32_t dac_input;
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* DAC OUT Pin mux function - note that SystemInit() may already setup your
+ pin muxing at system startup */
+static void Init_DAC_PinMux(void)
+{
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+ /* Disables pullups/pulldowns and disable digital mode */
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 12, (IOCON_MODE_INACT | IOCON_ADMODE_EN));
+
+ /* Assign DAC_OUT to P0.12 via SWM (fixed pin) */
+ Chip_SWM_EnableFixedPin(SWM_FIXED_DAC_OUT);
+#else
+ /* Configure your own ACMP pin muxing here if needed */
+#warning "No DAC Out pin muxing defined"
+#endif
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief DAC interrupt handler sub-routine
+ * @return Nothing
+ */
+void DAC_IRQHandler(void)
+{
+ if (Chip_DAC_GetIntStatus(LPC_DAC)) {
+ /* Update DAC Input value*/
+ dac_input += DAC_IN_UPDATE;
+ /* Boundary check for max DAC input*/
+ if (dac_input > 4095) {
+ /* Cycle DAC values */
+ dac_input = 0;
+ }
+ /* Updating DAC Value register will clear interrupt */
+ Chip_DAC_UpdateValue(LPC_DAC, dac_input);
+ }
+}
+
+/**
+ * @brief Main program body
+ * @return Does not return
+ */
+int main(void)
+{
+ /* initialize the board */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ /* initialize the DAC */
+ Chip_DAC_Init(LPC_DAC);
+ /* Setup board specific DAC pin muxing */
+ Init_DAC_PinMux();
+ /* Initialize DAC input to 0 */
+ dac_input = 0;
+ /* Set up DAC internal timer to trigger interrupts every 0.5ms/2KHz */
+ Chip_DAC_SetReqInterval(LPC_DAC, 2000);
+ Chip_DAC_EnableIntTimer(LPC_DAC);
+ /* Disable double buffering */
+ Chip_DAC_EnableDoubleBuffer(LPC_DAC);
+ /* Set trigger source as Internal Timer */
+ Chip_DAC_SetTrgSrcInternal(LPC_DAC);
+ /* Start DAC with zero voltage */
+ Chip_DAC_UpdateValue(LPC_DAC, dac_input);
+ /* Enable the Interrupt for DAC */
+ NVIC_EnableIRQ(DAC_IRQ);
+
+ while (1) {
+ /* Enter low power mode until DAC interrupt */
+ __WFI();
+ }
+
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dac/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dac/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dac/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_mem/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_mem/.cproject
new file mode 100644
index 0000000..0acbc0a
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_mem/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1971374399">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1971374399" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1971374399" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1971374399." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.204165649" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1951067746" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_dma_mem}/Debug" id="com.crt.advproject.builder.exe.debug.734420886" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1223858187" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.501614000" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.1364192105" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1465165815" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.304184143" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1763094642" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.53820566" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1092917481" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1278298006" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.2090283223" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1863924259" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.2134086846" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1133791751" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.207319073" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1340042776" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.725993081" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1828076189" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.115913495" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.26686901" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1634542533" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.351214038" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_dma_mem_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1375714276" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.95637996" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1141516968" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1891847525" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1471975860" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1043209980" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1270193089" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.429315528">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.429315528" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.429315528" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.429315528." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.238693974" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1979381982" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_dma_mem}/Release" id="com.crt.advproject.builder.exe.release.1752833018" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.985379356" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.787817454" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.1508959088" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1746813280" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1583753985" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.677326746" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1250892242" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1562969694" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1179479666" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1854910133" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.258101593" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1320873941" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.166022428" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1598329457" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.547548935" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.124877312" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.787340773" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.2051684911" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.299115943" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.181948360" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1250561235" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_dma_mem_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.82514777" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1089890763" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1820114272" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.226517807" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.2076897195" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.668699482" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.580523078" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_dma_mem.com.crt.advproject.projecttype.exe.220319057" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_mem/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_mem/.project
new file mode 100644
index 0000000..a37f752
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_mem/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_dma_mem</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_mem/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_mem/example/readme.dox
new file mode 100644
index 0000000..80c8037
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_mem/example/readme.dox
@@ -0,0 +1,67 @@
+/*
+ * @brief DMA memory to memory transfer example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_DMA_MEM LPC15xx DMA memory to memory transfer example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * This example shows how to setup and use the DMA controller for a limited
+ * software triggered memory to memory transfer. Because of the limited burst
+ * transfer size of the DMA (1024 transfers max) and limited burst size, DMA
+ * M2M operations are somewhat specialized, but they do have a good performance
+ * boost over memcpy() and memmove() functions. They would work best for
+ * smaller transfers.<br>
+ *
+ * Time measurement for performance is in milliSeconds. Lower values indicate
+ * higher data transfer performance. A time 50% smaller than another time would
+ * mean the same operation was about 2x faster. Times are provided for similar
+ * memmove(), memcpy(), and DMA data move operations.<br>
+ *
+ * The example also includes a test enable definition (XFERTEST) that will
+ * also perform data testing when it is defined.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_mem/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_mem/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_mem/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_mem/example/src/dma_mem.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_mem/example/src/dma_mem.c
new file mode 100644
index 0000000..c7cdc53
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_mem/example/src/dma_mem.c
@@ -0,0 +1,226 @@
+/*
+ * @brief DMA memory to memory transfer example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "board.h"
+#include "stopwatch.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* Number of memory operations to use for application */
+#define NUMBER_TRANSFER_OPS 50000
+
+/* Size of the source and destination buffers in 32-bit words.
+ Allowable values = 128, 256, 512, or 1024 */
+#define SIZE_BUFFERS (512)
+
+/* Source and destination buffers */
+uint32_t src[SIZE_BUFFERS], dst[SIZE_BUFFERS];
+
+/* DMA completion flag */
+static volatile bool dmaDone;
+
+/* Enable this define to test the data after memory transfers */
+/* #define XFERTEST */
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Populate source array with changing data, clear destination data */
+static void modifyData(uint32_t *src, uint32_t *dst, int words)
+{
+#if defined(XFERTEST)
+ int i;
+
+ /* Put some data in the source buffer for test */
+ for (i = 0; i < words; i++) {
+ src[i] = src[i] + i + 1;
+ dst[i] = 0;
+ }
+#endif
+}
+
+/* Simple data verification */
+static void verifyData(uint32_t *src, uint32_t *dst, int words)
+{
+#if defined(XFERTEST)
+ int i, errIdx = -1;
+
+ for (i = 0; ((i < words) && (errIdx == -1)); i++) {
+ if (src[i] != dst[i]) {
+ errIdx = i;
+ }
+ }
+
+ if (errIdx != -1) {
+ Board_LED_Set(1, true); /* LED 1 indicates a compare error */
+ DEBUGOUT("Compare error on index %d\r\n", errIdx);
+ }
+#endif
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief DMA Interrupt Handler
+ * @return None
+ */
+void DMA_IRQHandler(void)
+{
+ /* Error interrupt on channel 0? */
+ if ((Chip_DMA_GetIntStatus(LPC_DMA) & DMA_INTSTAT_ACTIVEERRINT) != 0) {
+ /* This shouldn't happen for this simple DMA example, so set the LED
+ to indicate an error occurred. This is the correct method to clear
+ an abort. */
+ Chip_DMA_DisableChannel(LPC_DMA, DMA_CH0);
+ while ((Chip_DMA_GetBusyChannels(LPC_DMA) & (1 << DMA_CH0)) != 0) {}
+ Chip_DMA_AbortChannel(LPC_DMA, DMA_CH0);
+ Chip_DMA_ClearErrorIntChannel(LPC_DMA, DMA_CH0);
+ Chip_DMA_EnableChannel(LPC_DMA, DMA_CH0);
+ Board_LED_Set(0, true);
+ }
+
+ /* Clear DMA interrupt for the channel */
+ Chip_DMA_ClearActiveIntAChannel(LPC_DMA, DMA_CH0);
+
+ dmaDone = true;
+}
+
+/**
+ * @brief Main program body
+ * @return int
+ */
+int main(void)
+{
+ DMA_CHDESC_T dmaDesc;
+ int i;
+ uint32_t startTime, ticks[3];
+
+ /* Setup SystemCoreClock and any needed board code */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ /* Initialize stopwatch */
+ StopWatch_Init();
+
+ DEBUGOUT("Test transfer size is %d blocks @ %d bytes each\r\n",
+ NUMBER_TRANSFER_OPS, (SIZE_BUFFERS * 4));
+ DEBUGOUT("Total test size = %d bytes\r\n",
+ (NUMBER_TRANSFER_OPS * SIZE_BUFFERS * 4));
+
+ /* Reset timer and perform a bunch memory to memory moves with memmove */
+ DEBUGOUT("Starting memmove test\r\n");
+ startTime = StopWatch_Start();
+ for (i = 0; i < NUMBER_TRANSFER_OPS; i++) {
+ modifyData(src, dst, SIZE_BUFFERS);
+ memmove(dst, src, sizeof(src));
+ verifyData(src, dst, SIZE_BUFFERS);
+ }
+ ticks[0] = StopWatch_Elapsed(startTime);
+
+ /* Reset timer and perform a bunch memory to memory moves with memcpy */
+ DEBUGOUT("Starting memcpy test\r\n");
+ startTime = StopWatch_Start();
+ for (i = 0; i < NUMBER_TRANSFER_OPS; i++) {
+ modifyData(src, dst, SIZE_BUFFERS);
+ memcpy(dst, src, sizeof(src));
+ verifyData(src, dst, SIZE_BUFFERS);
+ }
+ ticks[1] = StopWatch_Elapsed(startTime);
+
+ /* DMA initialization - enable DMA clocking and reset DMA if needed */
+ Chip_DMA_Init(LPC_DMA);
+
+ /* Enable DMA controller and use driver provided DMA table for current descriptors */
+ Chip_DMA_Enable(LPC_DMA);
+ Chip_DMA_SetSRAMBase(LPC_DMA, DMA_ADDR(Chip_DMA_Table));
+
+ /* Setup channel 0 for the following configuration:
+ - High channel priority
+ - Interrupt A fires on descriptor completion */
+ Chip_DMA_EnableChannel(LPC_DMA, DMA_CH0);
+ Chip_DMA_EnableIntChannel(LPC_DMA, DMA_CH0);
+ Chip_DMA_SetupChannelConfig(LPC_DMA, DMA_CH0,
+ (DMA_CFG_HWTRIGEN | DMA_CFG_TRIGTYPE_EDGE | DMA_CFG_TRIGPOL_HIGH |
+ DMA_CFG_BURSTPOWER_128 | DMA_CFG_CHPRIORITY(0)));
+
+ /* DMA descriptor for memory to memory operation - note that addresses must
+ be the END address for src and destination, not the starting address.
+ DMA operations moves from end to start. */
+ dmaDesc.source = DMA_ADDR(&src[SIZE_BUFFERS - 1]) + 3;
+ dmaDesc.dest = DMA_ADDR(&dst[SIZE_BUFFERS - 1]) + 3;
+ dmaDesc.next = DMA_ADDR(0);
+
+ /* Enable DMA interrupt */
+ NVIC_EnableIRQ(DMA_IRQn);
+
+ /* Reset timer and perform a bunch memory to memory moves with DMA */
+ DEBUGOUT("Starting DMA test\r\n");
+ startTime = StopWatch_Start();
+ for (i = 0; i < NUMBER_TRANSFER_OPS; i++) {
+ dmaDone = false;
+
+ modifyData(src, dst, SIZE_BUFFERS);
+
+ /* Setup transfer descriptor and validate it */
+ Chip_DMA_SetupTranChannel(LPC_DMA, DMA_CH0, &dmaDesc);
+ Chip_DMA_SetValidChannel(LPC_DMA, DMA_CH0);
+
+ /* Setup data transfer and software trigger in same call */
+ Chip_DMA_SetupChannelTransfer(LPC_DMA, DMA_CH0,
+ (DMA_XFERCFG_CFGVALID | DMA_XFERCFG_SETINTA | DMA_XFERCFG_SWTRIG |
+ DMA_XFERCFG_WIDTH_32 | DMA_XFERCFG_SRCINC_1 | DMA_XFERCFG_DSTINC_1 |
+ DMA_XFERCFG_XFERCOUNT(SIZE_BUFFERS)));
+
+ /* Wait for DMA completion */
+ while (dmaDone == false) {
+ Chip_PMU_SleepState(LPC_PMU);
+ }
+
+ verifyData(src, dst, SIZE_BUFFERS);
+ }
+ ticks[2] = StopWatch_Elapsed(startTime);
+ DEBUGOUT("Transfer time with memmove (mS) = %d\r\n", StopWatch_TicksToMs(ticks[0]));
+ DEBUGOUT("Transfer time with memcpy (mS) = %d\r\n", StopWatch_TicksToMs(ticks[1]));
+ DEBUGOUT("Transfer time with DMA (mS) = %d\r\n", StopWatch_TicksToMs(ticks[2]));
+
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_mem/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_mem/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_mem/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_rom_uart/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_rom_uart/.cproject
new file mode 100644
index 0000000..0a4e2d4
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_rom_uart/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.30161643">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.30161643" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.30161643" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.30161643." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.256106400" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1387702674" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_dma_rom_uart}/Debug" id="com.crt.advproject.builder.exe.debug.1281195979" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.568730930" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1790637467" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.873500707" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1038038016" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1021127100" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1244780743" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.430749041" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.984661873" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1999841532" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.1771053268" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1787224610" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.186016265" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.2045862873" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.178713486" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.245578828" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.752210635" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.100295297" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1024036467" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.441807370" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.2025873104" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.556349978" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_dma_rom_uart_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1542060547" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1004772092" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1688587131" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.762498756" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.2001825482" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1038872024" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.5353122" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.119192567">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.119192567" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.119192567" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.119192567." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.333179222" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.183040175" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_dma_rom_uart}/Release" id="com.crt.advproject.builder.exe.release.2059915171" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.86503787" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.481056311" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.1814144147" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1266080727" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.582333551" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1460438754" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1366740637" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.998496183" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.828599573" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.312448403" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1750768024" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1476947074" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1487868268" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1993392500" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.2008915127" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1934344654" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.183264942" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1268903571" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1979872625" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.2041074991" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.359481985" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_dma_rom_uart_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1596637413" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.420382123" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1076208919" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.907736599" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.326011029" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.868646267" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.265821380" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_dma_rom_uart.com.crt.advproject.projecttype.exe.515434497" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_rom_uart/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_rom_uart/.project
new file mode 100644
index 0000000..2920086
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_rom_uart/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_dma_rom_uart</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_rom_uart/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_rom_uart/example/readme.dox
new file mode 100644
index 0000000..241f5e0
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_rom_uart/example/readme.dox
@@ -0,0 +1,69 @@
+/*
+ * @brief UART DMA example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_DMA_ROM_UART LPC15xx UART using DMA ROM example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * This examples shows how to use the DMA ROM driver to handle servicing
+ * of UART transmit and receive operations to offload the MCU and reduce
+ * interrupt processing.<br>
+ *
+ * UART transmit operations have a known transmit size and are queued to the
+ * DMA controller via descriptors setup for the transfer. Descriptors are
+ * only queued to the DMA controller when data is waiting to be sent.
+ * This specific implementation can queue multiple UART buffers with a single
+ * DMA interrupt per UART buffer sent. This example doesn't used linked
+ * DMA descriptors.<br>
+ *
+ * UART receive operations have a fixed list of descriptors and buffer sizes
+ * setup for a Ping Pong transfer, linked list is not supported by the ROM driver.
+ * The DMA controller will generate a DMA interrupt for UART receive only when
+ * a full buffer of data has been received. Once this buffer is received, it
+ * is sent back out via UART transmit via DMA.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_rom_uart/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_rom_uart/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_rom_uart/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_rom_uart/example/src/dma_rom_uart.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_rom_uart/example/src/dma_rom_uart.c
new file mode 100644
index 0000000..429510a
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_rom_uart/example/src/dma_rom_uart.c
@@ -0,0 +1,411 @@
+/*
+ * @brief UART DMA ROM example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include "string.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+#define USE_INTEGER_CLOCK
+
+/* DMA send string arrays. DMA buffers must remain in memory during the DMA
+ transfer. */
+#define DMASENDSTRCNT 6
+static char dmaSendStr[DMASENDSTRCNT][32];
+
+/* Number of UART TX descriptors used for DMA */
+#define UARTTXDESC 8
+
+/* Next available UART TX DMA descriptor and use counter */
+static volatile int nextTXDesc, countTXDescUsed;
+
+/* Number of UART RX descriptors used for DMA */
+#define UARTRXDESC 3
+
+/* Maximum size of each UART RX receive buffer */
+#define UARTRXBUFFSIZE 8
+
+/* UART RX receive buffers */
+static volatile uint8_t dmaRXBuffs[UARTRXDESC][UARTRXBUFFSIZE];
+
+/* UART receive buffer that is available and available flag */
+static volatile int uartRXBuff;
+static volatile bool uartRxAvail;
+
+/* RAM Block for the DMA ROM Handle which contains the DMA
+ Channel Descriptor Map which should be aligned to 512 bytes */
+#define RAMBLOCK 400
+#if defined(__CC_ARM)
+/* Keil alignment to 512 bytes */
+__align(512) static uint8_t dma_ram_block[RAMBLOCK];
+#endif /* defined (__CC_ARM) */
+
+/* IAR support */
+#if defined(__ICCARM__)
+/* IAR EWARM alignment to 512 bytes */
+#pragma data_alignment=512
+static uint8_t dma_ram_block[RAMBLOCK];
+#endif /* defined (__ICCARM__) */
+
+#if defined( __GNUC__ )
+/* GNU alignment to 512 bytes */
+static uint8_t dma_ram_block[RAMBLOCK]; __attribute__ ((aligned(512)));
+#endif /* defined (__GNUC__) */
+
+/* DMA descriptors must be aligned to 16 bytes */
+#if defined(__CC_ARM)
+__align(16) static DMA_CHDESC_T dmaTXDesc[UARTTXDESC];
+__align(16) static DMA_CHDESC_T dmaRXDesc[UARTRXDESC];
+#endif /* defined (__CC_ARM) */
+
+/* IAR support */
+#if defined(__ICCARM__)
+#pragma data_alignment=16
+static DMA_CHDESC_T dmaTXDesc[UARTTXDESC];
+#pragma data_alignment=16
+static DMA_CHDESC_T dmaRXDesc[UARTRXDESC];
+#endif /* defined (__ICCARM__) */
+
+#if defined( __GNUC__ )
+static DMA_CHDESC_T dmaTXDesc[UARTTXDESC] __attribute__ ((aligned(16)));
+static DMA_CHDESC_T dmaRXDesc[UARTRXDESC] __attribute__ ((aligned(16)));
+#endif /* defined (__GNUC__) */
+
+/* DMA ROM structures */
+static const DMAD_API_T *pDMAApi;
+static uint32_t size_in_bytes;
+static DMA_HANDLE_T dma_handle; /* handle to DMA */
+static DMA_CHANNEL_T dma_ch_cfg; /* Channel Configuration for DMA ROM API */
+static DMA_TASK_T dma_task_cfg; /* Transfer Configuration for DMA ROM API */
+static volatile ErrorCode_t err_code;
+
+static void dmaRXQueue(void);
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+static void Init_UART_PinMux(void)
+{
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 13, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 18, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+
+ /* UART signal muxing via SWM */
+ Chip_SWM_MovablePortPinAssign(SWM_UART0_RXD_I, 0, 13);
+ Chip_SWM_MovablePortPinAssign(SWM_UART0_TXD_O, 0, 18);
+
+#else
+#error "No UART setup defined"
+#endif
+}
+
+/* Transmit Callback for DMA Tx Channel */
+static void dmaTXDone(uint32_t err_code, uint32_t int_type)
+{
+ if ((ErrorCode_t) err_code == LPC_OK) {
+ /* No error, so decrement descriptor count */
+ countTXDescUsed--;
+ }
+ else {
+ /* DMA error, channel needs to be reset */
+ pDMAApi->dma_abort(dma_handle, DMAREQ_USART0_TX);
+ }
+ /* Is another DMA descriptor waiting that was not chained? */
+ if (countTXDescUsed > 0) {
+ nextTXDesc++;
+ /* Setup the Channel configuration structure with Peripheral request enabled for UART Tx
+ priority is 3 and setup callback routine */
+ dma_ch_cfg.event = DMA_ROM_CH_EVENT_PERIPH;
+ dma_ch_cfg.hd_trigger = 0;
+ dma_ch_cfg.priority = 3;
+ dma_ch_cfg.cb_func = dmaTXDone;
+ /* Setup Task Configuration structure, enable SW Trigger and INTA, 8 bit data width,
+ with no destination increment. The transfer length is retrieved from the descriptor */
+ dma_task_cfg.ch_num = DMAREQ_USART0_TX;
+ dma_task_cfg.config = DMA_ROM_TASK_CFG_SW_TRIGGER | DMA_ROM_TASK_CFG_SEL_INTA;
+ dma_task_cfg.data_type = DMA_ROM_TASK_DATA_WIDTH_8 | DMA_ROM_TASK_SRC_INC_1 | DMA_ROM_TASK_DEST_INC_0;
+ dma_task_cfg.data_length = dmaTXDesc[nextTXDesc].xfercfg;
+ dma_task_cfg.src = dmaTXDesc[nextTXDesc].source;
+ dma_task_cfg.dst = dmaTXDesc[nextTXDesc].dest;
+ dma_task_cfg.task_addr = (uint32_t) &dmaTXDesc[nextTXDesc];
+ /* Call DMA Init routine to start Tx transfer for newly added descriptor */
+ err_code = pDMAApi->dma_init(dma_handle, &dma_ch_cfg, &dma_task_cfg);
+ err_code = pDMAApi->dma_set_valid(dma_handle, DMAREQ_USART0_TX);
+ }
+}
+
+/* Receive Callback for DMA Rx Channel */
+static void dmaRXDone(uint32_t err_code, uint32_t int_type)
+{
+ /* Handle errors if needed */
+ if ((ErrorCode_t) err_code == LPC_OK) {
+ uartRxAvail = true;
+ }
+ else {
+ /* DMA error, channel needs to be reset */
+ pDMAApi->dma_abort(dma_handle, DMAREQ_USART0_RX);
+ dmaRXQueue();
+ }
+}
+
+/* Send data via the UART */
+static bool dmaTXSend(uint8_t *data, int bytes)
+{
+ /* Disable the DMA IRQ to prevent race conditions with shared data */
+ NVIC_DisableIRQ(DMA_IRQn);
+
+ /* This is a limited example, limit descriptor and byte count */
+ if ((countTXDescUsed >= UARTTXDESC) || (bytes > 1024)) {
+ /* Re-enable the DMA IRQ */
+ NVIC_EnableIRQ(DMA_IRQn);
+
+ /* All DMA descriptors are used, so just exit */
+ return false;
+ }
+ else if (countTXDescUsed == 0) {
+ /* No descriptors are currently used, so take the first one */
+ nextTXDesc = 0;
+ }
+
+ /* Create a descriptor for the data */
+ dmaTXDesc[countTXDescUsed].source = (uint32_t) (data + bytes - 1); /* Last address here */
+ dmaTXDesc[countTXDescUsed].dest = (uint32_t) &LPC_USART0->TXDATA; /* Byte aligned */
+
+ /* If there are multiple buffers with non-contiguous addresses, they can be chained
+ together here. If another TX buffer needs to be sent, the DMA
+ IRQ handler will re-queue and send the buffer there without using chaining. */
+ dmaTXDesc[countTXDescUsed].next = DMA_ADDR(0);
+
+ /* Temporarily store length in transfer configuration */
+ dmaTXDesc[countTXDescUsed].xfercfg = bytes - 1;
+
+ /* If a transfer is currently in progress, then stop here and let the DMA
+ handler re-queue the next transfer. Otherwise, start the transfer here. */
+ if (countTXDescUsed == 0) {
+ /* Setup the Channel configuration structure with Peripheral request enabled for UART Tx
+ priority is 3 and setup callback routine */
+ dma_ch_cfg.event = DMA_ROM_CH_EVENT_PERIPH;
+ dma_ch_cfg.hd_trigger = 0;
+ dma_ch_cfg.priority = 3;
+ dma_ch_cfg.cb_func = dmaTXDone;
+ /* Setup Task Configuration structure, enable SW Trigger and INTA, 8 bit data width,
+ with no destination increment. The transfer length is retrieved from the descriptor */
+ dma_task_cfg.ch_num = DMAREQ_USART0_TX;
+ dma_task_cfg.config = DMA_ROM_TASK_CFG_SW_TRIGGER | DMA_ROM_TASK_CFG_SEL_INTA;
+ dma_task_cfg.data_type = DMA_ROM_TASK_DATA_WIDTH_8 | DMA_ROM_TASK_SRC_INC_1 | DMA_ROM_TASK_DEST_INC_0;
+ dma_task_cfg.data_length = dmaTXDesc[countTXDescUsed].xfercfg;
+ dma_task_cfg.src = dmaTXDesc[countTXDescUsed].source;
+ dma_task_cfg.dst = dmaTXDesc[countTXDescUsed].dest;
+ dma_task_cfg.task_addr = (uint32_t) &dmaTXDesc[countTXDescUsed];
+ /* Call DMA Init routine to start Tx transfer for newly added descriptor */
+ err_code = pDMAApi->dma_init(dma_handle, &dma_ch_cfg, &dma_task_cfg);
+ err_code = pDMAApi->dma_set_valid(dma_handle, DMAREQ_USART0_TX);
+ }
+
+ /* Update used descriptor count */
+ countTXDescUsed++;
+
+ /* Re-enable the DMA IRQ */
+ NVIC_EnableIRQ(DMA_IRQn);
+
+ return true;
+}
+
+/* Queue up DMA descriptors and buffers for UART RX */
+static void dmaRXQueue(void)
+{
+ int i;
+
+ /* Linked list of descriptors that map to the 3 receive buffers */
+ for (i = 0; i < UARTRXDESC; i++) {
+ /* Setup next descriptor */
+ if (i == (UARTRXDESC - 1)) {
+ /* Wrap descriptors for the last one*/
+ dma_task_cfg.config = DMA_ROM_TASK_CFG_SEL_INTA | DMA_ROM_TASK_CFG_PING_PONG_EN;
+ }
+ else {
+ dma_task_cfg.config = DMA_ROM_TASK_CFG_SEL_INTA;
+ }
+ /* Update the Task Config structure for DMA ROM driver with no source increment, 8 bit data width*/
+ dma_task_cfg.ch_num = DMAREQ_USART0_RX;
+ dma_task_cfg.data_type = DMA_ROM_TASK_DATA_WIDTH_8 | DMA_ROM_TASK_SRC_INC_0 | DMA_ROM_TASK_DEST_INC_1;
+ dma_task_cfg.data_length = UARTRXBUFFSIZE - 1;
+ dma_task_cfg.src = (uint32_t) &LPC_USART0->RXDATA;
+ dma_task_cfg.dst = (uint32_t) (&dmaRXBuffs[i][0] + UARTRXBUFFSIZE - 1);
+ dma_task_cfg.task_addr = (uint32_t) &dmaRXDesc[i];
+ /* If it is the first descriptor then setup channel config structure and call Init */
+ if (i == 0) {
+ dma_ch_cfg.event = DMA_ROM_CH_EVENT_PERIPH;
+ dma_ch_cfg.hd_trigger = 0;
+ dma_ch_cfg.priority = 3;
+ dma_ch_cfg.cb_func = dmaRXDone;
+ err_code = pDMAApi->dma_init(dma_handle, &dma_ch_cfg, &dma_task_cfg);
+ }
+ /* Link descriptors */
+ else {
+ err_code = pDMAApi->dma_link(dma_handle, &dma_task_cfg, 1);
+ }
+ }
+ err_code = pDMAApi->dma_set_valid(dma_handle, DMAREQ_USART0_RX);
+ Chip_DMA_SWTriggerChannel(LPC_DMA, DMAREQ_USART0_RX);
+}
+
+/* Check and return UART RX data if it exists */
+static int checkRxData(uint8_t *buff)
+{
+ int bytesRec = 0;
+
+ if (uartRxAvail) {
+ uartRxAvail = false;
+
+ memcpy(buff, (void *) dmaRXBuffs[uartRXBuff], UARTRXBUFFSIZE);
+ uartRXBuff++;
+ if (uartRXBuff >= UARTRXDESC) {
+ /* Since we are using Ping Pong transfers
+ the buffer is reset to 1 and not 0*/
+ uartRXBuff = 1;
+ }
+ bytesRec = UARTRXBUFFSIZE;
+ }
+
+ return bytesRec;
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief DMA Interrupt Handler
+ * @return None
+ */
+void DMA_IRQHandler(void)
+{
+ /* Call ROM driver handler */
+ pDMAApi->dma_isr(dma_handle);
+}
+
+/**
+ * @brief Main UART/DMA program body
+ * @return Does not exit
+ */
+int main(void)
+{
+ int bytes = 0, idx;
+ uint8_t buff[UARTRXBUFFSIZE];
+
+ SystemCoreClockUpdate();
+ Board_Init();
+ Init_UART_PinMux();
+ Board_LED_Set(0, false);
+
+#if defined(USE_INTEGER_CLOCK)
+ /* Use main clock rate as base for UART baud rate divider */
+ Chip_Clock_SetUARTBaseClockRate(Chip_Clock_GetMainClockRate(), false);
+
+#else
+ /* Use 128x expected UART baud rate for fractional baud mode. */
+ Chip_Clock_SetUARTBaseClockRate((115200 * 128), true);
+#endif
+ /* Setup UART */
+ Chip_UART_Init(LPC_USART0);
+ Chip_UART_ConfigData(LPC_USART0, UART_CFG_DATALEN_8 | UART_CFG_PARITY_NONE | UART_CFG_STOPLEN_1);
+ Chip_UART_SetBaud(LPC_USART0, 115200);
+ /* Optional for low clock rates only: Chip_UART_SetBaudWithRTC32K(LPC_USART, 300); */
+ Chip_UART_Enable(LPC_USART0);
+ Chip_UART_TXEnable(LPC_USART0);
+
+ /* DMA initialization - enable DMA clocking and reset DMA if needed */
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_DMA);
+ Chip_SYSCTL_PeriphReset(RESET_DMA);
+ /* Initialize ROM API pointer */
+ pDMAApi = LPC_DMAD_API;
+ size_in_bytes = pDMAApi->dma_get_mem_size();
+ if (size_in_bytes > RAMBLOCK) {
+ /* Adjust RAMBLOCK size in this case */
+ return 1;
+ }
+ /* Setup DMA ROM driver, provided RAM blocks for DMA Handle */
+ dma_handle = pDMAApi->dma_setup(LPC_DMA_BASE, dma_ram_block);
+
+ /* Init UART 0 TX descriptor */
+ countTXDescUsed = 0;
+
+ /* Enable the DMA IRQ */
+ NVIC_EnableIRQ(DMA_IRQn);
+
+ /* Enqueue a bunch of strings in DMA transmit descriptors and start
+ transmit. In this use of DMA, the descriptors aren't chained, so
+ the DMA restarts the next queued descriptor in the DMA interrupt
+ handler. */
+ for (idx = 0; idx < DMASENDSTRCNT; idx++) {
+ sprintf(dmaSendStr[idx], "DMA send string (unlinked) #%d\r\n", idx);
+ dmaTXSend((uint8_t *) dmaSendStr[idx], strlen(dmaSendStr[idx]));
+ }
+
+ /* Wait for UART TX DMA channel to go inactive */
+ while (1) {
+ __WFI();
+ if (countTXDescUsed == 0) {
+ break;
+ }
+ }
+
+ /* Receive buffers are queued. The DMA interrupt will only trigger on a
+ full DMA buffer receive, so if the UART is idle, but the DMA is only
+ partially complete, the DMA interrupt won't fire. For UART data
+ receive where data is not continuous, a timeout method will be
+ required to flush the DMA when the DMA has pending data and no
+ data has been received on the UART in a specified timeout */
+ dmaRXQueue();
+
+ /* Get RX data via DMA and send it out on TX via DMA */
+ while (1) {
+ /* Sleep until something happens */
+ __WFI();
+
+ /* Did any data come in? */
+ bytes = checkRxData(buff);
+ if (bytes > 0) {
+ /* RX data received, send it via TX DMA */
+ dmaTXSend(buff, bytes);
+ }
+ }
+
+ return 1;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_rom_uart/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_rom_uart/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_rom_uart/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_uart/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_uart/.cproject
new file mode 100644
index 0000000..2cda734
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_uart/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1697071061">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1697071061" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1697071061" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1697071061." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.1694294162" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1488556240" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_dma_uart}/Debug" id="com.crt.advproject.builder.exe.debug.1977925913" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.315689954" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1891135681" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.535046394" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1003033875" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.857664439" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.70003955" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.867017525" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.659422277" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.890753031" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.1722597556" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1572803358" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.298777967" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1593657372" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.889192586" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1905502395" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1524532879" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.892197881" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1030144864" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1202335469" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.521206153" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.2061235963" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_dma_uart_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1631177510" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.687289444" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1071756434" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1609971040" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.2056320756" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1131899332" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.982542342" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.379454924">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.379454924" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.379454924" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.379454924." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.1101177536" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1818322614" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_dma_uart}/Release" id="com.crt.advproject.builder.exe.release.369955795" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.1421364411" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.447702949" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.1959199362" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1780376515" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.196038751" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.438510206" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1815797243" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1910813557" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.756201296" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1737591433" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.590032336" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.920250352" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1620852753" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1661587467" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1774268593" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1994873084" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.2004357585" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1949566906" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.615732180" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.808561561" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1832885629" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_dma_uart_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.214295457" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.564095365" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.97198615" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1947418897" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.526123835" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.548382268" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1075264779" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_dma_uart.com.crt.advproject.projecttype.exe.1122895077" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_uart/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_uart/.project
new file mode 100644
index 0000000..3a4c652
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_uart/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_dma_uart</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_uart/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_uart/example/readme.dox
new file mode 100644
index 0000000..575cd34
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_uart/example/readme.dox
@@ -0,0 +1,68 @@
+/*
+ * @brief UART DMA example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_DMA_UART LPC15xx UART using DMA example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * This examples shows how to use the DMA controller to handle servicing
+ * of UART transmit and receive operations to offload the MCU and reduce
+ * interrupt processing.<br>
+ *
+ * UART transmit operations have a known transmit size and are queued to the
+ * DMA controller via descriptors setup for the transfer. Descriptors are
+ * only queued to the DMA controller when data is waiting to be sent.
+ * This specific implementation can queue multiple UART buffers with a single
+ * DMA interrupt per UART buffer sent. This example doesn't used linked
+ * DMA descriptors.<br>
+ *
+ * UART receive operations have a fixed list of descriptors and buffer sizes.
+ * The DMA controller will generate a DMA interrupt for UART receive only when
+ * a full buffer of data has been received. Once this buffer is received, it
+ * is sent back out via UART transmit via DMA.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref BOARD_NXP_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_uart/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_uart/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_uart/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_uart/example/src/dma_uart.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_uart/example/src/dma_uart.c
new file mode 100644
index 0000000..0ea2da7
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_uart/example/src/dma_uart.c
@@ -0,0 +1,406 @@
+/*
+ * @brief UART DMA example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include "string.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+#define USE_INTEGER_CLOCK
+
+/* DMA send string arrays. DMA buffers must remain in memory during the DMA
+ transfer. */
+#define DMASENDSTRCNT 6
+static char dmaSendStr[DMASENDSTRCNT][32];
+
+/* Number of UART TX descriptors used for DMA */
+#define UARTTXDESC 8
+
+/* Next available UART TX DMA descriptor and use counter */
+static volatile int nextTXDesc, countTXDescUsed;
+
+/* Number of UART RX descriptors used for DMA */
+#define UARTRXDESC 4
+
+/* Maximum size of each UART RX receive buffer */
+#define UARTRXBUFFSIZE 8
+
+/* UART RX receive buffers */
+static uint8_t dmaRXBuffs[UARTRXDESC][UARTRXBUFFSIZE];
+
+/* UART receive buffer that is available and availa flag */
+static volatile int uartRXBuff;
+static volatile bool uartRxAvail;
+
+/* DMA descriptors must be aligned to 16 bytes */
+#if defined(__CC_ARM)
+__align(16) static DMA_CHDESC_T dmaTXDesc[UARTTXDESC];
+__align(16) static DMA_CHDESC_T dmaRXDesc[UARTRXDESC];
+#endif /* defined (__CC_ARM) */
+
+/* IAR support */
+#if defined(__ICCARM__)
+#pragma data_alignment=16
+static DMA_CHDESC_T dmaTXDesc[UARTTXDESC];
+#pragma data_alignment=16
+static DMA_CHDESC_T dmaRXDesc[UARTRXDESC];
+#endif /* defined (__ICCARM__) */
+
+#if defined( __GNUC__ )
+static DMA_CHDESC_T dmaTXDesc[UARTTXDESC] __attribute__ ((aligned(16)));
+static DMA_CHDESC_T dmaRXDesc[UARTRXDESC] __attribute__ ((aligned(16)));
+#endif /* defined (__GNUC__) */
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+static void Init_UART_PinMux(void)
+{
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 13, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 18, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+
+ /* UART signal muxing via SWM */
+ Chip_SWM_MovablePortPinAssign(SWM_UART0_RXD_I, 0, 13);
+ Chip_SWM_MovablePortPinAssign(SWM_UART0_TXD_O, 0, 18);
+
+#else
+#error "No UART setup defined"
+#endif
+}
+
+/* Setup DMA UART TX support, but do not queue descriptors yet */
+static void dmaTXSetup(void)
+{
+ /* Setup UART 0 TX channel for the following configuration:
+ - Peripheral DMA request (UART 0 TX channel)
+ - Single transfer
+ - Low channel priority */
+ Chip_DMA_EnableChannel(LPC_DMA, DMAREQ_USART0_TX);
+ Chip_DMA_EnableIntChannel(LPC_DMA, DMAREQ_USART0_TX);
+ Chip_DMA_SetupChannelConfig(LPC_DMA, DMAREQ_USART0_TX,
+ (DMA_CFG_PERIPHREQEN | DMA_CFG_TRIGBURST_SNGL | DMA_CFG_CHPRIORITY(3)));
+
+ countTXDescUsed = 0;
+}
+
+/* Setup DMA UART RX support, but do not queue descriptors yet */
+static void dmaRXSetup(void)
+{
+ /* Setup UART 0 RX channel for the following configuration:
+ - Peripheral DMA request (UART 0 RX channel)
+ - Single transfer
+ - Low channel priority */
+ Chip_DMA_EnableChannel(LPC_DMA, DMAREQ_USART0_RX);
+ Chip_DMA_EnableIntChannel(LPC_DMA, DMAREQ_USART0_RX);
+ Chip_DMA_SetupChannelConfig(LPC_DMA, DMAREQ_USART0_RX,
+ (DMA_CFG_PERIPHREQEN | DMA_CFG_TRIGBURST_SNGL | DMA_CFG_CHPRIORITY(3)));
+}
+
+/* Send data via the UART */
+static bool dmaTXSend(uint8_t *data, int bytes)
+{
+ /* Disable the DMA IRQ to prevent race conditions with shared data */
+ NVIC_DisableIRQ(DMA_IRQn);
+
+ /* This is a limited example, limit descriptor and byte count */
+ if ((countTXDescUsed >= UARTTXDESC) || (bytes > 1024)) {
+ /* Re-enable the DMA IRQ */
+ NVIC_EnableIRQ(DMA_IRQn);
+
+ /* All DMA descriptors are used, so just exit */
+ return false;
+ }
+ else if (countTXDescUsed == 0) {
+ /* No descriptors are currently used, so take the first one */
+ nextTXDesc = 0;
+ }
+
+ /* Create a descriptor for the data */
+ dmaTXDesc[countTXDescUsed].source = DMA_ADDR(data + bytes - 1); /* Last address here */
+ dmaTXDesc[countTXDescUsed].dest = DMA_ADDR(&LPC_USART0->TXDATA); /* Byte aligned */
+
+ /* If there are multiple buffers with non-contiguous addresses, they can be chained
+ together here (it is recommended to only use the DMA_XFERCFG_SETINTA on the
+ last chained descriptor). If another TX buffer needs to be sent, the DMA
+ IRQ handler will re-queue and send the buffer there without using chaining. */
+ dmaTXDesc[countTXDescUsed].next = DMA_ADDR(0);
+
+ /* Setup transfer configuration */
+ dmaTXDesc[countTXDescUsed].xfercfg = DMA_XFERCFG_CFGVALID | DMA_XFERCFG_SETINTA |
+ DMA_XFERCFG_SWTRIG | DMA_XFERCFG_WIDTH_8 | DMA_XFERCFG_SRCINC_1 |
+ DMA_XFERCFG_DSTINC_0 | DMA_XFERCFG_XFERCOUNT(bytes);
+
+ /* If a transfer is currently in progress, then stop here and let the DMA
+ handler re-queue the next transfer. Otherwise, start the transfer here. */
+ if (countTXDescUsed == 0) {
+ /* Setup transfer descriptor and validate it */
+ Chip_DMA_SetupTranChannel(LPC_DMA, DMAREQ_USART0_TX, &dmaTXDesc[countTXDescUsed]);
+
+ /* Setup data transfer */
+ Chip_DMA_SetupChannelTransfer(LPC_DMA, DMAREQ_USART0_TX,
+ dmaTXDesc[countTXDescUsed].xfercfg);
+
+ Chip_DMA_SetValidChannel(LPC_DMA, DMAREQ_USART0_TX);
+ }
+
+ /* Update used descriptor count */
+ countTXDescUsed++;
+
+ /* Re-enable the DMA IRQ */
+ NVIC_EnableIRQ(DMA_IRQn);
+
+ return true;
+}
+
+/* Queue up DMA descriptors and buffers for UART RX */
+static void dmaRXQueue(void)
+{
+ int i;
+
+ /* Linked list of descriptors that map to the 3 receive buffers */
+ for (i = 0; i < UARTRXDESC; i++) {
+ /* Setup next descriptor */
+ if (i == (UARTRXDESC - 1)) {
+ /* Wrap descriptors */
+ dmaRXDesc[i].next = DMA_ADDR(&dmaRXDesc[0]);
+ }
+ else {
+ dmaRXDesc[i].next = DMA_ADDR(&dmaRXDesc[i + 1]);
+ }
+
+ /* Create a descriptor for the data */
+ dmaRXDesc[i].source = DMA_ADDR(&LPC_USART0->RXDATA) + 0; /* Byte aligned */
+ dmaRXDesc[i].dest = DMA_ADDR(&dmaRXBuffs[i][0] + UARTRXBUFFSIZE - 1);
+
+ /* Setup transfer configuration */
+ dmaRXDesc[i].xfercfg = DMA_XFERCFG_CFGVALID | DMA_XFERCFG_SETINTA |
+ DMA_XFERCFG_WIDTH_8 | DMA_XFERCFG_SRCINC_0 |
+ DMA_XFERCFG_DSTINC_1 | DMA_XFERCFG_RELOAD |
+ DMA_XFERCFG_XFERCOUNT(UARTRXBUFFSIZE);
+ }
+
+ /* Setup transfer descriptor and validate it */
+ Chip_DMA_SetupTranChannel(LPC_DMA, DMAREQ_USART0_RX, &dmaRXDesc[0]);
+
+ /* Setup data transfer */
+ Chip_DMA_SetupChannelTransfer(LPC_DMA, DMAREQ_USART0_RX,
+ dmaRXDesc[0].xfercfg);
+ Chip_DMA_SetValidChannel(LPC_DMA, DMAREQ_USART0_RX);
+ Chip_DMA_SWTriggerChannel(LPC_DMA, DMAREQ_USART0_RX);
+}
+
+/* Check and return UART RX data if it exists */
+static int checkRxData(uint8_t *buff)
+{
+ int bytesRec = 0;
+
+ if (uartRxAvail) {
+ uartRxAvail = false;
+
+ memcpy(buff, dmaRXBuffs[uartRXBuff], UARTRXBUFFSIZE);
+ uartRXBuff++;
+ if (uartRXBuff >= UARTRXDESC) {
+ uartRXBuff = 0;
+ }
+ bytesRec = UARTRXBUFFSIZE;
+ }
+
+ return bytesRec;
+}
+
+/* Clear an error on a DMA channel */
+static void dmaClearChannel(DMA_CHID_T ch) {
+ Chip_DMA_DisableChannel(LPC_DMA, ch);
+ while ((Chip_DMA_GetBusyChannels(LPC_DMA) & (1 << ch)) != 0) {}
+
+ Chip_DMA_AbortChannel(LPC_DMA, ch);
+ Chip_DMA_ClearErrorIntChannel(LPC_DMA, ch);
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief DMA Interrupt Handler
+ * @return None
+ */
+void DMA_IRQHandler(void)
+{
+ uint32_t errors, pending;
+
+ /* Get DMA error and interrupt channels */
+ errors = Chip_DMA_GetErrorIntChannels(LPC_DMA);
+ pending = Chip_DMA_GetActiveIntAChannels(LPC_DMA);
+
+ /* Check DMA interrupts of UART 0 TX channel */
+ if ((errors | pending) & (1 << DMAREQ_USART0_TX)) {
+ /* Clear DMA interrupt for the channel */
+ Chip_DMA_ClearActiveIntAChannel(LPC_DMA, DMAREQ_USART0_TX);
+
+ /* Handle errors if needed */
+ if (errors & (1 << DMAREQ_USART0_TX)) {
+ /* DMA error, channel needs to be reset */
+ dmaClearChannel(DMAREQ_USART0_TX);
+ dmaTXSetup();
+ }
+ else {
+ /* Descriptor is consumed */
+ countTXDescUsed--;
+ }
+
+ /* Is another DMA descriptor waiting that was not chained? */
+ if (countTXDescUsed > 0) {
+ nextTXDesc++;
+
+ /* Setup transfer descriptor and validate it */
+ Chip_DMA_SetupTranChannel(LPC_DMA, DMAREQ_USART0_TX, &dmaTXDesc[nextTXDesc]);
+
+ /* Setup data transfer */
+ Chip_DMA_SetupChannelTransfer(LPC_DMA, DMAREQ_USART0_TX,
+ dmaTXDesc[nextTXDesc].xfercfg);
+
+ Chip_DMA_SetValidChannel(LPC_DMA, DMAREQ_USART0_TX);
+ }
+ }
+
+ /* Check DMA interrupts of UART 0 RX channel */
+ if ((errors | pending) & (1 << DMAREQ_USART0_RX)) {
+ /* Clear DMA interrupt for the channel */
+ Chip_DMA_ClearActiveIntAChannel(LPC_DMA, DMAREQ_USART0_RX);
+
+ /* Handle errors if needed */
+ if (errors & (1 << DMAREQ_USART0_RX)) {
+ /* DMA error, channel needs to be reset */
+ dmaClearChannel(DMAREQ_USART0_RX);
+ dmaRXSetup();
+ dmaRXQueue();
+ }
+ else {
+ uartRxAvail = true;
+ }
+ }
+}
+
+/**
+ * @brief Main UART/DMA program body
+ * @return Does not exit
+ */
+int main(void)
+{
+ int bytes, idx;
+ uint8_t buff[UARTRXBUFFSIZE];
+
+ SystemCoreClockUpdate();
+ Board_Init();
+ Init_UART_PinMux();
+ Board_LED_Set(0, false);
+
+#if defined(USE_INTEGER_CLOCK)
+ /* Use main clock rate as base for UART baud rate divider */
+ Chip_Clock_SetUARTBaseClockRate(Chip_Clock_GetMainClockRate(), false);
+
+#else
+ /* Use 128x expected UART baud rate for fractional baud mode. */
+ Chip_Clock_SetUARTBaseClockRate((115200 * 128), true);
+#endif
+ /* Setup UART */
+ Chip_UART_Init(LPC_USART0);
+ Chip_UART_ConfigData(LPC_USART0, UART_CFG_DATALEN_8 | UART_CFG_PARITY_NONE | UART_CFG_STOPLEN_1);
+ Chip_UART_SetBaud(LPC_USART0, 115200);
+ /* Optional for low clock rates only: Chip_UART_SetBaudWithRTC32K(LPC_USART, 300); */
+ Chip_UART_Enable(LPC_USART0);
+ Chip_UART_TXEnable(LPC_USART0);
+
+ /* DMA initialization - enable DMA clocking and reset DMA if needed */
+ Chip_DMA_Init(LPC_DMA);
+
+ /* Enable DMA controller and use driver provided DMA table for current descriptors */
+ Chip_DMA_Enable(LPC_DMA);
+ Chip_DMA_SetSRAMBase(LPC_DMA, DMA_ADDR(Chip_DMA_Table));
+
+ /* Setup UART 0 TX DMA support */
+ dmaTXSetup();
+
+ /* Setup UART 0 RX DMA support */
+ dmaRXSetup();
+
+ /* Enable the DMA IRQ */
+ NVIC_EnableIRQ(DMA_IRQn);
+
+ /* Enqueue a bunch of strings in DMA transmit descriptors and start
+ transmit. In this use of DMA, the descriptors aren't chained, so
+ the DMA restarts the next queued descriptor in the DMA interrupt
+ handler. */
+ for (idx = 0; idx < DMASENDSTRCNT; idx++) {
+ sprintf(dmaSendStr[idx], "DMA send string (unlinked) #%d\r\n", idx);
+ dmaTXSend((uint8_t *) dmaSendStr[idx], strlen(dmaSendStr[idx]));
+ }
+
+ /* Wait for UART TX DMA channel to go inactive */
+ while (1) {
+ __WFI();
+ if (Chip_DMA_GetActiveChannels(LPC_DMA) & (1 << DMAREQ_USART0_TX)) {
+ break;
+ }
+ }
+
+ /* Receive buffers are queued. The DMA interrupt will only trigger on a
+ full DMA buffer receive, so if the UART is idle, but the DMA is only
+ partially complete, the DMA interrupt won't fire. For UART data
+ receive where data is not continuous, a timeout method will be
+ required to flush the DMA when the DMA has pending data and no
+ data has been received on the UART in a specified timeout */
+ dmaRXQueue();
+
+ /* Get RX data via DMA and send it out on TX via DMA */
+ while (1) {
+ /* Sleep until something happens */
+ __WFI();
+
+ /* Did any data come in? */
+ bytes = checkRxData(buff);
+ if (bytes > 0) {
+ /* RX data received, send it via TX DMA */
+ dmaTXSend(buff, bytes);
+ }
+ }
+
+ return 1;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_uart/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_uart/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_dma_uart/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_eeprom/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_eeprom/.cproject
new file mode 100644
index 0000000..daae1cc
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_eeprom/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.109607857">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.109607857" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.109607857" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.109607857." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.1021135262" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1552251725" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_eeprom}/Debug" id="com.crt.advproject.builder.exe.debug.583057236" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.2067259817" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.34400001" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.667316587" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1471963262" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.372446711" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.2081798895" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1140165234" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1587534750" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1595624510" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.1503573419" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1286006069" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1103878439" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1921844870" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.913149231" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.667160993" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.110146566" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.402369902" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1474566851" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.705524238" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1910432196" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1830919861" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_eeprom_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.674408869" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.857539220" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.410891303" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.777374649" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.5526724" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1527558490" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1843853117" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.1957251931">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.1957251931" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.1957251931" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.1957251931." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.414782038" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.609321732" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_eeprom}/Release" id="com.crt.advproject.builder.exe.release.1108010034" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.2024565568" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.2045937462" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.267500616" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1382836086" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1731802247" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.2076072485" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1483426781" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.521997031" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.2140530184" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1643192675" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1954386985" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.674402557" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.729721969" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1083641937" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.509197636" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1747535693" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.1239199892" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1212691567" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.406991207" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1560919832" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1093195757" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_eeprom_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1474293910" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1626055916" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.589809259" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1390163348" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1237737607" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.624250116" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1469326978" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_eeprom.com.crt.advproject.projecttype.exe.1174727358" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_eeprom/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_eeprom/.project
new file mode 100644
index 0000000..deb472f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_eeprom/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_eeprom</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_eeprom/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_eeprom/example/readme.dox
new file mode 100644
index 0000000..c5b6a09
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_eeprom/example/readme.dox
@@ -0,0 +1,55 @@
+/*
+ * @brief EEPROM example using IAP command to read/write from/to EEPROM
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_EEPROM LPC15xx EEPROM read/write example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * This examples uses the IAP commands to read and write a small test
+ * string from and to the EEPROM.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_eeprom/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_eeprom/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_eeprom/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_eeprom/example/src/eeprom.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_eeprom/example/src/eeprom.c
new file mode 100644
index 0000000..422ee6e
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_eeprom/example/src/eeprom.c
@@ -0,0 +1,197 @@
+/*
+ * @brief EEPROM example
+ * This example show how to use the EEPROM interface
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include "string.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* Systick interrupt rate */
+#define TICKRATE_HZ (10) /* 10 ticks per second */
+
+/* EEPROM Address used for storage */
+#define EEPROM_ADDRESS 0x00000100
+
+/* Write count */
+#define IAP_NUM_BYTES_TO_READ_WRITE 32
+
+/* Tag for checking if a string already exists in EEPROM */
+#define CHKTAG "NxP"
+#define CHKTAG_SIZE 3
+
+/* ASCII ESC character code */
+#define ESC_CHAR 27
+
+/* Read/write buffer (32-bit aligned) */
+uint32_t buffer[IAP_NUM_BYTES_TO_READ_WRITE / sizeof(uint32_t)];
+
+/* Test string for no DEBUG */
+#define TESTSTRING "12345678"
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Show current string stored in UART */
+static void ShowString(char *str) {
+ int stSize;
+
+ /* Is data tagged with check pattern? */
+ if (strncmp(str, CHKTAG, CHKTAG_SIZE) == 0) {
+ /* Get next byte, which is the string size in bytes */
+ stSize = (uint32_t) str[3];
+ if (stSize > 32) {
+ stSize = 32;
+ }
+
+ /* Add terminator */
+ str[4 + stSize] = '\0';
+
+ /* Show string stored in EEPROM */
+ DEBUGSTR("Stored string found in EEEPROM\r\n");
+ DEBUGSTR("-->");
+ DEBUGSTR((char *) &str[4]);
+ DEBUGSTR("<--\r\n");
+ }
+ else {
+ DEBUGSTR("No string stored in the EEPROM\r\n");
+ }
+}
+
+/* Get a string to save from the UART */
+static uint32_t MakeString(uint8_t *str)
+{
+ int index, byte;
+ char strOut[2];
+
+ /* Get a string up to 32 bytes to write into EEPROM */
+ DEBUGSTR("\r\nEnter a string to write into EEPROM\r\n");
+ DEBUGSTR("Up to 32 bytes in length, press ESC to accept\r\n");
+
+ /* Setup header */
+ strncpy((char *) str, CHKTAG, CHKTAG_SIZE);
+
+#if defined(DEBUG_ENABLE)
+ /* Read until escape, but cap at 32 characters */
+ index = 0;
+ strOut[1] = '\0';
+ byte = DEBUGIN();
+ while ((index < 32) && (byte != ESC_CHAR)) {
+ if (byte != EOF) {
+ strOut[0] = str[4 + index] = (uint8_t) byte;
+ DEBUGSTR(strOut);
+ index++;
+ }
+
+ byte = DEBUGIN();
+ }
+#else
+ /* Suppress warnings */
+ (void) byte;
+ (void) strOut;
+
+ /* Debug input not enabled, so use a pre-setup string */
+ strcpy((char *) &str[4], TESTSTRING);
+ index = strlen(TESTSTRING);
+#endif
+
+ str[3] = (uint8_t) index;
+
+ return (uint32_t) index;
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle interrupt from SysTick timer
+ * @return Nothing
+ */
+void SysTick_Handler(void)
+{
+ Board_LED_Toggle(0);
+}
+
+/**
+ * @brief main routine for EEPROM example
+ * @return Always returns 0
+ */
+int main(void)
+{
+ uint8_t *ptr = (uint8_t *) buffer;
+ uint8_t ret_code;
+
+ /* Generic Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ /* Enable SysTick Timer */
+ SysTick_Config(SystemCoreClock / TICKRATE_HZ);
+
+ /* Enable EEPROM clock and reset EEPROM controller */
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_EEPROM);
+ Chip_SYSCTL_PeriphReset(RESET_EEPROM);
+
+ /* Data to be read from EEPROM */
+ ret_code = Chip_EEPROM_Read(EEPROM_ADDRESS, ptr, IAP_NUM_BYTES_TO_READ_WRITE);
+
+ /* Error checking */
+ if (ret_code != IAP_CMD_SUCCESS) {
+ DEBUGOUT("Command failed to execute, return code is: %x\r\n", ret_code);
+ }
+
+ /* Check and display string if it exists */
+ ShowString((char *) ptr);
+
+ /* Get a string to save */
+ MakeString(ptr);
+
+ /* Data to be written to EEPROM */
+ ret_code = Chip_EEPROM_Write(EEPROM_ADDRESS, ptr, IAP_NUM_BYTES_TO_READ_WRITE);
+
+ /* Error checking */
+ if (ret_code == IAP_CMD_SUCCESS) {
+ DEBUGSTR("EEPROM write passed\r\n");
+ }
+ else {
+ DEBUGOUT("EEPROM write failed, return code is: %x\r\n", ret_code);
+ }
+
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_eeprom/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_eeprom/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_eeprom/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_flashiap/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_flashiap/.cproject
new file mode 100644
index 0000000..082d7f8
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_flashiap/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1305489825">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1305489825" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1305489825" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1305489825." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.269552822" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.244490292" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_flashiap}/Debug" id="com.crt.advproject.builder.exe.debug.489162669" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1572106976" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1999779968" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.1988641650" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.217886185" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.537147080" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.211308509" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.701397798" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.886486992" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1892424282" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.347562859" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.954276237" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.388091351" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1884889773" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.564494007" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.659553373" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1795805497" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1197564159" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1267602972" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.485437290" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.2103368180" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1389365005" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_flashiap_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1853005983" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1965924983" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.971001691" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1641657161" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.29742643" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.284534708" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.124725121" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.397138592">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.397138592" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.397138592" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.397138592." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.1983724593" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.140103262" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_flashiap}/Release" id="com.crt.advproject.builder.exe.release.1835894920" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.1134873932" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.533179413" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.1917397364" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1608828382" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.2138104450" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1627406844" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1771309608" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.506744525" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.2119552780" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1514430838" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.273442370" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.464291123" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1717941958" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.2006395363" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.439024651" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1973005495" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.1537149647" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.558815024" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1899730080" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.338091907" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.841926895" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_flashiap_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1421008512" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.251029178" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1726500894" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1183228574" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.376805173" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.429359294" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.942739465" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_flashiap.com.crt.advproject.projecttype.exe.1416866339" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_flashiap/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_flashiap/.project
new file mode 100644
index 0000000..b26bc51
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_flashiap/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_flashiap</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_flashiap/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_flashiap/example/readme.dox
new file mode 100644
index 0000000..f289e84
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_flashiap/example/readme.dox
@@ -0,0 +1,64 @@
+/*
+ * @brief IAP FLASH programming & FLASH signature example using IAP commands
+ * to write to FLASH memory with FLASH signature generator
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_FLASHSIG LPC15xx FLASH read/write/signature example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * The IAP example demonstrates programming a FLASH block during run-time and
+ * generating a FLASH signature. For this example, the code is running from FLASH
+ * and a FLASH block not used for the executing code will be erased and programmed
+ * with some data. After the program is complete, the signature for the programmed
+ * area is generated. The example also toggles the LED in the systick interrupt.
+ * The interrupts need to be disabled during the IAP calls that change FLASH data
+ * and re-enabled after the calls are complete.>br>
+ *
+ * Do not run this example too many times or set it up to repeatedly erase and
+ * reprogram FLASH as it will wear out FLASH.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_flashiap/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_flashiap/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_flashiap/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_flashiap/example/src/flashiap.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_flashiap/example/src/flashiap.c
new file mode 100644
index 0000000..d931df7
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_flashiap/example/src/flashiap.c
@@ -0,0 +1,159 @@
+/*
+ * @brief FLASH IAP programming & FLASH signature example using IAP commands
+ * to write to FLASH memory and a FLASH signature generator
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include <stdio.h>
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+#define TICKRATE_HZ (10) /* 10 ticks per second */
+
+/* Last sector address */
+#define START_ADDR_LAST_SECTOR 0x0003F000
+
+/* LAST SECTOR */
+#define IAP_LAST_SECTOR 63
+
+/* Number of bytes to be written to the last sector */
+#define IAP_NUM_BYTES_TO_WRITE 1024
+
+/* Size of each sector */
+#define SECTOR_SIZE 4096
+
+/* Number elements in array */
+#define ARRAY_ELEMENTS (IAP_NUM_BYTES_TO_WRITE / sizeof(uint32_t))
+
+/* Data array to write to flash */
+static uint32_t src_iap_array_data[ARRAY_ELEMENTS];
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle interrupt from SysTick timer
+ * @return Nothing
+ */
+void SysTick_Handler(void)
+{
+ Board_LED_Toggle(0);
+}
+
+/**
+ * @brief Main program body
+ * @return Always returns 0
+ */
+int main(void)
+{
+ int i;
+ uint8_t ret_code;
+ uint32_t part_id;
+
+ /* Generic Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+ Board_LED_Set(0, false);
+
+ /* Enable SysTick Timer */
+ SysTick_Config(SystemCoreClock / TICKRATE_HZ);
+
+ /* Initialize the array data to be written to FLASH */
+ for (i = 0; i < ARRAY_ELEMENTS; i++) {
+ src_iap_array_data[i] = 0x11223340 + i;
+ }
+
+ /* Read Part Identification Number*/
+ part_id = Chip_IAP_ReadPID();
+ DEBUGOUT("Part ID is: %x\r\n", part_id);
+
+ /* Disable interrupt mode so it doesn't fire during FLASH updates */
+ __disable_irq();
+
+ /* IAP Flash programming */
+ /* Prepare to write/erase the last sector */
+ ret_code = Chip_IAP_PreSectorForReadWrite(IAP_LAST_SECTOR, IAP_LAST_SECTOR);
+
+ /* Error checking */
+ if (ret_code != IAP_CMD_SUCCESS) {
+ DEBUGOUT("Command failed to execute, return code is: %x\r\n", ret_code);
+ }
+
+ /* Erase the last sector */
+ ret_code = Chip_IAP_EraseSector(IAP_LAST_SECTOR, IAP_LAST_SECTOR);
+
+ /* Error checking */
+ if (ret_code != IAP_CMD_SUCCESS) {
+ DEBUGOUT("Command failed to execute, return code is: %x\r\n", ret_code);
+ }
+
+ /* Prepare to write/erase the last sector */
+ ret_code = Chip_IAP_PreSectorForReadWrite(IAP_LAST_SECTOR, IAP_LAST_SECTOR);
+
+ /* Error checking */
+ if (ret_code != IAP_CMD_SUCCESS) {
+ DEBUGOUT("Command failed to execute, return code is: %x\r\n", ret_code);
+ }
+
+ /* Write to the last sector */
+ ret_code = Chip_IAP_CopyRamToFlash(START_ADDR_LAST_SECTOR, src_iap_array_data, IAP_NUM_BYTES_TO_WRITE);
+
+ /* Error checking */
+ if (ret_code != IAP_CMD_SUCCESS) {
+ DEBUGOUT("Command failed to execute, return code is: %x\r\n", ret_code);
+ }
+
+ /* Re-enable interrupt mode */
+ __enable_irq();
+
+ /* Start the signature generator for the last sector */
+ Chip_FMC_ComputeSignatureBlocks(START_ADDR_LAST_SECTOR, (SECTOR_SIZE / 16));
+
+ /* Check for signature geenration completion */
+ while (Chip_FMC_IsSignatureBusy()) {}
+
+ /* Get the generated FLASH signature value */
+ DEBUGOUT("Generated signature for the last sector is: %x \r\n", Chip_FMC_GetSignature(0));
+
+ NVIC_DisableIRQ(SysTick_IRQn);
+
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_flashiap/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_flashiap/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_flashiap/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_freqmeas/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_freqmeas/.cproject
new file mode 100644
index 0000000..4d4b551
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_freqmeas/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.557244595">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.557244595" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.557244595" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.557244595." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.1389366160" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1083475979" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_freqmeas}/Debug" id="com.crt.advproject.builder.exe.debug.1428598836" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1209723192" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1267810681" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.263447156" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1065060834" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.290622202" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.419380439" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1193899906" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.638953250" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1824850974" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.165018203" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1115178693" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1913877906" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1140627249" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1903256036" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.546210932" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.675494584" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.969625889" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.123711153" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.732304451" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1415339576" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.917518265" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_freqmeas_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.2110007023" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.840424370" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1206784199" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1983840883" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1086022856" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.940186753" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1742515353" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.649332952">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.649332952" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.649332952" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.649332952." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.1375504989" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.982160898" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_freqmeas}/Release" id="com.crt.advproject.builder.exe.release.400471831" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.1290883058" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.1350426091" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.586229418" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1309634903" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1142938684" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.969451600" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1088485379" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1911658961" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1369279921" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1016984321" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.262956757" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1829887377" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1110269868" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.660464983" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.513423057" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.354073625" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.811865915" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1814006181" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.15610308" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1145873276" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1093755054" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_freqmeas_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1378711437" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.271396742" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.2144379857" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.495930043" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.2007233246" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.369904478" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1794632595" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_freqmeas.com.crt.advproject.projecttype.exe.1055774124" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_freqmeas/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_freqmeas/.project
new file mode 100644
index 0000000..47fc171
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_freqmeas/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_freqmeas</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_freqmeas/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_freqmeas/example/readme.dox
new file mode 100644
index 0000000..2705892
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_freqmeas/example/readme.dox
@@ -0,0 +1,62 @@
+/*
+ * @brief Freqeuency measurement example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_FREQMEAS LPC15xx Freqeuency measurement example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * This example shows how to use the frequency measurement capability in
+ * the SYSCON and INMUX blocks to measure unknown frequencies using a known
+ * reference frequency.<br>
+ *
+ * The frequency measurement capability can measure target source frequencies
+ * if the reference frequency is greater than the target frequency. The example
+ * will measure the RTC and watchdog oscillator frequencies using the main
+ * oscillator, internal RC oscillator, and the divided system clock (via the
+ * CLKOUT pin) as reference clocks.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_freqmeas/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_freqmeas/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_freqmeas/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_freqmeas/example/src/freqmeas.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_freqmeas/example/src/freqmeas.c
new file mode 100644
index 0000000..2e8e451
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_freqmeas/example/src/freqmeas.c
@@ -0,0 +1,138 @@
+/*
+ * @brief Freqeuency measurement example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Measurement cycle with value display */
+static uint32_t measureDisplay(char *str, FREQMSR_SRC_T src, uint32_t freqRef)
+{
+ uint32_t freqComp;
+
+ /* Setup to measure the selected target */
+ Chip_INMUX_SetFreqMeasTargClock(src);
+
+ /* Start a measurement cycle and wait for it to complete. If the target
+ clock is not running, the measurement cycle will remain active
+ forever, so a timeout may be necessary if the target clock can stop */
+ Chip_SYSCTL_StartFreqMeas();
+ while (!Chip_SYSCTL_IsFreqMeasComplete()) {}
+
+ /* Get computed frequency */
+ freqComp = Chip_SYSCTL_GetCompFreqMeas(freqRef);
+
+ /* Show the raw capture value and the compute frequency */
+ DEBUGOUT("Capture source : %s, reference frequency = %dHz\r\n", str, freqRef);
+ DEBUGOUT("Raw frequency capture value = %d\r\n", Chip_SYSCTL_GetRawFreqMeasCapval());
+ DEBUGOUT("Computed frequency value = %dHz\r\n\r\n", freqComp);
+
+ return freqComp;
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Application main function
+ * @return Does not return
+ */
+int main(void)
+{
+ uint32_t freqRef;
+
+ /* Board Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ /* Enable watchdog oscillator needed for measurement later. Enabling it
+ early allows it to settle. */
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_WDTOSC_PD);
+
+ /* Setup to use the main oscillator for the frequency reference since
+ we already know this rate */
+ Chip_INMUX_SetFreqMeasRefClock(FREQMSR_MAIN_OSC);
+ freqRef = Chip_Clock_GetMainOscRate();
+
+ /* Start RTC oscillator frequency measurement and display results */
+ measureDisplay("RTC32K oscillator (main osc reference)", FREQMSR_32KHZOSC, freqRef);
+
+ /* Start watchdog oscillator frequency measurement and display results */
+ measureDisplay("Watchdog oscillator (main osc reference)", FREQMSR_WDOSC, freqRef);
+
+ /* Note that the accuracy of a target measurement requires a reference
+ clock rate faster than then target clock, so using the main oscillator
+ source (typically 12MHz) can't be used to get the IRC clock rate. To
+ get around this, the main PLL can be used as a reference clock by
+ routing the PLL output to CLKOUT and then using the switch matrix
+ pin assign function to map CLKOUT to one of the frequency measurement
+ input mux pins. The sequence below shows how to do this and measure
+ the watchdog oscillator and internal RC oscillator frequencies. */
+
+ /* Route the CLKOUT pin to pin PIO0_5 */
+ Chip_SWM_MovablePortPinAssign(SWM_CLK_OUT_O, 0, 5);
+
+ /* Enable CLKOUT with the PLL output (main system clock) and a divider of 2 */
+ Chip_Clock_SetCLKOUTSource(SYSCTL_CLKOUTSRC_MAINSYSCLK, 2);
+
+ /* Set reference frequency to the clock on PIO0_5 */
+ Chip_INMUX_SetFreqMeasRefClock(FREQMSR_PIO0_5);
+ freqRef = Chip_Clock_GetSystemClockRate() / 2;
+
+ /* Start RTC oscillator frequency measurement and display results */
+ measureDisplay("RTC32K oscillator (CLKOUT reference)", FREQMSR_32KHZOSC, freqRef);
+
+ /* Start watchdog oscillator frequency measurement and display results */
+ measureDisplay("Watchdog oscillator (CLKOUT reference)", FREQMSR_WDOSC, freqRef);
+
+ /* Try a few measurements with the IRC and it's computed frequency */
+ Chip_INMUX_SetFreqMeasRefClock(FREQMSR_IRC);
+ freqRef = Chip_Clock_GetIntOscRate();
+
+ /* Start RTC oscillator frequency measurement and display results */
+ measureDisplay("RTC32K oscillator (IRC reference)", FREQMSR_32KHZOSC, freqRef);
+
+ /* Start watchdog oscillator frequency measurement and display results */
+ measureDisplay("Watchdog oscillator (IRC reference)", FREQMSR_WDOSC, freqRef);
+
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_freqmeas/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_freqmeas/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_freqmeas/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_gpio/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_gpio/.cproject
new file mode 100644
index 0000000..ed4e92c
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_gpio/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1865839359">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1865839359" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1865839359" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1865839359." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.696925262" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1683948085" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_gpio}/Debug" id="com.crt.advproject.builder.exe.debug.1858660044" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.293677897" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1364584413" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.2041915359" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.161913846" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.777615919" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1913732501" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.13237590" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.783210884" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1920729354" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.1516772348" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1329595327" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.65740886" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.529139111" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.981972209" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1899678837" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1052069595" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1279600341" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.393871685" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.337341582" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1395107948" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1548244573" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_gpio_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.672686673" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.996489625" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1889351011" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1842693158" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1664516255" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1195770159" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1720360973" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.772534043">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.772534043" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.772534043" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.772534043." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.1321945579" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1613242315" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_gpio}/Release" id="com.crt.advproject.builder.exe.release.1205573335" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.879474472" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.1406893229" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.1035007313" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.873453896" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.818223422" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1245376775" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.2046487960" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1545509595" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1516352212" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.499754756" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.53581405" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.2142830837" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1434039242" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1234370830" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1645468252" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.2012229217" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.624015823" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1242884959" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.922407901" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1619330890" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1599749535" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_gpio_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.2004390643" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.778121725" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1393314259" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.883550200" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.359047480" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1280933035" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.607629365" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_gpio.com.crt.advproject.projecttype.exe.1012868197" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_gpio/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_gpio/.project
new file mode 100644
index 0000000..3bebd0b
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_gpio/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_gpio</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_gpio/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_gpio/example/readme.dox
new file mode 100644
index 0000000..bcc1f1f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_gpio/example/readme.dox
@@ -0,0 +1,55 @@
+/*
+ * @brief General Purpose Input/Output example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_GPIO LPC15xx General Purpose Input/Output example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * The General Purpose Input/Output example demonstrates how to use the GPIO functions
+ * for multiple GPIO pin functions at once. The example will operate on multiple GPIO
+ * pins at once usnig the GPIO direction setup and masked write oeprations.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_gpio/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_gpio/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_gpio/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_gpio/example/src/gpio.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_gpio/example/src/gpio.c
new file mode 100644
index 0000000..c904ee4
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_gpio/example/src/gpio.c
@@ -0,0 +1,109 @@
+/*
+ * @brief General Purpose Input/Output example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* Number of tickrate per second */
+#define TICKRATE_HZ (10)
+
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+/* LPCXpresso LPC1549 board has LEDs on P0_0, P0_1, and P0_24. We'll toggle them
+ all at once. */
+#define PORT_MASK ((1 << 0) | (1 << 1) | (1 << 24))
+
+#else
+#error "No PORT_MASK defined"
+#endif /* defined(BOARD_NXP_LPCXPRESSO_1549) */
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle interrupt from SysTick timer
+ * @return Nothing
+ */
+void SysTick_Handler(void)
+{
+ uint32_t states;
+
+ /* Get current masked port states */
+ states = Chip_GPIO_GetMaskedPortValue(LPC_GPIO, 0);
+
+ /* Toggle all the states */
+ states = ~states;
+
+ /* Write states back via masked set function. Only the enanled
+ (masked states) will be changed. */
+ Chip_GPIO_SetMaskedPortValue(LPC_GPIO, 0, states);
+}
+
+/**
+ * @brief Main program body
+ * @return Does not return
+ */
+int main(void) {
+
+ /* Generic Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ /* Chip_GPIO_Init(LPC_GPIO) is called as part of Board_Init() */
+
+ /* Set port 0 pins to the output direction */
+ Chip_GPIO_SetPortDIROutput(LPC_GPIO, 0, PORT_MASK);
+
+ /* Set GPIO port mask value to make sure only port 0
+ selected pins are activated during writes */
+ Chip_GPIO_SetPortMask(LPC_GPIO, 0, ~PORT_MASK);
+
+ /* Enable SysTick Timer */
+ SysTick_Config(SystemCoreClock / TICKRATE_HZ);
+
+ /* All work happens in the systick interrupt handler */
+ while (1) {
+ __WFI();
+ }
+
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_gpio/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_gpio/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_gpio/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_grouped_int/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_grouped_int/.cproject
new file mode 100644
index 0000000..9873070
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_grouped_int/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.782881814">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.782881814" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.782881814" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.782881814." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.1664102755" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1175686655" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_grouped_int}/Debug" id="com.crt.advproject.builder.exe.debug.717783213" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.517194871" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1293317908" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.1551365317" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1546916659" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.902558204" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1286046487" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.743990698" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.91672045" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.848325117" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.930733656" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.293166171" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.432719749" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1540213353" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1383988673" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1726322209" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1661908696" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.342772614" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1746210631" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1600894978" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1675323534" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.145923966" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_grouped_int_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.666634608" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.717113477" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1527085103" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1209755321" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1242564409" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1718093197" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1370519567" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.122605759">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.122605759" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.122605759" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.122605759." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.2112527844" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1063101015" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_grouped_int}/Release" id="com.crt.advproject.builder.exe.release.971975756" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.267808243" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.1155100620" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.2089359591" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.2145604293" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1458589283" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1498898394" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.2088891743" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1703866795" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.779798174" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.611598155" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1158124081" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1286750010" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1097401" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.882212774" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1101572451" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1334735562" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.2081153210" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.820436375" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.905114685" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1832580313" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1894763411" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_grouped_int_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1248115980" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1772313445" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.932763425" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.458546190" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1342692645" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.2051537389" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.162640073" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_grouped_int.com.crt.advproject.projecttype.exe.657047025" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_grouped_int/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_grouped_int/.project
new file mode 100644
index 0000000..e2e36b2
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_grouped_int/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_grouped_int</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_grouped_int/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_grouped_int/example/readme.dox
new file mode 100644
index 0000000..23acdd6
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_grouped_int/example/readme.dox
@@ -0,0 +1,58 @@
+/*
+ * @brief Grouped GPIO Interrupt example
+ * This example shows how to use Grouped GPIO interrupt.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_GROUPED_INT LPC15xx Grouped GPIO Interrupt example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * The Grouped GPIO interrupt example demonstrates the Grouped GPIO interrupt feature.<br>
+ *
+ * This example configures Grouped GPIO interrupt 0 to be invoked when a button is
+ * pressed by the user. The interrupt toggles the state of an LED.
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_grouped_int/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_grouped_int/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_grouped_int/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_grouped_int/example/src/grouped_int.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_grouped_int/example/src/grouped_int.c
new file mode 100644
index 0000000..f4df9b0
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_grouped_int/example/src/grouped_int.c
@@ -0,0 +1,104 @@
+/*
+ * @brief Grouped GPIO Interrupt example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+
+/* GPIO pin for GROUPED GPIO interrupt. This is SW1-WAKE button switch input. */
+#define TEST_BUTTON_PIN 17 /* GPIO pin number mapped to PININT */
+#define TEST_BUTTON_PORT 0 /* GPIO port number mapped to PININT */
+
+#else
+#error "Grouped GPIO Interrupt not configured for this example"
+#endif /* defined(BOARD_NXP_LPCXPRESSO_1549) */
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle Group GPIO 0 interrupt
+ * @return Nothing
+ */
+void GINT0_IRQHandler(void)
+{
+ Chip_GPIOGP_ClearIntStatus(LPC_GPIOGROUP, 0);
+ Board_LED_Toggle(0);
+}
+
+/**
+ * @brief Main program body
+ * @return Does not return
+ */
+int main(void)
+{
+ /* Generic Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+ Board_LED_Set(0, false);
+
+ /* Initialize GPIO grouped interrupts */
+ Chip_GPIOGP_Init(LPC_GPIOGROUP);
+
+ /* Set pin back to GPIO (on some boards may have been changed to something
+ else by Board_Init()) */
+ Chip_IOCON_PinMuxSet(LPC_IOCON, TEST_BUTTON_PORT, TEST_BUTTON_PIN,
+ (IOCON_DIGMODE_EN | IOCON_MODE_INACT) );
+
+ /* Group GPIO interrupt 0 will be invoked when the button is pressed. */
+ Chip_GPIO_SetPinDIRInput(LPC_GPIO, TEST_BUTTON_PORT, TEST_BUTTON_PIN);
+ Chip_GPIOGP_SelectLowLevel(LPC_GPIOGROUP, 0, TEST_BUTTON_PORT, 1 << TEST_BUTTON_PIN);
+ Chip_GPIOGP_EnableGroupPins(LPC_GPIOGROUP, 0, TEST_BUTTON_PORT, 1 << TEST_BUTTON_PIN);
+ Chip_GPIOGP_SelectAndMode(LPC_GPIOGROUP, 0);
+ Chip_GPIOGP_SelectEdgeMode(LPC_GPIOGROUP, 0);
+
+ /* Enable Group GPIO interrupt 0 */
+ NVIC_EnableIRQ(GINT0_IRQn);
+
+ /* Spin in a loop here. All the work is done in ISR. */
+ while (1) {}
+
+ /* Does not return */
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_grouped_int/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_grouped_int/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_grouped_int/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt/.cproject
new file mode 100644
index 0000000..e11d7d4
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1178801823">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1178801823" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1178801823" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1178801823." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.1766118290" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.191646041" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_i2c_rom_interrupt}/Debug" id="com.crt.advproject.builder.exe.debug.1683456084" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1602465314" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.320033761" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.244367705" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.729154970" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1528370589" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1405842550" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.515166957" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.372186450" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.144092969" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.853947611" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1375365165" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1905539619" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.2016822651" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1228891738" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1656519446" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1289906416" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.491495704" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1012939739" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1122923309" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.322631260" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1413392532" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_i2c_rom_interrupt_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.2090199258" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.187186421" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.222171017" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1045872735" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.336533791" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.754459825" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.852122941" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.455371265">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.455371265" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.455371265" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.455371265." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.618029587" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.808969984" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_i2c_rom_interrupt}/Release" id="com.crt.advproject.builder.exe.release.2128654842" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.819390788" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.654822519" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.90340477" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.876085959" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.949441882" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.177152792" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.2073777311" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1577336589" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1865730284" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1089504364" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1516990777" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1767738130" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.310184542" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1266358192" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.298805726" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.701747332" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.1298544712" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1337889735" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1075591595" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.986563971" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.557981380" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_i2c_rom_interrupt_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.338336131" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.399406125" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.150027476" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1277680849" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1101298032" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1946407733" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1634451935" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_i2c_rom_interrupt.com.crt.advproject.projecttype.exe.236285627" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt/.project
new file mode 100644
index 0000000..001f339
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_i2c_rom_interrupt</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt/example/readme.dox
new file mode 100644
index 0000000..8e874c3
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt/example/readme.dox
@@ -0,0 +1,63 @@
+/*
+ * @brief I2C bus master example using the ROM API and interrupt mode
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_I2CINT LPC15xx I2C bus master (interrupt) example using the ROM API
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * This example shows how to configure I2C as a bus master in interrupt mode using
+ * the ROM-based APIs.<br>
+ *
+ * This demo supports both 7-bit and 10-bit addressing, but only 7-bit addressing is
+ * used in the example. After I2C is setup, the I2C master receive and transmit
+ * functions are called through the built-in ROM routines.
+ *
+ * For the LPCXpresso Motor Control Board rev B, this example reads the LM75A temperature sensor on the
+ * base board. Using the debugger or an I2C analyzer, the temperature reading process is visible.
+ * The temperature data is also outputted through the Debug UART port.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt/example/src/periph_i2c_rom_interrupt.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt/example/src/periph_i2c_rom_interrupt.c
new file mode 100644
index 0000000..96d9a18
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt/example/src/periph_i2c_rom_interrupt.c
@@ -0,0 +1,285 @@
+/*
+ * @brief I2C bus master example using the ROM API in interrupt mode
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* I2C master handle and memory for ROM API */
+static I2C_HANDLE_T *i2cHandleMaster;
+
+/* Use a buffer size larger than the expected return value of
+ i2c_get_mem_size() for the static I2C handle type */
+static uint32_t i2cMasterHandleMEM[0x20];
+
+#define SPEED_100KHZ (100000)
+#define I2C_RD_CMD_BIT (0x01)
+/* Standard I2C mode */
+#define I2C_MODE (0)
+
+/* 7-bit I2C addresses */
+#define I2C_ADDR_7BIT (0x90) /* This is the 7-bit address shifted up 1-bit (orig 0x48) */
+
+/* SysTick rate in Hz */
+#define TICKRATE_HZ (10)
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/* Interrupt error code (used as semaphore) */
+static volatile int intErrCode;
+
+/* Current state for I2C control */
+static volatile int state;
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Initializes pin muxing for I2C interface - note that SystemInit() may
+ already setup your pin muxing at system startup */
+static void Init_I2C_PinMux(void)
+{
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 22, IOCON_DIGMODE_EN | I2C_MODE);
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 23, IOCON_DIGMODE_EN | I2C_MODE);
+ Chip_SWM_EnableFixedPin(SWM_FIXED_I2C0_SCL);
+ Chip_SWM_EnableFixedPin(SWM_FIXED_I2C0_SDA);
+#else
+#error "No I2C Pin Muxing defined for this example"
+#endif
+}
+
+/* Turn on LED to indicate an error */
+static void errorI2C(void)
+{
+ Board_LED_Set(0, true);
+ while (1) {}
+}
+
+/* Setup I2C handle and parameters */
+static void setupI2CMaster()
+{
+ /* Enable I2C clock and reset I2C peripheral - the boot ROM does not
+ do this */
+ Chip_I2C_Init(LPC_I2C0);
+
+ /* Perform a sanity check on the storage allocation */
+ if (LPC_I2CD_API->i2c_get_mem_size() > sizeof(i2cMasterHandleMEM)) {
+ /* Example only: this should never happen and probably isn't needed for
+ most I2C code. */
+ errorI2C();
+ }
+
+ /* Setup the I2C handle */
+ i2cHandleMaster = LPC_I2CD_API->i2c_setup(LPC_I2C_BASE, i2cMasterHandleMEM);
+ if (i2cHandleMaster == NULL) {
+ errorI2C();
+ }
+
+ /* Set I2C bitrate */
+ if (LPC_I2CD_API->i2c_set_bitrate(i2cHandleMaster, Chip_Clock_GetSystemClockRate(),
+ SPEED_100KHZ) != LPC_OK) {
+ errorI2C();
+ }
+}
+
+/* I2C interrupt callback, called on completion of I2C operation when in
+ interrupt mode. Called in interrupt context. */
+static void cbI2CComplete(uint32_t err_code, uint32_t n)
+{
+ intErrCode = (int) err_code;
+}
+
+/* Master receive in interrupt mode */
+static void readI2CMaster(uint16_t AddressI2C, uint8_t *readPtr, bool address10Bit)
+{
+ uint8_t recvData[10];
+ I2C_PARAM_T param;
+ I2C_RESULT_T result;
+ ErrorCode_t error_code;
+ uint8_t rx_index = 0;
+ uint8_t txData[3];
+ uint8_t tx_index = 0;
+
+ /* Setup I2C receive for address/read, read desired LED state, then stop */
+ if (address10Bit) {
+ /* 10-bit addressing - 4 MSBs of slave address in first byte of
+ transmit buffer */
+ recvData[rx_index++] = (uint8_t) (((AddressI2C >> 7) & 0x06) | 0xF0);
+ recvData[rx_index++] = (uint8_t) (AddressI2C & 0x0FF);
+
+ txData[tx_index++] = (uint8_t) (((AddressI2C >> 7) & 0x06) | 0xF0);
+ txData[tx_index++] = (uint8_t) (AddressI2C & 0x0FF);
+ }
+ else {
+ /* 7-bit address */
+ recvData[rx_index++] = (uint8_t) AddressI2C;
+ txData[tx_index++] = (uint8_t) AddressI2C;
+ }
+
+ /* Setup I2C parameters for number of bytes with stop - appears as follows on bus:
+ Start - address7 or address10upper - ack
+ (10 bits addressing only) address10lower - ack
+ value 1 (read) - ack
+ value 2 read) - ack - stop */
+ txData[tx_index++] = 0;
+ param.num_bytes_send = tx_index;
+ param.num_bytes_rec = rx_index + 2;
+ param.buffer_ptr_send = &txData[0];
+ param.buffer_ptr_rec = &recvData[0];
+ param.stop_flag = 1;
+ param.func_pt = cbI2CComplete;
+
+ /* Set timeout (much) greater than the transfer length */
+ LPC_I2CD_API->i2c_set_timeout(i2cHandleMaster, 100000);
+
+ /* Do master read transfer */
+ intErrCode = -1;
+
+ /* Function is non-blocking, returned error should be LPC_OK, but isn't checked here */
+ error_code = LPC_I2CD_API->i2c_master_tx_rx_intr(i2cHandleMaster, ¶m, &result);
+
+ /* Sleep until transfer is complete, but allow IRQ to wake system
+ to handle I2C IRQ */
+ while (intErrCode == -1) {
+ __WFI();
+ }
+
+ /* Cast saved error code from callback */
+ error_code = (ErrorCode_t) intErrCode;
+
+ /* Completed without erors? */
+ if (error_code != LPC_OK) {
+ /* Likely cause is NAK */
+ DEBUGOUT("i2c_master_receive error code : %x\r\b", error_code);
+ errorI2C();
+ }
+
+ /* Note results are only valid when there are no errors */
+ *readPtr++ = recvData[1];
+ *readPtr++ = recvData[2];
+}
+
+static void ReadTemperatureI2C(void)
+{
+ int8_t readState_Input[2];
+
+ /* Read temperature */
+ readI2CMaster(I2C_ADDR_7BIT | I2C_RD_CMD_BIT, (uint8_t *) readState_Input, false);
+
+ /* Output temperature. */
+ DEBUGOUT("Temperature read over I2C is %d Celsius\r\n",
+ (((int16_t) readState_Input[0] << 3) | ((uint8_t) readState_Input[1] >> 5)) / 8);
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle I2C0 interrupt by calling I2C ROM handler
+ * @return Nothing
+ */
+void I2C0_IRQHandler(void)
+{
+ /* Call I2C ISR function in ROM with the I2C handle */
+ LPC_I2CD_API->i2c_isr_handler(i2cHandleMaster);
+}
+
+/**
+ * @brief Handle interrupt from SysTick timer
+ * @return Nothing
+ */
+void SysTick_Handler(void)
+{
+ static int ticks = 0;
+
+ ticks++;
+ if (ticks > TICKRATE_HZ) {
+ ticks = 0;
+ state = 1 - state;
+ }
+}
+
+/**
+ * @brief Main routine for I2C example
+ * @return Function should not exit
+ */
+int main(void)
+{
+ int lastState = 0;
+ state = 0;
+
+ /* Generic Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ /* Clear activity LED */
+ Board_LED_Set(0, false);
+
+ /* Setup I2C pin muxing */
+ Init_I2C_PinMux();
+
+ /* Allocate I2C handle, setup I2C rate, and initialize I2C
+ clocking */
+ setupI2CMaster();
+
+ /* Enable the interrupt for the I2C */
+ NVIC_EnableIRQ(I2C0_IRQn);
+
+ /* Enable SysTick Timer */
+ SysTick_Config(SystemCoreClock / TICKRATE_HZ);
+
+ /* Loop forever, toggle LED on other board via I2C */
+ while (1) {
+
+ /* Sleep until a state change occurs in SysTick */
+ while (lastState == state) {
+ __WFI();
+ }
+
+ /* Read current temperature from LM75A part over I2C */
+ ReadTemperatureI2C();
+
+ /* Reset lastState to allow for WFI */
+ lastState = state;
+
+ /* Toggle LED to show activity. */
+ Board_LED_Toggle(0);
+ }
+
+ /* Code never reaches here. Only used to satisfy standard main() */
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt_slave/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt_slave/.cproject
new file mode 100644
index 0000000..e502ab7
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt_slave/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.216320475">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.216320475" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.216320475" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.216320475." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.272014206" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.385090193" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_i2c_rom_interrupt_slave}/Debug" id="com.crt.advproject.builder.exe.debug.1240322984" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.721121294" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.428970774" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.336427866" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1665817168" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.797477737" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.657895546" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.145148950" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.645229122" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1908829519" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.1311757709" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1863893386" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.855314868" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.870626896" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.212111939" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.325732708" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1194756403" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1511019026" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.650299695" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1511618244" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.872331702" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1976862890" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_i2c_rom_interrupt_slave_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.518329290" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1936467245" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.2140226738" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1175146217" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.534394199" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1228919859" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1250189120" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.2047059460">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.2047059460" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.2047059460" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.2047059460." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.99942200" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.718314195" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_i2c_rom_interrupt_slave}/Release" id="com.crt.advproject.builder.exe.release.898643490" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.1277022081" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.292307942" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.538140739" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.452610313" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1403497427" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.506940866" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.919144598" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.423487875" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.153420106" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1028299856" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1687200571" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.954806393" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.585419406" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.361809084" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1843808026" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.769493267" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.62752164" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1620515703" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.594136447" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1594531955" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.232255812" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_i2c_rom_interrupt_slave_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.916015732" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1181439288" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.256923423" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1646485464" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.569567667" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.573782536" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.265707086" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_i2c_rom_interrupt_slave.com.crt.advproject.projecttype.exe.240462600" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt_slave/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt_slave/.project
new file mode 100644
index 0000000..b77f62f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt_slave/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_i2c_rom_interrupt_slave</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt_slave/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt_slave/example/readme.dox
new file mode 100644
index 0000000..abc5704
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt_slave/example/readme.dox
@@ -0,0 +1,67 @@
+/*
+ * @brief I2C bus slave example using the ROM API via interrupts
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_I2CSLAVEINT LPC15xx I2C bus slave (interrupt) example using the ROM API
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * This example shows how to configure I2C as a bus slave in interrupt mode using
+ * the ROM-based APIs.<br>
+ *
+ * This demo supports both 7-bit and 10-bit addressing, but only 7-bit addressing is
+ * used in the example. After I2C is setup, the I2C receive and transmit functions
+ * are called through the built-in ROM routines.<br>
+ *
+ * If this demo is running correctly and is correctly connected to a master that
+ * supports this example, the LED will toggle. Because of the connection
+ * requirements, this example is best used as a reference on how to use the ROM
+ * API I2C slave functions.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * IMOPRTANT NOTE:<br>
+ * This example requires a connection via I2C to a I2C master. The I2C master writes a byte
+ * to the slave which controls the slave's LED state (0 or 1). The master can also read the
+ * slave's LED state (0 or 1).<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt_slave/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt_slave/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt_slave/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt_slave/example/src/periph_i2c_rom_interrupt_slave.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt_slave/example/src/periph_i2c_rom_interrupt_slave.c
new file mode 100644
index 0000000..214692a
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt_slave/example/src/periph_i2c_rom_interrupt_slave.c
@@ -0,0 +1,273 @@
+/*
+ * @brief I2C bus slave interrupt example using the ROM API
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* I2C master handle and memory for ROM API */
+static I2C_HANDLE_T *i2cHandleSlave;
+
+/* Use a buffer size larger than the expected return value of
+ i2c_get_mem_size() for the static I2C handle type */
+static uint32_t i2cSlaveHandleMEM[0x20];
+
+/** I2C addresses - in slave mode, only 7-bit addressing is supported */
+/* NOTE: Since I2C uses the most-significant 7-bits of each byte-lane
+ this address represents device 0x22. */
+#define I2C_ADDR_7BIT (0x00000048)
+
+/** I2C mask - in slave mode, only 7-bit addressing is supported */
+/* NOTE: This mask will only allow device 0x22. */
+#define I2C_ADDR_7BIT_MASK (0x00000000)
+
+/* Standard I2C mode */
+#define I2C_MODE (0)
+
+/* Saved callback error codes */
+static volatile int RXintErrCode, TXintErrCode;
+
+/* Receive and transmit buffers */
+static uint8_t recvBuff[16], tranBuff[16];
+
+/* Global I2C ROM API parameter and results structures */
+static I2C_PARAM_T paramRX, paramTX;
+static I2C_RESULT_T resultRX, resultTX;
+
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Initializes pin muxing for I2C interface - note that SystemInit() may
+ already setup your pin muxing at system startup */
+static void Init_I2C_PinMux(void)
+{
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 22, IOCON_DIGMODE_EN | I2C_MODE);
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 23, IOCON_DIGMODE_EN | I2C_MODE);
+ Chip_SWM_EnableFixedPin(SWM_FIXED_I2C0_SCL);
+ Chip_SWM_EnableFixedPin(SWM_FIXED_I2C0_SDA);
+#else
+#error "No I2C Pin Muxing defined for this example"
+#endif
+}
+
+/* Turn on LED to indicate an error */
+static void errorI2C(void)
+{
+ Board_LED_Set(0, true);
+ while (1) {}
+}
+
+/* Setup I2C handle and parameters */
+static void setupI2CSlave()
+{
+ ErrorCode_t error_code;
+
+ /* Enable I2C clock and reset I2C peripheral - the boot ROM does not
+ do this */
+ Chip_I2C_Init(LPC_I2C0);
+
+ /* Perform a sanity check on the storage allocation */
+ if (LPC_I2CD_API->i2c_get_mem_size() > sizeof(i2cSlaveHandleMEM)) {
+ /* Example only: this should never happen and probably isn't needed for
+ most I2C code. */
+ errorI2C();
+ }
+
+ /* Setup the I2C handle */
+ i2cHandleSlave = LPC_I2CD_API->i2c_setup(LPC_I2C_BASE, i2cSlaveHandleMEM);
+ if (i2cHandleSlave == NULL) {
+ errorI2C();
+ }
+
+ /* Set a single 7-bit I2C address, only 7-bit addressing is supported,
+ but the ROM API expects the address byte value */
+ error_code = LPC_I2CD_API->i2c_set_slave_addr(i2cHandleSlave,
+ I2C_ADDR_7BIT << 1, I2C_ADDR_7BIT_MASK);
+ if (error_code != LPC_OK) {
+ DEBUGOUT("Error setting I2C slave address\r\n");
+ errorI2C();
+ }
+
+ /* No need to set I2C clock rate in slave mode */
+}
+
+/* I2C interrupt transmit callback, called on completion of I2C 'send'
+ operation when in interrupt mode. Called in interrupt context. */
+static void cbTXI2CComplete(uint32_t err_code, uint32_t n)
+{
+ TXintErrCode = (int) err_code;
+}
+
+/* Slave transmit in interrupt mode */
+static void sendI2CSlave(void)
+{
+ ErrorCode_t error_code;
+
+ /* Send 1 byte based on master request */
+ paramTX.num_bytes_send = 1;
+ paramTX.buffer_ptr_send = &tranBuff[0];
+ paramTX.func_pt = cbTXI2CComplete;
+
+ /* Clear global error code */
+ TXintErrCode = -1;
+
+ /* Interrupt function is non-blocking */
+ error_code = LPC_I2CD_API->i2c_slave_transmit_intr(i2cHandleSlave, ¶mTX, &resultTX);
+
+ /* Completed without erors? */
+ if (error_code != LPC_OK) {
+ DEBUGOUT("i2c_slave_transmit_intr error code : %x\r\b", error_code);
+ errorI2C();
+ }
+}
+
+/* I2C interrupt receive callback, called on completion of I2C 'read'
+ operation when in interrupt mode. Called in interrupt context. */
+static void cbRXI2CComplete(uint32_t err_code, uint32_t n)
+{
+ RXintErrCode = (int) err_code;
+}
+
+/* Slave receive in interrupt mode */
+static void readI2CSlave(void)
+{
+ ErrorCode_t error_code;
+
+ /* Setup receive buffer, receive buffer size, and receive callback */
+ paramRX.num_bytes_rec = 2; /* Address and single byte */
+ paramRX.buffer_ptr_rec = &recvBuff[0];
+ paramRX.func_pt = cbRXI2CComplete;
+
+ /* Clear error code */
+ RXintErrCode = -1;
+
+ /* Function is non-blocking */
+ error_code = LPC_I2CD_API->i2c_slave_receive_intr(i2cHandleSlave, ¶mRX, &resultRX);
+
+ /* Completed without erors? */
+ if (error_code != LPC_OK) {
+ DEBUGOUT("i2c_slave_receive_intr error code : %x\r\b", error_code);
+ errorI2C();
+ }
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief I2C interrupt handler
+ * @return Nothing
+ */
+void I2C0_IRQHandler(void)
+{
+ static bool ledState = false;
+
+ /* Call I2C ISR function in ROM with the I2C handle */
+ LPC_I2CD_API->i2c_isr_handler(i2cHandleSlave);
+
+ /* Has a receive operation been completed? */
+ if (RXintErrCode != -1) {
+ if (RXintErrCode == LPC_OK) {
+ ledState = (bool) recvBuff[1];
+ Board_LED_Set(0, ledState);
+ }
+
+ /* Toggle LED state on next master read */
+ tranBuff[0] = 1 - recvBuff[1];
+
+ /* Setup transmit processing */
+ sendI2CSlave();
+ RXintErrCode = -1;
+ }
+
+ /* Has a transmit operation been completed? */
+ if (TXintErrCode != -1) {
+ if (TXintErrCode == LPC_OK) {
+ /* Do something here if need. This example doesn't need
+ to do anything here */
+ /* Number of bytes sent = resultTX.n_bytes_sent; */
+ }
+
+ /* Setup receive processing */
+ readI2CSlave();
+ TXintErrCode = -1;
+ }
+}
+
+/**
+ * @brief Main routine for I2C example
+ * @return Function should not exit
+ */
+int main(void)
+{
+ /* Generic Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ /* Set initial LED state to off */
+ Board_LED_Set(0, false);
+
+ /* Setup I2C at the board level (usually pin muxing) */
+ Init_I2C_PinMux();
+
+ /* Allocate I2C handle, setup I2C rate, and initialize I2C
+ clocking */
+ setupI2CSlave();
+
+ /* Enable the interrupt for the I2C */
+ NVIC_EnableIRQ(I2C0_IRQn);
+
+ /* Setup I2C receive slave mode - this will setup a
+ non-blocking I2C mode which will be handled via the I2C interrupt */
+ readI2CSlave(); /* Wait for message from master first */
+
+ /* I2C slave handler loop - wait for requests from master and
+ receive or send data in response */
+ while (1) {
+ /* Sleep while waiting for I2C master requests */
+ __WFI();
+
+ /* All I2C slave processing is performed in the I2C IRQ
+ handler, so there is nothing to really do here */
+ }
+
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt_slave/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt_slave/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_interrupt_slave/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling/.cproject
new file mode 100644
index 0000000..a1e8a89
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.519323198">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.519323198" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.519323198" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.519323198." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.1262821928" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.31243680" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_i2c_rom_polling}/Debug" id="com.crt.advproject.builder.exe.debug.1651551148" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1740990612" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1085701686" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.1869608277" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1611613181" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.2105842360" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1773648623" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1894384484" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1213453446" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1651734717" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.204943642" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.263063334" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.669613156" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1496242355" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1501463567" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1104165858" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.900172229" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.5342817" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.985093083" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.927946258" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.708493902" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1788164274" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_i2c_rom_polling_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1163304281" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.580122787" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1352177134" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1534980299" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1653976517" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.909355014" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.265380483" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.725766793">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.725766793" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.725766793" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.725766793." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.2060904981" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1695856751" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_i2c_rom_polling}/Release" id="com.crt.advproject.builder.exe.release.836428866" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.616401131" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.473397411" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.1960930562" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1734079296" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1319174830" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1012424471" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1304896160" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1930842896" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.2030909439" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.591342420" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1512284440" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.2111656723" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.565603532" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.955266692" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1569974949" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.495927460" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.57225494" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.575178524" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1298424872" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1489868078" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.2054801031" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_i2c_rom_polling_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.983293139" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.44436416" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.652598219" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1768816312" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.12922890" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1788725725" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.642715626" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_i2c_rom_polling.com.crt.advproject.projecttype.exe.529010131" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling/.project
new file mode 100644
index 0000000..aa9efc5
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_i2c_rom_polling</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling/example/readme.dox
new file mode 100644
index 0000000..794523c
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling/example/readme.dox
@@ -0,0 +1,63 @@
+/*
+ * @brief I2C bus master example using the ROM API via polling
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_I2CPOLL LPC15xx I2C bus master (polling) example using the ROM API
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * This example shows how to configure I2C as a bus master in polling mode using
+ * the ROM-based APIs.<br>
+ *
+ * This demo supports both 7-bit and 10-bit addressing, but only 7-bit addressing is
+ * used in the example. After I2C is setup, the I2C master receive and transmit
+ * functions are called through the built-in ROM routines.
+ *
+ * For the LPCXpresso Motor Control Board rev B, this example reads the LM75A temperature sensor on the
+ * base board. Using the debugger or an I2C analyzer, the temperature reading process is visible.
+ * The temperature data is also outputted through the Debug UART port.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling/example/src/periph_i2c_rom_polling.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling/example/src/periph_i2c_rom_polling.c
new file mode 100644
index 0000000..4fe5ffd
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling/example/src/periph_i2c_rom_polling.c
@@ -0,0 +1,249 @@
+/*
+ * @brief I2C bus master example using the ROM API in polling mode
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* I2C master handle and memory for ROM API */
+static I2C_HANDLE_T *i2cHandleMaster;
+
+/* Use a buffer size larger than the expected return value of
+ i2c_get_mem_size() for the static I2C handle type */
+static uint32_t i2cMasterHandleMEM[0x20];
+
+#define SPEED_100KHZ (100000)
+#define I2C_RD_CMD_BIT (0x01)
+/* Standard I2C mode */
+#define I2C_MODE (0)
+
+/* 7-bit I2C addresses */
+#define I2C_ADDR_7BIT (0x90) /* This is the 7-bit address shifted up 1-bit (orig 0x48) */
+
+/* SysTick rate in Hz */
+#define TICKRATE_HZ (10)
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/* Current state for LED control via I2C cases */
+static volatile int state;
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Initializes pin muxing for I2C interface - note that SystemInit() may
+ already setup your pin muxing at system startup */
+static void Init_I2C_PinMux(void)
+{
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 22, IOCON_DIGMODE_EN | I2C_MODE);
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 23, IOCON_DIGMODE_EN | I2C_MODE);
+ Chip_SWM_EnableFixedPin(SWM_FIXED_I2C0_SCL);
+ Chip_SWM_EnableFixedPin(SWM_FIXED_I2C0_SDA);
+#else
+#error "No I2C Pin Muxing defined for this example"
+#endif
+}
+
+/* Turn on LED to indicate an error */
+static void errorI2C(void)
+{
+ Board_LED_Set(0, true);
+ while (1) {}
+}
+
+/* Setup I2C handle and parameters */
+static void setupI2CMaster()
+{
+ /* Enable I2C clock and reset I2C peripheral - the boot ROM does not
+ do this */
+ Chip_I2C_Init(LPC_I2C0);
+
+ /* Perform a sanity check on the storage allocation */
+ if (LPC_I2CD_API->i2c_get_mem_size() > sizeof(i2cMasterHandleMEM)) {
+ /* Example only: this should never happen and probably isn't needed for
+ most I2C code. */
+ errorI2C();
+ }
+
+ /* Setup the I2C handle */
+ i2cHandleMaster = LPC_I2CD_API->i2c_setup(LPC_I2C_BASE, i2cMasterHandleMEM);
+ if (i2cHandleMaster == NULL) {
+ errorI2C();
+ }
+
+ /* Set I2C bitrate */
+ if (LPC_I2CD_API->i2c_set_bitrate(i2cHandleMaster, Chip_Clock_GetSystemClockRate(),
+ SPEED_100KHZ) != LPC_OK) {
+ errorI2C();
+ }
+}
+
+/* Master receive in interrupt mode */
+static void readI2CMaster(uint16_t AddressI2C, uint8_t *readPtr, bool address10Bit)
+{
+ uint8_t recvData[10];
+ I2C_PARAM_T param;
+ I2C_RESULT_T result;
+ ErrorCode_t error_code;
+ uint8_t rx_index = 0;
+ uint8_t txData[3];
+ uint8_t tx_index = 0;
+
+ /* Setup I2C receive for address/read, read desired LED state, then stop */
+ if (address10Bit) {
+ /* 10-bit addressing - 4 MSBs of slave address in first byte of
+ transmit buffer */
+ recvData[rx_index++] = (uint8_t) (((AddressI2C >> 7) & 0x06) | 0xF0);
+ recvData[rx_index++] = (uint8_t) (AddressI2C & 0x0FF);
+
+ txData[tx_index++] = (uint8_t) (((AddressI2C >> 7) & 0x06) | 0xF0);
+ txData[tx_index++] = (uint8_t) (AddressI2C & 0x0FF);
+ }
+ else {
+ /* 7-bit address */
+ recvData[rx_index++] = (uint8_t) AddressI2C;
+ txData[tx_index++] = (uint8_t) AddressI2C;
+ }
+
+ /* Setup I2C parameters for number of bytes with stop - appears as follows on bus:
+ Start - address7 or address10upper - ack
+ (10 bits addressing only) address10lower - ack
+ value 1 (read) - ack
+ value 2 read) - ack - stop */
+ txData[tx_index++] = 0;
+ param.num_bytes_send = tx_index;
+ param.num_bytes_rec = rx_index + 2;
+ param.buffer_ptr_send = &txData[0];
+ param.buffer_ptr_rec = &recvData[0];
+ param.stop_flag = 1;
+
+ /* Set timeout (much) greater than the transfer length */
+ LPC_I2CD_API->i2c_set_timeout(i2cHandleMaster, 100000);
+
+ /* Function is non-blocking, returned error should be LPC_OK, but isn't checked here */
+ error_code = LPC_I2CD_API->i2c_master_tx_rx_poll(i2cHandleMaster, ¶m, &result);
+
+ /* Completed without erors? */
+ if (error_code != LPC_OK) {
+ /* Likely cause is NAK */
+ DEBUGOUT("i2c_master_receive error code : %x\r\b", error_code);
+ errorI2C();
+ }
+
+ /* Note results are only valid when there are no errors */
+ *readPtr++ = recvData[1];
+ *readPtr++ = recvData[2];
+}
+
+/* Read current temperature from LM75A part over I2C */
+static void ReadTemperatureI2C(void)
+{
+ int8_t readState_Input[2];
+
+ /* Read temperature */
+ readI2CMaster(I2C_ADDR_7BIT | I2C_RD_CMD_BIT, (uint8_t *) readState_Input, false);
+ /* Output temperature. */
+ DEBUGOUT("Temperature read over I2C is %d Celsius\r\n",
+ (((int16_t) readState_Input[0] << 3) | ((uint8_t) readState_Input[1] >> 5)) / 8);
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle interrupt from SysTick timer
+ * @return Nothing
+ */
+void SysTick_Handler(void)
+{
+ static int ticks = 0;
+
+ ticks++;
+ if (ticks > TICKRATE_HZ) {
+ ticks = 0;
+ state = 1 - state;
+ }
+}
+
+/**
+ * @brief Main routine for I2C example
+ * @return Function should not exit
+ */
+int main(void)
+{
+ int lastState = 0;
+ state = 0;
+
+ /* Generic Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ /* Clear activity LED */
+ Board_LED_Set(0, false);
+
+ /* Setup I2C pin muxing */
+ Init_I2C_PinMux();
+
+ /* Allocate I2C handle, setup I2C rate, and initialize I2C
+ clocking */
+ setupI2CMaster();
+
+ /* Enable SysTick Timer */
+ SysTick_Config(SystemCoreClock / TICKRATE_HZ);
+
+ /* Loop forever, toggle LED on other board via I2C */
+ while (1) {
+
+ /* Sleep until a state change occurs in SysTick */
+ while (lastState == state) {
+ __WFI();
+ }
+
+ /* Read current temperature from LM75A part over I2C */
+ ReadTemperatureI2C();
+
+ /* Reset lastState to allow for WFI */
+ lastState = state;
+
+ /* Toggle LED to show activity. */
+ Board_LED_Toggle(0);
+ }
+
+ /* Code never reaches here. Only used to satisfy standard main() */
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling_slave/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling_slave/.cproject
new file mode 100644
index 0000000..ede6df1
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling_slave/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.145726666">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.145726666" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.145726666" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.145726666." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.1672900465" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.305952496" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_i2c_rom_polling_slave}/Debug" id="com.crt.advproject.builder.exe.debug.600489287" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1277900015" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1395340952" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.1835041670" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1732434157" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.477981536" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.944337982" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.2004897474" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.2137916689" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1503492088" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.282272778" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.129639181" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.787082284" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.627018226" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.2020183123" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1982213280" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.13336532" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1956653692" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1222790821" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1075543403" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1129427386" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.560054474" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_i2c_rom_polling_slave_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.700859752" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1376569900" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.815045403" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1528615875" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.172602473" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1703166728" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1818918863" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.143548771">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.143548771" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.143548771" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.143548771." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.1816661630" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.372833605" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_i2c_rom_polling_slave}/Release" id="com.crt.advproject.builder.exe.release.2119081845" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.764697667" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.1114244917" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.2078081386" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.889553371" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.931629764" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1234535737" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1154526191" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1330827699" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1122912797" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.34342714" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.512899975" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.866716460" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.5667723" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.687886750" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.567227679" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1656118542" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.2018810779" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.162431759" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.750523825" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.220657124" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1717708003" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_i2c_rom_polling_slave_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.681918718" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1025914625" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1353145182" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.241842975" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.2129383350" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1657891992" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1147154054" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_i2c_rom_polling_slave.com.crt.advproject.projecttype.exe.1055938327" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling_slave/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling_slave/.project
new file mode 100644
index 0000000..a8597ae
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling_slave/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_i2c_rom_polling_slave</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling_slave/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling_slave/example/readme.dox
new file mode 100644
index 0000000..91cb5da
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling_slave/example/readme.dox
@@ -0,0 +1,67 @@
+/*
+ * @brief I2C bus slave example using the ROM API in polling mode
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_I2CSLAVEPOLL LPC15xx I2C bus slave (polling) example using the ROM API
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * This example shows how to configure I2C as a bus slave in polling mode using
+ * the ROM-based APIs.<br>
+ *
+ * This demo supports both 7-bit and 10-bit addressing, but only 7-bit addressing is
+ * used in the example. After I2C is setup, the I2C receive and transmit functions
+ * are called through the built-in ROM routines.<br>
+ *
+ * If this demo is running correctly and is correctly connected to a master that
+ * supports this example, the LED will toggle. Because of the connection
+ * requirements, this example is best used as a reference on how to use the ROM
+ * API I2C slave functions.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * IMOPRTANT NOTE:<br>
+ * This example requires a connection via I2C to a I2C master. The I2C master writes a byte
+ * to the slave which controls the slave's LED state (0 or 1). The master can also read the
+ * slave's LED state (0 or 1).<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling_slave/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling_slave/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling_slave/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling_slave/example/src/periph_i2c_rom_polling_slave.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling_slave/example/src/periph_i2c_rom_polling_slave.c
new file mode 100644
index 0000000..8293469
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling_slave/example/src/periph_i2c_rom_polling_slave.c
@@ -0,0 +1,207 @@
+/*
+ * @brief I2C bus slave polling example using the ROM API
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* I2C master handle and memory for ROM API */
+static I2C_HANDLE_T *i2cHandleSlave;
+
+/* Use a buffer size larger than the expected return value of
+ i2c_get_mem_size() for the static I2C handle type */
+static uint32_t i2cSlaveHandleMEM[0x20];
+
+/* Since I2C uses the most-significant 7-bits of each byte-lane
+ this address represents device 0x22. 4 addresses are supported. */
+#define I2C_ADDR_7BIT (0x00000048)
+
+/* This mask will only allow device 0x22. */
+#define I2C_ADDR_7BIT_MASK (0x00000000)
+
+/* Standard I2C mode */
+#define I2C_MODE (0)
+
+/* Receive and transmit buffers */
+static uint8_t recvBuff[16], tranBuff[16];
+
+/* Global I2C ROM API parameter and results structures */
+static I2C_PARAM_T paramRX, paramTX;
+static I2C_RESULT_T resultRX, resultTX;
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Initializes pin muxing for I2C interface - note that SystemInit() may
+ already setup your pin muxing at system startup */
+static void Init_I2C_PinMux(void)
+{
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 22, IOCON_DIGMODE_EN | I2C_MODE);
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 23, IOCON_DIGMODE_EN | I2C_MODE);
+ Chip_SWM_EnableFixedPin(SWM_FIXED_I2C0_SCL);
+ Chip_SWM_EnableFixedPin(SWM_FIXED_I2C0_SDA);
+#else
+#error "No I2C Pin Muxing defined for this example"
+#endif
+}
+
+/* Turn on LED to indicate an error */
+static void errorI2C()
+{
+ Board_LED_Set(0, true);
+ while (1) {}
+}
+
+/* Setup I2C handle and parameters */
+static void setupI2CSlave()
+{
+ ErrorCode_t error_code;
+
+ /* Enable I2C clock and reset I2C peripheral - the boot ROM does not
+ do this */
+ Chip_I2C_Init(LPC_I2C0);
+
+ /* Perform a sanity check on the storage allocation */
+ if (LPC_I2CD_API->i2c_get_mem_size() > sizeof(i2cSlaveHandleMEM)) {
+ /* Example only: this should never happen and probably isn't needed for
+ most I2C code. */
+ errorI2C();
+ }
+
+ /* Setup the I2C handle */
+ i2cHandleSlave = LPC_I2CD_API->i2c_setup(LPC_I2C_BASE, i2cSlaveHandleMEM);
+ if (i2cHandleSlave == NULL) {
+ errorI2C();
+ }
+
+ /* Set a single 7-bit I2C address, only 7-bit addressing is supported,
+ but the ROM API expects the address byte value */
+ error_code = LPC_I2CD_API->i2c_set_slave_addr(i2cHandleSlave,
+ I2C_ADDR_7BIT << 1, I2C_ADDR_7BIT_MASK);
+ if (error_code != LPC_OK) {
+ DEBUGOUT("Error setting I2C slave address\r\n");
+ errorI2C();
+ }
+
+ /* No need to set I2C clock rate in slave mode */
+}
+
+/* Slave transmit in polling mode */
+static void sendI2CSlave(void)
+{
+ ErrorCode_t error_code;
+
+ /* Send 1 byte based on master request */
+ paramTX.num_bytes_send = 1;
+ paramTX.buffer_ptr_send = &tranBuff[0];
+
+ /* Polling function is blocking */
+ error_code = LPC_I2CD_API->i2c_slave_transmit_poll(i2cHandleSlave, ¶mTX, &resultTX);
+
+ /* Completed without erors? */
+ if (error_code != LPC_OK) {
+ DEBUGOUT("i2c_slave_transmit_poll error code : %x\r\b", error_code);
+ errorI2C();
+ }
+}
+
+/* Slave receive in polling mode */
+static void readI2CSlave(void)
+{
+ ErrorCode_t error_code;
+ bool ledState;
+
+ /* Setup receive buffer, receive buffer size, and receive callback */
+ paramRX.num_bytes_rec = 2; /* Address and single byte */
+ paramRX.buffer_ptr_rec = &recvBuff[0];
+
+ /* Function is blocking */
+ error_code = LPC_I2CD_API->i2c_slave_receive_poll(i2cHandleSlave, ¶mRX, &resultRX);
+
+ /* Completed without erors? */
+ if (error_code != LPC_OK) {
+ DEBUGOUT("i2c_slave_receive_poll error code : %x\r\b", error_code);
+ }
+ else {
+ /* Setup LED on/off state */
+ ledState = (bool) recvBuff[1];
+
+ /* Turn LED on = 1 or off = 0 */
+ Board_LED_Set(0, ledState);
+
+ /* Toggle LED state on next master read */
+ tranBuff[0] = 1 - recvBuff[1];
+ /* Transmit toggled LED state */
+ sendI2CSlave();
+ }
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Main routine for I2C example
+ * @return Function should not exit
+ */
+int main(void)
+{
+ /* Generic Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ /* Set initial LED state to off */
+ Board_LED_Set(0, false);
+
+ /* Setup I2C at the board level (usually pin muxing) */
+ Init_I2C_PinMux();
+
+ /* Allocate I2C handle, setup I2C rate, and initialize I2C
+ clocking */
+ setupI2CSlave();
+
+ /* I2C slave handler loop - loop forever waiting for requests from
+ master to receive or send data */
+ while (1) {
+ /* Poll until the next read/write operation */
+ readI2CSlave();
+ }
+
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling_slave/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling_slave/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2c_rom_polling_slave/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_interrupt/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_interrupt/.cproject
new file mode 100644
index 0000000..a45f198
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_interrupt/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1346307549">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1346307549" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1346307549" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1346307549." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.750487304" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.750775096" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_i2cm_interrupt}/Debug" id="com.crt.advproject.builder.exe.debug.1397776548" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.851551601" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.609201111" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.1039019318" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.502995001" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1976151320" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.485415679" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1424996084" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1146393806" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1261513656" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.1546899949" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.129936298" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.2121273934" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1658607191" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1029887400" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.328270734" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1163614239" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.2011751815" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.833115057" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1790506113" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.680183716" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.836770132" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_i2cm_interrupt_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.769510063" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.51787431" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.140513110" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1847764150" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.366639864" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1486078584" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1140508102" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.1998593863">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.1998593863" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.1998593863" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.1998593863." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.432163491" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.956941995" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_i2cm_interrupt}/Release" id="com.crt.advproject.builder.exe.release.1945282072" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.1660242553" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.504878112" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.299046607" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1208337535" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.837980661" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1115875822" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1885224029" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.544306210" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.258093656" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.602191418" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.333044916" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1496913422" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.58160030" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1468001423" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1235815839" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.47583079" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.131865123" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.142367667" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1181353598" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.672398963" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1450286789" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_i2cm_interrupt_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.713594964" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1358027799" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.2146950236" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1871485261" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.187496539" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.362012473" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1027853673" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_i2cm_interrupt.com.crt.advproject.projecttype.exe.1617305512" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_interrupt/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_interrupt/.project
new file mode 100644
index 0000000..27f22e4
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_interrupt/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_i2cm_interrupt</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_interrupt/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_interrupt/example/readme.dox
new file mode 100644
index 0000000..b45df23
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_interrupt/example/readme.dox
@@ -0,0 +1,61 @@
+/*
+ * @brief I2CM bus master example using interrupt mode
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_I2CMINT LPC15xx I2CM bus master example using interrupts
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * This example shows how to configure I2C as a bus master in interrupt mode using
+ * the I2CM driver.<br>
+ *
+ * This example uses 7-bit addressing to periodically read temperature data from a temperature
+ * sensor on the Motor Control board. After I2C is setup, the I2CM master receive and transmit
+ * functions are called through the i2cm_15xx driver routines. The temperature data is outputted
+ * through the Debug UART port.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * The Motor Control board is required with the LPCXpresso board to use this
+ * example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_interrupt/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_interrupt/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_interrupt/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_interrupt/example/src/periph_i2cm_interrupt.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_interrupt/example/src/periph_i2cm_interrupt.c
new file mode 100644
index 0000000..98cfabb
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_interrupt/example/src/periph_i2cm_interrupt.c
@@ -0,0 +1,248 @@
+/*
+ * @brief I2CM bus master example using interrupt mode
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* I2CM transfer record */
+static I2CM_XFER_T i2cmXferRec;
+/* I2C clock is set to 1.8MHz */
+#define I2C_CLK_DIVIDER (40)
+/* 100KHz I2C bit-rate */
+#define I2C_BITRATE (100000)
+/* Standard I2C mode */
+#define I2C_MODE (0)
+
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+/** 7-bit I2C addresses of Temperature Sensor */
+#define I2C_ADDR_7BIT (0x48)
+
+#endif
+
+/* SysTick rate in Hz */
+#define TICKRATE_HZ (10)
+
+/* Current state for LED control via I2C cases */
+static volatile int state;
+
+static volatile int intErrCode;
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Initializes pin muxing for I2C interface - note that SystemInit() may
+ already setup your pin muxing at system startup */
+static void Init_I2C_PinMux(void)
+{
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 22, IOCON_DIGMODE_EN | I2C_MODE);
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 23, IOCON_DIGMODE_EN | I2C_MODE);
+ Chip_SWM_EnableFixedPin(SWM_FIXED_I2C0_SCL);
+ Chip_SWM_EnableFixedPin(SWM_FIXED_I2C0_SDA);
+#else
+#error "No I2C Pin Muxing defined for this example"
+#endif
+}
+
+/* Setup I2C handle and parameters */
+static void setupI2CMaster()
+{
+ /* Enable I2C clock and reset I2C peripheral - the boot ROM does not
+ do this */
+ Chip_I2C_Init(LPC_I2C0);
+
+ /* Setup clock rate for I2C */
+ Chip_I2C_SetClockDiv(LPC_I2C0, I2C_CLK_DIVIDER);
+
+ /* Setup I2CM transfer rate */
+ Chip_I2CM_SetBusSpeed(LPC_I2C0, I2C_BITRATE);
+
+ /* Enable Master Mode */
+ Chip_I2CM_Enable(LPC_I2C0);
+}
+
+/* Function to wait for I2CM transfer completion */
+static void WaitForI2cXferComplete(I2CM_XFER_T *xferRecPtr)
+{
+ /* Test for still transferring data */
+ while (xferRecPtr->status == I2CM_STATUS_BUSY) {
+ /* Sleep until next interrupt */
+ __WFI();
+ }
+}
+
+/* Function to setup and execute I2C transfer request */
+static void SetupXferRecAndExecute(uint8_t devAddr,
+ uint8_t *txBuffPtr,
+ uint16_t txSize,
+ uint8_t *rxBuffPtr,
+ uint16_t rxSize)
+{
+ /* Setup I2C transfer record */
+ i2cmXferRec.slaveAddr = devAddr;
+ i2cmXferRec.status = 0;
+ i2cmXferRec.txSz = txSize;
+ i2cmXferRec.rxSz = rxSize;
+ i2cmXferRec.txBuff = txBuffPtr;
+ i2cmXferRec.rxBuff = rxBuffPtr;
+
+ Chip_I2CM_Xfer(LPC_I2C0, &i2cmXferRec);
+ /* Enable Master Interrupts */
+ Chip_I2C_EnableInt(LPC_I2C0, I2C_INTENSET_MSTPENDING | I2C_INTENSET_MSTRARBLOSS | I2C_INTENSET_MSTSTSTPERR);
+ /* Wait for transfer completion */
+ WaitForI2cXferComplete(&i2cmXferRec);
+ /* Clear all Interrupts */
+ Chip_I2C_ClearInt(LPC_I2C0, I2C_INTENSET_MSTPENDING | I2C_INTENSET_MSTRARBLOSS | I2C_INTENSET_MSTSTSTPERR);
+}
+
+/* Master I2CM receive in interrupt mode */
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+static void readI2CMaster(uint16_t AddressI2C, uint8_t *readPtr)
+{
+ uint8_t rx_buffer[3];
+ uint8_t tx_buffer[3];
+
+ /* Update with temperature address register */
+ tx_buffer[0] = 0x00;
+ /* Read LM75 temerature sensor */
+ SetupXferRecAndExecute(AddressI2C, tx_buffer, 1, rx_buffer, 2);
+
+ /* Test for valid operation */
+ if (i2cmXferRec.status == I2CM_STATUS_OK) {
+ /* Note results are only valid when there are no errors */
+ *readPtr++ = rx_buffer[0];
+ *readPtr++ = rx_buffer[1];
+ }
+}
+
+/* Function to read I2C temperature sensor and output result */
+static void ReadTemperatureI2CM(void)
+{
+ int8_t readState_Input[2] = {0, 0};
+
+ /* Read temperature */
+ readI2CMaster(I2C_ADDR_7BIT, (uint8_t *) readState_Input);
+
+ /* Output temperature. */
+ DEBUGOUT("Temperature read over I2C is %d Celsius\r\n",
+ (((int16_t) readState_Input[0] << 3) | ((uint8_t) readState_Input[1] >> 5)) / 8);
+}
+
+#endif
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle I2C0 interrupt by calling I2CM interrupt transfer handler
+ * @return Nothing
+ */
+void I2C0_IRQHandler(void)
+{
+ /* Call I2CM ISR function with the I2C device and transfer rec */
+ Chip_I2CM_XferHandler(LPC_I2C0, &i2cmXferRec);
+}
+
+/**
+ * @brief Handle interrupt from SysTick timer
+ * @return Nothing
+ */
+void SysTick_Handler(void)
+{
+ static int ticks = 0;
+
+ ticks++;
+ if (ticks > TICKRATE_HZ) {
+ ticks = 0;
+ state = 1 - state;
+ }
+}
+
+/**
+ * @brief Main routine for I2C example
+ * @return Function should not exit
+ */
+int main(void)
+{
+ int lastState = 0;
+ state = 0;
+ /* Generic Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ /* Clear activity LED */
+ Board_LED_Set(0, false);
+
+ /* Setup I2C pin muxing */
+ Init_I2C_PinMux();
+
+ /* Allocate I2C handle, setup I2C rate, and initialize I2C
+ clocking */
+ setupI2CMaster();
+
+ /* Enable the interrupt for the I2C */
+ NVIC_EnableIRQ(I2C0_IRQn);
+
+ /* Enable SysTick Timer */
+ SysTick_Config(SystemCoreClock / TICKRATE_HZ);
+
+ /* Loop forever, toggle LED on board */
+ while (1) {
+
+ /* Sleep until a state change occurs in SysTick */
+ while (lastState == state) {
+ __WFI();
+ }
+
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+ /* Read Motor Control board's I2C temperature sensor and output result */
+ ReadTemperatureI2CM();
+#endif
+
+ /* Reset lastState to allow for WFI */
+ lastState = state;
+
+ /* Toggle LED to show activity. */
+ Board_LED_Toggle(0);
+ }
+
+ /* Code never reaches here. Only used to satisfy standard main() */
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_interrupt/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_interrupt/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_interrupt/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_polling/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_polling/.cproject
new file mode 100644
index 0000000..c9ddc0c
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_polling/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.756645020">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.756645020" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.756645020" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.756645020." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.401972193" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1067803485" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_i2cm_polling}/Debug" id="com.crt.advproject.builder.exe.debug.179349580" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1447384726" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.2033125740" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.2011111643" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.317645053" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.530996434" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1705166468" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1041273223" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.738557772" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1249529232" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.1718780617" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.321318374" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.825466030" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1400580200" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1388347871" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.947526155" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.423382350" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.481601077" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.479754002" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.2050798558" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.585529680" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.79729939" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_i2cm_polling_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.33460686" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1302913677" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.350551335" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.2091407492" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.640044617" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.947421544" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1808752028" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.368178373">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.368178373" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.368178373" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.368178373." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.409080581" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.808011983" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_i2cm_polling}/Release" id="com.crt.advproject.builder.exe.release.152424985" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.1945745372" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.1250720674" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.865925820" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1977690049" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.19011252" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.24266581" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1791655438" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.2098101740" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1386158138" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1336328741" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1788629214" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1538088335" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1786926702" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.2087115182" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1180268764" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.2105920123" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.467777102" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.513818853" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1141507732" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1043586800" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1401348970" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_i2cm_polling_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.974803778" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1432459293" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.186126965" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.733205496" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1041183244" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.2006783929" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.2002349" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_i2cm_polling.com.crt.advproject.projecttype.exe.274031679" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_polling/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_polling/.project
new file mode 100644
index 0000000..a3f7577
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_polling/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_i2cm_polling</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_polling/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_polling/example/readme.dox
new file mode 100644
index 0000000..18e6f09
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_polling/example/readme.dox
@@ -0,0 +1,61 @@
+/*
+ * @brief I2CM bus master example using polling mode
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_I2CMPOLL LPC15xx I2CM bus master example using polling
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * This example shows how to configure I2C as a bus master in polling mode using
+ * the I2CM driver.<br>
+ *
+ * This example uses 7-bit addressing to periodically read temperature data from a temperature
+ * sensor on the Motor Control board. After I2C is setup, the I2CM master receive and transmit
+ * functions are called through the i2cm_15xx driver routines. The temperature data is outputted
+ * through the Debug UART port.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * The Motor Control board is required with the LPCXpresso board to use this
+ * example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_polling/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_polling/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_polling/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_polling/example/src/periph_i2cm_polling.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_polling/example/src/periph_i2cm_polling.c
new file mode 100644
index 0000000..e027a44
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_polling/example/src/periph_i2cm_polling.c
@@ -0,0 +1,220 @@
+/*
+ * @brief I2CM bus master example using polling mode
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* I2CM transfer record */
+static I2CM_XFER_T i2cmXferRec;
+/* I2C clock is set to 1.8MHz */
+#define I2C_CLK_DIVIDER (40)
+/* 100KHz I2C bit-rate */
+#define I2C_BITRATE (100000)
+/* Standard I2C mode */
+#define I2C_MODE (0)
+
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+/** 7-bit I2C addresses of Temperature Sensor */
+#define I2C_ADDR_7BIT (0x48)
+
+#endif
+
+/* SysTick rate in Hz */
+#define TICKRATE_HZ (10)
+
+/* Current state for LED control via I2C cases */
+static volatile int state;
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Initializes pin muxing for I2C interface - note that SystemInit() may
+ already setup your pin muxing at system startup */
+static void Init_I2C_PinMux(void)
+{
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 22, IOCON_DIGMODE_EN | I2C_MODE);
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 23, IOCON_DIGMODE_EN | I2C_MODE);
+ Chip_SWM_EnableFixedPin(SWM_FIXED_I2C0_SCL);
+ Chip_SWM_EnableFixedPin(SWM_FIXED_I2C0_SDA);
+#else
+#error "No I2C Pin Muxing defined for this example"
+#endif
+}
+
+/* Setup I2C handle and parameters */
+static void setupI2CMaster()
+{
+ /* Enable I2C clock and reset I2C peripheral - the boot ROM does not
+ do this */
+ Chip_I2C_Init(LPC_I2C0);
+
+ /* Setup clock rate for I2C */
+ Chip_I2C_SetClockDiv(LPC_I2C0, I2C_CLK_DIVIDER);
+
+ /* Setup I2CM transfer rate */
+ Chip_I2CM_SetBusSpeed(LPC_I2C0, I2C_BITRATE);
+
+ /* Enable Master Mode */
+ Chip_I2CM_Enable(LPC_I2C0);
+}
+
+static void SetupXferRecAndExecute(uint8_t devAddr,
+ uint8_t *txBuffPtr,
+ uint16_t txSize,
+ uint8_t *rxBuffPtr,
+ uint16_t rxSize)
+{
+ /* Setup I2C transfer record */
+ i2cmXferRec.slaveAddr = devAddr;
+ i2cmXferRec.status = 0;
+ i2cmXferRec.txSz = txSize;
+ i2cmXferRec.rxSz = rxSize;
+ i2cmXferRec.txBuff = txBuffPtr;
+ i2cmXferRec.rxBuff = rxBuffPtr;
+
+ Chip_I2CM_XferBlocking(LPC_I2C0, &i2cmXferRec);
+}
+
+/* Master I2CM receive in polling mode */
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+static void readI2CMaster(uint16_t AddressI2C, uint8_t *readPtr)
+{
+ uint8_t rx_buffer[3];
+ uint8_t tx_buffer[3];
+
+ /* Update with temperature address register */
+ tx_buffer[0] = 0x00;
+ /* Read LM75 temerature sensor */
+ SetupXferRecAndExecute(AddressI2C, tx_buffer, 1, rx_buffer, 2);
+
+ /* Test for valid operation */
+ if (i2cmXferRec.status == I2CM_STATUS_OK) {
+ /* Note results are only valid when there are no errors */
+ *readPtr++ = rx_buffer[0];
+ *readPtr++ = rx_buffer[1];
+ }
+}
+
+/* Function to read I2C temperature sensor and output result */
+static void ReadTemperatureI2CM(void)
+{
+ int8_t readState_Input[2] = {0, 0};
+
+ /* Read temperature */
+ readI2CMaster(I2C_ADDR_7BIT, (uint8_t *) readState_Input);
+
+ /* Output temperature. */
+ DEBUGOUT("Temperature read over I2C is %d Celsius\r\n",
+ (((int16_t) readState_Input[0] << 3) | ((uint8_t) readState_Input[1] >> 5)) / 8);
+}
+
+#endif
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle interrupt from SysTick timer
+ * @return Nothing
+ */
+void SysTick_Handler(void)
+{
+ static int ticks = 0;
+
+ ticks++;
+ if (ticks > TICKRATE_HZ) {
+ ticks = 0;
+ state = 1 - state;
+ }
+}
+
+/**
+ * @brief Main routine for I2CM example
+ * @return Function should not exit
+ */
+int main(void)
+{
+ int lastState = 0;
+ state = 0;
+
+ /* Generic Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ /* Clear activity LED */
+ Board_LED_Set(0, false);
+
+ /* Setup I2C pin muxing */
+ Init_I2C_PinMux();
+
+ /* Allocate I2C handle, setup I2C rate, and initialize I2C
+ clocking */
+ setupI2CMaster();
+
+ /* Disable the interrupt for the I2C */
+ NVIC_DisableIRQ(I2C0_IRQn);
+
+ /* Enable SysTick Timer */
+ SysTick_Config(SystemCoreClock / TICKRATE_HZ);
+
+ /* Loop forever, toggle LED on board */
+ while (1) {
+
+ /* Sleep until a state change occurs in SysTick */
+ while (lastState == state) {
+ __WFI();
+ }
+
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+ /* Read Motor Control board's I2C temperature sensor and output result */
+ ReadTemperatureI2CM();
+#endif
+
+ /* Reset lastState to allow for WFI */
+ lastState = state;
+
+ /* Toggle LED to show activity. */
+ Board_LED_Toggle(0);
+ }
+
+ /* Code never reaches here. Only used to satisfy standard main() */
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_polling/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_polling/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cm_polling/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cs_interrupt/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cs_interrupt/.cproject
new file mode 100644
index 0000000..5593d09
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cs_interrupt/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.299095860">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.299095860" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.299095860" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.299095860." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.349496353" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1469687995" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_i2cs_interrupt}/Debug" id="com.crt.advproject.builder.exe.debug.783175459" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1669027105" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.955400414" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.329790218" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1652557724" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.719968816" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.78559681" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.406556180" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.330841023" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.206959161" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.616193685" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.390724547" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.773473057" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.472806306" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.989810893" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1354410655" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.36755315" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1855530408" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.89927639" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1558563313" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.403588317" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.208714057" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_i2cs_interrupt_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.653439029" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.222395070" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1892249866" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.211088167" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1213154938" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.699570216" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1351023616" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.1851775466">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.1851775466" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.1851775466" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.1851775466." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.2035846155" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1257178123" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_i2cs_interrupt}/Release" id="com.crt.advproject.builder.exe.release.1960557167" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.2135722489" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.495227133" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.661419301" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.586205026" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.319035152" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1601332787" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.421329593" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1872942207" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1009807872" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.252665835" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.2106620303" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1585709534" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1932920787" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.673510997" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.89519527" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.905724109" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.249045561" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.2110833586" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.420584391" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.627132878" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.146262373" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_i2cs_interrupt_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.962431653" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.2135442181" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.982380304" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.510449309" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.361714173" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.186476761" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1132131763" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_i2cs_interrupt.com.crt.advproject.projecttype.exe.288911806" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cs_interrupt/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cs_interrupt/.project
new file mode 100644
index 0000000..10f5286
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cs_interrupt/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_i2cs_interrupt</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cs_interrupt/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cs_interrupt/example/readme.dox
new file mode 100644
index 0000000..07b7548
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cs_interrupt/example/readme.dox
@@ -0,0 +1,79 @@
+/*
+ * @brief I2CS bus slave example using interrupt mode
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_I2CSINT LPC15xx I2CS bus slave example using interrupts
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * This example shows how to configure I2C as a bus slave in interrupt mode using
+ * the I2CS driver.<br>
+ *
+ * This example provides 2 simple (emulated) EEPROMs at different I2C slave
+ * addresses. Both are on the same I2C bus, but the slave controller will be
+ * configured to support 2 slave addresses on the single bus. The emulated
+ * EEPROMs have their memory locations set and read via I2C write and read
+ * operations. Operations can be as little as a byte or continuous until the
+ * master terminates the transfer. The following operations are supported:<br>
+ * - <START> <ADDR><W> Write 16-bit address <STOP><br>
+ * - <START> <ADDR><W> Write 16-bit address <REPEAT START><R> READ READ ... READ <STOP> (unbound read)<br>
+ * - <START> <ADDR><W> Write 16-bit address WRITE WRITE ... WRITE <STOP> (unbound write)<br>
+ * - <START> <ADDR><R> READ READ ... READ <STOP> (unbound read)<br>
+ * Note: Slave address is 0x28.<br>
+ *
+ * Unbound read oeprations have no limit on size and will go as long as the master
+ * requests or sends data. If the end of emulated EEPROM is reached, the EEPROM address
+ * will wrap. All reads and write operations auto-increment. Read operations without a
+ * 16-bit address will use the last incremented address.<br>
+ *
+ * The I2C slave processing is handled entirely in the I2C slave interrupt handler.
+ * This example doesn't use the Chip_I2CS_Xfer() function and implements the slave
+ * support inside the I2C interrupt handler in real-time.<br>
+ *
+ * The example also provides the master interface on the same I2C bus as the slave
+ * to communicate the the emulated EEPROMs without requiring an external I2C master.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * No special requirements are needed for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cs_interrupt/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cs_interrupt/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cs_interrupt/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cs_interrupt/example/src/periph_i2cs_interrupt.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cs_interrupt/example/src/periph_i2cs_interrupt.c
new file mode 100644
index 0000000..e5372ea
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cs_interrupt/example/src/periph_i2cs_interrupt.c
@@ -0,0 +1,450 @@
+/*
+ * @brief I2CM bus slave example using interrupt mode
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* I2CS transfer record for master and slave operations */
+static I2CM_XFER_T i2cmXferRec;
+
+/* I2C clock is set to 1.8MHz */
+#define I2C_CLK_DIVIDER (40)
+
+/* 100KHz I2C bit-rate - going too fast may prevent the salev from responding
+ in time */
+#define I2C_BITRATE (100000)
+/* Standard I2C mode */
+#define I2C_MODE (0)
+
+/* Emulated EEPROM slave addresses */
+#define EEPROM0SLVADD (0x28)
+#define EEPROM1SLVADD (0x2C)
+
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+/** Our slave address and I2C information */
+#define LPC_I2C_PORT LPC_I2C0
+#define LPC_I2C_INTHAND I2C0_IRQHandler
+#define LPC_IRQNUM I2C0_IRQn
+#endif
+
+/* Emulated EEPROM device2 - size, buffer, and current address */
+#define EMUEEPROMSIZE 512
+static uint8_t eepromData[2][EMUEEPROMSIZE];
+static uint16_t eepromAddr[2];
+static int curEEPROM, addrbytes;
+
+/* work buffers for this example */
+uint8_t txWorkBuff[EMUEEPROMSIZE], rxWorkBuff[EMUEEPROMSIZE];
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Initializes pin muxing for I2C interface - note that SystemInit() may
+ already setup your pin muxing at system startup */
+static void Init_I2C_PinMux(void)
+{
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 22, IOCON_DIGMODE_EN | I2C_MODE);
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 23, IOCON_DIGMODE_EN | I2C_MODE);
+ Chip_SWM_EnableFixedPin(SWM_FIXED_I2C0_SCL);
+ Chip_SWM_EnableFixedPin(SWM_FIXED_I2C0_SDA);
+#else
+ /* Configure your own I2C pin muxing here if needed */
+#error "No I2C Pin Muxing defined for this example"
+#endif
+}
+
+/* Setup I2C */
+static void setupI2CMaster(void)
+{
+ /* Enable I2C clock and reset I2C peripheral */
+ Chip_I2C_Init(LPC_I2C_PORT);
+
+ /* Setup clock rate for I2C */
+ Chip_I2C_SetClockDiv(LPC_I2C_PORT, I2C_CLK_DIVIDER);
+
+ /* Setup I2CM transfer rate */
+ Chip_I2CM_SetBusSpeed(LPC_I2C_PORT, I2C_BITRATE);
+
+ /* Enable I2C master interface */
+ Chip_I2CM_Enable(LPC_I2C_PORT);
+}
+
+/* Setup I2C */
+static void setupI2CSlave(void)
+{
+ /* Some common I2C init was performed in setupI2CMaster(), so it doesn't
+ need to be done again for the slave setup. */
+
+ /* Emulated EEPROM 0 is on slave index 0 */
+ Chip_I2CS_SetSlaveAddr(LPC_I2C_PORT, 0, EEPROM0SLVADD);
+ /* Disable Qualifier for Slave Address 0 */
+ Chip_I2CS_SetSlaveQual0(LPC_I2C_PORT, false, 0);
+ /* Enable Slave Address 0 */
+ Chip_I2CS_EnableSlaveAddr(LPC_I2C_PORT, 0);
+
+ /* Emulated EEPROM 1 is on slave index 1 */
+ Chip_I2CS_SetSlaveAddr(LPC_I2C_PORT, 1, EEPROM1SLVADD);
+ /* Enable Slave Address 1 */
+ Chip_I2CS_EnableSlaveAddr(LPC_I2C_PORT, 1);
+
+ /* Clear interrupt status and enable slave interrupts */
+ Chip_I2CS_ClearStatus(LPC_I2C_PORT, I2C_STAT_SLVDESEL);
+ Chip_I2C_EnableInt(LPC_I2C_PORT, I2C_INTENSET_SLVPENDING | I2C_INTENSET_SLVDESEL);
+
+ /* Enable I2C slave interface */
+ Chip_I2CS_Enable(LPC_I2C_PORT);
+}
+
+/* Setup emulated EEPROM */
+static void setupEmuEEPROM(void)
+{
+ eepromAddr[0] = 0;
+ eepromAddr[1] = 0;
+}
+
+/* Set emulated EEPROM address */
+static void setEmuEEPROMAddr(int eepromNum, uint16_t addr)
+{
+ eepromAddr[eepromNum] = (addr & (EMUEEPROMSIZE - 1));
+}
+
+/* Increment emulated EEPROM address */
+static void incEmuEEPROMAddr(int eepromNum)
+{
+ eepromAddr[eepromNum]++;
+ if (eepromAddr[eepromNum] >= EMUEEPROMSIZE) {
+ eepromAddr[eepromNum] = 0;
+ }
+}
+
+/* Read a byte from the emulated EEPROM and incrmenet address */
+static uint8_t readEmuEEPROM(int eepromNum)
+{
+ uint8_t data = eepromData[eepromNum][eepromAddr[eepromNum]];
+
+ incEmuEEPROMAddr(eepromNum);
+
+ return data;
+}
+
+/* Write a byte to the emulated EEPROM and incrmenet address */
+static void writeEmuEEPROM(int eepromNum, uint8_t data)
+{
+ eepromData[eepromNum][eepromAddr[eepromNum]] = data;
+
+ incEmuEEPROMAddr(eepromNum);
+}
+
+/* Function to wait for I2CM transfer completion */
+static void WaitForI2cXferComplete(I2CM_XFER_T *xferRecPtr)
+{
+ /* Test for still transferring data */
+ while (xferRecPtr->status == I2CM_STATUS_BUSY) {
+ /* Sleep until next interrupt */
+ __WFI();
+ }
+}
+
+/* Function to setup and execute I2C transfer request */
+static void SetupXferRecAndExecute(uint8_t devAddr,
+ uint8_t *txBuffPtr,
+ uint16_t txSize,
+ uint8_t *rxBuffPtr,
+ uint16_t rxSize)
+{
+ /* Setup I2C transfer record */
+ i2cmXferRec.slaveAddr = devAddr;
+ i2cmXferRec.status = 0;
+ i2cmXferRec.txSz = txSize;
+ i2cmXferRec.rxSz = rxSize;
+ i2cmXferRec.txBuff = txBuffPtr;
+ i2cmXferRec.rxBuff = rxBuffPtr;
+
+ /* Wait for master to go pending - needed in mixed master/slave mode on single I2C bus */
+ while (Chip_I2CM_IsMasterPending(LPC_I2C_PORT) == false) {}
+
+ Chip_I2CM_Xfer(LPC_I2C_PORT, &i2cmXferRec);
+ /* Enable Master Interrupts */
+ Chip_I2C_EnableInt(LPC_I2C_PORT, I2C_INTENSET_MSTPENDING | I2C_INTENSET_MSTRARBLOSS | I2C_INTENSET_MSTSTSTPERR);
+ /* Wait for transfer completion */
+ WaitForI2cXferComplete(&i2cmXferRec);
+ /* Disable all Interrupts */
+ Chip_I2C_DisableInt(LPC_I2C_PORT, I2C_INTENSET_MSTPENDING | I2C_INTENSET_MSTRARBLOSS | I2C_INTENSET_MSTSTSTPERR);
+
+ if (i2cmXferRec.status != I2CM_STATUS_OK) {
+ DEBUGOUT("\r\nI2C error: %d\r\n", i2cmXferRec.status);
+ }
+}
+
+/* Handler for slave start callback */
+static void processSlaveTransferStart(uint8_t addr)
+{
+ if (addr == EEPROM0SLVADD) {
+ curEEPROM = 0;
+ }
+ else {
+ curEEPROM = 1;
+ }
+
+ addrbytes = 0;
+}
+
+/* Handler for slave send callback */
+static uint8_t processSlaveTransferSend(uint8_t *data)
+{
+ /* Send data from emulated EEPROM */
+ *data = readEmuEEPROM(curEEPROM);
+
+ return 0;
+}
+
+/* Handler for slave receive callback */
+static uint8_t processSlaveTransferRecv(uint8_t data)
+{
+ static uint16_t addr;
+
+ if (addrbytes == 0) {
+ /* Address MSB bytes is in */
+ addr = ((uint16_t) data) << 8;
+ }
+ else if (addrbytes == 1) {
+ /* Address LSB bytes is in */
+ addr |= (uint16_t) data;
+
+ /* Set emulated EEPROM address */
+ setEmuEEPROMAddr(curEEPROM, addr);
+ }
+ else {
+ /* Write data to emulated EEPROM */
+ writeEmuEEPROM(curEEPROM, data);
+ }
+ addrbytes++;
+
+ return 0;
+}
+
+/* Handler for slave transfer complete callback */
+static void processSlaveTransferDone(void)
+{
+ /* Nothing needs to be done here */
+}
+
+/* I2C slavecallback function list */
+const static I2CS_XFER_T i2csCallBacks = {
+ &processSlaveTransferStart,
+ &processSlaveTransferSend,
+ &processSlaveTransferRecv,
+ &processSlaveTransferDone
+};
+
+/* Populate EEPROM with some initial data */
+static void fillWorkBuff(uint8_t *buff, uint8_t seed)
+{
+ int i;
+
+ for (i = 0; i < EMUEEPROMSIZE; i++) {
+ buff[i] = seed;
+ seed = seed + (uint8_t) i;
+ }
+}
+
+/* Convert a 16-bit address to to 8-bit values */
+static void toAddr(uint8_t *tx, uint16_t addr)
+{
+ tx[0] = (uint8_t) (addr >> 8);
+ tx[1] = (uint8_t) (addr >> 0);
+}
+
+/* Compate 2 fixed length buffers */
+static bool compFail(uint8_t *ptr1, uint8_t *ptr2)
+{
+ int i;
+
+ for (i = 0; i < EMUEEPROMSIZE; i++) {
+ if (ptr1[i] != ptr2[i]) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/* EEPROM testing via I2C */
+static void eepromTest(uint8_t eepromAddr)
+{
+ int i;
+ uint8_t rx[8], tx[8];
+ static uint8_t seed = 0;
+
+ DEBUGOUT("Testing emulated EEPROM @ %x : ", eepromAddr);
+
+ /* Generate data to send to the emulated EEPROM */
+ fillWorkBuff(txWorkBuff, seed);
+ seed += 33 + eepromAddr;
+
+ /* Write the first 128 bytes to the EEPROM with byte operations */
+ for (i = 0; i < 128; i++) {
+ toAddr(tx, (uint16_t) i);
+ tx[2] = txWorkBuff[i];
+ SetupXferRecAndExecute(eepromAddr, tx, 3, rx, 0);
+ }
+
+ /* Write the next 128 bytes as 16-bit operations */
+ for (i = 0; i < 128; i += 2) {
+ toAddr(tx, (128 + (uint16_t) i));
+ tx[2] = txWorkBuff[128 + i];
+ tx[3] = txWorkBuff[128 + i + 1];
+ SetupXferRecAndExecute(eepromAddr, tx, 4, rx, 0);
+ }
+
+ /* Write the next 256 bytes as 32-bit operations */
+ for (i = 0; i < 256; i += 4) {
+ toAddr(tx, (256 + (uint16_t) i));
+ tx[2] = txWorkBuff[256 + i];
+ tx[3] = txWorkBuff[256 + i + 1];
+ tx[4] = txWorkBuff[256 + i + 2];
+ tx[5] = txWorkBuff[256 + i + 3];
+ SetupXferRecAndExecute(eepromAddr, tx, 6, rx, 0);
+ }
+
+ /* Read back 128 individual bytes */
+ for (i = 0; i < 128; i++) {
+ toAddr(tx, (uint16_t) i);
+ SetupXferRecAndExecute(eepromAddr, tx, 2, rx, 1);
+ rxWorkBuff[i] = rx[0];
+ }
+
+ /* Read the next 128 bytes as 16-bit operations */
+ for (i = 0; i < 128; i += 2) {
+ toAddr(tx, (128 + (uint16_t) i));
+ SetupXferRecAndExecute(eepromAddr, tx, 2, rx, 2);
+ rxWorkBuff[128 + i] = rx[0];
+ rxWorkBuff[128 + i + 1] = rx[1];
+ }
+
+ /* Read the next 256 bytes as 32-bit operations */
+ for (i = 0; i < 256; i += 4) {
+ toAddr(tx, (256 + (uint16_t) i));
+ SetupXferRecAndExecute(eepromAddr, tx, 2, rx, 4);
+ rxWorkBuff[256 + i] = rx[0];
+ rxWorkBuff[256 + i + 1] = rx[1];
+ rxWorkBuff[256 + i + 2] = rx[2];
+ rxWorkBuff[256 + i + 3] = rx[3];
+ }
+
+ /* Compare send and receive data */
+ if (compFail(rxWorkBuff, txWorkBuff)) {
+ Board_LED_Set(0, true);
+ DEBUGOUT("FAILED\r\n");
+ }
+ else {
+ DEBUGOUT("PASSED\r\n");
+ }
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle I2C1 interrupt by calling I2CM interrupt transfer handler
+ * @return Nothing
+ */
+void LPC_I2C_INTHAND(void)
+{
+ uint32_t state = Chip_I2C_GetPendingInt(LPC_I2C_PORT);
+
+ /* Error handling */
+ if (state & (I2C_INTSTAT_MSTRARBLOSS | I2C_INTSTAT_MSTSTSTPERR)) {
+ Chip_I2CM_ClearStatus(LPC_I2C_PORT, I2C_STAT_MSTRARBLOSS | I2C_STAT_MSTSTSTPERR);
+ }
+
+ /* Call I2CM ISR function with the I2C device and transfer rec */
+ if (state & I2C_INTENSET_MSTPENDING) {
+ Chip_I2CM_XferHandler(LPC_I2C_PORT, &i2cmXferRec);
+ }
+
+ /* I2C slave related interrupt */
+ while (state & (I2C_INTENSET_SLVPENDING | I2C_INTENSET_SLVDESEL)) {
+ Chip_I2CS_XferHandler(LPC_I2C_PORT, &i2csCallBacks);
+
+ /* Update state */
+ state = Chip_I2C_GetPendingInt(LPC_I2C_PORT);
+ }
+}
+
+/**
+ * @brief Main routine for I2C example
+ * @return Function should not exit
+ */
+int main(void)
+{
+ /* Generic Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ /* Clear activity LED */
+ Board_LED_Set(0, false);
+
+ /* Setup I2C pin muxing */
+ Init_I2C_PinMux();
+
+ /* Setup I2C, master, and slave */
+ setupI2CMaster();
+ setupI2CSlave();
+
+ /* Setup emulated EEPROMd evice */
+ setupEmuEEPROM();
+
+ /* Enable the interrupt for the I2C */
+ NVIC_EnableIRQ(LPC_IRQNUM);
+
+ DEBUGOUT("2 Emulated EEPROM I2C devices using 2 I2C slaves\r\n");
+
+ /* Test each emulated EEPROM */
+ while (1) {
+ /* Read some data from the emulated EEPROMs */
+ eepromTest(EEPROM0SLVADD);
+ eepromTest(EEPROM1SLVADD);
+ }
+
+ /* Code never reaches here. Only used to satisfy standard main() */
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cs_interrupt/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cs_interrupt/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_i2cs_interrupt/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_iap/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_iap/.cproject
new file mode 100644
index 0000000..77a23df
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_iap/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.389967876">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.389967876" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.389967876" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.389967876." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.811859823" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.259749230" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_iap}/Debug" id="com.crt.advproject.builder.exe.debug.2046424344" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.481341637" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1578799597" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.1157275251" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1935279859" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.2006894205" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.2064994590" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.499230138" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1708296094" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1426103354" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.1240886049" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1286813670" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.2067678371" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.399693461" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.2042791718" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1564104507" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.595993707" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1337685801" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1669007725" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1442047999" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1051348973" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.2103732942" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_iap_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.514470954" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.385601859" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.2020188510" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1416726654" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.487849231" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.2007314597" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.725080690" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.888262834">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.888262834" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.888262834" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.888262834." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.532099007" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.985659078" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_iap}/Release" id="com.crt.advproject.builder.exe.release.1262480546" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.1670667154" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.1630573402" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.101768503" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1195047354" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1975838090" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1228102112" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.184831621" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1920398604" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1442364715" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1291550110" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1078146252" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1919404353" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.487539524" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.78104565" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.2101981521" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.640453639" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.1366910186" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1338387097" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1062911008" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1281546474" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.237118900" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_iap_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1003683626" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.49150916" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.988666413" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1386072327" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.339598858" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1024018307" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1472723487" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_iap.com.crt.advproject.projecttype.exe.97182433" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_iap/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_iap/.project
new file mode 100644
index 0000000..0fb913c
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_iap/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_iap</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_iap/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_iap/example/readme.dox
new file mode 100644
index 0000000..1bfe74a
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_iap/example/readme.dox
@@ -0,0 +1,62 @@
+/*
+ * @brief IAP example using IAP FLASH programming
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_IAP LPC15xx In-Application FLASH programming example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * The IAP example demonstrates programming a FLASH block during run-time. For this
+ * example, the code is running from FLASH and a FLASH block not used for the
+ * executing code will be erased and programmed with some data. The example also
+ * toggles the LED in the systick interrupt. The interrupts need to be disabled
+ * during the IAP calls that change FLASH data and re-enabled after the calls are
+ * complete.>br>
+ *
+ * Do not run this example too many times or set it up to repeatedly erase and
+ * reprogram FLASH as it will wear out FLASH.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_iap/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_iap/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_iap/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_iap/example/src/iap.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_iap/example/src/iap.c
new file mode 100644
index 0000000..51da1ea
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_iap/example/src/iap.c
@@ -0,0 +1,157 @@
+/*
+ * @brief IAP example using IAP FLASH programming
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include <stdio.h>
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+#define TICKRATE_HZ (10) /* 10 ticks per second */
+
+/* SystemTick Counter */
+static volatile uint32_t sysTick;
+
+#define IAP_NUM_BYTES_TO_WRITE 256
+/* Address of the last sector on flash */
+#define last_sector_flash 0x0000F000
+/* LAST SECTOR */
+#define IAP_LAST_SECTOR 15
+
+/* IAP defines*/
+/* Prepare sector for write operation command */
+#define IAP_PREWRRITE_CMD 50
+
+/* Write Sector command */
+#define IAP_WRISECTOR_CMD 51
+
+/* Erase Sector command */
+#define IAP_ERSSECTOR_CMD 52
+
+/* Read PartID command */
+#define IAP_REPID_CMD 54
+
+/* IAP command variables */
+static unsigned int command[5], result[4];
+
+/* Data to write and write count */
+#define WRITECOUNT (IAP_NUM_BYTES_TO_WRITE / 32)
+static uint32_t array_data[WRITECOUNT];
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle interrupt from SysTick timer
+ * @return Nothing
+ */
+void SysTick_Handler(void)
+{
+ Board_LED_Toggle(0);
+ sysTick++;
+}
+
+/**
+ * @brief main routine for blinky example
+ * @return Function should not exit.
+ */
+int main(void)
+{
+ int i;
+
+ /* Generic Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+ Board_LED_Set(0, false);
+
+ /* Enable SysTick Timer */
+ SysTick_Config(SystemCoreClock / TICKRATE_HZ);
+
+ /* Initialize the array data to be written to FLASH */
+ for (i = 0; i < WRITECOUNT; i++) {
+ array_data[i] = 0x11223340 + i;
+ }
+
+ /* Read Part Identification Number*/
+ command[0] = IAP_REPID_CMD; /* Read ID command code */
+ iap_entry(command, result);
+
+ /* Reinvoke ISP mode so that reprogamming of Flash possible */
+ __disable_irq();
+
+ command[0] = IAP_REPID_CMD;
+ iap_entry(command, result);
+
+ /* Prepare to write/erase the last sector */
+ command[0] = IAP_PREWRRITE_CMD; /* Prepare to write/erase command code */
+ command[1] = IAP_LAST_SECTOR; /* Start Sector Number */
+ command[2] = IAP_LAST_SECTOR; /* End Sector Number */
+ iap_entry(command, result);
+
+ /* Erase the last sector */
+ command[0] = IAP_ERSSECTOR_CMD; /* Erase command code*/
+ command[1] = IAP_LAST_SECTOR; /* Start Sector Number */
+ command[2] = IAP_LAST_SECTOR; /* Start Sector Number */
+ iap_entry(command, result);
+
+ /* Prepare to write/erase the last sector */
+ command[0] = IAP_PREWRRITE_CMD; /* Prepare to write/erase command code */
+ command[1] = IAP_LAST_SECTOR; /* Start Sector Number */
+ command[2] = IAP_LAST_SECTOR; /* Start Sector Number */
+ iap_entry(command, result);
+
+ /* Write to the last sector */
+ command[0] = IAP_WRISECTOR_CMD; /* Write command code */
+ command[1] = (uint32_t) last_sector_flash; /* Destination Flash Address */
+ command[2] = (uint32_t) &array_data; /* Source RAM Address */
+ command[3] = IAP_NUM_BYTES_TO_WRITE; /* Number of Bytes to be written */
+ command[4] = SystemCoreClock / 1000; /* System clock frequency */
+ iap_entry(command, result);
+
+ /* Re-enable interrupt mode */
+ __enable_irq();
+
+ while (1) {
+ __WFI();
+ }
+
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_iap/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_iap/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_iap/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_mrt/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_mrt/.cproject
new file mode 100644
index 0000000..4c61b58
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_mrt/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1251754329">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1251754329" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1251754329" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1251754329." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.1747373628" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1098785143" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_mrt}/Debug" id="com.crt.advproject.builder.exe.debug.608441200" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.696885849" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.2079391872" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.959418448" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.425924454" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1312467976" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.671254952" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.334296976" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.61499702" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.704133064" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.966083870" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.291247095" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.694307343" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.947044726" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1385646264" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.2096590060" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.219288957" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.2127169421" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.4649206" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.2082441138" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1226318418" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.914916724" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_mrt_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1629701313" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.632495522" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1092045030" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.546834187" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1114992587" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1900772240" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.611495485" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.347658704">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.347658704" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.347658704" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.347658704." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.1997658344" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1605811404" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_mrt}/Release" id="com.crt.advproject.builder.exe.release.186588743" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.1689278194" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.19910987" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.1245410041" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.499798960" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.935632167" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1793783028" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.991015953" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.977558938" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.161912994" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1879382130" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1641279685" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1492781215" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1961823195" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.209252315" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.28922413" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.905165236" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.2072046762" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.2020127238" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.526943218" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1957843951" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.839726843" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_mrt_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.625984026" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1725813151" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1685889447" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.581887323" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1344403530" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.617178686" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.453650621" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_mrt.com.crt.advproject.projecttype.exe.607378870" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_mrt/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_mrt/.project
new file mode 100644
index 0000000..7cfb006
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_mrt/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_mrt</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_mrt/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_mrt/example/readme.dox
new file mode 100644
index 0000000..8ddf5fa
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_mrt/example/readme.dox
@@ -0,0 +1,57 @@
+/*
+ * @brief Multi-Rate Timer (MRT) example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_MRT LPC15xx Multi-Rate Timer example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * The MRT example demonstrates using the Multi-Rate Timer API functions.
+ * This example configures timers 0 and 1 as periodic interrupts that
+ * blink LEDs 0 and 1. Timer 2 is configured as a one-shot interrupt that gets
+ * reset in the interrupt handler.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_mrt/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_mrt/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_mrt/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_mrt/example/src/mrt.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_mrt/example/src/mrt.c
new file mode 100644
index 0000000..c4d9c1f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_mrt/example/src/mrt.c
@@ -0,0 +1,138 @@
+/*
+ * @brief Multi-Rate Timer (MRT) example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+static volatile bool t3Fired;
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Setup a timer for a periodic (repeat mode) rate */
+static void setupMRT(uint8_t ch, MRT_MODE_T mode, uint32_t rate)
+{
+ LPC_MRT_CH_T *pMRT;
+
+ /* Get pointer to timer selected by ch */
+ pMRT = Chip_MRT_GetRegPtr(ch);
+
+ /* Setup timer with rate based on MRT clock */
+ Chip_MRT_SetInterval(pMRT, (Chip_Clock_GetSystemClockRate() / rate) |
+ MRT_INTVAL_LOAD);
+
+ /* Timer mode */
+ Chip_MRT_SetMode(pMRT, mode);
+
+ /* Clear pending interrupt and enable timer */
+ Chip_MRT_IntClear(pMRT);
+ Chip_MRT_SetEnabled(pMRT);
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle interrupt from MRT
+ * @return Nothing
+ */
+void MRT_IRQHandler(void)
+{
+ uint32_t int_pend;
+
+ /* Get and clear interrupt pending status for all timers */
+ int_pend = Chip_MRT_GetIntPending();
+ Chip_MRT_ClearIntPending(int_pend);
+
+ /* Channel 0 */
+ if (int_pend & MRTn_INTFLAG(0)) {
+ Board_LED_Toggle(0);
+ }
+
+ /* Channel 1 */
+ if (int_pend & MRTn_INTFLAG(1)) {
+ Board_LED_Toggle(1);
+ }
+
+ /* Channel 2 is single shot, reset it here */
+ if (int_pend & (MRTn_INTFLAG(2))) {
+ setupMRT(2, MRT_MODE_ONESHOT, 2); /* Will fire in 0.5 seconds */
+ Board_LED_Toggle(2);
+ }
+}
+
+/**
+ * @brief MRT example main function
+ * @return Status (This function will not return)
+ */
+int main(void)
+{
+ int mrtch;
+
+ /* Generic Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ DEBUGSTR("LPC15xx MRT Example \r\n");
+
+ /* MRT Initialization and disable all timers */
+ Chip_MRT_Init();
+ for (mrtch = 0; mrtch < MRT_CHANNELS_NUM; mrtch++) {
+ Chip_MRT_SetDisabled(Chip_MRT_GetRegPtr(mrtch));
+ }
+
+ /* Enable the interrupt for the MRT */
+ NVIC_EnableIRQ(MRT_IRQn);
+
+ /* Enable timers 0 and 1 in repeat mode with different rates */
+ setupMRT(0, MRT_MODE_REPEAT, 2);/* 2Hz rate */
+ setupMRT(1, MRT_MODE_REPEAT, 5);/* 5Hz rate */
+
+ /* Enable timer 2 in single one mode with the interrupt restarting the
+ timer */
+ setupMRT(2, MRT_MODE_ONESHOT, 7); /* Will fire in 1/7 seconds */
+
+ /* All processing and MRT reset in the interrupt handler */
+ while (1) {
+ __WFI();
+ }
+
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_mrt/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_mrt/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_mrt/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pinint/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pinint/.cproject
new file mode 100644
index 0000000..39ebdda
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pinint/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1458812046">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1458812046" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1458812046" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1458812046." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.470945342" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.459624053" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_pinint}/Debug" id="com.crt.advproject.builder.exe.debug.837030419" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1727387850" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.776544589" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.1005362168" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.262699238" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1719188277" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.909106871" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.2119812121" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.218832460" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.854896601" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.382641939" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.159415866" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.940072350" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.83865368" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1088285268" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1816958411" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1371015773" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.376169599" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.582354573" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1146717940" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1097054432" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.925628589" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_pinint_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.183865208" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1962119828" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.358103640" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1469636341" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1028527664" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.339043096" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.834060585" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.1212415104">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.1212415104" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.1212415104" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.1212415104." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.938087142" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1089759124" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_pinint}/Release" id="com.crt.advproject.builder.exe.release.1205613030" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.345268455" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.1224966160" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.1802611120" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1200766605" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.390668949" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1069691930" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.459865888" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.446101959" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.822179605" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.881704090" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1727570900" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1253432409" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.309413431" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.192816461" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1325698842" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1132682422" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.315450042" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1338982664" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.2054556276" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1284310240" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1237595053" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_pinint_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.82418144" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.219854341" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.666833244" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.316918887" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.2093450345" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.336299414" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1868321164" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_pinint.com.crt.advproject.projecttype.exe.1726139503" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pinint/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pinint/.project
new file mode 100644
index 0000000..4aec213
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pinint/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_pinint</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pinint/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pinint/example/readme.dox
new file mode 100644
index 0000000..6b86ac4
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pinint/example/readme.dox
@@ -0,0 +1,60 @@
+/*
+ * @brief Pin Interrupt example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_PININT LPC15xx Pin Interrupt example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * The Pin interrupt example demonstrates using the pin interrupt API functions.<br>
+ *
+ * This example configures a pin interrupt as a falling edge interrupt.
+ * The WAKEUP/SW1 switch generates the interrupt signal to the input.
+ *
+ * The application will spin in a loop. With every pin interrupt the
+ * board LED0 will be toggled.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pinint/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pinint/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pinint/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pinint/example/src/pinint.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pinint/example/src/pinint.c
new file mode 100644
index 0000000..0875b09
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pinint/example/src/pinint.c
@@ -0,0 +1,119 @@
+/*
+ * @brief Pin Interrupt example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include "chip.h"
+#include <stdio.h>
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+/* GPIO pin for PININT interrupt. This is SW1-WAKE button switch input. */
+#define TEST_INPUT_PIN 17 /* GPIO pin number mapped to PININT */
+#define TEST_INPUT_PORT 0 /* GPIO port number mapped to PININT */
+#define TEST_INPUT_PIN_PORT 0
+#define TEST_INPUT_PIN_BIT 17
+#define PININT_INDEX 0 /* PININT index used for GPIO mapping */
+#define PININT_IRQ_HANDLER PIN_INT0_IRQHandler /* GPIO interrupt IRQ function name */
+#define PININT_NVIC_NAME PIN_INT0_IRQn /* GPIO interrupt NVIC interrupt name */
+
+#else
+#error "PININT Interrupt not configured for this example"
+#endif /* defined(BOARD_NXP_LPCXPRESSO_1549) */
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle interrupt from GPIO pin or GPIO pin mapped to PININT
+ * @return Nothing
+ */
+void PININT_IRQ_HANDLER(void)
+{
+ Chip_PININT_ClearIntStatus(LPC_GPIO_PIN_INT, PININTCH(PININT_INDEX));
+ Board_LED_Toggle(0);
+}
+
+/**
+ * @brief Main program body
+ * @return Does not return
+ */
+int main(void)
+{
+ SystemCoreClockUpdate();
+ Board_Init();
+ Board_LED_Set(0, false);
+
+ /* Initialize PININT driver */
+ Chip_PININT_Init(LPC_GPIO_PIN_INT);
+
+ /* Set pin back to GPIO (on some boards may have been changed to something
+ else by Board_Init()) */
+ Chip_IOCON_PinMuxSet(LPC_IOCON, TEST_INPUT_PIN_PORT, TEST_INPUT_PIN_BIT,
+ (IOCON_DIGMODE_EN | IOCON_MODE_INACT) );
+
+ /* Configure GPIO pin as input */
+ Chip_GPIO_SetPinDIRInput(LPC_GPIO, TEST_INPUT_PORT, TEST_INPUT_PIN);
+
+ /* Enable PININT clock */
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_PININT);
+
+ /* Reset the PININT block */
+ Chip_SYSCTL_PeriphReset(RESET_PININT);
+
+ /* Configure interrupt channel for the GPIO pin in INMUX block */
+ Chip_INMUX_PinIntSel(PININT_INDEX, TEST_INPUT_PORT, TEST_INPUT_PIN);
+
+ /* Configure channel interrupt as edge sensitive and falling edge interrupt */
+ Chip_PININT_ClearIntStatus(LPC_GPIO_PIN_INT, PININTCH(PININT_INDEX));
+ Chip_PININT_SetPinModeEdge(LPC_GPIO_PIN_INT, PININTCH(PININT_INDEX));
+ Chip_PININT_EnableIntLow(LPC_GPIO_PIN_INT, PININTCH(PININT_INDEX));
+
+ /* Enable interrupt in the NVIC */
+ NVIC_ClearPendingIRQ(PININT_NVIC_NAME);
+ NVIC_EnableIRQ(PININT_NVIC_NAME);
+
+ /* Spin in a loop here. All the work is done in ISR. */
+ while (1) {}
+
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pinint/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pinint/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pinint/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu/.cproject
new file mode 100644
index 0000000..06ecf9b
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1174923777">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1174923777" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1174923777" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1174923777." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.2019612695" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1045961662" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_pmu}/Debug" id="com.crt.advproject.builder.exe.debug.1890209638" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1470633684" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.468471279" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.1218026905" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.4590996" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.536643609" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.2071207455" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1926570701" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1969263546" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1628435473" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.750541679" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.582993012" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.601060706" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.2013862637" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1894804955" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.2001605804" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1276039125" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1433078108" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.488554890" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.744425483" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1189319192" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.83066013" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_pmu_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1078102852" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.799865008" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1513344600" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.941304222" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.925740364" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1949770260" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1748823736" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.1790616214">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.1790616214" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.1790616214" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.1790616214." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.897401189" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1705105944" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_pmu}/Release" id="com.crt.advproject.builder.exe.release.419630822" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.1797875591" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.1876156542" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.1867388678" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1404514272" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.2109720357" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.152661601" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1856577942" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1418709651" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1098964906" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.544602797" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1931689279" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.570584560" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.936480247" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1689351741" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1080177977" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1003111473" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.673004088" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1123786241" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1454837483" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.25570465" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.804826660" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_pmu_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.2132093923" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.778980765" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1885205396" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.704803884" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1799793342" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1945663599" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.911740076" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_pmu.com.crt.advproject.projecttype.exe.2097177443" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu/.project
new file mode 100644
index 0000000..4e90302
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_pmu</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu/example/readme.dox
new file mode 100644
index 0000000..55a8d6e
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu/example/readme.dox
@@ -0,0 +1,66 @@
+/*
+ * @brief PMU example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_PMU LPC1549 Low Power (PMU) example
+ * @ingroup EXAMPLES_PERIPH_1549
+ * <b>Example description</b><br>
+ * The PMU example demonstrates power state change using the RTC timer to wake-up
+ * the MCU from the following low power states, SLEEP, DEEP SLEEP, POWER DOWN,
+ * and DEEP POWER DOWN.<br>
+ * The wakeup timer is configurable, allowing the user to select the time delay
+ * between power state changes. The chip is then placed into a low power mode and
+ * will wakeup from the RTC timer event. PMU power modes tested are:<br>
+ * MCU_SLEEP,<br>
+ * MCU_DEEP_SLEEP,<br>
+ * MCU_POWER_DOWN,<br>
+ * MCU_DEEP_POWER_DOWN<br>
+ * The UART serial output from the board will announce each power state change.<br>
+ * <i>Expect to lose your debugger connection with this example when the MCU
+ * goes into low power states.</i><br>
+ *
+ * <b>Special connection requirements</b><br>
+ * This example requires a UART connection to display status.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu/example/src/pmu.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu/example/src/pmu.c
new file mode 100644
index 0000000..8b7e342
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu/example/src/pmu.c
@@ -0,0 +1,264 @@
+/*
+ * @brief PMU example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* Change this value to increase/decrease the time between power state changes */
+#define POWER_CYCLE_SEC_DELAY 10
+
+/* Comment out this #define if you want a power-cycle count */
+/* #define RESET_POWER_CYCLE_COUNT */
+
+/* Index of PMU GP registers */
+#define PWR_CYCLE_COUNT_REG_INDEX 0
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Read or reset the power-cycle counter */
+static uint32_t ProcessCycleCounter(void)
+{
+ uint32_t returnVal = 0xFFFFFFFF;
+
+#ifndef RESET_POWER_CYCLE_COUNT
+ /* Read current power-cycle count register */
+ returnVal = Chip_PMU_ReadGPREG(LPC_PMU, PWR_CYCLE_COUNT_REG_INDEX);
+#endif
+
+ /* Write power-cycle count register */
+ Chip_PMU_WriteGPREG(LPC_PMU, PWR_CYCLE_COUNT_REG_INDEX, returnVal + 1);
+
+ /* Return current value of cycle-count */
+ return returnVal;
+}
+
+/* Delay to allow all serial output to be processed before power state change */
+static void DelayForSerialOutput(void)
+{
+ volatile uint32_t tempTimeout;
+
+ /* Delay until all serial processing complete */
+ tempTimeout = Chip_RTC_GetCount(LPC_RTC) + 1;
+ while (Chip_RTC_GetCount(LPC_RTC) < tempTimeout) {}
+}
+
+/* Handle interrupt from GPIO pin or GPIO pin mapped to PININT */
+static void ProcessPowerState(CHIP_PMU_MCUPOWER_T crntPowerSetting)
+{
+ volatile uint32_t tempTimeout;
+
+ /* Output power status message, add separating space */
+ DEBUGSTR("\r\n");
+
+ /* Switch on current selected power setting */
+ switch (crntPowerSetting) {
+ case PMU_MCU_SLEEP:
+ default:
+ DEBUGSTR("-----------------------------------------------------------------\r\n");
+ DEBUGSTR(" Entering SLEEP power setting\r\n");
+ DEBUGOUT(" (System will exit SLEEP in %d seconds)\r\n", POWER_CYCLE_SEC_DELAY);
+ DEBUGSTR("-----------------------------------------------------------------\r\n\r\n");
+
+ /* Wait for all serial characters to be output */
+ DelayForSerialOutput();
+
+ /* Enter MCU Sleep mode */
+ Chip_PMU_SleepState(LPC_PMU);
+
+ break;
+
+ case PMU_MCU_DEEP_SLEEP:
+ DEBUGSTR("-----------------------------------------------------------------\r\n");
+ DEBUGSTR(" Entering DEEP SLEEP power setting\r\n");
+ DEBUGOUT(" (System will exit DEEP SLEEP in %d seconds)\r\n", POWER_CYCLE_SEC_DELAY);
+ DEBUGSTR("-----------------------------------------------------------------\r\n\r\n");
+
+ /* Wait for all serial characters to be output */
+ DelayForSerialOutput();
+
+ /* We should call Chip_SYSCTL_SetWakeup() to setup any peripherals we want
+ to power back up on wakeup. For this example, we'll power back up the IRC,
+ FLASH, the system oscillator, and the PLL */
+ Chip_SYSCTL_SetWakeup(~(SYSCTL_SLPWAKE_IRCOUT_PD | SYSCTL_SLPWAKE_IRC_PD |
+ SYSCTL_SLPWAKE_FLASH_PD | SYSCTL_SLPWAKE_SYSOSC_PD | SYSCTL_SLPWAKE_SYSPLL_PD));
+ Chip_SYSCTL_EnableERP1PeriphWakeup(SYSCTL_ERP1_WAKEUP_RTCALARMINT);
+
+ /* Enter MCU Deep Sleep mode */
+ Chip_PMU_DeepSleepState(LPC_PMU);
+
+ break;
+
+ case PMU_MCU_POWER_DOWN:
+ DEBUGSTR("-----------------------------------------------------------------\r\n");
+ DEBUGSTR(" Entering POWER DOWN power setting\r\n");
+ DEBUGOUT(" (System will exit POWER DOWN in %d seconds)\r\n", POWER_CYCLE_SEC_DELAY);
+ DEBUGSTR("-----------------------------------------------------------------\r\n\r\n");
+
+ /* Wait for all serial characters to be output */
+ DelayForSerialOutput();
+
+ /* We should call Chip_SYSCTL_SetWakeup() to setup any peripherals we want
+ to power back up on wakeup. For this example, we'll power back up the IRC,
+ FLASH, the system oscillator, and the PLL */
+ Chip_SYSCTL_SetWakeup(~(SYSCTL_SLPWAKE_IRCOUT_PD | SYSCTL_SLPWAKE_IRC_PD |
+ SYSCTL_SLPWAKE_FLASH_PD | SYSCTL_SLPWAKE_SYSOSC_PD | SYSCTL_SLPWAKE_SYSPLL_PD));
+ Chip_SYSCTL_EnableERP1PeriphWakeup(SYSCTL_ERP1_WAKEUP_RTCALARMINT);
+
+ /* Enter MCU Power down mode */
+ Chip_PMU_PowerDownState(LPC_PMU);
+
+ break;
+
+ case PMU_MCU_DEEP_PWRDOWN:
+ DEBUGSTR("-----------------------------------------------------------------\r\n");
+ DEBUGSTR(" Entering DEEP POWER DOWN power setting\r\n");
+ DEBUGOUT(" (System will exit DEEP POWER DOWN in %d seconds)\r\n", POWER_CYCLE_SEC_DELAY);
+ DEBUGSTR("-----------------------------------------------------------------\r\n\r\n");
+
+ /* Wait for all serial characters to be output */
+ DelayForSerialOutput();
+ /* Enable wakeup from deep power down mode due to RTC Alarm Match */
+ Chip_RTC_EnableWakeup(LPC_RTC, RTC_CTRL_ALARMDPD_EN);
+ /* Enter MCU Deep Power down mode */
+ Chip_PMU_DeepPowerDownState(LPC_PMU);
+
+ break;
+ }
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief RealTimeClock (RTC) Alarm Interrupt Handler
+ * @return None
+ */
+void RTC_ALARM_IRQHandler(void)
+{
+ uint32_t rtcStatus;
+
+ /* Get RTC status register */
+ rtcStatus = Chip_RTC_GetStatus(LPC_RTC);
+
+ /* Clear only latched RTC status */
+ Chip_RTC_EnableOptions(LPC_RTC,
+ (rtcStatus & (RTC_CTRL_WAKE1KHZ | RTC_CTRL_ALARM1HZ)));
+}
+
+/**
+ * @brief Main program body
+ * @return int
+ */
+int main(void)
+{
+ CHIP_PMU_MCUPOWER_T crntPowerSetting;
+
+ /* Setup SystemCoreClock and any needed board code */
+ SystemCoreClockUpdate();
+ Board_Init();
+ Board_LED_Set(0, true);
+
+ /* Clear any previously set deep power down and sleep flags */
+ Chip_PMU_ClearSleepFlags(LPC_PMU, PMU_PCON_SLEEPFLAG | PMU_PCON_DPDFLAG);
+ /* Enable the RTC oscillator, oscillator rate can be determined by
+ calling Chip_Clock_GetRTCOscRate() */
+ Chip_Clock_EnableRTCOsc();
+
+ /* Initialize RTC driver (enables RTC clocking) */
+ Chip_RTC_Init(LPC_RTC);
+
+ /* RTC reset */
+ Chip_RTC_Reset(LPC_RTC);
+
+ /* Start RTC at a count of 0 when RTC is disabled. If the RTC is enabled, you
+ need to disable it before setting the initial RTC count. */
+ Chip_RTC_Disable(LPC_RTC);
+ Chip_RTC_SetCount(LPC_RTC, 0);
+
+ /* Set a long alarm time so the interrupt won't trigger */
+ Chip_RTC_SetAlarm(LPC_RTC, 1000);
+
+ /* Enable RTC */
+ Chip_RTC_Enable(LPC_RTC);
+
+ /* Clear latched RTC interrupt statuses */
+ Chip_RTC_ClearStatus(LPC_RTC, (RTC_CTRL_OFD | RTC_CTRL_ALARM1HZ | RTC_CTRL_WAKE1KHZ));
+
+ /* Enable RTC interrupt */
+ NVIC_EnableIRQ(RTC_ALARM_IRQn);
+
+ /* Enable RTC alarm interrupt */
+ Chip_RTC_EnableWakeup(LPC_RTC, RTC_CTRL_ALARMDPD_EN);
+
+ /* Output example's activity banner */
+ DEBUGSTR("\r\n");
+ DEBUGSTR("-----------------------------------------------------------------\r\n");
+#ifdef RESET_POWER_CYCLE_COUNT
+ ProcessCycleCounter();
+ DEBUGOUT("Power Control Example\r\n");
+#else
+ DEBUGOUT("Power Control Example Cycle Count: %d\r\n", ProcessCycleCounter());
+#endif
+ DEBUGSTR(" System will cycle through SLEEP, DEEP SLEEP, POWER\r\n");
+ DEBUGSTR(" DOWN, and DEEP POWER DOWN power states\r\n");
+ DEBUGSTR("-----------------------------------------------------------------\r\n\r\n");
+
+ /* Setup alarm, process next power state then wait for alarm to wake-up system */
+ crntPowerSetting = PMU_MCU_SLEEP;
+ while (1) {
+ /* Set alarm to wakeup in POWER_CYCLE_SEC_DELAY seconds */
+ Chip_RTC_SetAlarm(LPC_RTC, Chip_RTC_GetCount(LPC_RTC) + POWER_CYCLE_SEC_DELAY);
+
+ /* Enter first (or next) power state */
+ ProcessPowerState(crntPowerSetting);
+
+ /* Inc current power setting and test for overflow */
+ if (crntPowerSetting == PMU_MCU_DEEP_PWRDOWN) {
+ /* Reset to lowest power setting */
+ crntPowerSetting = PMU_MCU_SLEEP;
+ }
+ else {
+ crntPowerSetting++;
+ }
+ }
+
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu_rom/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu_rom/.cproject
new file mode 100644
index 0000000..0cef882
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu_rom/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.817349737">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.817349737" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.817349737" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.817349737." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.67471170" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1034323459" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_pmu_rom}/Debug" id="com.crt.advproject.builder.exe.debug.1029076241" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.859278758" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.442900340" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.866658778" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1528939149" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.706392819" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.551075634" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1589517250" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.292027274" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1079356081" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.1988460929" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1577444402" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.988107837" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.263882676" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.132120528" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1715740300" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.603025067" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.211922671" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1584027034" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1623627271" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1977290468" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.676931512" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_pmu_rom_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.124578651" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1611156253" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.474883340" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1776527523" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.2066631438" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1870983189" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1322779916" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.1477104403">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.1477104403" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.1477104403" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.1477104403." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.1920592435" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1797664555" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_pmu_rom}/Release" id="com.crt.advproject.builder.exe.release.653123491" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.2075350809" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.30568802" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.1478779298" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1196603443" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1845477876" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.108435193" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.2079579528" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1288084568" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.966332917" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.493251628" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1297712003" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1239138477" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.475955414" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.326710120" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1697578763" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1429245577" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.1466938769" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.432672900" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.2126332828" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.374974544" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.132057839" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_pmu_rom_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.930226321" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1387003684" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.283030031" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1065671150" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.2021266923" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1677560968" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.326370828" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_pmu_rom.com.crt.advproject.projecttype.exe.1612256563" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu_rom/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu_rom/.project
new file mode 100644
index 0000000..48c4642
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu_rom/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_pmu_rom</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu_rom/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu_rom/example/readme.dox
new file mode 100644
index 0000000..55a8d6e
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu_rom/example/readme.dox
@@ -0,0 +1,66 @@
+/*
+ * @brief PMU example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_PMU LPC1549 Low Power (PMU) example
+ * @ingroup EXAMPLES_PERIPH_1549
+ * <b>Example description</b><br>
+ * The PMU example demonstrates power state change using the RTC timer to wake-up
+ * the MCU from the following low power states, SLEEP, DEEP SLEEP, POWER DOWN,
+ * and DEEP POWER DOWN.<br>
+ * The wakeup timer is configurable, allowing the user to select the time delay
+ * between power state changes. The chip is then placed into a low power mode and
+ * will wakeup from the RTC timer event. PMU power modes tested are:<br>
+ * MCU_SLEEP,<br>
+ * MCU_DEEP_SLEEP,<br>
+ * MCU_POWER_DOWN,<br>
+ * MCU_DEEP_POWER_DOWN<br>
+ * The UART serial output from the board will announce each power state change.<br>
+ * <i>Expect to lose your debugger connection with this example when the MCU
+ * goes into low power states.</i><br>
+ *
+ * <b>Special connection requirements</b><br>
+ * This example requires a UART connection to display status.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu_rom/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu_rom/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu_rom/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu_rom/example/src/pmu_rom.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu_rom/example/src/pmu_rom.c
new file mode 100644
index 0000000..9ba2845
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu_rom/example/src/pmu_rom.c
@@ -0,0 +1,268 @@
+/*
+ * @brief PMU example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* Change this value to increase/decrease the time between power state changes */
+#define POWER_CYCLE_SEC_DELAY 10
+
+/* Comment out this #define if you want a power-cycle count */
+/* #define RESET_POWER_CYCLE_COUNT */
+
+/* Index of PMU GP registers */
+#define PWR_CYCLE_COUNT_REG_INDEX 0
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Read or reset the power-cycle counter */
+static uint32_t ProcessCycleCounter(void)
+{
+ uint32_t returnVal = 0xFFFFFFFF;
+
+#ifndef RESET_POWER_CYCLE_COUNT
+ /* Read current power-cycle count register */
+ returnVal = Chip_PMU_ReadGPREG(LPC_PMU, PWR_CYCLE_COUNT_REG_INDEX);
+#endif
+
+ /* Write power-cycle count register */
+ Chip_PMU_WriteGPREG(LPC_PMU, PWR_CYCLE_COUNT_REG_INDEX, returnVal + 1);
+
+ /* Return current value of cycle-count */
+ return returnVal;
+}
+
+/* Delay to allow all serial output to be processed before power state change */
+static void DelayForSerialOutput(void)
+{
+ volatile uint32_t tempTimeout;
+
+ /* Delay until all serial processing complete */
+ tempTimeout = Chip_RTC_GetCount(LPC_RTC) + 1;
+ while (Chip_RTC_GetCount(LPC_RTC) < tempTimeout) {}
+}
+
+/* Handle interrupt from GPIO pin or GPIO pin mapped to PININT */
+static void ProcessPowerState(CHIP_PMU_MCUPOWER_T crntPowerSetting)
+{
+ volatile uint32_t tempTimeout;
+
+ /* Output power status message, add separating space */
+ DEBUGSTR("\r\n");
+
+ /* Switch on current selected power setting */
+ switch (crntPowerSetting) {
+ case PMU_MCU_SLEEP:
+ default:
+ DEBUGSTR("-----------------------------------------------------------------\r\n");
+ DEBUGSTR(" Entering SLEEP power setting\r\n");
+ DEBUGOUT(" (System will exit SLEEP in %d seconds)\r\n", POWER_CYCLE_SEC_DELAY);
+ DEBUGSTR("-----------------------------------------------------------------\r\n\r\n");
+
+ /* Wait for all serial characters to be output */
+ DelayForSerialOutput();
+
+ /* Enter MCU Sleep mode */
+ LPC_PWRD_API->power_mode_configure(PMU_SLEEP, (PMU_PD_WDOSC | PMU_PD_BOD | PMU_PD_ACMP0 | PMU_PD_ACMP1 | PMU_PD_ACMP2 |PMU_PD_ACMP3 | PMU_PD_IREF | PMU_PD_TS));
+ __WFI();
+
+ break;
+
+ case PMU_MCU_DEEP_SLEEP:
+ DEBUGSTR("-----------------------------------------------------------------\r\n");
+ DEBUGSTR(" Entering DEEP SLEEP power setting\r\n");
+ DEBUGOUT(" (System will exit DEEP SLEEP in %d seconds)\r\n", POWER_CYCLE_SEC_DELAY);
+ DEBUGSTR("-----------------------------------------------------------------\r\n\r\n");
+
+ /* Wait for all serial characters to be output */
+ DelayForSerialOutput();
+
+ /* We should call Chip_SYSCTL_SetWakeup() to setup any peripherals we want
+ to power back up on wakeup. For this example, we'll power back up the IRC,
+ FLASH, the system oscillator, and the PLL */
+ Chip_SYSCTL_SetWakeup(~(SYSCTL_SLPWAKE_IRCOUT_PD | SYSCTL_SLPWAKE_IRC_PD |
+ SYSCTL_SLPWAKE_FLASH_PD | SYSCTL_SLPWAKE_SYSOSC_PD | SYSCTL_SLPWAKE_SYSPLL_PD));
+ Chip_SYSCTL_EnableERP1PeriphWakeup(SYSCTL_ERP1_WAKEUP_RTCALARMINT);
+
+ /* Enter MCU Deep Sleep mode */
+ LPC_PWRD_API->power_mode_configure(PMU_DEEP_SLEEP, (PMU_PD_WDOSC | PMU_PD_BOD | PMU_PD_ACMP0 | PMU_PD_ACMP1 | PMU_PD_ACMP2 |PMU_PD_ACMP3 | PMU_PD_IREF | PMU_PD_TS));
+ __WFI();
+
+ break;
+
+ case PMU_MCU_POWER_DOWN:
+ DEBUGSTR("-----------------------------------------------------------------\r\n");
+ DEBUGSTR(" Entering POWER DOWN power setting\r\n");
+ DEBUGOUT(" (System will exit POWER DOWN in %d seconds)\r\n", POWER_CYCLE_SEC_DELAY);
+ DEBUGSTR("-----------------------------------------------------------------\r\n\r\n");
+
+ /* Wait for all serial characters to be output */
+ DelayForSerialOutput();
+
+ /* We should call Chip_SYSCTL_SetWakeup() to setup any peripherals we want
+ to power back up on wakeup. For this example, we'll power back up the IRC,
+ FLASH, the system oscillator, and the PLL */
+ Chip_SYSCTL_SetWakeup(~(SYSCTL_SLPWAKE_IRCOUT_PD | SYSCTL_SLPWAKE_IRC_PD |
+ SYSCTL_SLPWAKE_FLASH_PD | SYSCTL_SLPWAKE_SYSOSC_PD | SYSCTL_SLPWAKE_SYSPLL_PD));
+ Chip_SYSCTL_EnableERP1PeriphWakeup(SYSCTL_ERP1_WAKEUP_RTCALARMINT);
+
+ /* Enter MCU Power down mode */
+ LPC_PWRD_API->power_mode_configure(PMU_POWERDOWN, (PMU_PD_WDOSC | PMU_PD_BOD | PMU_PD_ACMP0 | PMU_PD_ACMP1 | PMU_PD_ACMP2 |PMU_PD_ACMP3 | PMU_PD_IREF | PMU_PD_TS));
+ __WFI();
+
+ break;
+
+ case PMU_MCU_DEEP_PWRDOWN:
+ DEBUGSTR("-----------------------------------------------------------------\r\n");
+ DEBUGSTR(" Entering DEEP POWER DOWN power setting\r\n");
+ DEBUGOUT(" (System will exit DEEP POWER DOWN in %d seconds)\r\n", POWER_CYCLE_SEC_DELAY);
+ DEBUGSTR("-----------------------------------------------------------------\r\n\r\n");
+
+ /* Wait for all serial characters to be output */
+ DelayForSerialOutput();
+ /* Enable wakeup from deep power down mode due to RTC Alarm Match */
+ Chip_RTC_EnableWakeup(LPC_RTC, RTC_CTRL_ALARMDPD_EN);
+ /* Enter MCU Deep Power down mode */
+ LPC_PWRD_API->power_mode_configure(PMU_DEEP_POWERDOWN, (PMU_PD_WDOSC | PMU_PD_BOD | PMU_PD_ACMP0 | PMU_PD_ACMP1 | PMU_PD_ACMP2 |PMU_PD_ACMP3 | PMU_PD_IREF | PMU_PD_TS));
+ __WFI();
+
+ break;
+ }
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief RealTimeClock (RTC) Alarm Interrupt Handler
+ * @return None
+ */
+void RTC_ALARM_IRQHandler(void)
+{
+ uint32_t rtcStatus;
+
+ /* Get RTC status register */
+ rtcStatus = Chip_RTC_GetStatus(LPC_RTC);
+
+ /* Clear only latched RTC status */
+ Chip_RTC_EnableOptions(LPC_RTC,
+ (rtcStatus & (RTC_CTRL_WAKE1KHZ | RTC_CTRL_ALARM1HZ)));
+}
+
+/**
+ * @brief Main program body
+ * @return int
+ */
+int main(void)
+{
+ CHIP_PMU_MCUPOWER_T crntPowerSetting;
+
+ /* Setup SystemCoreClock and any needed board code */
+ SystemCoreClockUpdate();
+ Board_Init();
+ Board_LED_Set(0, true);
+
+ /* Clear any previously set deep power down and sleep flags */
+ Chip_PMU_ClearSleepFlags(LPC_PMU, PMU_PCON_SLEEPFLAG | PMU_PCON_DPDFLAG);
+ /* Enable the RTC oscillator, oscillator rate can be determined by
+ calling Chip_Clock_GetRTCOscRate() */
+ Chip_Clock_EnableRTCOsc();
+
+ /* Initialize RTC driver (enables RTC clocking) */
+ Chip_RTC_Init(LPC_RTC);
+
+ /* RTC reset */
+ Chip_RTC_Reset(LPC_RTC);
+
+ /* Start RTC at a count of 0 when RTC is disabled. If the RTC is enabled, you
+ need to disable it before setting the initial RTC count. */
+ Chip_RTC_Disable(LPC_RTC);
+ Chip_RTC_SetCount(LPC_RTC, 0);
+
+ /* Set a long alarm time so the interrupt won't trigger */
+ Chip_RTC_SetAlarm(LPC_RTC, 1000);
+
+ /* Enable RTC */
+ Chip_RTC_Enable(LPC_RTC);
+
+ /* Clear latched RTC interrupt statuses */
+ Chip_RTC_ClearStatus(LPC_RTC, (RTC_CTRL_OFD | RTC_CTRL_ALARM1HZ | RTC_CTRL_WAKE1KHZ));
+
+ /* Enable RTC interrupt */
+ NVIC_EnableIRQ(RTC_ALARM_IRQn);
+
+ /* Enable RTC alarm interrupt */
+ Chip_RTC_EnableWakeup(LPC_RTC, RTC_CTRL_ALARMDPD_EN);
+
+ /* Output example's activity banner */
+ DEBUGSTR("\r\n");
+ DEBUGSTR("-----------------------------------------------------------------\r\n");
+#ifdef RESET_POWER_CYCLE_COUNT
+ ProcessCycleCounter();
+ DEBUGOUT("Power Control Example\r\n");
+#else
+ DEBUGOUT("Power Control Example Cycle Count: %d\r\n", ProcessCycleCounter());
+#endif
+ DEBUGSTR(" System will cycle through SLEEP, DEEP SLEEP, POWER\r\n");
+ DEBUGSTR(" DOWN, and DEEP POWER DOWN power states\r\n");
+ DEBUGSTR("-----------------------------------------------------------------\r\n\r\n");
+
+ /* Setup alarm, process next power state then wait for alarm to wake-up system */
+ crntPowerSetting = PMU_MCU_SLEEP;
+ while (1) {
+ /* Set alarm to wakeup in POWER_CYCLE_SEC_DELAY seconds */
+ Chip_RTC_SetAlarm(LPC_RTC, Chip_RTC_GetCount(LPC_RTC) + POWER_CYCLE_SEC_DELAY);
+
+ /* Enter first (or next) power state */
+ ProcessPowerState(crntPowerSetting);
+
+ /* Inc current power setting and test for overflow */
+ if (crntPowerSetting == PMU_MCU_DEEP_PWRDOWN) {
+ /* Reset to lowest power setting */
+ crntPowerSetting = PMU_MCU_SLEEP;
+ }
+ else {
+ crntPowerSetting++;
+ }
+ }
+
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu_rom/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu_rom/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_pmu_rom/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_ritimer/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_ritimer/.cproject
new file mode 100644
index 0000000..7190c22
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_ritimer/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.503866771">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.503866771" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.503866771" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.503866771." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.915311380" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.980529002" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_ritimer}/Debug" id="com.crt.advproject.builder.exe.debug.1643109058" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1199356881" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.642229709" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.1204666974" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1127014886" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1936813717" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.938466188" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1966730390" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.317430875" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1121883337" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.1828902653" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1364293836" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1152839043" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.285491191" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.543434463" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1887063403" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.349326097" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.765247622" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1465934542" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1764366123" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.935178409" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.494189619" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_ritimer_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.39011423" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1311509771" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.62601457" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.101905332" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.308569186" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.26514963" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.2024700782" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.198066124">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.198066124" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.198066124" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.198066124." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.982256040" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.859658107" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_ritimer}/Release" id="com.crt.advproject.builder.exe.release.1412236333" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.708411647" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.1978298557" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.1516486010" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.226605895" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1937546295" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.798536505" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.332988182" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.50694182" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.646991070" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.933660014" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1774870294" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1574074307" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.732061757" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.988989197" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.152206907" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.285728874" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.513500437" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.38051345" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.998978057" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.277311658" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1497887730" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_ritimer_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.952779864" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1959181706" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1884334525" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.738847456" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1070160085" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1948632105" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.639780038" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_ritimer.com.crt.advproject.projecttype.exe.1051087400" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_ritimer/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_ritimer/.project
new file mode 100644
index 0000000..df7394b
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_ritimer/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_ritimer</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_ritimer/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_ritimer/example/readme.dox
new file mode 100644
index 0000000..5630d6c
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_ritimer/example/readme.dox
@@ -0,0 +1,56 @@
+/*
+ * @brief RITimer example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_RIT LPC15xx Repetitive Timer example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * The Repetitive Interrupt Timer (RIT) example shows how to use the
+ * RIT. The example sets up a periodic interrupt at a selected time
+ * interval.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_ritimer/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_ritimer/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_ritimer/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_ritimer/example/src/ritimer.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_ritimer/example/src/ritimer.c
new file mode 100644
index 0000000..395f79f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_ritimer/example/src/ritimer.c
@@ -0,0 +1,89 @@
+/*
+ * @brief RITimer example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* Repetitive timer rate in Hz */
+#define TIME_INTERVAL 5
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief RIT interrupt handler
+ * @return Nothing
+ */
+void RIT_IRQHandler(void)
+{
+ /* Clear interrupt */
+ Chip_RIT_ClearIntStatus(LPC_RITIMER);
+
+ Board_LED_Toggle(0);
+}
+
+/**
+ * @brief Main entry point
+ * @return Nothing
+ */
+int main(void)
+{
+ /* Generic Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ /* Initialize RITimer */
+ Chip_RIT_Init(LPC_RITIMER);
+
+ /* Configure RIT for a periodic interrupt tick rate */
+ Chip_RIT_SetTimerIntervalHz(LPC_RITIMER, TIME_INTERVAL);
+ Chip_RIT_Enable(LPC_RITIMER);
+
+ NVIC_EnableIRQ(RITIMER_IRQn);
+
+ /* LED is toggled in interrupt handler */
+ while (1) {
+ /* Sleep between interrupts */
+ __WFI();
+ }
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_ritimer/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_ritimer/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_ritimer/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_rtc/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_rtc/.cproject
new file mode 100644
index 0000000..ffc2d7f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_rtc/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1323157879">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1323157879" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1323157879" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1323157879." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.1892881292" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.980010876" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_rtc}/Debug" id="com.crt.advproject.builder.exe.debug.453472586" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1166436794" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1348706715" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.2003870202" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.205530510" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.991179606" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.389712893" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.434483187" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.2066709422" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1581403494" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.749666378" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.632103833" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.676683905" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1187304556" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.765170615" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1167688043" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.8906209" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1637009668" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1048842431" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1436175533" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.187861371" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.720313245" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_rtc_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1443268281" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1426732855" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1162172441" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.324158456" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.299387006" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.694099024" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.886570640" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.418655321">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.418655321" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.418655321" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.418655321." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.1596846802" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.562414818" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_rtc}/Release" id="com.crt.advproject.builder.exe.release.1076192151" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.1718053979" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.1652810821" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.1210173558" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.2033875558" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.743461570" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1829852161" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.16344900" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1465899752" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.50663269" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1941678390" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1766201759" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1823133990" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.753761136" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1890520117" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.173712784" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1312567850" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.2035087758" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.354396977" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1130851542" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.120782540" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1000810155" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_rtc_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1386645744" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.445683166" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.719043101" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.271960308" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1900422973" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.510613262" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.854817260" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_rtc.com.crt.advproject.projecttype.exe.537091766" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_rtc/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_rtc/.project
new file mode 100644
index 0000000..479e2b9
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_rtc/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_rtc</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_rtc/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_rtc/example/readme.dox
new file mode 100644
index 0000000..6c6e2d0
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_rtc/example/readme.dox
@@ -0,0 +1,61 @@
+/*
+ * @brief RTC example with wakeup
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_RTC LPC15xx RTC example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * This example shows how to setup and use the RTC and to use the alarm
+ * to wake up the device from a sleep mode.<br>
+ *
+ * The board LED will toggle on and off twice at a varying rate based on
+ * varied (changing) wakeup timing. Then the chip will go to sleep. After 4
+ * seconds, the RTC alarm will wakeup the chip and turn on the LED. If you
+ * hook up the serial port to a terminal, you will get messages indicating
+ * what is happening.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_rtc/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_rtc/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_rtc/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_rtc/example/src/rtc.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_rtc/example/src/rtc.c
new file mode 100644
index 0000000..384ef05
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_rtc/example/src/rtc.c
@@ -0,0 +1,186 @@
+/*
+ * @brief RTC example with wakeup
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* RTC interrupt flags */
+static volatile bool rtcWake, rtcAlarm;
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief RTC alarm interrupt Handler
+ * @return None
+ */
+void RTC_ALARM_IRQHandler(void)
+{
+ uint32_t rtcStatus;
+
+ Board_LED_Toggle(1);
+
+ /* Get RTC status register */
+ rtcStatus = Chip_RTC_GetStatus(LPC_RTC);
+
+ /* Check RTC 1Khz match interrupt */
+ if (rtcStatus & RTC_CTRL_ALARM1HZ) {
+ /* Alarm */
+ rtcAlarm = true;
+ }
+
+ /* Clear only latched RTC alarm status */
+ Chip_RTC_EnableOptions(LPC_RTC, rtcStatus & RTC_CTRL_ALARM1HZ);
+}
+
+/**
+ * @brief RTC wake interrupt Handler
+ * @return None
+ */
+void RTC_WAKE_IRQHandler(void)
+{
+ uint32_t rtcStatus;
+
+ Board_LED_Toggle(0);
+
+ /* Get RTC status register */
+ rtcStatus = Chip_RTC_GetStatus(LPC_RTC);
+
+ /* Check RTC 1KHz match interrupt */
+ if (rtcStatus & RTC_CTRL_WAKE1KHZ) {
+ /* RTC high resultiuon wakeup interrupt */
+ rtcWake = true;
+ }
+
+ /* Clear only latched RTC wake status */
+ Chip_RTC_EnableOptions(LPC_RTC, rtcStatus & RTC_CTRL_WAKE1KHZ);
+}
+
+/**
+ * @brief Main program body
+ * @return int
+ */
+int main(void)
+{
+ int stateCounter = 0;
+ uint32_t ticks = 0;
+
+ /* Setup SystemCoreClock and any needed board code */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ /* Enable the RTC oscillator, oscillator rate can be determined by
+ calling Chip_Clock_GetRTCOscRate() */
+ Chip_Clock_EnableRTCOsc();
+
+ /* Initialize RTC driver (enables RTC clocking) */
+ Chip_RTC_Init(LPC_RTC);
+
+ /* Enable RTC as a peripheral wakeup event */
+ Chip_SYSCTL_EnableERP1PeriphWakeup(SYSCTL_ERP1_WAKEUP_RTCALARMINT |
+ SYSCTL_ERP1_WAKEUP_RTCWAKEINT);
+
+ /* RTC reset */
+ Chip_RTC_Reset(LPC_RTC);
+
+ /* Start RTC at a count of 0 when RTC is disabled. If the RTC is enabled, you
+ need to disable it before setting the initial RTC count. */
+ Chip_RTC_Disable(LPC_RTC);
+ Chip_RTC_SetCount(LPC_RTC, 0);
+
+ /* Set a long alarm time so the interrupt won't trigger */
+ Chip_RTC_SetAlarm(LPC_RTC, 1000);
+
+ /* Enable RTC and high resolution timer - this can be done in a single
+ call with Chip_RTC_EnableOptions(LPC_RTC, (RTC_CTRL_RTC1KHZ_EN | RTC_CTRL_RTC_EN)); */
+ Chip_RTC_Enable1KHZ(LPC_RTC);
+ Chip_RTC_Enable(LPC_RTC);
+
+ /* Clear latched RTC interrupt statuses */
+ Chip_RTC_ClearStatus(LPC_RTC, (RTC_CTRL_OFD | RTC_CTRL_ALARM1HZ | RTC_CTRL_WAKE1KHZ));
+
+ /* Enable RTC wake and alarm interrupts */
+ NVIC_EnableIRQ(RTC_ALARM_IRQn);
+ NVIC_EnableIRQ(RTC_WAKE_IRQn);
+
+ /* Enable RTC alarm interrupt */
+ Chip_RTC_EnableWakeup(LPC_RTC, (RTC_CTRL_ALARMDPD_EN | RTC_CTRL_WAKEDPD_EN));
+
+ /* Sleep and do all the work in the RTC interrupt handler */
+ while (1) {
+ ticks = 0;
+ DEBUGOUT("Tick number: %d, 1KHZ int:%d, alarm int:%d\r\n",
+ stateCounter, rtcWake, rtcAlarm);
+ rtcWake = rtcAlarm = false;
+
+ /* 10 high resolution ticks that get slower each tick */
+ if (stateCounter < 10) {
+ /* Wakeup in 300, 400, 500, etc. milliSeconds */
+ Chip_RTC_SetWake(LPC_RTC, (300 + (stateCounter * 100)));
+
+ stateCounter++;
+ }
+ else {
+ DEBUGOUT("Setting alarm to wake up in 4s\r\n");
+
+ /* Set alarm to wakeup in 4 seconds */
+ Chip_RTC_SetAlarm(LPC_RTC, Chip_RTC_GetCount(LPC_RTC) + 4);
+
+ stateCounter = 0;
+ }
+
+ Chip_SYSCTL_SetWakeup(~(SYSCTL_SLPWAKE_IRCOUT_PD | SYSCTL_SLPWAKE_IRC_PD |
+ SYSCTL_SLPWAKE_FLASH_PD | SYSCTL_SLPWAKE_SYSOSC_PD | SYSCTL_SLPWAKE_SYSPLL_PD));
+ Chip_SYSCTL_EnableERP1PeriphWakeup(SYSCTL_ERP1_WAKEUP_RTCALARMINT | SYSCTL_ERP1_WAKEUP_RTCWAKEINT);
+
+ /* Delay to allow serial transmission to complete*/
+ while(ticks++ < 10000) {}
+
+ /* Enter MCU Deep Sleep mode */
+ Chip_PMU_DeepSleepState(LPC_PMU);
+ }
+
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_rtc/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_rtc/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_rtc/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_interrupt/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_interrupt/.cproject
new file mode 100644
index 0000000..efafdad
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_interrupt/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.923091536">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.923091536" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.923091536" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.923091536." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.1176016388" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.631217127" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_spi_interrupt}/Debug" id="com.crt.advproject.builder.exe.debug.1132101157" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1147063294" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1867521524" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.826040960" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.632205936" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1631089982" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.155605614" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1312849617" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1003040906" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.719500588" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.987046455" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.687242714" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.630662676" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1485867601" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1125381380" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.312712127" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1125479011" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.2090703280" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.756897410" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1879175337" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1667313730" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.693111949" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_spi_interrupt_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.718613941" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1052323421" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.408773533" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1115234390" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1828965173" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.574605174" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1068964536" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.40230377">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.40230377" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.40230377" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.40230377." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.182198268" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1492278633" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_spi_interrupt}/Release" id="com.crt.advproject.builder.exe.release.1739591448" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.375097278" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.723869279" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.960617965" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1483486678" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1800389862" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.2021605992" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1224724721" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1567508352" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.233038617" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.304551709" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.844180856" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.214265137" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1317336022" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.250276533" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.235100269" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1063320769" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.418451422" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1239607699" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.880011165" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.7941370" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1165273202" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_spi_interrupt_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.23546925" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.76909533" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.503432895" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.681905492" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.258561358" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1596758430" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.109189371" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_spi_interrupt.com.crt.advproject.projecttype.exe.620279201" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_interrupt/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_interrupt/.project
new file mode 100644
index 0000000..c1a921a
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_interrupt/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_spi_interrupt</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_interrupt/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_interrupt/example/readme.dox
new file mode 100644
index 0000000..2af46d0
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_interrupt/example/readme.dox
@@ -0,0 +1,59 @@
+/*
+ * @brief SPI bus master example in interrupt mode
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_SPINT LPC15xx SPI bus master (interrupt) example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * This example shows how to configure SPI as a bus master in interrupt mode.<br>
+ *
+ * This example transmits an array of uint16_t values (0x1111, 0x2222, 0x3333, 0x4444) as SPI master
+ * using interrupt mode. The SPI is configured to be in loop back mode and the received data is compared
+ * against the transmitted data, if they match the transmission is repeated and the LED 0 keeps flickering
+ * In case of any error or mismatch in received and transmitted data, LED 0 will stay On.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_interrupt/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_interrupt/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_interrupt/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_interrupt/example/src/periph_spi_interrupt.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_interrupt/example/src/periph_spi_interrupt.c
new file mode 100644
index 0000000..163a2c1
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_interrupt/example/src/periph_spi_interrupt.c
@@ -0,0 +1,217 @@
+/*
+ * @brief SPI bus master example in interrupt mode
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* Transmit and Receive Buffers */
+static uint16_t xferArray[] = {0x1111, 0x2222, 0x3333, 0x4444};
+static uint16_t rx_buff[sizeof(xferArray) / sizeof(xferArray[0])];
+/* Interrupt error code (used as semaphore) */
+static volatile int intErrCode;
+/* SPI Transfer Setup */
+static SPI_DATA_SETUP_T XferSetup;
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Initializes pin muxing for SPI interface - note that SystemInit() may
+ already setup your pin muxing at system startup */
+static void Init_SPI_PinMux(void)
+{
+#if (defined(BOARD_NXP_LPCXPRESSO_1549))
+
+ /* Enable the clock to the Switch Matrix */
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
+ /*
+ * Initialize SPI0 pins connect
+ * SCK0: PINASSIGN3[15:8]: Select P0.0
+ * MOSI0: PINASSIGN3[23:16]: Select P0.16
+ * MISO0: PINASSIGN3[31:24] : Select P0.10
+ * SSEL0: PINASSIGN4[7:0]: Select P0.9
+ */
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 0, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 16, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 10, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 9, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+
+ Chip_SWM_MovablePinAssign(SWM_SPI0_SCK_IO, 0); /* P0.0 */
+ Chip_SWM_MovablePinAssign(SWM_SPI0_MOSI_IO, 16);/* P0.16 */
+ Chip_SWM_MovablePinAssign(SWM_SPI0_MISO_IO, 10);/* P0.10 */
+ Chip_SWM_MovablePinAssign(SWM_SPI0_SSELSN_0_IO, 9); /* P0.9 */
+
+ /* Disable the clock to the Switch Matrix to save power */
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM);
+#else
+ /* Configure your own SPI pin muxing here if needed */
+#warning "No SPI pin muxing defined"
+#endif
+}
+
+/* Turn on LED to indicate an error */
+static void errorSPI(void)
+{
+ Board_LED_Set(0, true);
+ while (1) {}
+}
+
+/* Setup SPI handle and parameters */
+static void setupSpiMaster()
+{
+ SPI_CFG_T spiCfg;
+ SPI_DELAY_CONFIG_T spiDelayCfg;
+ /* Initialize SPI Block */
+ Chip_SPI_Init(LPC_SPI0);
+ /* Set SPI Config register */
+ spiCfg.ClkDiv = 0xFFFF; /* Set Clock divider to maximum */
+ spiCfg.Mode = SPI_MODE_MASTER; /* Enable Master Mode */
+ spiCfg.ClockMode = SPI_CLOCK_MODE0; /* Enable Mode 0 */
+ spiCfg.DataOrder = SPI_DATA_MSB_FIRST; /* Transmit MSB first */
+ /* Slave select polarity is active low */
+ spiCfg.SSELPol = (SPI_CFG_SPOL0_LO | SPI_CFG_SPOL1_LO | SPI_CFG_SPOL2_LO | SPI_CFG_SPOL3_LO);
+ Chip_SPI_SetConfig(LPC_SPI0, &spiCfg);
+ /* Set Delay register */
+ spiDelayCfg.PreDelay = 2;
+ spiDelayCfg.PostDelay = 2;
+ spiDelayCfg.FrameDelay = 2;
+ spiDelayCfg.TransferDelay = 2;
+ Chip_SPI_DelayConfig(LPC_SPI0, &spiDelayCfg);
+ /* Enable Loopback mode for this example */
+ Chip_SPI_EnableLoopBack(LPC_SPI0);
+ /* Enable SPI0 */
+ Chip_SPI_Enable(LPC_SPI0);
+}
+
+/* Master SPI transmit in interrupt mode */
+static void WriteSpiMssg(uint16_t *xferPtr, uint32_t xferSize)
+{
+ /* Init variable used as semaphore */
+ intErrCode = -1;
+ /* Setup Transfer structure, this data should be retained for the entire transmission */
+ XferSetup.pTx = xferArray; /* Transmit Buffer */
+ XferSetup.pRx = rx_buff;/* Receive Buffer */
+ XferSetup.DataSize = sizeof(xferArray[0]) * 8; /* Data size in bits */
+ XferSetup.Length = sizeof(xferArray) / sizeof(xferArray[0]); /* Total frame length */
+ /* Assert only SSEL0 */
+ XferSetup.ssel = SPI_TXCTL_ASSERT_SSEL0 | SPI_TXCTL_DEASSERT_SSEL1 | SPI_TXCTL_DEASSERT_SSEL2 |
+ SPI_TXCTL_DEASSERT_SSEL3;
+ XferSetup.TxCnt = 0;
+ XferSetup.RxCnt = 0;
+ if (Chip_SPI_Int_RWFrames(LPC_SPI0, &XferSetup) == ERROR) {
+ errorSPI();
+ }
+ /* Enable interrupts after initiating transmission */
+ Chip_SPI_Int_Cmd(LPC_SPI0,
+ SPI_INTENSET_RXRDYEN | SPI_INTENSET_TXRDYEN | SPI_INTENSET_RXOVEN | SPI_INTENSET_TXUREN,
+ ENABLE);
+
+ /* Sleep until transfer is complete, but allow IRQ to wake system
+ to handle SPI IRQ */
+ while (intErrCode == -1) {
+ __WFI();
+ }
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle SPI0 interrupt by calling SPI ROM handler
+ * @return Nothing
+ */
+void SPI0_IRQHandler(void)
+{
+ uint32_t i;
+
+ if (XferSetup.RxCnt < XferSetup.Length) {
+ /* Call driver function until transmission is complete */
+ if (Chip_SPI_Int_RWFrames(LPC_SPI0, &XferSetup) == ERROR) {
+ errorSPI();
+ }
+ }
+ else {
+ /* Disable interrupts after transmission is complete */
+ Chip_SPI_Int_Cmd(LPC_SPI0,
+ SPI_INTENSET_RXRDYEN | SPI_INTENSET_TXRDYEN | SPI_INTENSET_RXOVEN | SPI_INTENSET_TXUREN,
+ DISABLE);
+ /* Verify if received data is same as transmit */
+ for (i = 0; i < sizeof(xferArray) / sizeof(xferArray[0]); i++) {
+ if (rx_buff[i] != xferArray[i]) {
+ errorSPI();
+ }
+ }
+ intErrCode = (int) LPC_OK;
+ }
+}
+
+/**
+ * @brief Main routine for SPI example
+ * @return Function should not exit
+ */
+int main(void)
+{
+ /* Generic Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ /* Clear activity LED */
+ Board_LED_Set(0, false);
+
+ /* Setup SPI pin muxing */
+ Init_SPI_PinMux();
+
+ /* Allocate SPI handle, setup rate, and initialize clocking */
+ setupSpiMaster();
+
+ /* Enable SPI0 interrupt */
+ NVIC_EnableIRQ(SPI0_IRQn);
+
+ /* Loop forever */
+ while (1) {
+ /* Write simple message over SPI */
+ WriteSpiMssg(xferArray, sizeof(xferArray) / sizeof(xferArray[0]));
+
+ /* Toggle LED to show activity. */
+ Board_LED_Toggle(0);
+ }
+
+ /* Code never reaches here. Only used to satisfy standard main() */
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_interrupt/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_interrupt/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_interrupt/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_polling/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_polling/.cproject
new file mode 100644
index 0000000..604cb00
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_polling/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1621952991">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1621952991" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1621952991" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1621952991." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.432893743" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1006707459" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_spi_polling}/Debug" id="com.crt.advproject.builder.exe.debug.557884683" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.215213118" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.416625529" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.1314437190" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1964370851" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.2128880797" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1066262815" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1069284312" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1849818267" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.731016907" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.71703747" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.227175725" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1013239267" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1953028474" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.444524518" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1272727814" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.2040418037" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1091569969" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1522921549" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.759620458" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.2119812408" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1654011756" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_spi_polling_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1545397216" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1593629116" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.302999894" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1704191200" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1090325250" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1557348115" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.429538160" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.1191958006">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.1191958006" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.1191958006" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.1191958006." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.613618018" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1154871538" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_spi_polling}/Release" id="com.crt.advproject.builder.exe.release.1534805422" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.1710843640" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.2134858239" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.364129453" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.9236843" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1001243856" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.762433344" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1747885187" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1281988732" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1088344435" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1112992024" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1945312371" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.382436828" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.29358141" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1359683300" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1636712162" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.979809251" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.988166652" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.372525039" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1602627918" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.700446248" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1111217300" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_spi_polling_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1093120336" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1541163352" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1697391591" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1483786267" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1598100399" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.41953676" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1976841462" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_spi_polling.com.crt.advproject.projecttype.exe.1341831732" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_polling/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_polling/.project
new file mode 100644
index 0000000..2b12406
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_polling/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_spi_polling</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_polling/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_polling/example/readme.dox
new file mode 100644
index 0000000..7181dec
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_polling/example/readme.dox
@@ -0,0 +1,59 @@
+/*
+ * @brief SPI bus master example via polling
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_SPIPOLL LPC15xx SPI bus master (polling) example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * This example shows how to configure SPI as a bus master in polling mode.<br>
+ *
+ * This example transmits an array of uint16_t values (0x1111, 0x2222, 0x3333, 0x4444) as SPI master
+ * using polling mode. The SPI is configured to be in loop back mode and the received data is compared
+ * against the transmitted data, if they match the transmission is repeated and the LED 0 keeps flickering
+ * In case of any error or mismatch in received and transmitted data, LED 0 will stay On.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_polling/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_polling/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_polling/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_polling/example/src/periph_spi_polling.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_polling/example/src/periph_spi_polling.c
new file mode 100644
index 0000000..3b9f472
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_polling/example/src/periph_spi_polling.c
@@ -0,0 +1,182 @@
+/*
+ * @brief SPI bus master example in polling mode
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* Transmit and Receive Buffers */
+static uint16_t xferArray[] = {0x1111, 0x2222, 0x3333, 0x4444};
+static uint16_t rx_buff[sizeof(xferArray) / sizeof(xferArray[0])];
+/* SPI Transfer Setup */
+static SPI_DATA_SETUP_T XferSetup;
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Initializes pin muxing for SPI interface - note that SystemInit() may
+ already setup your pin muxing at system startup */
+static void Init_SPI_PinMux(void)
+{
+#if (defined(BOARD_NXP_LPCXPRESSO_1549))
+
+ /* Enable the clock to the Switch Matrix */
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
+ /*
+ * Initialize SPI0 pins connect
+ * SCK0: PINASSIGN3[15:8]: Select P0.0
+ * MOSI0: PINASSIGN3[23:16]: Select P0.16
+ * MISO0: PINASSIGN3[31:24] : Select P0.10
+ * SSEL0: PINASSIGN4[7:0]: Select P0.9
+ */
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 0, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 16, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 10, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 9, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+
+ Chip_SWM_MovablePinAssign(SWM_SPI0_SCK_IO, 0); /* P0.0 */
+ Chip_SWM_MovablePinAssign(SWM_SPI0_MOSI_IO, 16);/* P0.16 */
+ Chip_SWM_MovablePinAssign(SWM_SPI0_MISO_IO, 10);/* P0.10 */
+ Chip_SWM_MovablePinAssign(SWM_SPI0_SSELSN_0_IO, 9); /* P0.9 */
+
+ /* Disable the clock to the Switch Matrix to save power */
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM);
+#else
+ /* Configure your own SPI pin muxing here if needed */
+#warning "No SPI pin muxing defined"
+#endif
+}
+
+/* Turn on LED to indicate an error */
+static void errorSPI(void)
+{
+ Board_LED_Set(0, true);
+ while (1) {}
+}
+
+/* Setup SPI handle and parameters */
+static void setupSpiMaster()
+{
+ SPI_CFG_T spiCfg;
+ SPI_DELAY_CONFIG_T spiDelayCfg;
+ /* Initialize SPI Block */
+ Chip_SPI_Init(LPC_SPI0);
+ /* Set SPI Config register */
+ spiCfg.ClkDiv = 0xFFFF; /* Set Clock divider to maximum */
+ spiCfg.Mode = SPI_MODE_MASTER; /* Enable Master Mode */
+ spiCfg.ClockMode = SPI_CLOCK_MODE0; /* Enable Mode 0 */
+ spiCfg.DataOrder = SPI_DATA_MSB_FIRST; /* Transmit MSB first */
+ /* Slave select polarity is active low */
+ spiCfg.SSELPol = (SPI_CFG_SPOL0_LO | SPI_CFG_SPOL1_LO | SPI_CFG_SPOL2_LO | SPI_CFG_SPOL3_LO);
+ Chip_SPI_SetConfig(LPC_SPI0, &spiCfg);
+ /* Set Delay register */
+ spiDelayCfg.PreDelay = 2;
+ spiDelayCfg.PostDelay = 2;
+ spiDelayCfg.FrameDelay = 2;
+ spiDelayCfg.TransferDelay = 2;
+ Chip_SPI_DelayConfig(LPC_SPI0, &spiDelayCfg);
+ /* Enable Loopback mode for this example */
+ Chip_SPI_EnableLoopBack(LPC_SPI0);
+ /* Enable SPI0 */
+ Chip_SPI_Enable(LPC_SPI0);
+}
+
+/* Master SPI transmit in polling mode */
+static void WriteSpiMssg(uint16_t *xferPtr, uint32_t xferSize)
+{
+ uint8_t i;
+ /* Setup Transfer structure, this data should be retained for the entire transmission */
+ XferSetup.pTx = xferArray; /* Transmit Buffer */
+ XferSetup.pRx = rx_buff;/* Receive Buffer */
+ XferSetup.DataSize = sizeof(xferArray[0]) * 8; /* Data size in bits */
+ XferSetup.Length = sizeof(xferArray) / sizeof(xferArray[0]); /* Total frame length */
+ /* Assert only SSEL0 */
+ XferSetup.ssel = SPI_TXCTL_ASSERT_SSEL0 | SPI_TXCTL_DEASSERT_SSEL1 | SPI_TXCTL_DEASSERT_SSEL2 |
+ SPI_TXCTL_DEASSERT_SSEL3;
+ XferSetup.TxCnt = 0;
+ XferSetup.RxCnt = 0;
+ /* Transfer message as SPI master via polling */
+ if (Chip_SPI_RWFrames_Blocking(LPC_SPI0, &XferSetup) > 0) {
+ /* If transmit successful then verify received data */
+ for (i = 0; i < sizeof(xferArray) / sizeof(xferArray[0]); i++) {
+ if (rx_buff[i] != xferArray[i]) {
+ errorSPI();
+ }
+ }
+ }
+ else {
+ /* Signal SPI error */
+ errorSPI();
+ }
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Main routine for SPI example
+ * @return Function should not exit
+ */
+int main(void)
+{
+ /* Generic Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ /* Clear activity LED */
+ Board_LED_Set(0, false);
+
+ /* Setup SPI pin muxing */
+ Init_SPI_PinMux();
+
+ /* Allocate SPI handle, setup rate, and initialize clocking */
+ setupSpiMaster();
+
+ /* Loop forever */
+ while (1) {
+ /* Write simple message over SPI */
+ WriteSpiMssg(xferArray, sizeof(xferArray) / sizeof(xferArray[0]));
+
+ /* Toggle LED to show activity. */
+ Board_LED_Toggle(0);
+ }
+
+ /* Code never reaches here. Only used to satisfy standard main() */
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_polling/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_polling/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_polling/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt/.cproject
new file mode 100644
index 0000000..824f400
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1739124968">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1739124968" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1739124968" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1739124968." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.1574857802" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1798994384" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_spi_rom_interrupt}/Debug" id="com.crt.advproject.builder.exe.debug.1194693127" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.51268834" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1355916031" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.2090569053" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.347998659" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1850297667" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1036362129" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1695658046" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.584859709" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.506122598" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.91587166" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1987101250" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.670845114" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.65102448" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1454564802" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1102394567" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.2015634599" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.2082171652" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1108042492" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1928634329" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1983834708" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.2134510405" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_spi_rom_interrupt_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.983687527" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.537085047" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.79423815" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.657884819" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.266401103" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.57940887" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.921181293" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.449014981">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.449014981" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.449014981" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.449014981." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.1601290078" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1209078823" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_spi_rom_interrupt}/Release" id="com.crt.advproject.builder.exe.release.1892051127" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.2125192321" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.884248320" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.1608383704" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.997807163" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.2115753718" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1724976594" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1191212056" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1676612227" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.60998306" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1166041755" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1404126802" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.974220980" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.602162756" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1324104930" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1734123170" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.933980654" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.377211777" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.703930889" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1692113877" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1768313768" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.35807151" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_spi_rom_interrupt_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1628637446" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.2000276238" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1147978342" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.975837640" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.335717997" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.636331370" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.389287507" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_spi_rom_interrupt.com.crt.advproject.projecttype.exe.1302562961" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt/.project
new file mode 100644
index 0000000..0a4c0b2
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_spi_rom_interrupt</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt/example/readme.dox
new file mode 100644
index 0000000..8893b76
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt/example/readme.dox
@@ -0,0 +1,60 @@
+/*
+ * @brief SPI bus master example using the ROM API and interrupt mode
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_SPIROMPINT LPC15xx SPI bus master (interrupt) example using the ROM API
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * This example shows how to configure SPI as a bus master in interrupt mode using
+ * the ROM-based APIs.<br>
+ *
+ * This example transmits an array of uint16_t values (0x1111, 0x2222, 0x3333, 0x4444) as SPI master
+ * using interrupt mode. The SPI is configured to be in loop back mode and the received data is compared
+ * against the transmitted data, if they match the transmission is repeated and the LED 0 keeps flickering
+ * In case of any error or mismatch in received and transmitted data, LED 0 will stay On.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt/example/src/periph_spi_rom_interrupt.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt/example/src/periph_spi_rom_interrupt.c
new file mode 100644
index 0000000..0b1be30
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt/example/src/periph_spi_rom_interrupt.c
@@ -0,0 +1,232 @@
+/*
+ * @brief SPI bus master example using the ROM API in interrupt mode
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* SPI master handle and memory for ROM API */
+static SPI_HANDLE_T *spiHandleMaster;
+
+/* Use a buffer size larger than the expected return value of
+ spi_get_mem_size() for the static SPI handle type */
+static uint32_t spiMasterHandleMEM[0x20];
+
+static uint16_t xferArray[] = {0x1111, 0x2222, 0x3333, 0x4444};
+static uint16_t rx_buff[sizeof(xferArray) / sizeof(uint16_t)];
+
+/* Interrupt error code (used as semaphore) */
+static volatile int intErrCode;
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Initializes pin muxing for SPI interface - note that SystemInit() may
+ already setup your pin muxing at system startup */
+static void Init_SPI_PinMux(void)
+{
+#if (defined(BOARD_NXP_LPCXPRESSO_1549))
+
+ /* Enable the clock to the Switch Matrix */
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
+ /*
+ * Initialize SPI0 pins connect
+ * SCK0: PINASSIGN3[15:8]: Select P0.0
+ * MOSI0: PINASSIGN3[23:16]: Select P0.16
+ * MISO0: PINASSIGN3[31:24] : Select P0.10
+ * SSEL0: PINASSIGN4[7:0]: Select P0.9
+ */
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 0, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 16, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 10, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 9, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+
+ Chip_SWM_MovablePinAssign(SWM_SPI0_SCK_IO, 0); /* P0.0 */
+ Chip_SWM_MovablePinAssign(SWM_SPI0_MOSI_IO, 16);/* P0.16 */
+ Chip_SWM_MovablePinAssign(SWM_SPI0_MISO_IO, 10);/* P0.10 */
+ Chip_SWM_MovablePinAssign(SWM_SPI0_SSELSN_0_IO, 9); /* P0.9 */
+
+ /* Disable the clock to the Switch Matrix to save power */
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM);
+#else
+ /* Configure your own SPI pin muxing here if needed */
+#warning "No SPI pin muxing defined"
+#endif
+}
+
+/* Turn on LED to indicate an error */
+static void errorSPI(void)
+{
+ Board_LED_Set(0, true);
+ while (1) {}
+}
+
+/* Setup SPI handle and parameters */
+static void setupSpiMaster()
+{
+ SPI_CONFIG_T spiConfigRec;
+
+ /* Enable SPI clock and reset SPI peripheral - the boot ROM does not
+ do this */
+ Chip_SPI_Init(LPC_SPI0);
+
+ /* Perform a sanity check on the storage allocation */
+ if (LPC_SPID_API->spi_get_mem_size() > sizeof(spiMasterHandleMEM)) {
+ /* Example only: this should never happen and probably isn't needed for
+ most SPI code. */
+ errorSPI();
+ }
+
+ /* Setup the SPI0 handle */
+ spiHandleMaster = LPC_SPID_API->spi_setup(LPC_SPI0_BASE, (uint8_t *) &spiMasterHandleMEM);
+ if (spiHandleMaster == NULL) {
+ errorSPI();
+ }
+ /* Setup SPI0 configuration record */
+ spiConfigRec.delay = 0x2222;
+ /* SysClock divided is set to maximum */
+ spiConfigRec.divider = 0xFFFF;
+ /* Loopback mode, master mode and SPI block enabled */
+ spiConfigRec.config = 0x85;
+ spiConfigRec.error_en = 0;
+
+ /* Init SPI0 */
+ LPC_SPID_API->spi_init(spiHandleMaster, &spiConfigRec);
+}
+
+/* SPI interrupt callback, called on completion of SPI operation when in
+ interrupt mode. Called in interrupt context. */
+static void cbSpiComplete(uint32_t err_code, uint32_t n)
+{
+ uint32_t i;
+ if ((err_code == LPC_OK) && (n == (sizeof(xferArray) / sizeof(xferArray[0])))) {
+ /* Verify if received data is same as transmit */
+ for (i = 0; i < n; i++) {
+ if (rx_buff[i] != xferArray[i]) {
+ errorSPI();
+ }
+ }
+ intErrCode = (int) err_code;
+ }
+ else {
+ /* Signal Error */
+ errorSPI();
+ }
+}
+
+/* Master SPI transmit in interrupt mode */
+static void WriteSpiMssg(uint16_t *xferPtr, uint32_t xferSize)
+{
+ SPI_PARAM_T paramRec;
+
+ /* Init variable used as semaphore */
+ intErrCode = -1;
+
+ /* Setup transfer record */
+ paramRec.tx_buffer = xferPtr; /* SPI TX buffer */
+ paramRec.size = xferSize; /* total number of SPI transfers */
+ paramRec.rx_buffer = rx_buff; /* SPI RX buffer */
+ paramRec.fsize_sel = 0x0F0E0000;/* Set Tx Control for 16 bit transfer, SSEL0 asserted */
+ paramRec.eof_flag = 1; /* End of Frame enabled */
+ paramRec.tx_rx_flag = 2; /* transmit and receive */
+ paramRec.driver_mode = 1; /* interrupt mode */
+ paramRec.dma_cfg = NULL; /* DMA configuration */
+ paramRec.cb = (SPI_CALLBK_T) cbSpiComplete; /* SPI completion callback */
+ paramRec.dma_cb = NULL; /* DMA completion callback */
+
+ /* Transfer message as SPI master via interrupt */
+ if (LPC_SPID_API->spi_master_transfer(spiHandleMaster, ¶mRec) != LPC_OK) {
+ /* Signal SPI error */
+ errorSPI();
+ }
+
+ /* Sleep until transfer is complete, but allow IRQ to wake system
+ to handle SPI IRQ */
+ while (intErrCode == -1) {
+ __WFI();
+ }
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle SPI0 interrupt by calling SPI ROM handler
+ * @return Nothing
+ */
+void SPI0_IRQHandler(void)
+{
+ /* Call SPI ISR function in ROM with the SPI handle */
+ LPC_SPID_API->spi_isr(spiHandleMaster);
+}
+
+/**
+ * @brief Main routine for SPI example
+ * @return Function should not exit
+ */
+int main(void)
+{
+ /* Generic Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ /* Clear activity LED */
+ Board_LED_Set(0, false);
+
+ /* Setup SPI pin muxing */
+ Init_SPI_PinMux();
+
+ /* Allocate SPI handle, setup rate, and initialize clocking */
+ setupSpiMaster();
+
+ /* Enable SPI0 interrupt */
+ NVIC_EnableIRQ(SPI0_IRQn);
+
+ /* Loop forever */
+ while (1) {
+ /* Write simple message over SPI */
+ WriteSpiMssg(xferArray, sizeof(xferArray) / sizeof(xferArray[0]));
+
+ /* Toggle LED to show activity. */
+ Board_LED_Toggle(0);
+ }
+
+ /* Code never reaches here. Only used to satisfy standard main() */
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt_slave/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt_slave/.cproject
new file mode 100644
index 0000000..5d5108e
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt_slave/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1885470335">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1885470335" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1885470335" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1885470335." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.1171677416" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.983436611" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_spi_rom_interrupt_slave}/Debug" id="com.crt.advproject.builder.exe.debug.885675750" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1857648810" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.264287107" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.479642951" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1833901710" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1497756969" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.451421745" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.203827776" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.217335566" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1707533961" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.1667731110" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1363395632" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1937630459" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1525438787" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1487399986" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1525620028" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1048501558" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1350373993" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1819144469" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.2040335620" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1160366024" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1024064531" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_spi_rom_interrupt_slave_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1461898801" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.453377774" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1592338475" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.615383965" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1443282971" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1104241613" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.397506712" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.225227003">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.225227003" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.225227003" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.225227003." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.1659710382" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1540340144" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_spi_rom_interrupt_slave}/Release" id="com.crt.advproject.builder.exe.release.87810703" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.2110462771" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.1959321338" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.888143353" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1784907150" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1081635760" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.761478331" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1864793404" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.825634637" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1104685288" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1823393497" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1171448320" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.170697639" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.226142765" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1869278174" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1583130814" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.658562108" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.1004990221" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.294689322" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1549857235" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1780862535" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1571732219" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_spi_rom_interrupt_slave_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1530119884" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1500951512" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.333430052" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.848831533" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1769393931" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1779155393" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1279907589" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_spi_rom_interrupt_slave.com.crt.advproject.projecttype.exe.1565812813" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt_slave/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt_slave/.project
new file mode 100644
index 0000000..7775a84
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt_slave/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_spi_rom_interrupt_slave</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt_slave/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt_slave/example/readme.dox
new file mode 100644
index 0000000..97f79f4
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt_slave/example/readme.dox
@@ -0,0 +1,65 @@
+/*
+ * @brief SPI bus slave example using the ROM API via interrupts
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_SPISLAVEINT LPC15xx SPI bus slave (interrupt) example using the ROM API
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * This example shows how to configure SPI as a bus slave in interrupt mode using
+ * the ROM-based APIs.<br>
+ *
+ * This example configures SPI as a slave to read an array of 4 words of 16 bits using interrupt mode.
+ * The received data is output through the Debug UART port.
+ * To test the example a SPI master needs to be connected, the SPI master needs to keep transmitting
+ * the 4 words which will be outputted on the UART port of the slave. Since the slave transmits the received
+ * SPI data on UART, the master should allow sufficient (around 10ms) delay between each transfer. <br>
+ *
+ * <b>Special connection requirements</b><br>
+ * A SPI master should be connected to test this example the SPI connections are as below: <br>
+ * SCK - P0.0 - J2 pin7 on Expresso board <br>
+ * MOSI - P0.16 - J2 pin5 on Expresso board <br>
+ * MISO - P0.10 - J2 pin4 on Expresso board <br>
+ * SSEL0 - P0.9 - J2 pin3 on Expresso board <br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt_slave/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt_slave/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt_slave/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt_slave/example/src/periph_spi_rom_interrupt_slave.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt_slave/example/src/periph_spi_rom_interrupt_slave.c
new file mode 100644
index 0000000..30e59fc
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt_slave/example/src/periph_spi_rom_interrupt_slave.c
@@ -0,0 +1,227 @@
+/*
+ * @brief SPI bus slave example using the ROM API in interrupt mode
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+#define SPI_RX_BUFFER_SIZE 4
+/* SPI slave handle and memory for ROM API */
+static SPI_HANDLE_T *spiHandleSlave;
+
+/* Use a buffer size larger than the expected return value of
+ spi_get_mem_size() for the static SPI handle type */
+static uint32_t spiSlaveHandleMEM[0x20];
+/* Receive Buffer for SPI */
+static uint16_t rx_buff[SPI_RX_BUFFER_SIZE];
+
+/* Interrupt error code (used as semaphore) */
+static volatile int intErrCode;
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Initializes pin muxing for SPI interface - note that SystemInit() may
+ already setup your pin muxing at system startup */
+static void Init_SPI_PinMux(void)
+{
+#if (defined(BOARD_NXP_LPCXPRESSO_1549))
+ /* Enable the clock to the Switch Matrix */
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
+ /*
+ * Initialize SPI0 pins connect
+ * SCK0: PINASSIGN3[15:8]: Select P0.0
+ * MOSI0: PINASSIGN3[23:16]: Select P0.16
+ * MISO0: PINASSIGN3[31:24] : Select P0.10
+ * SSEL0: PINASSIGN4[7:0]: Select P0.9
+ */
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 0, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 16, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 10, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 9, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+
+ Chip_SWM_MovablePinAssign(SWM_SPI0_SCK_IO, 0); /* P0.0 */
+ Chip_SWM_MovablePinAssign(SWM_SPI0_MOSI_IO, 16);/* P0.16 */
+ Chip_SWM_MovablePinAssign(SWM_SPI0_MISO_IO, 10);/* P0.10 */
+ Chip_SWM_MovablePinAssign(SWM_SPI0_SSELSN_0_IO, 9); /* P0.9 */
+
+ /* Disable the clock to the Switch Matrix to save power */
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM);
+#else
+ /* Configure your own SPI pin muxing here if needed */
+#warning "No SPI pin muxing defined"
+#endif
+}
+
+/* Turn on LED to indicate an error */
+static void errorSPI(void)
+{
+ Board_LED_Set(0, true);
+ while (1) {}
+}
+
+/* Setup SPI handle and parameters */
+static void setupSpiSlave()
+{
+ SPI_CONFIG_T spiConfigRec;
+
+ /* Enable SPI clock and reset SPI peripheral - the boot ROM does not
+ do this */
+ Chip_SPI_Init(LPC_SPI0);
+
+ /* Perform a sanity check on the storage allocation */
+ if (LPC_SPID_API->spi_get_mem_size() > sizeof(spiSlaveHandleMEM)) {
+ /* Example only: this should never happen and probably isn't needed for
+ most SPI code. */
+ errorSPI();
+ }
+
+ /* Setup the SPI0 handle */
+ spiHandleSlave = LPC_SPID_API->spi_setup(LPC_SPI0_BASE, (uint8_t *) &spiSlaveHandleMEM);
+ if (spiHandleSlave == NULL) {
+ errorSPI();
+ }
+ /* Setup SPI0 configuration record */
+ /* Delay doesn't matter for slave it is not used */
+ spiConfigRec.delay = 0;
+ /* SysClock divider is not used for slave */
+ spiConfigRec.divider = 0;
+ /* slave mode and SPI block enabled */
+ spiConfigRec.config = 0x01;
+ spiConfigRec.error_en = 0;
+
+ /* Init SPI0 */
+ LPC_SPID_API->spi_init(spiHandleSlave, &spiConfigRec);
+}
+
+/* SPI interrupt callback, called on completion of SPI operation when in
+ interrupt mode. Called in interrupt context. */
+static void cbSpiComplete(uint32_t err_code, uint32_t n)
+{
+ if ((err_code == LPC_OK) && (n == SPI_RX_BUFFER_SIZE)) {
+ /* Change intErrCode only if receive is successful */
+ intErrCode = (int) err_code;
+ }
+ else {
+ errorSPI();
+ }
+}
+
+/* Slave SPI Receive in interrupt mode */
+static void ReadSpiMssg(uint16_t *xferPtr, uint32_t xferSize)
+{
+ SPI_PARAM_T paramRec;
+
+ /* Init variable used as semaphore */
+ intErrCode = -1;
+
+ paramRec.tx_buffer = NULL; /* SPI TX buffer */
+ paramRec.size = xferSize; /* total number of SPI transfers */
+ paramRec.rx_buffer = xferPtr; /* SPI RX buffer */
+ paramRec.fsize_sel = 0x0F000000;/* Set Tx Control for 16 bit transfer, SSEL doesn't matter */
+ paramRec.eof_flag = 0; /* End of Frame doesn't matter for slave */
+ paramRec.tx_rx_flag = 1; /* Receive only */
+ paramRec.driver_mode = 1; /* interrupt mode */
+ paramRec.dma_cfg = NULL; /* DMA configuration */
+ paramRec.cb = (SPI_CALLBK_T) cbSpiComplete; /* SPI completion callback */
+ paramRec.dma_cb = NULL; /* DMA completion callback */
+
+ /* Setup reception as SPI slave via interrupt */
+ if (LPC_SPID_API->spi_slave_transfer(spiHandleSlave, ¶mRec) != LPC_OK) {
+ /* Signal SPI error */
+ errorSPI();
+ }
+
+ /* Sleep until transfer is complete, but allow IRQ to wake system
+ to handle SPI IRQ */
+ while (intErrCode == -1) {
+ __WFI();
+ }
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle SPI0 interrupt by calling SPI ROM handler
+ * @return Nothing
+ */
+void SPI0_IRQHandler(void)
+{
+ /* Call SPI ISR function in ROM with the SPI handle */
+ LPC_SPID_API->spi_isr(spiHandleSlave);
+}
+
+/**
+ * @brief Main routine for SPI example
+ * @return Function should not exit
+ */
+int main(void)
+{
+ uint8_t i;
+ /* Generic Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ /* Clear activity LED */
+ Board_LED_Set(0, false);
+
+ /* Setup SPI pin muxing */
+ Init_SPI_PinMux();
+
+ /* Allocate SPI handle, setup rate, and initialize clocking */
+ setupSpiSlave();
+
+ /* Enable SPI0 interrupt */
+ NVIC_EnableIRQ(SPI0_IRQn);
+
+ /* Loop forever */
+ while (1) {
+ /* Read simple message over SPI */
+ ReadSpiMssg(rx_buff, SPI_RX_BUFFER_SIZE);
+ for (i = 0; i < SPI_RX_BUFFER_SIZE; i++) {
+ DEBUGOUT("SPI Read Data %d is %x\r\n", i, rx_buff[i]);
+ }
+
+ /* Toggle LED to show activity. */
+ Board_LED_Toggle(0);
+ }
+
+ /* Code never reaches here. Only used to satisfy standard main() */
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt_slave/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt_slave/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_interrupt_slave/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling/.cproject
new file mode 100644
index 0000000..38a73cb
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1415325601">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1415325601" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1415325601" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1415325601." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.1779823233" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.645063391" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_spi_rom_polling}/Debug" id="com.crt.advproject.builder.exe.debug.1328377398" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.64932996" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1555294883" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.1876819459" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1723579355" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.482563523" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1685341334" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.2127441249" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1545228229" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.2043219725" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.516177727" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1772871756" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1039134747" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.531398615" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.125765538" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1515693823" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.464711763" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1831222276" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.167065798" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1675994427" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.126265826" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.778602854" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_spi_rom_polling_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.813869735" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1910964498" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1755185204" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1316254269" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1650791116" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.624091652" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.456826195" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.1628093494">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.1628093494" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.1628093494" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.1628093494." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.207285716" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1373753808" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_spi_rom_polling}/Release" id="com.crt.advproject.builder.exe.release.503868142" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.1087328791" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.23317121" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.1846789861" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1546111141" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1464821666" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1359410371" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.2085485224" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.546693804" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1079485652" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.622597835" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1208776528" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1940875613" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1803368712" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.821373475" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1941523181" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.936871271" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.698954468" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.544408604" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.87446014" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1772763024" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1363046511" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_spi_rom_polling_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.675823847" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.196304088" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.831707792" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.311599960" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1871309759" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.933565353" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1426088969" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_spi_rom_polling.com.crt.advproject.projecttype.exe.228047814" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling/.project
new file mode 100644
index 0000000..88a7d83
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_spi_rom_polling</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling/example/readme.dox
new file mode 100644
index 0000000..7529236
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling/example/readme.dox
@@ -0,0 +1,60 @@
+/*
+ * @brief SPI bus master example using the ROM API via polling
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_SPIROMPOLL LPC15xx SPI bus master (polling) example using the ROM API
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * This example shows how to configure SPI as a bus master in polling mode using
+ * the ROM-based APIs.<br>
+ *
+ * This example transmits an array of uint16_t values (0x1111, 0x2222, 0x3333, 0x4444) as SPI master
+ * using polling mode. The SPI is configured to be in loop back mode and the received data is compared
+ * against the transmitted data, if they match the transmission is repeated and the LED 0 keeps flickering
+ * In case of any error or mismatch in received and transmitted data, LED 0 will stay On.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling/example/src/periph_spi_rom_polling.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling/example/src/periph_spi_rom_polling.c
new file mode 100644
index 0000000..60d423d
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling/example/src/periph_spi_rom_polling.c
@@ -0,0 +1,196 @@
+/*
+ * @brief SPI bus master example using the ROM API in polling mode
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* SPI master handle and memory for ROM API */
+static SPI_HANDLE_T *spiHandleMaster;
+
+/* Use a buffer size larger than the expected return value of
+ spi_get_mem_size() for the static SPI handle type */
+static uint32_t spiMasterHandleMEM[0x20];
+
+static uint16_t xferArray[] = {0x1111, 0x2222, 0x3333, 0x4444};
+static uint16_t rx_buff[sizeof(xferArray) / sizeof(uint16_t)];
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Initializes pin muxing for SPI interface - note that SystemInit() may
+ already setup your pin muxing at system startup */
+static void Init_SPI_PinMux(void)
+{
+#if (defined(BOARD_NXP_LPCXPRESSO_1549))
+
+ /* Enable the clock to the Switch Matrix */
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
+ /*
+ * Initialize SPI0 pins connect
+ * SCK0: PINASSIGN3[15:8]: Select P0.0
+ * MOSI0: PINASSIGN3[23:16]: Select P0.16
+ * MISO0: PINASSIGN3[31:24] : Select P0.10
+ * SSEL0: PINASSIGN4[7:0]: Select P0.9
+ */
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 0, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 16, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 10, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 9, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+
+ Chip_SWM_MovablePinAssign(SWM_SPI0_SCK_IO, 0); /* P0.0 */
+ Chip_SWM_MovablePinAssign(SWM_SPI0_MOSI_IO, 16);/* P0.16 */
+ Chip_SWM_MovablePinAssign(SWM_SPI0_MISO_IO, 10);/* P0.10 */
+ Chip_SWM_MovablePinAssign(SWM_SPI0_SSELSN_0_IO, 9); /* P0.9 */
+
+ /* Disable the clock to the Switch Matrix to save power */
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM);
+#else
+ /* Configure your own SPI pin muxing here if needed */
+#warning "No SPI pin muxing defined"
+#endif
+}
+
+/* Turn on LED to indicate an error */
+static void errorSPI(void)
+{
+ Board_LED_Set(0, true);
+ while (1) {}
+}
+
+/* Setup SPI handle and parameters */
+static void setupSpiMaster()
+{
+ SPI_CONFIG_T spiConfigRec;
+
+ /* Enable SPI clock and reset SPI peripheral - the boot ROM does not
+ do this */
+ Chip_SPI_Init(LPC_SPI0);
+
+ /* Perform a sanity check on the storage allocation */
+ if (LPC_SPID_API->spi_get_mem_size() > sizeof(spiMasterHandleMEM)) {
+ /* Example only: this should never happen and probably isn't needed for
+ most SPI code. */
+ errorSPI();
+ }
+
+ /* Setup the SPI0 handle */
+ spiHandleMaster = LPC_SPID_API->spi_setup(LPC_SPI0_BASE, (uint8_t *) &spiMasterHandleMEM);
+ if (spiHandleMaster == NULL) {
+ errorSPI();
+ }
+ /* Setup SPI0 configuration record */
+ spiConfigRec.delay = 0x2222;
+ /* SysClock divider is set to maximum */
+ spiConfigRec.divider = 0xFFFF;
+ /* Loopback mode, master mode and SPI block enabled */
+ spiConfigRec.config = 0x85;
+ spiConfigRec.error_en = 0;
+
+ /* Init SPI0 */
+ LPC_SPID_API->spi_init(spiHandleMaster, &spiConfigRec);
+}
+
+/* Master SPI transmit in polling mode */
+static void WriteSpiMssg(uint16_t *xferPtr, uint32_t xferSize)
+{
+ SPI_PARAM_T paramRec;
+ uint8_t i;
+
+ /* Setup transfer record */
+ paramRec.tx_buffer = xferPtr; /* SPI TX buffer */
+ paramRec.size = xferSize; /* total number of SPI transfers */
+ paramRec.rx_buffer = rx_buff; /* SPI RX buffer */
+ paramRec.fsize_sel = 0x0F0E0000;/* Set Tx Control for 16 bit transfer, SSEL0 asserted */
+ paramRec.eof_flag = 1; /* End of Frame enabled */
+ paramRec.tx_rx_flag = 2; /* transmit and receive */
+ paramRec.driver_mode = 0; /* polling mode */
+ paramRec.dma_cfg = NULL; /* DMA configuration */
+ paramRec.cb = NULL; /* SPI completion callback */
+ paramRec.dma_cb = NULL; /* DMA completion callback */
+
+ /* Transfer message as SPI master via polling */
+ if (LPC_SPID_API->spi_master_transfer(spiHandleMaster, ¶mRec) == LPC_OK) {
+ /* If transmit successful then verify received data */
+ for (i = 0; i < sizeof(xferArray) / sizeof(uint16_t); i++) {
+ if (rx_buff[i] != xferArray[i]) {
+ errorSPI();
+ }
+ }
+ }
+ else {
+ /* Signal SPI error */
+ errorSPI();
+ }
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Main routine for SPI example
+ * @return Function should not exit
+ */
+int main(void)
+{
+ /* Generic Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ /* Clear activity LED */
+ Board_LED_Set(0, false);
+
+ /* Setup SPI pin muxing */
+ Init_SPI_PinMux();
+
+ /* Allocate SPI handle, setup rate, and initialize clocking */
+ setupSpiMaster();
+
+ /* Loop forever */
+ while (1) {
+ /* Write simple message over SPI */
+ WriteSpiMssg(xferArray, sizeof(xferArray) / sizeof(uint16_t));
+
+ /* Toggle LED to show activity. */
+ Board_LED_Toggle(0);
+ }
+
+ /* Code never reaches here. Only used to satisfy standard main() */
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling_slave/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling_slave/.cproject
new file mode 100644
index 0000000..e70714d
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling_slave/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.2146622157">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.2146622157" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.2146622157" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.2146622157." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.1519642003" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1810579842" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_spi_rom_polling_slave}/Debug" id="com.crt.advproject.builder.exe.debug.334649365" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.764272403" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.799785244" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.1883212265" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1204194948" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.603600560" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1934524025" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.86244136" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1353113687" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1965380820" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.452828959" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1574133189" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1186049335" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.74999034" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.540090436" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.735470880" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1841533641" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1987789785" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1345332678" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1465894667" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.104126171" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.857135038" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_spi_rom_polling_slave_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1258984011" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.744020155" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.888724400" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.667851321" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1768768871" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.2093305383" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.603344914" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.1400619430">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.1400619430" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.1400619430" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.1400619430." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.1762775918" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.2054986527" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_spi_rom_polling_slave}/Release" id="com.crt.advproject.builder.exe.release.1716670415" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.115951585" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.822894331" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.641167880" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1829139209" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1929963612" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1466992401" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.861399251" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1950419225" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.977106131" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.545285703" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.2075116620" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.253268871" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.352328258" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.2091598091" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.731427625" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.187114392" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.1896152654" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1928449310" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.495044801" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1950635621" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1073214969" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_spi_rom_polling_slave_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.330398292" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1129270549" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.655143941" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.190782634" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.421618154" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.582451817" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.60313486" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_spi_rom_polling_slave.com.crt.advproject.projecttype.exe.1297332096" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling_slave/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling_slave/.project
new file mode 100644
index 0000000..bf8fe1d
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling_slave/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_spi_rom_polling_slave</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling_slave/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling_slave/example/readme.dox
new file mode 100644
index 0000000..1b86dd5
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling_slave/example/readme.dox
@@ -0,0 +1,65 @@
+/*
+ * @brief SPI bus slave example using the ROM API in polling mode
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_SPISLAVEPOLL LPC15xx SPI bus slave (polling) example using the ROM API
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * This example shows how to configure SPI as a bus slave in polling mode using
+ * the ROM-based APIs.<br>
+ *
+ * This example configures SPI as a slave to read an array of 4 words of 16 bits using polling mode.
+ * The received data is output through the Debug UART port.
+ * To test the example a SPI master needs to be connected, the SPI master needs to keep transmitting
+ * the 4 words which will be outputted on the UART port of the slave. Since the slave transmits the received
+ * SPI data on UART, the master should allow sufficient (around 10ms) delay between each transfer. <br>
+ *
+* <b>Special connection requirements</b><br>
+ * A SPI master should be connected to test this example the SPI connections are as below: <br>
+ * SCK - P0.0 - J2 pin7 on Expresso board <br>
+ * MOSI - P0.16 - J2 pin5 on Expresso board <br>
+ * MISO - P0.10 - J2 pin4 on Expresso board <br>
+ * SSEL0 - P0.9 - J2 pin3 on Expresso board <br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling_slave/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling_slave/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling_slave/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling_slave/example/src/periph_spi_rom_polling_slave.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling_slave/example/src/periph_spi_rom_polling_slave.c
new file mode 100644
index 0000000..c8cc1a4
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling_slave/example/src/periph_spi_rom_polling_slave.c
@@ -0,0 +1,190 @@
+/*
+ * @brief SPI bus slave example using the ROM API in polling mode
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2014
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+#define SPI_RX_BUFFER_SIZE 4
+/* SPI slave handle and memory for ROM API */
+static SPI_HANDLE_T *spiHandleSlave;
+
+/* Use a buffer size larger than the expected return value of
+ spi_get_mem_size() for the static SPI handle type */
+static uint32_t spiSlaveHandleMEM[0x20];
+/* Receive Buffer for SPI */
+static uint16_t rx_buff[SPI_RX_BUFFER_SIZE];
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Initializes pin muxing for SPI interface - note that SystemInit() may
+ already setup your pin muxing at system startup */
+static void Init_SPI_PinMux(void)
+{
+#if (defined(BOARD_NXP_LPCXPRESSO_1549))
+ /* Enable the clock to the Switch Matrix */
+ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
+ /*
+ * Initialize SPI0 pins connect
+ * SCK0: PINASSIGN3[15:8]: Select P0.0
+ * MOSI0: PINASSIGN3[23:16]: Select P0.16
+ * MISO0: PINASSIGN3[31:24] : Select P0.10
+ * SSEL0: PINASSIGN4[7:0]: Select P0.9
+ */
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 0, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 16, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 10, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 9, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+
+ Chip_SWM_MovablePinAssign(SWM_SPI0_SCK_IO, 0); /* P0.0 */
+ Chip_SWM_MovablePinAssign(SWM_SPI0_MOSI_IO, 16);/* P0.16 */
+ Chip_SWM_MovablePinAssign(SWM_SPI0_MISO_IO, 10);/* P0.10 */
+ Chip_SWM_MovablePinAssign(SWM_SPI0_SSELSN_0_IO, 9); /* P0.9 */
+
+ /* Disable the clock to the Switch Matrix to save power */
+ Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM);
+#else
+ /* Configure your own SPI pin muxing here if needed */
+#warning "No SPI pin muxing defined"
+#endif
+}
+
+/* Turn on LED to indicate an error */
+static void errorSPI(void)
+{
+ Board_LED_Set(0, true);
+ while (1) {}
+}
+
+/* Setup SPI handle and parameters */
+static void setupSpiSlave()
+{
+ SPI_CONFIG_T spiConfigRec;
+
+ /* Enable SPI clock and reset SPI peripheral - the boot ROM does not
+ do this */
+ Chip_SPI_Init(LPC_SPI0);
+
+ /* Perform a sanity check on the storage allocation */
+ if (LPC_SPID_API->spi_get_mem_size() > sizeof(spiSlaveHandleMEM)) {
+ /* Example only: this should never happen and probably isn't needed for
+ most SPI code. */
+ errorSPI();
+ }
+
+ /* Setup the SPI0 handle */
+ spiHandleSlave = LPC_SPID_API->spi_setup(LPC_SPI0_BASE, (uint8_t *) &spiSlaveHandleMEM);
+ if (spiHandleSlave == NULL) {
+ errorSPI();
+ }
+ /* Setup SPI0 configuration record */
+ /* Delay doesn't matter for slave it is not used */
+ spiConfigRec.delay = 0;
+ /* SysClock divider is not used for slave */
+ spiConfigRec.divider = 0;
+ /* slave mode and SPI block enabled */
+ spiConfigRec.config = 0x01;
+ spiConfigRec.error_en = 0;
+
+ /* Init SPI0 */
+ LPC_SPID_API->spi_init(spiHandleSlave, &spiConfigRec);
+}
+
+/* Slave SPI Receive in interrupt mode */
+static void ReadSpiMssg(uint16_t *xferPtr, uint32_t xferSize)
+{
+ SPI_PARAM_T paramRec;
+
+ paramRec.tx_buffer = NULL; /* SPI TX buffer */
+ paramRec.size = xferSize; /* total number of SPI transfers */
+ paramRec.rx_buffer = xferPtr; /* SPI RX buffer */
+ paramRec.fsize_sel = 0x0F000000;/* Set Tx Control for 16 bit transfer, SSEL doesn't matter */
+ paramRec.eof_flag = 0; /* End of Frame doesn't matter for slave */
+ paramRec.tx_rx_flag = 1; /* Receive only */
+ paramRec.driver_mode = 0; /* polling mode */
+ paramRec.dma_cfg = NULL; /* DMA configuration */
+ paramRec.cb = NULL; /* SPI completion callback */
+ paramRec.dma_cb = NULL; /* DMA completion callback */
+
+ /* Transfer message as SPI slave via polling */
+ if (LPC_SPID_API->spi_slave_transfer(spiHandleSlave, ¶mRec) != LPC_OK) {
+ /* Signal SPI error */
+ errorSPI();
+ }
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Main routine for SPI example
+ * @return Function should not exit
+ */
+int main(void)
+{
+ uint8_t i;
+ /* Generic Initialization */
+ SystemCoreClockUpdate();
+ Board_Init();
+
+ /* Clear activity LED */
+ Board_LED_Set(0, false);
+
+ /* Setup SPI pin muxing */
+ Init_SPI_PinMux();
+
+ /* Allocate SPI handle, setup rate, and initialize clocking */
+ setupSpiSlave();
+
+ /* Loop forever */
+ while (1) {
+ /* Read simple message over SPI */
+ ReadSpiMssg(rx_buff, SPI_RX_BUFFER_SIZE);
+ for (i = 0; i < SPI_RX_BUFFER_SIZE; i++) {
+ DEBUGOUT("SPI Read Data %d is %x\r\n", i, rx_buff[i]);
+ }
+
+ /* Toggle LED to show activity. */
+ Board_LED_Toggle(0);
+ }
+
+ /* Code never reaches here. Only used to satisfy standard main() */
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling_slave/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling_slave/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_spi_rom_polling_slave/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_systick/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_systick/.cproject
new file mode 100644
index 0000000..af2af29
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_systick/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.833720657">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.833720657" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.833720657" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.833720657." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.2001540272" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1031312937" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_systick}/Debug" id="com.crt.advproject.builder.exe.debug.1481618183" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.512821270" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1730784887" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.416840271" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.781660434" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.141662164" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.998315412" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1426677532" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.163724116" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.552551239" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.951411025" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1737504413" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.203630016" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.2108652910" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.476956657" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.2122022277" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1549309803" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1088316356" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1537917916" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.448954028" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.138859400" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.467471529" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_systick_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1422900090" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1433602253" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.860544640" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.2136868829" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.67740905" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.777387494" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.245597914" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.1080003168">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.1080003168" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.1080003168" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.1080003168." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.1309591526" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1283294587" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_systick}/Release" id="com.crt.advproject.builder.exe.release.1686854122" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.943745900" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.126732500" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.83308542" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.541963495" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.215151318" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.28242803" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1439720113" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.965874903" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1474677978" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1945019471" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.914278988" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.2029533766" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1820737330" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.973585014" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1913060907" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.575566382" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.1037645061" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.414725356" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1915049020" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1884072195" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.571734642" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_systick_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.656003759" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.2138919002" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.2093504323" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1689227001" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.15362420" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.28624870" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.490892526" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_systick.com.crt.advproject.projecttype.exe.1934758526" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_systick/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_systick/.project
new file mode 100644
index 0000000..b21d663
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_systick/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_systick</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_systick/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_systick/example/readme.dox
new file mode 100644
index 0000000..71f5a95
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_systick/example/readme.dox
@@ -0,0 +1,68 @@
+/*
+ * @brief Systick example using systick timer, the SYSTICK clock divider, and the LED
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_SYSTICK LPC15xx Simple systick example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * The Systick example simply blinks an LED at a periodic rate using the systick
+ * timer and SYSTICK clock divider. The LED state is toggled in the systick
+ * interrupt handler.<br>
+ *
+ * <b>NOTE</b><br>
+ * While one would expect a clock divider to delay an interrupt occurrence this implementation
+ * seems to hasten the interrupt occurrence. For example, if the SYSTICK clock divider is set
+ * to 1, 453 interrupts occur in a 30-second interval. If the SYSTICK clock divider is set
+ * to 2, one would expect to see half the interrupt count however twice the interrupts occure as
+ * though the clock divider were really a clock multiplier.<br>
+ *
+ * <b>NOTE</b><br>
+ * In addition, once the SYSTICK clock divider is set and SYSTICK is enabled, the SYSTICK clock
+ * divider becomes static, changes seem to have no effect. Once the clock was running, the effective
+ * rate could not be changed or the SYSTICK timer clock disabled as described in the UM.
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_systick/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_systick/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_systick/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_systick/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_systick/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_systick/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_systick/example/src/systick.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_systick/example/src/systick.c
new file mode 100644
index 0000000..704c1f3
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_systick/example/src/systick.c
@@ -0,0 +1,96 @@
+/*
+ * @brief Blinky example using timers and sysTick
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include <stdio.h>
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+#define TICKRATE_HZ1 (15) /* 15 ticks per second */
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle interrupt from SysTick timer
+ * @return Nothing
+ */
+void SysTick_Handler(void)
+{
+ Board_LED_Toggle(0);
+ Board_LED_Toggle(1);
+}
+
+/**
+ * @brief main routine for blinky example
+ * @return Function should not exit.
+ */
+int main(void)
+{
+ uint32_t sysTickRate;
+
+ SystemCoreClockUpdate();
+ Board_Init();
+ Board_LED_Set(0, false);
+ Board_LED_Set(1, true);
+
+ /* The sysTick counter only has 24 bits of precision, so it will
+ overflow quickly with a fast core clock. You can alter the
+ sysTick divider to generate slower sysTick clock rates. */
+ Chip_Clock_SetSysTickClockDiv(1);
+
+ /* A SysTick divider is present that scales the sysTick rate down
+ from the core clock. Using the SystemCoreClock variable as a
+ rate reference for the SysTick_Config() function won't work,
+ so get the sysTick rate by calling Chip_Clock_GetSysTickClockRate() */
+ sysTickRate = Chip_Clock_GetSysTickClockRate();
+
+ /* Enable and setup SysTick Timer at a periodic rate */
+ SysTick_Config(sysTickRate / TICKRATE_HZ1);
+
+ /* LEDs toggle in interrupt handlers */
+ while (1) {
+ __WFI();
+ }
+
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_temp/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_temp/.cproject
new file mode 100644
index 0000000..afca7e8
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_temp/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.281852388">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.281852388" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.281852388" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.281852388." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.124203466" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.2020121784" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_temp}/Debug" id="com.crt.advproject.builder.exe.debug.218532132" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1780835837" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.123848742" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.1847277483" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.159819643" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1109128630" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.363356611" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.881636633" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1352822359" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.677626342" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.1350392413" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1747182771" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1468741615" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.52906112" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.167214018" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1321401238" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.181920514" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1425323525" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1165464145" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.517103759" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.820773503" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1177129628" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_temp_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1178788851" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.381230220" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.45329730" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.744266195" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.233888442" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.434385099" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1604985301" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.596925917">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.596925917" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.596925917" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.596925917." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.322961177" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.63650836" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_temp}/Release" id="com.crt.advproject.builder.exe.release.1662169304" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.87688064" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.58257290" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.1280783130" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.66687333" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.80432801" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1111450578" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.878901005" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1127420392" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.251034993" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1420605987" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.430407697" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.729387367" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1795813835" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.2006074601" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1642026502" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1358580424" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.1842375544" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.430638234" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1860572965" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1744035077" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.206418169" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_temp_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1746811652" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.733209019" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1867477697" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1761148513" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.767429282" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.123855926" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.369126911" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_temp.com.crt.advproject.projecttype.exe.993292565" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_temp/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_temp/.project
new file mode 100644
index 0000000..662b65a
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_temp/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_temp</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_temp/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_temp/example/readme.dox
new file mode 100644
index 0000000..f0348c8
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_temp/example/readme.dox
@@ -0,0 +1,64 @@
+/*
+ * @brief LPC15xx ADC example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_TEMP LPC15xx Temperature sensor example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * The LPC15xx temperature sensor example shows how to monitor the
+ * chip temperature using the build-in temperature sensor and ADC.
+ * The ADC is configured to monitor the temperature sensor input and
+ * is sampled by manually starting the ADC sequence from the system
+ * tick interrupt. The sequence then starts and generates an interrupt
+ * when complete.<br>
+ *
+ * Note: The recommended approach to read the temperature sensor
+ * requires using an ADC burst and reading a later sample instead of the
+ * initial sample. This examples uses this approach, but displays both
+ * the later sample and initial sample values for comparison.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_temp/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_temp/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_temp/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_temp/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_temp/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_temp/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_temp/example/src/temp.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_temp/example/src/temp.c
new file mode 100644
index 0000000..c9014cd
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_temp/example/src/temp.c
@@ -0,0 +1,209 @@
+/*
+ * @brief LPC11u6x ADC example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include <stdio.h>
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+static volatile bool tempSequenceComplete;
+static volatile int tempSampleIdx;
+
+/* Temperature sample ADC read buffer - only index 9 is used for the valid
+ temperature sample. */
+#define TEMPSAMPLES 10
+static uint32_t temp[TEMPSAMPLES];
+
+#define TICKRATE_HZ (100) /* 100 ticks per second */
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* This starts an ADC temperature sampling sequence using the recommended
+ burst method. It bursts 10 temperature sensor samples via the ADC and
+ then stops the ADC sequencer. The single sequence (non-burst) mode can
+ also be used for ADC temperature sensor read. */
+static void tempStartCycle(void)
+{
+ tempSampleIdx = 0;
+ tempSequenceComplete = false;
+
+ /* Enable burst mode */
+ Chip_ADC_StartBurstSequencer(LPC_ADC0, ADC_SEQA_IDX);
+}
+
+/* Used to indicate when a temperature cycle is complete and the sample
+ is ready */
+static bool tempCycleComplete(void)
+{
+ return tempSequenceComplete;
+}
+
+/* Returns the last temperature sample only. Only valid if tempCycleComplete()
+ returns true */
+static uint32_t tempGetSample(void)
+{
+ tempSequenceComplete = false;
+ return temp[TEMPSAMPLES - 1];
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle interrupt from SysTick timer
+ * @return Nothing
+ */
+void SysTick_Handler(void)
+{
+ static uint32_t count;
+
+ /* Every 1/2 second */
+ count++;
+ if (count >= (TICKRATE_HZ / 1)) {
+ count = 0;
+
+ /* Restart temperature cycle */
+ tempStartCycle();
+ }
+}
+
+/**
+ * @brief Handle interrupt from ADC sequencer A
+ * @return Nothing
+ */
+void ADC0A_IRQHandler(void)
+{
+ uint32_t pending;
+
+ /* Get pending interrupts */
+ pending = Chip_ADC_GetFlags(LPC_ADC0);
+
+ /* Sequence A completion interrupt */
+ if (pending & ADC_FLAGS_SEQA_INT_MASK) {
+ if (tempSampleIdx < TEMPSAMPLES) {
+ /* Save sample */
+ temp[tempSampleIdx] = Chip_ADC_GetDataReg(LPC_ADC0, 0);
+ tempSampleIdx++;
+
+ if (tempSampleIdx >= TEMPSAMPLES) {
+ Chip_ADC_StopBurstSequencer(LPC_ADC0, ADC_SEQA_IDX);
+ tempSequenceComplete = true;
+ }
+ }
+ }
+
+ /* Clear any pending interrupts */
+ Chip_ADC_ClearFlags(LPC_ADC0, pending);
+}
+
+/**
+ * @brief main routine for ADC example
+ * @return Function should not exit
+ */
+int main(void)
+{
+ uint32_t rawSample;
+
+ SystemCoreClockUpdate();
+ Board_Init();
+ DEBUGSTR("Temperature sensor demo\r\n");
+
+ /* Setup ADC for 12-bit mode and normal power */
+ Chip_ADC_Init(LPC_ADC0, 0);
+
+ /* Setup ADC clock rate */
+ Chip_ADC_SetClockRate(LPC_ADC0, 250000);
+
+ /* For ADC0, select temperature sensor for channel 0 on ADC0 */
+ Chip_ADC_SetADC0Input(LPC_ADC0, ADC_INSEL_TS);
+
+ /* Setup a sequencer to do the following:
+ Perform ADC conversion of ADC channels 0 with EOS interrupt */
+ Chip_ADC_SetupSequencer(LPC_ADC0, ADC_SEQA_IDX, (ADC_SEQ_CTRL_CHANSEL(0) |
+ ADC_SEQ_CTRL_MODE_EOS));
+
+ /* Power up the internal temperature sensor - this also selects the
+ temperature sensor as the input for the ADC0 input */
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_TS_PD);
+
+ /* Use higher voltage trim */
+ Chip_ADC_SetTrim(LPC_ADC0, ADC_TRIM_VRANGE_HIGHV);
+
+ /* Need to do a calibration after initialization and trim */
+ Chip_ADC_StartCalibration(LPC_ADC0);
+ while (!(Chip_ADC_IsCalibrationDone(LPC_ADC0))) {}
+
+ /* Clear all pending interrupts */
+ Chip_ADC_ClearFlags(LPC_ADC0, Chip_ADC_GetFlags(LPC_ADC0));
+
+ /* Enable ADC sequence A completion interrupt */
+ Chip_ADC_EnableInt(LPC_ADC0, ADC_INTEN_SEQA_ENABLE);
+
+ /* Enable ADC NVIC interrupt */
+ NVIC_EnableIRQ(ADC0_SEQA_IRQn);
+
+ /* Enable sequencer */
+ Chip_ADC_EnableSequencer(LPC_ADC0, ADC_SEQA_IDX);
+
+ /* This example uses the periodic sysTick to manually trigger
+ the ADC burst cycle */
+ SysTick_Config(SystemCoreClock / TICKRATE_HZ);
+
+ /* Endless loop */
+ while (1) {
+ /* Sleep until something happens */
+ __WFI();
+
+ /* Is a conversion sequence complete? */
+ if (tempCycleComplete()) {
+ rawSample = tempGetSample();
+ if ((rawSample & ADC_SEQ_GDAT_DATAVALID) != 0) {
+ DEBUGOUT("Sampled temp value = 0x%04x (first = 0x%04x)\r", ADC_DR_RESULT(rawSample),
+ ADC_DR_RESULT(temp[0]));
+ }
+ else {
+ DEBUGSTR("\r\nInvalid sample read\r\n");
+ }
+ }
+ }
+
+ /* Should not run to here */
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rb/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rb/.cproject
new file mode 100644
index 0000000..a307851
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rb/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1534346789">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1534346789" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1534346789" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1534346789." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.1630397185" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.556293691" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_uart_rb}/Debug" id="com.crt.advproject.builder.exe.debug.1159581404" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.842011822" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.826587097" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.1138594920" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1183719120" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.612680915" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.399643366" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1343655687" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1586008458" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.495814540" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.733184453" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1133398617" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1609615415" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.296770188" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1015016190" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1369451700" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.11443381" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1397343711" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1777296699" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.529592667" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.586747452" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.715396113" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_uart_rb_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.218602778" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1063629602" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1270903603" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1340618942" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1990826330" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1811764079" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1515917467" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.1902504756">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.1902504756" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.1902504756" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.1902504756." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.771621803" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.189697509" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_uart_rb}/Release" id="com.crt.advproject.builder.exe.release.993229049" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.688125818" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.1719885174" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.138534276" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.694588191" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.2102881776" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.629742131" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.895858209" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.79249739" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.2016235388" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.624786650" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.2134939609" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.704358955" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.372347054" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1612492439" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1063379603" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1388176311" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.299180801" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1827064347" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1793508788" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1228333903" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.458998041" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_uart_rb_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.928275839" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.834498477" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1357799697" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.944291223" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.2120523183" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.2075875680" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.2079801323" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_uart_rb.com.crt.advproject.projecttype.exe.1407730118" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rb/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rb/.project
new file mode 100644
index 0000000..9bac959
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rb/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_uart_rb</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rb/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rb/example/readme.dox
new file mode 100644
index 0000000..fe1fbf6
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rb/example/readme.dox
@@ -0,0 +1,61 @@
+/*
+ * @brief UART interrupt example with ring buffers
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_UART_RB LPC15xx UART ringbuffer/interrupt example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * The UART example shows how to use the UART in interrupt mode with transmit
+ * and receive ring buffers.<br>
+ *
+ * To use the example, connect a serial cable to the board's RS232/UART port and
+ * start a terminal program to monitor the port. The terminal program on the host
+ * PC should be setup for 115200-8-N-1.
+ * Once the example is started, a small message is printed on terminal. Any data
+ * received will be returned back to the caller.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * Need to connect with base board for using RS232/UART port.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rb/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rb/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rb/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rb/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rb/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rb/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rb/example/src/uart_rb.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rb/example/src/uart_rb.c
new file mode 100644
index 0000000..57f6335
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rb/example/src/uart_rb.c
@@ -0,0 +1,181 @@
+/*
+ * @brief UART interrupt example with ring buffers
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include "string.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* Enable this define to use integer clocking instead of the fractional baud
+ rate generator */
+#define USE_INTEGER_CLOCK
+
+/* Transmit and receive ring buffers */
+STATIC RINGBUFF_T txring, rxring;
+
+/* Ring buffer size */
+#define UART_RB_SIZE 64
+
+/* Set the default UART, IRQ number, and IRQ handler name */
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+#define LPC_USART LPC_USART0
+#define LPC_IRQNUM UART0_IRQn
+#define LPC_UARTHNDLR UART0_IRQHandler
+
+#else
+/* Configure your own UART pin muxing here if needed */
+#error "No UART setup defined"
+#endif
+
+/* Default baudrate for testing */
+#define UART_TEST_DEFAULT_BAUDRATE 115200
+
+/* Transmit and receive buffers */
+static uint8_t rxbuff[UART_RB_SIZE], txbuff[UART_RB_SIZE];
+
+const char inst1[] = "LPC15xx UART example using ring buffers\r\n";
+const char inst2[] = "Press a key to echo it back or ESC to quit\r\n";
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* UART Pin mux function - note that SystemInit() may already setup your
+ pin muxing at system startup */
+static void Init_UART_PinMux(void)
+{
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+ /* UART signals on pins PIO0_13 (FUNC0, U0_TXD) and PIO0_18 (FUNC0, U0_RXD) */
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 13, (IOCON_FUNC0 | IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 18, (IOCON_FUNC0 | IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+
+ /* UART signal muxing via SWM */
+ Chip_SWM_MovablePortPinAssign(SWM_UART0_RXD_I, 0, 13);
+ Chip_SWM_MovablePortPinAssign(SWM_UART0_TXD_O, 0, 18);
+
+#else
+#warning "No UART nmuxing defined for this example"
+#endif
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief UART interrupt handler using ring buffers
+ * @return Nothing
+ */
+void LPC_UARTHNDLR(void)
+{
+ /* Want to handle any errors? Do it here. */
+
+ /* Use default ring buffer handler. Override this with your own
+ code if you need more capability. */
+ Chip_UART_IRQRBHandler(LPC_USART, &rxring, &txring);
+}
+
+/**
+ * @brief Main UART program body
+ * @return Always returns 1
+ */
+int main(void)
+{
+ uint8_t key;
+ int bytes;
+
+ SystemCoreClockUpdate();
+ Board_Init();
+ Init_UART_PinMux();
+ Board_LED_Set(0, false);
+
+ /* Before setting up the UART, the global UART clock for USARTS 1-4
+ must first be setup. This requires setting the UART divider and
+ the UART base clock rate to 16x the maximum UART rate for all
+ UARTs. */
+#if defined(USE_INTEGER_CLOCK)
+ /* Use main clock rate as base for UART baud rate divider */
+ Chip_Clock_SetUARTBaseClockRate(Chip_Clock_GetMainClockRate(), false);
+
+#else
+ /* Use 128x expected UART baud rate for fractional baud mode. */
+ Chip_Clock_SetUARTBaseClockRate((115200 * 128), true);
+#endif
+
+ /* Setup UART */
+ Chip_UART_Init(LPC_USART);
+ Chip_UART_ConfigData(LPC_USART, UART_CFG_DATALEN_8 | UART_CFG_PARITY_NONE | UART_CFG_STOPLEN_1);
+ Chip_UART_SetBaud(LPC_USART, UART_TEST_DEFAULT_BAUDRATE);
+ /* Optional for low clock rates only: Chip_UART_SetBaudWithRTC32K(LPC_USART, 300); */
+ Chip_UART_Enable(LPC_USART);
+ Chip_UART_TXEnable(LPC_USART);
+
+ /* Before using the ring buffers, initialize them using the ring
+ buffer init function */
+ RingBuffer_Init(&rxring, rxbuff, 1, UART_RB_SIZE);
+ RingBuffer_Init(&txring, txbuff, 1, UART_RB_SIZE);
+
+ /* Enable receive data and line status interrupt */
+ Chip_UART_IntEnable(LPC_USART, UART_INTEN_RXRDY);
+ Chip_UART_IntDisable(LPC_USART, UART_INTEN_TXRDY); /* May not be needed */
+
+ /* Enable UART interrupt */
+ NVIC_EnableIRQ(LPC_IRQNUM);
+
+ /* Initial message sent using blocking method to prevent ring
+ buffer overflow */
+ Chip_UART_SendBlocking(LPC_USART, inst1, sizeof(inst1) - 1);
+ Chip_UART_SendRB(LPC_USART, &txring, inst2, sizeof(inst2) - 1);
+
+ /* Poll the receive ring buffer for the ESC (ASCII 27) key */
+ key = 0;
+ while (key != 27) {
+ bytes = Chip_UART_ReadRB(LPC_USART, &rxring, &key, 1);
+ if (bytes > 0) {
+ /* Wrap value back around */
+ if (Chip_UART_SendRB(LPC_USART, &txring, (const uint8_t *) &key, 1) != 1) {
+ Board_LED_Toggle(0);/* Toggle LED if the TX FIFO is full */
+ }
+ }
+ }
+
+ /* DeInitialize UART peripheral */
+ NVIC_DisableIRQ(LPC_IRQNUM);
+ Chip_UART_DeInit(LPC_USART);
+
+ return 1;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_int/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_int/.cproject
new file mode 100644
index 0000000..5285c03
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_int/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1122481357">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1122481357" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1122481357" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1122481357." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.2044404971" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1606160472" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_uart_rom_int}/Debug" id="com.crt.advproject.builder.exe.debug.811591169" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1568274718" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1915912289" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.1406040688" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1815448313" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.663972831" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1048728905" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.701080259" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.2050643675" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.287395117" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.753733029" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1086808539" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1018381986" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1625541244" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.723597861" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.547190417" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.485299316" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1650360379" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.301606369" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1553660093" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1510526451" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1287553733" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_uart_rom_int_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1230361587" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1360611185" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1347964661" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.2114003497" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1835461074" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1199981347" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.590569728" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.1540645849">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.1540645849" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.1540645849" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.1540645849." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.547261418" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1709956427" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_uart_rom_int}/Release" id="com.crt.advproject.builder.exe.release.1147665793" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.1997140954" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.1852520858" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.1976925221" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.699466455" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1269594586" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.735672873" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1551127324" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.61549020" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1368777018" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.681956746" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.580707378" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.24349194" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.22329316" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.218773399" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1923154554" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1994563599" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.909349586" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.492980585" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1181314893" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1889902366" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1550830673" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_uart_rom_int_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1409882899" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.930828416" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1855257632" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.783922649" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1061203921" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1695746343" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.521613011" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_uart_rom_int.com.crt.advproject.projecttype.exe.601871042" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_int/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_int/.project
new file mode 100644
index 0000000..20f85bd
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_int/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_uart_rom_int</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_int/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_int/example/readme.dox
new file mode 100644
index 0000000..e97f702
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_int/example/readme.dox
@@ -0,0 +1,62 @@
+/*
+ * @brief UART ROM API interrupt example (for UARTS0)
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_UART0_ROM_API_INTERRUPT LPC15xx UART interrupt example using ROM API
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * The UART example shows how to use the UART ROM API in interrupt mode.
+ * This example only applies to USART0.<br>
+ *
+ * To use the example, connect a serial cable to the board's RS232/UART port and
+ * start a terminal program to monitor the port. The terminal program on the host
+ * PC should be setup for 115200-8-N-1.
+ * Once the example is started, a small message is printed on terminal. Any data
+ * received will be returned back to the caller.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * The LPCXpresso base board is required with the LPCXpresso board to use this
+ * example. The Manley board needs no extra hardware.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_int/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_int/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_int/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_int/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_int/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_int/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_int/example/src/uart_rom_int.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_int/example/src/uart_rom_int.c
new file mode 100644
index 0000000..8e9bf07
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_int/example/src/uart_rom_int.c
@@ -0,0 +1,290 @@
+/*
+ * @brief UART0 ROM API interrupt example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include "string.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* UART handle and memory for ROM API */
+static UART_HANDLE_T *uartHandle;
+
+/* Use a buffer size larger than the expected return value of
+ uart_get_mem_size() for the static UART handle type */
+static uint32_t uartHandleMEM[0x10];
+
+/* Receive buffer */
+#define RECV_BUFF_SIZE 32
+static char recv_buf[RECV_BUFF_SIZE];
+static int indexIn;
+
+/* ASCII code for escapre key */
+#define ESCKEY 27
+
+/* Flag used to indicate callback fired */
+static volatile bool gotCallback;
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* UART Pin mux function - note that SystemInit() may already setup your
+ pin muxing at system startup */
+static void Init_UART0_PinMux(void)
+{
+ /* UART signals on pins PIO0_13 (FUNC0, U0_TXD) and PIO0_18 (FUNC0, U0_RXD) */
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 13, (IOCON_FUNC0 | IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 18, (IOCON_FUNC0 | IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+
+ /* UART signal muxing via SWM */
+ Chip_SWM_MovablePortPinAssign(SWM_UART0_RXD_I, 0, 13);
+ Chip_SWM_MovablePortPinAssign(SWM_UART0_TXD_O, 0, 18);
+}
+
+/* Turn on LED to indicate an error */
+static void errorUART(void)
+{
+ Board_LED_Set(0, true);
+ while (1) {}
+}
+
+/* Setup UART handle and parameters */
+static void setupUART()
+{
+ uint32_t ret_value;
+
+ /* 115.2KBPS, 8N1, ASYNC mode, no errors, clock filled in later */
+ UART_CONFIG_T cfg = {
+ 0, /* U_PCLK frequency in Hz */
+ 115200, /* Baud Rate in Hz */
+ 1, /* 8N1 */
+ 0, /* Asynchronous Mode */
+ NO_ERR_EN /* Enable No Errors */
+ };
+
+ /* Initialize UART0 */
+ Chip_UART_Init(LPC_USART0);
+
+ Chip_Clock_SetUARTFRGDivider(1);
+
+ /* Perform a sanity check on the storage allocation */
+ if (LPC_UARTD_API->uart_get_mem_size() > sizeof(uartHandleMEM)) {
+ /* Example only: this should never happen and probably isn't needed for
+ most UART code. */
+ errorUART();
+ }
+
+ /* Setup the UART handle */
+ uartHandle = LPC_UARTD_API->uart_setup((uint32_t) LPC_USART0, (uint8_t *) &uartHandleMEM);
+ if (uartHandle == NULL) {
+ errorUART();
+ }
+
+ /* Need to tell UART ROM API function the current UART peripheral clock
+ speed */
+ cfg.sys_clk_in_hz = Chip_Clock_GetSystemClockRate();
+
+ /* Initialize the UART with the configuration parameters */
+ ret_value = LPC_UARTD_API->uart_init(uartHandle, &cfg);
+ LPC_SYSCTL->FRGCTRL = ret_value;
+
+}
+
+/* UART callback */
+static void waitCallback(uint32_t err_code, uint32_t n)
+{
+ gotCallback = true;
+}
+
+/* Sleep until callback is called */
+void sleepUntilCB(void)
+{
+ /* Wait until the transmit callback occurs. When it hits, the
+ transfer is complete. */
+ while (gotCallback == false) {
+ /* Sleep until the callback signals transmit completion */
+ __WFI();
+ }
+}
+
+/* Send a string on the UART terminated by a NULL character using
+ interrupt mode. */
+static void putLineUART(const char *send_data)
+{
+ UART_PARAM_T param;
+
+ param.buffer = (uint8_t *) send_data;
+ param.size = strlen(send_data);
+
+ /* Interrupt mode, do not append CR/LF to sent data */
+ param.transfer_mode = TX_MODE_SZERO;
+ param.driver_mode = DRIVER_MODE_INTERRUPT;
+
+ /* Setup the transmit callback, this will get called when the
+ transfer is complete */
+ param.callback_func_pt = (UART_CALLBK_T) waitCallback;
+
+ /* Transmit the data using interrupt mode, the function will
+ return */
+ gotCallback = false;
+
+ if (LPC_UARTD_API->uart_put_line(uartHandle, ¶m)) {
+ errorUART();
+ }
+
+ /* Wait until the transmit callback occurs. When it hits, the
+ transfer is complete. */
+ sleepUntilCB();
+}
+
+/* Receive a string on the UART terminated by a LF character using
+ polling mode. */
+static void getLineUART(char *receive_buffer, uint32_t length)
+{
+ UART_PARAM_T param;
+
+ param.buffer = (uint8_t *) receive_buffer;
+ param.size = length;
+
+ /* Receive data up to the CR/LF character in polling mode. Will
+ truncate at length if too long. */
+ param.transfer_mode = RX_MODE_CRLF_RECVD;
+ param.driver_mode = DRIVER_MODE_INTERRUPT;
+
+ /* Setup the receive callback, this will get called when the
+ transfer is complete */
+ param.callback_func_pt = (UART_CALLBK_T) waitCallback;
+
+ /* Receive the data */
+ gotCallback = false;
+ if (LPC_UARTD_API->uart_get_line(uartHandle, ¶m)) {
+ errorUART();
+ }
+
+ /* Wait until the transmit callback occurs. When it hits, the
+ transfer is complete. */
+ sleepUntilCB();
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle UART interrupt
+ * @return Nothing
+ */
+void UART0_IRQHandler(void)
+{
+ LPC_UARTD_API->uart_isr(uartHandle);
+}
+
+/**
+ * @brief Main UART program body
+ * @return Always returns 1
+ */
+int main(void)
+{
+ SystemCoreClockUpdate();
+ Board_Init();
+ Init_UART0_PinMux();
+ Board_LED_Set(0, false);
+
+ /* Before setting up the UART, the global UART clock for USARTS 1-4
+ must first be setup. This requires setting the UART divider and
+ the UART base clock rate to 16x the maximum UART rate for all
+ UARTs. */
+ #if defined(USE_INTEGER_CLOCK)
+ /* Use main clock rate as base for UART baud rate divider */
+ Chip_Clock_SetUARTBaseClockRate(Chip_Clock_GetMainClockRate(), false);
+
+ #else
+ /* Use 128x expected UART baud rate for fractional baud mode. */
+ Chip_Clock_SetUARTBaseClockRate((115200 * 128), true);
+ #endif
+
+ /* Allocate UART handle, setup UART parameters, and initialize UART
+ clocking */
+ setupUART();
+
+ NVIC_EnableIRQ(UART0_IRQn);
+
+ /* Transmit the welcome message and instructions using the
+ putline function */
+
+ putLineUART("LPC15XX USART ROM API interrupt Example\r\n");
+ putLineUART("String receive (no echo): "
+ "Enter a string and press enter to echo if back\r\n");
+
+ /* Get a string for the UART and echo it back to the caller. Data is NOT
+ echoed back via the UART using this function. */
+ getLineUART(recv_buf, sizeof(recv_buf));
+ recv_buf[sizeof(recv_buf) - 1] = '\0'; /* Safety */
+ if (strlen(recv_buf) == (sizeof(recv_buf) - 1)) {
+ putLineUART("**String was truncated, input data longer than "
+ "receive buffer***\r\n");
+ }
+ putLineUART(recv_buf);
+
+ /* Transmit the message for byte/character part of the exampel */
+ putLineUART("\r\nByte receive with echo using uart_get_line(): "
+ "Send16 bytes to fill the ring buffers\r\n");
+
+ /* An (inefficient) ring buffer can be emulated in interrupt
+ mode using the uart_get_line() with a buffer size of 1. Read
+ 16 bytes into the ring buffer and then exit. */
+ indexIn = 0;
+ while (indexIn < 16) {
+ /* Get byte in next index in buffer */
+ getLineUART(&recv_buf[indexIn], 1);
+
+ /* Echo back using polling function */
+ LPC_UARTD_API->uart_put_char(uartHandle, recv_buf[indexIn]);
+
+ /* Next index */
+ indexIn++;
+ }
+
+ /* Safe string termination */
+ recv_buf[indexIn] = '\0';
+
+ /* Transmit the message for byte/character part of the example */
+ putLineUART("\r\nData in ring buffer: ");
+ putLineUART(recv_buf);
+
+ return 1;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_polling/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_polling/.cproject
new file mode 100644
index 0000000..f080f5b
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_polling/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.242962562">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.242962562" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.242962562" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.242962562." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.1074571722" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1605979376" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_uart_rom_polling}/Debug" id="com.crt.advproject.builder.exe.debug.507685680" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1324671576" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1159358135" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.417636578" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.770352873" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.67557868" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1734941326" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.811673643" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1526759681" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.33202808" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.420431888" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1636565026" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.915650065" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.527735644" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.599589250" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.183997889" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.2125446203" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1749756114" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.484810781" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1521580827" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1496877042" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1830688597" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_uart_rom_polling_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.771004084" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.847359115" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1818024836" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.794343710" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1508602313" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1607444653" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1260038196" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.2040767428">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.2040767428" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.2040767428" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.2040767428." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.308983426" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.114380124" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_uart_rom_polling}/Release" id="com.crt.advproject.builder.exe.release.2085131374" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.12175611" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.1167705306" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.973042194" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1473408435" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.432038493" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.319873767" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.23233451" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1165120971" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.232923252" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.725428055" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1562105933" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.563759063" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1400744210" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1968862242" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.618138646" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.991306507" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.729351161" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1125947973" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.2109330506" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1158429502" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1190954698" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_uart_rom_polling_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1581627753" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1310132335" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1696634309" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.43108224" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1700203510" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1994795469" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.2036744080" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_uart_rom_polling.com.crt.advproject.projecttype.exe.1651903736" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_polling/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_polling/.project
new file mode 100644
index 0000000..125aea3
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_polling/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_uart_rom_polling</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_polling/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_polling/example/readme.dox
new file mode 100644
index 0000000..3c49620
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_polling/example/readme.dox
@@ -0,0 +1,62 @@
+/*
+ * @brief UART ROM API polling example (for UARTS0)
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_UART0_ROM_API_POLLING LPC15xx UART polling example using ROM API
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * The UART example shows how to use the UART ROM API in polled mode.
+ * This example only applies to USART0.<br>
+ *
+ * To use the example, connect a serial cable to the board's RS232/UART port and
+ * start a terminal program to monitor the port. The terminal program on the host
+ * PC should be setup for 115200-8-N-1.
+ * Once the example is started, a small message is printed on terminal. Any data
+ * received will be returned back to the caller.<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * The LPCXpresso base board is required with the LPCXpresso board to use this
+ * example. The Manley board needs no extra hardware.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_polling/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_polling/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_polling/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_polling/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_polling/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_polling/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_polling/example/src/uart_rom_polling.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_polling/example/src/uart_rom_polling.c
new file mode 100644
index 0000000..2aed3b7
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_uart_rom_polling/example/src/uart_rom_polling.c
@@ -0,0 +1,217 @@
+/*
+ * @brief UART0 ROM API polling example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include "string.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* UART handle and memory for ROM API */
+static UART_HANDLE_T *uartHandle;
+
+/* Use a buffer size larger than the expected return value of
+ uart_get_mem_size() for the static UART handle type */
+static uint32_t uartHandleMEM[0x10];
+
+/* Receive buffer */
+#define RECV_BUFF_SIZE 32
+static char recv_buf[RECV_BUFF_SIZE];
+
+/* ASCII code for escapre key */
+#define ESCKEY 27
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* UART Pin mux function - note that SystemInit() may already setup your
+ pin muxing at system startup */
+static void Init_UART0_PinMux(void)
+{
+ /* UART signals on pins PIO0_13 (FUNC0, U0_TXD) and PIO0_18 (FUNC0, U0_RXD) */
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 13, (IOCON_FUNC0 | IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 18, (IOCON_FUNC0 | IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+
+ /* UART signal muxing via SWM */
+ Chip_SWM_MovablePortPinAssign(SWM_UART0_RXD_I, 0, 13);
+ Chip_SWM_MovablePortPinAssign(SWM_UART0_TXD_O, 0, 18);
+}
+
+/* Turn on LED to indicate an error */
+static void errorUART(void)
+{
+ Board_LED_Set(0, true);
+ while (1) {}
+}
+
+/* Setup UART handle and parameters */
+static void setupUART()
+{
+ uint32_t errCode;
+
+ /* 115.2KBPS, 8N1, ASYNC mode, no errors, clock filled in later */
+ UART_CONFIG_T cfg = {
+ 0, /* U_PCLK frequency in Hz */
+ 115200, /* Baud Rate in Hz */
+ 1, /* 8N1 */
+ 0, /* Asynchronous Mode */
+ NO_ERR_EN /* Enable No Errors */
+ };
+
+ /* Initialize UART0 */
+ Chip_UART_Init(LPC_USART0);
+
+ Chip_Clock_SetUARTFRGDivider(1);
+
+ /* Perform a sanity check on the storage allocation */
+ if (LPC_UARTD_API->uart_get_mem_size() > sizeof(uartHandleMEM)) {
+ /* Example only: this should never happen and probably isn't needed for
+ most UART code. */
+ errorUART();
+ }
+
+ /* Setup the UART handle */
+ uartHandle = LPC_UARTD_API->uart_setup((uint32_t) LPC_USART0, (uint8_t *) &uartHandleMEM);
+ if (uartHandle == NULL) {
+ errorUART();
+ }
+
+ /* Need to tell UART ROM API function the current UART peripheral clock
+ speed */
+ cfg.sys_clk_in_hz = Chip_Clock_GetSystemClockRate();
+
+ /* Initialize the UART with the configuration parameters */
+ errCode = LPC_UARTD_API->uart_init(uartHandle, &cfg);
+ if (errCode != LPC_OK) {
+ /* Some type of error handling here */
+ errorUART();
+ }
+}
+
+/* Send a string on the UART terminated by a NULL character using
+ polling mode. */
+static void putLineUART(const char *send_data)
+{
+ UART_PARAM_T param;
+
+ param.buffer = (uint8_t *) send_data;
+ param.size = strlen(send_data);
+
+ /* Polling mode, do not append CR/LF to sent data */
+ param.transfer_mode = TX_MODE_SZERO;
+ param.driver_mode = DRIVER_MODE_POLLING;
+
+ /* Transmit the data */
+ if (LPC_UARTD_API->uart_put_line(uartHandle, ¶m)) {
+ errorUART();
+ }
+}
+
+/* Receive a string on the UART terminated by a LF character using
+ polling mode. */
+static void getLineUART(char *receive_buffer, uint32_t length)
+{
+ UART_PARAM_T param;
+
+ param.buffer = (uint8_t *) receive_buffer;
+ param.size = length;
+
+ /* Receive data up to the CR/LF character in polling mode. Will
+ truncate at length if too long. */
+ param.transfer_mode = RX_MODE_CRLF_RECVD;
+ param.driver_mode = DRIVER_MODE_POLLING;
+
+ /* Receive the data */
+ if (LPC_UARTD_API->uart_get_line(uartHandle, ¶m)) {
+ errorUART();
+ }
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Main UART program body
+ * @return Always returns 1
+ */
+int main(void)
+{
+ SystemCoreClockUpdate();
+ Board_Init();
+ Init_UART0_PinMux();
+ Board_LED_Set(0, false);
+
+ /* Allocate UART handle, setup UART parameters, and initialize UART
+ clocking */
+ setupUART();
+
+ /* Transmit the welcome message and instructions using the
+ putline function */
+ putLineUART("LPC15XX USART API ROM polling Example\r\n");
+ putLineUART("String receive (no echo): "
+ "Enter a string and press enter to echo if back\r\n");
+
+ /* Get a string for the UART and echo it back to the caller. Data is NOT
+ echoed back via the UART using this function. */
+ getLineUART(recv_buf, sizeof(recv_buf));
+ recv_buf[sizeof(recv_buf) - 1] = '\0'; /* Safety */
+ if (strlen(recv_buf) == (sizeof(recv_buf) - 1)) {
+ putLineUART("**String was truncated, input data longer than "
+ "receive buffer***\r\n");
+ }
+ putLineUART(recv_buf);
+
+ /* Transmit the message for byte/character part of the exampel */
+ putLineUART("\r\nByte receive with echo: "
+ "Press a key to echo it back. Press ESC to exit\r");
+
+ /* Endless loop until ESC key is pressed */
+ recv_buf[0] = '\n';
+ while (recv_buf[0] != ESCKEY) {
+ /* Echo it back */
+ LPC_UARTD_API->uart_put_char(uartHandle, recv_buf[0]);
+
+ /* uart_get_char will block until a character is received */
+ recv_buf[0] = LPC_UARTD_API->uart_get_char(uartHandle);
+ }
+
+ /* Transmit the message for byte/character part of the example */
+ putLineUART("\r\nESC key received, exiting\r\n");
+
+ return 1;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_wwdt/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_wwdt/.cproject
new file mode 100644
index 0000000..8a9715d
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_wwdt/.cproject
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.727196050">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.727196050" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.727196050" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.727196050." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.1456647068" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1515903231" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/periph_wwdt}/Debug" id="com.crt.advproject.builder.exe.debug.1227071420" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1379252443" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.2112997351" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.668897734" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1999980637" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1595176888" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.866777623" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.195281831" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.659989385" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1788143276" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.2111885271" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.648820446" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.375425317" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.2013493114" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.570779596" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.2066676479" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.2082876329" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1947911517" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.900959445" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.797327448" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.758887072" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.548232412" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_wwdt_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.2028167323" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.797725978" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.970722255" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.2010871458" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1282560071" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.311554273" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.186655117" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.2018842940">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.2018842940" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.2018842940" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.2018842940." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.1086453" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.638547465" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/periph_wwdt}/Release" id="com.crt.advproject.builder.exe.release.1634725227" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.1569274499" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.517847488" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.106128999" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.510757605" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.509110097" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1889388724" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1070209394" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.878185248" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.825968515" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1285811252" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.367940335" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.470211540" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1387472019" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1592878617" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.764630353" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.477872214" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.177482534" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1885319202" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1903039293" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.828614147" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.516216571" name="Linker script" superClass="com.crt.advproject.link.script" value=""periph_wwdt_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.889591378" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.680177365" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.439486326" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.119444914" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1602398781" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.943242289" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1045426122" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="periph_wwdt.com.crt.advproject.projecttype.exe.1466962109" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_wwdt/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_wwdt/.project
new file mode 100644
index 0000000..f5f4902
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_wwdt/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>periph_wwdt</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_wwdt/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_wwdt/example/readme.dox
new file mode 100644
index 0000000..54e3cea
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_wwdt/example/readme.dox
@@ -0,0 +1,57 @@
+/*
+ * @brief Windowed Watchdog Timer (WWDT) example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_PERIPH_15XX_WWDT LPC15xx Windowed Watchdog Timer example
+ * @ingroup EXAMPLES_PERIPH_15XX
+ * <b>Example description</b><br>
+ * The WWDT example demonstrates the handling of WDT warning trigger interrupt
+ * to enable "safe" operation.
+ * The watchdog generates a warning WWDT interrupt and then feeds the WWDT
+ * on the warning (the LED0 will toggle on each warning interval cycle).<br>
+ *
+ * <b>Special connection requirements</b><br>
+ * There are no special connection requirements for this example.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_wwdt/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_wwdt/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_wwdt/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_wwdt/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_wwdt/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_wwdt/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/periph_wwdt/example/src/wwdt.c b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_wwdt/example/src/wwdt.c
new file mode 100644
index 0000000..13eb3d7
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/periph_wwdt/example/src/wwdt.c
@@ -0,0 +1,133 @@
+/*
+ * @brief Windowed Watchdog Timer (WWDT) example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+/**
+ * @brief watchdog timer Interrupt Handler
+ * @return Nothing
+ * @note Handles watchdog timer warning and timeout events
+ */
+void WDT_IRQHandler(void)
+{
+ uint32_t wdtStatus = Chip_WWDT_GetStatus(LPC_WWDT);
+
+ Board_LED_Toggle(0);
+
+ /* The chip will reset before this happens, but if the WDT doesn't
+ have WWDT_WDMOD_WDRESET enabled, this will hit once */
+ if (wdtStatus & WWDT_WDMOD_WDTOF) {
+ /* A watchdog feed didn't occur prior to window timeout */
+ Chip_WWDT_UnsetOption(LPC_WWDT, WWDT_WDMOD_WDEN); /* Stop WDT */
+ Chip_WWDT_ClearStatusFlag(LPC_WWDT, WWDT_WDMOD_WDTOF);
+ Chip_WWDT_Start(LPC_WWDT); /* Needs restart */
+ }
+
+ /* Handle warning interrupt */
+ if (wdtStatus & WWDT_WDMOD_WDINT) {
+ /* A watchdog feed didn't occur prior to warning timeout */
+ Chip_WWDT_ClearStatusFlag(LPC_WWDT, WWDT_WDMOD_WDINT);
+ Chip_WWDT_Feed(LPC_WWDT);
+ }
+}
+
+/**
+ * @brief Application Main entry point
+ * @return Nothing (This will not return)
+ */
+int main(void)
+{
+ uint32_t wdtFreq;
+
+ SystemCoreClockUpdate();
+ Board_Init();
+ Board_LED_Set(0, false);
+
+ /* Enable the WDT oscillator */
+ Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_WDTOSC_PD);
+
+ /* The WDT divides the input frequency into it by 4 */
+ wdtFreq = Chip_Clock_GetWDTOSCRate() / 4;
+
+ /* Initialize WWDT (also enables WWDT clock) */
+ Chip_WWDT_Init(LPC_WWDT);
+
+ /* Set watchdog feed time constant to approximately 2s
+ Set watchdog warning time to 512 ticks after feed time constant
+ Set watchdog window time to 3s */
+ Chip_WWDT_SetTimeOut(LPC_WWDT, wdtFreq * 2);
+ Chip_WWDT_SetWarning(LPC_WWDT, 512);
+ Chip_WWDT_SetWindow(LPC_WWDT, wdtFreq * 3);
+
+ /* Configure WWDT to reset on timeout */
+ Chip_WWDT_SetOption(LPC_WWDT, WWDT_WDMOD_WDRESET);
+
+ /* Clear watchdog warning and timeout interrupts */
+ Chip_WWDT_ClearStatusFlag(LPC_WWDT, WWDT_WDMOD_WDTOF | WWDT_WDMOD_WDINT);
+
+ /* Power everything up except for ADC, USB and temp sensor on wake up from
+ deep sleep. */
+ Chip_SYSCTL_SetWakeup(~(SYSCTL_SLPWAKE_IRCOUT_PD | SYSCTL_SLPWAKE_IRC_PD |
+ SYSCTL_SLPWAKE_FLASH_PD | SYSCTL_SLPWAKE_SYSOSC_PD |
+ SYSCTL_SLPWAKE_SYSPLL_PD | SYSCTL_SLPWAKE_WDTOSC_PD));
+ /* Allow WDT to wake from deep sleep. */
+ Chip_SYSCTL_EnableERP0PeriphWakeup(SYSCTL_ERP0_WAKEUP_WDTINT);
+
+ /* Clear and enable watchdog interrupt */
+ NVIC_ClearPendingIRQ(WWDT_IRQn);
+ NVIC_EnableIRQ(WWDT_IRQn);
+
+ /* Start watchdog */
+ Chip_WWDT_Start(LPC_WWDT);
+
+ /* Sleep until WDT needs servicing */
+ while (1) {
+ LPC_PWRD_API->power_mode_configure(PMU_DEEP_SLEEP, ~PMU_PD_WDOSC);
+ __WFI();
+ }
+
+ return 0;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/rules.mk b/src/bsp/lk/platform/lpc15xx/lpcopen/rules.mk
new file mode 100644
index 0000000..5756910
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/rules.mk
@@ -0,0 +1,39 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+GLOBAL_INCLUDES += $(LOCAL_DIR)/lpc_chip_15xx/inc
+
+MODULE_DEFINES += CORE_M3=1
+
+MODULE_SRCS += \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/acmp_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/adc_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/chip_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/clock_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/crc_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/dac_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/dma_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/eeprom.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/gpio_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/i2c_common_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/i2cm_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/i2cs_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/iap.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/iocon_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/pinint_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/pmu_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/ring_buffer.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/ritimer_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/rtc_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/sctipu_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/spi_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/stopwatch_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/swm_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/sysctl_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/sysinit_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/uart_15xx.c \
+ $(LOCAL_DIR)/lpc_chip_15xx/src/wwdt_15xx.c \
+
+include make/module.mk
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/.cproject
new file mode 100644
index 0000000..fe6484e
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/.cproject
@@ -0,0 +1,243 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1226917460">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1226917460" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1226917460" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1226917460." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.1693704367" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.23900037" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/usbd_rom_cdc}/Debug" id="com.crt.advproject.builder.exe.debug.1864345061" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1735031094" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.764373220" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.308087766" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1463909346" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1217208244" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.210825373" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.781909634" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1987930858" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/example/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc/usbd}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1664642440" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.500493973" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.413386653" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.411073461" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.721879719" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1770119369" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.526880782" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.188195017" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.493644499" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1414187297" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1214910666" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.434382044" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.576641071" name="Linker script" superClass="com.crt.advproject.link.script" value=""usbd_rom_cdc_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1649828065" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.943031743" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.457213579" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1699790674" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1750751349" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.483234431" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.46765789" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.1203044339">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.1203044339" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.1203044339" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.1203044339." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.791776403" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1085337748" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/usbd_rom_cdc}/Release" id="com.crt.advproject.builder.exe.release.1478276872" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.347286528" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.163020117" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.85940135" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.795466566" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1291917358" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.2110583753" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.640597174" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1013510849" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/example/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc/usbd}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1790287491" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.562341273" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.2104406168" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.602363140" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1696131513" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1416860193" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1721866288" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.2101643620" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.181151067" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1241173980" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1186262586" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.114566526" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1906517697" name="Linker script" superClass="com.crt.advproject.link.script" value=""usbd_rom_cdc_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1593046405" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1662273992" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1702614049" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.2012612630" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1093859552" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1817279765" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.865147308" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="usbd_rom_cdc.com.crt.advproject.projecttype.exe.1787186350" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/.project
new file mode 100644
index 0000000..94a3758
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>usbd_rom_cdc</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/inc/app_usbd_cfg.h b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/inc/app_usbd_cfg.h
new file mode 100644
index 0000000..dc40a11
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/inc/app_usbd_cfg.h
@@ -0,0 +1,96 @@
+/*
+ * @brief Configuration file needed for USB ROM stack based applications.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+#include "lpc_types.h"
+#include "error.h"
+#include "usbd_rom_api.h"
+
+#ifndef __APP_USB_CFG_H_
+#define __APP_USB_CFG_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @ingroup EXAMPLES_USBDROM_15XX_CDC
+ * @{
+ */
+
+/* Manifest constants used by USBD ROM stack. These values SHOULD NOT BE CHANGED
+ for advance features which require usage of USB_CORE_CTRL_T structure.
+ Since these are the values used for compiling USB stack.
+ */
+#define USB_MAX_IF_NUM 8 /*!< Max interface number used for building USBD ROM. DON'T CHANGE. */
+#define USB_MAX_EP_NUM 5 /*!< Max number of EP used for building USBD ROM. DON'T CHANGE. */
+#define USB_MAX_PACKET0 64 /*!< Max EP0 packet size used for building USBD ROM. DON'T CHANGE. */
+#define USB_FS_MAX_BULK_PACKET 64 /*!< MAXP for FS bulk EPs used for building USBD ROM. DON'T CHANGE. */
+#define USB_HS_MAX_BULK_PACKET 512 /*!< MAXP for HS bulk EPs used for building USBD ROM. DON'T CHANGE. */
+#define USB_DFU_XFER_SIZE 2048 /*!< Max DFU transfer size used for building USBD ROM. DON'T CHANGE. */
+
+/* Manifest constants defining interface numbers and endpoints used by a
+ particular interface in this application.
+ */
+#define USB_CDC_CIF_NUM 0
+#define USB_CDC_DIF_NUM 1
+#define USB_CDC_IN_EP 0x81
+#define USB_CDC_OUT_EP 0x01
+#define USB_CDC_INT_EP 0x82
+
+/* The following manifest constants are used to define this memory area to be used
+ by USBD ROM stack.
+ */
+#define USB_STACK_MEM_BASE 0x02008000
+#define USB_STACK_MEM_SIZE 0x1000
+
+/* USB descriptor arrays defined *_desc.c file */
+extern const uint8_t USB_DeviceDescriptor[];
+extern uint8_t USB_FsConfigDescriptor[];
+extern const uint8_t USB_StringDescriptor[];
+extern const uint8_t USB_DeviceQualifier[];
+
+/**
+ * @brief Find the address of interface descriptor for given class type.
+ * @param pDesc : Pointer to configuration descriptor in which the desired class
+ * interface descriptor to be found.
+ * @param intfClass : Interface class type to be searched.
+ * @return If found returns the address of requested interface else returns NULL.
+ */
+extern USB_INTERFACE_DESCRIPTOR *find_IntfDesc(const uint8_t *pDesc, uint32_t intfClass);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __APP_USB_CFG_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/inc/cdc_vcom.h b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/inc/cdc_vcom.h
new file mode 100644
index 0000000..9e16134
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/inc/cdc_vcom.h
@@ -0,0 +1,127 @@
+/*
+ * @brief Programming API used with Virtual Communication port
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __CDC_VCOM_H_
+#define __CDC_VCOM_H_
+
+#include "app_usbd_cfg.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @ingroup EXAMPLES_USBDROM_15XX_CDC
+ * @{
+ */
+
+#define VCOM_RX_BUF_SZ 512
+#define VCOM_TX_CONNECTED _BIT(8) /* connection state is for both RX/Tx */
+#define VCOM_TX_BUSY _BIT(0)
+#define VCOM_RX_DONE _BIT(0)
+#define VCOM_RX_BUF_FULL _BIT(1)
+#define VCOM_RX_BUF_QUEUED _BIT(2)
+#define VCOM_RX_DB_QUEUED _BIT(3)
+
+/**
+ * Structure containing Virtual Comm port control data
+ */
+typedef struct VCOM_DATA {
+ USBD_HANDLE_T hUsb;
+ USBD_HANDLE_T hCdc;
+ uint8_t *rx_buff;
+ uint16_t rx_rd_count;
+ uint16_t rx_count;
+ volatile uint16_t tx_flags;
+ volatile uint16_t rx_flags;
+} VCOM_DATA_T;
+
+/**
+ * Virtual Comm port control data instance.
+ */
+extern VCOM_DATA_T g_vCOM;
+
+/**
+ * @brief Virtual com port init routine
+ * @param hUsb : Handle to USBD stack instance
+ * @param pDesc : Pointer to configuration descriptor
+ * @param pUsbParam : Pointer USB param structure returned by previous init call
+ * @return Always returns LPC_OK.
+ */
+ErrorCode_t vcom_init (USBD_HANDLE_T hUsb, USB_CORE_DESCS_T *pDesc, USBD_API_INIT_PARAM_T *pUsbParam);
+
+/**
+ * @brief Virtual com port buffered read routine
+ * @param pBuf : Pointer to buffer where read data should be copied
+ * @param buf_len : Length of the buffer passed
+ * @return Return number of bytes read.
+ */
+uint32_t vcom_bread (uint8_t *pBuf, uint32_t buf_len);
+
+/**
+ * @brief Virtual com port read routine
+ * @param pBuf : Pointer to buffer where read data should be copied
+ * @param buf_len : Length of the buffer passed
+ * @return Always returns LPC_OK.
+ */
+ErrorCode_t vcom_read_req (uint8_t *pBuf, uint32_t buf_len);
+
+/**
+ * @brief Gets current read count.
+ * @return Returns current read count.
+ */
+uint32_t vcom_read_cnt(void);
+
+/**
+ * @brief Check if Vcom is connected
+ * @return Returns non-zero value if connected.
+ */
+static INLINE uint32_t vcom_connected(void) {
+ return g_vCOM.tx_flags & VCOM_TX_CONNECTED;
+}
+
+/**
+ * @brief Virtual com port write routine
+ * @param pBuf : Pointer to buffer to be written
+ * @param buf_len : Length of the buffer passed
+ * @return Number of bytes written
+ */
+uint32_t vcom_write (uint8_t *pBuf, uint32_t buf_len);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CDC_VCOM_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/readme.dox
new file mode 100644
index 0000000..80e41f7
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/readme.dox
@@ -0,0 +1,57 @@
+/*
+ * @brief Virtual communication port example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_USBDROM_15XX_CDC LPC15XX Virtual Comm port example
+ * @ingroup EXAMPLES_USBDROM_15XX
+ * <b>Example description</b><br>
+ * The example shows how to us USBD ROM stack to creates a virtual comm port.
+ * <br>
+ *
+ * <b>Special connection requirements</b><br>
+ * Connect the USB cable between micro connector on board and to a host.
+ * When connected to Windows host use the .inf included in the project
+ * directory to install the driver. For OSx (Mac) host, no drivers are needed.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/src/cdc_desc.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/src/cdc_desc.c
new file mode 100644
index 0000000..b03a109
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/src/cdc_desc.c
@@ -0,0 +1,206 @@
+/*
+ * @brief Virtual Comm port USB descriptors
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "app_usbd_cfg.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/**
+ * USB Standard Device Descriptor
+ */
+ALIGNED(4) const uint8_t USB_DeviceDescriptor[] = {
+ USB_DEVICE_DESC_SIZE, /* bLength */
+ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL(0x0200), /* bcdUSB */
+ 0xEF, /* bDeviceClass */
+ 0x02, /* bDeviceSubClass */
+ 0x01, /* bDeviceProtocol */
+ USB_MAX_PACKET0, /* bMaxPacketSize0 */
+ WBVAL(0x1FC9), /* idVendor */
+ WBVAL(0x0083), /* idProduct */
+ WBVAL(0x0100), /* bcdDevice */
+ 0x01, /* iManufacturer */
+ 0x02, /* iProduct */
+ 0x03, /* iSerialNumber */
+ 0x01 /* bNumConfigurations */
+};
+
+/**
+ * USB FSConfiguration Descriptor
+ * All Descriptors (Configuration, Interface, Endpoint, Class, Vendor)
+ */
+ALIGNED(4) uint8_t USB_FsConfigDescriptor[] = {
+ /* Configuration 1 */
+ USB_CONFIGURATION_DESC_SIZE, /* bLength */
+ USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL( /* wTotalLength */
+ USB_CONFIGURATION_DESC_SIZE +
+ USB_INTERFACE_ASSOC_DESC_SIZE + /* interface association descriptor */
+ USB_INTERFACE_DESC_SIZE + /* communication control interface */
+ 0x0013 + /* CDC functions */
+ 1 * USB_ENDPOINT_DESC_SIZE + /* interrupt endpoint */
+ USB_INTERFACE_DESC_SIZE + /* communication data interface */
+ 2 * USB_ENDPOINT_DESC_SIZE + /* bulk endpoints */
+ 0
+ ),
+ 0x02, /* bNumInterfaces */
+ 0x01, /* bConfigurationValue */
+ 0x00, /* iConfiguration */
+ USB_CONFIG_SELF_POWERED, /* bmAttributes */
+ USB_CONFIG_POWER_MA(500), /* bMaxPower */
+
+ /* Interface association descriptor IAD*/
+ USB_INTERFACE_ASSOC_DESC_SIZE, /* bLength */
+ USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE, /* bDescriptorType */
+ USB_CDC_CIF_NUM, /* bFirstInterface */
+ 0x02, /* bInterfaceCount */
+ CDC_COMMUNICATION_INTERFACE_CLASS, /* bFunctionClass */
+ CDC_ABSTRACT_CONTROL_MODEL, /* bFunctionSubClass */
+ 0x00, /* bFunctionProtocol */
+ 0x04, /* iFunction */
+
+ /* Interface 0, Alternate Setting 0, Communication class interface descriptor */
+ USB_INTERFACE_DESC_SIZE, /* bLength */
+ USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
+ USB_CDC_CIF_NUM, /* bInterfaceNumber: Number of Interface */
+ 0x00, /* bAlternateSetting: Alternate setting */
+ 0x01, /* bNumEndpoints: One endpoint used */
+ CDC_COMMUNICATION_INTERFACE_CLASS, /* bInterfaceClass: Communication Interface Class */
+ CDC_ABSTRACT_CONTROL_MODEL, /* bInterfaceSubClass: Abstract Control Model */
+ 0x00, /* bInterfaceProtocol: no protocol used */
+ 0x04, /* iInterface: */
+ /* Header Functional Descriptor*/
+ 0x05, /* bLength: CDC header Descriptor size */
+ CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */
+ CDC_HEADER, /* bDescriptorSubtype: Header Func Desc */
+ WBVAL(CDC_V1_10), /* bcdCDC 1.10 */
+ /* Call Management Functional Descriptor*/
+ 0x05, /* bFunctionLength */
+ CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */
+ CDC_CALL_MANAGEMENT, /* bDescriptorSubtype: Call Management Func Desc */
+ 0x01, /* bmCapabilities: device handles call management */
+ USB_CDC_DIF_NUM, /* bDataInterface: CDC data IF ID */
+ /* Abstract Control Management Functional Descriptor*/
+ 0x04, /* bFunctionLength */
+ CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */
+ CDC_ABSTRACT_CONTROL_MANAGEMENT, /* bDescriptorSubtype: Abstract Control Management desc */
+ 0x02, /* bmCapabilities: SET_LINE_CODING, GET_LINE_CODING, SET_CONTROL_LINE_STATE supported */
+ /* Union Functional Descriptor*/
+ 0x05, /* bFunctionLength */
+ CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */
+ CDC_UNION, /* bDescriptorSubtype: Union func desc */
+ USB_CDC_CIF_NUM, /* bMasterInterface: Communication class interface is master */
+ USB_CDC_DIF_NUM, /* bSlaveInterface0: Data class interface is slave 0 */
+ /* Endpoint 1 Descriptor*/
+ USB_ENDPOINT_DESC_SIZE, /* bLength */
+ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
+ USB_CDC_INT_EP, /* bEndpointAddress */
+ USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */
+ WBVAL(0x0010), /* wMaxPacketSize */
+ 0x02, /* 2ms */ /* bInterval */
+
+ /* Interface 1, Alternate Setting 0, Data class interface descriptor*/
+ USB_INTERFACE_DESC_SIZE, /* bLength */
+ USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
+ USB_CDC_DIF_NUM, /* bInterfaceNumber: Number of Interface */
+ 0x00, /* bAlternateSetting: no alternate setting */
+ 0x02, /* bNumEndpoints: two endpoints used */
+ CDC_DATA_INTERFACE_CLASS, /* bInterfaceClass: Data Interface Class */
+ 0x00, /* bInterfaceSubClass: no subclass available */
+ 0x00, /* bInterfaceProtocol: no protocol used */
+ 0x04, /* iInterface: */
+ /* Endpoint, EP Bulk Out */
+ USB_ENDPOINT_DESC_SIZE, /* bLength */
+ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
+ USB_CDC_OUT_EP, /* bEndpointAddress */
+ USB_ENDPOINT_TYPE_BULK, /* bmAttributes */
+ WBVAL(USB_FS_MAX_BULK_PACKET), /* wMaxPacketSize */
+ 0x00, /* bInterval: ignore for Bulk transfer */
+ /* Endpoint, EP Bulk In */
+ USB_ENDPOINT_DESC_SIZE, /* bLength */
+ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
+ USB_CDC_IN_EP, /* bEndpointAddress */
+ USB_ENDPOINT_TYPE_BULK, /* bmAttributes */
+ WBVAL(64), /* wMaxPacketSize */
+ 0x00, /* bInterval: ignore for Bulk transfer */
+ /* Terminator */
+ 0 /* bLength */
+};
+
+/**
+ * USB String Descriptor (optional)
+ */
+ALIGNED(4) const uint8_t USB_StringDescriptor[] = {
+ /* Index 0x00: LANGID Codes */
+ 0x04, /* bLength */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL(0x0409), /* US English */ /* wLANGID */
+ /* Index 0x01: Manufacturer */
+ (3 * 2 + 2), /* bLength (13 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'N', 0,
+ 'X', 0,
+ 'P', 0,
+ /* Index 0x02: Product */
+ (9 * 2 + 2), /* bLength */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'V', 0,
+ 'C', 0,
+ 'O', 0,
+ 'M', 0,
+ ' ', 0,
+ 'P', 0,
+ 'o', 0,
+ 'r', 0,
+ 't', 0,
+ /* Index 0x03: Serial Number */
+ (6 * 2 + 2), /* bLength (8 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'N', 0,
+ 'X', 0,
+ 'P', 0,
+ '-', 0,
+ '7', 0,
+ '7', 0,
+ /* Index 0x04: Interface 1, Alternate Setting 0 */
+ ( 4 * 2 + 2), /* bLength (4 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'V', 0,
+ 'C', 0,
+ 'O', 0,
+ 'M', 0,
+};
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/src/cdc_main.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/src/cdc_main.c
new file mode 100644
index 0000000..87a13cd
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/src/cdc_main.c
@@ -0,0 +1,174 @@
+/*
+ * @brief Vitual communication port example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include <stdio.h>
+#include <string.h>
+#include "app_usbd_cfg.h"
+#include "cdc_vcom.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+static USBD_HANDLE_T g_hUsb;
+static uint8_t g_rxBuff[256];
+const USBD_API_T *g_pUsbApi;
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle interrupt from USB0
+ * @return Nothing
+ */
+void USB_IRQHandler(void)
+{
+ USBD_API->hw->ISR(g_hUsb);
+}
+
+/* Find the address of interface descriptor for given class type. */
+USB_INTERFACE_DESCRIPTOR *find_IntfDesc(const uint8_t *pDesc, uint32_t intfClass)
+{
+ USB_COMMON_DESCRIPTOR *pD;
+ USB_INTERFACE_DESCRIPTOR *pIntfDesc = 0;
+ uint32_t next_desc_adr;
+
+ pD = (USB_COMMON_DESCRIPTOR *) pDesc;
+ next_desc_adr = (uint32_t) pDesc;
+
+ while (pD->bLength) {
+ /* is it interface descriptor */
+ if (pD->bDescriptorType == USB_INTERFACE_DESCRIPTOR_TYPE) {
+
+ pIntfDesc = (USB_INTERFACE_DESCRIPTOR *) pD;
+ /* did we find the right interface descriptor */
+ if (pIntfDesc->bInterfaceClass == intfClass) {
+ break;
+ }
+ }
+ pIntfDesc = 0;
+ next_desc_adr = (uint32_t) pD + pD->bLength;
+ pD = (USB_COMMON_DESCRIPTOR *) next_desc_adr;
+ }
+
+ return pIntfDesc;
+}
+
+/**
+ * @brief main routine for blinky example
+ * @return Function should not exit.
+ */
+int main(void)
+{
+ USBD_API_INIT_PARAM_T usb_param;
+ USB_CORE_DESCS_T desc;
+ ErrorCode_t ret = LPC_OK;
+ uint32_t prompt = 0, rdCnt = 0;
+
+ SystemCoreClockUpdate();
+ /* Initialize board and chip */
+ Board_Init();
+
+ /* enable clocks */
+ Chip_USB_Init();
+
+ /* initialize USBD ROM API pointer. */
+ g_pUsbApi = (const USBD_API_T *) LPC_ROM_API->pUSBD;
+
+ /* initialize call back structures */
+ memset((void *) &usb_param, 0, sizeof(USBD_API_INIT_PARAM_T));
+ usb_param.usb_reg_base = LPC_USB0_BASE;
+ /* WORKAROUND for artf44835 ROM driver BUG:
+ Code clearing STALL bits in endpoint reset routine corrupts memory area
+ next to the endpoint control data. For example When EP0, EP1_IN, EP1_OUT,
+ EP2_IN are used we need to specify 3 here. But as a workaround for this
+ issue specify 4. So that extra EPs control structure acts as padding buffer
+ to avoid data corruption. Corruption of padding memory doesn’t affect the
+ stack/program behaviour.
+ */
+ usb_param.max_num_ep = 3 + 1;
+ usb_param.mem_base = USB_STACK_MEM_BASE;
+ usb_param.mem_size = USB_STACK_MEM_SIZE;
+
+ /* Set the USB descriptors */
+ desc.device_desc = (uint8_t *) &USB_DeviceDescriptor[0];
+ desc.string_desc = (uint8_t *) &USB_StringDescriptor[0];
+ /* Note, to pass USBCV test full-speed only devices should have both
+ descriptor arrays point to same location and device_qualifier set to 0.
+ */
+ desc.high_speed_desc = (uint8_t *) &USB_FsConfigDescriptor[0];
+ desc.full_speed_desc = (uint8_t *) &USB_FsConfigDescriptor[0];
+ desc.device_qualifier = 0;
+
+ /* USB Initialization */
+ ret = USBD_API->hw->Init(&g_hUsb, &desc, &usb_param);
+ if (ret == LPC_OK) {
+
+ /* Init VCOM interface */
+ ret = vcom_init(g_hUsb, &desc, &usb_param);
+ if (ret == LPC_OK) {
+ /* enable USB interrupts */
+ NVIC_EnableIRQ(USB0_IRQn);
+ /* now connect */
+ USBD_API->hw->Connect(g_hUsb, 1);
+ }
+
+ }
+
+ DEBUGSTR("USB CDC class based virtual Comm port example!\r\n");
+
+ while (1) {
+ /* Check if host has connected and opened the VCOM port */
+ if ((vcom_connected() != 0) && (prompt == 0)) {
+ vcom_write("Hello World!!\r\n", 15);
+ prompt = 1;
+ }
+ /* If VCOM port is opened echo whatever we receive back to host. */
+ if (prompt) {
+ rdCnt = vcom_bread(&g_rxBuff[0], 256);
+ if (rdCnt) {
+ vcom_write(&g_rxBuff[0], rdCnt);
+ }
+ }
+ /* Sleep until next IRQ happens */
+ __WFI();
+ }
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/src/cdc_vcom.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/src/cdc_vcom.c
new file mode 100644
index 0000000..3eef973
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/src/cdc_vcom.c
@@ -0,0 +1,230 @@
+/*
+ * @brief Virtual Comm port call back routines
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+#include <string.h>
+#include "app_usbd_cfg.h"
+#include "board.h"
+#include "cdc_vcom.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/**
+ * Global variable to hold Virtual COM port control data.
+ */
+VCOM_DATA_T g_vCOM;
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* VCOM bulk EP_IN endpoint handler */
+static ErrorCode_t VCOM_bulk_in_hdlr(USBD_HANDLE_T hUsb, void *data, uint32_t event)
+{
+ VCOM_DATA_T *pVcom = (VCOM_DATA_T *) data;
+
+ if (event == USB_EVT_IN) {
+ pVcom->tx_flags &= ~VCOM_TX_BUSY;
+ }
+ return LPC_OK;
+}
+
+/* VCOM bulk EP_OUT endpoint handler */
+static ErrorCode_t VCOM_bulk_out_hdlr(USBD_HANDLE_T hUsb, void *data, uint32_t event)
+{
+ VCOM_DATA_T *pVcom = (VCOM_DATA_T *) data;
+
+ switch (event) {
+ case USB_EVT_OUT:
+ pVcom->rx_count = USBD_API->hw->ReadEP(hUsb, USB_CDC_OUT_EP, pVcom->rx_buff);
+ if (pVcom->rx_flags & VCOM_RX_BUF_QUEUED) {
+ pVcom->rx_flags &= ~VCOM_RX_BUF_QUEUED;
+ if (pVcom->rx_count != 0) {
+ pVcom->rx_flags |= VCOM_RX_BUF_FULL;
+ }
+
+ }
+ else if (pVcom->rx_flags & VCOM_RX_DB_QUEUED) {
+ pVcom->rx_flags &= ~VCOM_RX_DB_QUEUED;
+ pVcom->rx_flags |= VCOM_RX_DONE;
+ }
+ break;
+
+ case USB_EVT_OUT_NAK:
+ /* queue free buffer for RX */
+ if ((pVcom->rx_flags & (VCOM_RX_BUF_FULL | VCOM_RX_BUF_QUEUED)) == 0) {
+ USBD_API->hw->ReadReqEP(hUsb, USB_CDC_OUT_EP, pVcom->rx_buff, VCOM_RX_BUF_SZ);
+ pVcom->rx_flags |= VCOM_RX_BUF_QUEUED;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return LPC_OK;
+}
+
+/* Set line coding call back routine */
+static ErrorCode_t VCOM_SetLineCode(USBD_HANDLE_T hCDC, CDC_LINE_CODING *line_coding)
+{
+ VCOM_DATA_T *pVcom = &g_vCOM;
+
+ /* Called when baud rate is changed/set. Using it to know host connection state */
+ pVcom->tx_flags = VCOM_TX_CONNECTED; /* reset other flags */
+
+ return LPC_OK;
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Virtual com port init routine */
+ErrorCode_t vcom_init(USBD_HANDLE_T hUsb, USB_CORE_DESCS_T *pDesc, USBD_API_INIT_PARAM_T *pUsbParam)
+{
+ USBD_CDC_INIT_PARAM_T cdc_param;
+ ErrorCode_t ret = LPC_OK;
+ uint32_t ep_indx;
+
+ g_vCOM.hUsb = hUsb;
+ memset((void *) &cdc_param, 0, sizeof(USBD_CDC_INIT_PARAM_T));
+ cdc_param.mem_base = pUsbParam->mem_base;
+ cdc_param.mem_size = pUsbParam->mem_size;
+ cdc_param.cif_intf_desc = (uint8_t *) find_IntfDesc(pDesc->high_speed_desc, CDC_COMMUNICATION_INTERFACE_CLASS);
+ cdc_param.dif_intf_desc = (uint8_t *) find_IntfDesc(pDesc->high_speed_desc, CDC_DATA_INTERFACE_CLASS);
+ cdc_param.SetLineCode = VCOM_SetLineCode;
+
+ ret = USBD_API->cdc->init(hUsb, &cdc_param, &g_vCOM.hCdc);
+
+ if (ret == LPC_OK) {
+ /* allocate transfer buffers */
+ g_vCOM.rx_buff = (uint8_t *) cdc_param.mem_base;
+ cdc_param.mem_base += VCOM_RX_BUF_SZ;
+ cdc_param.mem_size -= VCOM_RX_BUF_SZ;
+
+ /* register endpoint interrupt handler */
+ ep_indx = (((USB_CDC_IN_EP & 0x0F) << 1) + 1);
+ ret = USBD_API->core->RegisterEpHandler(hUsb, ep_indx, VCOM_bulk_in_hdlr, &g_vCOM);
+ if (ret == LPC_OK) {
+ /* register endpoint interrupt handler */
+ ep_indx = ((USB_CDC_OUT_EP & 0x0F) << 1);
+ ret = USBD_API->core->RegisterEpHandler(hUsb, ep_indx, VCOM_bulk_out_hdlr, &g_vCOM);
+
+ }
+ /* update mem_base and size variables for cascading calls. */
+ pUsbParam->mem_base = cdc_param.mem_base;
+ pUsbParam->mem_size = cdc_param.mem_size;
+ }
+
+ return ret;
+}
+
+/* Virtual com port buffered read routine */
+uint32_t vcom_bread(uint8_t *pBuf, uint32_t buf_len)
+{
+ VCOM_DATA_T *pVcom = &g_vCOM;
+ uint16_t cnt = 0;
+ /* read from the default buffer if any data present */
+ if (pVcom->rx_count) {
+ cnt = (pVcom->rx_count < buf_len) ? pVcom->rx_count : buf_len;
+ memcpy(pBuf, pVcom->rx_buff, cnt);
+ pVcom->rx_rd_count += cnt;
+
+ /* enter critical section */
+ NVIC_DisableIRQ(USB0_IRQn);
+ if (pVcom->rx_rd_count >= pVcom->rx_count) {
+ pVcom->rx_flags &= ~VCOM_RX_BUF_FULL;
+ pVcom->rx_rd_count = pVcom->rx_count = 0;
+ }
+ /* exit critical section */
+ NVIC_EnableIRQ(USB0_IRQn);
+ }
+ return cnt;
+
+}
+
+/* Virtual com port read routine */
+ErrorCode_t vcom_read_req(uint8_t *pBuf, uint32_t len)
+{
+ VCOM_DATA_T *pVcom = &g_vCOM;
+
+ /* check if we queued Rx buffer */
+ if (pVcom->rx_flags & (VCOM_RX_BUF_QUEUED | VCOM_RX_DB_QUEUED)) {
+ return ERR_BUSY;
+ }
+ /* enter critical section */
+ NVIC_DisableIRQ(USB0_IRQn);
+ /* if not queue the request and return 0 bytes */
+ USBD_API->hw->ReadReqEP(pVcom->hUsb, USB_CDC_OUT_EP, pBuf, len);
+ /* exit critical section */
+ NVIC_EnableIRQ(USB0_IRQn);
+ pVcom->rx_flags |= VCOM_RX_DB_QUEUED;
+
+ return LPC_OK;
+}
+
+/* Gets current read count. */
+uint32_t vcom_read_cnt(void)
+{
+ VCOM_DATA_T *pVcom = &g_vCOM;
+ uint32_t ret = 0;
+
+ if (pVcom->rx_flags & VCOM_RX_DONE) {
+ ret = pVcom->rx_count;
+ pVcom->rx_count = 0;
+ }
+
+ return ret;
+}
+
+/* Virtual com port write routine*/
+uint32_t vcom_write(uint8_t *pBuf, uint32_t len)
+{
+ VCOM_DATA_T *pVcom = &g_vCOM;
+ uint32_t ret = 0;
+
+ if ( (pVcom->tx_flags & VCOM_TX_CONNECTED) && ((pVcom->tx_flags & VCOM_TX_BUSY) == 0) ) {
+ pVcom->tx_flags |= VCOM_TX_BUSY;
+
+ /* enter critical section */
+ NVIC_DisableIRQ(USB0_IRQn);
+ ret = USBD_API->hw->WriteEP(pVcom->hUsb, USB_CDC_IN_EP, pBuf, len);
+ /* exit critical section */
+ NVIC_EnableIRQ(USB0_IRQn);
+ }
+
+ return ret;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/.cproject
new file mode 100644
index 0000000..d276ca9
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/.cproject
@@ -0,0 +1,243 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1249427026">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1249427026" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1249427026" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1249427026." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.1685284530" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1488115577" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/usbd_rom_cdc_uart}/Debug" id="com.crt.advproject.builder.exe.debug.892602445" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1970385134" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.968367154" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.1964906485" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.290878382" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.515537543" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.449842993" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1142910053" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.343382013" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/example/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc/usbd}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1273082380" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.68389427" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.172477181" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1052182067" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1488239075" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.214186526" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1884623477" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.57685252" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1392765194" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1259402711" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.263823772" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1358756567" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.2080134929" name="Linker script" superClass="com.crt.advproject.link.script" value=""usbd_rom_cdc_uart_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1032932173" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1190311073" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.70989581" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1938684674" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1575273139" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1102657692" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.756387317" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.1091194492">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.1091194492" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.1091194492" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.1091194492." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.620516335" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1042737271" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/usbd_rom_cdc_uart}/Release" id="com.crt.advproject.builder.exe.release.129770262" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.198448793" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.1174609702" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.526291671" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.869764154" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.888337285" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1061534553" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1523394895" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.533231737" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/example/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc/usbd}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.444919300" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.711945760" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1816463116" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.728859644" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1460954435" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1439291104" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1249682803" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1344316377" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.1422658788" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.2038362173" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.181664055" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.189391800" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.444168997" name="Linker script" superClass="com.crt.advproject.link.script" value=""usbd_rom_cdc_uart_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1561603275" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1155240465" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.948971389" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.972820638" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1501284072" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1721452498" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.985787406" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="usbd_rom_cdc_uart.com.crt.advproject.projecttype.exe.1743021975" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/.project
new file mode 100644
index 0000000..60dc364
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>usbd_rom_cdc_uart</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/inc/app_usbd_cfg.h b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/inc/app_usbd_cfg.h
new file mode 100644
index 0000000..9ae863b
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/inc/app_usbd_cfg.h
@@ -0,0 +1,96 @@
+/*
+ * @brief Configuration file needed for USB ROM stack based applications.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+#include "lpc_types.h"
+#include "error.h"
+#include "usbd_rom_api.h"
+
+#ifndef __APP_USB_CFG_H_
+#define __APP_USB_CFG_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @ingroup EXAMPLES_USBDROM_15XX_CDC_UART
+ * @{
+ */
+
+/* Manifest constants used by USBD ROM stack. These values SHOULD NOT BE CHANGED
+ for advance features which require usage of USB_CORE_CTRL_T structure.
+ Since these are the values used for compiling USB stack.
+ */
+#define USB_MAX_IF_NUM 8 /*!< Max interface number used for building USBDL_Lib. DON'T CHANGE. */
+#define USB_MAX_EP_NUM 5 /*!< Max number of EP used for building USBD ROM. DON'T CHANGE. */
+#define USB_MAX_PACKET0 64 /*!< Max EP0 packet size used for building USBD ROM. DON'T CHANGE. */
+#define USB_FS_MAX_BULK_PACKET 64 /*!< MAXP for FS bulk EPs used for building USBD ROM. DON'T CHANGE. */
+#define USB_HS_MAX_BULK_PACKET 512 /*!< MAXP for HS bulk EPs used for building USBD ROM. DON'T CHANGE. */
+#define USB_DFU_XFER_SIZE 2048 /*!< Max DFU transfer size used for building USBD ROM. DON'T CHANGE. */
+
+/* Manifest constants defining interface numbers and endpoints used by a
+ particular interface in this application.
+ */
+#define USB_CDC_CIF_NUM 0
+#define USB_CDC_DIF_NUM 1
+#define USB_CDC_IN_EP 0x81
+#define USB_CDC_OUT_EP 0x01
+#define USB_CDC_INT_EP 0x82
+
+/* The following manifest constants are used to define this memory area to be used
+ by USBD ROM stack.
+ */
+#define USB_STACK_MEM_BASE 0x02008000
+#define USB_STACK_MEM_SIZE 0x1000
+
+/* USB descriptor arrays defined *_desc.c file */
+extern const uint8_t USB_DeviceDescriptor[];
+extern uint8_t USB_FsConfigDescriptor[];
+extern const uint8_t USB_StringDescriptor[];
+extern const uint8_t USB_DeviceQualifier[];
+
+/**
+ * @brief Find the address of interface descriptor for given class type.
+ * @param pDesc : Pointer to configuration descriptor in which the desired class
+ * interface descriptor to be found.
+ * @param intfClass : Interface class type to be searched.
+ * @return If found returns the address of requested interface else returns NULL.
+ */
+extern USB_INTERFACE_DESCRIPTOR *find_IntfDesc(const uint8_t *pDesc, uint32_t intfClass);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __APP_USB_CFG_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/inc/cdc_uart.h b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/inc/cdc_uart.h
new file mode 100644
index 0000000..a5f6b43
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/inc/cdc_uart.h
@@ -0,0 +1,63 @@
+/*
+ * @brief Programming API used with Virtual Communication port
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __CDC_UCOM_H_
+#define __CDC_UCOM_H_
+
+#include "app_usbd_cfg.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @ingroup EXAMPLES_USBDROM_15XX_CDC_UART
+ * @{
+ */
+
+/**
+ * @brief USB to UART bridge port init routine
+ * @param hUsb : Handle to USBD stack instance
+ * @param pDesc : Pointer to configuration descriptor
+ * @param pUsbParam : Pointer USB param structure returned by previous init call
+ * @return Always returns LPC_OK.
+ */
+ErrorCode_t UCOM_init (USBD_HANDLE_T hUsb, USB_CORE_DESCS_T *pDesc, USBD_API_INIT_PARAM_T *pUsbParam);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CDC_UCOM_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/readme.dox
new file mode 100644
index 0000000..29716cb
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/readme.dox
@@ -0,0 +1,64 @@
+/*
+ * @brief USB to UART bridge example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_USBDROM_15XX_CDC_UARTN LPC15XX USB to UART bridge example
+ * @ingroup EXAMPLES_USBDROM_15XX
+ * <b>Example description</b><br>
+ * The example shows how to us USBD ROM stack to creates a USB to UART converter port.
+ * The example uses UARTN api. Note, LPC15XX has two types of UARTs.
+ * <br>
+ *
+ * <b>Special connection requirements</b><br>
+ * Connect the USB cable between micro connector on board and to a host.
+ * When connected to Windows host use the .inf included in the project
+ * directory to install the driver. For OSx (Mac) host, no drivers are needed.<br>
+ *
+ * When using @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549 boards with a base board you need to remove jumpers
+ * J54 & J55 on base board and power the system through USB port connected to FTDI chip. Note,
+ * serial port settings such as baud rate, parity and data bits should be same for FTDI port and
+ * "LPC VCOM port".
+ *
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/src/cdc_desc.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/src/cdc_desc.c
new file mode 100644
index 0000000..b03a109
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/src/cdc_desc.c
@@ -0,0 +1,206 @@
+/*
+ * @brief Virtual Comm port USB descriptors
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "app_usbd_cfg.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/**
+ * USB Standard Device Descriptor
+ */
+ALIGNED(4) const uint8_t USB_DeviceDescriptor[] = {
+ USB_DEVICE_DESC_SIZE, /* bLength */
+ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL(0x0200), /* bcdUSB */
+ 0xEF, /* bDeviceClass */
+ 0x02, /* bDeviceSubClass */
+ 0x01, /* bDeviceProtocol */
+ USB_MAX_PACKET0, /* bMaxPacketSize0 */
+ WBVAL(0x1FC9), /* idVendor */
+ WBVAL(0x0083), /* idProduct */
+ WBVAL(0x0100), /* bcdDevice */
+ 0x01, /* iManufacturer */
+ 0x02, /* iProduct */
+ 0x03, /* iSerialNumber */
+ 0x01 /* bNumConfigurations */
+};
+
+/**
+ * USB FSConfiguration Descriptor
+ * All Descriptors (Configuration, Interface, Endpoint, Class, Vendor)
+ */
+ALIGNED(4) uint8_t USB_FsConfigDescriptor[] = {
+ /* Configuration 1 */
+ USB_CONFIGURATION_DESC_SIZE, /* bLength */
+ USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL( /* wTotalLength */
+ USB_CONFIGURATION_DESC_SIZE +
+ USB_INTERFACE_ASSOC_DESC_SIZE + /* interface association descriptor */
+ USB_INTERFACE_DESC_SIZE + /* communication control interface */
+ 0x0013 + /* CDC functions */
+ 1 * USB_ENDPOINT_DESC_SIZE + /* interrupt endpoint */
+ USB_INTERFACE_DESC_SIZE + /* communication data interface */
+ 2 * USB_ENDPOINT_DESC_SIZE + /* bulk endpoints */
+ 0
+ ),
+ 0x02, /* bNumInterfaces */
+ 0x01, /* bConfigurationValue */
+ 0x00, /* iConfiguration */
+ USB_CONFIG_SELF_POWERED, /* bmAttributes */
+ USB_CONFIG_POWER_MA(500), /* bMaxPower */
+
+ /* Interface association descriptor IAD*/
+ USB_INTERFACE_ASSOC_DESC_SIZE, /* bLength */
+ USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE, /* bDescriptorType */
+ USB_CDC_CIF_NUM, /* bFirstInterface */
+ 0x02, /* bInterfaceCount */
+ CDC_COMMUNICATION_INTERFACE_CLASS, /* bFunctionClass */
+ CDC_ABSTRACT_CONTROL_MODEL, /* bFunctionSubClass */
+ 0x00, /* bFunctionProtocol */
+ 0x04, /* iFunction */
+
+ /* Interface 0, Alternate Setting 0, Communication class interface descriptor */
+ USB_INTERFACE_DESC_SIZE, /* bLength */
+ USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
+ USB_CDC_CIF_NUM, /* bInterfaceNumber: Number of Interface */
+ 0x00, /* bAlternateSetting: Alternate setting */
+ 0x01, /* bNumEndpoints: One endpoint used */
+ CDC_COMMUNICATION_INTERFACE_CLASS, /* bInterfaceClass: Communication Interface Class */
+ CDC_ABSTRACT_CONTROL_MODEL, /* bInterfaceSubClass: Abstract Control Model */
+ 0x00, /* bInterfaceProtocol: no protocol used */
+ 0x04, /* iInterface: */
+ /* Header Functional Descriptor*/
+ 0x05, /* bLength: CDC header Descriptor size */
+ CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */
+ CDC_HEADER, /* bDescriptorSubtype: Header Func Desc */
+ WBVAL(CDC_V1_10), /* bcdCDC 1.10 */
+ /* Call Management Functional Descriptor*/
+ 0x05, /* bFunctionLength */
+ CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */
+ CDC_CALL_MANAGEMENT, /* bDescriptorSubtype: Call Management Func Desc */
+ 0x01, /* bmCapabilities: device handles call management */
+ USB_CDC_DIF_NUM, /* bDataInterface: CDC data IF ID */
+ /* Abstract Control Management Functional Descriptor*/
+ 0x04, /* bFunctionLength */
+ CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */
+ CDC_ABSTRACT_CONTROL_MANAGEMENT, /* bDescriptorSubtype: Abstract Control Management desc */
+ 0x02, /* bmCapabilities: SET_LINE_CODING, GET_LINE_CODING, SET_CONTROL_LINE_STATE supported */
+ /* Union Functional Descriptor*/
+ 0x05, /* bFunctionLength */
+ CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */
+ CDC_UNION, /* bDescriptorSubtype: Union func desc */
+ USB_CDC_CIF_NUM, /* bMasterInterface: Communication class interface is master */
+ USB_CDC_DIF_NUM, /* bSlaveInterface0: Data class interface is slave 0 */
+ /* Endpoint 1 Descriptor*/
+ USB_ENDPOINT_DESC_SIZE, /* bLength */
+ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
+ USB_CDC_INT_EP, /* bEndpointAddress */
+ USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */
+ WBVAL(0x0010), /* wMaxPacketSize */
+ 0x02, /* 2ms */ /* bInterval */
+
+ /* Interface 1, Alternate Setting 0, Data class interface descriptor*/
+ USB_INTERFACE_DESC_SIZE, /* bLength */
+ USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
+ USB_CDC_DIF_NUM, /* bInterfaceNumber: Number of Interface */
+ 0x00, /* bAlternateSetting: no alternate setting */
+ 0x02, /* bNumEndpoints: two endpoints used */
+ CDC_DATA_INTERFACE_CLASS, /* bInterfaceClass: Data Interface Class */
+ 0x00, /* bInterfaceSubClass: no subclass available */
+ 0x00, /* bInterfaceProtocol: no protocol used */
+ 0x04, /* iInterface: */
+ /* Endpoint, EP Bulk Out */
+ USB_ENDPOINT_DESC_SIZE, /* bLength */
+ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
+ USB_CDC_OUT_EP, /* bEndpointAddress */
+ USB_ENDPOINT_TYPE_BULK, /* bmAttributes */
+ WBVAL(USB_FS_MAX_BULK_PACKET), /* wMaxPacketSize */
+ 0x00, /* bInterval: ignore for Bulk transfer */
+ /* Endpoint, EP Bulk In */
+ USB_ENDPOINT_DESC_SIZE, /* bLength */
+ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
+ USB_CDC_IN_EP, /* bEndpointAddress */
+ USB_ENDPOINT_TYPE_BULK, /* bmAttributes */
+ WBVAL(64), /* wMaxPacketSize */
+ 0x00, /* bInterval: ignore for Bulk transfer */
+ /* Terminator */
+ 0 /* bLength */
+};
+
+/**
+ * USB String Descriptor (optional)
+ */
+ALIGNED(4) const uint8_t USB_StringDescriptor[] = {
+ /* Index 0x00: LANGID Codes */
+ 0x04, /* bLength */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL(0x0409), /* US English */ /* wLANGID */
+ /* Index 0x01: Manufacturer */
+ (3 * 2 + 2), /* bLength (13 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'N', 0,
+ 'X', 0,
+ 'P', 0,
+ /* Index 0x02: Product */
+ (9 * 2 + 2), /* bLength */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'V', 0,
+ 'C', 0,
+ 'O', 0,
+ 'M', 0,
+ ' ', 0,
+ 'P', 0,
+ 'o', 0,
+ 'r', 0,
+ 't', 0,
+ /* Index 0x03: Serial Number */
+ (6 * 2 + 2), /* bLength (8 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'N', 0,
+ 'X', 0,
+ 'P', 0,
+ '-', 0,
+ '7', 0,
+ '7', 0,
+ /* Index 0x04: Interface 1, Alternate Setting 0 */
+ ( 4 * 2 + 2), /* bLength (4 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'V', 0,
+ 'C', 0,
+ 'O', 0,
+ 'M', 0,
+};
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/src/cdc_main.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/src/cdc_main.c
new file mode 100644
index 0000000..d3740c7
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/src/cdc_main.c
@@ -0,0 +1,159 @@
+/*
+ * @brief USB to UART bridge example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include <stdio.h>
+#include <string.h>
+#include "app_usbd_cfg.h"
+#include "cdc_uart.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+static USBD_HANDLE_T g_hUsb;
+const USBD_API_T *g_pUsbApi;
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle interrupt from USB0
+ * @return Nothing
+ */
+void USB_IRQHandler(void)
+{
+ USBD_API->hw->ISR(g_hUsb);
+}
+
+/* Find the address of interface descriptor for given class type. */
+USB_INTERFACE_DESCRIPTOR *find_IntfDesc(const uint8_t *pDesc, uint32_t intfClass)
+{
+ USB_COMMON_DESCRIPTOR *pD;
+ USB_INTERFACE_DESCRIPTOR *pIntfDesc = 0;
+ uint32_t next_desc_adr;
+
+ pD = (USB_COMMON_DESCRIPTOR *) pDesc;
+ next_desc_adr = (uint32_t) pDesc;
+
+ while (pD->bLength) {
+ /* is it interface descriptor */
+ if (pD->bDescriptorType == USB_INTERFACE_DESCRIPTOR_TYPE) {
+
+ pIntfDesc = (USB_INTERFACE_DESCRIPTOR *) pD;
+ /* did we find the right interface descriptor */
+ if (pIntfDesc->bInterfaceClass == intfClass) {
+ break;
+ }
+ }
+ pIntfDesc = 0;
+ next_desc_adr = (uint32_t) pD + pD->bLength;
+ pD = (USB_COMMON_DESCRIPTOR *) next_desc_adr;
+ }
+
+ return pIntfDesc;
+}
+
+/**
+ * @brief main routine for blinky example
+ * @return Function should not exit.
+ */
+int main(void)
+{
+ USBD_API_INIT_PARAM_T usb_param;
+ USB_CORE_DESCS_T desc;
+ ErrorCode_t ret = LPC_OK;
+
+ SystemCoreClockUpdate();
+ /* Initialize board and chip */
+ Board_Init();
+
+ /* enable clocks */
+ Chip_USB_Init();
+
+ /* initialize USBD ROM API pointer. */
+ g_pUsbApi = (const USBD_API_T *) LPC_ROM_API->pUSBD;
+
+ /* initialize call back structures */
+ memset((void *) &usb_param, 0, sizeof(USBD_API_INIT_PARAM_T));
+ usb_param.usb_reg_base = LPC_USB0_BASE;
+ /* WORKAROUND for artf44835 ROM driver BUG:
+ Code clearing STALL bits in endpoint reset routine corrupts memory area
+ next to the endpoint control data. For example When EP0, EP1_IN, EP1_OUT,
+ EP2_IN are used we need to specify 3 here. But as a workaround for this
+ issue specify 4. So that extra EPs control structure acts as padding buffer
+ to avoid data corruption. Corruption of padding memory doesn’t affect the
+ stack/program behaviour.
+ */
+ usb_param.max_num_ep = 3 + 1;
+ usb_param.mem_base = USB_STACK_MEM_BASE;
+ usb_param.mem_size = USB_STACK_MEM_SIZE;
+
+ /* Set the USB descriptors */
+ desc.device_desc = (uint8_t *) &USB_DeviceDescriptor[0];
+ desc.string_desc = (uint8_t *) &USB_StringDescriptor[0];
+ /* Note, to pass USBCV test full-speed only devices should have both
+ descriptor arrays point to same location and device_qualifier set to 0.
+ */
+ desc.high_speed_desc = (uint8_t *) &USB_FsConfigDescriptor[0];
+ desc.full_speed_desc = (uint8_t *) &USB_FsConfigDescriptor[0];
+ desc.device_qualifier = 0;
+
+ /* USB Initialization */
+ ret = USBD_API->hw->Init(&g_hUsb, &desc, &usb_param);
+ if (ret == LPC_OK) {
+
+ /* Init UCOM - USB to UART bridge interface */
+ ret = UCOM_init(g_hUsb, &desc, &usb_param);
+ if (ret == LPC_OK) {
+ /* Make sure USB and UART IRQ priorities are same for this example */
+ NVIC_SetPriority(USB0_IRQn, 1);
+ /* enable USB interrupts */
+ NVIC_EnableIRQ(USB0_IRQn);
+ /* now connect */
+ USBD_API->hw->Connect(g_hUsb, 1);
+ }
+ }
+
+ while (1) {
+ /* Sleep until next IRQ happens */
+ __WFI();
+ }
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/src/cdc_uart.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/src/cdc_uart.c
new file mode 100644
index 0000000..967f9a2
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/src/cdc_uart.c
@@ -0,0 +1,356 @@
+/*
+ * @brief UART Comm port call back routines
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+#include <string.h>
+#include "board.h"
+#include "app_usbd_cfg.h"
+#include "cdc_uart.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* Enable this define to use integer clocking instead of the fractional baud
+ rate generator */
+#define USE_INTEGER_CLOCK
+
+/* Set the default UART, IRQ number, and IRQ handler name */
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+#define LPC_USART LPC_USART0
+#define LPC_IRQNUM UART0_IRQn
+#define LPC_UARTHNDLR UART0_IRQHandler
+
+#else
+/* Configure your own UART pin muxing here if needed */
+#error "No UART setup defined"
+#endif
+
+/* Default baudrate for testing */
+#define UART_TEST_DEFAULT_BAUDRATE 115200
+
+/* Ring buffer size */
+#define UCOM_BUF_SZ 64 /* The size should always be 2^n type.*/
+#define UCOM_TX_CONNECTED _BIT(8) /* connection state is for both RX/Tx */
+#define UCOM_TX_BUSY _BIT(0)
+
+#define UCOM_RX_UART_DIS _BIT(0)
+#define UCOM_RX_BUF_FULL _BIT(1)
+#define UCOM_RX_BUF_QUEUED _BIT(2)
+#define UCOM_RX_DB_QUEUED _BIT(3)
+
+/**
+ * Structure containing Virtual Comm port control data
+ */
+typedef struct UCOM_DATA {
+ USBD_HANDLE_T hUsb; /*!< Handle to USB stack */
+ USBD_HANDLE_T hCdc; /*!< Handle to CDC class controller */
+
+ uint8_t *rxBuf; /*!< UART Rx buffer */
+ uint8_t *txBuf; /*!< UART Tx buffer */
+ uint8_t txBuf_uartIndex;/*!< UART index in Tx buffer */
+ int8_t txBuf_count; /*!< Bytes present in Tx buffer */
+ uint8_t rxBuf_uartIndex;/*!< UART index in Rx buffer */
+ uint8_t rxBuf_usbIndex; /*!< USB index in Rx buffer */
+
+ volatile uint8_t usbTxBusy; /*!< USB is busy sending previous packet */
+ volatile uint8_t usbRxPending; /*!< USB packet is pending in EP buffer */
+} UCOM_DATA_T;
+
+/** Virtual Comm port control data instance. */
+static UCOM_DATA_T g_uCOM;
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+static void Init_UART_PinMux(void)
+{
+#if defined(BOARD_NXP_LPCXPRESSO_1549)
+ /* Disables pull-ups/pull-downs and enable digital mode */
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 13, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 18, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+
+ /* UART signal muxing via SWM */
+ Chip_SWM_MovablePortPinAssign(SWM_UART0_RXD_I, 0, 13);
+ Chip_SWM_MovablePortPinAssign(SWM_UART0_TXD_O, 0, 18);
+
+#else
+#warning "No UART nmuxing defined for this example"
+#endif
+}
+
+/* UART port init routine */
+void UCOM_UartInit(void)
+{
+ /* Board specific muxing */
+ Init_UART_PinMux();
+
+ /* Before setting up the UART, the global UART clock for USARTS 1-4
+ must first be setup. This requires setting the UART divider and
+ the UART base clock rate to 16x the maximum UART rate for all
+ UARTs. */
+#if defined(USE_INTEGER_CLOCK)
+ /* Use main clock rate as base for UART baud rate divider */
+ Chip_Clock_SetUARTBaseClockRate(Chip_Clock_GetMainClockRate(), false);
+
+#else
+ /* Use 128x expected UART baud rate for fractional baud mode. */
+ Chip_Clock_SetUARTBaseClockRate((115200 * 128), true);
+#endif
+
+ /* Setup UART */
+ Chip_UART_Init(LPC_USART);
+ Chip_UART_ConfigData(LPC_USART, UART_CFG_DATALEN_8 | UART_CFG_PARITY_NONE | UART_CFG_STOPLEN_1);
+ Chip_UART_SetBaud(LPC_USART, UART_TEST_DEFAULT_BAUDRATE);
+ /* Optional for low clock rates only: Chip_UART_SetBaudWithRTC32K(LPC_USART, 300); */
+ Chip_UART_Enable(LPC_USART);
+ Chip_UART_TXEnable(LPC_USART);
+
+ /* Enable receive data and line status interrupt */
+ Chip_UART_IntEnable(LPC_USART, UART_INTEN_RXRDY);
+
+ /* Enable Interrupt for UART channel */
+ /* Priority = 1 */
+ NVIC_SetPriority(LPC_IRQNUM, 1);
+ /* Enable Interrupt for UART channel */
+ NVIC_EnableIRQ(LPC_IRQNUM);
+}
+
+/* UCOM bulk EP_IN and EP_OUT endpoints handler */
+static ErrorCode_t UCOM_bulk_hdlr(USBD_HANDLE_T hUsb, void *data, uint32_t event)
+{
+ UCOM_DATA_T *pUcom = (UCOM_DATA_T *) data;
+ uint32_t count = 0;
+
+ switch (event) {
+ /* A transfer from us to the USB host that we queued has completed. */
+ case USB_EVT_IN:
+ /* check if UART had more data to send */
+ if (pUcom->rxBuf_uartIndex < pUcom->rxBuf_usbIndex) {
+ count = UCOM_BUF_SZ - pUcom->rxBuf_usbIndex;
+ }
+ else {
+ count = pUcom->rxBuf_uartIndex - pUcom->rxBuf_usbIndex;
+ }
+ if (count) {
+ pUcom->usbTxBusy = 1;
+ count = USBD_API->hw->WriteEP(pUcom->hUsb, USB_CDC_IN_EP, &pUcom->rxBuf[g_uCOM.rxBuf_usbIndex], count);
+ g_uCOM.rxBuf_usbIndex = (g_uCOM.rxBuf_usbIndex + count) & (UCOM_BUF_SZ - 1);
+ }
+ else {
+ pUcom->usbTxBusy = 0;
+ }
+ break;
+
+ /* We received a transfer from the USB host . */
+ case USB_EVT_OUT:
+ if ((Chip_UART_GetIntsEnabled(LPC_USART) & UART_INTEN_TXRDY) == 0) {
+ pUcom->txBuf_count = USBD_API->hw->ReadEP(hUsb, USB_CDC_OUT_EP, pUcom->txBuf);
+ pUcom->txBuf_uartIndex = 0;
+ /* kick start UART tranmission */
+ pUcom->txBuf_uartIndex = Chip_UART_Send(LPC_USART,
+ &pUcom->txBuf[g_uCOM.txBuf_uartIndex],
+ pUcom->txBuf_count);
+ pUcom->txBuf_count -= pUcom->txBuf_uartIndex;
+ /* Enable UART transmit interrupt */
+ Chip_UART_IntEnable(LPC_USART, UART_INTEN_TXRDY);
+ }
+ else {
+ pUcom->usbRxPending++;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return LPC_OK;
+}
+
+/* Set line coding call back routine */
+static ErrorCode_t UCOM_SetLineCode(USBD_HANDLE_T hCDC, CDC_LINE_CODING *line_coding)
+{
+ uint32_t config_data = 0;
+
+ switch (line_coding->bDataBits) {
+ case 7:
+ config_data |= UART_CFG_DATALEN_7;
+ break;
+
+ case 9:
+ config_data |= UART_CFG_DATALEN_9;
+ break;
+
+ case 8:
+ default:
+ config_data |= UART_CFG_DATALEN_8;
+ break;
+ }
+
+ switch (line_coding->bCharFormat) {
+ case 2: /* 2 Stop Bits */
+ config_data |= UART_CFG_STOPLEN_2;
+ break;
+
+ default:
+ case 1: /* 1 Stop Bit */
+ config_data |= UART_CFG_STOPLEN_1;
+ break;
+ }
+
+ switch (line_coding->bParityType) {
+ case 1:
+ config_data |= (UART_CFG_PARITY_ODD);
+ break;
+
+ case 2:
+ config_data |= (UART_CFG_PARITY_EVEN);
+ break;
+
+ default:
+ case 0:
+ config_data |= UART_CFG_PARITY_NONE;
+ break;
+ }
+
+ if (line_coding->dwDTERate < 3125000) {
+ Chip_UART_SetBaud(LPC_USART, line_coding->dwDTERate);
+ }
+ Chip_UART_ConfigData(LPC_USART, config_data);
+
+ return LPC_OK;
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief UART interrupt handler sub-routine
+ * @return Nothing
+ */
+void LPC_UARTHNDLR(void)
+{
+ uint32_t count = 0;
+ /* Handle transmit interrupt if enabled */
+ if ((Chip_UART_GetStatus(LPC_USART) & UART_STAT_TXRDY) != 0) {
+ if (g_uCOM.txBuf_count > 0) {
+ count = Chip_UART_Send(LPC_USART, &g_uCOM.txBuf[g_uCOM.txBuf_uartIndex], g_uCOM.txBuf_count);
+ g_uCOM.txBuf_count -= count;
+ g_uCOM.txBuf_uartIndex += count;
+ }
+ /* If usbRxBuf empty check if any packet pending USB EP RAM */
+ if (g_uCOM.txBuf_count < 1) {
+ if ((g_uCOM.usbRxPending > 0) && USB_IsConfigured(g_uCOM.hUsb)) {
+ g_uCOM.usbRxPending--;
+ g_uCOM.txBuf_count = USBD_API->hw->ReadEP(g_uCOM.hUsb, USB_CDC_OUT_EP, g_uCOM.txBuf);
+ g_uCOM.txBuf_uartIndex = 0;
+
+ }
+ else {
+ /* all data transmitted on UART disable UART_INTEN_TXRDY */
+ Chip_UART_IntDisable(LPC_USART, UART_INTEN_TXRDY);
+ }
+ }
+ }
+
+ /* Handle receive interrupt */
+ count = Chip_UART_Read(LPC_USART, &g_uCOM.rxBuf[g_uCOM.rxBuf_uartIndex], UCOM_BUF_SZ - g_uCOM.rxBuf_uartIndex);
+
+ if (count) {
+ /* Note, following logic works if UCOM_BUF_SZ is 2^n size only. */
+ g_uCOM.rxBuf_uartIndex = (g_uCOM.rxBuf_uartIndex + count) & (UCOM_BUF_SZ - 1);
+ /* If USB Tx is not busy kick start USB Tx */
+ if ((g_uCOM.usbTxBusy == 0) && USB_IsConfigured(g_uCOM.hUsb)) {
+ g_uCOM.usbTxBusy = 1;
+ count = USBD_API->hw->WriteEP(g_uCOM.hUsb, USB_CDC_IN_EP, &g_uCOM.rxBuf[g_uCOM.rxBuf_usbIndex], count);
+ g_uCOM.rxBuf_usbIndex = (g_uCOM.rxBuf_usbIndex + count) & (UCOM_BUF_SZ - 1);
+ }
+ }
+
+}
+
+/* UART to USB com port init routine */
+ErrorCode_t UCOM_init(USBD_HANDLE_T hUsb, USB_CORE_DESCS_T *pDesc, USBD_API_INIT_PARAM_T *pUsbParam)
+{
+ USBD_CDC_INIT_PARAM_T cdc_param;
+ ErrorCode_t ret = LPC_OK;
+ uint32_t ep_indx;
+ USB_CDC_CTRL_T *pCDC;
+
+ /* Store USB stack handle for future use. */
+ g_uCOM.hUsb = hUsb;
+ /* Initi CDC params */
+ memset((void *) &cdc_param, 0, sizeof(USBD_CDC_INIT_PARAM_T));
+ cdc_param.mem_base = pUsbParam->mem_base;
+ cdc_param.mem_size = pUsbParam->mem_size;
+ cdc_param.cif_intf_desc = (uint8_t *) find_IntfDesc(pDesc->high_speed_desc, CDC_COMMUNICATION_INTERFACE_CLASS);
+ cdc_param.dif_intf_desc = (uint8_t *) find_IntfDesc(pDesc->high_speed_desc, CDC_DATA_INTERFACE_CLASS);
+ cdc_param.SetLineCode = UCOM_SetLineCode;
+
+ /* Init CDC interface */
+ ret = USBD_API->cdc->init(hUsb, &cdc_param, &g_uCOM.hCdc);
+
+ if (ret == LPC_OK) {
+ /* allocate transfer buffers */
+ g_uCOM.txBuf = (uint8_t *) cdc_param.mem_base;
+ cdc_param.mem_base += UCOM_BUF_SZ;
+ cdc_param.mem_size -= UCOM_BUF_SZ;
+ g_uCOM.rxBuf = (uint8_t *) cdc_param.mem_base;
+ cdc_param.mem_base += UCOM_BUF_SZ;
+ cdc_param.mem_size -= UCOM_BUF_SZ;
+
+ /* register endpoint interrupt handler */
+ ep_indx = (((USB_CDC_IN_EP & 0x0F) << 1) + 1);
+ ret = USBD_API->core->RegisterEpHandler(hUsb, ep_indx, UCOM_bulk_hdlr, &g_uCOM);
+
+ if (ret == LPC_OK) {
+ /* register endpoint interrupt handler */
+ ep_indx = ((USB_CDC_OUT_EP & 0x0F) << 1);
+ ret = USBD_API->core->RegisterEpHandler(hUsb, ep_indx, UCOM_bulk_hdlr, &g_uCOM);
+ /* Set the line coding values as per UART Settings */
+ pCDC = (USB_CDC_CTRL_T *) g_uCOM.hCdc;
+ pCDC->line_coding.dwDTERate = 115200;
+ pCDC->line_coding.bDataBits = 8;
+ /* Init UART port for bridging */
+ UCOM_UartInit();
+ }
+
+ /* update mem_base and size variables for cascading calls. */
+ pUsbParam->mem_base = cdc_param.mem_base;
+ pUsbParam->mem_size = cdc_param.mem_size;
+ }
+
+ return ret;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_cdc_uart/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/.cproject
new file mode 100644
index 0000000..9976f53
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/.cproject
@@ -0,0 +1,243 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.715235335">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.715235335" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.715235335" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.715235335." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.573105171" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1102499918" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/usbd_rom_composite}/Debug" id="com.crt.advproject.builder.exe.debug.1688133260" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.784602767" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1454427094" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.1236069635" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1148885246" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.138322833" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1192044984" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.673988165" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1850895614" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/example/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc/usbd}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1642215405" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.1829750027" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.232022562" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1570802510" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.1618004111" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1080907910" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.94683132" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1971887688" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1648604756" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.487642109" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.846875419" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1851649908" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.456386250" name="Linker script" superClass="com.crt.advproject.link.script" value=""usbd_rom_composite_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.393742289" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.877672477" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.800515919" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.930088992" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.257939172" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.703063083" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.55047615" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.433723221">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.433723221" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.433723221" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.433723221." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.1281210662" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.595752780" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/usbd_rom_composite}/Release" id="com.crt.advproject.builder.exe.release.1007588291" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.2083481552" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.167693979" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.1806261811" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.2027586576" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.258879774" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.771850356" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.737851549" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.1260740240" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/example/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc/usbd}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1286345865" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1451403690" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.750550842" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1155836331" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.676888111" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1228508228" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1859387700" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.751490496" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.645928402" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.780413637" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.921328790" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.482741271" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.314757780" name="Linker script" superClass="com.crt.advproject.link.script" value=""usbd_rom_composite_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1669369891" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.350122754" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.269605120" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.1351271957" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.601229610" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.877552832" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1696687366" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="usbd_rom_composite.com.crt.advproject.projecttype.exe.572524070" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/.project
new file mode 100644
index 0000000..14c56bf
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>usbd_rom_composite</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/inc/app_usbd_cfg.h b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/inc/app_usbd_cfg.h
new file mode 100644
index 0000000..892d4ce
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/inc/app_usbd_cfg.h
@@ -0,0 +1,105 @@
+/*
+ * @brief Configuration file needed for USB ROM stack based applications.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+#include "lpc_types.h"
+#include "error.h"
+#include "usbd_rom_api.h"
+
+#ifndef __APP_USB_CFG_H_
+#define __APP_USB_CFG_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @ingroup EXAMPLES_USBDROM_15XX_COMPOSITE
+ * @{
+ */
+
+/* HID In/Out Endpoint Address */
+#define HID_EP_IN 0x81
+#define USB_HID_IF_NUM 0
+/** Interval between mouse reports expressed in milliseconds for full-speed device. */
+#define HID_MOUSE_REPORT_INTERVAL_MS 10
+/* bInterval value used in descriptor. For HS this macro will differ from HID_MOUSE_REPORT_INTERVAL_MS macro. */
+#define HID_MOUSE_REPORT_INTERVAL 10
+
+/* Manifest constants defining interface numbers and endpoints used by a
+ CDC class interfaces in this application.
+ */
+#define USB_CDC_CIF_NUM 1
+#define USB_CDC_DIF_NUM 2
+#define USB_CDC_IN_EP 0x82
+#define USB_CDC_OUT_EP 0x01
+#define USB_CDC_INT_EP 0x83
+
+/* The following manifest constants are used to define this memory area to be used
+ by USBD ROM stack.
+ */
+#define USB_STACK_MEM_BASE 0x02008000
+#define USB_STACK_MEM_SIZE 0x1000
+
+/* Manifest constants used by USBD ROM stack. These values SHOULD NOT BE CHANGED
+ for advance features which require usage of USB_CORE_CTRL_T structure.
+ Since these are the values used for compiling USB stack.
+ */
+#define USB_MAX_IF_NUM 8 /*!< Max interface number used for building USBDL_Lib. DON'T CHANGE. */
+#define USB_MAX_EP_NUM 5 /*!< Max number of EP used for building USBD ROM. DON'T CHANGE. */
+#define USB_MAX_PACKET0 64 /*!< Max EP0 packet size used for building USBD ROM. DON'T CHANGE. */
+#define USB_FS_MAX_BULK_PACKET 64 /*!< MAXP for FS bulk EPs used for building USBD ROM. DON'T CHANGE. */
+#define USB_HS_MAX_BULK_PACKET 512 /*!< MAXP for HS bulk EPs used for building USBD ROM. DON'T CHANGE. */
+#define USB_DFU_XFER_SIZE 2048 /*!< Max DFU transfer size used for building USBD ROM. DON'T CHANGE. */
+
+/* USB descriptor arrays defined *_desc.c file */
+extern const uint8_t USB_DeviceDescriptor[];
+extern uint8_t USB_HsConfigDescriptor[];
+extern uint8_t USB_FsConfigDescriptor[];
+extern const uint8_t USB_StringDescriptor[];
+extern const uint8_t USB_DeviceQualifier[];
+
+/**
+ * @brief Find the address of interface descriptor for given class type.
+ * @param pDesc : Pointer to configuration descriptor in which the desired class
+ * interface descriptor to be found.
+ * @param intfClass : Interface class type to be searched.
+ * @return If found returns the address of requested interface else returns NULL.
+ */
+extern USB_INTERFACE_DESCRIPTOR *find_IntfDesc(const uint8_t *pDesc, uint32_t intfClass);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __APP_USB_CFG_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/inc/cdc_vcom.h b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/inc/cdc_vcom.h
new file mode 100644
index 0000000..937700a
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/inc/cdc_vcom.h
@@ -0,0 +1,127 @@
+/*
+ * @brief Programming API used with Virtual Communication port
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __CDC_VCOM_H_
+#define __CDC_VCOM_H_
+
+#include "app_usbd_cfg.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @ingroup EXAMPLES_USBDROM_15XX_COMPOSITE
+ * @{
+ */
+
+#define VCOM_RX_BUF_SZ 512
+#define VCOM_TX_CONNECTED _BIT(8) /* connection state is for both RX/Tx */
+#define VCOM_TX_BUSY _BIT(0)
+#define VCOM_RX_DONE _BIT(0)
+#define VCOM_RX_BUF_FULL _BIT(1)
+#define VCOM_RX_BUF_QUEUED _BIT(2)
+#define VCOM_RX_DB_QUEUED _BIT(3)
+
+/**
+ * Structure containing Virtual Comm port control data
+ */
+typedef struct VCOM_DATA {
+ USBD_HANDLE_T hUsb;
+ USBD_HANDLE_T hCdc;
+ uint8_t *rx_buff;
+ uint16_t rx_rd_count;
+ uint16_t rx_count;
+ volatile uint16_t tx_flags;
+ volatile uint16_t rx_flags;
+} VCOM_DATA_T;
+
+/**
+ * Virtual Comm port control data instance.
+ */
+extern VCOM_DATA_T g_vCOM;
+
+/**
+ * @brief Virtual com port init routine
+ * @param hUsb : Handle to USBD stack instance
+ * @param pDesc : Pointer to configuration descriptor
+ * @param pUsbParam : Pointer USB param structure returned by previous init call
+ * @return Always returns LPC_OK.
+ */
+ErrorCode_t vcom_init (USBD_HANDLE_T hUsb, USB_CORE_DESCS_T *pDesc, USBD_API_INIT_PARAM_T *pUsbParam);
+
+/**
+ * @brief Virtual com port buffered read routine
+ * @param pBuf : Pointer to buffer where read data should be copied
+ * @param buf_len : Length of the buffer passed
+ * @return Return number of bytes read.
+ */
+uint32_t vcom_bread (uint8_t *pBuf, uint32_t buf_len);
+
+/**
+ * @brief Virtual com port read routine
+ * @param pBuf : Pointer to buffer where read data should be copied
+ * @param buf_len : Length of the buffer passed
+ * @return Always returns LPC_OK.
+ */
+ErrorCode_t vcom_read_req (uint8_t *pBuf, uint32_t buf_len);
+
+/**
+ * @brief Gets current read count.
+ * @return Returns current read count.
+ */
+uint32_t vcom_read_cnt(void);
+
+/**
+ * @brief Check if Vcom is connected
+ * @return Returns non-zero value if connected.
+ */
+static INLINE uint32_t vcom_connected(void) {
+ return g_vCOM.tx_flags & VCOM_TX_CONNECTED;
+}
+
+/**
+ * @brief Virtual com port write routine
+ * @param pBuf : Pointer to buffer to be written
+ * @param buf_len : Length of the buffer passed
+ * @return Number of bytes written
+ */
+uint32_t vcom_write (uint8_t *pBuf, uint32_t buf_len);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CDC_VCOM_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/inc/hid_mouse.h b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/inc/hid_mouse.h
new file mode 100644
index 0000000..71fe7a2
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/inc/hid_mouse.h
@@ -0,0 +1,77 @@
+/*
+ * @brief Programming API used with HID Mouse interface.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __HID_MOUSE_H_
+#define __HID_MOUSE_H_
+
+#include "app_usbd_cfg.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @ingroup EXAMPLES_USBDROM_15XX_COMPOSITE
+ * @{
+ */
+
+#define MOUSE_REPORT_SIZE 3
+#define CLEAR_HID_MOUSE_REPORT(x) memset(x, 0, MOUSE_REPORT_SIZE);
+
+/**
+ * @brief HID mouse interface init routine.
+ * @param hUsb : Handle to USB device stack
+ * @param pIntfDesc : Pointer to HID interface descriptor
+ * @param mem_base : Pointer to memory address which can be used by HID driver
+ * @param mem_size : Size of the memory passed
+ * @return On success returns LPC_OK. Params mem_base and mem_size are updated
+ * to point to new base and available size.
+ */
+extern ErrorCode_t Mouse_Init(USBD_HANDLE_T hUsb,
+ USB_INTERFACE_DESCRIPTOR *pIntfDesc,
+ uint32_t *mem_base,
+ uint32_t *mem_size);
+
+/**
+ * @brief Mouse tasks.
+ * @return On success returns LPC_OK.
+ */
+extern void Mouse_Tasks(void);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __HID_MOUSE_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/readme.dox
new file mode 100644
index 0000000..3ca152a
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/readme.dox
@@ -0,0 +1,64 @@
+/*
+ * @brief USB Composite device example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_USBDROM_15XX_COMPOSITE LPC15XX USB Composite device example
+ * @ingroup EXAMPLES_USBDROM_15XX
+ * <b>Example description</b><br>
+ * The example shows how to us USBD ROM stack to creates a composite device. A USB
+ * device which has multiple class interface in single configuration is termed as
+ * composite device. In this example and virtual comm port interface (using CDC-ACM class) and
+ * a HID-mouse interfaces are combined together to form a composite device. The VCOM interface
+ * could be used for out putting debug messages.
+ * <br>
+ *
+ * <b>Special connection requirements</b><br>
+ * Connect the USB cable between micro connector on board and to a host.
+ * When connected to Windows host use the .inf included with the LPCOPen example
+ * Windows USB driver package. You can get this package on the LPCOpen download
+ * page at
+ * <a href="http://www.lpcware.com/content/nxpfile/lpcopen-platform">http://www.lpcware.com/content/nxpfile/lpcopen-platform</a>.
+ * For OSx (Mac) host, no drivers are needed.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/src/cdc_vcom.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/src/cdc_vcom.c
new file mode 100644
index 0000000..afa05eb
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/src/cdc_vcom.c
@@ -0,0 +1,229 @@
+/*
+ * @brief Virtual Comm port call back routines
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+#include <string.h>
+#include "app_usbd_cfg.h"
+#include "board.h"
+#include "cdc_vcom.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/**
+ * Global variable to hold Virtual COM port control data.
+ */
+VCOM_DATA_T g_vCOM;
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* VCOM bulk EP_IN endpoint handler */
+static ErrorCode_t VCOM_bulk_in_hdlr(USBD_HANDLE_T hUsb, void *data, uint32_t event)
+{
+ VCOM_DATA_T *pVcom = (VCOM_DATA_T *) data;
+
+ if (event == USB_EVT_IN) {
+ pVcom->tx_flags &= ~VCOM_TX_BUSY;
+ }
+ return LPC_OK;
+}
+
+/* VCOM bulk EP_OUT endpoint handler */
+static ErrorCode_t VCOM_bulk_out_hdlr(USBD_HANDLE_T hUsb, void *data, uint32_t event)
+{
+ VCOM_DATA_T *pVcom = (VCOM_DATA_T *) data;
+
+ switch (event) {
+ case USB_EVT_OUT:
+ pVcom->rx_count = USBD_API->hw->ReadEP(hUsb, USB_CDC_OUT_EP, pVcom->rx_buff);
+ if (pVcom->rx_flags & VCOM_RX_BUF_QUEUED) {
+ pVcom->rx_flags &= ~VCOM_RX_BUF_QUEUED;
+ if (pVcom->rx_count != 0) {
+ pVcom->rx_flags |= VCOM_RX_BUF_FULL;
+ }
+
+ }
+ else if (pVcom->rx_flags & VCOM_RX_DB_QUEUED) {
+ pVcom->rx_flags &= ~VCOM_RX_DB_QUEUED;
+ pVcom->rx_flags |= VCOM_RX_DONE;
+ }
+ break;
+
+ case USB_EVT_OUT_NAK:
+ /* queue free buffer for RX */
+ if ((pVcom->rx_flags & (VCOM_RX_BUF_FULL | VCOM_RX_BUF_QUEUED)) == 0) {
+ USBD_API->hw->ReadReqEP(hUsb, USB_CDC_OUT_EP, pVcom->rx_buff, VCOM_RX_BUF_SZ);
+ pVcom->rx_flags |= VCOM_RX_BUF_QUEUED;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return LPC_OK;
+}
+
+/* Set line coding call back routine */
+static ErrorCode_t VCOM_SetLineCode(USBD_HANDLE_T hCDC, CDC_LINE_CODING *line_coding)
+{
+ VCOM_DATA_T *pVcom = &g_vCOM;
+
+ /* Called when baud rate is changed/set. Using it to know host connection state */
+ pVcom->tx_flags = VCOM_TX_CONNECTED; /* reset other flags */
+
+ return LPC_OK;
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Virtual com port init routine */
+ErrorCode_t vcom_init(USBD_HANDLE_T hUsb, USB_CORE_DESCS_T *pDesc, USBD_API_INIT_PARAM_T *pUsbParam)
+{
+ USBD_CDC_INIT_PARAM_T cdc_param;
+ ErrorCode_t ret = LPC_OK;
+ uint32_t ep_indx;
+
+ g_vCOM.hUsb = hUsb;
+ memset((void *) &cdc_param, 0, sizeof(USBD_CDC_INIT_PARAM_T));
+ cdc_param.mem_base = pUsbParam->mem_base;
+ cdc_param.mem_size = pUsbParam->mem_size;
+ cdc_param.cif_intf_desc = (uint8_t *) find_IntfDesc(pDesc->high_speed_desc, CDC_COMMUNICATION_INTERFACE_CLASS);
+ cdc_param.dif_intf_desc = (uint8_t *) find_IntfDesc(pDesc->high_speed_desc, CDC_DATA_INTERFACE_CLASS);
+ cdc_param.SetLineCode = VCOM_SetLineCode;
+
+ ret = USBD_API->cdc->init(hUsb, &cdc_param, &g_vCOM.hCdc);
+
+ if (ret == LPC_OK) {
+ /* allocate transfer buffers */
+ g_vCOM.rx_buff = (uint8_t *) cdc_param.mem_base;
+ cdc_param.mem_base += VCOM_RX_BUF_SZ;
+ cdc_param.mem_size -= VCOM_RX_BUF_SZ;
+
+ /* register endpoint interrupt handler */
+ ep_indx = (((USB_CDC_IN_EP & 0x0F) << 1) + 1);
+ ret = USBD_API->core->RegisterEpHandler(hUsb, ep_indx, VCOM_bulk_in_hdlr, &g_vCOM);
+ if (ret == LPC_OK) {
+ /* register endpoint interrupt handler */
+ ep_indx = ((USB_CDC_OUT_EP & 0x0F) << 1);
+ ret = USBD_API->core->RegisterEpHandler(hUsb, ep_indx, VCOM_bulk_out_hdlr, &g_vCOM);
+
+ }
+ /* update mem_base and size variables for cascading calls. */
+ pUsbParam->mem_base = cdc_param.mem_base;
+ pUsbParam->mem_size = cdc_param.mem_size;
+ }
+
+ return ret;
+}
+
+/* Virtual com port buffered read routine */
+uint32_t vcom_bread(uint8_t *pBuf, uint32_t buf_len)
+{
+ VCOM_DATA_T *pVcom = &g_vCOM;
+ uint16_t cnt = 0;
+ /* read from the default buffer if any data present */
+ if (pVcom->rx_count) {
+ cnt = (pVcom->rx_count < buf_len) ? pVcom->rx_count : buf_len;
+ memcpy(pBuf, pVcom->rx_buff, cnt);
+ pVcom->rx_rd_count += cnt;
+
+ /* enter critical section */
+ NVIC_DisableIRQ(USB0_IRQn);
+ if (pVcom->rx_rd_count >= pVcom->rx_count) {
+ pVcom->rx_flags &= ~VCOM_RX_BUF_FULL;
+ pVcom->rx_rd_count = pVcom->rx_count = 0;
+ }
+ /* exit critical section */
+ NVIC_EnableIRQ(USB0_IRQn);
+ }
+ return cnt;
+
+}
+
+/* Virtual com port read routine */
+ErrorCode_t vcom_read_req(uint8_t *pBuf, uint32_t len)
+{
+ VCOM_DATA_T *pVcom = &g_vCOM;
+
+ /* check if we queued Rx buffer */
+ if (pVcom->rx_flags & (VCOM_RX_BUF_QUEUED | VCOM_RX_DB_QUEUED)) {
+ return ERR_BUSY;
+ }
+ /* enter critical section */
+ NVIC_DisableIRQ(USB0_IRQn);
+ /* if not queue the request and return 0 bytes */
+ USBD_API->hw->ReadReqEP(pVcom->hUsb, USB_CDC_OUT_EP, pBuf, len);
+ /* exit critical section */
+ NVIC_EnableIRQ(USB0_IRQn);
+ pVcom->rx_flags |= VCOM_RX_DB_QUEUED;
+
+ return LPC_OK;
+}
+
+/* Gets current read count. */
+uint32_t vcom_read_cnt(void)
+{
+ VCOM_DATA_T *pVcom = &g_vCOM;
+ uint32_t ret = 0;
+
+ if (pVcom->rx_flags & VCOM_RX_DONE) {
+ ret = pVcom->rx_count;
+ pVcom->rx_count = 0;
+ }
+
+ return ret;
+}
+
+/* Virtual com port write routine */
+uint32_t vcom_write(uint8_t *pBuf, uint32_t len)
+{
+ VCOM_DATA_T *pVcom = &g_vCOM;
+ uint32_t ret = 0;
+
+ if ( (pVcom->tx_flags & VCOM_TX_CONNECTED) && ((pVcom->tx_flags & VCOM_TX_BUSY) == 0) ) {
+ pVcom->tx_flags |= VCOM_TX_BUSY;
+
+ /* enter critical section */
+ NVIC_DisableIRQ(USB0_IRQn);
+ ret = USBD_API->hw->WriteEP(pVcom->hUsb, USB_CDC_IN_EP, pBuf, len);
+ /* exit critical section */
+ NVIC_EnableIRQ(USB0_IRQn);
+ }
+ return ret;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/src/composite_desc.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/src/composite_desc.c
new file mode 100644
index 0000000..e98efbe
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/src/composite_desc.c
@@ -0,0 +1,310 @@
+/*
+ * @brief This file contains USB composite class example using USBD ROM stack.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "app_usbd_cfg.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/**
+ * HID Mouse Report Descriptor
+ */
+const uint8_t Mouse_ReportDescriptor[] = {
+ HID_UsagePage(HID_USAGE_PAGE_GENERIC),
+ HID_Usage(HID_USAGE_GENERIC_MOUSE),
+ HID_Collection(HID_Application),
+ HID_Usage(HID_USAGE_GENERIC_POINTER),
+ HID_Collection(HID_Physical),
+ HID_UsagePage(HID_USAGE_PAGE_BUTTON),
+ HID_UsageMin(1),
+ HID_UsageMax(3),
+ HID_LogicalMin(0),
+ HID_LogicalMax(1),
+ HID_ReportCount(3),
+ HID_ReportSize(1),
+ HID_Input(HID_Data | HID_Variable | HID_Absolute),
+ HID_ReportCount(1),
+ HID_ReportSize(5),
+ HID_Input(HID_Constant),
+ HID_UsagePage(HID_USAGE_PAGE_GENERIC),
+ HID_Usage(HID_USAGE_GENERIC_X),
+ HID_Usage(HID_USAGE_GENERIC_Y),
+ HID_LogicalMin( (uint8_t) -127),
+ HID_LogicalMax(127),
+ HID_ReportSize(8),
+ HID_ReportCount(2),
+ HID_Input(HID_Data | HID_Variable | HID_Relative),
+ HID_EndCollection,
+ HID_EndCollection,
+};
+const uint16_t Mouse_ReportDescSize = sizeof(Mouse_ReportDescriptor);
+
+/**
+ * USB Standard Device Descriptor
+ */
+ALIGNED(4) const uint8_t USB_DeviceDescriptor[] = {
+ USB_DEVICE_DESC_SIZE, /* bLength */
+ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL(0x0200), /* bcdUSB : 2.00*/
+ 0x00, /* bDeviceClass */
+ 0x00, /* bDeviceSubClass */
+ 0x00, /* bDeviceProtocol */
+ USB_MAX_PACKET0, /* bMaxPacketSize0 */
+ WBVAL(0x1FC9), /* idVendor */
+ WBVAL(0x0087), /* idProduct */
+ WBVAL(0x0100), /* bcdDevice : 1.00 */
+ 0x01, /* iManufacturer */
+ 0x02, /* iProduct */
+ 0x03, /* iSerialNumber */
+ 0x01 /* bNumConfigurations */
+};
+
+/**
+ * USB FSConfiguration Descriptor
+ * All Descriptors (Configuration, Interface, Endpoint, Class, Vendor)
+ */
+ALIGNED(4) uint8_t USB_FsConfigDescriptor[] = {
+ /* Configuration 1 */
+ USB_CONFIGURATION_DESC_SIZE, /* bLength */
+ USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL( /* wTotalLength */
+ USB_CONFIGURATION_DESC_SIZE +
+ /* HID class related descriptors */
+ USB_INTERFACE_DESC_SIZE +
+ HID_DESC_SIZE +
+ USB_ENDPOINT_DESC_SIZE +
+ /* CDC class related descriptors */
+ USB_INTERFACE_ASSOC_DESC_SIZE + /* interface association descriptor */
+ USB_INTERFACE_DESC_SIZE + /* communication control interface */
+ 0x0013 + /* CDC functions */
+ 1 * USB_ENDPOINT_DESC_SIZE + /* interrupt endpoint */
+ USB_INTERFACE_DESC_SIZE + /* communication data interface */
+ 2 * USB_ENDPOINT_DESC_SIZE + /* bulk endpoints */
+ 0
+ ),
+ 0x03, /* bNumInterfaces */
+ 0x01, /* bConfigurationValue */
+ 0x00, /* iConfiguration */
+ USB_CONFIG_SELF_POWERED, /* bmAttributes */
+ USB_CONFIG_POWER_MA(2), /* bMaxPower */
+
+ /* Interface 0, Alternate Setting 0, HID Class */
+ USB_INTERFACE_DESC_SIZE, /* bLength */
+ USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
+ USB_HID_IF_NUM, /* bInterfaceNumber */
+ 0x00, /* bAlternateSetting */
+ 0x01, /* bNumEndpoints */
+ USB_DEVICE_CLASS_HUMAN_INTERFACE, /* bInterfaceClass */
+ HID_SUBCLASS_BOOT, /* bInterfaceSubClass */
+ HID_PROTOCOL_MOUSE, /* bInterfaceProtocol */
+ 0x04, /* iInterface */
+ /* HID Class Descriptor */
+ /* HID_DESC_OFFSET = 0x0012 */
+ HID_DESC_SIZE, /* bLength */
+ HID_HID_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL(0x0111), /* bcdHID : 1.11*/
+ 0x00, /* bCountryCode */
+ 0x01, /* bNumDescriptors */
+ HID_REPORT_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL(sizeof(Mouse_ReportDescriptor)), /* wDescriptorLength */
+ /* Endpoint, HID Interrupt In */
+ USB_ENDPOINT_DESC_SIZE, /* bLength */
+ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
+ HID_EP_IN, /* bEndpointAddress */
+ USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */
+ WBVAL(0x0008), /* wMaxPacketSize */
+ HID_MOUSE_REPORT_INTERVAL, /* bInterval */
+
+ /* Interface association descriptor IAD*/
+ USB_INTERFACE_ASSOC_DESC_SIZE, /* bLength */
+ USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE, /* bDescriptorType */
+ USB_CDC_CIF_NUM, /* bFirstInterface */
+ 0x02, /* bInterfaceCount */
+ CDC_COMMUNICATION_INTERFACE_CLASS, /* bFunctionClass */
+ CDC_ABSTRACT_CONTROL_MODEL, /* bFunctionSubClass */
+ 0x00, /* bFunctionProtocol */
+ 0x05, /* iFunction */
+
+ /* Interface 1, Alternate Setting 0, Communication class interface descriptor */
+ USB_INTERFACE_DESC_SIZE, /* bLength */
+ USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
+ USB_CDC_CIF_NUM, /* bInterfaceNumber: Number of Interface */
+ 0x00, /* bAlternateSetting: Alternate setting */
+ 0x01, /* bNumEndpoints: One endpoint used */
+ CDC_COMMUNICATION_INTERFACE_CLASS, /* bInterfaceClass: Communication Interface Class */
+ CDC_ABSTRACT_CONTROL_MODEL, /* bInterfaceSubClass: Abstract Control Model */
+ 0x00, /* bInterfaceProtocol: no protocol used */
+ 0x05, /* iInterface: */
+ /* Header Functional Descriptor*/
+ 0x05, /* bLength: CDC header Descriptor size */
+ CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */
+ CDC_HEADER, /* bDescriptorSubtype: Header Func Desc */
+ WBVAL(CDC_V1_10), /* bcdCDC 1.10 */
+ /* Call Management Functional Descriptor*/
+ 0x05, /* bFunctionLength */
+ CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */
+ CDC_CALL_MANAGEMENT, /* bDescriptorSubtype: Call Management Func Desc */
+ 0x01, /* bmCapabilities: device handles call management */
+ USB_CDC_DIF_NUM, /* bDataInterface: CDC data IF ID */
+ /* Abstract Control Management Functional Descriptor*/
+ 0x04, /* bFunctionLength */
+ CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */
+ CDC_ABSTRACT_CONTROL_MANAGEMENT, /* bDescriptorSubtype: Abstract Control Management desc */
+ 0x02, /* bmCapabilities: SET_LINE_CODING, GET_LINE_CODING, SET_CONTROL_LINE_STATE supported */
+ /* Union Functional Descriptor*/
+ 0x05, /* bFunctionLength */
+ CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */
+ CDC_UNION, /* bDescriptorSubtype: Union func desc */
+ USB_CDC_CIF_NUM, /* bMasterInterface: Communication class interface is master */
+ USB_CDC_DIF_NUM, /* bSlaveInterface0: Data class interface is slave 0 */
+ /* Endpoint 1 Descriptor*/
+ USB_ENDPOINT_DESC_SIZE, /* bLength */
+ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
+ USB_CDC_INT_EP, /* bEndpointAddress */
+ USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */
+ WBVAL(0x0010), /* wMaxPacketSize */
+ 0x02, /* 2ms */ /* bInterval */
+
+ /* Interface 2, Alternate Setting 0, Data class interface descriptor*/
+ USB_INTERFACE_DESC_SIZE, /* bLength */
+ USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
+ USB_CDC_DIF_NUM, /* bInterfaceNumber: Number of Interface */
+ 0x00, /* bAlternateSetting: no alternate setting */
+ 0x02, /* bNumEndpoints: two endpoints used */
+ CDC_DATA_INTERFACE_CLASS, /* bInterfaceClass: Data Interface Class */
+ 0x00, /* bInterfaceSubClass: no subclass available */
+ 0x00, /* bInterfaceProtocol: no protocol used */
+ 0x05, /* iInterface: */
+ /* Endpoint, EP Bulk Out */
+ USB_ENDPOINT_DESC_SIZE, /* bLength */
+ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
+ USB_CDC_OUT_EP, /* bEndpointAddress */
+ USB_ENDPOINT_TYPE_BULK, /* bmAttributes */
+ WBVAL(USB_FS_MAX_BULK_PACKET), /* wMaxPacketSize */
+ 0x00, /* bInterval: ignore for Bulk transfer */
+ /* Endpoint, EP Bulk In */
+ USB_ENDPOINT_DESC_SIZE, /* bLength */
+ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
+ USB_CDC_IN_EP, /* bEndpointAddress */
+ USB_ENDPOINT_TYPE_BULK, /* bmAttributes */
+ WBVAL(64), /* wMaxPacketSize */
+ 0x00, /* bInterval: ignore for Bulk transfer */
+
+ /* Terminator */
+ 0 /* bLength */
+};
+
+/**
+ * USB String Descriptor (optional)
+ */
+const uint8_t USB_StringDescriptor[] = {
+ /* Index 0x00: LANGID Codes */
+ 0x04, /* bLength */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL(0x0409), /* wLANGID : US English */
+ /* Index 0x01: Manufacturer */
+ (18 * 2 + 2), /* bLength (18 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'N', 0,
+ 'X', 0,
+ 'P', 0,
+ ' ', 0,
+ 'S', 0,
+ 'e', 0,
+ 'm', 0,
+ 'i', 0,
+ 'c', 0,
+ 'o', 0,
+ 'n', 0,
+ 'd', 0,
+ 'u', 0,
+ 'c', 0,
+ 't', 0,
+ 'o', 0,
+ 'r', 0,
+ 's', 0,
+ /* Index 0x02: Product */
+ (13 * 2 + 2), /* bLength (13 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'L', 0,
+ 'P', 0,
+ 'C', 0,
+ '1', 0,
+ '5', 0,
+ 'x', 0,
+ 'x', 0,
+ ' ', 0,
+ 'M', 0,
+ 'O', 0,
+ 'U', 0,
+ 'S', 0,
+ 'E', 0,
+ /* Index 0x03: Serial Number */
+ (13 * 2 + 2), /* bLength (13 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'A', 0,
+ 'B', 0,
+ 'C', 0,
+ 'D', 0,
+ '1', 0,
+ '2', 0,
+ '3', 0,
+ '4', 0,
+ '5', 0,
+ '6', 0,
+ '7', 0,
+ '8', 0,
+ '9', 0,
+ /* Index 0x04: Interface 0, Alternate Setting 0 */
+ (9 * 2 + 2), /* bLength (9 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'H', 0,
+ 'I', 0,
+ 'D', 0,
+ ' ', 0,
+ 'M', 0,
+ 'O', 0,
+ 'U', 0,
+ 'S', 0,
+ 'E', 0,
+ /* Index 0x05: Interface 1, Alternate Setting 0 */
+ ( 4 * 2 + 2), /* bLength (4 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'V', 0,
+ 'C', 0,
+ 'O', 0,
+ 'M', 0,
+};
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/src/composite_main.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/src/composite_main.c
new file mode 100644
index 0000000..c82af37
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/src/composite_main.c
@@ -0,0 +1,186 @@
+/*
+ * @brief This file contains USB HID Mouse example using USB ROM Drivers.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include <stdio.h>
+#include <string.h>
+#include "app_usbd_cfg.h"
+#include "hid_mouse.h"
+#include "cdc_vcom.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+static USBD_HANDLE_T g_hUsb;
+static uint8_t g_rxBuff[256];
+const USBD_API_T *g_pUsbApi;
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle interrupt from USB0
+ * @return Nothing
+ */
+void USB_IRQHandler(void)
+{
+ USBD_API->hw->ISR(g_hUsb);
+}
+
+/* Find the address of interface descriptor for given class type. */
+USB_INTERFACE_DESCRIPTOR *find_IntfDesc(const uint8_t *pDesc, uint32_t intfClass)
+{
+ USB_COMMON_DESCRIPTOR *pD;
+ USB_INTERFACE_DESCRIPTOR *pIntfDesc = 0;
+ uint32_t next_desc_adr;
+
+ pD = (USB_COMMON_DESCRIPTOR *) pDesc;
+ next_desc_adr = (uint32_t) pDesc;
+
+ while (pD->bLength) {
+ /* is it interface descriptor */
+ if (pD->bDescriptorType == USB_INTERFACE_DESCRIPTOR_TYPE) {
+
+ pIntfDesc = (USB_INTERFACE_DESCRIPTOR *) pD;
+ /* did we find the right interface descriptor */
+ if (pIntfDesc->bInterfaceClass == intfClass) {
+ break;
+ }
+ }
+ pIntfDesc = 0;
+ next_desc_adr = (uint32_t) pD + pD->bLength;
+ pD = (USB_COMMON_DESCRIPTOR *) next_desc_adr;
+ }
+
+ return pIntfDesc;
+}
+
+/**
+ * @brief main routine for blinky example
+ * @return Function should not exit.
+ */
+int main(void)
+{
+ USBD_API_INIT_PARAM_T usb_param;
+ USB_CORE_DESCS_T desc;
+ ErrorCode_t ret = LPC_OK;
+ uint32_t prompt = 0, rdCnt = 0;
+
+ /* Initialize board and chip */
+ Board_Init();
+
+ /* enable clocks */
+ Chip_USB_Init();
+
+ /* initialize USBD ROM API pointer. */
+ g_pUsbApi = (const USBD_API_T *) LPC_ROM_API->pUSBD;
+
+ /* initialize call back structures */
+ memset((void *) &usb_param, 0, sizeof(USBD_API_INIT_PARAM_T));
+ usb_param.usb_reg_base = LPC_USB0_BASE;
+ /* WORKAROUND for artf44835 ROM driver BUG:
+ Code clearing STALL bits in endpoint reset routine corrupts memory area
+ next to the endpoint control data. For example When EP0, EP1_IN, EP1_OUT,
+ EP2_IN are used we need to specify 3 here. But as a workaround for this
+ issue specify 4. So that extra EPs control structure acts as padding buffer
+ to avoid data corruption. Corruption of padding memory doesn’t affect the
+ stack/program behaviour.
+ */
+ usb_param.max_num_ep = 4 + 1;
+ usb_param.mem_base = USB_STACK_MEM_BASE;
+ usb_param.mem_size = USB_STACK_MEM_SIZE;
+
+ /* Set the USB descriptors */
+ desc.device_desc = (uint8_t *) USB_DeviceDescriptor;
+ desc.string_desc = (uint8_t *) USB_StringDescriptor;
+
+ /* Note, to pass USBCV test full-speed only devices should have both
+ * descriptor arrays point to same location and device_qualifier set
+ * to 0.
+ */
+ desc.high_speed_desc = USB_FsConfigDescriptor;
+ desc.full_speed_desc = USB_FsConfigDescriptor;
+ desc.device_qualifier = 0;
+
+ /* USB Initialization */
+ ret = USBD_API->hw->Init(&g_hUsb, &desc, &usb_param);
+ if (ret == LPC_OK) {
+
+ ret = Mouse_Init(g_hUsb,
+ (USB_INTERFACE_DESCRIPTOR *) find_IntfDesc(desc.high_speed_desc,
+ USB_DEVICE_CLASS_HUMAN_INTERFACE),
+ &usb_param.mem_base, &usb_param.mem_size);
+ if (ret == LPC_OK) {
+ /* Init VCOM interface */
+ ret = vcom_init(g_hUsb, &desc, &usb_param);
+ if (ret == LPC_OK) {
+ /* enable USB interrupts */
+ NVIC_EnableIRQ(USB0_IRQn);
+ /* now connect */
+ USBD_API->hw->Connect(g_hUsb, 1);
+ }
+ }
+ }
+
+ while (1) {
+ /* If everything went well with stack init do the tasks or else sleep */
+ if (ret == LPC_OK) {
+ /* Do Mouse tasks */
+ Mouse_Tasks();
+
+ /* Check if host has connected and opened the VCOM port */
+ if ((vcom_connected() != 0) && (prompt == 0)) {
+ vcom_write("Hello World!!\r\n", 15);
+ prompt = 1;
+ }
+ /* If VCOM port is opened echo whatever we receive back to host. */
+ if (prompt) {
+ rdCnt = vcom_bread(&g_rxBuff[0], 256);
+ if (rdCnt) {
+ vcom_write(&g_rxBuff[0], rdCnt);
+ }
+ }
+ }
+
+ /* Sleep until next IRQ happens */
+ __WFI();
+ }
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/src/hid_mouse.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/src/hid_mouse.c
new file mode 100644
index 0000000..aa109ff
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/src/hid_mouse.c
@@ -0,0 +1,226 @@
+/*
+ * @brief This file contains USB HID Mouse example using USB ROM Drivers.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include <stdint.h>
+#include <string.h>
+#include "usbd_rom_api.h"
+#include "hid_mouse.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/**
+ * @brief Structure to hold mouse data
+ */
+
+typedef struct {
+ USBD_HANDLE_T hUsb; /*!< Handle to USB stack. */
+ uint8_t report[MOUSE_REPORT_SIZE]; /*!< Last report data */
+ uint8_t tx_busy; /*!< Flag indicating whether a report is pending in endpoint queue. */
+} Mouse_Ctrl_T;
+
+/** Singleton instance of mouse control */
+static Mouse_Ctrl_T g_mouse;
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+extern const uint8_t Mouse_ReportDescriptor[];
+extern const uint16_t Mouse_ReportDescSize;
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+static void setXYMouseReport(uint8_t *rep, int8_t xVal, int8_t yVal)
+{
+ rep[1] = (uint8_t) xVal;
+ rep[2] = (uint8_t) yVal;
+}
+
+static void setLeftButtonMouseReport(uint8_t *rep, uint8_t state)
+{
+ if (state) {
+ rep[0] |= 0x01;
+ }
+ else {
+ rep[0] &= ~0x01;
+ }
+}
+
+/* Routine to update mouse state report */
+static void Mouse_UpdateReport(void)
+{
+ uint8_t joystick_status = Joystick_GetStatus();
+ CLEAR_HID_MOUSE_REPORT(&g_mouse.report[0]);
+
+ switch (joystick_status) {
+ case JOY_PRESS:
+ setLeftButtonMouseReport(g_mouse.report, 1);
+ break;
+
+ case JOY_LEFT:
+ setXYMouseReport(g_mouse.report, -4, 0);
+ break;
+
+ case JOY_RIGHT:
+ setXYMouseReport(g_mouse.report, 4, 0);
+ break;
+
+ case JOY_UP:
+ setXYMouseReport(g_mouse.report, 0, -4);
+ break;
+
+ case JOY_DOWN:
+ setXYMouseReport(g_mouse.report, 0, 4);
+ break;
+ }
+}
+
+/* HID Get Report Request Callback. Called automatically on HID Get Report Request */
+static ErrorCode_t Mouse_GetReport(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t * *pBuffer, uint16_t *plength)
+{
+ /* ReportID = SetupPacket.wValue.WB.L; */
+ switch (pSetup->wValue.WB.H) {
+ case HID_REPORT_INPUT:
+ Mouse_UpdateReport();
+ *pBuffer = &g_mouse.report[0];
+ *plength = MOUSE_REPORT_SIZE;
+ break;
+
+ case HID_REPORT_OUTPUT: /* Not Supported */
+ case HID_REPORT_FEATURE: /* Not Supported */
+ return ERR_USBD_STALL;
+ }
+ return LPC_OK;
+}
+
+/* HID Set Report Request Callback. Called automatically on HID Set Report Request */
+static ErrorCode_t Mouse_SetReport(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t * *pBuffer, uint16_t length)
+{
+ /* we will reuse standard EP0Buf */
+ if (length == 0) {
+ return LPC_OK;
+ }
+ /* ReportID = SetupPacket.wValue.WB.L; */
+ switch (pSetup->wValue.WB.H) {
+ case HID_REPORT_INPUT: /* Not Supported */
+ case HID_REPORT_OUTPUT: /* Not Supported */
+ case HID_REPORT_FEATURE: /* Not Supported */
+ return ERR_USBD_STALL;
+ }
+ return LPC_OK;
+}
+
+/* HID interrupt IN endpoint handler. */
+static ErrorCode_t Mouse_EpIN_Hdlr(USBD_HANDLE_T hUsb, void *data, uint32_t event)
+{
+ switch (event) {
+ case USB_EVT_IN:
+ /* USB_EVT_IN occurs when HW completes sending IN packet. So clear the
+ busy flag for main loop to queue next packet.
+ */
+ g_mouse.tx_busy = 0;
+ break;
+ }
+ return LPC_OK;
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Mouse init routine. */
+ErrorCode_t Mouse_Init(USBD_HANDLE_T hUsb,
+ USB_INTERFACE_DESCRIPTOR *pIntfDesc,
+ uint32_t *mem_base,
+ uint32_t *mem_size)
+{
+ USBD_HID_INIT_PARAM_T hid_param;
+ USB_HID_REPORT_T reports_data[1];
+ ErrorCode_t ret = LPC_OK;
+
+ /* Do a quick check of if the interface descriptor passed is the right one. */
+ if ((pIntfDesc == 0) || (pIntfDesc->bInterfaceClass != USB_DEVICE_CLASS_HUMAN_INTERFACE)) {
+ return ERR_FAILED;
+ }
+
+ /* init joystick control */
+ Board_Joystick_Init();
+
+ /* Init HID params */
+ memset((void *) &hid_param, 0, sizeof(USBD_HID_INIT_PARAM_T));
+ hid_param.max_reports = 1;
+ hid_param.mem_base = *mem_base;
+ hid_param.mem_size = *mem_size;
+ hid_param.intf_desc = (uint8_t *) pIntfDesc;
+ /* user defined functions */
+ hid_param.HID_GetReport = Mouse_GetReport;
+ hid_param.HID_SetReport = Mouse_SetReport;
+ hid_param.HID_EpIn_Hdlr = Mouse_EpIN_Hdlr;
+ /* Init reports_data */
+ reports_data[0].len = Mouse_ReportDescSize;
+ reports_data[0].idle_time = 0;
+ reports_data[0].desc = (uint8_t *) &Mouse_ReportDescriptor[0];
+ hid_param.report_data = reports_data;
+
+ ret = USBD_API->hid->init(hUsb, &hid_param);
+
+ /* update memory variables */
+ *mem_base = hid_param.mem_base;
+ *mem_size = hid_param.mem_size;
+ /* store stack handle for later use. */
+ g_mouse.hUsb = hUsb;
+
+ return ret;
+}
+
+/* Mouse tasks routine. */
+void Mouse_Tasks(void)
+{
+ /* check device is configured before sending report. */
+ if ( USB_IsConfigured(g_mouse.hUsb)) {
+ if (g_mouse.tx_busy == 0) {
+ /* update report based on board state */
+ Mouse_UpdateReport();
+ /* send report data */
+ g_mouse.tx_busy = 1;
+ USBD_API->hw->WriteEP(g_mouse.hUsb, HID_EP_IN, &g_mouse.report[0], MOUSE_REPORT_SIZE);
+ }
+ }
+ else {
+ /* reset busy flag if we get disconnected. */
+ g_mouse.tx_busy = 0;
+ }
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_composite/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/.cproject
new file mode 100644
index 0000000..2f00ec3
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/.cproject
@@ -0,0 +1,243 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1619149723">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1619149723" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1619149723" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1619149723." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.2039514864" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1069478332" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/usbd_rom_hid_generic}/Debug" id="com.crt.advproject.builder.exe.debug.1032657846" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.1729742966" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1214854886" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.1201077434" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1728683464" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.444027359" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.67037647" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.2021647749" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.2056417466" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/example/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc/usbd}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.204003992" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.1169246807" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.281160573" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.24414214" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.2120039624" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.584955462" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1912334651" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.958534305" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.1093554958" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.278602681" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.204066310" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1509645395" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1718785993" name="Linker script" superClass="com.crt.advproject.link.script" value=""usbd_rom_hid_generic_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.278165787" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.145093006" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1159842305" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.310088970" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.315865287" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.152348580" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.709145648" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.80878166">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.80878166" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.80878166" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.80878166." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.77974334" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1401788860" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/usbd_rom_hid_generic}/Release" id="com.crt.advproject.builder.exe.release.1498766584" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.1265096471" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.1764940994" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.1986013773" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.25916217" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1891819449" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1414479639" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.515876063" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.2072582083" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/example/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc/usbd}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.2028729074" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.1031098684" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.459509056" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.835339959" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.2041973465" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1741366572" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.383459932" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.453889352" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.1764982560" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1871339580" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1652225482" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.335896894" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1426385663" name="Linker script" superClass="com.crt.advproject.link.script" value=""usbd_rom_hid_generic_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1133608772" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1135173892" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.228124688" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.150168086" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.635536403" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1555677802" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1686891429" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="usbd_rom_hid_generic.com.crt.advproject.projecttype.exe.1453540129" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/.project
new file mode 100644
index 0000000..e688ae4
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>usbd_rom_hid_generic</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/inc/app_usbd_cfg.h b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/inc/app_usbd_cfg.h
new file mode 100644
index 0000000..6f47113
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/inc/app_usbd_cfg.h
@@ -0,0 +1,92 @@
+/*
+ * @brief Configuration file needed for USB ROM stack based applications.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+#include "lpc_types.h"
+#include "error.h"
+#include "usbd_rom_api.h"
+
+#ifndef __APP_USB_CFG_H_
+#define __APP_USB_CFG_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @ingroup EXAMPLES_USBDROM_15XX_HID_GENERIC
+ * @{
+ */
+
+/* HID In/Out Endpoint Address */
+#define HID_EP_IN 0x81
+#define HID_EP_OUT 0x01
+
+/* The following manifest constants are used to define this memory area to be used
+ by USBD ROM stack.
+ */
+#define USB_STACK_MEM_BASE 0x02008000
+#define USB_STACK_MEM_SIZE 0x1000
+
+/* Manifest constants used by USBD ROM stack. These values SHOULD NOT BE CHANGED
+ for advance features which require usage of USB_CORE_CTRL_T structure.
+ Since these are the values used for compiling USB stack.
+ */
+#define USB_MAX_IF_NUM 8 /*!< Max interface number used for building USBDL_Lib. DON'T CHANGE. */
+#define USB_MAX_EP_NUM 5 /*!< Max number of EP used for building USBD ROM. DON'T CHANGE. */
+#define USB_MAX_PACKET0 64 /*!< Max EP0 packet size used for building USBD ROM. DON'T CHANGE. */
+#define USB_FS_MAX_BULK_PACKET 64 /*!< MAXP for FS bulk EPs used for building USBD ROM. DON'T CHANGE. */
+#define USB_HS_MAX_BULK_PACKET 512 /*!< MAXP for HS bulk EPs used for building USBD ROM. DON'T CHANGE. */
+#define USB_DFU_XFER_SIZE 2048 /*!< Max DFU transfer size used for building USBD ROM. DON'T CHANGE. */
+
+/* USB descriptor arrays defined *_desc.c file */
+extern const uint8_t USB_DeviceDescriptor[];
+extern uint8_t USB_HsConfigDescriptor[];
+extern uint8_t USB_FsConfigDescriptor[];
+extern const uint8_t USB_StringDescriptor[];
+extern const uint8_t USB_DeviceQualifier[];
+
+/**
+ * @brief Find the address of interface descriptor for given class type.
+ * @param pDesc : Pointer to configuration descriptor in which the desired class
+ * interface descriptor to be found.
+ * @param intfClass : Interface class type to be searched.
+ * @return If found returns the address of requested interface else returns NULL.
+ */
+extern USB_INTERFACE_DESCRIPTOR *find_IntfDesc(const uint8_t *pDesc, uint32_t intfClass);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __APP_USB_CFG_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/inc/hid_generic.h b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/inc/hid_generic.h
new file mode 100644
index 0000000..4e7a12d
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/inc/hid_generic.h
@@ -0,0 +1,68 @@
+/*
+ * @brief Programming API used with HID example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __HID_GENERIC_H_
+#define __HID_GENERIC_H_
+
+#include "app_usbd_cfg.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @ingroup EXAMPLES_USBDROM_15XX_HID_GENERIC
+ * @{
+ */
+
+/**
+ * @brief Generic HID interface init routine.
+ * @param hUsb : Handle to USB device stack
+ * @param pIntfDesc : Pointer to HID interface descriptor
+ * @param mem_base : Pointer to memory address which can be used by HID driver
+ * @param mem_size : Size of the memory passed
+ * @return On success returns LPC_OK. Params mem_base and mem_size are updated
+ * to point to new base and available size.
+ */
+ErrorCode_t usb_hid_init(USBD_HANDLE_T hUsb,
+ USB_INTERFACE_DESCRIPTOR *pIntfDesc,
+ uint32_t *mem_base,
+ uint32_t *mem_size);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __HID_GENERIC_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/readme.dox
new file mode 100644
index 0000000..81a5a40
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/readme.dox
@@ -0,0 +1,60 @@
+/*
+ * @brief HID generic example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_USBDROM_15XX_HID_GENERIC LPC15XX HID generic example
+ * @ingroup EXAMPLES_USBDROM_15XX
+ * <b>Example description</b><br>
+ * The example shows how to us USBD ROM stack to creates a generic HID device.
+ * The example supports 1 byte report and loops back the data received in
+ * SET_REPORT message.
+ * <br>
+ *
+ * <b>Special connection requirements</b><br>
+ * Connect the USB cable between micro connector on board and to a host.
+ * The HID reports sent/received by this example are supported by HID_client.exe
+ * program distributed as part of Keil installation "(C:\Keil\ARM\Utilities\HID_Client)".
+ * <br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/src/hid_desc.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/src/hid_desc.c
new file mode 100644
index 0000000..f20783f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/src/hid_desc.c
@@ -0,0 +1,213 @@
+/*
+ * @brief HID example USB descriptors
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "app_usbd_cfg.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+#define HID_INPUT_REPORT_BYTES 1 /* size of report in Bytes */
+#define HID_OUTPUT_REPORT_BYTES 1 /* size of report in Bytes */
+#define HID_FEATURE_REPORT_BYTES 1 /* size of report in Bytes */
+
+/**
+ * HID Report Descriptor
+ */
+const uint8_t HID_ReportDescriptor[] = {
+ HID_UsagePageVendor(0x00),
+ HID_Usage(0x01),
+ HID_Collection(HID_Application),
+ HID_LogicalMin(0), /* value range: 0 - 0xFF */
+ HID_LogicalMaxS(0xFF),
+ HID_ReportSize(8), /* 8 bits */
+ HID_ReportCount(HID_INPUT_REPORT_BYTES),
+ HID_Usage(0x01),
+ HID_Input(HID_Data | HID_Variable | HID_Absolute),
+ HID_ReportCount(HID_OUTPUT_REPORT_BYTES),
+ HID_Usage(0x01),
+ HID_Output(HID_Data | HID_Variable | HID_Absolute),
+ HID_ReportCount(HID_FEATURE_REPORT_BYTES),
+ HID_Usage(0x01),
+ HID_Feature(HID_Data | HID_Variable | HID_Absolute),
+ HID_EndCollection,
+};
+const uint16_t HID_ReportDescSize = sizeof(HID_ReportDescriptor);
+
+/**
+ * USB Standard Device Descriptor
+ */
+ALIGNED(4) const uint8_t USB_DeviceDescriptor[] = {
+ USB_DEVICE_DESC_SIZE, /* bLength */
+ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL(0x0200), /* bcdUSB 2.0 */
+ 0x00, /* bDeviceClass */
+ 0x00, /* bDeviceSubClass */
+ 0x00, /* bDeviceProtocol */
+ USB_MAX_PACKET0, /* bMaxPacketSize0 */
+ WBVAL(0x1FC9), /* idVendor */
+ WBVAL(0x0081), /* idProduct */
+ WBVAL(0x0100), /* bcdDevice */
+ 0x01, /* iManufacturer */
+ 0x02, /* iProduct */
+ 0x03, /* iSerialNumber */
+ 0x01 /* bNumConfigurations */
+};
+
+/**
+ * USB FSConfiguration Descriptor
+ * All Descriptors (Configuration, Interface, Endpoint, Class, Vendor)
+ */
+ALIGNED(4) uint8_t USB_FsConfigDescriptor[] = {
+ /* Configuration 1 */
+ USB_CONFIGURATION_DESC_SIZE, /* bLength */
+ USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL( /* wTotalLength */
+ USB_CONFIGURATION_DESC_SIZE +
+ USB_INTERFACE_DESC_SIZE +
+ HID_DESC_SIZE +
+ USB_ENDPOINT_DESC_SIZE +
+ USB_ENDPOINT_DESC_SIZE
+ ),
+ 0x01, /* bNumInterfaces */
+ 0x01, /* bConfigurationValue */
+ 0x00, /* iConfiguration */
+ USB_CONFIG_SELF_POWERED, /* bmAttributes */
+ USB_CONFIG_POWER_MA(100), /* bMaxPower */
+
+ /* Interface 0, Alternate Setting 0, HID Class */
+ USB_INTERFACE_DESC_SIZE, /* bLength */
+ USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 0x00, /* bInterfaceNumber */
+ 0x00, /* bAlternateSetting */
+ 0x02, /* bNumEndpoints */
+ USB_DEVICE_CLASS_HUMAN_INTERFACE, /* bInterfaceClass */
+ HID_SUBCLASS_NONE, /* bInterfaceSubClass */
+ HID_PROTOCOL_NONE, /* bInterfaceProtocol */
+ 0x04, /* iInterface */
+ /* HID Class Descriptor */
+ /* HID_DESC_OFFSET = 0x0012 */
+ HID_DESC_SIZE, /* bLength */
+ HID_HID_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL(0x0111), /* bcdHID : 1.11*/
+ 0x00, /* bCountryCode */
+ 0x01, /* bNumDescriptors */
+ HID_REPORT_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL(sizeof(HID_ReportDescriptor)), /* wDescriptorLength */
+ /* Endpoint, HID Interrupt In */
+ USB_ENDPOINT_DESC_SIZE, /* bLength */
+ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
+ HID_EP_IN, /* bEndpointAddress */
+ USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */
+ WBVAL(0x0004), /* wMaxPacketSize */
+ 0x20, /* 16ms */ /* bInterval */
+ /* Endpoint, HID Interrupt Out */
+ USB_ENDPOINT_DESC_SIZE, /* bLength */
+ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
+ HID_EP_OUT, /* bEndpointAddress */
+ USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */
+ WBVAL(0x0004), /* wMaxPacketSize */
+ 0x20, /* bInterval: 16ms */
+ /* Terminator */
+ 0 /* bLength */
+};
+
+/**
+ * USB String Descriptor (optional)
+ */
+const uint8_t USB_StringDescriptor[] = {
+ /* Index 0x00: LANGID Codes */
+ 0x04, /* bLength */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL(0x0409), /* wLANGID : US English*/
+ /* Index 0x01: Manufacturer */
+ (18 * 2 + 2), /* bLength (13 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'N', 0,
+ 'X', 0,
+ 'P', 0,
+ ' ', 0,
+ 'S', 0,
+ 'e', 0,
+ 'm', 0,
+ 'i', 0,
+ 'c', 0,
+ 'o', 0,
+ 'n', 0,
+ 'd', 0,
+ 'u', 0,
+ 'c', 0,
+ 't', 0,
+ 'o', 0,
+ 'r', 0,
+ 's', 0,
+ /* Index 0x02: Product */
+ (12 * 2 + 2), /* bLength (12 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'L', 0,
+ 'P', 0,
+ 'C', 0,
+ '1', 0,
+ '5', 0,
+ 'x', 0,
+ 'x', 0,
+ ' ', 0,
+ 'H', 0,
+ 'I', 0,
+ 'D', 0,
+ ' ', 0,
+ /* Index 0x03: Serial Number */
+ (13 * 2 + 2), /* bLength (13 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'A', 0,
+ 'B', 0,
+ 'C', 0,
+ 'D', 0,
+ '1', 0,
+ '2', 0,
+ '3', 0,
+ '4', 0,
+ '5', 0,
+ '6', 0,
+ '7', 0,
+ '8', 0,
+ '9', 0,
+ /* Index 0x04: Interface 0, Alternate Setting 0 */
+ (3 * 2 + 2), /* bLength (3 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'H', 0,
+ 'I', 0,
+ 'D', 0,
+};
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/src/hid_generic.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/src/hid_generic.c
new file mode 100644
index 0000000..045147f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/src/hid_generic.c
@@ -0,0 +1,161 @@
+/*
+ * @brief HID generic example's callabck routines
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include <stdint.h>
+#include <string.h>
+#include "usbd_rom_api.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+static uint8_t *loopback_report;
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+extern const uint8_t HID_ReportDescriptor[];
+extern const uint16_t HID_ReportDescSize;
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* HID get report callback function. */
+static ErrorCode_t HID_GetReport(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t * *pBuffer, uint16_t *plength)
+{
+ /* ReportID = SetupPacket.wValue.WB.L; */
+ switch (pSetup->wValue.WB.H) {
+ case HID_REPORT_INPUT:
+ *pBuffer[0] = *loopback_report;
+ *plength = 1;
+ break;
+
+ case HID_REPORT_OUTPUT:
+ return ERR_USBD_STALL; /* Not Supported */
+
+ case HID_REPORT_FEATURE:
+ return ERR_USBD_STALL; /* Not Supported */
+ }
+ return LPC_OK;
+}
+
+/* HID set report callback function. */
+static ErrorCode_t HID_SetReport(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t * *pBuffer, uint16_t length)
+{
+ /* we will reuse standard EP0Buf */
+ if (length == 0) {
+ return LPC_OK;
+ }
+
+ /* ReportID = SetupPacket.wValue.WB.L; */
+ switch (pSetup->wValue.WB.H) {
+ case HID_REPORT_INPUT:
+ return ERR_USBD_STALL; /* Not Supported */
+
+ case HID_REPORT_OUTPUT:
+ *loopback_report = **pBuffer;
+ break;
+
+ case HID_REPORT_FEATURE:
+ return ERR_USBD_STALL; /* Not Supported */
+ }
+ return LPC_OK;
+}
+
+/* HID Interrupt endpoint event handler. */
+static ErrorCode_t HID_Ep_Hdlr(USBD_HANDLE_T hUsb, void *data, uint32_t event)
+{
+ USB_HID_CTRL_T *pHidCtrl = (USB_HID_CTRL_T *) data;
+
+ switch (event) {
+ case USB_EVT_IN:
+ /* last report is successfully sent. Do something... */
+ break;
+
+ case USB_EVT_OUT:
+ /* Read the new report received. */
+ USBD_API->hw->ReadEP(hUsb, pHidCtrl->epout_adr, loopback_report);
+ /* loopback the report received. */
+ USBD_API->hw->WriteEP(hUsb, pHidCtrl->epin_adr, loopback_report, 1);
+ break;
+ }
+ return LPC_OK;
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* HID init routine */
+ErrorCode_t usb_hid_init(USBD_HANDLE_T hUsb,
+ USB_INTERFACE_DESCRIPTOR *pIntfDesc,
+ uint32_t *mem_base,
+ uint32_t *mem_size)
+{
+ USBD_HID_INIT_PARAM_T hid_param;
+ USB_HID_REPORT_T reports_data[1];
+ ErrorCode_t ret = LPC_OK;
+
+ memset((void *) &hid_param, 0, sizeof(USBD_HID_INIT_PARAM_T));
+ /* HID paramas */
+ hid_param.max_reports = 1;
+ /* Init reports_data */
+ reports_data[0].len = HID_ReportDescSize;
+ reports_data[0].idle_time = 0;
+ reports_data[0].desc = (uint8_t *) &HID_ReportDescriptor[0];
+
+ if ((pIntfDesc == 0) || (pIntfDesc->bInterfaceClass != USB_DEVICE_CLASS_HUMAN_INTERFACE)) {
+ return ERR_FAILED;
+ }
+
+ hid_param.mem_base = *mem_base;
+ hid_param.mem_size = *mem_size;
+ hid_param.intf_desc = (uint8_t *) pIntfDesc;
+ /* user defined functions */
+ hid_param.HID_GetReport = HID_GetReport;
+ hid_param.HID_SetReport = HID_SetReport;
+ hid_param.HID_EpIn_Hdlr = HID_Ep_Hdlr;
+ hid_param.HID_EpOut_Hdlr = HID_Ep_Hdlr;
+ hid_param.report_data = reports_data;
+
+ ret = USBD_API->hid->init(hUsb, &hid_param);
+ /* allocate USB accessable memory space for report data */
+ loopback_report = (uint8_t *) hid_param.mem_base;
+ hid_param.mem_base += 4;
+ hid_param.mem_size += 4;
+ /* update memory variables */
+ *mem_base = hid_param.mem_base;
+ *mem_size = hid_param.mem_size;
+ return ret;
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/src/hid_main.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/src/hid_main.c
new file mode 100644
index 0000000..e779856
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/src/hid_main.c
@@ -0,0 +1,160 @@
+/*
+ * @brief HID generic example
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include <stdio.h>
+#include <string.h>
+#include "app_usbd_cfg.h"
+#include "hid_generic.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+static USBD_HANDLE_T g_hUsb;
+const USBD_API_T *g_pUsbApi;
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle interrupt from USB
+ * @return Nothing
+ */
+void USB_IRQHandler(void)
+{
+ USBD_API->hw->ISR(g_hUsb);
+}
+
+/* Find the address of interface descriptor for given class type. */
+USB_INTERFACE_DESCRIPTOR *find_IntfDesc(const uint8_t *pDesc, uint32_t intfClass)
+{
+ USB_COMMON_DESCRIPTOR *pD;
+ USB_INTERFACE_DESCRIPTOR *pIntfDesc = 0;
+ uint32_t next_desc_adr;
+
+ pD = (USB_COMMON_DESCRIPTOR *) pDesc;
+ next_desc_adr = (uint32_t) pDesc;
+
+ while (pD->bLength) {
+ /* is it interface descriptor */
+ if (pD->bDescriptorType == USB_INTERFACE_DESCRIPTOR_TYPE) {
+
+ pIntfDesc = (USB_INTERFACE_DESCRIPTOR *) pD;
+ /* did we find the right interface descriptor */
+ if (pIntfDesc->bInterfaceClass == intfClass) {
+ break;
+ }
+ }
+ pIntfDesc = 0;
+ next_desc_adr = (uint32_t) pD + pD->bLength;
+ pD = (USB_COMMON_DESCRIPTOR *) next_desc_adr;
+ }
+
+ return pIntfDesc;
+}
+
+/**
+ * @brief main routine for blinky example
+ * @return Function should not exit.
+ */
+int main(void)
+{
+ USBD_API_INIT_PARAM_T usb_param;
+ USB_CORE_DESCS_T desc;
+ ErrorCode_t ret = LPC_OK;
+
+ /* Initialize board and chip */
+ Board_Init();
+
+ /* enable clocks */
+ Chip_USB_Init();
+
+ /* initialize USBD ROM API pointer. */
+ g_pUsbApi = (const USBD_API_T *) LPC_ROM_API->pUSBD;
+
+ /* initialize call back structures */
+ memset((void *) &usb_param, 0, sizeof(USBD_API_INIT_PARAM_T));
+ usb_param.usb_reg_base = LPC_USB0_BASE;
+ /* WORKAROUND for artf44835 ROM driver BUG:
+ Code clearing STALL bits in endpoint reset routine corrupts memory area
+ next to the endpoint control data. For example When EP0, EP1_IN, EP1_OUT,
+ EP2_IN are used we need to specify 3 here. But as a workaround for this
+ issue specify 4. So that extra EPs control structure acts as padding buffer
+ to avoid data corruption. Corruption of padding memory doesn’t affect the
+ stack/program behaviour.
+ */
+ usb_param.max_num_ep = 2 + 1;
+ usb_param.mem_base = USB_STACK_MEM_BASE;
+ usb_param.mem_size = USB_STACK_MEM_SIZE;
+
+ /* Set the USB descriptors */
+ desc.device_desc = (uint8_t *) USB_DeviceDescriptor;
+ desc.string_desc = (uint8_t *) USB_StringDescriptor;
+
+ /* Note, to pass USBCV test full-speed only devices should have both
+ * descriptor arrays point to same location and device_qualifier set
+ * to 0.
+ */
+ desc.high_speed_desc = USB_FsConfigDescriptor;
+ desc.full_speed_desc = USB_FsConfigDescriptor;
+ desc.device_qualifier = 0;
+
+ /* USB Initialization */
+ ret = USBD_API->hw->Init(&g_hUsb, &desc, &usb_param);
+ if (ret == LPC_OK) {
+
+ ret =
+ usb_hid_init(g_hUsb,
+ (USB_INTERFACE_DESCRIPTOR *) &USB_FsConfigDescriptor[sizeof(USB_CONFIGURATION_DESCRIPTOR)],
+ &usb_param.mem_base, &usb_param.mem_size);
+ if (ret == LPC_OK) {
+ /* enable USB interrupts */
+ NVIC_EnableIRQ(USB0_IRQn);
+ /* now connect */
+ USBD_API->hw->Connect(g_hUsb, 1);
+ }
+
+ }
+
+ while (1) {
+ __WFI();
+ }
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_generic/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/.cproject
new file mode 100644
index 0000000..03ae7e6
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/.cproject
@@ -0,0 +1,243 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.1575189433">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.1575189433" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.1575189433" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.1575189433." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.350382659" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.356290331" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/usbd_rom_hid_keyboard}/Debug" id="com.crt.advproject.builder.exe.debug.1171229332" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.2053087291" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1529279338" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.824108240" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.416976928" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.924893350" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.792222747" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.378987128" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.369655799" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/example/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc/usbd}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.2032661348" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.158589050" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1835238921" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.492081872" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.965897746" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.856540083" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.59837835" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.2085573836" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.761710981" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.1478162101" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.415483505" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1012394887" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.561685578" name="Linker script" superClass="com.crt.advproject.link.script" value=""usbd_rom_hid_keyboard_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.1058521020" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.482130576" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.507397345" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.2125988589" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.206671556" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.7914163" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1073613624" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.65000738">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.65000738" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.65000738" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.65000738." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.2120508480" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1830508103" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/usbd_rom_hid_keyboard}/Release" id="com.crt.advproject.builder.exe.release.680030083" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.519100570" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.1407465030" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.561696743" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1925452593" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1573018699" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.1207132625" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.258619276" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.998643195" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/example/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc/usbd}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.1429433978" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.298995281" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.1509620782" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.2125284167" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.341849607" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1723863947" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1236372925" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1249666094" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.944992959" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.1539263296" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.2115009247" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.133973963" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.144278334" name="Linker script" superClass="com.crt.advproject.link.script" value=""usbd_rom_hid_keyboard_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.839782844" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1602473549" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.444794570" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.92048399" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1815677011" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.838865419" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.2069678955" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="usbd_rom_hid_keyboard.com.crt.advproject.projecttype.exe.1568905101" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/.project
new file mode 100644
index 0000000..1319093
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>usbd_rom_hid_keyboard</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/inc/app_usbd_cfg.h b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/inc/app_usbd_cfg.h
new file mode 100644
index 0000000..c669868
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/inc/app_usbd_cfg.h
@@ -0,0 +1,97 @@
+/*
+ * @brief Configuration file needed for USB ROM stack based applications.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "lpc_types.h"
+#include "error.h"
+#include "usbd_rom_api.h"
+
+#ifndef __APP_USB_CFG_H_
+#define __APP_USB_CFG_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @ingroup EXAMPLES_USBDROM_15XX_HID_KEYBOARD
+ * @{
+ */
+
+/* HID In/Out Endpoint Address */
+#define HID_EP_IN 0x81
+#define HID_EP_OUT 0x01
+/** Interval between keyboard reports expressed in milliseconds for full-speed device. */
+#define HID_KEYBRD_REPORT_INTERVAL_MS 10
+/** bInterval value used in descriptor. For HS this macro will differ from HID_KEYBRD_REPORT_INTERVAL_MS macro. */
+#define HID_KEYBRD_REPORT_INTERVAL 10
+
+/* The following manifest constants are used to define this memory area to be used
+ by USBD ROM stack.
+ */
+#define USB_STACK_MEM_BASE 0x02008000
+#define USB_STACK_MEM_SIZE 0x1000
+
+/* Manifest constants used by USBD ROM stack. These values SHOULD NOT BE CHANGED
+ for advance features which require usage of USB_CORE_CTRL_T structure.
+ Since these are the values used for compiling USB stack.
+ */
+#define USB_MAX_IF_NUM 8 /*!< Max interface number used for building USBDL_Lib. DON'T CHANGE. */
+#define USB_MAX_EP_NUM 5 /*!< Max number of EP used for building USBD ROM. DON'T CHANGE. */
+#define USB_MAX_PACKET0 64 /*!< Max EP0 packet size used for building USBD ROM. DON'T CHANGE. */
+#define USB_FS_MAX_BULK_PACKET 64 /*!< MAXP for FS bulk EPs used for building USBD ROM. DON'T CHANGE. */
+#define USB_HS_MAX_BULK_PACKET 512 /*!< MAXP for HS bulk EPs used for building USBD ROM. DON'T CHANGE. */
+#define USB_DFU_XFER_SIZE 2048 /*!< Max DFU transfer size used for building USBD ROM. DON'T CHANGE. */
+
+/* USB descriptor arrays defined *_desc.c file */
+extern const uint8_t USB_DeviceDescriptor[];
+extern uint8_t USB_HsConfigDescriptor[];
+extern uint8_t USB_FsConfigDescriptor[];
+extern const uint8_t USB_StringDescriptor[];
+extern const uint8_t USB_DeviceQualifier[];
+
+/**
+ * @brief Find the address of interface descriptor for given class type.
+ * @param pDesc Pointer to configuration descriptor in which the desired class
+ * interface descriptor to be found.
+ * @param intfClass Interface class type to be searched.
+ * @return If found returns the address of requested interface else returns NULL.
+ */
+extern USB_INTERFACE_DESCRIPTOR *find_IntfDesc(const uint8_t *pDesc, uint32_t intfClass);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __APP_USB_CFG_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/inc/hid_keyboard.h b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/inc/hid_keyboard.h
new file mode 100644
index 0000000..69b2d26
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/inc/hid_keyboard.h
@@ -0,0 +1,79 @@
+/*
+ * @brief This file contains USB HID Keyboard example using USB ROM Drivers.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __HID_KEYBOARD_H_
+#define __HID_KEYBOARD_H_
+
+#include "app_usbd_cfg.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @ingroup EXAMPLES_USBDROM_15XX_HID_KEYBOARD
+ * @{
+ */
+
+#define KEYBOARD_REPORT_SIZE 8
+
+#define HID_KEYBOARD_CLEAR_REPORT(x) memset(x, 0, 8);
+#define HID_KEYBOARD_REPORT_SET_KEY_PRESS(x, val) x[2] = (uint8_t) val;
+
+/**
+ * @brief HID keyboard interface init routine.
+ * @param hUsb : Handle to USB device stack
+ * @param pIntfDesc : Pointer to HID interface descriptor
+ * @param mem_base : Pointer to memory address which can be used by HID driver
+ * @param mem_size : Size of the memory passed
+ * @return On success returns LPC_OK. Params mem_base and mem_size are updated
+ * to point to new base and available size.
+ */
+extern ErrorCode_t Keyboard_init(USBD_HANDLE_T hUsb,
+ USB_INTERFACE_DESCRIPTOR *pIntfDesc,
+ uint32_t *mem_base,
+ uint32_t *mem_size);
+
+/**
+ * @brief Keyboard tasks.
+ * @return On success returns LPC_OK.
+ */
+extern void Keyboard_Tasks(void);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __HID_KEYBOARD_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/inc/ms_timer.h b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/inc/ms_timer.h
new file mode 100644
index 0000000..ce36c14
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/inc/ms_timer.h
@@ -0,0 +1,158 @@
+/*
+ * @brief This file contains millisecond timer routines.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+
+#ifndef _MS_TIMER_H
+#define _MS_TIMER_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @ingroup EXAMPLES_USBDROM_15XX_HID_KEYBOARD
+ * @{
+ */
+
+/**
+ * @brief Structure to hold millisecond timer data
+ */
+
+typedef struct {
+ int32_t start; /*!< SysTick count when current timer started. */
+ int32_t interval; /*!< Timer interval. */
+} ms_timer_t;
+
+/* exported data */
+extern volatile uint32_t g_msTicks; /*!< 1 millisecond counter incremented in SysTick_IRQ() */
+
+/**
+ * @brief Setup Systick to generate 1 msec interrupt.
+ * @return Nothing
+ */
+static INLINE void systick_init(void)
+{
+ if (SysTick_Config(Chip_Clock_GetSystemClockRate() / 1000)) { /* Setup SysTick Timer for 1 msec interrupts */
+ while (1) { /* Capture error */
+ }
+ }
+ NVIC_SetPriority(SysTick_IRQn, 0x0);
+}
+
+/**
+ * @brief Gets millisecond count from board startup.
+ * @return Nothing
+ */
+static INLINE uint32_t systick_Count(void)
+{
+ return g_msTicks;
+}
+
+/**
+ * @brief Initialize the given timer object and also start the timer.
+ * @param t : Pointer to timer object
+ * @param interval: Timer interval in milliseconds
+ * @return Nothing
+ */
+static INLINE void ms_timerInit(ms_timer_t *t, int32_t interval)
+{
+ t->interval = interval;
+ t->start = (int32_t) g_msTicks;
+}
+
+/**
+ * @brief Initialize the given timer object without starting the timer.
+ * @param t : Pointer to timer object
+ * @param interval: Timer interval in milliseconds
+ * @return Nothing
+ */
+static INLINE void ms_timerInitOnly(ms_timer_t *t, int32_t interval)
+{
+ t->interval = interval;
+ t->start = 0;
+}
+
+/**
+ * @brief Stop the timer.
+ * @param t : Pointer to timer object
+ * @return Nothing
+ */
+static INLINE void ms_timerStop(ms_timer_t *t)
+{
+ t->start = 0;
+}
+
+/**
+ * @brief Check if the timer has started.
+ * @param t : Pointer to timer object
+ * @return true if the timer has started, otherwise false
+ */
+static INLINE bool ms_timerStarted(ms_timer_t *t)
+{
+ return (bool) (t->start != 0);
+}
+
+/**
+ * @brief Start the timer.
+ * @param t : Pointer to timer object
+ * @return Nothing
+ */
+static INLINE void ms_timerStart(ms_timer_t *t)
+{
+ t->start = (g_msTicks == 0) ? 1 : (int32_t) g_msTicks;
+}
+
+/**
+ * @brief Check if timer has expired.
+ * @param t : Pointer to timer object
+ * @return true if the timer has expired, otherwise false
+ */
+static INLINE bool ms_timerExpired(ms_timer_t *t)
+{
+ return (bool) (((int32_t) g_msTicks - t->start) >= t->interval);
+}
+
+/**
+ * @brief Waits for given number of milliseconds
+ * @param n : Number of milliseconds
+ * @return Nothing
+ */
+extern void ms_timerDelay(uint32_t n);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* end _MS_TIMER_H */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/readme.dox
new file mode 100644
index 0000000..325532d
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/readme.dox
@@ -0,0 +1,59 @@
+/*
+ * @brief This file contains USB HID Keyboard example using USB ROM Drivers.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+
+/** @defgroup EXAMPLES_USBDROM_15XX_HID_KEYBOARD LPC15XX Keyboard example
+ * @ingroup EXAMPLES_USBDROM_15XX
+ * <b>Example description</b><br>
+ * The example shows how to us USBD ROM stack to creates a HID keyboard.
+ * <br>
+ *
+ * <b>Special connection requirements</b><br>
+ * The tiny joystick that is surface mounted on the eval board has 4 positions
+ * and a button press. They act as number keys '2', '4', '6', '8', and NUMLOCK.
+ * The joystick press toggles NUMLOCK. When NUMLOCK is ON the joystick positions
+ * are mapped to the arrow keys. For most OSs, no drivers are needed.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/src/hid_desc.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/src/hid_desc.c
new file mode 100644
index 0000000..dd1feae
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/src/hid_desc.c
@@ -0,0 +1,230 @@
+/*
+ * @brief This file contains USB HID Keyboard example using USB ROM Drivers.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "app_usbd_cfg.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/**
+ * HID Keyboard Report Descriptor
+ */
+const uint8_t Keyboard_ReportDescriptor[] = {
+ HID_UsagePage(HID_USAGE_PAGE_GENERIC),
+ HID_Usage(HID_USAGE_GENERIC_KEYBOARD),
+ HID_Collection(HID_Application),
+ HID_UsagePage(HID_USAGE_PAGE_KEYBOARD),
+ HID_UsageMin(224),
+ HID_UsageMax(231),
+ HID_LogicalMin(0),
+ HID_LogicalMax(1),
+ HID_ReportSize(1),
+ HID_ReportCount(8),
+ HID_Input(HID_Data | HID_Variable | HID_Absolute),
+ HID_ReportCount(1),
+ HID_ReportSize(8),
+ HID_Input(HID_Constant),
+ HID_ReportCount(5),
+ HID_ReportSize(1),
+ HID_UsagePage(HID_USAGE_PAGE_LED),
+ HID_UsageMin(1),
+ HID_UsageMax(5),
+ HID_Output(HID_Data | HID_Variable | HID_Absolute),
+ HID_ReportCount(1),
+ HID_ReportSize(3),
+ HID_Output(HID_Constant),
+ HID_ReportCount(6),
+ HID_ReportSize(8),
+ HID_LogicalMin(0),
+ HID_LogicalMax(101),
+ HID_UsagePage(HID_USAGE_PAGE_KEYBOARD),
+ HID_UsageMin(0),
+ HID_UsageMax(101),
+ HID_Input(HID_Array),
+ HID_EndCollection,
+};
+const uint16_t Keyboard_ReportDescSize = sizeof(Keyboard_ReportDescriptor);
+
+/**
+ * USB Standard Device Descriptor
+ */
+ALIGNED(4) const uint8_t USB_DeviceDescriptor[] = {
+ USB_DEVICE_DESC_SIZE, /* bLength */
+ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL(0x0200), /* bcdUSB = 2.00*/
+ 0x00, /* bDeviceClass */
+ 0x00, /* bDeviceSubClass */
+ 0x00, /* bDeviceProtocol */
+ USB_MAX_PACKET0, /* bMaxPacketSize0 */
+ WBVAL(0x1FC9), /* idVendor */
+ WBVAL(0x0086), /* idProduct */
+ WBVAL(0x0100), /* bcdDevice */
+ 0x01, /* iManufacturer */
+ 0x02, /* iProduct */
+ 0x03, /* iSerialNumber */
+ 0x01 /* bNumConfigurations */
+};
+
+/**
+ * USB FSConfiguration Descriptor
+ * All Descriptors (Configuration, Interface, Endpoint, Class, Vendor)
+ */
+ALIGNED(4) uint8_t USB_FsConfigDescriptor[] = {
+ /* Configuration 1 */
+ USB_CONFIGURATION_DESC_SIZE, /* bLength */
+ USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL( /* wTotalLength */
+ USB_CONFIGURATION_DESC_SIZE +
+ USB_INTERFACE_DESC_SIZE +
+ HID_DESC_SIZE +
+ USB_ENDPOINT_DESC_SIZE
+ ),
+ 0x01, /* bNumInterfaces */
+ 0x01, /* bConfigurationValue */
+ 0x00, /* iConfiguration */
+ USB_CONFIG_SELF_POWERED, /* bmAttributes */
+ USB_CONFIG_POWER_MA(2), /* bMaxPower */
+
+ /* Interface 0, Alternate Setting 0, HID Class */
+ USB_INTERFACE_DESC_SIZE, /* bLength */
+ USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 0x00, /* bInterfaceNumber */
+ 0x00, /* bAlternateSetting */
+ 0x01, /* bNumEndpoints */
+ USB_DEVICE_CLASS_HUMAN_INTERFACE, /* bInterfaceClass */
+ HID_SUBCLASS_BOOT, /* bInterfaceSubClass */
+ HID_PROTOCOL_KEYBOARD, /* bInterfaceProtocol */
+ 0x04, /* iInterface */
+ /* HID Class Descriptor */
+ /* HID_DESC_OFFSET = 0x0012 */
+ HID_DESC_SIZE, /* bLength */
+ HID_HID_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL(0x0111), /* bcdHID : 1.11*/
+ 0x00, /* bCountryCode */
+ 0x01, /* bNumDescriptors */
+ HID_REPORT_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL(sizeof(Keyboard_ReportDescriptor)), /* wDescriptorLength */
+ /* Endpoint, HID Interrupt In */
+ USB_ENDPOINT_DESC_SIZE, /* bLength */
+ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
+ HID_EP_IN, /* bEndpointAddress */
+ USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */
+ WBVAL(0x0008), /* wMaxPacketSize */
+ HID_KEYBRD_REPORT_INTERVAL, /* bInterval */
+ /* Terminator */
+ 0 /* bLength */
+};
+
+/**
+ * USB String Descriptor (optional)
+ */
+const uint8_t USB_StringDescriptor[] = {
+ /* Index 0x00: LANGID Codes */
+ 0x04, /* bLength */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL(0x0409), /* wLANGID 0x0409 = US English*/
+ /* Index 0x01: Manufacturer */
+ (18 * 2 + 2), /* bLength (18 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'N', 0,
+ 'X', 0,
+ 'P', 0,
+ ' ', 0,
+ 'S', 0,
+ 'e', 0,
+ 'm', 0,
+ 'i', 0,
+ 'c', 0,
+ 'o', 0,
+ 'n', 0,
+ 'd', 0,
+ 'u', 0,
+ 'c', 0,
+ 't', 0,
+ 'o', 0,
+ 'r', 0,
+ 's', 0,
+ /* Index 0x02: Product */
+ (16 * 2 + 2), /* bLength (16 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'L', 0,
+ 'P', 0,
+ 'C', 0,
+ '1', 0,
+ '5', 0,
+ 'x', 0,
+ 'x', 0,
+ ' ', 0,
+ 'K', 0,
+ 'E', 0,
+ 'Y', 0,
+ 'B', 0,
+ 'O', 0,
+ 'A', 0,
+ 'R', 0,
+ 'D', 0,
+ /* Index 0x03: Serial Number */
+ (13 * 2 + 2), /* bLength (13 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'A', 0,
+ 'B', 0,
+ 'C', 0,
+ 'D', 0,
+ '1', 0,
+ '2', 0,
+ '3', 0,
+ '4', 0,
+ '5', 0,
+ '6', 0,
+ '7', 0,
+ '8', 0,
+ '9', 0,
+ /* Index 0x04: Interface 0, Alternate Setting 0 */
+ (12 * 2 + 2), /* bLength (12 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'H', 0,
+ 'I', 0,
+ 'D', 0,
+ ' ', 0,
+ 'K', 0,
+ 'E', 0,
+ 'Y', 0,
+ 'B', 0,
+ 'O', 0,
+ 'A', 0,
+ 'R', 0,
+ 'D', 0,
+};
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/src/hid_keyboard.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/src/hid_keyboard.c
new file mode 100644
index 0000000..6042625
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/src/hid_keyboard.c
@@ -0,0 +1,225 @@
+/*
+ * @brief This file contains USB HID Keyboard example using USB ROM Drivers.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include <stdint.h>
+#include <string.h>
+#include "usbd_rom_api.h"
+#include "hid_keyboard.h"
+#include "ms_timer.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/**
+ * @brief Structure to hold Keyboard data
+ */
+typedef struct {
+ USBD_HANDLE_T hUsb; /*!< Handle to USB stack. */
+ uint8_t report[KEYBOARD_REPORT_SIZE]; /*!< Last report data */
+ uint8_t tx_busy; /*!< Flag indicating whether a report is pending in endpoint queue. */
+ ms_timer_t tmo; /*!< Timer to track when to send next report. */
+} Keyboard_Ctrl_T;
+
+/** Singleton instance of Keyboard control */
+static Keyboard_Ctrl_T g_keyBoard;
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+extern const uint8_t Keyboard_ReportDescriptor[];
+extern const uint16_t Keyboard_ReportDescSize;
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/* Routine to update keyboard state */
+static void Keyboard_UpdateReport(void)
+{
+ uint8_t joystick_status = Joystick_GetStatus();
+
+ HID_KEYBOARD_CLEAR_REPORT(&g_keyBoard.report[0]);
+
+ switch (joystick_status) {
+ case JOY_PRESS:
+ HID_KEYBOARD_REPORT_SET_KEY_PRESS(g_keyBoard.report, 0x53);
+ break;
+
+ case JOY_LEFT:
+ HID_KEYBOARD_REPORT_SET_KEY_PRESS(g_keyBoard.report, 0x5C);
+ break;
+
+ case JOY_RIGHT:
+ HID_KEYBOARD_REPORT_SET_KEY_PRESS(g_keyBoard.report, 0x5E);
+ break;
+
+ case JOY_UP:
+ HID_KEYBOARD_REPORT_SET_KEY_PRESS(g_keyBoard.report, 0x60);
+ break;
+
+ case JOY_DOWN:
+ HID_KEYBOARD_REPORT_SET_KEY_PRESS(g_keyBoard.report, 0x5A);
+ break;
+ }
+}
+
+/* HID Get Report Request Callback. Called automatically on HID Get Report Request */
+static ErrorCode_t Keyboard_GetReport(USBD_HANDLE_T hHid,
+ USB_SETUP_PACKET *pSetup,
+ uint8_t * *pBuffer,
+ uint16_t *plength)
+{
+ /* ReportID = SetupPacket.wValue.WB.L; */
+ switch (pSetup->wValue.WB.H) {
+ case HID_REPORT_INPUT:
+ Keyboard_UpdateReport();
+ memcpy(*pBuffer, &g_keyBoard.report[0], KEYBOARD_REPORT_SIZE);
+ *plength = KEYBOARD_REPORT_SIZE;
+ break;
+
+ case HID_REPORT_OUTPUT: /* Not Supported */
+ case HID_REPORT_FEATURE: /* Not Supported */
+ return ERR_USBD_STALL;
+ }
+ return LPC_OK;
+}
+
+/* HID Set Report Request Callback. Called automatically on HID Set Report Request */
+static ErrorCode_t Keyboard_SetReport(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t * *pBuffer, uint16_t length)
+{
+ /* we will reuse standard EP0Buf */
+ if (length == 0) {
+ return LPC_OK;
+ }
+ /* ReportID = SetupPacket.wValue.WB.L; */
+ switch (pSetup->wValue.WB.H) {
+ case HID_REPORT_OUTPUT:
+ /* If the USB host tells us to turn on the NUM LOCK LED,
+ * then turn on LED#2.
+ */
+ if (**pBuffer & 0x01) {
+ Board_LED_Set(0, 1);
+ }
+ else {
+ Board_LED_Set(0, 0);
+ }
+ break;
+
+ case HID_REPORT_INPUT: /* Not Supported */
+ case HID_REPORT_FEATURE: /* Not Supported */
+ return ERR_USBD_STALL;
+ }
+ return LPC_OK;
+}
+
+/* HID interrupt IN endpoint handler */
+static ErrorCode_t Keyboard_EpIN_Hdlr(USBD_HANDLE_T hUsb, void *data, uint32_t event)
+{
+ switch (event) {
+ case USB_EVT_IN:
+ g_keyBoard.tx_busy = 0;
+ break;
+ }
+ return LPC_OK;
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* HID keyboard init routine */
+ErrorCode_t Keyboard_init(USBD_HANDLE_T hUsb,
+ USB_INTERFACE_DESCRIPTOR *pIntfDesc,
+ uint32_t *mem_base,
+ uint32_t *mem_size)
+{
+ USBD_HID_INIT_PARAM_T hid_param;
+ USB_HID_REPORT_T reports_data[1];
+ ErrorCode_t ret = LPC_OK;
+
+ /* Do a quick check of if the interface descriptor passed is the right one. */
+ if ((pIntfDesc == 0) || (pIntfDesc->bInterfaceClass != USB_DEVICE_CLASS_HUMAN_INTERFACE)) {
+ return ERR_FAILED;
+ }
+
+ /* init joystick control */
+ Board_Joystick_Init();
+
+ /* Init HID params */
+ memset((void *) &hid_param, 0, sizeof(USBD_HID_INIT_PARAM_T));
+ hid_param.max_reports = 1;
+ hid_param.mem_base = *mem_base;
+ hid_param.mem_size = *mem_size;
+ hid_param.intf_desc = (uint8_t *) pIntfDesc;
+ /* user defined functions */
+ hid_param.HID_GetReport = Keyboard_GetReport;
+ hid_param.HID_SetReport = Keyboard_SetReport;
+ hid_param.HID_EpIn_Hdlr = Keyboard_EpIN_Hdlr;
+ /* Init reports_data */
+ reports_data[0].len = Keyboard_ReportDescSize;
+ reports_data[0].idle_time = 0;
+ reports_data[0].desc = (uint8_t *) &Keyboard_ReportDescriptor[0];
+ hid_param.report_data = reports_data;
+
+ ret = USBD_API->hid->init(hUsb, &hid_param);
+ /* update memory variables */
+ *mem_base = hid_param.mem_base;
+ *mem_size = hid_param.mem_size;
+ /* store stack handle for later use. */
+ g_keyBoard.hUsb = hUsb;
+ /* start the mouse timer */
+ ms_timerInit(&g_keyBoard.tmo, HID_KEYBRD_REPORT_INTERVAL_MS);
+
+ return ret;
+}
+
+/* Keyboard tasks */
+void Keyboard_Tasks(void)
+{
+ /* check if moue report timer expired */
+ if (ms_timerExpired(&g_keyBoard.tmo)) {
+ /* reset timer */
+ ms_timerStart(&g_keyBoard.tmo);
+ /* check device is configured before sending report. */
+ if ( USB_IsConfigured(g_keyBoard.hUsb)) {
+ /* update report based on board state */
+ Keyboard_UpdateReport();
+ /* send report data */
+ if (g_keyBoard.tx_busy == 0) {
+ g_keyBoard.tx_busy = 1;
+ USBD_API->hw->WriteEP(g_keyBoard.hUsb, HID_EP_IN, &g_keyBoard.report[0], KEYBOARD_REPORT_SIZE);
+ }
+ }
+ }
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/src/hid_main.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/src/hid_main.c
new file mode 100644
index 0000000..7120f7f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/src/hid_main.c
@@ -0,0 +1,165 @@
+/*
+ * @brief This file contains USB HID Keyboard example using USB ROM Drivers.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include <stdio.h>
+#include <string.h>
+#include "app_usbd_cfg.h"
+#include "hid_keyboard.h"
+#include "ms_timer.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+static USBD_HANDLE_T g_hUsb;
+const USBD_API_T *g_pUsbApi;
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle interrupt from USB0
+ * @return Nothing
+ */
+void USB_IRQHandler(void)
+{
+ USBD_API->hw->ISR(g_hUsb);
+}
+
+/* Find the address of interface descriptor for given class type. */
+USB_INTERFACE_DESCRIPTOR *find_IntfDesc(const uint8_t *pDesc, uint32_t intfClass)
+{
+ USB_COMMON_DESCRIPTOR *pD;
+ USB_INTERFACE_DESCRIPTOR *pIntfDesc = 0;
+ uint32_t next_desc_adr;
+
+ pD = (USB_COMMON_DESCRIPTOR *) pDesc;
+ next_desc_adr = (uint32_t) pDesc;
+
+ while (pD->bLength) {
+ /* is it interface descriptor */
+ if (pD->bDescriptorType == USB_INTERFACE_DESCRIPTOR_TYPE) {
+
+ pIntfDesc = (USB_INTERFACE_DESCRIPTOR *) pD;
+ /* did we find the right interface descriptor */
+ if (pIntfDesc->bInterfaceClass == intfClass) {
+ break;
+ }
+ }
+ pIntfDesc = 0;
+ next_desc_adr = (uint32_t) pD + pD->bLength;
+ pD = (USB_COMMON_DESCRIPTOR *) next_desc_adr;
+ }
+
+ return pIntfDesc;
+}
+
+/**
+ * @brief main routine for example
+ * @return Function should not exit.
+ */
+int main(void)
+{
+ USBD_API_INIT_PARAM_T usb_param;
+ USB_CORE_DESCS_T desc;
+ ErrorCode_t ret = LPC_OK;
+
+ /* Initialize board and chip */
+ Board_Init();
+
+ /* Init millisecond timer tick driver */
+ systick_init();
+
+ /* enable clocks */
+ Chip_USB_Init();
+
+ /* initialize USBD ROM API pointer. */
+ g_pUsbApi = (const USBD_API_T *) LPC_ROM_API->pUSBD;
+
+ /* initialize call back structures */
+ memset((void *) &usb_param, 0, sizeof(USBD_API_INIT_PARAM_T));
+ usb_param.usb_reg_base = LPC_USB0_BASE;
+ /* WORKAROUND for artf44835 ROM driver BUG:
+ Code clearing STALL bits in endpoint reset routine corrupts memory area
+ next to the endpoint control data. For example When EP0, EP1_IN, EP1_OUT,
+ EP2_IN are used we need to specify 3 here. But as a workaround for this
+ issue specify 4. So that extra EPs control structure acts as padding buffer
+ to avoid data corruption. Corruption of padding memory doesn’t affect the
+ stack/program behaviour.
+ */
+ usb_param.max_num_ep = 2 + 1;
+ usb_param.mem_base = USB_STACK_MEM_BASE;
+ usb_param.mem_size = USB_STACK_MEM_SIZE;
+
+ /* Set the USB descriptors */
+ desc.device_desc = (uint8_t *) USB_DeviceDescriptor;
+ desc.string_desc = (uint8_t *) USB_StringDescriptor;
+
+ /* Note, to pass USBCV test full-speed only devices should have both
+ * descriptor arrays point to same location and device_qualifier set
+ * to 0.
+ */
+ desc.high_speed_desc = USB_FsConfigDescriptor;
+ desc.full_speed_desc = USB_FsConfigDescriptor;
+ desc.device_qualifier = 0;
+
+ /* USB Initialization */
+ ret = USBD_API->hw->Init(&g_hUsb, &desc, &usb_param);
+ if (ret == LPC_OK) {
+
+ ret = Keyboard_init(g_hUsb,
+ (USB_INTERFACE_DESCRIPTOR *) &USB_FsConfigDescriptor[sizeof(USB_CONFIGURATION_DESCRIPTOR)],
+ &usb_param.mem_base, &usb_param.mem_size);
+ if (ret == LPC_OK) {
+ /* enable USB interrupts */
+ NVIC_EnableIRQ(USB0_IRQn);
+ /* now connect */
+ USBD_API->hw->Connect(g_hUsb, 1);
+ }
+ }
+
+ while (1) {
+ /* Do Keyboard tasks */
+ Keyboard_Tasks();
+ /* Sleep until next IRQ happens */
+ __WFI();
+ }
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/src/ms_timer.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/src/ms_timer.c
new file mode 100644
index 0000000..2ec2653
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/src/ms_timer.c
@@ -0,0 +1,77 @@
+/*
+ * @brief This file contains Systick handler and millisecond timer routines.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+#include "board.h"
+#include "ms_timer.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+volatile uint32_t g_msTicks; /** counts 1ms timeTicks */
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief SysTick IRQ handler
+ * @return None.
+ */
+void SysTick_Handler(void)
+{
+ g_msTicks++; /* increment counter necessary in Delay() */
+}
+
+/**
+ * @brief Waits for given number of milliseconds
+ * @param n : Number of milliseconds
+ * @return Nothing
+ */
+void ms_timerDelay(uint32_t n)
+{
+ ms_timer_t timer;
+
+ ms_timerInit(&timer, n);
+
+ while (ms_timerExpired(&timer) == false) {
+ __NOP();
+ __WFI();/* conserve power */
+ }
+
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_keyboard/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/.cproject b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/.cproject
new file mode 100644
index 0000000..faa92d2
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/.cproject
@@ -0,0 +1,243 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.crt.advproject.config.exe.debug.151731095">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.debug.151731095" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Debug build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.debug.151731095" name="Debug" parent="com.crt.advproject.config.exe.debug" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.debug.151731095." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.debug.1799875339" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.debug.1256507156" name="ARM-based MCU (Debug)" superClass="com.crt.advproject.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/usbd_rom_hid_mouse}/Debug" id="com.crt.advproject.builder.exe.debug.1287374270" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
+ <tool id="com.crt.advproject.cpp.exe.debug.236018149" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.gcc.exe.debug.1400460922" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
+ <option id="com.crt.advproject.gcc.arch.1645356253" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.956379015" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1642713898" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="DEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.128265706" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1039020092" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.595557858" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/example/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc/usbd}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.488819335" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.debug.740304925" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
+ <option id="com.crt.advproject.gas.arch.1127522416" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.19866859" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.2144310579" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.1932669445" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1382998445" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1028544515" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.debug.2039549518" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
+ <tool id="com.crt.advproject.link.exe.debug.786701480" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
+ <option id="com.crt.advproject.link.arch.1978498247" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.1788276703" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.856593466" name="Linker script" superClass="com.crt.advproject.link.script" value=""usbd_rom_hid_mouse_Debug.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.597963014" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.1518614324" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.241337184" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.214391744" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.1856087657" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.574160189" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Debug}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Debug}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.653906628" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.crt.advproject.config.exe.release.578672617">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.crt.advproject.config.exe.release.578672617" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="Release build" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.config.exe.release.578672617" name="Release" parent="com.crt.advproject.config.exe.release" postannouncebuildStep="Performing post-build steps" postbuildStep="arm-none-eabi-size "${BuildArtifactFileName}"; # arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; # checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; ">
+ <folderInfo id="com.crt.advproject.config.exe.release.578672617." name="/" resourcePath="">
+ <toolChain id="com.crt.advproject.toolchain.exe.release.1883495661" name="Code Red MCU Tools" superClass="com.crt.advproject.toolchain.exe.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.GNU_ELF" id="com.crt.advproject.platform.exe.release.1568021864" name="ARM-based MCU (Release)" superClass="com.crt.advproject.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/usbd_rom_hid_mouse}/Release" id="com.crt.advproject.builder.exe.release.2076273789" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.release"/>
+ <tool id="com.crt.advproject.cpp.exe.release.2142724975" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.release"/>
+ <tool id="com.crt.advproject.gcc.exe.release.142786167" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.release">
+ <option id="com.crt.advproject.gcc.arch.679998368" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.thumb.1005569712" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.619938700" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="__REDLIB__"/>
+ <listOptionValue builtIn="false" value="NDEBUG"/>
+ <listOptionValue builtIn="false" value="__CODE_RED"/>
+ <listOptionValue builtIn="false" value="__USE_LPCOPEN"/>
+ <listOptionValue builtIn="false" value="CORE_M3"/>
+ </option>
+ <option id="gnu.c.compiler.option.misc.other.2065248569" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/>
+ <option id="com.crt.advproject.gcc.hdrlib.1607285789" superClass="com.crt.advproject.gcc.hdrlib" value="Redlib" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.include.paths.220173145" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/example/inc}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc/usbd}""/>
+ </option>
+ <inputType id="com.crt.advproject.compiler.input.129924800" superClass="com.crt.advproject.compiler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.gas.exe.release.664156232" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.release">
+ <option id="com.crt.advproject.gas.arch.521605026" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.thumb.1942917279" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
+ <option id="gnu.both.asm.option.flags.crt.552109816" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DNDEBUG -D__CODE_RED" valueType="string"/>
+ <option id="com.crt.advproject.gas.hdrlib.794505193" superClass="com.crt.advproject.gas.hdrlib" value="Redlib" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1560302960" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ <inputType id="com.crt.advproject.assembler.input.1576511126" name="Additional Assembly Source Files" superClass="com.crt.advproject.assembler.input"/>
+ </tool>
+ <tool id="com.crt.advproject.link.cpp.exe.release.1823911586" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.release"/>
+ <tool id="com.crt.advproject.link.exe.release.585954154" name="MCU Linker" superClass="com.crt.advproject.link.exe.release">
+ <option id="com.crt.advproject.link.arch.1235754312" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.thumb.2021638772" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
+ <option id="com.crt.advproject.link.script.1077512139" name="Linker script" superClass="com.crt.advproject.link.script" value=""usbd_rom_hid_mouse_Release.ld"" valueType="string"/>
+ <option id="com.crt.advproject.link.manage.598503776" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.nostdlibs.120783103" name="No startup or default libs (-nostdlib)" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
+ <option id="gnu.c.link.option.other.1718457269" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" valueType="stringList">
+ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/>
+ <listOptionValue builtIn="false" value="--gc-sections"/>
+ </option>
+ <option id="com.crt.advproject.link.gcc.hdrlib.61788840" name="Library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/>
+ <option id="gnu.c.link.option.libs.872262791" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="lpc_board_nxp_lpcxpresso_1549"/>
+ <listOptionValue builtIn="false" value="lpc_chip_15xx"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1760469545" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/Release}""/>
+ <listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_1549/Release}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1109299419" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="example"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="usbd_rom_hid_mouse.com.crt.advproject.projecttype.exe.1553288240" name="Executable" projectType="com.crt.advproject.projecttype.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="com.crt.config">
+ <projectStorage><?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_0="" property_2="LPC15xx_256K.cfx" property_3="NXP" property_4="LPC1549" property_count="5" version="60100"/>
+<infoList vendor="NXP">
+<info chip="LPC1549" connectscript="LPC15RunBootRomConnect.scp" flash_driver="LPC15xx_256K.cfx" match_id="0x0" name="LPC1549" resetscript="LPC15RunBootRomReset.scp" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC1549</name>
+<family>LPC15xx</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_16" location="0x2000000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram1_16" location="0x2004000" size="0x4000"/>
+<memoryInstance derived_from="RAM" id="Ram2_4" location="0x2008000" size="0x1000"/>
+<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/>
+<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/>
+<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/>
+<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/>
+<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x1c000000"/>
+<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x1c004000"/>
+<peripheralInstance derived_from="USB" determined="infoFile" id="USB" location="0x1c00c000"/>
+<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x1c010000"/>
+<peripheralInstance derived_from="SCT0" determined="infoFile" id="SCT0" location="0x1c018000"/>
+<peripheralInstance derived_from="SCT1" determined="infoFile" id="SCT1" location="0x1c01c000"/>
+<peripheralInstance derived_from="SCT2" determined="infoFile" id="SCT2" location="0x1c020000"/>
+<peripheralInstance derived_from="SCT3" determined="infoFile" id="SCT3" location="0x1c024000"/>
+<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x40000000"/>
+<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x40004000"/>
+<peripheralInstance derived_from="ACMP" determined="infoFile" id="ACMP" location="0x40008000"/>
+<peripheralInstance derived_from="INMUX" determined="infoFile" id="INMUX" location="0x40014000"/>
+<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40028000"/>
+<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x4002c000"/>
+<peripheralInstance derived_from="SWM" determined="infoFile" id="SWM" location="0x40038000"/>
+<peripheralInstance derived_from="PMU" determined="infoFile" id="PMU" location="0x4003c000"/>
+<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40040000"/>
+<peripheralInstance derived_from="USART1" determined="infoFile" id="USART1" location="0x40044000"/>
+<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x40048000"/>
+<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4004c000"/>
+<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40050000"/>
+<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x40058000"/>
+<peripheralInstance derived_from="SYSCON" determined="infoFile" id="SYSCON" location="0x40074000"/>
+<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40080000"/>
+<peripheralInstance derived_from="MRT" determined="infoFile" id="MRT" location="0x400a0000"/>
+<peripheralInstance derived_from="PINT" determined="infoFile" id="PINT" location="0x400a4000"/>
+<peripheralInstance derived_from="GINT0" determined="infoFile" id="GINT0" location="0x400a8000"/>
+<peripheralInstance derived_from="GINT1" determined="infoFile" id="GINT1" location="0x400ac000"/>
+<peripheralInstance derived_from="RIT" determined="infoFile" id="RIT" location="0x400b4000"/>
+<peripheralInstance derived_from="SCTIPU" determined="infoFile" id="SCTIPU" location="0x400b8000"/>
+<peripheralInstance derived_from="FLASHCTRL" determined="infoFile" id="FLASHCTRL" location="0x400bc000"/>
+<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c0000"/>
+<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400f0000"/>
+<peripheralInstance derived_from="IOCON" determined="infoFile" id="IOCON" location="0x400f8000"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m3">Cortex-M3</name>
+<family>Cortex-M</family>
+</processor>
+<link href="LPC15xx_peripheral.xme" show="embed" type="simple"/>
+</info>
+</infoList>
+</TargetConfig></projectStorage>
+ </storageModule>
+</cproject>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/.project b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/.project
new file mode 100644
index 0000000..e2496e7
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>usbd_rom_hid_mouse</name>
+ <comment></comment>
+ <projects>
+ <project>lpc_chip_15xx</project>
+ <project>lpc_board_nxp_lpcxpresso_1549</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/inc/app_usbd_cfg.h b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/inc/app_usbd_cfg.h
new file mode 100644
index 0000000..edc63a7
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/inc/app_usbd_cfg.h
@@ -0,0 +1,96 @@
+/*
+ * @brief Configuration file needed for USB ROM stack based applications.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+#include "lpc_types.h"
+#include "error.h"
+#include "usbd_rom_api.h"
+
+#ifndef __APP_USB_CFG_H_
+#define __APP_USB_CFG_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @ingroup EXAMPLES_USBDROM_15XX_HID_MOUSE
+ * @{
+ */
+
+/* HID In/Out Endpoint Address */
+#define HID_EP_IN 0x81
+#define HID_EP_OUT 0x01
+/** Interval between mouse reports expressed in milliseconds for full-speed device. */
+#define HID_MOUSE_REPORT_INTERVAL_MS 10
+/* bInterval value used in descriptor. For HS this macro will differ from HID_MOUSE_REPORT_INTERVAL_MS macro. */
+#define HID_MOUSE_REPORT_INTERVAL 10
+
+/* The following manifest constants are used to define this memory area to be used
+ by USBD ROM stack.
+ */
+#define USB_STACK_MEM_BASE 0x02008000
+#define USB_STACK_MEM_SIZE 0x1000
+
+/* Manifest constants used by USBD ROM stack. These values SHOULD NOT BE CHANGED
+ for advance features which require usage of USB_CORE_CTRL_T structure.
+ Since these are the values used for compiling USB stack.
+ */
+#define USB_MAX_IF_NUM 8 /*!< Max interface number used for building USBDL_Lib. DON'T CHANGE. */
+#define USB_MAX_EP_NUM 5 /*!< Max number of EP used for building USBD ROM. DON'T CHANGE. */
+#define USB_MAX_PACKET0 64 /*!< Max EP0 packet size used for building USBD ROM. DON'T CHANGE. */
+#define USB_FS_MAX_BULK_PACKET 64 /*!< MAXP for FS bulk EPs used for building USBD ROM. DON'T CHANGE. */
+#define USB_HS_MAX_BULK_PACKET 512 /*!< MAXP for HS bulk EPs used for building USBD ROM. DON'T CHANGE. */
+#define USB_DFU_XFER_SIZE 2048 /*!< Max DFU transfer size used for building USBD ROM. DON'T CHANGE. */
+
+/* USB descriptor arrays defined *_desc.c file */
+extern const uint8_t USB_DeviceDescriptor[];
+extern uint8_t USB_HsConfigDescriptor[];
+extern uint8_t USB_FsConfigDescriptor[];
+extern const uint8_t USB_StringDescriptor[];
+extern const uint8_t USB_DeviceQualifier[];
+
+/**
+ * @brief Find the address of interface descriptor for given class type.
+ * @param pDesc : Pointer to configuration descriptor in which the desired class
+ * interface descriptor to be found.
+ * @param intfClass : Interface class type to be searched.
+ * @return If found returns the address of requested interface else returns NULL.
+ */
+extern USB_INTERFACE_DESCRIPTOR *find_IntfDesc(const uint8_t *pDesc, uint32_t intfClass);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __APP_USB_CFG_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/inc/hid_mouse.h b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/inc/hid_mouse.h
new file mode 100644
index 0000000..6a96ce8
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/inc/hid_mouse.h
@@ -0,0 +1,77 @@
+/*
+ * @brief This file contains USB HID Mouse example using USBD ROM stack.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#ifndef __HID_MOUSE_H_
+#define __HID_MOUSE_H_
+
+#include "app_usbd_cfg.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @ingroup EXAMPLES_USBDROM_15XX_HID_MOUSE
+ * @{
+ */
+
+#define MOUSE_REPORT_SIZE 3
+#define CLEAR_HID_MOUSE_REPORT(x) memset(x, 0, MOUSE_REPORT_SIZE);
+
+/**
+ * @brief HID mouse interface init routine.
+ * @param hUsb : Handle to USB device stack
+ * @param pIntfDesc : Pointer to HID interface descriptor
+ * @param mem_base : Pointer to memory address which can be used by HID driver
+ * @param mem_size : Size of the memory passed
+ * @return On success returns LPC_OK. Params mem_base and mem_size are updated
+ * to point to new base and available size.
+ */
+extern ErrorCode_t Mouse_Init(USBD_HANDLE_T hUsb,
+ USB_INTERFACE_DESCRIPTOR *pIntfDesc,
+ uint32_t *mem_base,
+ uint32_t *mem_size);
+
+/**
+ * @brief Mouse tasks.
+ * @return On success returns LPC_OK.
+ */
+extern void Mouse_Tasks(void);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __HID_MOUSE_H_ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/readme.dox b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/readme.dox
new file mode 100644
index 0000000..3e00f5f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/readme.dox
@@ -0,0 +1,57 @@
+/*
+ * @brief This file contains USB HID Mouse example using USB ROM Drivers.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+/** @defgroup EXAMPLES_USBDROM_15XX_HID_MOUSE LPC15XX Mouse example
+ * @ingroup EXAMPLES_USBDROM_15XX
+ * <b>Example description</b><br>
+ * The example shows how to us USBD ROM stack to creates a HID mouse.
+ * <br>
+ *
+ * <b>Special connection requirements</b><br>
+ * The tiny joystick that is surface mounted on the eval board moves the mouse.
+ * Pressing the joystick in causes a left mouse click to happening over USB.
+ * For most OSs, no drivers are needed.<br>
+ *
+ * <b>Build procedures:</b><br>
+ * Visit the <a href="http://www.lpcware.com/content/project/lpcopen-platform-nxp-lpc-microcontrollers/lpcopen-v200-quickstart-guides">LPCOpen quickstart guides</a>
+ * to get started building LPCOpen projects.
+ *
+ * <b>Supported boards and board setup:</b><br>
+ * @ref LPCOPEN_15XX_BOARD_LPCXPRESSO_1549<br>
+ *
+ * <b>Submitting LPCOpen issues:</b><br>
+ * @ref LPCOPEN_COMMUNITY
+ * @{
+ */
+
+/**
+ * @}
+ */
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/src/cr_startup_lpc15xx.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/src/cr_startup_lpc15xx.c
new file mode 100644
index 0000000..148961f
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/src/cr_startup_lpc15xx.c
@@ -0,0 +1,392 @@
+//*****************************************************************************
+// LPC15xx Microcontroller Startup code for use with LPCXpresso IDE
+//
+// Version : 140114
+//*****************************************************************************
+//
+// Copyright(C) NXP Semiconductors, 2014
+// All rights reserved.
+//
+// Software that is described herein is for illustrative purposes only
+// which provides customers with programming information regarding the
+// LPC products. This software is supplied "AS IS" without any warranties of
+// any kind, and NXP Semiconductors and its licensor disclaim any and
+// all warranties, express or implied, including all implied warranties of
+// merchantability, fitness for a particular purpose and non-infringement of
+// intellectual property rights. NXP Semiconductors assumes no responsibility
+// or liability for the use of the software, conveys no license or rights under any
+// patent, copyright, mask work right, or any other intellectual property rights in
+// or to any products. NXP Semiconductors reserves the right to make changes
+// in the software without notification. NXP Semiconductors also makes no
+// representation or warranty that such application will be suitable for the
+// specified use without further testing or modification.
+//
+// Permission to use, copy, modify, and distribute this software and its
+// documentation is hereby granted, under NXP Semiconductors' and its
+// licensor's relevant copyrights in the software, without fee, provided that it
+// is used in conjunction with NXP Semiconductors microcontrollers. This
+// copyright, permission, and disclaimer notice must appear in all copies of
+// this code.
+//*****************************************************************************
+
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+// Declaration of external SystemInit function
+extern void SystemInit(void);
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void MemManage_Handler(void);
+WEAK void BusFault_Handler(void);
+WEAK void UsageFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void DebugMon_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void EEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SCT3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void MRT_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void SPI1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler(void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC0_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1A_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1B_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_THCMP_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ADC1_OVR_IRQHandler(void) ALIAS(IntDefaultHandler);
+void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP0_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP1_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP2_IRQHandler(void) ALIAS(IntDefaultHandler);
+void ACMP3_IRQHandler(void) ALIAS(IntDefaultHandler);
+void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_ALARM_IRQHandler(void) ALIAS(IntDefaultHandler);
+void RTC_WAKE_IRQHandler(void) ALIAS(IntDefaultHandler);
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+//*****************************************************************************
+//
+// The vector table.
+// This relies on the linker script to place at correct location in memory.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector")))
+void (* const g_pfnVectors[])(void) = {
+ // Core Level - CM3
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ MemManage_Handler, // The MPU fault handler
+ BusFault_Handler, // The bus fault handler
+ UsageFault_Handler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ DebugMon_Handler, // Debug monitor handler
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+ // Chip Level - LPC15xx
+ WDT_IRQHandler, // 0 - Windowed watchdog timer
+ BOD_IRQHandler, // 1 - BOD
+ FMC_IRQHandler, // 2 - Flash controller
+ EEPROM_IRQHandler, // 3 - EEPROM controller
+ DMA_IRQHandler, // 4 - DMA
+ GINT0_IRQHandler, // 5 - GINT0
+ GINT1_IRQHandler, // 6 - GINT1
+ PIN_INT0_IRQHandler, // 7 - PIO INT0
+ PIN_INT1_IRQHandler, // 8 - PIO INT1
+ PIN_INT2_IRQHandler, // 9 - PIO INT2
+ PIN_INT3_IRQHandler, // 10 - PIO INT3
+ PIN_INT4_IRQHandler, // 11 - PIO INT4
+ PIN_INT5_IRQHandler, // 12 - PIO INT5
+ PIN_INT6_IRQHandler, // 13 - PIO INT6
+ PIN_INT7_IRQHandler, // 14 - PIO INT7
+ RIT_IRQHandler, // 15 - RIT
+ SCT0_IRQHandler, // 16 - State configurable timer
+ SCT1_IRQHandler, // 17 - State configurable timer
+ SCT2_IRQHandler, // 18 - State configurable timer
+ SCT3_IRQHandler, // 19 - State configurable timer
+ MRT_IRQHandler, // 20 - Multi-Rate Timer
+ UART0_IRQHandler, // 21 - UART0
+ UART1_IRQHandler, // 22 - UART1
+ UART2_IRQHandler, // 23 - UART2
+ I2C0_IRQHandler, // 24 - I2C0 controller
+ SPI0_IRQHandler, // 25 - SPI0 controller
+ SPI1_IRQHandler, // 26 - SPI1 controller
+ CAN_IRQHandler, // 27 - C_CAN0
+ USB_IRQHandler, // 28 - USB IRQ
+ USB_FIQHandler, // 29 - USB FIQ
+ USBWakeup_IRQHandler, // 30 - USB wake-up
+ ADC0A_IRQHandler, // 31 - ADC0 sequence A completion
+ ADC0B_IRQHandler, // 32 - ADC0 sequence B completion
+ ADC0_THCMP_IRQHandler, // 33 - ADC0 threshold compare
+ ADC0_OVR_IRQHandler, // 34 - ADC0 overrun
+ ADC1A_IRQHandler, // 35 - ADC1 sequence A completion
+ ADC1B_IRQHandler, // 36 - ADC1 sequence B completion
+ ADC1_THCMP_IRQHandler, // 37 - ADC1 threshold compare
+ ADC1_OVR_IRQHandler, // 38 - ADC1 overrun
+ DAC_IRQHandler, // 39 - DAC
+ ACMP0_IRQHandler, // 40 - Analog Comparator 0
+ ACMP1_IRQHandler, // 41 - Analog Comparator 1
+ ACMP2_IRQHandler, // 42 - Analog Comparator 2
+ ACMP3_IRQHandler, // 43 - Analog Comparator 3
+ QEI_IRQHandler, // 44 - QEI
+ RTC_ALARM_IRQHandler, // 45 - RTC alarm
+ RTC_WAKE_IRQHandler, // 46 - RTC wake-up
+
+}; /* End of g_pfnVectors */
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
+
+
+
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/src/hid_desc.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/src/hid_desc.c
new file mode 100644
index 0000000..db84309
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/src/hid_desc.c
@@ -0,0 +1,218 @@
+/*
+ * @brief This file contains USB HID Mouse example using USB ROM Drivers.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "app_usbd_cfg.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/**
+ * HID Mouse Report Descriptor
+ */
+const uint8_t Mouse_ReportDescriptor[] = {
+ HID_UsagePage(HID_USAGE_PAGE_GENERIC),
+ HID_Usage(HID_USAGE_GENERIC_MOUSE),
+ HID_Collection(HID_Application),
+ HID_Usage(HID_USAGE_GENERIC_POINTER),
+ HID_Collection(HID_Physical),
+ HID_UsagePage(HID_USAGE_PAGE_BUTTON),
+ HID_UsageMin(1),
+ HID_UsageMax(3),
+ HID_LogicalMin(0),
+ HID_LogicalMax(1),
+ HID_ReportCount(3),
+ HID_ReportSize(1),
+ HID_Input(HID_Data | HID_Variable | HID_Absolute),
+ HID_ReportCount(1),
+ HID_ReportSize(5),
+ HID_Input(HID_Constant),
+ HID_UsagePage(HID_USAGE_PAGE_GENERIC),
+ HID_Usage(HID_USAGE_GENERIC_X),
+ HID_Usage(HID_USAGE_GENERIC_Y),
+ HID_LogicalMin( (uint8_t) -127),
+ HID_LogicalMax(127),
+ HID_ReportSize(8),
+ HID_ReportCount(2),
+ HID_Input(HID_Data | HID_Variable | HID_Relative),
+ HID_EndCollection,
+ HID_EndCollection,
+};
+const uint16_t Mouse_ReportDescSize = sizeof(Mouse_ReportDescriptor);
+
+/**
+ * USB Standard Device Descriptor
+ */
+ALIGNED(4) const uint8_t USB_DeviceDescriptor[] = {
+ USB_DEVICE_DESC_SIZE, /* bLength */
+ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL(0x0200), /* bcdUSB : 2.00*/
+ 0x00, /* bDeviceClass */
+ 0x00, /* bDeviceSubClass */
+ 0x00, /* bDeviceProtocol */
+ USB_MAX_PACKET0, /* bMaxPacketSize0 */
+ WBVAL(0x1FC9), /* idVendor */
+ WBVAL(0x0085), /* idProduct */
+ WBVAL(0x0100), /* bcdDevice : 1.00 */
+ 0x01, /* iManufacturer */
+ 0x02, /* iProduct */
+ 0x03, /* iSerialNumber */
+ 0x01 /* bNumConfigurations */
+};
+
+/**
+ * USB FSConfiguration Descriptor
+ * All Descriptors (Configuration, Interface, Endpoint, Class, Vendor)
+ */
+ALIGNED(4) uint8_t USB_FsConfigDescriptor[] = {
+ /* Configuration 1 */
+ USB_CONFIGURATION_DESC_SIZE, /* bLength */
+ USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL( /* wTotalLength */
+ USB_CONFIGURATION_DESC_SIZE +
+ USB_INTERFACE_DESC_SIZE +
+ HID_DESC_SIZE +
+ USB_ENDPOINT_DESC_SIZE
+ ),
+ 0x01, /* bNumInterfaces */
+ 0x01, /* bConfigurationValue */
+ 0x00, /* iConfiguration */
+ USB_CONFIG_SELF_POWERED, /* bmAttributes */
+ USB_CONFIG_POWER_MA(2), /* bMaxPower */
+
+ /* Interface 0, Alternate Setting 0, HID Class */
+ USB_INTERFACE_DESC_SIZE, /* bLength */
+ USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 0x00, /* bInterfaceNumber */
+ 0x00, /* bAlternateSetting */
+ 0x01, /* bNumEndpoints */
+ USB_DEVICE_CLASS_HUMAN_INTERFACE, /* bInterfaceClass */
+ HID_SUBCLASS_BOOT, /* bInterfaceSubClass */
+ HID_PROTOCOL_MOUSE, /* bInterfaceProtocol */
+ 0x04, /* iInterface */
+ /* HID Class Descriptor */
+ /* HID_DESC_OFFSET = 0x0012 */
+ HID_DESC_SIZE, /* bLength */
+ HID_HID_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL(0x0111), /* bcdHID : 1.11*/
+ 0x00, /* bCountryCode */
+ 0x01, /* bNumDescriptors */
+ HID_REPORT_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL(sizeof(Mouse_ReportDescriptor)), /* wDescriptorLength */
+ /* Endpoint, HID Interrupt In */
+ USB_ENDPOINT_DESC_SIZE, /* bLength */
+ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
+ HID_EP_IN, /* bEndpointAddress */
+ USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */
+ WBVAL(0x0008), /* wMaxPacketSize */
+ HID_MOUSE_REPORT_INTERVAL, /* bInterval */
+ /* Terminator */
+ 0 /* bLength */
+};
+
+/**
+ * USB String Descriptor (optional)
+ */
+const uint8_t USB_StringDescriptor[] = {
+ /* Index 0x00: LANGID Codes */
+ 0x04, /* bLength */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ WBVAL(0x0409), /* wLANGID : US English */
+ /* Index 0x01: Manufacturer */
+ (18 * 2 + 2), /* bLength (18 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'N', 0,
+ 'X', 0,
+ 'P', 0,
+ ' ', 0,
+ 'S', 0,
+ 'e', 0,
+ 'm', 0,
+ 'i', 0,
+ 'c', 0,
+ 'o', 0,
+ 'n', 0,
+ 'd', 0,
+ 'u', 0,
+ 'c', 0,
+ 't', 0,
+ 'o', 0,
+ 'r', 0,
+ 's', 0,
+ /* Index 0x02: Product */
+ (13 * 2 + 2), /* bLength (13 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'L', 0,
+ 'P', 0,
+ 'C', 0,
+ '1', 0,
+ '5', 0,
+ 'x', 0,
+ 'x', 0,
+ ' ', 0,
+ 'M', 0,
+ 'O', 0,
+ 'U', 0,
+ 'S', 0,
+ 'E', 0,
+ /* Index 0x03: Serial Number */
+ (13 * 2 + 2), /* bLength (13 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'A', 0,
+ 'B', 0,
+ 'C', 0,
+ 'D', 0,
+ '1', 0,
+ '2', 0,
+ '3', 0,
+ '4', 0,
+ '5', 0,
+ '6', 0,
+ '7', 0,
+ '8', 0,
+ '9', 0,
+ /* Index 0x04: Interface 0, Alternate Setting 0 */
+ (9 * 2 + 2), /* bLength (9 Char + Type + lenght) */
+ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'H', 0,
+ 'I', 0,
+ 'D', 0,
+ ' ', 0,
+ 'M', 0,
+ 'O', 0,
+ 'U', 0,
+ 'S', 0,
+ 'E', 0,
+};
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/src/hid_main.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/src/hid_main.c
new file mode 100644
index 0000000..5f32986
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/src/hid_main.c
@@ -0,0 +1,162 @@
+/*
+ * @brief This file contains USB HID Mouse example using USB ROM Drivers.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include <stdio.h>
+#include <string.h>
+#include "app_usbd_cfg.h"
+#include "hid_mouse.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+static USBD_HANDLE_T g_hUsb;
+const USBD_API_T *g_pUsbApi;
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/**
+ * @brief Handle interrupt from USB0
+ * @return Nothing
+ */
+void USB_IRQHandler(void)
+{
+ USBD_API->hw->ISR(g_hUsb);
+}
+
+/* Find the address of interface descriptor for given class type. */
+USB_INTERFACE_DESCRIPTOR *find_IntfDesc(const uint8_t *pDesc, uint32_t intfClass)
+{
+ USB_COMMON_DESCRIPTOR *pD;
+ USB_INTERFACE_DESCRIPTOR *pIntfDesc = 0;
+ uint32_t next_desc_adr;
+
+ pD = (USB_COMMON_DESCRIPTOR *) pDesc;
+ next_desc_adr = (uint32_t) pDesc;
+
+ while (pD->bLength) {
+ /* is it interface descriptor */
+ if (pD->bDescriptorType == USB_INTERFACE_DESCRIPTOR_TYPE) {
+
+ pIntfDesc = (USB_INTERFACE_DESCRIPTOR *) pD;
+ /* did we find the right interface descriptor */
+ if (pIntfDesc->bInterfaceClass == intfClass) {
+ break;
+ }
+ }
+ pIntfDesc = 0;
+ next_desc_adr = (uint32_t) pD + pD->bLength;
+ pD = (USB_COMMON_DESCRIPTOR *) next_desc_adr;
+ }
+
+ return pIntfDesc;
+}
+
+/**
+ * @brief main routine for blinky example
+ * @return Function should not exit.
+ */
+int main(void)
+{
+ USBD_API_INIT_PARAM_T usb_param;
+ USB_CORE_DESCS_T desc;
+ ErrorCode_t ret = LPC_OK;
+
+ /* Initialize board and chip */
+ Board_Init();
+
+ /* enable clocks */
+ Chip_USB_Init();
+
+ /* initialize USBD ROM API pointer. */
+ g_pUsbApi = (const USBD_API_T *) LPC_ROM_API->pUSBD;
+
+ /* initialize call back structures */
+ memset((void *) &usb_param, 0, sizeof(USBD_API_INIT_PARAM_T));
+ usb_param.usb_reg_base = LPC_USB0_BASE;
+ /* WORKAROUND for artf44835 ROM driver BUG:
+ Code clearing STALL bits in endpoint reset routine corrupts memory area
+ next to the endpoint control data. For example When EP0, EP1_IN, EP1_OUT,
+ EP2_IN are used we need to specify 3 here. But as a workaround for this
+ issue specify 4. So that extra EPs control structure acts as padding buffer
+ to avoid data corruption. Corruption of padding memory doesn’t affect the
+ stack/program behaviour.
+ */
+ usb_param.max_num_ep = 2 + 1;
+ usb_param.mem_base = USB_STACK_MEM_BASE;
+ usb_param.mem_size = USB_STACK_MEM_SIZE;
+
+ /* Set the USB descriptors */
+ desc.device_desc = (uint8_t *) USB_DeviceDescriptor;
+ desc.string_desc = (uint8_t *) USB_StringDescriptor;
+
+ /* Note, to pass USBCV test full-speed only devices should have both
+ * descriptor arrays point to same location and device_qualifier set
+ * to 0.
+ */
+ desc.high_speed_desc = USB_FsConfigDescriptor;
+ desc.full_speed_desc = USB_FsConfigDescriptor;
+ desc.device_qualifier = 0;
+
+ /* USB Initialization */
+ ret = USBD_API->hw->Init(&g_hUsb, &desc, &usb_param);
+ if (ret == LPC_OK) {
+
+ ret = Mouse_Init(g_hUsb,
+ (USB_INTERFACE_DESCRIPTOR *) &USB_FsConfigDescriptor[sizeof(USB_CONFIGURATION_DESCRIPTOR)],
+ &usb_param.mem_base, &usb_param.mem_size);
+ if (ret == LPC_OK) {
+ /* enable USB interrupts */
+ NVIC_EnableIRQ(USB0_IRQn);
+ /* now connect */
+ USBD_API->hw->Connect(g_hUsb, 1);
+ }
+ }
+
+ while (1) {
+ /* Do Mouse tasks */
+ Mouse_Tasks();
+ /* Sleep until next IRQ happens */
+ __WFI();
+ }
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/src/hid_mouse.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/src/hid_mouse.c
new file mode 100644
index 0000000..40594f7
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/src/hid_mouse.c
@@ -0,0 +1,226 @@
+/*
+ * @brief This file contains USB HID Mouse example using USB ROM Drivers.
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+#include "board.h"
+#include <stdint.h>
+#include <string.h>
+#include "usbd_rom_api.h"
+#include "hid_mouse.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/**
+ * @brief Structure to hold mouse data
+ */
+typedef struct {
+ USBD_HANDLE_T hUsb; /*!< Handle to USB stack. */
+ uint8_t report[MOUSE_REPORT_SIZE]; /*!< Last report data */
+ uint8_t tx_busy; /*!< Flag indicating whether a report is pending in endpoint queue. */
+} Mouse_Ctrl_T;
+
+/** Singleton instance of mouse control */
+static Mouse_Ctrl_T g_mouse;
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+extern const uint8_t Mouse_ReportDescriptor[];
+extern const uint16_t Mouse_ReportDescSize;
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+static void setXYMouseReport(uint8_t *rep, int8_t xVal, int8_t yVal)
+{
+ rep[1] = (uint8_t) xVal;
+ rep[2] = (uint8_t) yVal;
+}
+
+static void setLeftButtonMouseReport(uint8_t *rep, uint8_t state)
+{
+ if (state) {
+ rep[0] |= 0x01;
+ }
+ else {
+ rep[0] &= ~0x01;
+ }
+}
+
+/* Routine to update mouse state report */
+static void Mouse_UpdateReport(void)
+{
+ uint8_t joystick_status = Joystick_GetStatus();
+ CLEAR_HID_MOUSE_REPORT(&g_mouse.report[0]);
+
+ switch (joystick_status) {
+ case JOY_PRESS:
+ setLeftButtonMouseReport(g_mouse.report, 1);
+ break;
+
+ case JOY_LEFT:
+ setXYMouseReport(g_mouse.report, -4, 0);
+ break;
+
+ case JOY_RIGHT:
+ setXYMouseReport(g_mouse.report, 4, 0);
+ break;
+
+ case JOY_UP:
+ setXYMouseReport(g_mouse.report, 0, -4);
+ break;
+
+ case JOY_DOWN:
+ setXYMouseReport(g_mouse.report, 0, 4);
+ break;
+ }
+}
+
+/* HID Get Report Request Callback. Called automatically on HID Get Report Request */
+static ErrorCode_t Mouse_GetReport(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t * *pBuffer, uint16_t *plength)
+{
+ /* ReportID = SetupPacket.wValue.WB.L; */
+ switch (pSetup->wValue.WB.H) {
+ case HID_REPORT_INPUT:
+ Mouse_UpdateReport();
+ *pBuffer = &g_mouse.report[0];
+ *plength = MOUSE_REPORT_SIZE;
+ break;
+
+ case HID_REPORT_OUTPUT: /* Not Supported */
+ case HID_REPORT_FEATURE: /* Not Supported */
+ return ERR_USBD_STALL;
+ }
+ return LPC_OK;
+}
+
+/* HID Set Report Request Callback. Called automatically on HID Set Report Request */
+static ErrorCode_t Mouse_SetReport(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t * *pBuffer, uint16_t length)
+{
+ /* we will reuse standard EP0Buf */
+ if (length == 0) {
+ return LPC_OK;
+ }
+ /* ReportID = SetupPacket.wValue.WB.L; */
+ switch (pSetup->wValue.WB.H) {
+ case HID_REPORT_INPUT: /* Not Supported */
+ case HID_REPORT_OUTPUT: /* Not Supported */
+ case HID_REPORT_FEATURE: /* Not Supported */
+ return ERR_USBD_STALL;
+ }
+ return LPC_OK;
+}
+
+/* HID interrupt IN endpoint handler */
+static ErrorCode_t Mouse_EpIN_Hdlr(USBD_HANDLE_T hUsb, void *data, uint32_t event)
+{
+ switch (event) {
+ case USB_EVT_IN:
+ /* USB_EVT_IN occurs when HW completes sending IN packet. So clear the
+ busy flag for main loop to queue next packet.
+ */
+ g_mouse.tx_busy = 0;
+ break;
+ }
+ return LPC_OK;
+}
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* HID mouse interface init routine */
+ErrorCode_t Mouse_Init(USBD_HANDLE_T hUsb,
+ USB_INTERFACE_DESCRIPTOR *pIntfDesc,
+ uint32_t *mem_base,
+ uint32_t *mem_size)
+{
+ USBD_HID_INIT_PARAM_T hid_param;
+ USB_HID_REPORT_T reports_data[1];
+ ErrorCode_t ret = LPC_OK;
+
+ /* Do a quick check of if the interface descriptor passed is the right one. */
+ if ((pIntfDesc == 0) || (pIntfDesc->bInterfaceClass != USB_DEVICE_CLASS_HUMAN_INTERFACE)) {
+ return ERR_FAILED;
+ }
+
+ /* init joystick control */
+ Board_Joystick_Init();
+
+ /* Init HID params */
+ memset((void *) &hid_param, 0, sizeof(USBD_HID_INIT_PARAM_T));
+ hid_param.max_reports = 1;
+ hid_param.mem_base = *mem_base;
+ hid_param.mem_size = *mem_size;
+ hid_param.intf_desc = (uint8_t *) pIntfDesc;
+ /* user defined functions */
+ hid_param.HID_GetReport = Mouse_GetReport;
+ hid_param.HID_SetReport = Mouse_SetReport;
+ hid_param.HID_EpIn_Hdlr = Mouse_EpIN_Hdlr;
+ /* Init reports_data */
+ reports_data[0].len = Mouse_ReportDescSize;
+ reports_data[0].idle_time = 0;
+ reports_data[0].desc = (uint8_t *) &Mouse_ReportDescriptor[0];
+ hid_param.report_data = reports_data;
+
+ ret = USBD_API->hid->init(hUsb, &hid_param);
+
+ /* update memory variables */
+ *mem_base = hid_param.mem_base;
+ *mem_size = hid_param.mem_size;
+ /* store stack handle for later use. */
+ g_mouse.hUsb = hUsb;
+
+ return ret;
+}
+
+/* Mouse tasks */
+void Mouse_Tasks(void)
+{
+ /* check device is configured before sending report. */
+ if ( USB_IsConfigured(g_mouse.hUsb)) {
+ if (g_mouse.tx_busy == 0) {
+ /* update report based on board state */
+ Mouse_UpdateReport();
+ /* send report data */
+ g_mouse.tx_busy = 1;
+ USBD_API->hw->WriteEP(g_mouse.hUsb, HID_EP_IN, &g_mouse.report[0], MOUSE_REPORT_SIZE);
+ }
+ }
+ else {
+ /* reset busy flag if we get disconnected. */
+ g_mouse.tx_busy = 0;
+ }
+
+}
diff --git a/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/src/sysinit.c b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/src/sysinit.c
new file mode 100644
index 0000000..de25833
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/lpcopen/usbd_rom_hid_mouse/example/src/sysinit.c
@@ -0,0 +1,60 @@
+/*
+ * @brief Common SystemInit function for LPC15xx chips
+ *
+ * @note
+ * Copyright(C) NXP Semiconductors, 2013
+ * All rights reserved.
+ *
+ * @par
+ * Software that is described herein is for illustrative purposes only
+ * which provides customers with programming information regarding the
+ * LPC products. This software is supplied "AS IS" without any warranties of
+ * any kind, and NXP Semiconductors and its licensor disclaim any and
+ * all warranties, express or implied, including all implied warranties of
+ * merchantability, fitness for a particular purpose and non-infringement of
+ * intellectual property rights. NXP Semiconductors assumes no responsibility
+ * or liability for the use of the software, conveys no license or rights under any
+ * patent, copyright, mask work right, or any other intellectual property rights in
+ * or to any products. NXP Semiconductors reserves the right to make changes
+ * in the software without notification. NXP Semiconductors also makes no
+ * representation or warranty that such application will be suitable for the
+ * specified use without further testing or modification.
+ *
+ * @par
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, under NXP Semiconductors' and its
+ * licensor's relevant copyrights in the software, without fee, provided that it
+ * is used in conjunction with NXP Semiconductors microcontrollers. This
+ * copyright, permission, and disclaimer notice must appear in all copies of
+ * this code.
+ */
+
+ #include "board.h"
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public types/enumerations/variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Private functions
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Public functions
+ ****************************************************************************/
+
+/* Set up and initialize hardware prior to call to main */
+void SystemInit(void)
+{
+#if defined(NO_BOARD_LIB)
+ /* Chip specific SystemInit */
+ Chip_SystemInit();
+#else
+ /* Board specific SystemInit */
+ Board_SystemInit();
+#endif
+}
diff --git a/src/bsp/lk/platform/lpc15xx/rules.mk b/src/bsp/lk/platform/lpc15xx/rules.mk
new file mode 100644
index 0000000..b17d5ce
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/rules.mk
@@ -0,0 +1,66 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+# ROMBASE, MEMBASE, and MEMSIZE are required for the linker script
+
+ARCH := arm
+
+ifeq ($(LPC_CHIP),LPC1549)
+MEMSIZE ?= 36864
+MEMBASE := 0x02000000
+ROMBASE := 0x00000000
+ARM_CPU := cortex-m3
+endif
+
+MODULE_DEFINES += PART_$(LPC_CHIP)
+
+ifeq ($(MEMSIZE),)
+$(error need to define MEMSIZE)
+endif
+
+MODULE_SRCS += \
+ $(LOCAL_DIR)/init.c \
+ $(LOCAL_DIR)/debug.c \
+ $(LOCAL_DIR)/vectab.c \
+
+# $(LOCAL_DIR)/gpio.c \
+ $(LOCAL_DIR)/usbc.c \
+
+
+# $(LOCAL_DIR)/debug.c \
+ $(LOCAL_DIR)/interrupts.c \
+ $(LOCAL_DIR)/platform_early.c \
+ $(LOCAL_DIR)/platform.c \
+ $(LOCAL_DIR)/timer.c \
+ $(LOCAL_DIR)/init_clock.c \
+ $(LOCAL_DIR)/init_clock_48mhz.c \
+ $(LOCAL_DIR)/mux.c \
+ $(LOCAL_DIR)/emac_dev.c
+
+# use a two segment memory layout, where all of the read-only sections
+# of the binary reside in rom, and the read/write are in memory. The
+# ROMBASE, MEMBASE, and MEMSIZE make variables are required to be set
+# for the linker script to be generated properly.
+#
+LINKER_SCRIPT += \
+ $(BUILDDIR)/system-twosegment.ld
+
+MODULE_DEPS += \
+ arch/arm/arm-m/systick \
+ platform/lpc15xx/lpcopen \
+ lib/cbuf
+
+LPCSIGNEDBIN := $(OUTBIN).sign
+LPCCHECK := $(LOCAL_DIR)/lpccheck.py
+EXTRA_BUILDDEPS += $(LPCSIGNEDBIN)
+GENERATED += $(LPCSIGNEDBIN)
+
+$(LPCSIGNEDBIN): $(OUTBIN) $(LPCCHECK)
+ @$(MKDIR)
+ $(NOECHO)echo generating $@; \
+ cp $< $@.tmp; \
+ $(LPCCHECK) $@.tmp; \
+ mv $@.tmp $@
+
+include make/module.mk
diff --git a/src/bsp/lk/platform/lpc15xx/vectab.c b/src/bsp/lk/platform/lpc15xx/vectab.c
new file mode 100644
index 0000000..70c5b90
--- /dev/null
+++ b/src/bsp/lk/platform/lpc15xx/vectab.c
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2013-2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <debug.h>
+#include <compiler.h>
+#include <arch/arm/cm.h>
+
+ /* from cmsis.h */
+#if 0
+ WDT_IRQn = 0, /*!< Watchdog timer Interrupt */
+ WWDT_IRQn = WDT_IRQn, /*!< Watchdog timer Interrupt alias for WDT_IRQn */
+ BOD_IRQn = 1, /*!< Brown Out Detect(BOD) Interrupt */
+ FMC_IRQn = 2, /*!< FLASH Interrupt */
+ FLASHEEPROM_IRQn = 3, /*!< EEPROM controller interrupt */
+ DMA_IRQn = 4, /*!< DMA Interrupt */
+ GINT0_IRQn = 5, /*!< GPIO group 0 Interrupt */
+ GINT1_IRQn = 6, /*!< GPIO group 1 Interrupt */
+ PIN_INT0_IRQn = 7, /*!< Pin Interrupt 0 */
+ PIN_INT1_IRQn = 8, /*!< Pin Interrupt 1 */
+ PIN_INT2_IRQn = 9, /*!< Pin Interrupt 2 */
+ PIN_INT3_IRQn = 10, /*!< Pin Interrupt 3 */
+ PIN_INT4_IRQn = 11, /*!< Pin Interrupt 4 */
+ PIN_INT5_IRQn = 12, /*!< Pin Interrupt 5 */
+ PIN_INT6_IRQn = 13, /*!< Pin Interrupt 6 */
+ PIN_INT7_IRQn = 14, /*!< Pin Interrupt 7 */
+ RITIMER_IRQn = 15, /*!< RITIMER interrupt */
+ SCT0_IRQn = 16, /*!< SCT0 interrupt */
+ SCT_IRQn = SCT0_IRQn, /*!< Optional alias for SCT0_IRQn */
+ SCT1_IRQn = 17, /*!< SCT1 interrupt */
+ SCT2_IRQn = 18, /*!< SCT2 interrupt */
+ SCT3_IRQn = 19, /*!< SCT3 interrupt */
+ MRT_IRQn = 20, /*!< MRT interrupt */
+ UART0_IRQn = 21, /*!< UART0 Interrupt */
+ UART1_IRQn = 22, /*!< UART1 Interrupt */
+ UART2_IRQn = 23, /*!< UART2 Interrupt */
+ I2C0_IRQn = 24, /*!< I2C0 Interrupt */
+ I2C_IRQn = I2C0_IRQn, /*!< Optional alias for I2C0_IRQn */
+ SPI0_IRQn = 25, /*!< SPI0 Interrupt */
+ SPI1_IRQn = 26, /*!< SPI1 Interrupt */
+ CAN_IRQn = 27, /*!< CAN Interrupt */
+ USB0_IRQn = 28, /*!< USB IRQ interrupt */
+ USB_IRQn = USB0_IRQn, /*!< Optional alias for USB0_IRQn */
+ USB0_FIQ_IRQn = 29, /*!< USB FIQ interrupt */
+ USB_FIQ_IRQn = USB0_FIQ_IRQn, /*!< Optional alias for USB0_FIQ_IRQn */
+ USB_WAKEUP_IRQn = 30, /*!< USB wake-up interrupt Interrupt */
+ ADC0_SEQA_IRQn = 31, /*!< ADC0_A sequencer Interrupt */
+ ADC0_A_IRQn = ADC0_SEQA_IRQn, /*!< Optional alias for ADC0_SEQA_IRQn */
+ ADC_A_IRQn = ADC0_SEQA_IRQn, /*!< Optional alias for ADC0_SEQA_IRQn */
+ ADC0_SEQB_IRQn = 32, /*!< ADC0_B sequencer Interrupt */
+ ADC0_B_IRQn = ADC0_SEQB_IRQn, /*!< Optional alias for ADC0_SEQB_IRQn */
+ ADC_B_IRQn = ADC0_SEQB_IRQn, /*!< Optional alias for ADC0_SEQB_IRQn */
+ ADC0_THCMP = 33, /*!< ADC0 threshold compare interrupt */
+ ADC0_OVR = 34, /*!< ADC0 overrun interrupt */
+ ADC1_SEQA_IRQn = 35, /*!< ADC1_A sequencer Interrupt */
+ ADC1_A_IRQn = ADC1_SEQA_IRQn, /*!< Optional alias for ADC1_SEQA_IRQn */
+ ADC1_SEQB_IRQn = 36, /*!< ADC1_B sequencer Interrupt */
+ ADC1_B_IRQn = ADC1_SEQB_IRQn, /*!< Optional alias for ADC1_SEQB_IRQn */
+ ADC1_THCMP = 37, /*!< ADC1 threshold compare interrupt */
+ ADC1_OVR = 38, /*!< ADC1 overrun interrupt */
+ DAC_IRQ = 39, /*!< DAC interrupt */
+ CMP0_IRQ = 40, /*!< Analog comparator 0 interrupt */
+ CMP_IRQn = CMP0_IRQ, /*!< Optional alias for CMP0_IRQ */
+ CMP1_IRQ = 41, /*!< Analog comparator 1 interrupt */
+ CMP2_IRQ = 42, /*!< Analog comparator 2 interrupt */
+ CMP3_IRQ = 43, /*!< Analog comparator 3 interrupt */
+ QEI_IRQn = 44, /*!< QEI interrupt */
+ RTC_ALARM_IRQn = 45, /*!< RTC alarm interrupt */
+ RTC_WAKE_IRQn = 46, /*!< RTC wake-up interrupt */
+#endif
+
+/* un-overridden irq handler */
+void lpc_dummy_irq(void)
+{
+ arm_cm_irq_entry();
+
+ panic("unhandled irq\n");
+}
+
+extern void lpc_uart_irq(void);
+
+/* a list of default handlers that are simply aliases to the dummy handler */
+#define DEFAULT_HANDLER(x) \
+void lpc_##x##_irq(void) __WEAK_ALIAS("lpc_dummy_irq")
+
+DEFAULT_HANDLER(WDT);
+DEFAULT_HANDLER(BOD);
+DEFAULT_HANDLER(FMC);
+DEFAULT_HANDLER(FLASHEEPROM);
+DEFAULT_HANDLER(DMA);
+DEFAULT_HANDLER(GINT0);
+DEFAULT_HANDLER(GINT1);
+DEFAULT_HANDLER(PIN_INT0);
+DEFAULT_HANDLER(PIN_INT1);
+DEFAULT_HANDLER(PIN_INT2);
+DEFAULT_HANDLER(PIN_INT3);
+DEFAULT_HANDLER(PIN_INT4);
+DEFAULT_HANDLER(PIN_INT5);
+DEFAULT_HANDLER(PIN_INT6);
+DEFAULT_HANDLER(PIN_INT7);
+DEFAULT_HANDLER(RITIMER);
+DEFAULT_HANDLER(SCT0);
+DEFAULT_HANDLER(SCT1);
+DEFAULT_HANDLER(SCT2);
+DEFAULT_HANDLER(SCT3);
+DEFAULT_HANDLER(MRT);
+DEFAULT_HANDLER(UART0);
+DEFAULT_HANDLER(UART1);
+DEFAULT_HANDLER(UART2);
+DEFAULT_HANDLER(I2C0);
+DEFAULT_HANDLER(SPI0);
+DEFAULT_HANDLER(SPI1);
+DEFAULT_HANDLER(CAN);
+DEFAULT_HANDLER(USB0);
+DEFAULT_HANDLER(USB0_FIQ);
+DEFAULT_HANDLER(USB_WAKEUP);
+DEFAULT_HANDLER(ADC0_SEQA);
+DEFAULT_HANDLER(ADC0_SEQB);
+DEFAULT_HANDLER(ADC0_THCMP);
+DEFAULT_HANDLER(ADC0_OVR);
+DEFAULT_HANDLER(ADC1_SEQA);
+DEFAULT_HANDLER(ADC1_SEQB);
+DEFAULT_HANDLER(ADC1_THCMP);
+DEFAULT_HANDLER(ADC1_OVR);
+DEFAULT_HANDLER(DAC);
+DEFAULT_HANDLER(CMP0);
+DEFAULT_HANDLER(CMP1);
+DEFAULT_HANDLER(CMP2);
+DEFAULT_HANDLER(CMP3);
+DEFAULT_HANDLER(QEI);
+DEFAULT_HANDLER(RTC_ALARM);
+DEFAULT_HANDLER(RTC_WAKE);
+
+#define VECTAB_ENTRY(x) lpc_##x##_irq
+
+const void * const __SECTION(".text.boot.vectab2") vectab2[] = {
+ VECTAB_ENTRY(WDT),
+ VECTAB_ENTRY(BOD),
+ VECTAB_ENTRY(FMC),
+ VECTAB_ENTRY(FLASHEEPROM),
+ VECTAB_ENTRY(DMA),
+ VECTAB_ENTRY(GINT0),
+ VECTAB_ENTRY(GINT1),
+ VECTAB_ENTRY(PIN_INT0),
+ VECTAB_ENTRY(PIN_INT1),
+ VECTAB_ENTRY(PIN_INT2),
+ VECTAB_ENTRY(PIN_INT3),
+ VECTAB_ENTRY(PIN_INT4),
+ VECTAB_ENTRY(PIN_INT5),
+ VECTAB_ENTRY(PIN_INT6),
+ VECTAB_ENTRY(PIN_INT7),
+ VECTAB_ENTRY(RITIMER),
+ VECTAB_ENTRY(SCT0),
+ VECTAB_ENTRY(SCT1),
+ VECTAB_ENTRY(SCT2),
+ VECTAB_ENTRY(SCT3),
+ VECTAB_ENTRY(MRT),
+ VECTAB_ENTRY(UART0),
+ VECTAB_ENTRY(UART1),
+ VECTAB_ENTRY(UART2),
+ VECTAB_ENTRY(I2C0),
+ VECTAB_ENTRY(SPI0),
+ VECTAB_ENTRY(SPI1),
+ VECTAB_ENTRY(CAN),
+ VECTAB_ENTRY(USB0),
+ VECTAB_ENTRY(USB0_FIQ),
+ VECTAB_ENTRY(USB_WAKEUP),
+ VECTAB_ENTRY(ADC0_SEQA),
+ VECTAB_ENTRY(ADC0_SEQB),
+ VECTAB_ENTRY(ADC0_THCMP),
+ VECTAB_ENTRY(ADC0_OVR),
+ VECTAB_ENTRY(ADC1_SEQA),
+ VECTAB_ENTRY(ADC1_SEQB),
+ VECTAB_ENTRY(ADC1_THCMP),
+ VECTAB_ENTRY(ADC1_OVR),
+ VECTAB_ENTRY(DAC),
+ VECTAB_ENTRY(CMP0),
+ VECTAB_ENTRY(CMP1),
+ VECTAB_ENTRY(CMP2),
+ VECTAB_ENTRY(CMP3),
+ VECTAB_ENTRY(QEI),
+ VECTAB_ENTRY(RTC_ALARM),
+ VECTAB_ENTRY(RTC_WAKE),
+};