Fork of mbed-src file paths change. LPC1114FN28 use only.

Fork of mbed-src by mbed official

Information

この情報は2013/10/28時点での解決方法です。
現在はmbed-src、標準ライブラリで問題なくコンパイルが可能です。

・使う物
LPC1114FN28
mbed SDK

LPC1114FN28でmbed-SDKのLibraryを使うとCompile出来ない。(2013/10/28) /media/uploads/minicube/mbed_lpc1114_sdk.png

パスが通ってないだけのようなのでファイルを以下に移動する。

mbed-src\targets\cmsis\TARGET_NXP\TARGET_LPC11XX_11CXX\
mbed-src\targets\cmsis\TARGET_NXP\TARGET_LPC11XX_11CXX\TARGET_LPC11XX\

にあるファイルをすべて

mbed-src\targets\cmsis\TARGET_NXP\

へ移動

mbed-src\targets\cmsis\TARGET_NXP\TARGET_LPC11XX_11CXX\にある

TOOLCHAIN_ARM_MICRO

をフォルダごと

mbed-src\targets\cmsis\TARGET_NXP\

へ移動

mbed-src\targets\hal\TARGET_NXP\TARGET_LPC11XX_11CXX\
mbed-src\targets\hal\TARGET_NXP\TARGET_LPC11XX_11CXX\TARGET_LPC11XX\

にあるファイルをすべて

mbed-src\targets\hal\TARGET_NXP\

へ移動

移動後は以下のような構成になると思います。
※不要なファイルは削除してあります。

/media/uploads/minicube/mbed_lpc1114_sdk_tree.png


ファイルの移動が面倒なので以下に本家からフォークしたライブラリを置いておきます。

Import librarymbed-src-LPC1114FN28

Fork of mbed-src file paths change. LPC1114FN28 use only.


エラーが出力される場合

"TOOLCHAIN_ARM_MICRO"が無いとエラーになる。

Error: Undefined symbol _initial_sp (referred from entry2.o).
Error: Undefined symbol _heap_base (referred from malloc.o).
Error: Undefined symbol _heap_limit (referred from malloc.o).

LPC1114FN28はMicrolibを使ってCompileされるため上記のエラーになるようです。

Files at this revision

API Documentation at this revision

Comitter:
minicube
Date:
Sun Oct 27 20:12:31 2013 +0000
Parent:
42:7ca0bbba899b
Commit message:
mbed SDK; LPC1114FN28 use only

Changed in this revision

targets/cmsis/TARGET_Freescale/TARGET_KL05Z/MKL05Z4.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL05Z/TOOLCHAIN_ARM_STD/MKL05Z4.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL05Z/TOOLCHAIN_ARM_STD/startup_MKL05Z4.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL05Z/TOOLCHAIN_ARM_STD/sys.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL05Z/cmsis.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL05Z/cmsis_nvic.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL05Z/cmsis_nvic.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL05Z/system_MKL05Z4.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL05Z/system_MKL05Z4.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL25Z/MKL25Z4.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_ARM_MICRO/MKL25Z4.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_ARM_MICRO/startup_MKL25Z4.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_ARM_MICRO/sys.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_ARM_STD/MKL25Z4.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_ARM_STD/startup_MKL25Z4.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_ARM_STD/sys.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_GCC_ARM/MKL25Z4.ld Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_GCC_ARM/startup_MKL25Z4.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_GCC_CW_EWL/MKL25Z4.ld Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_GCC_CW_EWL/startup_MKL25Z4.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_GCC_CW_NEWLIB/MKL25Z4.ld Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_GCC_CW_NEWLIB/startup_MKL25Z4.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL25Z/cmsis.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL25Z/cmsis_nvic.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL25Z/cmsis_nvic.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL25Z/system_MKL25Z4.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL25Z/system_MKL25Z4.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL46Z/MKL46Z4.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL46Z/TOOLCHAIN_ARM_STD/MKL46Z4.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL46Z/TOOLCHAIN_ARM_STD/startup_MKL46Z4.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL46Z/TOOLCHAIN_ARM_STD/sys.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL46Z/TOOLCHAIN_GCC_ARM/MKL46Z4.ld Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL46Z/TOOLCHAIN_GCC_ARM/startup_MKL46Z4.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL46Z/cmsis.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL46Z/cmsis_nvic.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL46Z/cmsis_nvic.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL46Z/system_MKL46Z4.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_Freescale/TARGET_KL46Z/system_MKL46Z4.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/LPC11xx.h Show annotated file Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/LPC11Uxx.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_MICRO/TARGET_LPC11U24_301/LPC11U24.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_MICRO/TARGET_LPC11U24_301/startup_LPC11xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_MICRO/TARGET_LPC11U24_401/LPC11U24.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_MICRO/TARGET_LPC11U24_401/startup_LPC11xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_MICRO/TARGET_LPC11U35_401/LPC11U35.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_MICRO/TARGET_LPC11U35_401/startup_LPC11xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_MICRO/sys.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_STD/TARGET_LPC11U24_301/LPC11U24.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_STD/TARGET_LPC11U24_301/startup_LPC11xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_STD/TARGET_LPC11U24_401/LPC11U24.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_STD/TARGET_LPC11U24_401/startup_LPC11xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_STD/TARGET_LPC11U35_401/LPC11U35.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_STD/TARGET_LPC11U35_401/startup_LPC11xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_STD/sys.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11U24_301/LPC11U24.ld Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11U24_401/LPC11U24.ld Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11U35_401/LPC11U35.ld Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/startup_LPC11xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_CR/LPC11U24.ld Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_CR/startup_LPC11xx.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_CS/LPC11U24.ld Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_CS/startup_LPC11xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_CS/sys.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/cmsis.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/cmsis_nvic.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/cmsis_nvic.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/power_api.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/system_LPC11Uxx.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/system_LPC11Uxx.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/LPC11xx.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11CXX/system_LPC11xx.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11XX/system_LPC11xx.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_ARM_MICRO/TARGET_LPC11CXX/LPC11C24.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_ARM_MICRO/TARGET_LPC11CXX/startup_LPC11xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_ARM_MICRO/TARGET_LPC11XX/LPC1114.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_ARM_MICRO/TARGET_LPC11XX/startup_LPC11xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_ARM_MICRO/sys.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_ARM_STD/TARGET_LPC11CXX/LPC11C24.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_ARM_STD/TARGET_LPC11CXX/startup_LPC11xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_ARM_STD/TARGET_LPC11XX/LPC1114.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_ARM_STD/TARGET_LPC11XX/startup_LPC11xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_ARM_STD/sys.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11CXX/LPC11C24.ld Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11XX/LPC1114.ld Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_GCC_ARM/startup_LPC11xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_GCC_CR/startup_LPC11xx.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_GCC_CS/startup_LPC11xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_GCC_CS/sys.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/bitfields.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/cmsis.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/cmsis_nvic.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/cmsis_nvic.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/system_LPC11xx.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC13XX/LPC13Uxx.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC13XX/TOOLCHAIN_ARM_MICRO/LPC1347.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC13XX/TOOLCHAIN_ARM_MICRO/startup_LPC13xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC13XX/TOOLCHAIN_ARM_MICRO/sys.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC13XX/TOOLCHAIN_ARM_STD/LPC1347.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC13XX/TOOLCHAIN_ARM_STD/startup_LPC13xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC13XX/TOOLCHAIN_ARM_STD/sys.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC13XX/TOOLCHAIN_GCC_ARM/LPC1347.ld Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC13XX/TOOLCHAIN_GCC_ARM/startup_LPC13xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC13XX/cmsis.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC13XX/cmsis_nvic.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC13XX/cmsis_nvic.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC13XX/system_LPC13Uxx.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC13XX/system_LPC13Uxx.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC176X/LPC17xx.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_ARM_MICRO/LPC1768.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_ARM_MICRO/startup_LPC17xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_ARM_MICRO/sys.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_ARM_STD/LPC1768.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_ARM_STD/startup_LPC17xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_ARM_STD/sys.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_ARM/LPC1768.ld Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_ARM/startup_LPC17xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_CR/LPC1768.ld Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_CR/startup_LPC17xx.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_CS/LPC1768.ld Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_CS/startup_LPC17xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_CS/sys.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_IAR/LPC17xx.icf Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_IAR/startup_LPC17xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC176X/cmsis.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC176X/cmsis_nvic.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC176X/cmsis_nvic.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC176X/system_LPC17xx.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC176X/system_LPC17xx.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/LPC23xx.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_ARM_MICRO/LPC2368.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_ARM_MICRO/sys.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_ARM_MICRO/vector_functions.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_ARM_MICRO/vector_table.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_ARM_STD/LPC2368.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_ARM_STD/sys.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_ARM_STD/vector_functions.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_ARM_STD/vector_table.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_ARM/LPC2368.ld Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_ARM/vector_functions.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_ARM/vector_table.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_CR/LPC2368.ld Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_CR/vector_functions.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_CR/vector_table.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_CS/LPC2368.ld Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_CS/vector_functions.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_CS/vector_table.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/cmsis.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/cmsis_nvic.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/cmsis_nvic.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/core_arm7.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/core_arm7.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/system_LPC23xx.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/system_LPC23xx.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/vector_defns.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC23XX/vector_realmonitor.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC408X/LPC407x_8x_177x_8x.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_ARM_STD/TARGET_LPC4088/LPC407X_8X.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_ARM_STD/TARGET_LPC4088_EA/LPC407X_8X.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_ARM_STD/startup_LPC407x_8x_177x_8x.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_ARM_STD/sys.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_GCC_CR/LPC407x_8x.ld Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_GCC_CR/startup_lpc407x_8x.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC408X/cmsis.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC408X/cmsis_nvic.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC408X/cmsis_nvic.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC408X/system_LPC407x_8x_177x_8x.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC408X/system_LPC407x_8x_177x_8x.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC43XX/LPC43xx.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC43XX/TOOLCHAIN_ARM_STD/LPC43xx.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC43XX/TOOLCHAIN_ARM_STD/startup_LPC43xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC43XX/TOOLCHAIN_ARM_STD/sys.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC43XX/TOOLCHAIN_GCC_CR/LPC43xx.ld Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC43XX/TOOLCHAIN_GCC_CR/startup_LPC43xx.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC43XX/TOOLCHAIN_IAR/LPC43xx.icf Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC43XX/TOOLCHAIN_IAR/startup_LPC43xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC43XX/cmsis.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC43XX/cmsis_nvic.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC43XX/cmsis_nvic.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC43XX/system_LPC43xx.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC43XX/system_LPC43xx.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC810/TOOLCHAIN_ARM_MICRO/LPC810.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC810/TOOLCHAIN_ARM_MICRO/startup_LPC8xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC810/system_LPC8xx.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC812/TOOLCHAIN_ARM_MICRO/LPC812.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC812/TOOLCHAIN_ARM_MICRO/startup_LPC8xx.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC812/system_LPC8xx.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/LPC8xx.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/TOOLCHAIN_ARM_MICRO/sys.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/cmsis.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/cmsis_nvic.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/cmsis_nvic.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/system_LPC8xx.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TOOLCHAIN_ARM_MICRO/TARGET_LPC11CXX/LPC11C24.sct Show annotated file Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TOOLCHAIN_ARM_MICRO/TARGET_LPC11CXX/startup_LPC11xx.s Show annotated file Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TOOLCHAIN_ARM_MICRO/TARGET_LPC11XX/LPC1114.sct Show annotated file Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TOOLCHAIN_ARM_MICRO/TARGET_LPC11XX/startup_LPC11xx.s Show annotated file Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/TOOLCHAIN_ARM_MICRO/sys.cpp Show annotated file Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/bitfields.h Show annotated file Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/cmsis.h Show annotated file Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/cmsis_nvic.c Show annotated file Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/cmsis_nvic.h Show annotated file Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/system_LPC11xx.c Show annotated file Show diff for this revision Revisions of this file
targets/cmsis/TARGET_NXP/system_LPC11xx.h Show annotated file Show diff for this revision Revisions of this file
targets/cmsis/TARGET_STM/TARGET_STM32F4XX/TOOLCHAIN_ARM_STD/STM32F407.sct Show diff for this revision Revisions of this file
targets/cmsis/TARGET_STM/TARGET_STM32F4XX/TOOLCHAIN_ARM_STD/startup_STM32F40x.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_STM/TARGET_STM32F4XX/TOOLCHAIN_ARM_STD/sys.cpp Show diff for this revision Revisions of this file
targets/cmsis/TARGET_STM/TARGET_STM32F4XX/TOOLCHAIN_GCC_ARM/STM32F407.ld Show diff for this revision Revisions of this file
targets/cmsis/TARGET_STM/TARGET_STM32F4XX/TOOLCHAIN_GCC_ARM/startup_STM32F40x.s Show diff for this revision Revisions of this file
targets/cmsis/TARGET_STM/TARGET_STM32F4XX/cmsis.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_STM/TARGET_STM32F4XX/cmsis_nvic.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_STM/TARGET_STM32F4XX/cmsis_nvic.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_STM/TARGET_STM32F4XX/stm32f4xx.h Show diff for this revision Revisions of this file
targets/cmsis/TARGET_STM/TARGET_STM32F4XX/system_stm32f4xx.c Show diff for this revision Revisions of this file
targets/cmsis/TARGET_STM/TARGET_STM32F4XX/system_stm32f4xx.h Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL05Z/PeripheralNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL05Z/PinNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL05Z/PortNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL05Z/analogin_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL05Z/analogout_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL05Z/device.h Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL05Z/gpio_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL05Z/gpio_irq_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL05Z/gpio_object.h Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL05Z/i2c_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL05Z/objects.h Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL05Z/pinmap.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL05Z/port_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL05Z/pwmout_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL05Z/rtc_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL05Z/serial_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL05Z/spi_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL05Z/us_ticker.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL25Z/PeripheralNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL25Z/PinNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL25Z/PortNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL25Z/analogin_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL25Z/analogout_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL25Z/device.h Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL25Z/gpio_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL25Z/gpio_irq_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL25Z/gpio_object.h Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL25Z/i2c_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL25Z/objects.h Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL25Z/pinmap.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL25Z/port_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL25Z/pwmout_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL25Z/rtc_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL25Z/serial_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL25Z/spi_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL25Z/us_ticker.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL46Z/PeripheralNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL46Z/PinNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL46Z/PortNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL46Z/analogin_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL46Z/analogout_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL46Z/device.h Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL46Z/gpio_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL46Z/gpio_irq_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL46Z/gpio_object.h Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL46Z/i2c_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL46Z/objects.h Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL46Z/pinmap.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL46Z/port_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL46Z/pwmout_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL46Z/rtc_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL46Z/serial_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL46Z/spi_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KL46Z/us_ticker.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/PeripheralNames.h Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/PinNames.h Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/PortNames.h Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11UXX/PeripheralNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11UXX/PinNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11UXX/PortNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11UXX/analogin_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11UXX/device.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11UXX/gpio_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11UXX/gpio_irq_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11UXX/gpio_object.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11UXX/i2c_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11UXX/objects.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11UXX/pinmap.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11UXX/port_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11UXX/pwmout_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11UXX/serial_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11UXX/sleep.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11UXX/spi_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11UXX/us_ticker.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/PeripheralNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/PortNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11CXX/PinNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11CXX/can_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11CXX/device.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11CXX/reserved_pins.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11XX/PinNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11XX/device.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11XX/reserved_pins.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/analogin_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/gpio_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/gpio_irq_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/gpio_object.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/i2c_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/objects.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/pinmap.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/port_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/pwmout_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/serial_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/sleep.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/spi_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/us_ticker.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC13XX/PeripheralNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC13XX/PinNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC13XX/PortNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC13XX/analogin_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC13XX/device.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC13XX/gpio_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC13XX/gpio_irq_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC13XX/gpio_object.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC13XX/i2c_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC13XX/objects.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC13XX/pinmap.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC13XX/port_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC13XX/pwmout_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC13XX/serial_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC13XX/sleep.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC13XX/spi_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC13XX/us_ticker.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC176X/PeripheralNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC176X/PinNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC176X/PortNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC176X/analogin_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC176X/analogout_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC176X/can_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC176X/device.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC176X/ethernet_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC176X/gpio_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC176X/gpio_irq_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC176X/gpio_object.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC176X/i2c_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC176X/objects.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC176X/pinmap.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC176X/port_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC176X/pwmout_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC176X/rtc_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC176X/serial_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC176X/sleep.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC176X/spi_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC176X/us_ticker.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC23XX/PeripheralNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC23XX/PinNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC23XX/PortNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC23XX/analogin_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC23XX/analogout_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC23XX/can_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC23XX/device.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC23XX/ethernet_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC23XX/gpio_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC23XX/gpio_irq_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC23XX/gpio_object.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC23XX/i2c_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC23XX/objects.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC23XX/pinmap.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC23XX/port_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC23XX/pwmout_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC23XX/rtc_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC23XX/serial_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC23XX/spi_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC23XX/us_ticker.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC408X/PeripheralNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC408X/PinNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC408X/PortNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC408X/analogin_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC408X/analogout_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC408X/can_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC408X/device.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC408X/ethernet_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC408X/gpio_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC408X/gpio_irq_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC408X/gpio_object.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC408X/i2c_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC408X/objects.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC408X/pinmap.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC408X/port_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC408X/pwmout_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC408X/rtc_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC408X/serial_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC408X/sleep.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC408X/spi_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC408X/us_ticker.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC43XX/PeripheralNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC43XX/PinNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC43XX/PortNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC43XX/README.txt Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC43XX/analogin_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC43XX/analogout_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC43XX/device.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC43XX/gpio_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC43XX/gpio_irq_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC43XX/gpio_object.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC43XX/objects.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC43XX/pinmap.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC43XX/port_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC43XX/rtc_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC43XX/serial_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC43XX/sleep.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC43XX/spi_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC43XX/us_ticker.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC810/PinNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC812/PinNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/PeripheralNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/PortNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/device.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/gpio_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/gpio_irq_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/gpio_object.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/i2c_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/objects.h Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/pinmap.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/serial_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/spi_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/us_ticker.c Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/analogin_api.c Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/device.h Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/gpio_api.c Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/gpio_irq_api.c Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/gpio_object.h Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/i2c_api.c Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/objects.h Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/pinmap.c Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/port_api.c Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/pwmout_api.c Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/reserved_pins.h Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/serial_api.c Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/sleep.c Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/spi_api.c Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_NXP/us_ticker.c Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_STM/TARGET_STM32F4XX/PeripheralNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_STM/TARGET_STM32F4XX/PinNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_STM/TARGET_STM32F4XX/PortNames.h Show diff for this revision Revisions of this file
targets/hal/TARGET_STM/TARGET_STM32F4XX/analogin_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_STM/TARGET_STM32F4XX/device.h Show diff for this revision Revisions of this file
targets/hal/TARGET_STM/TARGET_STM32F4XX/gpio_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_STM/TARGET_STM32F4XX/gpio_object.h Show diff for this revision Revisions of this file
targets/hal/TARGET_STM/TARGET_STM32F4XX/i2c_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_STM/TARGET_STM32F4XX/objects.h Show diff for this revision Revisions of this file
targets/hal/TARGET_STM/TARGET_STM32F4XX/pinmap.c Show diff for this revision Revisions of this file
targets/hal/TARGET_STM/TARGET_STM32F4XX/port_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_STM/TARGET_STM32F4XX/spi_api.c Show diff for this revision Revisions of this file
targets/hal/TARGET_STM/TARGET_STM32F4XX/us_ticker.c Show diff for this revision Revisions of this file
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL05Z/MKL05Z4.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3613 +0,0 @@
-/*
-** ###################################################################
-**     Processors:          MKL05Z32FK4
-**                          MKL05Z32LC4
-**                          MKL05Z32VLF4
-**
-**     Compilers:           ARM Compiler
-**                          Freescale C/C++ for Embedded ARM
-**                          GNU C Compiler
-**                          IAR ANSI C/C++ Compiler for ARM
-**
-**     Reference manual:    KL05P48M48SF1RM, Rev.3, Sep 2012
-**     Version:             rev. 1.3, 2012-10-04
-**
-**     Abstract:
-**         CMSIS Peripheral Access Layer for MKL05Z4
-**
-**     Copyright: 1997 - 2012 Freescale, Inc. All Rights Reserved.
-**
-**     http:                 www.freescale.com
-**     mail:                 support@freescale.com
-**
-**     Revisions:
-**     - rev. 1.0 (2012-06-08)
-**         Initial version.
-**     - rev. 1.1 (2012-06-21)
-**         Update according to reference manual rev. 1.
-**     - rev. 1.2 (2012-08-01)
-**         Device type UARTLP changed to UART0.
-**         Missing PORTB_IRQn interrupt number definition added.
-**     - rev. 1.3 (2012-10-04)
-**         Update according to reference manual rev. 3.
-**
-** ###################################################################
-*/
-
-/**
- * @file MKL05Z4.h
- * @version 1.3
- * @date 2012-10-04
- * @brief CMSIS Peripheral Access Layer for MKL05Z4
- *
- * CMSIS Peripheral Access Layer for MKL05Z4
- */
-
-#if !defined(MKL05Z4_H_)
-#define MKL05Z4_H_                               /**< Symbol preventing repeated inclusion */
-
-/** Memory map major version (memory maps with equal major version number are
- * compatible) */
-#define MCU_MEM_MAP_VERSION 0x0100u
-/** Memory map minor version */
-#define MCU_MEM_MAP_VERSION_MINOR 0x0003u
-
-
-/* ----------------------------------------------------------------------------
-   -- Interrupt vector numbers
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup Interrupt_vector_numbers Interrupt vector numbers
- * @{
- */
-
-/** Interrupt Number Definitions */
-typedef enum IRQn {
-  /* Core interrupts */
-  NonMaskableInt_IRQn          = -14,              /**< Non Maskable Interrupt */
-  HardFault_IRQn               = -13,              /**< Cortex-M0 SV Hard Fault Interrupt */
-  SVCall_IRQn                  = -5,               /**< Cortex-M0 SV Call Interrupt */
-  PendSV_IRQn                  = -2,               /**< Cortex-M0 Pend SV Interrupt */
-  SysTick_IRQn                 = -1,               /**< Cortex-M0 System Tick Interrupt */
-
-  /* Device specific interrupts */
-  DMA0_IRQn                    = 0,                /**< DMA channel 0 transfer complete/error interrupt */
-  DMA1_IRQn                    = 1,                /**< DMA channel 1 transfer complete/error interrupt */
-  DMA2_IRQn                    = 2,                /**< DMA channel 2 transfer complete/error interrupt */
-  DMA3_IRQn                    = 3,                /**< DMA channel 3 transfer complete/error interrupt */
-  Reserved20_IRQn              = 4,                /**< Reserved interrupt 20 */
-  FTFA_IRQn                    = 5,                /**< FTFA command complete/read collision interrupt */
-  LVD_LVW_IRQn                 = 6,                /**< Low Voltage Detect, Low Voltage Warning */
-  LLW_IRQn                     = 7,                /**< Low Leakage Wakeup */
-  I2C0_IRQn                    = 8,                /**< I2C0 interrupt */
-  Reserved25_IRQn              = 9,                /**< Reserved interrupt 25 */
-  SPI0_IRQn                    = 10,               /**< SPI0 interrupt */
-  Reserved27_IRQn              = 11,               /**< Reserved interrupt 27 */
-  UART0_IRQn                   = 12,               /**< UART0 status/error interrupt */
-  Reserved29_IRQn              = 13,               /**< Reserved interrupt 29 */
-  Reserved30_IRQn              = 14,               /**< Reserved interrupt 30 */
-  ADC0_IRQn                    = 15,               /**< ADC0 interrupt */
-  CMP0_IRQn                    = 16,               /**< CMP0 interrupt */
-  TPM0_IRQn                    = 17,               /**< TPM0 fault, overflow and channels interrupt */
-  TPM1_IRQn                    = 18,               /**< TPM1 fault, overflow and channels interrupt */
-  Reserved35_IRQn              = 19,               /**< Reserved interrupt 35 */
-  RTC_IRQn                     = 20,               /**< RTC interrupt */
-  RTC_Seconds_IRQn             = 21,               /**< RTC seconds interrupt */
-  PIT_IRQn                     = 22,               /**< PIT timer interrupt */
-  Reserved39_IRQn              = 23,               /**< Reserved interrupt 39 */
-  Reserved40_IRQn              = 24,               /**< Reserved interrupt 40 */
-  DAC0_IRQn                    = 25,               /**< DAC0 interrupt */
-  TSI0_IRQn                    = 26,               /**< TSI0 interrupt */
-  MCG_IRQn                     = 27,               /**< MCG interrupt */
-  LPTimer_IRQn                 = 28,               /**< LPTimer interrupt */
-  Reserved45_IRQn              = 29,               /**< Reserved interrupt 45 */
-  PORTA_IRQn                   = 30,               /**< Port A interrupt */
-  PORTB_IRQn                   = 31                /**< Port B interrupt */
-} IRQn_Type;
-
-/**
- * @}
- */ /* end of group Interrupt_vector_numbers */
-
-
-/* ----------------------------------------------------------------------------
-   -- Cortex M0 Core Configuration
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup Cortex_Core_Configuration Cortex M0 Core Configuration
- * @{
- */
-
-#define __CM0PLUS_REV                  0x0000    /**< Core revision r0p0 */
-#define __MPU_PRESENT                  0         /**< Defines if an MPU is present or not */
-#define __VTOR_PRESENT                 1         /**< Defines if an MPU is present or not */
-#define __NVIC_PRIO_BITS               2         /**< Number of priority bits implemented in the NVIC */
-#define __Vendor_SysTickConfig         0         /**< Vendor specific implementation of SysTickConfig is defined */
-
-#include "core_cm0plus.h"              /* Core Peripheral Access Layer */
-#include "system_MKL05Z4.h"            /* Device specific configuration file */
-
-/**
- * @}
- */ /* end of group Cortex_Core_Configuration */
-
-
-/* ----------------------------------------------------------------------------
-   -- Device Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup Peripheral_access_layer Device Peripheral Access Layer
- * @{
- */
-
-
-/*
-** Start of section using anonymous unions
-*/
-
-#if defined(__ARMCC_VERSION)
-  #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 language=extended
-#else
-  #error Not supported compiler type
-#endif
-
-/* ----------------------------------------------------------------------------
-   -- ADC Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup ADC_Peripheral_Access_Layer ADC Peripheral Access Layer
- * @{
- */
-
-/** ADC - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t SC1[2];                            /**< ADC Status and Control Registers 1, array offset: 0x0, array step: 0x4 */
-  __IO uint32_t CFG1;                              /**< ADC Configuration Register 1, offset: 0x8 */
-  __IO uint32_t CFG2;                              /**< ADC Configuration Register 2, offset: 0xC */
-  __I  uint32_t R[2];                              /**< ADC Data Result Register, array offset: 0x10, array step: 0x4 */
-  __IO uint32_t CV1;                               /**< Compare Value Registers, offset: 0x18 */
-  __IO uint32_t CV2;                               /**< Compare Value Registers, offset: 0x1C */
-  __IO uint32_t SC2;                               /**< Status and Control Register 2, offset: 0x20 */
-  __IO uint32_t SC3;                               /**< Status and Control Register 3, offset: 0x24 */
-  __IO uint32_t OFS;                               /**< ADC Offset Correction Register, offset: 0x28 */
-  __IO uint32_t PG;                                /**< ADC Plus-Side Gain Register, offset: 0x2C */
-       uint8_t RESERVED_0[4];
-  __IO uint32_t CLPD;                              /**< ADC Plus-Side General Calibration Value Register, offset: 0x34 */
-  __IO uint32_t CLPS;                              /**< ADC Plus-Side General Calibration Value Register, offset: 0x38 */
-  __IO uint32_t CLP4;                              /**< ADC Plus-Side General Calibration Value Register, offset: 0x3C */
-  __IO uint32_t CLP3;                              /**< ADC Plus-Side General Calibration Value Register, offset: 0x40 */
-  __IO uint32_t CLP2;                              /**< ADC Plus-Side General Calibration Value Register, offset: 0x44 */
-  __IO uint32_t CLP1;                              /**< ADC Plus-Side General Calibration Value Register, offset: 0x48 */
-  __IO uint32_t CLP0;                              /**< ADC Plus-Side General Calibration Value Register, offset: 0x4C */
-} ADC_Type;
-
-/* ----------------------------------------------------------------------------
-   -- ADC Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup ADC_Register_Masks ADC Register Masks
- * @{
- */
-
-/* SC1 Bit Fields */
-#define ADC_SC1_ADCH_MASK                        0x1Fu
-#define ADC_SC1_ADCH_SHIFT                       0
-#define ADC_SC1_ADCH(x)                          (((uint32_t)(((uint32_t)(x))<<ADC_SC1_ADCH_SHIFT))&ADC_SC1_ADCH_MASK)
-#define ADC_SC1_AIEN_MASK                        0x40u
-#define ADC_SC1_AIEN_SHIFT                       6
-#define ADC_SC1_COCO_MASK                        0x80u
-#define ADC_SC1_COCO_SHIFT                       7
-/* CFG1 Bit Fields */
-#define ADC_CFG1_ADICLK_MASK                     0x3u
-#define ADC_CFG1_ADICLK_SHIFT                    0
-#define ADC_CFG1_ADICLK(x)                       (((uint32_t)(((uint32_t)(x))<<ADC_CFG1_ADICLK_SHIFT))&ADC_CFG1_ADICLK_MASK)
-#define ADC_CFG1_MODE_MASK                       0xCu
-#define ADC_CFG1_MODE_SHIFT                      2
-#define ADC_CFG1_MODE(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CFG1_MODE_SHIFT))&ADC_CFG1_MODE_MASK)
-#define ADC_CFG1_ADLSMP_MASK                     0x10u
-#define ADC_CFG1_ADLSMP_SHIFT                    4
-#define ADC_CFG1_ADIV_MASK                       0x60u
-#define ADC_CFG1_ADIV_SHIFT                      5
-#define ADC_CFG1_ADIV(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CFG1_ADIV_SHIFT))&ADC_CFG1_ADIV_MASK)
-#define ADC_CFG1_ADLPC_MASK                      0x80u
-#define ADC_CFG1_ADLPC_SHIFT                     7
-/* CFG2 Bit Fields */
-#define ADC_CFG2_ADLSTS_MASK                     0x3u
-#define ADC_CFG2_ADLSTS_SHIFT                    0
-#define ADC_CFG2_ADLSTS(x)                       (((uint32_t)(((uint32_t)(x))<<ADC_CFG2_ADLSTS_SHIFT))&ADC_CFG2_ADLSTS_MASK)
-#define ADC_CFG2_ADHSC_MASK                      0x4u
-#define ADC_CFG2_ADHSC_SHIFT                     2
-#define ADC_CFG2_ADACKEN_MASK                    0x8u
-#define ADC_CFG2_ADACKEN_SHIFT                   3
-#define ADC_CFG2_MUXSEL_MASK                     0x10u
-#define ADC_CFG2_MUXSEL_SHIFT                    4
-/* R Bit Fields */
-#define ADC_R_D_MASK                             0xFFFFu
-#define ADC_R_D_SHIFT                            0
-#define ADC_R_D(x)                               (((uint32_t)(((uint32_t)(x))<<ADC_R_D_SHIFT))&ADC_R_D_MASK)
-/* CV1 Bit Fields */
-#define ADC_CV1_CV_MASK                          0xFFFFu
-#define ADC_CV1_CV_SHIFT                         0
-#define ADC_CV1_CV(x)                            (((uint32_t)(((uint32_t)(x))<<ADC_CV1_CV_SHIFT))&ADC_CV1_CV_MASK)
-/* CV2 Bit Fields */
-#define ADC_CV2_CV_MASK                          0xFFFFu
-#define ADC_CV2_CV_SHIFT                         0
-#define ADC_CV2_CV(x)                            (((uint32_t)(((uint32_t)(x))<<ADC_CV2_CV_SHIFT))&ADC_CV2_CV_MASK)
-/* SC2 Bit Fields */
-#define ADC_SC2_REFSEL_MASK                      0x3u
-#define ADC_SC2_REFSEL_SHIFT                     0
-#define ADC_SC2_REFSEL(x)                        (((uint32_t)(((uint32_t)(x))<<ADC_SC2_REFSEL_SHIFT))&ADC_SC2_REFSEL_MASK)
-#define ADC_SC2_DMAEN_MASK                       0x4u
-#define ADC_SC2_DMAEN_SHIFT                      2
-#define ADC_SC2_ACREN_MASK                       0x8u
-#define ADC_SC2_ACREN_SHIFT                      3
-#define ADC_SC2_ACFGT_MASK                       0x10u
-#define ADC_SC2_ACFGT_SHIFT                      4
-#define ADC_SC2_ACFE_MASK                        0x20u
-#define ADC_SC2_ACFE_SHIFT                       5
-#define ADC_SC2_ADTRG_MASK                       0x40u
-#define ADC_SC2_ADTRG_SHIFT                      6
-#define ADC_SC2_ADACT_MASK                       0x80u
-#define ADC_SC2_ADACT_SHIFT                      7
-/* SC3 Bit Fields */
-#define ADC_SC3_AVGS_MASK                        0x3u
-#define ADC_SC3_AVGS_SHIFT                       0
-#define ADC_SC3_AVGS(x)                          (((uint32_t)(((uint32_t)(x))<<ADC_SC3_AVGS_SHIFT))&ADC_SC3_AVGS_MASK)
-#define ADC_SC3_AVGE_MASK                        0x4u
-#define ADC_SC3_AVGE_SHIFT                       2
-#define ADC_SC3_ADCO_MASK                        0x8u
-#define ADC_SC3_ADCO_SHIFT                       3
-#define ADC_SC3_CALF_MASK                        0x40u
-#define ADC_SC3_CALF_SHIFT                       6
-#define ADC_SC3_CAL_MASK                         0x80u
-#define ADC_SC3_CAL_SHIFT                        7
-/* OFS Bit Fields */
-#define ADC_OFS_OFS_MASK                         0xFFFFu
-#define ADC_OFS_OFS_SHIFT                        0
-#define ADC_OFS_OFS(x)                           (((uint32_t)(((uint32_t)(x))<<ADC_OFS_OFS_SHIFT))&ADC_OFS_OFS_MASK)
-/* PG Bit Fields */
-#define ADC_PG_PG_MASK                           0xFFFFu
-#define ADC_PG_PG_SHIFT                          0
-#define ADC_PG_PG(x)                             (((uint32_t)(((uint32_t)(x))<<ADC_PG_PG_SHIFT))&ADC_PG_PG_MASK)
-/* CLPD Bit Fields */
-#define ADC_CLPD_CLPD_MASK                       0x3Fu
-#define ADC_CLPD_CLPD_SHIFT                      0
-#define ADC_CLPD_CLPD(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLPD_CLPD_SHIFT))&ADC_CLPD_CLPD_MASK)
-/* CLPS Bit Fields */
-#define ADC_CLPS_CLPS_MASK                       0x3Fu
-#define ADC_CLPS_CLPS_SHIFT                      0
-#define ADC_CLPS_CLPS(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLPS_CLPS_SHIFT))&ADC_CLPS_CLPS_MASK)
-/* CLP4 Bit Fields */
-#define ADC_CLP4_CLP4_MASK                       0x3FFu
-#define ADC_CLP4_CLP4_SHIFT                      0
-#define ADC_CLP4_CLP4(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLP4_CLP4_SHIFT))&ADC_CLP4_CLP4_MASK)
-/* CLP3 Bit Fields */
-#define ADC_CLP3_CLP3_MASK                       0x1FFu
-#define ADC_CLP3_CLP3_SHIFT                      0
-#define ADC_CLP3_CLP3(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLP3_CLP3_SHIFT))&ADC_CLP3_CLP3_MASK)
-/* CLP2 Bit Fields */
-#define ADC_CLP2_CLP2_MASK                       0xFFu
-#define ADC_CLP2_CLP2_SHIFT                      0
-#define ADC_CLP2_CLP2(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLP2_CLP2_SHIFT))&ADC_CLP2_CLP2_MASK)
-/* CLP1 Bit Fields */
-#define ADC_CLP1_CLP1_MASK                       0x7Fu
-#define ADC_CLP1_CLP1_SHIFT                      0
-#define ADC_CLP1_CLP1(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLP1_CLP1_SHIFT))&ADC_CLP1_CLP1_MASK)
-/* CLP0 Bit Fields */
-#define ADC_CLP0_CLP0_MASK                       0x3Fu
-#define ADC_CLP0_CLP0_SHIFT                      0
-#define ADC_CLP0_CLP0(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLP0_CLP0_SHIFT))&ADC_CLP0_CLP0_MASK)
-
-/**
- * @}
- */ /* end of group ADC_Register_Masks */
-
-
-/* ADC - Peripheral instance base addresses */
-/** Peripheral ADC0 base address */
-#define ADC0_BASE                                (0x4003B000u)
-/** Peripheral ADC0 base pointer */
-#define ADC0                                     ((ADC_Type *)ADC0_BASE)
-/** Array initializer of ADC peripheral base pointers */
-#define ADC_BASES                                { ADC0 }
-
-/**
- * @}
- */ /* end of group ADC_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- CMP Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup CMP_Peripheral_Access_Layer CMP Peripheral Access Layer
- * @{
- */
-
-/** CMP - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t CR0;                                /**< CMP Control Register 0, offset: 0x0 */
-  __IO uint8_t CR1;                                /**< CMP Control Register 1, offset: 0x1 */
-  __IO uint8_t FPR;                                /**< CMP Filter Period Register, offset: 0x2 */
-  __IO uint8_t SCR;                                /**< CMP Status and Control Register, offset: 0x3 */
-  __IO uint8_t DACCR;                              /**< DAC Control Register, offset: 0x4 */
-  __IO uint8_t MUXCR;                              /**< MUX Control Register, offset: 0x5 */
-} CMP_Type;
-
-/* ----------------------------------------------------------------------------
-   -- CMP Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup CMP_Register_Masks CMP Register Masks
- * @{
- */
-
-/* CR0 Bit Fields */
-#define CMP_CR0_HYSTCTR_MASK                     0x3u
-#define CMP_CR0_HYSTCTR_SHIFT                    0
-#define CMP_CR0_HYSTCTR(x)                       (((uint8_t)(((uint8_t)(x))<<CMP_CR0_HYSTCTR_SHIFT))&CMP_CR0_HYSTCTR_MASK)
-#define CMP_CR0_FILTER_CNT_MASK                  0x70u
-#define CMP_CR0_FILTER_CNT_SHIFT                 4
-#define CMP_CR0_FILTER_CNT(x)                    (((uint8_t)(((uint8_t)(x))<<CMP_CR0_FILTER_CNT_SHIFT))&CMP_CR0_FILTER_CNT_MASK)
-/* CR1 Bit Fields */
-#define CMP_CR1_EN_MASK                          0x1u
-#define CMP_CR1_EN_SHIFT                         0
-#define CMP_CR1_OPE_MASK                         0x2u
-#define CMP_CR1_OPE_SHIFT                        1
-#define CMP_CR1_COS_MASK                         0x4u
-#define CMP_CR1_COS_SHIFT                        2
-#define CMP_CR1_INV_MASK                         0x8u
-#define CMP_CR1_INV_SHIFT                        3
-#define CMP_CR1_PMODE_MASK                       0x10u
-#define CMP_CR1_PMODE_SHIFT                      4
-#define CMP_CR1_TRIGM_MASK                       0x20u
-#define CMP_CR1_TRIGM_SHIFT                      5
-#define CMP_CR1_WE_MASK                          0x40u
-#define CMP_CR1_WE_SHIFT                         6
-#define CMP_CR1_SE_MASK                          0x80u
-#define CMP_CR1_SE_SHIFT                         7
-/* FPR Bit Fields */
-#define CMP_FPR_FILT_PER_MASK                    0xFFu
-#define CMP_FPR_FILT_PER_SHIFT                   0
-#define CMP_FPR_FILT_PER(x)                      (((uint8_t)(((uint8_t)(x))<<CMP_FPR_FILT_PER_SHIFT))&CMP_FPR_FILT_PER_MASK)
-/* SCR Bit Fields */
-#define CMP_SCR_COUT_MASK                        0x1u
-#define CMP_SCR_COUT_SHIFT                       0
-#define CMP_SCR_CFF_MASK                         0x2u
-#define CMP_SCR_CFF_SHIFT                        1
-#define CMP_SCR_CFR_MASK                         0x4u
-#define CMP_SCR_CFR_SHIFT                        2
-#define CMP_SCR_IEF_MASK                         0x8u
-#define CMP_SCR_IEF_SHIFT                        3
-#define CMP_SCR_IER_MASK                         0x10u
-#define CMP_SCR_IER_SHIFT                        4
-#define CMP_SCR_DMAEN_MASK                       0x40u
-#define CMP_SCR_DMAEN_SHIFT                      6
-/* DACCR Bit Fields */
-#define CMP_DACCR_VOSEL_MASK                     0x3Fu
-#define CMP_DACCR_VOSEL_SHIFT                    0
-#define CMP_DACCR_VOSEL(x)                       (((uint8_t)(((uint8_t)(x))<<CMP_DACCR_VOSEL_SHIFT))&CMP_DACCR_VOSEL_MASK)
-#define CMP_DACCR_VRSEL_MASK                     0x40u
-#define CMP_DACCR_VRSEL_SHIFT                    6
-#define CMP_DACCR_DACEN_MASK                     0x80u
-#define CMP_DACCR_DACEN_SHIFT                    7
-/* MUXCR Bit Fields */
-#define CMP_MUXCR_MSEL_MASK                      0x7u
-#define CMP_MUXCR_MSEL_SHIFT                     0
-#define CMP_MUXCR_MSEL(x)                        (((uint8_t)(((uint8_t)(x))<<CMP_MUXCR_MSEL_SHIFT))&CMP_MUXCR_MSEL_MASK)
-#define CMP_MUXCR_PSEL_MASK                      0x38u
-#define CMP_MUXCR_PSEL_SHIFT                     3
-#define CMP_MUXCR_PSEL(x)                        (((uint8_t)(((uint8_t)(x))<<CMP_MUXCR_PSEL_SHIFT))&CMP_MUXCR_PSEL_MASK)
-#define CMP_MUXCR_PSTM_MASK                      0x80u
-#define CMP_MUXCR_PSTM_SHIFT                     7
-
-/**
- * @}
- */ /* end of group CMP_Register_Masks */
-
-
-/* CMP - Peripheral instance base addresses */
-/** Peripheral CMP0 base address */
-#define CMP0_BASE                                (0x40073000u)
-/** Peripheral CMP0 base pointer */
-#define CMP0                                     ((CMP_Type *)CMP0_BASE)
-/** Array initializer of CMP peripheral base pointers */
-#define CMP_BASES                                { CMP0 }
-
-/**
- * @}
- */ /* end of group CMP_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- DAC Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup DAC_Peripheral_Access_Layer DAC Peripheral Access Layer
- * @{
- */
-
-/** DAC - Register Layout Typedef */
-typedef struct {
-  struct {                                         /* offset: 0x0, array step: 0x2 */
-    __IO uint8_t DATL;                               /**< DAC Data Low Register, array offset: 0x0, array step: 0x2 */
-    __IO uint8_t DATH;                               /**< DAC Data High Register, array offset: 0x1, array step: 0x2 */
-  } DAT[2];
-       uint8_t RESERVED_0[28];
-  __IO uint8_t SR;                                 /**< DAC Status Register, offset: 0x20 */
-  __IO uint8_t C0;                                 /**< DAC Control Register, offset: 0x21 */
-  __IO uint8_t C1;                                 /**< DAC Control Register 1, offset: 0x22 */
-  __IO uint8_t C2;                                 /**< DAC Control Register 2, offset: 0x23 */
-} DAC_Type;
-
-/* ----------------------------------------------------------------------------
-   -- DAC Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup DAC_Register_Masks DAC Register Masks
- * @{
- */
-
-/* DATL Bit Fields */
-#define DAC_DATL_DATA0_MASK                      0xFFu
-#define DAC_DATL_DATA0_SHIFT                     0
-#define DAC_DATL_DATA0(x)                        (((uint8_t)(((uint8_t)(x))<<DAC_DATL_DATA0_SHIFT))&DAC_DATL_DATA0_MASK)
-/* DATH Bit Fields */
-#define DAC_DATH_DATA1_MASK                      0xFu
-#define DAC_DATH_DATA1_SHIFT                     0
-#define DAC_DATH_DATA1(x)                        (((uint8_t)(((uint8_t)(x))<<DAC_DATH_DATA1_SHIFT))&DAC_DATH_DATA1_MASK)
-/* SR Bit Fields */
-#define DAC_SR_DACBFRPBF_MASK                    0x1u
-#define DAC_SR_DACBFRPBF_SHIFT                   0
-#define DAC_SR_DACBFRPTF_MASK                    0x2u
-#define DAC_SR_DACBFRPTF_SHIFT                   1
-/* C0 Bit Fields */
-#define DAC_C0_DACBBIEN_MASK                     0x1u
-#define DAC_C0_DACBBIEN_SHIFT                    0
-#define DAC_C0_DACBTIEN_MASK                     0x2u
-#define DAC_C0_DACBTIEN_SHIFT                    1
-#define DAC_C0_LPEN_MASK                         0x8u
-#define DAC_C0_LPEN_SHIFT                        3
-#define DAC_C0_DACSWTRG_MASK                     0x10u
-#define DAC_C0_DACSWTRG_SHIFT                    4
-#define DAC_C0_DACTRGSEL_MASK                    0x20u
-#define DAC_C0_DACTRGSEL_SHIFT                   5
-#define DAC_C0_DACRFS_MASK                       0x40u
-#define DAC_C0_DACRFS_SHIFT                      6
-#define DAC_C0_DACEN_MASK                        0x80u
-#define DAC_C0_DACEN_SHIFT                       7
-/* C1 Bit Fields */
-#define DAC_C1_DACBFEN_MASK                      0x1u
-#define DAC_C1_DACBFEN_SHIFT                     0
-#define DAC_C1_DACBFMD_MASK                      0x4u
-#define DAC_C1_DACBFMD_SHIFT                     2
-#define DAC_C1_DMAEN_MASK                        0x80u
-#define DAC_C1_DMAEN_SHIFT                       7
-/* C2 Bit Fields */
-#define DAC_C2_DACBFUP_MASK                      0x1u
-#define DAC_C2_DACBFUP_SHIFT                     0
-#define DAC_C2_DACBFRP_MASK                      0x10u
-#define DAC_C2_DACBFRP_SHIFT                     4
-
-/**
- * @}
- */ /* end of group DAC_Register_Masks */
-
-
-/* DAC - Peripheral instance base addresses */
-/** Peripheral DAC0 base address */
-#define DAC0_BASE                                (0x4003F000u)
-/** Peripheral DAC0 base pointer */
-#define DAC0                                     ((DAC_Type *)DAC0_BASE)
-/** Array initializer of DAC peripheral base pointers */
-#define DAC_BASES                                { DAC0 }
-
-/**
- * @}
- */ /* end of group DAC_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- DMA Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup DMA_Peripheral_Access_Layer DMA Peripheral Access Layer
- * @{
- */
-
-/** DMA - Register Layout Typedef */
-typedef struct {
-       uint8_t RESERVED_0[256];
-  struct {                                         /* offset: 0x100, array step: 0x10 */
-    __IO uint32_t SAR;                               /**< Source Address Register, array offset: 0x100, array step: 0x10 */
-    __IO uint32_t DAR;                               /**< Destination Address Register, array offset: 0x104, array step: 0x10 */
-    union {                                          /* offset: 0x108, array step: 0x10 */
-      __IO uint32_t DSR_BCR;                           /**< DMA Status Register / Byte Count Register, array offset: 0x108, array step: 0x10 */
-      struct {                                         /* offset: 0x108, array step: 0x10 */
-             uint8_t RESERVED_0[3];
-        __IO uint8_t DSR;                                /**< DMA_DSR0 register...DMA_DSR3 register., array offset: 0x10B, array step: 0x10 */
-      } DMA_DSR_ACCESS8BIT;
-    };
-    __IO uint32_t DCR;                               /**< DMA Control Register, array offset: 0x10C, array step: 0x10 */
-  } DMA[4];
-} DMA_Type;
-
-/* ----------------------------------------------------------------------------
-   -- DMA Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup DMA_Register_Masks DMA Register Masks
- * @{
- */
-
-/* SAR Bit Fields */
-#define DMA_SAR_SAR_MASK                         0xFFFFFFFFu
-#define DMA_SAR_SAR_SHIFT                        0
-#define DMA_SAR_SAR(x)                           (((uint32_t)(((uint32_t)(x))<<DMA_SAR_SAR_SHIFT))&DMA_SAR_SAR_MASK)
-/* DAR Bit Fields */
-#define DMA_DAR_DAR_MASK                         0xFFFFFFFFu
-#define DMA_DAR_DAR_SHIFT                        0
-#define DMA_DAR_DAR(x)                           (((uint32_t)(((uint32_t)(x))<<DMA_DAR_DAR_SHIFT))&DMA_DAR_DAR_MASK)
-/* DSR_BCR Bit Fields */
-#define DMA_DSR_BCR_BCR_MASK                     0xFFFFFFu
-#define DMA_DSR_BCR_BCR_SHIFT                    0
-#define DMA_DSR_BCR_BCR(x)                       (((uint32_t)(((uint32_t)(x))<<DMA_DSR_BCR_BCR_SHIFT))&DMA_DSR_BCR_BCR_MASK)
-#define DMA_DSR_BCR_DONE_MASK                    0x1000000u
-#define DMA_DSR_BCR_DONE_SHIFT                   24
-#define DMA_DSR_BCR_BSY_MASK                     0x2000000u
-#define DMA_DSR_BCR_BSY_SHIFT                    25
-#define DMA_DSR_BCR_REQ_MASK                     0x4000000u
-#define DMA_DSR_BCR_REQ_SHIFT                    26
-#define DMA_DSR_BCR_BED_MASK                     0x10000000u
-#define DMA_DSR_BCR_BED_SHIFT                    28
-#define DMA_DSR_BCR_BES_MASK                     0x20000000u
-#define DMA_DSR_BCR_BES_SHIFT                    29
-#define DMA_DSR_BCR_CE_MASK                      0x40000000u
-#define DMA_DSR_BCR_CE_SHIFT                     30
-/* DCR Bit Fields */
-#define DMA_DCR_LCH2_MASK                        0x3u
-#define DMA_DCR_LCH2_SHIFT                       0
-#define DMA_DCR_LCH2(x)                          (((uint32_t)(((uint32_t)(x))<<DMA_DCR_LCH2_SHIFT))&DMA_DCR_LCH2_MASK)
-#define DMA_DCR_LCH1_MASK                        0xCu
-#define DMA_DCR_LCH1_SHIFT                       2
-#define DMA_DCR_LCH1(x)                          (((uint32_t)(((uint32_t)(x))<<DMA_DCR_LCH1_SHIFT))&DMA_DCR_LCH1_MASK)
-#define DMA_DCR_LINKCC_MASK                      0x30u
-#define DMA_DCR_LINKCC_SHIFT                     4
-#define DMA_DCR_LINKCC(x)                        (((uint32_t)(((uint32_t)(x))<<DMA_DCR_LINKCC_SHIFT))&DMA_DCR_LINKCC_MASK)
-#define DMA_DCR_D_REQ_MASK                       0x80u
-#define DMA_DCR_D_REQ_SHIFT                      7
-#define DMA_DCR_DMOD_MASK                        0xF00u
-#define DMA_DCR_DMOD_SHIFT                       8
-#define DMA_DCR_DMOD(x)                          (((uint32_t)(((uint32_t)(x))<<DMA_DCR_DMOD_SHIFT))&DMA_DCR_DMOD_MASK)
-#define DMA_DCR_SMOD_MASK                        0xF000u
-#define DMA_DCR_SMOD_SHIFT                       12
-#define DMA_DCR_SMOD(x)                          (((uint32_t)(((uint32_t)(x))<<DMA_DCR_SMOD_SHIFT))&DMA_DCR_SMOD_MASK)
-#define DMA_DCR_START_MASK                       0x10000u
-#define DMA_DCR_START_SHIFT                      16
-#define DMA_DCR_DSIZE_MASK                       0x60000u
-#define DMA_DCR_DSIZE_SHIFT                      17
-#define DMA_DCR_DSIZE(x)                         (((uint32_t)(((uint32_t)(x))<<DMA_DCR_DSIZE_SHIFT))&DMA_DCR_DSIZE_MASK)
-#define DMA_DCR_DINC_MASK                        0x80000u
-#define DMA_DCR_DINC_SHIFT                       19
-#define DMA_DCR_SSIZE_MASK                       0x300000u
-#define DMA_DCR_SSIZE_SHIFT                      20
-#define DMA_DCR_SSIZE(x)                         (((uint32_t)(((uint32_t)(x))<<DMA_DCR_SSIZE_SHIFT))&DMA_DCR_SSIZE_MASK)
-#define DMA_DCR_SINC_MASK                        0x400000u
-#define DMA_DCR_SINC_SHIFT                       22
-#define DMA_DCR_EADREQ_MASK                      0x800000u
-#define DMA_DCR_EADREQ_SHIFT                     23
-#define DMA_DCR_AA_MASK                          0x10000000u
-#define DMA_DCR_AA_SHIFT                         28
-#define DMA_DCR_CS_MASK                          0x20000000u
-#define DMA_DCR_CS_SHIFT                         29
-#define DMA_DCR_ERQ_MASK                         0x40000000u
-#define DMA_DCR_ERQ_SHIFT                        30
-#define DMA_DCR_EINT_MASK                        0x80000000u
-#define DMA_DCR_EINT_SHIFT                       31
-
-/**
- * @}
- */ /* end of group DMA_Register_Masks */
-
-
-/* DMA - Peripheral instance base addresses */
-/** Peripheral DMA base address */
-#define DMA_BASE                                 (0x40008000u)
-/** Peripheral DMA base pointer */
-#define DMA0                                     ((DMA_Type *)DMA_BASE)
-/** Array initializer of DMA peripheral base pointers */
-#define DMA_BASES                                { DMA0 }
-
-/**
- * @}
- */ /* end of group DMA_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- DMAMUX Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup DMAMUX_Peripheral_Access_Layer DMAMUX Peripheral Access Layer
- * @{
- */
-
-/** DMAMUX - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t CHCFG[4];                           /**< Channel Configuration register, array offset: 0x0, array step: 0x1 */
-} DMAMUX_Type;
-
-/* ----------------------------------------------------------------------------
-   -- DMAMUX Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup DMAMUX_Register_Masks DMAMUX Register Masks
- * @{
- */
-
-/* CHCFG Bit Fields */
-#define DMAMUX_CHCFG_SOURCE_MASK                 0x3Fu
-#define DMAMUX_CHCFG_SOURCE_SHIFT                0
-#define DMAMUX_CHCFG_SOURCE(x)                   (((uint8_t)(((uint8_t)(x))<<DMAMUX_CHCFG_SOURCE_SHIFT))&DMAMUX_CHCFG_SOURCE_MASK)
-#define DMAMUX_CHCFG_TRIG_MASK                   0x40u
-#define DMAMUX_CHCFG_TRIG_SHIFT                  6
-#define DMAMUX_CHCFG_ENBL_MASK                   0x80u
-#define DMAMUX_CHCFG_ENBL_SHIFT                  7
-
-/**
- * @}
- */ /* end of group DMAMUX_Register_Masks */
-
-
-/* DMAMUX - Peripheral instance base addresses */
-/** Peripheral DMAMUX0 base address */
-#define DMAMUX0_BASE                             (0x40021000u)
-/** Peripheral DMAMUX0 base pointer */
-#define DMAMUX0                                  ((DMAMUX_Type *)DMAMUX0_BASE)
-/** Array initializer of DMAMUX peripheral base pointers */
-#define DMAMUX_BASES                             { DMAMUX0 }
-
-/**
- * @}
- */ /* end of group DMAMUX_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- FGPIO Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup FGPIO_Peripheral_Access_Layer FGPIO Peripheral Access Layer
- * @{
- */
-
-/** FGPIO - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t PDOR;                              /**< Port Data Output Register, offset: 0x0 */
-  __O  uint32_t PSOR;                              /**< Port Set Output Register, offset: 0x4 */
-  __O  uint32_t PCOR;                              /**< Port Clear Output Register, offset: 0x8 */
-  __O  uint32_t PTOR;                              /**< Port Toggle Output Register, offset: 0xC */
-  __I  uint32_t PDIR;                              /**< Port Data Input Register, offset: 0x10 */
-  __IO uint32_t PDDR;                              /**< Port Data Direction Register, offset: 0x14 */
-} FGPIO_Type;
-
-/* ----------------------------------------------------------------------------
-   -- FGPIO Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup FGPIO_Register_Masks FGPIO Register Masks
- * @{
- */
-
-/* PDOR Bit Fields */
-#define FGPIO_PDOR_PDO_MASK                      0xFFFFFFFFu
-#define FGPIO_PDOR_PDO_SHIFT                     0
-#define FGPIO_PDOR_PDO(x)                        (((uint32_t)(((uint32_t)(x))<<FGPIO_PDOR_PDO_SHIFT))&FGPIO_PDOR_PDO_MASK)
-/* PSOR Bit Fields */
-#define FGPIO_PSOR_PTSO_MASK                     0xFFFFFFFFu
-#define FGPIO_PSOR_PTSO_SHIFT                    0
-#define FGPIO_PSOR_PTSO(x)                       (((uint32_t)(((uint32_t)(x))<<FGPIO_PSOR_PTSO_SHIFT))&FGPIO_PSOR_PTSO_MASK)
-/* PCOR Bit Fields */
-#define FGPIO_PCOR_PTCO_MASK                     0xFFFFFFFFu
-#define FGPIO_PCOR_PTCO_SHIFT                    0
-#define FGPIO_PCOR_PTCO(x)                       (((uint32_t)(((uint32_t)(x))<<FGPIO_PCOR_PTCO_SHIFT))&FGPIO_PCOR_PTCO_MASK)
-/* PTOR Bit Fields */
-#define FGPIO_PTOR_PTTO_MASK                     0xFFFFFFFFu
-#define FGPIO_PTOR_PTTO_SHIFT                    0
-#define FGPIO_PTOR_PTTO(x)                       (((uint32_t)(((uint32_t)(x))<<FGPIO_PTOR_PTTO_SHIFT))&FGPIO_PTOR_PTTO_MASK)
-/* PDIR Bit Fields */
-#define FGPIO_PDIR_PDI_MASK                      0xFFFFFFFFu
-#define FGPIO_PDIR_PDI_SHIFT                     0
-#define FGPIO_PDIR_PDI(x)                        (((uint32_t)(((uint32_t)(x))<<FGPIO_PDIR_PDI_SHIFT))&FGPIO_PDIR_PDI_MASK)
-/* PDDR Bit Fields */
-#define FGPIO_PDDR_PDD_MASK                      0xFFFFFFFFu
-#define FGPIO_PDDR_PDD_SHIFT                     0
-#define FGPIO_PDDR_PDD(x)                        (((uint32_t)(((uint32_t)(x))<<FGPIO_PDDR_PDD_SHIFT))&FGPIO_PDDR_PDD_MASK)
-
-/**
- * @}
- */ /* end of group FGPIO_Register_Masks */
-
-
-/* FGPIO - Peripheral instance base addresses */
-/** Peripheral FPTA base address */
-#define FPTA_BASE                                (0xF80FF000u)
-/** Peripheral FPTA base pointer */
-#define FPTA                                     ((FGPIO_Type *)FPTA_BASE)
-/** Peripheral FPTB base address */
-#define FPTB_BASE                                (0xF80FF040u)
-/** Peripheral FPTB base pointer */
-#define FPTB                                     ((FGPIO_Type *)FPTB_BASE)
-/** Array initializer of FGPIO peripheral base pointers */
-#define FGPIO_BASES                              { FPTA, FPTB }
-
-/**
- * @}
- */ /* end of group FGPIO_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- FTFA Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup FTFA_Peripheral_Access_Layer FTFA Peripheral Access Layer
- * @{
- */
-
-/** FTFA - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t FSTAT;                              /**< Flash Status Register, offset: 0x0 */
-  __IO uint8_t FCNFG;                              /**< Flash Configuration Register, offset: 0x1 */
-  __I  uint8_t FSEC;                               /**< Flash Security Register, offset: 0x2 */
-  __I  uint8_t FOPT;                               /**< Flash Option Register, offset: 0x3 */
-  __IO uint8_t FCCOB3;                             /**< Flash Common Command Object Registers, offset: 0x4 */
-  __IO uint8_t FCCOB2;                             /**< Flash Common Command Object Registers, offset: 0x5 */
-  __IO uint8_t FCCOB1;                             /**< Flash Common Command Object Registers, offset: 0x6 */
-  __IO uint8_t FCCOB0;                             /**< Flash Common Command Object Registers, offset: 0x7 */
-  __IO uint8_t FCCOB7;                             /**< Flash Common Command Object Registers, offset: 0x8 */
-  __IO uint8_t FCCOB6;                             /**< Flash Common Command Object Registers, offset: 0x9 */
-  __IO uint8_t FCCOB5;                             /**< Flash Common Command Object Registers, offset: 0xA */
-  __IO uint8_t FCCOB4;                             /**< Flash Common Command Object Registers, offset: 0xB */
-  __IO uint8_t FCCOBB;                             /**< Flash Common Command Object Registers, offset: 0xC */
-  __IO uint8_t FCCOBA;                             /**< Flash Common Command Object Registers, offset: 0xD */
-  __IO uint8_t FCCOB9;                             /**< Flash Common Command Object Registers, offset: 0xE */
-  __IO uint8_t FCCOB8;                             /**< Flash Common Command Object Registers, offset: 0xF */
-  __IO uint8_t FPROT3;                             /**< Program Flash Protection Registers, offset: 0x10 */
-  __IO uint8_t FPROT2;                             /**< Program Flash Protection Registers, offset: 0x11 */
-  __IO uint8_t FPROT1;                             /**< Program Flash Protection Registers, offset: 0x12 */
-  __IO uint8_t FPROT0;                             /**< Program Flash Protection Registers, offset: 0x13 */
-} FTFA_Type;
-
-/* ----------------------------------------------------------------------------
-   -- FTFA Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup FTFA_Register_Masks FTFA Register Masks
- * @{
- */
-
-/* FSTAT Bit Fields */
-#define FTFA_FSTAT_MGSTAT0_MASK                  0x1u
-#define FTFA_FSTAT_MGSTAT0_SHIFT                 0
-#define FTFA_FSTAT_FPVIOL_MASK                   0x10u
-#define FTFA_FSTAT_FPVIOL_SHIFT                  4
-#define FTFA_FSTAT_ACCERR_MASK                   0x20u
-#define FTFA_FSTAT_ACCERR_SHIFT                  5
-#define FTFA_FSTAT_RDCOLERR_MASK                 0x40u
-#define FTFA_FSTAT_RDCOLERR_SHIFT                6
-#define FTFA_FSTAT_CCIF_MASK                     0x80u
-#define FTFA_FSTAT_CCIF_SHIFT                    7
-/* FCNFG Bit Fields */
-#define FTFA_FCNFG_ERSSUSP_MASK                  0x10u
-#define FTFA_FCNFG_ERSSUSP_SHIFT                 4
-#define FTFA_FCNFG_ERSAREQ_MASK                  0x20u
-#define FTFA_FCNFG_ERSAREQ_SHIFT                 5
-#define FTFA_FCNFG_RDCOLLIE_MASK                 0x40u
-#define FTFA_FCNFG_RDCOLLIE_SHIFT                6
-#define FTFA_FCNFG_CCIE_MASK                     0x80u
-#define FTFA_FCNFG_CCIE_SHIFT                    7
-/* FSEC Bit Fields */
-#define FTFA_FSEC_SEC_MASK                       0x3u
-#define FTFA_FSEC_SEC_SHIFT                      0
-#define FTFA_FSEC_SEC(x)                         (((uint8_t)(((uint8_t)(x))<<FTFA_FSEC_SEC_SHIFT))&FTFA_FSEC_SEC_MASK)
-#define FTFA_FSEC_FSLACC_MASK                    0xCu
-#define FTFA_FSEC_FSLACC_SHIFT                   2
-#define FTFA_FSEC_FSLACC(x)                      (((uint8_t)(((uint8_t)(x))<<FTFA_FSEC_FSLACC_SHIFT))&FTFA_FSEC_FSLACC_MASK)
-#define FTFA_FSEC_MEEN_MASK                      0x30u
-#define FTFA_FSEC_MEEN_SHIFT                     4
-#define FTFA_FSEC_MEEN(x)                        (((uint8_t)(((uint8_t)(x))<<FTFA_FSEC_MEEN_SHIFT))&FTFA_FSEC_MEEN_MASK)
-#define FTFA_FSEC_KEYEN_MASK                     0xC0u
-#define FTFA_FSEC_KEYEN_SHIFT                    6
-#define FTFA_FSEC_KEYEN(x)                       (((uint8_t)(((uint8_t)(x))<<FTFA_FSEC_KEYEN_SHIFT))&FTFA_FSEC_KEYEN_MASK)
-/* FOPT Bit Fields */
-#define FTFA_FOPT_OPT_MASK                       0xFFu
-#define FTFA_FOPT_OPT_SHIFT                      0
-#define FTFA_FOPT_OPT(x)                         (((uint8_t)(((uint8_t)(x))<<FTFA_FOPT_OPT_SHIFT))&FTFA_FOPT_OPT_MASK)
-/* FCCOB3 Bit Fields */
-#define FTFA_FCCOB3_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB3_CCOBn_SHIFT                  0
-#define FTFA_FCCOB3_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB3_CCOBn_SHIFT))&FTFA_FCCOB3_CCOBn_MASK)
-/* FCCOB2 Bit Fields */
-#define FTFA_FCCOB2_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB2_CCOBn_SHIFT                  0
-#define FTFA_FCCOB2_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB2_CCOBn_SHIFT))&FTFA_FCCOB2_CCOBn_MASK)
-/* FCCOB1 Bit Fields */
-#define FTFA_FCCOB1_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB1_CCOBn_SHIFT                  0
-#define FTFA_FCCOB1_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB1_CCOBn_SHIFT))&FTFA_FCCOB1_CCOBn_MASK)
-/* FCCOB0 Bit Fields */
-#define FTFA_FCCOB0_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB0_CCOBn_SHIFT                  0
-#define FTFA_FCCOB0_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB0_CCOBn_SHIFT))&FTFA_FCCOB0_CCOBn_MASK)
-/* FCCOB7 Bit Fields */
-#define FTFA_FCCOB7_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB7_CCOBn_SHIFT                  0
-#define FTFA_FCCOB7_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB7_CCOBn_SHIFT))&FTFA_FCCOB7_CCOBn_MASK)
-/* FCCOB6 Bit Fields */
-#define FTFA_FCCOB6_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB6_CCOBn_SHIFT                  0
-#define FTFA_FCCOB6_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB6_CCOBn_SHIFT))&FTFA_FCCOB6_CCOBn_MASK)
-/* FCCOB5 Bit Fields */
-#define FTFA_FCCOB5_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB5_CCOBn_SHIFT                  0
-#define FTFA_FCCOB5_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB5_CCOBn_SHIFT))&FTFA_FCCOB5_CCOBn_MASK)
-/* FCCOB4 Bit Fields */
-#define FTFA_FCCOB4_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB4_CCOBn_SHIFT                  0
-#define FTFA_FCCOB4_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB4_CCOBn_SHIFT))&FTFA_FCCOB4_CCOBn_MASK)
-/* FCCOBB Bit Fields */
-#define FTFA_FCCOBB_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOBB_CCOBn_SHIFT                  0
-#define FTFA_FCCOBB_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOBB_CCOBn_SHIFT))&FTFA_FCCOBB_CCOBn_MASK)
-/* FCCOBA Bit Fields */
-#define FTFA_FCCOBA_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOBA_CCOBn_SHIFT                  0
-#define FTFA_FCCOBA_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOBA_CCOBn_SHIFT))&FTFA_FCCOBA_CCOBn_MASK)
-/* FCCOB9 Bit Fields */
-#define FTFA_FCCOB9_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB9_CCOBn_SHIFT                  0
-#define FTFA_FCCOB9_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB9_CCOBn_SHIFT))&FTFA_FCCOB9_CCOBn_MASK)
-/* FCCOB8 Bit Fields */
-#define FTFA_FCCOB8_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB8_CCOBn_SHIFT                  0
-#define FTFA_FCCOB8_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB8_CCOBn_SHIFT))&FTFA_FCCOB8_CCOBn_MASK)
-/* FPROT3 Bit Fields */
-#define FTFA_FPROT3_PROT_MASK                    0xFFu
-#define FTFA_FPROT3_PROT_SHIFT                   0
-#define FTFA_FPROT3_PROT(x)                      (((uint8_t)(((uint8_t)(x))<<FTFA_FPROT3_PROT_SHIFT))&FTFA_FPROT3_PROT_MASK)
-/* FPROT2 Bit Fields */
-#define FTFA_FPROT2_PROT_MASK                    0xFFu
-#define FTFA_FPROT2_PROT_SHIFT                   0
-#define FTFA_FPROT2_PROT(x)                      (((uint8_t)(((uint8_t)(x))<<FTFA_FPROT2_PROT_SHIFT))&FTFA_FPROT2_PROT_MASK)
-/* FPROT1 Bit Fields */
-#define FTFA_FPROT1_PROT_MASK                    0xFFu
-#define FTFA_FPROT1_PROT_SHIFT                   0
-#define FTFA_FPROT1_PROT(x)                      (((uint8_t)(((uint8_t)(x))<<FTFA_FPROT1_PROT_SHIFT))&FTFA_FPROT1_PROT_MASK)
-/* FPROT0 Bit Fields */
-#define FTFA_FPROT0_PROT_MASK                    0xFFu
-#define FTFA_FPROT0_PROT_SHIFT                   0
-#define FTFA_FPROT0_PROT(x)                      (((uint8_t)(((uint8_t)(x))<<FTFA_FPROT0_PROT_SHIFT))&FTFA_FPROT0_PROT_MASK)
-
-/**
- * @}
- */ /* end of group FTFA_Register_Masks */
-
-
-/* FTFA - Peripheral instance base addresses */
-/** Peripheral FTFA base address */
-#define FTFA_BASE                                (0x40020000u)
-/** Peripheral FTFA base pointer */
-#define FTFA                                     ((FTFA_Type *)FTFA_BASE)
-/** Array initializer of FTFA peripheral base pointers */
-#define FTFA_BASES                               { FTFA }
-
-/**
- * @}
- */ /* end of group FTFA_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- GPIO Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup GPIO_Peripheral_Access_Layer GPIO Peripheral Access Layer
- * @{
- */
-
-/** GPIO - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t PDOR;                              /**< Port Data Output Register, offset: 0x0 */
-  __O  uint32_t PSOR;                              /**< Port Set Output Register, offset: 0x4 */
-  __O  uint32_t PCOR;                              /**< Port Clear Output Register, offset: 0x8 */
-  __O  uint32_t PTOR;                              /**< Port Toggle Output Register, offset: 0xC */
-  __I  uint32_t PDIR;                              /**< Port Data Input Register, offset: 0x10 */
-  __IO uint32_t PDDR;                              /**< Port Data Direction Register, offset: 0x14 */
-} GPIO_Type;
-
-/* ----------------------------------------------------------------------------
-   -- GPIO Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup GPIO_Register_Masks GPIO Register Masks
- * @{
- */
-
-/* PDOR Bit Fields */
-#define GPIO_PDOR_PDO_MASK                       0xFFFFFFFFu
-#define GPIO_PDOR_PDO_SHIFT                      0
-#define GPIO_PDOR_PDO(x)                         (((uint32_t)(((uint32_t)(x))<<GPIO_PDOR_PDO_SHIFT))&GPIO_PDOR_PDO_MASK)
-/* PSOR Bit Fields */
-#define GPIO_PSOR_PTSO_MASK                      0xFFFFFFFFu
-#define GPIO_PSOR_PTSO_SHIFT                     0
-#define GPIO_PSOR_PTSO(x)                        (((uint32_t)(((uint32_t)(x))<<GPIO_PSOR_PTSO_SHIFT))&GPIO_PSOR_PTSO_MASK)
-/* PCOR Bit Fields */
-#define GPIO_PCOR_PTCO_MASK                      0xFFFFFFFFu
-#define GPIO_PCOR_PTCO_SHIFT                     0
-#define GPIO_PCOR_PTCO(x)                        (((uint32_t)(((uint32_t)(x))<<GPIO_PCOR_PTCO_SHIFT))&GPIO_PCOR_PTCO_MASK)
-/* PTOR Bit Fields */
-#define GPIO_PTOR_PTTO_MASK                      0xFFFFFFFFu
-#define GPIO_PTOR_PTTO_SHIFT                     0
-#define GPIO_PTOR_PTTO(x)                        (((uint32_t)(((uint32_t)(x))<<GPIO_PTOR_PTTO_SHIFT))&GPIO_PTOR_PTTO_MASK)
-/* PDIR Bit Fields */
-#define GPIO_PDIR_PDI_MASK                       0xFFFFFFFFu
-#define GPIO_PDIR_PDI_SHIFT                      0
-#define GPIO_PDIR_PDI(x)                         (((uint32_t)(((uint32_t)(x))<<GPIO_PDIR_PDI_SHIFT))&GPIO_PDIR_PDI_MASK)
-/* PDDR Bit Fields */
-#define GPIO_PDDR_PDD_MASK                       0xFFFFFFFFu
-#define GPIO_PDDR_PDD_SHIFT                      0
-#define GPIO_PDDR_PDD(x)                         (((uint32_t)(((uint32_t)(x))<<GPIO_PDDR_PDD_SHIFT))&GPIO_PDDR_PDD_MASK)
-
-/**
- * @}
- */ /* end of group GPIO_Register_Masks */
-
-
-/* GPIO - Peripheral instance base addresses */
-/** Peripheral PTA base address */
-#define PTA_BASE                                 (0x400FF000u)
-/** Peripheral PTA base pointer */
-#define PTA                                      ((GPIO_Type *)PTA_BASE)
-/** Peripheral PTB base address */
-#define PTB_BASE                                 (0x400FF040u)
-/** Peripheral PTB base pointer */
-#define PTB                                      ((GPIO_Type *)PTB_BASE)
-/** Array initializer of GPIO peripheral base pointers */
-#define GPIO_BASES                               { PTA, PTB }
-
-/**
- * @}
- */ /* end of group GPIO_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- I2C Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup I2C_Peripheral_Access_Layer I2C Peripheral Access Layer
- * @{
- */
-
-/** I2C - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t A1;                                 /**< I2C Address Register 1, offset: 0x0 */
-  __IO uint8_t F;                                  /**< I2C Frequency Divider register, offset: 0x1 */
-  __IO uint8_t C1;                                 /**< I2C Control Register 1, offset: 0x2 */
-  __IO uint8_t S;                                  /**< I2C Status register, offset: 0x3 */
-  __IO uint8_t D;                                  /**< I2C Data I/O register, offset: 0x4 */
-  __IO uint8_t C2;                                 /**< I2C Control Register 2, offset: 0x5 */
-  __IO uint8_t FLT;                                /**< I2C Programmable Input Glitch Filter register, offset: 0x6 */
-  __IO uint8_t RA;                                 /**< I2C Range Address register, offset: 0x7 */
-  __IO uint8_t SMB;                                /**< I2C SMBus Control and Status register, offset: 0x8 */
-  __IO uint8_t A2;                                 /**< I2C Address Register 2, offset: 0x9 */
-  __IO uint8_t SLTH;                               /**< I2C SCL Low Timeout Register High, offset: 0xA */
-  __IO uint8_t SLTL;                               /**< I2C SCL Low Timeout Register Low, offset: 0xB */
-} I2C_Type;
-
-/* ----------------------------------------------------------------------------
-   -- I2C Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup I2C_Register_Masks I2C Register Masks
- * @{
- */
-
-/* A1 Bit Fields */
-#define I2C_A1_AD_MASK                           0xFEu
-#define I2C_A1_AD_SHIFT                          1
-#define I2C_A1_AD(x)                             (((uint8_t)(((uint8_t)(x))<<I2C_A1_AD_SHIFT))&I2C_A1_AD_MASK)
-/* F Bit Fields */
-#define I2C_F_ICR_MASK                           0x3Fu
-#define I2C_F_ICR_SHIFT                          0
-#define I2C_F_ICR(x)                             (((uint8_t)(((uint8_t)(x))<<I2C_F_ICR_SHIFT))&I2C_F_ICR_MASK)
-#define I2C_F_MULT_MASK                          0xC0u
-#define I2C_F_MULT_SHIFT                         6
-#define I2C_F_MULT(x)                            (((uint8_t)(((uint8_t)(x))<<I2C_F_MULT_SHIFT))&I2C_F_MULT_MASK)
-/* C1 Bit Fields */
-#define I2C_C1_DMAEN_MASK                        0x1u
-#define I2C_C1_DMAEN_SHIFT                       0
-#define I2C_C1_WUEN_MASK                         0x2u
-#define I2C_C1_WUEN_SHIFT                        1
-#define I2C_C1_RSTA_MASK                         0x4u
-#define I2C_C1_RSTA_SHIFT                        2
-#define I2C_C1_TXAK_MASK                         0x8u
-#define I2C_C1_TXAK_SHIFT                        3
-#define I2C_C1_TX_MASK                           0x10u
-#define I2C_C1_TX_SHIFT                          4
-#define I2C_C1_MST_MASK                          0x20u
-#define I2C_C1_MST_SHIFT                         5
-#define I2C_C1_IICIE_MASK                        0x40u
-#define I2C_C1_IICIE_SHIFT                       6
-#define I2C_C1_IICEN_MASK                        0x80u
-#define I2C_C1_IICEN_SHIFT                       7
-/* S Bit Fields */
-#define I2C_S_RXAK_MASK                          0x1u
-#define I2C_S_RXAK_SHIFT                         0
-#define I2C_S_IICIF_MASK                         0x2u
-#define I2C_S_IICIF_SHIFT                        1
-#define I2C_S_SRW_MASK                           0x4u
-#define I2C_S_SRW_SHIFT                          2
-#define I2C_S_RAM_MASK                           0x8u
-#define I2C_S_RAM_SHIFT                          3
-#define I2C_S_ARBL_MASK                          0x10u
-#define I2C_S_ARBL_SHIFT                         4
-#define I2C_S_BUSY_MASK                          0x20u
-#define I2C_S_BUSY_SHIFT                         5
-#define I2C_S_IAAS_MASK                          0x40u
-#define I2C_S_IAAS_SHIFT                         6
-#define I2C_S_TCF_MASK                           0x80u
-#define I2C_S_TCF_SHIFT                          7
-/* D Bit Fields */
-#define I2C_D_DATA_MASK                          0xFFu
-#define I2C_D_DATA_SHIFT                         0
-#define I2C_D_DATA(x)                            (((uint8_t)(((uint8_t)(x))<<I2C_D_DATA_SHIFT))&I2C_D_DATA_MASK)
-/* C2 Bit Fields */
-#define I2C_C2_AD_MASK                           0x7u
-#define I2C_C2_AD_SHIFT                          0
-#define I2C_C2_AD(x)                             (((uint8_t)(((uint8_t)(x))<<I2C_C2_AD_SHIFT))&I2C_C2_AD_MASK)
-#define I2C_C2_RMEN_MASK                         0x8u
-#define I2C_C2_RMEN_SHIFT                        3
-#define I2C_C2_SBRC_MASK                         0x10u
-#define I2C_C2_SBRC_SHIFT                        4
-#define I2C_C2_HDRS_MASK                         0x20u
-#define I2C_C2_HDRS_SHIFT                        5
-#define I2C_C2_ADEXT_MASK                        0x40u
-#define I2C_C2_ADEXT_SHIFT                       6
-#define I2C_C2_GCAEN_MASK                        0x80u
-#define I2C_C2_GCAEN_SHIFT                       7
-/* FLT Bit Fields */
-#define I2C_FLT_FLT_MASK                         0x1Fu
-#define I2C_FLT_FLT_SHIFT                        0
-#define I2C_FLT_FLT(x)                           (((uint8_t)(((uint8_t)(x))<<I2C_FLT_FLT_SHIFT))&I2C_FLT_FLT_MASK)
-#define I2C_FLT_STOPIE_MASK                      0x20u
-#define I2C_FLT_STOPIE_SHIFT                     5
-#define I2C_FLT_STOPF_MASK                       0x40u
-#define I2C_FLT_STOPF_SHIFT                      6
-#define I2C_FLT_SHEN_MASK                        0x80u
-#define I2C_FLT_SHEN_SHIFT                       7
-/* RA Bit Fields */
-#define I2C_RA_RAD_MASK                          0xFEu
-#define I2C_RA_RAD_SHIFT                         1
-#define I2C_RA_RAD(x)                            (((uint8_t)(((uint8_t)(x))<<I2C_RA_RAD_SHIFT))&I2C_RA_RAD_MASK)
-/* SMB Bit Fields */
-#define I2C_SMB_SHTF2IE_MASK                     0x1u
-#define I2C_SMB_SHTF2IE_SHIFT                    0
-#define I2C_SMB_SHTF2_MASK                       0x2u
-#define I2C_SMB_SHTF2_SHIFT                      1
-#define I2C_SMB_SHTF1_MASK                       0x4u
-#define I2C_SMB_SHTF1_SHIFT                      2
-#define I2C_SMB_SLTF_MASK                        0x8u
-#define I2C_SMB_SLTF_SHIFT                       3
-#define I2C_SMB_TCKSEL_MASK                      0x10u
-#define I2C_SMB_TCKSEL_SHIFT                     4
-#define I2C_SMB_SIICAEN_MASK                     0x20u
-#define I2C_SMB_SIICAEN_SHIFT                    5
-#define I2C_SMB_ALERTEN_MASK                     0x40u
-#define I2C_SMB_ALERTEN_SHIFT                    6
-#define I2C_SMB_FACK_MASK                        0x80u
-#define I2C_SMB_FACK_SHIFT                       7
-/* A2 Bit Fields */
-#define I2C_A2_SAD_MASK                          0xFEu
-#define I2C_A2_SAD_SHIFT                         1
-#define I2C_A2_SAD(x)                            (((uint8_t)(((uint8_t)(x))<<I2C_A2_SAD_SHIFT))&I2C_A2_SAD_MASK)
-/* SLTH Bit Fields */
-#define I2C_SLTH_SSLT_MASK                       0xFFu
-#define I2C_SLTH_SSLT_SHIFT                      0
-#define I2C_SLTH_SSLT(x)                         (((uint8_t)(((uint8_t)(x))<<I2C_SLTH_SSLT_SHIFT))&I2C_SLTH_SSLT_MASK)
-/* SLTL Bit Fields */
-#define I2C_SLTL_SSLT_MASK                       0xFFu
-#define I2C_SLTL_SSLT_SHIFT                      0
-#define I2C_SLTL_SSLT(x)                         (((uint8_t)(((uint8_t)(x))<<I2C_SLTL_SSLT_SHIFT))&I2C_SLTL_SSLT_MASK)
-
-/**
- * @}
- */ /* end of group I2C_Register_Masks */
-
-
-/* I2C - Peripheral instance base addresses */
-/** Peripheral I2C0 base address */
-#define I2C0_BASE                                (0x40066000u)
-/** Peripheral I2C0 base pointer */
-#define I2C0                                     ((I2C_Type *)I2C0_BASE)
-/** Array initializer of I2C peripheral base pointers */
-#define I2C_BASES                                { I2C0 }
-
-/**
- * @}
- */ /* end of group I2C_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- LLWU Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup LLWU_Peripheral_Access_Layer LLWU Peripheral Access Layer
- * @{
- */
-
-/** LLWU - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t PE1;                                /**< LLWU Pin Enable 1 register, offset: 0x0 */
-  __IO uint8_t PE2;                                /**< LLWU Pin Enable 2 register, offset: 0x1 */
-  __IO uint8_t ME;                                 /**< LLWU Module Enable register, offset: 0x2 */
-  __IO uint8_t F1;                                 /**< LLWU Flag 1 register, offset: 0x3 */
-  __I  uint8_t F3;                                 /**< LLWU Flag 3 register, offset: 0x4 */
-  __IO uint8_t FILT1;                              /**< LLWU Pin Filter 1 register, offset: 0x5 */
-  __IO uint8_t FILT2;                              /**< LLWU Pin Filter 2 register, offset: 0x6 */
-} LLWU_Type;
-
-/* ----------------------------------------------------------------------------
-   -- LLWU Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup LLWU_Register_Masks LLWU Register Masks
- * @{
- */
-
-/* PE1 Bit Fields */
-#define LLWU_PE1_WUPE0_MASK                      0x3u
-#define LLWU_PE1_WUPE0_SHIFT                     0
-#define LLWU_PE1_WUPE0(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE1_WUPE0_SHIFT))&LLWU_PE1_WUPE0_MASK)
-#define LLWU_PE1_WUPE1_MASK                      0xCu
-#define LLWU_PE1_WUPE1_SHIFT                     2
-#define LLWU_PE1_WUPE1(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE1_WUPE1_SHIFT))&LLWU_PE1_WUPE1_MASK)
-#define LLWU_PE1_WUPE2_MASK                      0x30u
-#define LLWU_PE1_WUPE2_SHIFT                     4
-#define LLWU_PE1_WUPE2(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE1_WUPE2_SHIFT))&LLWU_PE1_WUPE2_MASK)
-#define LLWU_PE1_WUPE3_MASK                      0xC0u
-#define LLWU_PE1_WUPE3_SHIFT                     6
-#define LLWU_PE1_WUPE3(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE1_WUPE3_SHIFT))&LLWU_PE1_WUPE3_MASK)
-/* PE2 Bit Fields */
-#define LLWU_PE2_WUPE4_MASK                      0x3u
-#define LLWU_PE2_WUPE4_SHIFT                     0
-#define LLWU_PE2_WUPE4(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE2_WUPE4_SHIFT))&LLWU_PE2_WUPE4_MASK)
-#define LLWU_PE2_WUPE5_MASK                      0xCu
-#define LLWU_PE2_WUPE5_SHIFT                     2
-#define LLWU_PE2_WUPE5(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE2_WUPE5_SHIFT))&LLWU_PE2_WUPE5_MASK)
-#define LLWU_PE2_WUPE6_MASK                      0x30u
-#define LLWU_PE2_WUPE6_SHIFT                     4
-#define LLWU_PE2_WUPE6(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE2_WUPE6_SHIFT))&LLWU_PE2_WUPE6_MASK)
-#define LLWU_PE2_WUPE7_MASK                      0xC0u
-#define LLWU_PE2_WUPE7_SHIFT                     6
-#define LLWU_PE2_WUPE7(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE2_WUPE7_SHIFT))&LLWU_PE2_WUPE7_MASK)
-/* ME Bit Fields */
-#define LLWU_ME_WUME0_MASK                       0x1u
-#define LLWU_ME_WUME0_SHIFT                      0
-#define LLWU_ME_WUME1_MASK                       0x2u
-#define LLWU_ME_WUME1_SHIFT                      1
-#define LLWU_ME_WUME2_MASK                       0x4u
-#define LLWU_ME_WUME2_SHIFT                      2
-#define LLWU_ME_WUME3_MASK                       0x8u
-#define LLWU_ME_WUME3_SHIFT                      3
-#define LLWU_ME_WUME4_MASK                       0x10u
-#define LLWU_ME_WUME4_SHIFT                      4
-#define LLWU_ME_WUME5_MASK                       0x20u
-#define LLWU_ME_WUME5_SHIFT                      5
-#define LLWU_ME_WUME6_MASK                       0x40u
-#define LLWU_ME_WUME6_SHIFT                      6
-#define LLWU_ME_WUME7_MASK                       0x80u
-#define LLWU_ME_WUME7_SHIFT                      7
-/* F1 Bit Fields */
-#define LLWU_F1_WUF0_MASK                        0x1u
-#define LLWU_F1_WUF0_SHIFT                       0
-#define LLWU_F1_WUF1_MASK                        0x2u
-#define LLWU_F1_WUF1_SHIFT                       1
-#define LLWU_F1_WUF2_MASK                        0x4u
-#define LLWU_F1_WUF2_SHIFT                       2
-#define LLWU_F1_WUF3_MASK                        0x8u
-#define LLWU_F1_WUF3_SHIFT                       3
-#define LLWU_F1_WUF4_MASK                        0x10u
-#define LLWU_F1_WUF4_SHIFT                       4
-#define LLWU_F1_WUF5_MASK                        0x20u
-#define LLWU_F1_WUF5_SHIFT                       5
-#define LLWU_F1_WUF6_MASK                        0x40u
-#define LLWU_F1_WUF6_SHIFT                       6
-#define LLWU_F1_WUF7_MASK                        0x80u
-#define LLWU_F1_WUF7_SHIFT                       7
-/* F3 Bit Fields */
-#define LLWU_F3_MWUF0_MASK                       0x1u
-#define LLWU_F3_MWUF0_SHIFT                      0
-#define LLWU_F3_MWUF1_MASK                       0x2u
-#define LLWU_F3_MWUF1_SHIFT                      1
-#define LLWU_F3_MWUF2_MASK                       0x4u
-#define LLWU_F3_MWUF2_SHIFT                      2
-#define LLWU_F3_MWUF3_MASK                       0x8u
-#define LLWU_F3_MWUF3_SHIFT                      3
-#define LLWU_F3_MWUF4_MASK                       0x10u
-#define LLWU_F3_MWUF4_SHIFT                      4
-#define LLWU_F3_MWUF5_MASK                       0x20u
-#define LLWU_F3_MWUF5_SHIFT                      5
-#define LLWU_F3_MWUF6_MASK                       0x40u
-#define LLWU_F3_MWUF6_SHIFT                      6
-#define LLWU_F3_MWUF7_MASK                       0x80u
-#define LLWU_F3_MWUF7_SHIFT                      7
-/* FILT1 Bit Fields */
-#define LLWU_FILT1_FILTSEL_MASK                  0xFu
-#define LLWU_FILT1_FILTSEL_SHIFT                 0
-#define LLWU_FILT1_FILTSEL(x)                    (((uint8_t)(((uint8_t)(x))<<LLWU_FILT1_FILTSEL_SHIFT))&LLWU_FILT1_FILTSEL_MASK)
-#define LLWU_FILT1_FILTE_MASK                    0x60u
-#define LLWU_FILT1_FILTE_SHIFT                   5
-#define LLWU_FILT1_FILTE(x)                      (((uint8_t)(((uint8_t)(x))<<LLWU_FILT1_FILTE_SHIFT))&LLWU_FILT1_FILTE_MASK)
-#define LLWU_FILT1_FILTF_MASK                    0x80u
-#define LLWU_FILT1_FILTF_SHIFT                   7
-/* FILT2 Bit Fields */
-#define LLWU_FILT2_FILTSEL_MASK                  0xFu
-#define LLWU_FILT2_FILTSEL_SHIFT                 0
-#define LLWU_FILT2_FILTSEL(x)                    (((uint8_t)(((uint8_t)(x))<<LLWU_FILT2_FILTSEL_SHIFT))&LLWU_FILT2_FILTSEL_MASK)
-#define LLWU_FILT2_FILTE_MASK                    0x60u
-#define LLWU_FILT2_FILTE_SHIFT                   5
-#define LLWU_FILT2_FILTE(x)                      (((uint8_t)(((uint8_t)(x))<<LLWU_FILT2_FILTE_SHIFT))&LLWU_FILT2_FILTE_MASK)
-#define LLWU_FILT2_FILTF_MASK                    0x80u
-#define LLWU_FILT2_FILTF_SHIFT                   7
-
-/**
- * @}
- */ /* end of group LLWU_Register_Masks */
-
-
-/* LLWU - Peripheral instance base addresses */
-/** Peripheral LLWU base address */
-#define LLWU_BASE                                (0x4007C000u)
-/** Peripheral LLWU base pointer */
-#define LLWU                                     ((LLWU_Type *)LLWU_BASE)
-/** Array initializer of LLWU peripheral base pointers */
-#define LLWU_BASES                               { LLWU }
-
-/**
- * @}
- */ /* end of group LLWU_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- LPTMR Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup LPTMR_Peripheral_Access_Layer LPTMR Peripheral Access Layer
- * @{
- */
-
-/** LPTMR - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t CSR;                               /**< Low Power Timer Control Status Register, offset: 0x0 */
-  __IO uint32_t PSR;                               /**< Low Power Timer Prescale Register, offset: 0x4 */
-  __IO uint32_t CMR;                               /**< Low Power Timer Compare Register, offset: 0x8 */
-  __I  uint32_t CNR;                               /**< Low Power Timer Counter Register, offset: 0xC */
-} LPTMR_Type;
-
-/* ----------------------------------------------------------------------------
-   -- LPTMR Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup LPTMR_Register_Masks LPTMR Register Masks
- * @{
- */
-
-/* CSR Bit Fields */
-#define LPTMR_CSR_TEN_MASK                       0x1u
-#define LPTMR_CSR_TEN_SHIFT                      0
-#define LPTMR_CSR_TMS_MASK                       0x2u
-#define LPTMR_CSR_TMS_SHIFT                      1
-#define LPTMR_CSR_TFC_MASK                       0x4u
-#define LPTMR_CSR_TFC_SHIFT                      2
-#define LPTMR_CSR_TPP_MASK                       0x8u
-#define LPTMR_CSR_TPP_SHIFT                      3
-#define LPTMR_CSR_TPS_MASK                       0x30u
-#define LPTMR_CSR_TPS_SHIFT                      4
-#define LPTMR_CSR_TPS(x)                         (((uint32_t)(((uint32_t)(x))<<LPTMR_CSR_TPS_SHIFT))&LPTMR_CSR_TPS_MASK)
-#define LPTMR_CSR_TIE_MASK                       0x40u
-#define LPTMR_CSR_TIE_SHIFT                      6
-#define LPTMR_CSR_TCF_MASK                       0x80u
-#define LPTMR_CSR_TCF_SHIFT                      7
-/* PSR Bit Fields */
-#define LPTMR_PSR_PCS_MASK                       0x3u
-#define LPTMR_PSR_PCS_SHIFT                      0
-#define LPTMR_PSR_PCS(x)                         (((uint32_t)(((uint32_t)(x))<<LPTMR_PSR_PCS_SHIFT))&LPTMR_PSR_PCS_MASK)
-#define LPTMR_PSR_PBYP_MASK                      0x4u
-#define LPTMR_PSR_PBYP_SHIFT                     2
-#define LPTMR_PSR_PRESCALE_MASK                  0x78u
-#define LPTMR_PSR_PRESCALE_SHIFT                 3
-#define LPTMR_PSR_PRESCALE(x)                    (((uint32_t)(((uint32_t)(x))<<LPTMR_PSR_PRESCALE_SHIFT))&LPTMR_PSR_PRESCALE_MASK)
-/* CMR Bit Fields */
-#define LPTMR_CMR_COMPARE_MASK                   0xFFFFu
-#define LPTMR_CMR_COMPARE_SHIFT                  0
-#define LPTMR_CMR_COMPARE(x)                     (((uint32_t)(((uint32_t)(x))<<LPTMR_CMR_COMPARE_SHIFT))&LPTMR_CMR_COMPARE_MASK)
-/* CNR Bit Fields */
-#define LPTMR_CNR_COUNTER_MASK                   0xFFFFu
-#define LPTMR_CNR_COUNTER_SHIFT                  0
-#define LPTMR_CNR_COUNTER(x)                     (((uint32_t)(((uint32_t)(x))<<LPTMR_CNR_COUNTER_SHIFT))&LPTMR_CNR_COUNTER_MASK)
-
-/**
- * @}
- */ /* end of group LPTMR_Register_Masks */
-
-
-/* LPTMR - Peripheral instance base addresses */
-/** Peripheral LPTMR0 base address */
-#define LPTMR0_BASE                              (0x40040000u)
-/** Peripheral LPTMR0 base pointer */
-#define LPTMR0                                   ((LPTMR_Type *)LPTMR0_BASE)
-/** Array initializer of LPTMR peripheral base pointers */
-#define LPTMR_BASES                              { LPTMR0 }
-
-/**
- * @}
- */ /* end of group LPTMR_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- MCG Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MCG_Peripheral_Access_Layer MCG Peripheral Access Layer
- * @{
- */
-
-/** MCG - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t C1;                                 /**< MCG Control 1 Register, offset: 0x0 */
-  __IO uint8_t C2;                                 /**< MCG Control 2 Register, offset: 0x1 */
-  __IO uint8_t C3;                                 /**< MCG Control 3 Register, offset: 0x2 */
-  __IO uint8_t C4;                                 /**< MCG Control 4 Register, offset: 0x3 */
-  __I  uint8_t C5;                                 /**< MCG Control 5 Register, offset: 0x4 */
-  __IO uint8_t C6;                                 /**< MCG Control 6 Register, offset: 0x5 */
-  __I  uint8_t S;                                  /**< MCG Status Register, offset: 0x6 */
-       uint8_t RESERVED_0[1];
-  __IO uint8_t SC;                                 /**< MCG Status and Control Register, offset: 0x8 */
-       uint8_t RESERVED_1[1];
-  __IO uint8_t ATCVH;                              /**< MCG Auto Trim Compare Value High Register, offset: 0xA */
-  __IO uint8_t ATCVL;                              /**< MCG Auto Trim Compare Value Low Register, offset: 0xB */
-} MCG_Type;
-
-/* ----------------------------------------------------------------------------
-   -- MCG Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MCG_Register_Masks MCG Register Masks
- * @{
- */
-
-/* C1 Bit Fields */
-#define MCG_C1_IREFSTEN_MASK                     0x1u
-#define MCG_C1_IREFSTEN_SHIFT                    0
-#define MCG_C1_IRCLKEN_MASK                      0x2u
-#define MCG_C1_IRCLKEN_SHIFT                     1
-#define MCG_C1_IREFS_MASK                        0x4u
-#define MCG_C1_IREFS_SHIFT                       2
-#define MCG_C1_FRDIV_MASK                        0x38u
-#define MCG_C1_FRDIV_SHIFT                       3
-#define MCG_C1_FRDIV(x)                          (((uint8_t)(((uint8_t)(x))<<MCG_C1_FRDIV_SHIFT))&MCG_C1_FRDIV_MASK)
-#define MCG_C1_CLKS_MASK                         0xC0u
-#define MCG_C1_CLKS_SHIFT                        6
-#define MCG_C1_CLKS(x)                           (((uint8_t)(((uint8_t)(x))<<MCG_C1_CLKS_SHIFT))&MCG_C1_CLKS_MASK)
-/* C2 Bit Fields */
-#define MCG_C2_IRCS_MASK                         0x1u
-#define MCG_C2_IRCS_SHIFT                        0
-#define MCG_C2_LP_MASK                           0x2u
-#define MCG_C2_LP_SHIFT                          1
-#define MCG_C2_EREFS0_MASK                       0x4u
-#define MCG_C2_EREFS0_SHIFT                      2
-#define MCG_C2_HGO0_MASK                         0x8u
-#define MCG_C2_HGO0_SHIFT                        3
-#define MCG_C2_RANGE0_MASK                       0x30u
-#define MCG_C2_RANGE0_SHIFT                      4
-#define MCG_C2_RANGE0(x)                         (((uint8_t)(((uint8_t)(x))<<MCG_C2_RANGE0_SHIFT))&MCG_C2_RANGE0_MASK)
-#define MCG_C2_LOCRE0_MASK                       0x80u
-#define MCG_C2_LOCRE0_SHIFT                      7
-/* C3 Bit Fields */
-#define MCG_C3_SCTRIM_MASK                       0xFFu
-#define MCG_C3_SCTRIM_SHIFT                      0
-#define MCG_C3_SCTRIM(x)                         (((uint8_t)(((uint8_t)(x))<<MCG_C3_SCTRIM_SHIFT))&MCG_C3_SCTRIM_MASK)
-/* C4 Bit Fields */
-#define MCG_C4_SCFTRIM_MASK                      0x1u
-#define MCG_C4_SCFTRIM_SHIFT                     0
-#define MCG_C4_FCTRIM_MASK                       0x1Eu
-#define MCG_C4_FCTRIM_SHIFT                      1
-#define MCG_C4_FCTRIM(x)                         (((uint8_t)(((uint8_t)(x))<<MCG_C4_FCTRIM_SHIFT))&MCG_C4_FCTRIM_MASK)
-#define MCG_C4_DRST_DRS_MASK                     0x60u
-#define MCG_C4_DRST_DRS_SHIFT                    5
-#define MCG_C4_DRST_DRS(x)                       (((uint8_t)(((uint8_t)(x))<<MCG_C4_DRST_DRS_SHIFT))&MCG_C4_DRST_DRS_MASK)
-#define MCG_C4_DMX32_MASK                        0x80u
-#define MCG_C4_DMX32_SHIFT                       7
-/* C6 Bit Fields */
-#define MCG_C6_CME_MASK                          0x20u
-#define MCG_C6_CME_SHIFT                         5
-/* S Bit Fields */
-#define MCG_S_IRCST_MASK                         0x1u
-#define MCG_S_IRCST_SHIFT                        0
-#define MCG_S_OSCINIT0_MASK                      0x2u
-#define MCG_S_OSCINIT0_SHIFT                     1
-#define MCG_S_CLKST_MASK                         0xCu
-#define MCG_S_CLKST_SHIFT                        2
-#define MCG_S_CLKST(x)                           (((uint8_t)(((uint8_t)(x))<<MCG_S_CLKST_SHIFT))&MCG_S_CLKST_MASK)
-#define MCG_S_IREFST_MASK                        0x10u
-#define MCG_S_IREFST_SHIFT                       4
-/* SC Bit Fields */
-#define MCG_SC_LOCS0_MASK                        0x1u
-#define MCG_SC_LOCS0_SHIFT                       0
-#define MCG_SC_FCRDIV_MASK                       0xEu
-#define MCG_SC_FCRDIV_SHIFT                      1
-#define MCG_SC_FCRDIV(x)                         (((uint8_t)(((uint8_t)(x))<<MCG_SC_FCRDIV_SHIFT))&MCG_SC_FCRDIV_MASK)
-#define MCG_SC_FLTPRSRV_MASK                     0x10u
-#define MCG_SC_FLTPRSRV_SHIFT                    4
-#define MCG_SC_ATMF_MASK                         0x20u
-#define MCG_SC_ATMF_SHIFT                        5
-#define MCG_SC_ATMS_MASK                         0x40u
-#define MCG_SC_ATMS_SHIFT                        6
-#define MCG_SC_ATME_MASK                         0x80u
-#define MCG_SC_ATME_SHIFT                        7
-/* ATCVH Bit Fields */
-#define MCG_ATCVH_ATCVH_MASK                     0xFFu
-#define MCG_ATCVH_ATCVH_SHIFT                    0
-#define MCG_ATCVH_ATCVH(x)                       (((uint8_t)(((uint8_t)(x))<<MCG_ATCVH_ATCVH_SHIFT))&MCG_ATCVH_ATCVH_MASK)
-/* ATCVL Bit Fields */
-#define MCG_ATCVL_ATCVL_MASK                     0xFFu
-#define MCG_ATCVL_ATCVL_SHIFT                    0
-#define MCG_ATCVL_ATCVL(x)                       (((uint8_t)(((uint8_t)(x))<<MCG_ATCVL_ATCVL_SHIFT))&MCG_ATCVL_ATCVL_MASK)
-
-/**
- * @}
- */ /* end of group MCG_Register_Masks */
-
-
-/* MCG - Peripheral instance base addresses */
-/** Peripheral MCG base address */
-#define MCG_BASE                                 (0x40064000u)
-/** Peripheral MCG base pointer */
-#define MCG                                      ((MCG_Type *)MCG_BASE)
-/** Array initializer of MCG peripheral base pointers */
-#define MCG_BASES                                { MCG }
-
-/**
- * @}
- */ /* end of group MCG_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- MCM Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MCM_Peripheral_Access_Layer MCM Peripheral Access Layer
- * @{
- */
-
-/** MCM - Register Layout Typedef */
-typedef struct {
-       uint8_t RESERVED_0[8];
-  __I  uint16_t PLASC;                             /**< Crossbar Switch (AXBS) Slave Configuration, offset: 0x8 */
-  __I  uint16_t PLAMC;                             /**< Crossbar Switch (AXBS) Master Configuration, offset: 0xA */
-  __IO uint32_t PLACR;                             /**< Platform Control Register, offset: 0xC */
-       uint8_t RESERVED_1[48];
-  __IO uint32_t CPO;                               /**< Compute Operation Control Register, offset: 0x40 */
-} MCM_Type;
-
-/* ----------------------------------------------------------------------------
-   -- MCM Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MCM_Register_Masks MCM Register Masks
- * @{
- */
-
-/* PLASC Bit Fields */
-#define MCM_PLASC_ASC_MASK                       0xFFu
-#define MCM_PLASC_ASC_SHIFT                      0
-#define MCM_PLASC_ASC(x)                         (((uint16_t)(((uint16_t)(x))<<MCM_PLASC_ASC_SHIFT))&MCM_PLASC_ASC_MASK)
-/* PLAMC Bit Fields */
-#define MCM_PLAMC_AMC_MASK                       0xFFu
-#define MCM_PLAMC_AMC_SHIFT                      0
-#define MCM_PLAMC_AMC(x)                         (((uint16_t)(((uint16_t)(x))<<MCM_PLAMC_AMC_SHIFT))&MCM_PLAMC_AMC_MASK)
-/* PLACR Bit Fields */
-#define MCM_PLACR_ARB_MASK                       0x200u
-#define MCM_PLACR_ARB_SHIFT                      9
-#define MCM_PLACR_CFCC_MASK                      0x400u
-#define MCM_PLACR_CFCC_SHIFT                     10
-#define MCM_PLACR_DFCDA_MASK                     0x800u
-#define MCM_PLACR_DFCDA_SHIFT                    11
-#define MCM_PLACR_DFCIC_MASK                     0x1000u
-#define MCM_PLACR_DFCIC_SHIFT                    12
-#define MCM_PLACR_DFCC_MASK                      0x2000u
-#define MCM_PLACR_DFCC_SHIFT                     13
-#define MCM_PLACR_EFDS_MASK                      0x4000u
-#define MCM_PLACR_EFDS_SHIFT                     14
-#define MCM_PLACR_DFCS_MASK                      0x8000u
-#define MCM_PLACR_DFCS_SHIFT                     15
-#define MCM_PLACR_ESFC_MASK                      0x10000u
-#define MCM_PLACR_ESFC_SHIFT                     16
-/* CPO Bit Fields */
-#define MCM_CPO_CPOREQ_MASK                      0x1u
-#define MCM_CPO_CPOREQ_SHIFT                     0
-#define MCM_CPO_CPOACK_MASK                      0x2u
-#define MCM_CPO_CPOACK_SHIFT                     1
-#define MCM_CPO_CPOWOI_MASK                      0x4u
-#define MCM_CPO_CPOWOI_SHIFT                     2
-
-/**
- * @}
- */ /* end of group MCM_Register_Masks */
-
-
-/* MCM - Peripheral instance base addresses */
-/** Peripheral MCM base address */
-#define MCM_BASE                                 (0xF0003000u)
-/** Peripheral MCM base pointer */
-#define MCM                                      ((MCM_Type *)MCM_BASE)
-/** Array initializer of MCM peripheral base pointers */
-#define MCM_BASES                                { MCM }
-
-/**
- * @}
- */ /* end of group MCM_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- MTB Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MTB_Peripheral_Access_Layer MTB Peripheral Access Layer
- * @{
- */
-
-/** MTB - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t POSITION;                          /**< MTB Position Register, offset: 0x0 */
-  __IO uint32_t MASTER;                            /**< MTB Master Register, offset: 0x4 */
-  __IO uint32_t FLOW;                              /**< MTB Flow Register, offset: 0x8 */
-  __I  uint32_t BASE;                              /**< MTB Base Register, offset: 0xC */
-       uint8_t RESERVED_0[3824];
-  __I  uint32_t MODECTRL;                          /**< Integration Mode Control Register, offset: 0xF00 */
-       uint8_t RESERVED_1[156];
-  __I  uint32_t TAGSET;                            /**< Claim TAG Set Register, offset: 0xFA0 */
-  __I  uint32_t TAGCLEAR;                          /**< Claim TAG Clear Register, offset: 0xFA4 */
-       uint8_t RESERVED_2[8];
-  __I  uint32_t LOCKACCESS;                        /**< Lock Access Register, offset: 0xFB0 */
-  __I  uint32_t LOCKSTAT;                          /**< Lock Status Register, offset: 0xFB4 */
-  __I  uint32_t AUTHSTAT;                          /**< Authentication Status Register, offset: 0xFB8 */
-  __I  uint32_t DEVICEARCH;                        /**< Device Architecture Register, offset: 0xFBC */
-       uint8_t RESERVED_3[8];
-  __I  uint32_t DEVICECFG;                         /**< Device Configuration Register, offset: 0xFC8 */
-  __I  uint32_t DEVICETYPID;                       /**< Device Type Identifier Register, offset: 0xFCC */
-  __I  uint32_t PERIPHID[8];                       /**< Peripheral ID Register, array offset: 0xFD0, array step: 0x4 */
-  __I  uint32_t COMPID[4];                         /**< Component ID Register, array offset: 0xFF0, array step: 0x4 */
-} MTB_Type;
-
-/* ----------------------------------------------------------------------------
-   -- MTB Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MTB_Register_Masks MTB Register Masks
- * @{
- */
-
-/* POSITION Bit Fields */
-#define MTB_POSITION_WRAP_MASK                   0x4u
-#define MTB_POSITION_WRAP_SHIFT                  2
-#define MTB_POSITION_POINTER_MASK                0xFFFFFFF8u
-#define MTB_POSITION_POINTER_SHIFT               3
-#define MTB_POSITION_POINTER(x)                  (((uint32_t)(((uint32_t)(x))<<MTB_POSITION_POINTER_SHIFT))&MTB_POSITION_POINTER_MASK)
-/* MASTER Bit Fields */
-#define MTB_MASTER_MASK_MASK                     0x1Fu
-#define MTB_MASTER_MASK_SHIFT                    0
-#define MTB_MASTER_MASK(x)                       (((uint32_t)(((uint32_t)(x))<<MTB_MASTER_MASK_SHIFT))&MTB_MASTER_MASK_MASK)
-#define MTB_MASTER_TSTARTEN_MASK                 0x20u
-#define MTB_MASTER_TSTARTEN_SHIFT                5
-#define MTB_MASTER_TSTOPEN_MASK                  0x40u
-#define MTB_MASTER_TSTOPEN_SHIFT                 6
-#define MTB_MASTER_SFRWPRIV_MASK                 0x80u
-#define MTB_MASTER_SFRWPRIV_SHIFT                7
-#define MTB_MASTER_RAMPRIV_MASK                  0x100u
-#define MTB_MASTER_RAMPRIV_SHIFT                 8
-#define MTB_MASTER_HALTREQ_MASK                  0x200u
-#define MTB_MASTER_HALTREQ_SHIFT                 9
-#define MTB_MASTER_EN_MASK                       0x80000000u
-#define MTB_MASTER_EN_SHIFT                      31
-/* FLOW Bit Fields */
-#define MTB_FLOW_AUTOSTOP_MASK                   0x1u
-#define MTB_FLOW_AUTOSTOP_SHIFT                  0
-#define MTB_FLOW_AUTOHALT_MASK                   0x2u
-#define MTB_FLOW_AUTOHALT_SHIFT                  1
-#define MTB_FLOW_WATERMARK_MASK                  0xFFFFFFF8u
-#define MTB_FLOW_WATERMARK_SHIFT                 3
-#define MTB_FLOW_WATERMARK(x)                    (((uint32_t)(((uint32_t)(x))<<MTB_FLOW_WATERMARK_SHIFT))&MTB_FLOW_WATERMARK_MASK)
-/* BASE Bit Fields */
-#define MTB_BASE_BASEADDR_MASK                   0xFFFFFFFFu
-#define MTB_BASE_BASEADDR_SHIFT                  0
-#define MTB_BASE_BASEADDR(x)                     (((uint32_t)(((uint32_t)(x))<<MTB_BASE_BASEADDR_SHIFT))&MTB_BASE_BASEADDR_MASK)
-/* MODECTRL Bit Fields */
-#define MTB_MODECTRL_MODECTRL_MASK               0xFFFFFFFFu
-#define MTB_MODECTRL_MODECTRL_SHIFT              0
-#define MTB_MODECTRL_MODECTRL(x)                 (((uint32_t)(((uint32_t)(x))<<MTB_MODECTRL_MODECTRL_SHIFT))&MTB_MODECTRL_MODECTRL_MASK)
-/* TAGSET Bit Fields */
-#define MTB_TAGSET_TAGSET_MASK                   0xFFFFFFFFu
-#define MTB_TAGSET_TAGSET_SHIFT                  0
-#define MTB_TAGSET_TAGSET(x)                     (((uint32_t)(((uint32_t)(x))<<MTB_TAGSET_TAGSET_SHIFT))&MTB_TAGSET_TAGSET_MASK)
-/* TAGCLEAR Bit Fields */
-#define MTB_TAGCLEAR_TAGCLEAR_MASK               0xFFFFFFFFu
-#define MTB_TAGCLEAR_TAGCLEAR_SHIFT              0
-#define MTB_TAGCLEAR_TAGCLEAR(x)                 (((uint32_t)(((uint32_t)(x))<<MTB_TAGCLEAR_TAGCLEAR_SHIFT))&MTB_TAGCLEAR_TAGCLEAR_MASK)
-/* LOCKACCESS Bit Fields */
-#define MTB_LOCKACCESS_LOCKACCESS_MASK           0xFFFFFFFFu
-#define MTB_LOCKACCESS_LOCKACCESS_SHIFT          0
-#define MTB_LOCKACCESS_LOCKACCESS(x)             (((uint32_t)(((uint32_t)(x))<<MTB_LOCKACCESS_LOCKACCESS_SHIFT))&MTB_LOCKACCESS_LOCKACCESS_MASK)
-/* LOCKSTAT Bit Fields */
-#define MTB_LOCKSTAT_LOCKSTAT_MASK               0xFFFFFFFFu
-#define MTB_LOCKSTAT_LOCKSTAT_SHIFT              0
-#define MTB_LOCKSTAT_LOCKSTAT(x)                 (((uint32_t)(((uint32_t)(x))<<MTB_LOCKSTAT_LOCKSTAT_SHIFT))&MTB_LOCKSTAT_LOCKSTAT_MASK)
-/* AUTHSTAT Bit Fields */
-#define MTB_AUTHSTAT_BIT0_MASK                   0x1u
-#define MTB_AUTHSTAT_BIT0_SHIFT                  0
-#define MTB_AUTHSTAT_BIT1_MASK                   0x2u
-#define MTB_AUTHSTAT_BIT1_SHIFT                  1
-#define MTB_AUTHSTAT_BIT2_MASK                   0x4u
-#define MTB_AUTHSTAT_BIT2_SHIFT                  2
-#define MTB_AUTHSTAT_BIT3_MASK                   0x8u
-#define MTB_AUTHSTAT_BIT3_SHIFT                  3
-/* DEVICEARCH Bit Fields */
-#define MTB_DEVICEARCH_DEVICEARCH_MASK           0xFFFFFFFFu
-#define MTB_DEVICEARCH_DEVICEARCH_SHIFT          0
-#define MTB_DEVICEARCH_DEVICEARCH(x)             (((uint32_t)(((uint32_t)(x))<<MTB_DEVICEARCH_DEVICEARCH_SHIFT))&MTB_DEVICEARCH_DEVICEARCH_MASK)
-/* DEVICECFG Bit Fields */
-#define MTB_DEVICECFG_DEVICECFG_MASK             0xFFFFFFFFu
-#define MTB_DEVICECFG_DEVICECFG_SHIFT            0
-#define MTB_DEVICECFG_DEVICECFG(x)               (((uint32_t)(((uint32_t)(x))<<MTB_DEVICECFG_DEVICECFG_SHIFT))&MTB_DEVICECFG_DEVICECFG_MASK)
-/* DEVICETYPID Bit Fields */
-#define MTB_DEVICETYPID_DEVICETYPID_MASK         0xFFFFFFFFu
-#define MTB_DEVICETYPID_DEVICETYPID_SHIFT        0
-#define MTB_DEVICETYPID_DEVICETYPID(x)           (((uint32_t)(((uint32_t)(x))<<MTB_DEVICETYPID_DEVICETYPID_SHIFT))&MTB_DEVICETYPID_DEVICETYPID_MASK)
-/* PERIPHID Bit Fields */
-#define MTB_PERIPHID_PERIPHID_MASK               0xFFFFFFFFu
-#define MTB_PERIPHID_PERIPHID_SHIFT              0
-#define MTB_PERIPHID_PERIPHID(x)                 (((uint32_t)(((uint32_t)(x))<<MTB_PERIPHID_PERIPHID_SHIFT))&MTB_PERIPHID_PERIPHID_MASK)
-/* COMPID Bit Fields */
-#define MTB_COMPID_COMPID_MASK                   0xFFFFFFFFu
-#define MTB_COMPID_COMPID_SHIFT                  0
-#define MTB_COMPID_COMPID(x)                     (((uint32_t)(((uint32_t)(x))<<MTB_COMPID_COMPID_SHIFT))&MTB_COMPID_COMPID_MASK)
-
-/**
- * @}
- */ /* end of group MTB_Register_Masks */
-
-
-/* MTB - Peripheral instance base addresses */
-/** Peripheral MTB base address */
-#define MTB_BASE                                 (0xF0000000u)
-/** Peripheral MTB base pointer */
-#define MTB                                      ((MTB_Type *)MTB_BASE)
-/** Array initializer of MTB peripheral base pointers */
-#define MTB_BASES                                { MTB }
-
-/**
- * @}
- */ /* end of group MTB_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- MTBDWT Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MTBDWT_Peripheral_Access_Layer MTBDWT Peripheral Access Layer
- * @{
- */
-
-/** MTBDWT - Register Layout Typedef */
-typedef struct {
-  __I  uint32_t CTRL;                              /**< MTB DWT Control Register, offset: 0x0 */
-       uint8_t RESERVED_0[28];
-  struct {                                         /* offset: 0x20, array step: 0x10 */
-    __IO uint32_t COMP;                              /**< MTB_DWT Comparator Register, array offset: 0x20, array step: 0x10 */
-    __IO uint32_t MASK;                              /**< MTB_DWT Comparator Mask Register, array offset: 0x24, array step: 0x10 */
-    __IO uint32_t FCT;                               /**< MTB_DWT Comparator Function Register 0..MTB_DWT Comparator Function Register 1, array offset: 0x28, array step: 0x10 */
-         uint8_t RESERVED_0[4];
-  } COMPARATOR[2];
-       uint8_t RESERVED_1[448];
-  __IO uint32_t TBCTRL;                            /**< MTB_DWT Trace Buffer Control Register, offset: 0x200 */
-       uint8_t RESERVED_2[3524];
-  __I  uint32_t DEVICECFG;                         /**< Device Configuration Register, offset: 0xFC8 */
-  __I  uint32_t DEVICETYPID;                       /**< Device Type Identifier Register, offset: 0xFCC */
-  __I  uint32_t PERIPHID[8];                       /**< Peripheral ID Register, array offset: 0xFD0, array step: 0x4 */
-  __I  uint32_t COMPID[4];                         /**< Component ID Register, array offset: 0xFF0, array step: 0x4 */
-} MTBDWT_Type;
-
-/* ----------------------------------------------------------------------------
-   -- MTBDWT Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MTBDWT_Register_Masks MTBDWT Register Masks
- * @{
- */
-
-/* CTRL Bit Fields */
-#define MTBDWT_CTRL_DWTCFGCTRL_MASK              0xFFFFFFFu
-#define MTBDWT_CTRL_DWTCFGCTRL_SHIFT             0
-#define MTBDWT_CTRL_DWTCFGCTRL(x)                (((uint32_t)(((uint32_t)(x))<<MTBDWT_CTRL_DWTCFGCTRL_SHIFT))&MTBDWT_CTRL_DWTCFGCTRL_MASK)
-#define MTBDWT_CTRL_NUMCMP_MASK                  0xF0000000u
-#define MTBDWT_CTRL_NUMCMP_SHIFT                 28
-#define MTBDWT_CTRL_NUMCMP(x)                    (((uint32_t)(((uint32_t)(x))<<MTBDWT_CTRL_NUMCMP_SHIFT))&MTBDWT_CTRL_NUMCMP_MASK)
-/* COMP Bit Fields */
-#define MTBDWT_COMP_COMP_MASK                    0xFFFFFFFFu
-#define MTBDWT_COMP_COMP_SHIFT                   0
-#define MTBDWT_COMP_COMP(x)                      (((uint32_t)(((uint32_t)(x))<<MTBDWT_COMP_COMP_SHIFT))&MTBDWT_COMP_COMP_MASK)
-/* MASK Bit Fields */
-#define MTBDWT_MASK_MASK_MASK                    0x1Fu
-#define MTBDWT_MASK_MASK_SHIFT                   0
-#define MTBDWT_MASK_MASK(x)                      (((uint32_t)(((uint32_t)(x))<<MTBDWT_MASK_MASK_SHIFT))&MTBDWT_MASK_MASK_MASK)
-/* FCT Bit Fields */
-#define MTBDWT_FCT_FUNCTION_MASK                 0xFu
-#define MTBDWT_FCT_FUNCTION_SHIFT                0
-#define MTBDWT_FCT_FUNCTION(x)                   (((uint32_t)(((uint32_t)(x))<<MTBDWT_FCT_FUNCTION_SHIFT))&MTBDWT_FCT_FUNCTION_MASK)
-#define MTBDWT_FCT_DATAVMATCH_MASK               0x100u
-#define MTBDWT_FCT_DATAVMATCH_SHIFT              8
-#define MTBDWT_FCT_DATAVSIZE_MASK                0xC00u
-#define MTBDWT_FCT_DATAVSIZE_SHIFT               10
-#define MTBDWT_FCT_DATAVSIZE(x)                  (((uint32_t)(((uint32_t)(x))<<MTBDWT_FCT_DATAVSIZE_SHIFT))&MTBDWT_FCT_DATAVSIZE_MASK)
-#define MTBDWT_FCT_DATAVADDR0_MASK               0xF000u
-#define MTBDWT_FCT_DATAVADDR0_SHIFT              12
-#define MTBDWT_FCT_DATAVADDR0(x)                 (((uint32_t)(((uint32_t)(x))<<MTBDWT_FCT_DATAVADDR0_SHIFT))&MTBDWT_FCT_DATAVADDR0_MASK)
-#define MTBDWT_FCT_MATCHED_MASK                  0x1000000u
-#define MTBDWT_FCT_MATCHED_SHIFT                 24
-/* TBCTRL Bit Fields */
-#define MTBDWT_TBCTRL_ACOMP0_MASK                0x1u
-#define MTBDWT_TBCTRL_ACOMP0_SHIFT               0
-#define MTBDWT_TBCTRL_ACOMP1_MASK                0x2u
-#define MTBDWT_TBCTRL_ACOMP1_SHIFT               1
-#define MTBDWT_TBCTRL_NUMCOMP_MASK               0xF0000000u
-#define MTBDWT_TBCTRL_NUMCOMP_SHIFT              28
-#define MTBDWT_TBCTRL_NUMCOMP(x)                 (((uint32_t)(((uint32_t)(x))<<MTBDWT_TBCTRL_NUMCOMP_SHIFT))&MTBDWT_TBCTRL_NUMCOMP_MASK)
-/* DEVICECFG Bit Fields */
-#define MTBDWT_DEVICECFG_DEVICECFG_MASK          0xFFFFFFFFu
-#define MTBDWT_DEVICECFG_DEVICECFG_SHIFT         0
-#define MTBDWT_DEVICECFG_DEVICECFG(x)            (((uint32_t)(((uint32_t)(x))<<MTBDWT_DEVICECFG_DEVICECFG_SHIFT))&MTBDWT_DEVICECFG_DEVICECFG_MASK)
-/* DEVICETYPID Bit Fields */
-#define MTBDWT_DEVICETYPID_DEVICETYPID_MASK      0xFFFFFFFFu
-#define MTBDWT_DEVICETYPID_DEVICETYPID_SHIFT     0
-#define MTBDWT_DEVICETYPID_DEVICETYPID(x)        (((uint32_t)(((uint32_t)(x))<<MTBDWT_DEVICETYPID_DEVICETYPID_SHIFT))&MTBDWT_DEVICETYPID_DEVICETYPID_MASK)
-/* PERIPHID Bit Fields */
-#define MTBDWT_PERIPHID_PERIPHID_MASK            0xFFFFFFFFu
-#define MTBDWT_PERIPHID_PERIPHID_SHIFT           0
-#define MTBDWT_PERIPHID_PERIPHID(x)              (((uint32_t)(((uint32_t)(x))<<MTBDWT_PERIPHID_PERIPHID_SHIFT))&MTBDWT_PERIPHID_PERIPHID_MASK)
-/* COMPID Bit Fields */
-#define MTBDWT_COMPID_COMPID_MASK                0xFFFFFFFFu
-#define MTBDWT_COMPID_COMPID_SHIFT               0
-#define MTBDWT_COMPID_COMPID(x)                  (((uint32_t)(((uint32_t)(x))<<MTBDWT_COMPID_COMPID_SHIFT))&MTBDWT_COMPID_COMPID_MASK)
-
-/**
- * @}
- */ /* end of group MTBDWT_Register_Masks */
-
-
-/* MTBDWT - Peripheral instance base addresses */
-/** Peripheral MTBDWT base address */
-#define MTBDWT_BASE                              (0xF0001000u)
-/** Peripheral MTBDWT base pointer */
-#define MTBDWT                                   ((MTBDWT_Type *)MTBDWT_BASE)
-/** Array initializer of MTBDWT peripheral base pointers */
-#define MTBDWT_BASES                             { MTBDWT }
-
-/**
- * @}
- */ /* end of group MTBDWT_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- NV Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup NV_Peripheral_Access_Layer NV Peripheral Access Layer
- * @{
- */
-
-/** NV - Register Layout Typedef */
-typedef struct {
-  __I  uint8_t BACKKEY3;                           /**< Backdoor Comparison Key 3., offset: 0x0 */
-  __I  uint8_t BACKKEY2;                           /**< Backdoor Comparison Key 2., offset: 0x1 */
-  __I  uint8_t BACKKEY1;                           /**< Backdoor Comparison Key 1., offset: 0x2 */
-  __I  uint8_t BACKKEY0;                           /**< Backdoor Comparison Key 0., offset: 0x3 */
-  __I  uint8_t BACKKEY7;                           /**< Backdoor Comparison Key 7., offset: 0x4 */
-  __I  uint8_t BACKKEY6;                           /**< Backdoor Comparison Key 6., offset: 0x5 */
-  __I  uint8_t BACKKEY5;                           /**< Backdoor Comparison Key 5., offset: 0x6 */
-  __I  uint8_t BACKKEY4;                           /**< Backdoor Comparison Key 4., offset: 0x7 */
-  __I  uint8_t FPROT3;                             /**< Non-volatile P-Flash Protection 1 - Low Register, offset: 0x8 */
-  __I  uint8_t FPROT2;                             /**< Non-volatile P-Flash Protection 1 - High Register, offset: 0x9 */
-  __I  uint8_t FPROT1;                             /**< Non-volatile P-Flash Protection 0 - Low Register, offset: 0xA */
-  __I  uint8_t FPROT0;                             /**< Non-volatile P-Flash Protection 0 - High Register, offset: 0xB */
-  __I  uint8_t FSEC;                               /**< Non-volatile Flash Security Register, offset: 0xC */
-  __I  uint8_t FOPT;                               /**< Non-volatile Flash Option Register, offset: 0xD */
-} NV_Type;
-
-/* ----------------------------------------------------------------------------
-   -- NV Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup NV_Register_Masks NV Register Masks
- * @{
- */
-
-/* BACKKEY3 Bit Fields */
-#define NV_BACKKEY3_KEY_MASK                     0xFFu
-#define NV_BACKKEY3_KEY_SHIFT                    0
-#define NV_BACKKEY3_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY3_KEY_SHIFT))&NV_BACKKEY3_KEY_MASK)
-/* BACKKEY2 Bit Fields */
-#define NV_BACKKEY2_KEY_MASK                     0xFFu
-#define NV_BACKKEY2_KEY_SHIFT                    0
-#define NV_BACKKEY2_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY2_KEY_SHIFT))&NV_BACKKEY2_KEY_MASK)
-/* BACKKEY1 Bit Fields */
-#define NV_BACKKEY1_KEY_MASK                     0xFFu
-#define NV_BACKKEY1_KEY_SHIFT                    0
-#define NV_BACKKEY1_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY1_KEY_SHIFT))&NV_BACKKEY1_KEY_MASK)
-/* BACKKEY0 Bit Fields */
-#define NV_BACKKEY0_KEY_MASK                     0xFFu
-#define NV_BACKKEY0_KEY_SHIFT                    0
-#define NV_BACKKEY0_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY0_KEY_SHIFT))&NV_BACKKEY0_KEY_MASK)
-/* BACKKEY7 Bit Fields */
-#define NV_BACKKEY7_KEY_MASK                     0xFFu
-#define NV_BACKKEY7_KEY_SHIFT                    0
-#define NV_BACKKEY7_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY7_KEY_SHIFT))&NV_BACKKEY7_KEY_MASK)
-/* BACKKEY6 Bit Fields */
-#define NV_BACKKEY6_KEY_MASK                     0xFFu
-#define NV_BACKKEY6_KEY_SHIFT                    0
-#define NV_BACKKEY6_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY6_KEY_SHIFT))&NV_BACKKEY6_KEY_MASK)
-/* BACKKEY5 Bit Fields */
-#define NV_BACKKEY5_KEY_MASK                     0xFFu
-#define NV_BACKKEY5_KEY_SHIFT                    0
-#define NV_BACKKEY5_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY5_KEY_SHIFT))&NV_BACKKEY5_KEY_MASK)
-/* BACKKEY4 Bit Fields */
-#define NV_BACKKEY4_KEY_MASK                     0xFFu
-#define NV_BACKKEY4_KEY_SHIFT                    0
-#define NV_BACKKEY4_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY4_KEY_SHIFT))&NV_BACKKEY4_KEY_MASK)
-/* FPROT3 Bit Fields */
-#define NV_FPROT3_PROT_MASK                      0xFFu
-#define NV_FPROT3_PROT_SHIFT                     0
-#define NV_FPROT3_PROT(x)                        (((uint8_t)(((uint8_t)(x))<<NV_FPROT3_PROT_SHIFT))&NV_FPROT3_PROT_MASK)
-/* FPROT2 Bit Fields */
-#define NV_FPROT2_PROT_MASK                      0xFFu
-#define NV_FPROT2_PROT_SHIFT                     0
-#define NV_FPROT2_PROT(x)                        (((uint8_t)(((uint8_t)(x))<<NV_FPROT2_PROT_SHIFT))&NV_FPROT2_PROT_MASK)
-/* FPROT1 Bit Fields */
-#define NV_FPROT1_PROT_MASK                      0xFFu
-#define NV_FPROT1_PROT_SHIFT                     0
-#define NV_FPROT1_PROT(x)                        (((uint8_t)(((uint8_t)(x))<<NV_FPROT1_PROT_SHIFT))&NV_FPROT1_PROT_MASK)
-/* FPROT0 Bit Fields */
-#define NV_FPROT0_PROT_MASK                      0xFFu
-#define NV_FPROT0_PROT_SHIFT                     0
-#define NV_FPROT0_PROT(x)                        (((uint8_t)(((uint8_t)(x))<<NV_FPROT0_PROT_SHIFT))&NV_FPROT0_PROT_MASK)
-/* FSEC Bit Fields */
-#define NV_FSEC_SEC_MASK                         0x3u
-#define NV_FSEC_SEC_SHIFT                        0
-#define NV_FSEC_SEC(x)                           (((uint8_t)(((uint8_t)(x))<<NV_FSEC_SEC_SHIFT))&NV_FSEC_SEC_MASK)
-#define NV_FSEC_FSLACC_MASK                      0xCu
-#define NV_FSEC_FSLACC_SHIFT                     2
-#define NV_FSEC_FSLACC(x)                        (((uint8_t)(((uint8_t)(x))<<NV_FSEC_FSLACC_SHIFT))&NV_FSEC_FSLACC_MASK)
-#define NV_FSEC_MEEN_MASK                        0x30u
-#define NV_FSEC_MEEN_SHIFT                       4
-#define NV_FSEC_MEEN(x)                          (((uint8_t)(((uint8_t)(x))<<NV_FSEC_MEEN_SHIFT))&NV_FSEC_MEEN_MASK)
-#define NV_FSEC_KEYEN_MASK                       0xC0u
-#define NV_FSEC_KEYEN_SHIFT                      6
-#define NV_FSEC_KEYEN(x)                         (((uint8_t)(((uint8_t)(x))<<NV_FSEC_KEYEN_SHIFT))&NV_FSEC_KEYEN_MASK)
-/* FOPT Bit Fields */
-#define NV_FOPT_LPBOOT0_MASK                     0x1u
-#define NV_FOPT_LPBOOT0_SHIFT                    0
-#define NV_FOPT_EZPORT_DIS_MASK                  0x2u
-#define NV_FOPT_EZPORT_DIS_SHIFT                 1
-#define NV_FOPT_NMI_DIS_MASK                     0x4u
-#define NV_FOPT_NMI_DIS_SHIFT                    2
-#define NV_FOPT_RESET_PIN_CFG_MASK               0x8u
-#define NV_FOPT_RESET_PIN_CFG_SHIFT              3
-#define NV_FOPT_LPBOOT1_MASK                     0x10u
-#define NV_FOPT_LPBOOT1_SHIFT                    4
-#define NV_FOPT_FAST_INIT_MASK                   0x20u
-#define NV_FOPT_FAST_INIT_SHIFT                  5
-
-/**
- * @}
- */ /* end of group NV_Register_Masks */
-
-
-/* NV - Peripheral instance base addresses */
-/** Peripheral FTFA_FlashConfig base address */
-#define FTFA_FlashConfig_BASE                    (0x400u)
-/** Peripheral FTFA_FlashConfig base pointer */
-#define FTFA_FlashConfig                         ((NV_Type *)FTFA_FlashConfig_BASE)
-/** Array initializer of NV peripheral base pointers */
-#define NV_BASES                                 { FTFA_FlashConfig }
-
-/**
- * @}
- */ /* end of group NV_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- OSC Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup OSC_Peripheral_Access_Layer OSC Peripheral Access Layer
- * @{
- */
-
-/** OSC - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t CR;                                 /**< OSC Control Register, offset: 0x0 */
-} OSC_Type;
-
-/* ----------------------------------------------------------------------------
-   -- OSC Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup OSC_Register_Masks OSC Register Masks
- * @{
- */
-
-/* CR Bit Fields */
-#define OSC_CR_SC16P_MASK                        0x1u
-#define OSC_CR_SC16P_SHIFT                       0
-#define OSC_CR_SC8P_MASK                         0x2u
-#define OSC_CR_SC8P_SHIFT                        1
-#define OSC_CR_SC4P_MASK                         0x4u
-#define OSC_CR_SC4P_SHIFT                        2
-#define OSC_CR_SC2P_MASK                         0x8u
-#define OSC_CR_SC2P_SHIFT                        3
-#define OSC_CR_EREFSTEN_MASK                     0x20u
-#define OSC_CR_EREFSTEN_SHIFT                    5
-#define OSC_CR_ERCLKEN_MASK                      0x80u
-#define OSC_CR_ERCLKEN_SHIFT                     7
-
-/**
- * @}
- */ /* end of group OSC_Register_Masks */
-
-
-/* OSC - Peripheral instance base addresses */
-/** Peripheral OSC0 base address */
-#define OSC0_BASE                                (0x40065000u)
-/** Peripheral OSC0 base pointer */
-#define OSC0                                     ((OSC_Type *)OSC0_BASE)
-/** Array initializer of OSC peripheral base pointers */
-#define OSC_BASES                                { OSC0 }
-
-/**
- * @}
- */ /* end of group OSC_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- PIT Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup PIT_Peripheral_Access_Layer PIT Peripheral Access Layer
- * @{
- */
-
-/** PIT - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t MCR;                               /**< PIT Module Control Register, offset: 0x0 */
-       uint8_t RESERVED_0[220];
-  __I  uint32_t LTMR64H;                           /**< PIT Upper Lifetime Timer Register, offset: 0xE0 */
-  __I  uint32_t LTMR64L;                           /**< PIT Lower Lifetime Timer Register, offset: 0xE4 */
-       uint8_t RESERVED_1[24];
-  struct {                                         /* offset: 0x100, array step: 0x10 */
-    __IO uint32_t LDVAL;                             /**< Timer Load Value Register, array offset: 0x100, array step: 0x10 */
-    __I  uint32_t CVAL;                              /**< Current Timer Value Register, array offset: 0x104, array step: 0x10 */
-    __IO uint32_t TCTRL;                             /**< Timer Control Register, array offset: 0x108, array step: 0x10 */
-    __IO uint32_t TFLG;                              /**< Timer Flag Register, array offset: 0x10C, array step: 0x10 */
-  } CHANNEL[2];
-} PIT_Type;
-
-/* ----------------------------------------------------------------------------
-   -- PIT Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup PIT_Register_Masks PIT Register Masks
- * @{
- */
-
-/* MCR Bit Fields */
-#define PIT_MCR_FRZ_MASK                         0x1u
-#define PIT_MCR_FRZ_SHIFT                        0
-#define PIT_MCR_MDIS_MASK                        0x2u
-#define PIT_MCR_MDIS_SHIFT                       1
-/* LTMR64H Bit Fields */
-#define PIT_LTMR64H_LTH_MASK                     0xFFFFFFFFu
-#define PIT_LTMR64H_LTH_SHIFT                    0
-#define PIT_LTMR64H_LTH(x)                       (((uint32_t)(((uint32_t)(x))<<PIT_LTMR64H_LTH_SHIFT))&PIT_LTMR64H_LTH_MASK)
-/* LTMR64L Bit Fields */
-#define PIT_LTMR64L_LTL_MASK                     0xFFFFFFFFu
-#define PIT_LTMR64L_LTL_SHIFT                    0
-#define PIT_LTMR64L_LTL(x)                       (((uint32_t)(((uint32_t)(x))<<PIT_LTMR64L_LTL_SHIFT))&PIT_LTMR64L_LTL_MASK)
-/* LDVAL Bit Fields */
-#define PIT_LDVAL_TSV_MASK                       0xFFFFFFFFu
-#define PIT_LDVAL_TSV_SHIFT                      0
-#define PIT_LDVAL_TSV(x)                         (((uint32_t)(((uint32_t)(x))<<PIT_LDVAL_TSV_SHIFT))&PIT_LDVAL_TSV_MASK)
-/* CVAL Bit Fields */
-#define PIT_CVAL_TVL_MASK                        0xFFFFFFFFu
-#define PIT_CVAL_TVL_SHIFT                       0
-#define PIT_CVAL_TVL(x)                          (((uint32_t)(((uint32_t)(x))<<PIT_CVAL_TVL_SHIFT))&PIT_CVAL_TVL_MASK)
-/* TCTRL Bit Fields */
-#define PIT_TCTRL_TEN_MASK                       0x1u
-#define PIT_TCTRL_TEN_SHIFT                      0
-#define PIT_TCTRL_TIE_MASK                       0x2u
-#define PIT_TCTRL_TIE_SHIFT                      1
-#define PIT_TCTRL_CHN_MASK                       0x4u
-#define PIT_TCTRL_CHN_SHIFT                      2
-/* TFLG Bit Fields */
-#define PIT_TFLG_TIF_MASK                        0x1u
-#define PIT_TFLG_TIF_SHIFT                       0
-
-/**
- * @}
- */ /* end of group PIT_Register_Masks */
-
-
-/* PIT - Peripheral instance base addresses */
-/** Peripheral PIT base address */
-#define PIT_BASE                                 (0x40037000u)
-/** Peripheral PIT base pointer */
-#define PIT                                      ((PIT_Type *)PIT_BASE)
-/** Array initializer of PIT peripheral base pointers */
-#define PIT_BASES                                { PIT }
-
-/**
- * @}
- */ /* end of group PIT_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- PMC Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup PMC_Peripheral_Access_Layer PMC Peripheral Access Layer
- * @{
- */
-
-/** PMC - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t LVDSC1;                             /**< Low Voltage Detect Status And Control 1 register, offset: 0x0 */
-  __IO uint8_t LVDSC2;                             /**< Low Voltage Detect Status And Control 2 register, offset: 0x1 */
-  __IO uint8_t REGSC;                              /**< Regulator Status And Control register, offset: 0x2 */
-} PMC_Type;
-
-/* ----------------------------------------------------------------------------
-   -- PMC Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup PMC_Register_Masks PMC Register Masks
- * @{
- */
-
-/* LVDSC1 Bit Fields */
-#define PMC_LVDSC1_LVDV_MASK                     0x3u
-#define PMC_LVDSC1_LVDV_SHIFT                    0
-#define PMC_LVDSC1_LVDV(x)                       (((uint8_t)(((uint8_t)(x))<<PMC_LVDSC1_LVDV_SHIFT))&PMC_LVDSC1_LVDV_MASK)
-#define PMC_LVDSC1_LVDRE_MASK                    0x10u
-#define PMC_LVDSC1_LVDRE_SHIFT                   4
-#define PMC_LVDSC1_LVDIE_MASK                    0x20u
-#define PMC_LVDSC1_LVDIE_SHIFT                   5
-#define PMC_LVDSC1_LVDACK_MASK                   0x40u
-#define PMC_LVDSC1_LVDACK_SHIFT                  6
-#define PMC_LVDSC1_LVDF_MASK                     0x80u
-#define PMC_LVDSC1_LVDF_SHIFT                    7
-/* LVDSC2 Bit Fields */
-#define PMC_LVDSC2_LVWV_MASK                     0x3u
-#define PMC_LVDSC2_LVWV_SHIFT                    0
-#define PMC_LVDSC2_LVWV(x)                       (((uint8_t)(((uint8_t)(x))<<PMC_LVDSC2_LVWV_SHIFT))&PMC_LVDSC2_LVWV_MASK)
-#define PMC_LVDSC2_LVWIE_MASK                    0x20u
-#define PMC_LVDSC2_LVWIE_SHIFT                   5
-#define PMC_LVDSC2_LVWACK_MASK                   0x40u
-#define PMC_LVDSC2_LVWACK_SHIFT                  6
-#define PMC_LVDSC2_LVWF_MASK                     0x80u
-#define PMC_LVDSC2_LVWF_SHIFT                    7
-/* REGSC Bit Fields */
-#define PMC_REGSC_BGBE_MASK                      0x1u
-#define PMC_REGSC_BGBE_SHIFT                     0
-#define PMC_REGSC_REGONS_MASK                    0x4u
-#define PMC_REGSC_REGONS_SHIFT                   2
-#define PMC_REGSC_ACKISO_MASK                    0x8u
-#define PMC_REGSC_ACKISO_SHIFT                   3
-#define PMC_REGSC_BGEN_MASK                      0x10u
-#define PMC_REGSC_BGEN_SHIFT                     4
-
-/**
- * @}
- */ /* end of group PMC_Register_Masks */
-
-
-/* PMC - Peripheral instance base addresses */
-/** Peripheral PMC base address */
-#define PMC_BASE                                 (0x4007D000u)
-/** Peripheral PMC base pointer */
-#define PMC                                      ((PMC_Type *)PMC_BASE)
-/** Array initializer of PMC peripheral base pointers */
-#define PMC_BASES                                { PMC }
-
-/**
- * @}
- */ /* end of group PMC_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- PORT Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup PORT_Peripheral_Access_Layer PORT Peripheral Access Layer
- * @{
- */
-
-/** PORT - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t PCR[32];                           /**< Pin Control Register n, array offset: 0x0, array step: 0x4 */
-  __O  uint32_t GPCLR;                             /**< Global Pin Control Low Register, offset: 0x80 */
-  __O  uint32_t GPCHR;                             /**< Global Pin Control High Register, offset: 0x84 */
-       uint8_t RESERVED_0[24];
-  __IO uint32_t ISFR;                              /**< Interrupt Status Flag Register, offset: 0xA0 */
-} PORT_Type;
-
-/* ----------------------------------------------------------------------------
-   -- PORT Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup PORT_Register_Masks PORT Register Masks
- * @{
- */
-
-/* PCR Bit Fields */
-#define PORT_PCR_PS_MASK                         0x1u
-#define PORT_PCR_PS_SHIFT                        0
-#define PORT_PCR_PE_MASK                         0x2u
-#define PORT_PCR_PE_SHIFT                        1
-#define PORT_PCR_SRE_MASK                        0x4u
-#define PORT_PCR_SRE_SHIFT                       2
-#define PORT_PCR_PFE_MASK                        0x10u
-#define PORT_PCR_PFE_SHIFT                       4
-#define PORT_PCR_DSE_MASK                        0x40u
-#define PORT_PCR_DSE_SHIFT                       6
-#define PORT_PCR_MUX_MASK                        0x700u
-#define PORT_PCR_MUX_SHIFT                       8
-#define PORT_PCR_MUX(x)                          (((uint32_t)(((uint32_t)(x))<<PORT_PCR_MUX_SHIFT))&PORT_PCR_MUX_MASK)
-#define PORT_PCR_IRQC_MASK                       0xF0000u
-#define PORT_PCR_IRQC_SHIFT                      16
-#define PORT_PCR_IRQC(x)                         (((uint32_t)(((uint32_t)(x))<<PORT_PCR_IRQC_SHIFT))&PORT_PCR_IRQC_MASK)
-#define PORT_PCR_ISF_MASK                        0x1000000u
-#define PORT_PCR_ISF_SHIFT                       24
-/* GPCLR Bit Fields */
-#define PORT_GPCLR_GPWD_MASK                     0xFFFFu
-#define PORT_GPCLR_GPWD_SHIFT                    0
-#define PORT_GPCLR_GPWD(x)                       (((uint32_t)(((uint32_t)(x))<<PORT_GPCLR_GPWD_SHIFT))&PORT_GPCLR_GPWD_MASK)
-#define PORT_GPCLR_GPWE_MASK                     0xFFFF0000u
-#define PORT_GPCLR_GPWE_SHIFT                    16
-#define PORT_GPCLR_GPWE(x)                       (((uint32_t)(((uint32_t)(x))<<PORT_GPCLR_GPWE_SHIFT))&PORT_GPCLR_GPWE_MASK)
-/* GPCHR Bit Fields */
-#define PORT_GPCHR_GPWD_MASK                     0xFFFFu
-#define PORT_GPCHR_GPWD_SHIFT                    0
-#define PORT_GPCHR_GPWD(x)                       (((uint32_t)(((uint32_t)(x))<<PORT_GPCHR_GPWD_SHIFT))&PORT_GPCHR_GPWD_MASK)
-#define PORT_GPCHR_GPWE_MASK                     0xFFFF0000u
-#define PORT_GPCHR_GPWE_SHIFT                    16
-#define PORT_GPCHR_GPWE(x)                       (((uint32_t)(((uint32_t)(x))<<PORT_GPCHR_GPWE_SHIFT))&PORT_GPCHR_GPWE_MASK)
-/* ISFR Bit Fields */
-#define PORT_ISFR_ISF_MASK                       0xFFFFFFFFu
-#define PORT_ISFR_ISF_SHIFT                      0
-#define PORT_ISFR_ISF(x)                         (((uint32_t)(((uint32_t)(x))<<PORT_ISFR_ISF_SHIFT))&PORT_ISFR_ISF_MASK)
-
-/**
- * @}
- */ /* end of group PORT_Register_Masks */
-
-
-/* PORT - Peripheral instance base addresses */
-/** Peripheral PORTA base address */
-#define PORTA_BASE                               (0x40049000u)
-/** Peripheral PORTA base pointer */
-#define PORTA                                    ((PORT_Type *)PORTA_BASE)
-/** Peripheral PORTB base address */
-#define PORTB_BASE                               (0x4004A000u)
-/** Peripheral PORTB base pointer */
-#define PORTB                                    ((PORT_Type *)PORTB_BASE)
-/** Array initializer of PORT peripheral base pointers */
-#define PORT_BASES                               { PORTA, PORTB }
-
-/**
- * @}
- */ /* end of group PORT_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- RCM Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup RCM_Peripheral_Access_Layer RCM Peripheral Access Layer
- * @{
- */
-
-/** RCM - Register Layout Typedef */
-typedef struct {
-  __I  uint8_t SRS0;                               /**< System Reset Status Register 0, offset: 0x0 */
-  __I  uint8_t SRS1;                               /**< System Reset Status Register 1, offset: 0x1 */
-       uint8_t RESERVED_0[2];
-  __IO uint8_t RPFC;                               /**< Reset Pin Filter Control register, offset: 0x4 */
-  __IO uint8_t RPFW;                               /**< Reset Pin Filter Width register, offset: 0x5 */
-} RCM_Type;
-
-/* ----------------------------------------------------------------------------
-   -- RCM Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup RCM_Register_Masks RCM Register Masks
- * @{
- */
-
-/* SRS0 Bit Fields */
-#define RCM_SRS0_WAKEUP_MASK                     0x1u
-#define RCM_SRS0_WAKEUP_SHIFT                    0
-#define RCM_SRS0_LVD_MASK                        0x2u
-#define RCM_SRS0_LVD_SHIFT                       1
-#define RCM_SRS0_LOC_MASK                        0x4u
-#define RCM_SRS0_LOC_SHIFT                       2
-#define RCM_SRS0_WDOG_MASK                       0x20u
-#define RCM_SRS0_WDOG_SHIFT                      5
-#define RCM_SRS0_PIN_MASK                        0x40u
-#define RCM_SRS0_PIN_SHIFT                       6
-#define RCM_SRS0_POR_MASK                        0x80u
-#define RCM_SRS0_POR_SHIFT                       7
-/* SRS1 Bit Fields */
-#define RCM_SRS1_LOCKUP_MASK                     0x2u
-#define RCM_SRS1_LOCKUP_SHIFT                    1
-#define RCM_SRS1_SW_MASK                         0x4u
-#define RCM_SRS1_SW_SHIFT                        2
-#define RCM_SRS1_MDM_AP_MASK                     0x8u
-#define RCM_SRS1_MDM_AP_SHIFT                    3
-#define RCM_SRS1_SACKERR_MASK                    0x20u
-#define RCM_SRS1_SACKERR_SHIFT                   5
-/* RPFC Bit Fields */
-#define RCM_RPFC_RSTFLTSRW_MASK                  0x3u
-#define RCM_RPFC_RSTFLTSRW_SHIFT                 0
-#define RCM_RPFC_RSTFLTSRW(x)                    (((uint8_t)(((uint8_t)(x))<<RCM_RPFC_RSTFLTSRW_SHIFT))&RCM_RPFC_RSTFLTSRW_MASK)
-#define RCM_RPFC_RSTFLTSS_MASK                   0x4u
-#define RCM_RPFC_RSTFLTSS_SHIFT                  2
-/* RPFW Bit Fields */
-#define RCM_RPFW_RSTFLTSEL_MASK                  0x1Fu
-#define RCM_RPFW_RSTFLTSEL_SHIFT                 0
-#define RCM_RPFW_RSTFLTSEL(x)                    (((uint8_t)(((uint8_t)(x))<<RCM_RPFW_RSTFLTSEL_SHIFT))&RCM_RPFW_RSTFLTSEL_MASK)
-
-/**
- * @}
- */ /* end of group RCM_Register_Masks */
-
-
-/* RCM - Peripheral instance base addresses */
-/** Peripheral RCM base address */
-#define RCM_BASE                                 (0x4007F000u)
-/** Peripheral RCM base pointer */
-#define RCM                                      ((RCM_Type *)RCM_BASE)
-/** Array initializer of RCM peripheral base pointers */
-#define RCM_BASES                                { RCM }
-
-/**
- * @}
- */ /* end of group RCM_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- ROM Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup ROM_Peripheral_Access_Layer ROM Peripheral Access Layer
- * @{
- */
-
-/** ROM - Register Layout Typedef */
-typedef struct {
-  __I  uint32_t ENTRY[3];                          /**< Entry, array offset: 0x0, array step: 0x4 */
-  __I  uint32_t TABLEMARK;                         /**< End of Table Marker Register, offset: 0xC */
-       uint8_t RESERVED_0[4028];
-  __I  uint32_t SYSACCESS;                         /**< System Access Register, offset: 0xFCC */
-  __I  uint32_t PERIPHID4;                         /**< Peripheral ID Register, offset: 0xFD0 */
-  __I  uint32_t PERIPHID5;                         /**< Peripheral ID Register, offset: 0xFD4 */
-  __I  uint32_t PERIPHID6;                         /**< Peripheral ID Register, offset: 0xFD8 */
-  __I  uint32_t PERIPHID7;                         /**< Peripheral ID Register, offset: 0xFDC */
-  __I  uint32_t PERIPHID0;                         /**< Peripheral ID Register, offset: 0xFE0 */
-  __I  uint32_t PERIPHID1;                         /**< Peripheral ID Register, offset: 0xFE4 */
-  __I  uint32_t PERIPHID2;                         /**< Peripheral ID Register, offset: 0xFE8 */
-  __I  uint32_t PERIPHID3;                         /**< Peripheral ID Register, offset: 0xFEC */
-  __I  uint32_t COMPID[4];                         /**< Component ID Register, array offset: 0xFF0, array step: 0x4 */
-} ROM_Type;
-
-/* ----------------------------------------------------------------------------
-   -- ROM Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup ROM_Register_Masks ROM Register Masks
- * @{
- */
-
-/* ENTRY Bit Fields */
-#define ROM_ENTRY_ENTRY_MASK                     0xFFFFFFFFu
-#define ROM_ENTRY_ENTRY_SHIFT                    0
-#define ROM_ENTRY_ENTRY(x)                       (((uint32_t)(((uint32_t)(x))<<ROM_ENTRY_ENTRY_SHIFT))&ROM_ENTRY_ENTRY_MASK)
-/* TABLEMARK Bit Fields */
-#define ROM_TABLEMARK_MARK_MASK                  0xFFFFFFFFu
-#define ROM_TABLEMARK_MARK_SHIFT                 0
-#define ROM_TABLEMARK_MARK(x)                    (((uint32_t)(((uint32_t)(x))<<ROM_TABLEMARK_MARK_SHIFT))&ROM_TABLEMARK_MARK_MASK)
-/* SYSACCESS Bit Fields */
-#define ROM_SYSACCESS_SYSACCESS_MASK             0xFFFFFFFFu
-#define ROM_SYSACCESS_SYSACCESS_SHIFT            0
-#define ROM_SYSACCESS_SYSACCESS(x)               (((uint32_t)(((uint32_t)(x))<<ROM_SYSACCESS_SYSACCESS_SHIFT))&ROM_SYSACCESS_SYSACCESS_MASK)
-/* PERIPHID4 Bit Fields */
-#define ROM_PERIPHID4_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID4_PERIPHID_SHIFT             0
-#define ROM_PERIPHID4_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID4_PERIPHID_SHIFT))&ROM_PERIPHID4_PERIPHID_MASK)
-/* PERIPHID5 Bit Fields */
-#define ROM_PERIPHID5_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID5_PERIPHID_SHIFT             0
-#define ROM_PERIPHID5_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID5_PERIPHID_SHIFT))&ROM_PERIPHID5_PERIPHID_MASK)
-/* PERIPHID6 Bit Fields */
-#define ROM_PERIPHID6_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID6_PERIPHID_SHIFT             0
-#define ROM_PERIPHID6_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID6_PERIPHID_SHIFT))&ROM_PERIPHID6_PERIPHID_MASK)
-/* PERIPHID7 Bit Fields */
-#define ROM_PERIPHID7_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID7_PERIPHID_SHIFT             0
-#define ROM_PERIPHID7_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID7_PERIPHID_SHIFT))&ROM_PERIPHID7_PERIPHID_MASK)
-/* PERIPHID0 Bit Fields */
-#define ROM_PERIPHID0_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID0_PERIPHID_SHIFT             0
-#define ROM_PERIPHID0_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID0_PERIPHID_SHIFT))&ROM_PERIPHID0_PERIPHID_MASK)
-/* PERIPHID1 Bit Fields */
-#define ROM_PERIPHID1_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID1_PERIPHID_SHIFT             0
-#define ROM_PERIPHID1_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID1_PERIPHID_SHIFT))&ROM_PERIPHID1_PERIPHID_MASK)
-/* PERIPHID2 Bit Fields */
-#define ROM_PERIPHID2_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID2_PERIPHID_SHIFT             0
-#define ROM_PERIPHID2_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID2_PERIPHID_SHIFT))&ROM_PERIPHID2_PERIPHID_MASK)
-/* PERIPHID3 Bit Fields */
-#define ROM_PERIPHID3_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID3_PERIPHID_SHIFT             0
-#define ROM_PERIPHID3_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID3_PERIPHID_SHIFT))&ROM_PERIPHID3_PERIPHID_MASK)
-/* COMPID Bit Fields */
-#define ROM_COMPID_COMPID_MASK                   0xFFFFFFFFu
-#define ROM_COMPID_COMPID_SHIFT                  0
-#define ROM_COMPID_COMPID(x)                     (((uint32_t)(((uint32_t)(x))<<ROM_COMPID_COMPID_SHIFT))&ROM_COMPID_COMPID_MASK)
-
-/**
- * @}
- */ /* end of group ROM_Register_Masks */
-
-
-/* ROM - Peripheral instance base addresses */
-/** Peripheral ROM base address */
-#define ROM_BASE                                 (0xF0002000u)
-/** Peripheral ROM base pointer */
-#define ROM                                      ((ROM_Type *)ROM_BASE)
-/** Array initializer of ROM peripheral base pointers */
-#define ROM_BASES                                { ROM }
-
-/**
- * @}
- */ /* end of group ROM_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- RTC Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup RTC_Peripheral_Access_Layer RTC Peripheral Access Layer
- * @{
- */
-
-/** RTC - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t TSR;                               /**< RTC Time Seconds Register, offset: 0x0 */
-  __IO uint32_t TPR;                               /**< RTC Time Prescaler Register, offset: 0x4 */
-  __IO uint32_t TAR;                               /**< RTC Time Alarm Register, offset: 0x8 */
-  __IO uint32_t TCR;                               /**< RTC Time Compensation Register, offset: 0xC */
-  __IO uint32_t CR;                                /**< RTC Control Register, offset: 0x10 */
-  __IO uint32_t SR;                                /**< RTC Status Register, offset: 0x14 */
-  __IO uint32_t LR;                                /**< RTC Lock Register, offset: 0x18 */
-  __IO uint32_t IER;                               /**< RTC Interrupt Enable Register, offset: 0x1C */
-} RTC_Type;
-
-/* ----------------------------------------------------------------------------
-   -- RTC Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup RTC_Register_Masks RTC Register Masks
- * @{
- */
-
-/* TSR Bit Fields */
-#define RTC_TSR_TSR_MASK                         0xFFFFFFFFu
-#define RTC_TSR_TSR_SHIFT                        0
-#define RTC_TSR_TSR(x)                           (((uint32_t)(((uint32_t)(x))<<RTC_TSR_TSR_SHIFT))&RTC_TSR_TSR_MASK)
-/* TPR Bit Fields */
-#define RTC_TPR_TPR_MASK                         0xFFFFu
-#define RTC_TPR_TPR_SHIFT                        0
-#define RTC_TPR_TPR(x)                           (((uint32_t)(((uint32_t)(x))<<RTC_TPR_TPR_SHIFT))&RTC_TPR_TPR_MASK)
-/* TAR Bit Fields */
-#define RTC_TAR_TAR_MASK                         0xFFFFFFFFu
-#define RTC_TAR_TAR_SHIFT                        0
-#define RTC_TAR_TAR(x)                           (((uint32_t)(((uint32_t)(x))<<RTC_TAR_TAR_SHIFT))&RTC_TAR_TAR_MASK)
-/* TCR Bit Fields */
-#define RTC_TCR_TCR_MASK                         0xFFu
-#define RTC_TCR_TCR_SHIFT                        0
-#define RTC_TCR_TCR(x)                           (((uint32_t)(((uint32_t)(x))<<RTC_TCR_TCR_SHIFT))&RTC_TCR_TCR_MASK)
-#define RTC_TCR_CIR_MASK                         0xFF00u
-#define RTC_TCR_CIR_SHIFT                        8
-#define RTC_TCR_CIR(x)                           (((uint32_t)(((uint32_t)(x))<<RTC_TCR_CIR_SHIFT))&RTC_TCR_CIR_MASK)
-#define RTC_TCR_TCV_MASK                         0xFF0000u
-#define RTC_TCR_TCV_SHIFT                        16
-#define RTC_TCR_TCV(x)                           (((uint32_t)(((uint32_t)(x))<<RTC_TCR_TCV_SHIFT))&RTC_TCR_TCV_MASK)
-#define RTC_TCR_CIC_MASK                         0xFF000000u
-#define RTC_TCR_CIC_SHIFT                        24
-#define RTC_TCR_CIC(x)                           (((uint32_t)(((uint32_t)(x))<<RTC_TCR_CIC_SHIFT))&RTC_TCR_CIC_MASK)
-/* CR Bit Fields */
-#define RTC_CR_SWR_MASK                          0x1u
-#define RTC_CR_SWR_SHIFT                         0
-#define RTC_CR_WPE_MASK                          0x2u
-#define RTC_CR_WPE_SHIFT                         1
-#define RTC_CR_SUP_MASK                          0x4u
-#define RTC_CR_SUP_SHIFT                         2
-#define RTC_CR_UM_MASK                           0x8u
-#define RTC_CR_UM_SHIFT                          3
-#define RTC_CR_OSCE_MASK                         0x100u
-#define RTC_CR_OSCE_SHIFT                        8
-#define RTC_CR_CLKO_MASK                         0x200u
-#define RTC_CR_CLKO_SHIFT                        9
-#define RTC_CR_SC16P_MASK                        0x400u
-#define RTC_CR_SC16P_SHIFT                       10
-#define RTC_CR_SC8P_MASK                         0x800u
-#define RTC_CR_SC8P_SHIFT                        11
-#define RTC_CR_SC4P_MASK                         0x1000u
-#define RTC_CR_SC4P_SHIFT                        12
-#define RTC_CR_SC2P_MASK                         0x2000u
-#define RTC_CR_SC2P_SHIFT                        13
-/* SR Bit Fields */
-#define RTC_SR_TIF_MASK                          0x1u
-#define RTC_SR_TIF_SHIFT                         0
-#define RTC_SR_TOF_MASK                          0x2u
-#define RTC_SR_TOF_SHIFT                         1
-#define RTC_SR_TAF_MASK                          0x4u
-#define RTC_SR_TAF_SHIFT                         2
-#define RTC_SR_TCE_MASK                          0x10u
-#define RTC_SR_TCE_SHIFT                         4
-/* LR Bit Fields */
-#define RTC_LR_TCL_MASK                          0x8u
-#define RTC_LR_TCL_SHIFT                         3
-#define RTC_LR_CRL_MASK                          0x10u
-#define RTC_LR_CRL_SHIFT                         4
-#define RTC_LR_SRL_MASK                          0x20u
-#define RTC_LR_SRL_SHIFT                         5
-#define RTC_LR_LRL_MASK                          0x40u
-#define RTC_LR_LRL_SHIFT                         6
-/* IER Bit Fields */
-#define RTC_IER_TIIE_MASK                        0x1u
-#define RTC_IER_TIIE_SHIFT                       0
-#define RTC_IER_TOIE_MASK                        0x2u
-#define RTC_IER_TOIE_SHIFT                       1
-#define RTC_IER_TAIE_MASK                        0x4u
-#define RTC_IER_TAIE_SHIFT                       2
-#define RTC_IER_TSIE_MASK                        0x10u
-#define RTC_IER_TSIE_SHIFT                       4
-#define RTC_IER_WPON_MASK                        0x80u
-#define RTC_IER_WPON_SHIFT                       7
-
-/**
- * @}
- */ /* end of group RTC_Register_Masks */
-
-
-/* RTC - Peripheral instance base addresses */
-/** Peripheral RTC base address */
-#define RTC_BASE                                 (0x4003D000u)
-/** Peripheral RTC base pointer */
-#define RTC                                      ((RTC_Type *)RTC_BASE)
-/** Array initializer of RTC peripheral base pointers */
-#define RTC_BASES                                { RTC }
-
-/**
- * @}
- */ /* end of group RTC_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- SIM Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup SIM_Peripheral_Access_Layer SIM Peripheral Access Layer
- * @{
- */
-
-/** SIM - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t SOPT1;                             /**< System Options Register 1, offset: 0x0 */
-  __I  uint32_t SOPT1CFG;                          /**< SOPT1 Configuration Register, offset: 0x4 */
-       uint8_t RESERVED_0[4092];
-  __IO uint32_t SOPT2;                             /**< System Options Register 2, offset: 0x1004 */
-       uint8_t RESERVED_1[4];
-  __IO uint32_t SOPT4;                             /**< System Options Register 4, offset: 0x100C */
-  __IO uint32_t SOPT5;                             /**< System Options Register 5, offset: 0x1010 */
-       uint8_t RESERVED_2[4];
-  __IO uint32_t SOPT7;                             /**< System Options Register 7, offset: 0x1018 */
-       uint8_t RESERVED_3[8];
-  __I  uint32_t SDID;                              /**< System Device Identification Register, offset: 0x1024 */
-       uint8_t RESERVED_4[12];
-  __IO uint32_t SCGC4;                             /**< System Clock Gating Control Register 4, offset: 0x1034 */
-  __IO uint32_t SCGC5;                             /**< System Clock Gating Control Register 5, offset: 0x1038 */
-  __IO uint32_t SCGC6;                             /**< System Clock Gating Control Register 6, offset: 0x103C */
-  __IO uint32_t SCGC7;                             /**< System Clock Gating Control Register 7, offset: 0x1040 */
-  __IO uint32_t CLKDIV1;                           /**< System Clock Divider Register 1, offset: 0x1044 */
-       uint8_t RESERVED_5[4];
-  __IO uint32_t FCFG1;                             /**< Flash Configuration Register 1, offset: 0x104C */
-  __I  uint32_t FCFG2;                             /**< Flash Configuration Register 2, offset: 0x1050 */
-       uint8_t RESERVED_6[4];
-  __I  uint32_t UIDMH;                             /**< Unique Identification Register Mid-High, offset: 0x1058 */
-  __I  uint32_t UIDML;                             /**< Unique Identification Register Mid Low, offset: 0x105C */
-  __I  uint32_t UIDL;                              /**< Unique Identification Register Low, offset: 0x1060 */
-       uint8_t RESERVED_7[156];
-  __IO uint32_t COPC;                              /**< COP Control Register, offset: 0x1100 */
-  __O  uint32_t SRVCOP;                            /**< Service COP Register, offset: 0x1104 */
-} SIM_Type;
-
-/* ----------------------------------------------------------------------------
-   -- SIM Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup SIM_Register_Masks SIM Register Masks
- * @{
- */
-
-/* SOPT1 Bit Fields */
-#define SIM_SOPT1_OSC32KSEL_MASK                 0xC0000u
-#define SIM_SOPT1_OSC32KSEL_SHIFT                18
-#define SIM_SOPT1_OSC32KSEL(x)                   (((uint32_t)(((uint32_t)(x))<<SIM_SOPT1_OSC32KSEL_SHIFT))&SIM_SOPT1_OSC32KSEL_MASK)
-/* SOPT2 Bit Fields */
-#define SIM_SOPT2_RTCCLKOUTSEL_MASK              0x10u
-#define SIM_SOPT2_RTCCLKOUTSEL_SHIFT             4
-#define SIM_SOPT2_CLKOUTSEL_MASK                 0xE0u
-#define SIM_SOPT2_CLKOUTSEL_SHIFT                5
-#define SIM_SOPT2_CLKOUTSEL(x)                   (((uint32_t)(((uint32_t)(x))<<SIM_SOPT2_CLKOUTSEL_SHIFT))&SIM_SOPT2_CLKOUTSEL_MASK)
-#define SIM_SOPT2_TPMSRC_MASK                    0x3000000u
-#define SIM_SOPT2_TPMSRC_SHIFT                   24
-#define SIM_SOPT2_TPMSRC(x)                      (((uint32_t)(((uint32_t)(x))<<SIM_SOPT2_TPMSRC_SHIFT))&SIM_SOPT2_TPMSRC_MASK)
-#define SIM_SOPT2_UART0SRC_MASK                  0xC000000u
-#define SIM_SOPT2_UART0SRC_SHIFT                 26
-#define SIM_SOPT2_UART0SRC(x)                    (((uint32_t)(((uint32_t)(x))<<SIM_SOPT2_UART0SRC_SHIFT))&SIM_SOPT2_UART0SRC_MASK)
-/* SOPT4 Bit Fields */
-#define SIM_SOPT4_TPM1CH0SRC_MASK                0x40000u
-#define SIM_SOPT4_TPM1CH0SRC_SHIFT               18
-#define SIM_SOPT4_TPM0CLKSEL_MASK                0x1000000u
-#define SIM_SOPT4_TPM0CLKSEL_SHIFT               24
-#define SIM_SOPT4_TPM1CLKSEL_MASK                0x2000000u
-#define SIM_SOPT4_TPM1CLKSEL_SHIFT               25
-/* SOPT5 Bit Fields */
-#define SIM_SOPT5_UART0TXSRC_MASK                0x1u
-#define SIM_SOPT5_UART0TXSRC_SHIFT               0
-#define SIM_SOPT5_UART0RXSRC_MASK                0x4u
-#define SIM_SOPT5_UART0RXSRC_SHIFT               2
-#define SIM_SOPT5_UART0ODE_MASK                  0x10000u
-#define SIM_SOPT5_UART0ODE_SHIFT                 16
-/* SOPT7 Bit Fields */
-#define SIM_SOPT7_ADC0TRGSEL_MASK                0xFu
-#define SIM_SOPT7_ADC0TRGSEL_SHIFT               0
-#define SIM_SOPT7_ADC0TRGSEL(x)                  (((uint32_t)(((uint32_t)(x))<<SIM_SOPT7_ADC0TRGSEL_SHIFT))&SIM_SOPT7_ADC0TRGSEL_MASK)
-#define SIM_SOPT7_ADC0PRETRGSEL_MASK             0x10u
-#define SIM_SOPT7_ADC0PRETRGSEL_SHIFT            4
-#define SIM_SOPT7_ADC0ALTTRGEN_MASK              0x80u
-#define SIM_SOPT7_ADC0ALTTRGEN_SHIFT             7
-/* SDID Bit Fields */
-#define SIM_SDID_PINID_MASK                      0xFu
-#define SIM_SDID_PINID_SHIFT                     0
-#define SIM_SDID_PINID(x)                        (((uint32_t)(((uint32_t)(x))<<SIM_SDID_PINID_SHIFT))&SIM_SDID_PINID_MASK)
-#define SIM_SDID_DIEID_MASK                      0xF80u
-#define SIM_SDID_DIEID_SHIFT                     7
-#define SIM_SDID_DIEID(x)                        (((uint32_t)(((uint32_t)(x))<<SIM_SDID_DIEID_SHIFT))&SIM_SDID_DIEID_MASK)
-#define SIM_SDID_REVID_MASK                      0xF000u
-#define SIM_SDID_REVID_SHIFT                     12
-#define SIM_SDID_REVID(x)                        (((uint32_t)(((uint32_t)(x))<<SIM_SDID_REVID_SHIFT))&SIM_SDID_REVID_MASK)
-#define SIM_SDID_SRAMSIZE_MASK                   0xF0000u
-#define SIM_SDID_SRAMSIZE_SHIFT                  16
-#define SIM_SDID_SRAMSIZE(x)                     (((uint32_t)(((uint32_t)(x))<<SIM_SDID_SRAMSIZE_SHIFT))&SIM_SDID_SRAMSIZE_MASK)
-#define SIM_SDID_SERIESID_MASK                   0xF00000u
-#define SIM_SDID_SERIESID_SHIFT                  20
-#define SIM_SDID_SERIESID(x)                     (((uint32_t)(((uint32_t)(x))<<SIM_SDID_SERIESID_SHIFT))&SIM_SDID_SERIESID_MASK)
-#define SIM_SDID_SUBFAMID_MASK                   0xF000000u
-#define SIM_SDID_SUBFAMID_SHIFT                  24
-#define SIM_SDID_SUBFAMID(x)                     (((uint32_t)(((uint32_t)(x))<<SIM_SDID_SUBFAMID_SHIFT))&SIM_SDID_SUBFAMID_MASK)
-#define SIM_SDID_FAMID_MASK                      0xF0000000u
-#define SIM_SDID_FAMID_SHIFT                     28
-#define SIM_SDID_FAMID(x)                        (((uint32_t)(((uint32_t)(x))<<SIM_SDID_FAMID_SHIFT))&SIM_SDID_FAMID_MASK)
-/* SCGC4 Bit Fields */
-#define SIM_SCGC4_I2C0_MASK                      0x40u
-#define SIM_SCGC4_I2C0_SHIFT                     6
-#define SIM_SCGC4_UART0_MASK                     0x400u
-#define SIM_SCGC4_UART0_SHIFT                    10
-#define SIM_SCGC4_CMP_MASK                       0x80000u
-#define SIM_SCGC4_CMP_SHIFT                      19
-#define SIM_SCGC4_SPI0_MASK                      0x400000u
-#define SIM_SCGC4_SPI0_SHIFT                     22
-/* SCGC5 Bit Fields */
-#define SIM_SCGC5_LPTMR_MASK                     0x1u
-#define SIM_SCGC5_LPTMR_SHIFT                    0
-#define SIM_SCGC5_TSI_MASK                       0x20u
-#define SIM_SCGC5_TSI_SHIFT                      5
-#define SIM_SCGC5_PORTA_MASK                     0x200u
-#define SIM_SCGC5_PORTA_SHIFT                    9
-#define SIM_SCGC5_PORTB_MASK                     0x400u
-#define SIM_SCGC5_PORTB_SHIFT                    10
-/* SCGC6 Bit Fields */
-#define SIM_SCGC6_FTF_MASK                       0x1u
-#define SIM_SCGC6_FTF_SHIFT                      0
-#define SIM_SCGC6_DMAMUX_MASK                    0x2u
-#define SIM_SCGC6_DMAMUX_SHIFT                   1
-#define SIM_SCGC6_PIT_MASK                       0x800000u
-#define SIM_SCGC6_PIT_SHIFT                      23
-#define SIM_SCGC6_TPM0_MASK                      0x1000000u
-#define SIM_SCGC6_TPM0_SHIFT                     24
-#define SIM_SCGC6_TPM1_MASK                      0x2000000u
-#define SIM_SCGC6_TPM1_SHIFT                     25
-#define SIM_SCGC6_ADC0_MASK                      0x8000000u
-#define SIM_SCGC6_ADC0_SHIFT                     27
-#define SIM_SCGC6_RTC_MASK                       0x20000000u
-#define SIM_SCGC6_RTC_SHIFT                      29
-#define SIM_SCGC6_DAC0_MASK                      0x80000000u
-#define SIM_SCGC6_DAC0_SHIFT                     31
-/* SCGC7 Bit Fields */
-#define SIM_SCGC7_DMA_MASK                       0x100u
-#define SIM_SCGC7_DMA_SHIFT                      8
-/* CLKDIV1 Bit Fields */
-#define SIM_CLKDIV1_OUTDIV4_MASK                 0x70000u
-#define SIM_CLKDIV1_OUTDIV4_SHIFT                16
-#define SIM_CLKDIV1_OUTDIV4(x)                   (((uint32_t)(((uint32_t)(x))<<SIM_CLKDIV1_OUTDIV4_SHIFT))&SIM_CLKDIV1_OUTDIV4_MASK)
-#define SIM_CLKDIV1_OUTDIV1_MASK                 0xF0000000u
-#define SIM_CLKDIV1_OUTDIV1_SHIFT                28
-#define SIM_CLKDIV1_OUTDIV1(x)                   (((uint32_t)(((uint32_t)(x))<<SIM_CLKDIV1_OUTDIV1_SHIFT))&SIM_CLKDIV1_OUTDIV1_MASK)
-/* FCFG1 Bit Fields */
-#define SIM_FCFG1_FLASHDIS_MASK                  0x1u
-#define SIM_FCFG1_FLASHDIS_SHIFT                 0
-#define SIM_FCFG1_FLASHDOZE_MASK                 0x2u
-#define SIM_FCFG1_FLASHDOZE_SHIFT                1
-#define SIM_FCFG1_PFSIZE_MASK                    0xF000000u
-#define SIM_FCFG1_PFSIZE_SHIFT                   24
-#define SIM_FCFG1_PFSIZE(x)                      (((uint32_t)(((uint32_t)(x))<<SIM_FCFG1_PFSIZE_SHIFT))&SIM_FCFG1_PFSIZE_MASK)
-/* FCFG2 Bit Fields */
-#define SIM_FCFG2_MAXADDR0_MASK                  0x7F000000u
-#define SIM_FCFG2_MAXADDR0_SHIFT                 24
-#define SIM_FCFG2_MAXADDR0(x)                    (((uint32_t)(((uint32_t)(x))<<SIM_FCFG2_MAXADDR0_SHIFT))&SIM_FCFG2_MAXADDR0_MASK)
-/* UIDMH Bit Fields */
-#define SIM_UIDMH_UID_MASK                       0xFFFFu
-#define SIM_UIDMH_UID_SHIFT                      0
-#define SIM_UIDMH_UID(x)                         (((uint32_t)(((uint32_t)(x))<<SIM_UIDMH_UID_SHIFT))&SIM_UIDMH_UID_MASK)
-/* UIDML Bit Fields */
-#define SIM_UIDML_UID_MASK                       0xFFFFFFFFu
-#define SIM_UIDML_UID_SHIFT                      0
-#define SIM_UIDML_UID(x)                         (((uint32_t)(((uint32_t)(x))<<SIM_UIDML_UID_SHIFT))&SIM_UIDML_UID_MASK)
-/* UIDL Bit Fields */
-#define SIM_UIDL_UID_MASK                        0xFFFFFFFFu
-#define SIM_UIDL_UID_SHIFT                       0
-#define SIM_UIDL_UID(x)                          (((uint32_t)(((uint32_t)(x))<<SIM_UIDL_UID_SHIFT))&SIM_UIDL_UID_MASK)
-/* COPC Bit Fields */
-#define SIM_COPC_COPW_MASK                       0x1u
-#define SIM_COPC_COPW_SHIFT                      0
-#define SIM_COPC_COPCLKS_MASK                    0x2u
-#define SIM_COPC_COPCLKS_SHIFT                   1
-#define SIM_COPC_COPT_MASK                       0xCu
-#define SIM_COPC_COPT_SHIFT                      2
-#define SIM_COPC_COPT(x)                         (((uint32_t)(((uint32_t)(x))<<SIM_COPC_COPT_SHIFT))&SIM_COPC_COPT_MASK)
-/* SRVCOP Bit Fields */
-#define SIM_SRVCOP_SRVCOP_MASK                   0xFFu
-#define SIM_SRVCOP_SRVCOP_SHIFT                  0
-#define SIM_SRVCOP_SRVCOP(x)                     (((uint32_t)(((uint32_t)(x))<<SIM_SRVCOP_SRVCOP_SHIFT))&SIM_SRVCOP_SRVCOP_MASK)
-
-/**
- * @}
- */ /* end of group SIM_Register_Masks */
-
-
-/* SIM - Peripheral instance base addresses */
-/** Peripheral SIM base address */
-#define SIM_BASE                                 (0x40047000u)
-/** Peripheral SIM base pointer */
-#define SIM                                      ((SIM_Type *)SIM_BASE)
-/** Array initializer of SIM peripheral base pointers */
-#define SIM_BASES                                { SIM }
-
-/**
- * @}
- */ /* end of group SIM_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- SMC Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup SMC_Peripheral_Access_Layer SMC Peripheral Access Layer
- * @{
- */
-
-/** SMC - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t PMPROT;                             /**< Power Mode Protection register, offset: 0x0 */
-  __IO uint8_t PMCTRL;                             /**< Power Mode Control register, offset: 0x1 */
-  __IO uint8_t STOPCTRL;                           /**< Stop Control Register, offset: 0x2 */
-  __I  uint8_t PMSTAT;                             /**< Power Mode Status register, offset: 0x3 */
-} SMC_Type;
-
-/* ----------------------------------------------------------------------------
-   -- SMC Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup SMC_Register_Masks SMC Register Masks
- * @{
- */
-
-/* PMPROT Bit Fields */
-#define SMC_PMPROT_AVLLS_MASK                    0x2u
-#define SMC_PMPROT_AVLLS_SHIFT                   1
-#define SMC_PMPROT_ALLS_MASK                     0x8u
-#define SMC_PMPROT_ALLS_SHIFT                    3
-#define SMC_PMPROT_AVLP_MASK                     0x20u
-#define SMC_PMPROT_AVLP_SHIFT                    5
-/* PMCTRL Bit Fields */
-#define SMC_PMCTRL_STOPM_MASK                    0x7u
-#define SMC_PMCTRL_STOPM_SHIFT                   0
-#define SMC_PMCTRL_STOPM(x)                      (((uint8_t)(((uint8_t)(x))<<SMC_PMCTRL_STOPM_SHIFT))&SMC_PMCTRL_STOPM_MASK)
-#define SMC_PMCTRL_STOPA_MASK                    0x8u
-#define SMC_PMCTRL_STOPA_SHIFT                   3
-#define SMC_PMCTRL_RUNM_MASK                     0x60u
-#define SMC_PMCTRL_RUNM_SHIFT                    5
-#define SMC_PMCTRL_RUNM(x)                       (((uint8_t)(((uint8_t)(x))<<SMC_PMCTRL_RUNM_SHIFT))&SMC_PMCTRL_RUNM_MASK)
-/* STOPCTRL Bit Fields */
-#define SMC_STOPCTRL_VLLSM_MASK                  0x7u
-#define SMC_STOPCTRL_VLLSM_SHIFT                 0
-#define SMC_STOPCTRL_VLLSM(x)                    (((uint8_t)(((uint8_t)(x))<<SMC_STOPCTRL_VLLSM_SHIFT))&SMC_STOPCTRL_VLLSM_MASK)
-#define SMC_STOPCTRL_PORPO_MASK                  0x20u
-#define SMC_STOPCTRL_PORPO_SHIFT                 5
-#define SMC_STOPCTRL_PSTOPO_MASK                 0xC0u
-#define SMC_STOPCTRL_PSTOPO_SHIFT                6
-#define SMC_STOPCTRL_PSTOPO(x)                   (((uint8_t)(((uint8_t)(x))<<SMC_STOPCTRL_PSTOPO_SHIFT))&SMC_STOPCTRL_PSTOPO_MASK)
-/* PMSTAT Bit Fields */
-#define SMC_PMSTAT_PMSTAT_MASK                   0x7Fu
-#define SMC_PMSTAT_PMSTAT_SHIFT                  0
-#define SMC_PMSTAT_PMSTAT(x)                     (((uint8_t)(((uint8_t)(x))<<SMC_PMSTAT_PMSTAT_SHIFT))&SMC_PMSTAT_PMSTAT_MASK)
-
-/**
- * @}
- */ /* end of group SMC_Register_Masks */
-
-
-/* SMC - Peripheral instance base addresses */
-/** Peripheral SMC base address */
-#define SMC_BASE                                 (0x4007E000u)
-/** Peripheral SMC base pointer */
-#define SMC                                      ((SMC_Type *)SMC_BASE)
-/** Array initializer of SMC peripheral base pointers */
-#define SMC_BASES                                { SMC }
-
-/**
- * @}
- */ /* end of group SMC_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- SPI Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup SPI_Peripheral_Access_Layer SPI Peripheral Access Layer
- * @{
- */
-
-/** SPI - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t C1;                                 /**< SPI control register 1, offset: 0x0 */
-  __IO uint8_t C2;                                 /**< SPI control register 2, offset: 0x1 */
-  __IO uint8_t BR;                                 /**< SPI baud rate register, offset: 0x2 */
-  __I  uint8_t S;                                  /**< SPI status register, offset: 0x3 */
-       uint8_t RESERVED_0[1];
-  __IO uint8_t D;                                  /**< SPI data register, offset: 0x5 */
-       uint8_t RESERVED_1[1];
-  __IO uint8_t M;                                  /**< SPI match register, offset: 0x7 */
-} SPI_Type;
-
-/* ----------------------------------------------------------------------------
-   -- SPI Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup SPI_Register_Masks SPI Register Masks
- * @{
- */
-
-/* C1 Bit Fields */
-#define SPI_C1_LSBFE_MASK                        0x1u
-#define SPI_C1_LSBFE_SHIFT                       0
-#define SPI_C1_SSOE_MASK                         0x2u
-#define SPI_C1_SSOE_SHIFT                        1
-#define SPI_C1_CPHA_MASK                         0x4u
-#define SPI_C1_CPHA_SHIFT                        2
-#define SPI_C1_CPOL_MASK                         0x8u
-#define SPI_C1_CPOL_SHIFT                        3
-#define SPI_C1_MSTR_MASK                         0x10u
-#define SPI_C1_MSTR_SHIFT                        4
-#define SPI_C1_SPTIE_MASK                        0x20u
-#define SPI_C1_SPTIE_SHIFT                       5
-#define SPI_C1_SPE_MASK                          0x40u
-#define SPI_C1_SPE_SHIFT                         6
-#define SPI_C1_SPIE_MASK                         0x80u
-#define SPI_C1_SPIE_SHIFT                        7
-/* C2 Bit Fields */
-#define SPI_C2_SPC0_MASK                         0x1u
-#define SPI_C2_SPC0_SHIFT                        0
-#define SPI_C2_SPISWAI_MASK                      0x2u
-#define SPI_C2_SPISWAI_SHIFT                     1
-#define SPI_C2_RXDMAE_MASK                       0x4u
-#define SPI_C2_RXDMAE_SHIFT                      2
-#define SPI_C2_BIDIROE_MASK                      0x8u
-#define SPI_C2_BIDIROE_SHIFT                     3
-#define SPI_C2_MODFEN_MASK                       0x10u
-#define SPI_C2_MODFEN_SHIFT                      4
-#define SPI_C2_TXDMAE_MASK                       0x20u
-#define SPI_C2_TXDMAE_SHIFT                      5
-#define SPI_C2_SPMIE_MASK                        0x80u
-#define SPI_C2_SPMIE_SHIFT                       7
-/* BR Bit Fields */
-#define SPI_BR_SPR_MASK                          0xFu
-#define SPI_BR_SPR_SHIFT                         0
-#define SPI_BR_SPR(x)                            (((uint8_t)(((uint8_t)(x))<<SPI_BR_SPR_SHIFT))&SPI_BR_SPR_MASK)
-#define SPI_BR_SPPR_MASK                         0x70u
-#define SPI_BR_SPPR_SHIFT                        4
-#define SPI_BR_SPPR(x)                           (((uint8_t)(((uint8_t)(x))<<SPI_BR_SPPR_SHIFT))&SPI_BR_SPPR_MASK)
-/* S Bit Fields */
-#define SPI_S_MODF_MASK                          0x10u
-#define SPI_S_MODF_SHIFT                         4
-#define SPI_S_SPTEF_MASK                         0x20u
-#define SPI_S_SPTEF_SHIFT                        5
-#define SPI_S_SPMF_MASK                          0x40u
-#define SPI_S_SPMF_SHIFT                         6
-#define SPI_S_SPRF_MASK                          0x80u
-#define SPI_S_SPRF_SHIFT                         7
-/* D Bit Fields */
-#define SPI_D_Bits_MASK                          0xFFu
-#define SPI_D_Bits_SHIFT                         0
-#define SPI_D_Bits(x)                            (((uint8_t)(((uint8_t)(x))<<SPI_D_Bits_SHIFT))&SPI_D_Bits_MASK)
-/* M Bit Fields */
-#define SPI_M_Bits_MASK                          0xFFu
-#define SPI_M_Bits_SHIFT                         0
-#define SPI_M_Bits(x)                            (((uint8_t)(((uint8_t)(x))<<SPI_M_Bits_SHIFT))&SPI_M_Bits_MASK)
-
-/**
- * @}
- */ /* end of group SPI_Register_Masks */
-
-
-/* SPI - Peripheral instance base addresses */
-/** Peripheral SPI0 base address */
-#define SPI0_BASE                                (0x40076000u)
-/** Peripheral SPI0 base pointer */
-#define SPI0                                     ((SPI_Type *)SPI0_BASE)
-/** Array initializer of SPI peripheral base pointers */
-#define SPI_BASES                                { SPI0 }
-
-/**
- * @}
- */ /* end of group SPI_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- TPM Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup TPM_Peripheral_Access_Layer TPM Peripheral Access Layer
- * @{
- */
-
-/** TPM - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t SC;                                /**< Status and Control, offset: 0x0 */
-  __IO uint32_t CNT;                               /**< Counter, offset: 0x4 */
-  __IO uint32_t MOD;                               /**< Modulo, offset: 0x8 */
-  struct {                                         /* offset: 0xC, array step: 0x8 */
-    __IO uint32_t CnSC;                              /**< Channel (n) Status and Control, array offset: 0xC, array step: 0x8 */
-    __IO uint32_t CnV;                               /**< Channel (n) Value, array offset: 0x10, array step: 0x8 */
-  } CONTROLS[6];
-       uint8_t RESERVED_0[20];
-  __IO uint32_t STATUS;                            /**< Capture and Compare Status, offset: 0x50 */
-       uint8_t RESERVED_1[48];
-  __IO uint32_t CONF;                              /**< Configuration, offset: 0x84 */
-} TPM_Type;
-
-/* ----------------------------------------------------------------------------
-   -- TPM Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup TPM_Register_Masks TPM Register Masks
- * @{
- */
-
-/* SC Bit Fields */
-#define TPM_SC_PS_MASK                           0x7u
-#define TPM_SC_PS_SHIFT                          0
-#define TPM_SC_PS(x)                             (((uint32_t)(((uint32_t)(x))<<TPM_SC_PS_SHIFT))&TPM_SC_PS_MASK)
-#define TPM_SC_CMOD_MASK                         0x18u
-#define TPM_SC_CMOD_SHIFT                        3
-#define TPM_SC_CMOD(x)                           (((uint32_t)(((uint32_t)(x))<<TPM_SC_CMOD_SHIFT))&TPM_SC_CMOD_MASK)
-#define TPM_SC_CPWMS_MASK                        0x20u
-#define TPM_SC_CPWMS_SHIFT                       5
-#define TPM_SC_TOIE_MASK                         0x40u
-#define TPM_SC_TOIE_SHIFT                        6
-#define TPM_SC_TOF_MASK                          0x80u
-#define TPM_SC_TOF_SHIFT                         7
-#define TPM_SC_DMA_MASK                          0x100u
-#define TPM_SC_DMA_SHIFT                         8
-/* CNT Bit Fields */
-#define TPM_CNT_COUNT_MASK                       0xFFFFu
-#define TPM_CNT_COUNT_SHIFT                      0
-#define TPM_CNT_COUNT(x)                         (((uint32_t)(((uint32_t)(x))<<TPM_CNT_COUNT_SHIFT))&TPM_CNT_COUNT_MASK)
-/* MOD Bit Fields */
-#define TPM_MOD_MOD_MASK                         0xFFFFu
-#define TPM_MOD_MOD_SHIFT                        0
-#define TPM_MOD_MOD(x)                           (((uint32_t)(((uint32_t)(x))<<TPM_MOD_MOD_SHIFT))&TPM_MOD_MOD_MASK)
-/* CnSC Bit Fields */
-#define TPM_CnSC_DMA_MASK                        0x1u
-#define TPM_CnSC_DMA_SHIFT                       0
-#define TPM_CnSC_ELSA_MASK                       0x4u
-#define TPM_CnSC_ELSA_SHIFT                      2
-#define TPM_CnSC_ELSB_MASK                       0x8u
-#define TPM_CnSC_ELSB_SHIFT                      3
-#define TPM_CnSC_MSA_MASK                        0x10u
-#define TPM_CnSC_MSA_SHIFT                       4
-#define TPM_CnSC_MSB_MASK                        0x20u
-#define TPM_CnSC_MSB_SHIFT                       5
-#define TPM_CnSC_CHIE_MASK                       0x40u
-#define TPM_CnSC_CHIE_SHIFT                      6
-#define TPM_CnSC_CHF_MASK                        0x80u
-#define TPM_CnSC_CHF_SHIFT                       7
-/* CnV Bit Fields */
-#define TPM_CnV_VAL_MASK                         0xFFFFu
-#define TPM_CnV_VAL_SHIFT                        0
-#define TPM_CnV_VAL(x)                           (((uint32_t)(((uint32_t)(x))<<TPM_CnV_VAL_SHIFT))&TPM_CnV_VAL_MASK)
-/* STATUS Bit Fields */
-#define TPM_STATUS_CH0F_MASK                     0x1u
-#define TPM_STATUS_CH0F_SHIFT                    0
-#define TPM_STATUS_CH1F_MASK                     0x2u
-#define TPM_STATUS_CH1F_SHIFT                    1
-#define TPM_STATUS_CH2F_MASK                     0x4u
-#define TPM_STATUS_CH2F_SHIFT                    2
-#define TPM_STATUS_CH3F_MASK                     0x8u
-#define TPM_STATUS_CH3F_SHIFT                    3
-#define TPM_STATUS_CH4F_MASK                     0x10u
-#define TPM_STATUS_CH4F_SHIFT                    4
-#define TPM_STATUS_CH5F_MASK                     0x20u
-#define TPM_STATUS_CH5F_SHIFT                    5
-#define TPM_STATUS_TOF_MASK                      0x100u
-#define TPM_STATUS_TOF_SHIFT                     8
-/* CONF Bit Fields */
-#define TPM_CONF_DOZEEN_MASK                     0x20u
-#define TPM_CONF_DOZEEN_SHIFT                    5
-#define TPM_CONF_DBGMODE_MASK                    0xC0u
-#define TPM_CONF_DBGMODE_SHIFT                   6
-#define TPM_CONF_DBGMODE(x)                      (((uint32_t)(((uint32_t)(x))<<TPM_CONF_DBGMODE_SHIFT))&TPM_CONF_DBGMODE_MASK)
-#define TPM_CONF_GTBEEN_MASK                     0x200u
-#define TPM_CONF_GTBEEN_SHIFT                    9
-#define TPM_CONF_CSOT_MASK                       0x10000u
-#define TPM_CONF_CSOT_SHIFT                      16
-#define TPM_CONF_CSOO_MASK                       0x20000u
-#define TPM_CONF_CSOO_SHIFT                      17
-#define TPM_CONF_CROT_MASK                       0x40000u
-#define TPM_CONF_CROT_SHIFT                      18
-#define TPM_CONF_TRGSEL_MASK                     0xF000000u
-#define TPM_CONF_TRGSEL_SHIFT                    24
-#define TPM_CONF_TRGSEL(x)                       (((uint32_t)(((uint32_t)(x))<<TPM_CONF_TRGSEL_SHIFT))&TPM_CONF_TRGSEL_MASK)
-
-/**
- * @}
- */ /* end of group TPM_Register_Masks */
-
-
-/* TPM - Peripheral instance base addresses */
-/** Peripheral TPM0 base address */
-#define TPM0_BASE                                (0x40038000u)
-/** Peripheral TPM0 base pointer */
-#define TPM0                                     ((TPM_Type *)TPM0_BASE)
-/** Peripheral TPM1 base address */
-#define TPM1_BASE                                (0x40039000u)
-/** Peripheral TPM1 base pointer */
-#define TPM1                                     ((TPM_Type *)TPM1_BASE)
-/** Array initializer of TPM peripheral base pointers */
-#define TPM_BASES                                { TPM0, TPM1 }
-
-/**
- * @}
- */ /* end of group TPM_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- TSI Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup TSI_Peripheral_Access_Layer TSI Peripheral Access Layer
- * @{
- */
-
-/** TSI - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t GENCS;                             /**< TSI General Control and Status Register, offset: 0x0 */
-  __IO uint32_t DATA;                              /**< TSI DATA Register, offset: 0x4 */
-  __IO uint32_t TSHD;                              /**< TSI Threshold Register, offset: 0x8 */
-} TSI_Type;
-
-/* ----------------------------------------------------------------------------
-   -- TSI Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup TSI_Register_Masks TSI Register Masks
- * @{
- */
-
-/* GENCS Bit Fields */
-#define TSI_GENCS_CURSW_MASK                     0x2u
-#define TSI_GENCS_CURSW_SHIFT                    1
-#define TSI_GENCS_EOSF_MASK                      0x4u
-#define TSI_GENCS_EOSF_SHIFT                     2
-#define TSI_GENCS_SCNIP_MASK                     0x8u
-#define TSI_GENCS_SCNIP_SHIFT                    3
-#define TSI_GENCS_STM_MASK                       0x10u
-#define TSI_GENCS_STM_SHIFT                      4
-#define TSI_GENCS_STPE_MASK                      0x20u
-#define TSI_GENCS_STPE_SHIFT                     5
-#define TSI_GENCS_TSIIEN_MASK                    0x40u
-#define TSI_GENCS_TSIIEN_SHIFT                   6
-#define TSI_GENCS_TSIEN_MASK                     0x80u
-#define TSI_GENCS_TSIEN_SHIFT                    7
-#define TSI_GENCS_NSCN_MASK                      0x1F00u
-#define TSI_GENCS_NSCN_SHIFT                     8
-#define TSI_GENCS_NSCN(x)                        (((uint32_t)(((uint32_t)(x))<<TSI_GENCS_NSCN_SHIFT))&TSI_GENCS_NSCN_MASK)
-#define TSI_GENCS_PS_MASK                        0xE000u
-#define TSI_GENCS_PS_SHIFT                       13
-#define TSI_GENCS_PS(x)                          (((uint32_t)(((uint32_t)(x))<<TSI_GENCS_PS_SHIFT))&TSI_GENCS_PS_MASK)
-#define TSI_GENCS_EXTCHRG_MASK                   0x70000u
-#define TSI_GENCS_EXTCHRG_SHIFT                  16
-#define TSI_GENCS_EXTCHRG(x)                     (((uint32_t)(((uint32_t)(x))<<TSI_GENCS_EXTCHRG_SHIFT))&TSI_GENCS_EXTCHRG_MASK)
-#define TSI_GENCS_DVOLT_MASK                     0x180000u
-#define TSI_GENCS_DVOLT_SHIFT                    19
-#define TSI_GENCS_DVOLT(x)                       (((uint32_t)(((uint32_t)(x))<<TSI_GENCS_DVOLT_SHIFT))&TSI_GENCS_DVOLT_MASK)
-#define TSI_GENCS_REFCHRG_MASK                   0xE00000u
-#define TSI_GENCS_REFCHRG_SHIFT                  21
-#define TSI_GENCS_REFCHRG(x)                     (((uint32_t)(((uint32_t)(x))<<TSI_GENCS_REFCHRG_SHIFT))&TSI_GENCS_REFCHRG_MASK)
-#define TSI_GENCS_MODE_MASK                      0xF000000u
-#define TSI_GENCS_MODE_SHIFT                     24
-#define TSI_GENCS_MODE(x)                        (((uint32_t)(((uint32_t)(x))<<TSI_GENCS_MODE_SHIFT))&TSI_GENCS_MODE_MASK)
-#define TSI_GENCS_ESOR_MASK                      0x10000000u
-#define TSI_GENCS_ESOR_SHIFT                     28
-#define TSI_GENCS_OUTRGF_MASK                    0x80000000u
-#define TSI_GENCS_OUTRGF_SHIFT                   31
-/* DATA Bit Fields */
-#define TSI_DATA_TSICNT_MASK                     0xFFFFu
-#define TSI_DATA_TSICNT_SHIFT                    0
-#define TSI_DATA_TSICNT(x)                       (((uint32_t)(((uint32_t)(x))<<TSI_DATA_TSICNT_SHIFT))&TSI_DATA_TSICNT_MASK)
-#define TSI_DATA_SWTS_MASK                       0x400000u
-#define TSI_DATA_SWTS_SHIFT                      22
-#define TSI_DATA_DMAEN_MASK                      0x800000u
-#define TSI_DATA_DMAEN_SHIFT                     23
-#define TSI_DATA_TSICH_MASK                      0xF0000000u
-#define TSI_DATA_TSICH_SHIFT                     28
-#define TSI_DATA_TSICH(x)                        (((uint32_t)(((uint32_t)(x))<<TSI_DATA_TSICH_SHIFT))&TSI_DATA_TSICH_MASK)
-/* TSHD Bit Fields */
-#define TSI_TSHD_THRESL_MASK                     0xFFFFu
-#define TSI_TSHD_THRESL_SHIFT                    0
-#define TSI_TSHD_THRESL(x)                       (((uint32_t)(((uint32_t)(x))<<TSI_TSHD_THRESL_SHIFT))&TSI_TSHD_THRESL_MASK)
-#define TSI_TSHD_THRESH_MASK                     0xFFFF0000u
-#define TSI_TSHD_THRESH_SHIFT                    16
-#define TSI_TSHD_THRESH(x)                       (((uint32_t)(((uint32_t)(x))<<TSI_TSHD_THRESH_SHIFT))&TSI_TSHD_THRESH_MASK)
-
-/**
- * @}
- */ /* end of group TSI_Register_Masks */
-
-
-/* TSI - Peripheral instance base addresses */
-/** Peripheral TSI0 base address */
-#define TSI0_BASE                                (0x40045000u)
-/** Peripheral TSI0 base pointer */
-#define TSI0                                     ((TSI_Type *)TSI0_BASE)
-/** Array initializer of TSI peripheral base pointers */
-#define TSI_BASES                                { TSI0 }
-
-/**
- * @}
- */ /* end of group TSI_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- UART0 Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup UART0_Peripheral_Access_Layer UART0 Peripheral Access Layer
- * @{
- */
-
-/** UART0 - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t BDH;                                /**< UART Baud Rate Register High, offset: 0x0 */
-  __IO uint8_t BDL;                                /**< UART Baud Rate Register Low, offset: 0x1 */
-  __IO uint8_t C1;                                 /**< UART Control Register 1, offset: 0x2 */
-  __IO uint8_t C2;                                 /**< UART Control Register 2, offset: 0x3 */
-  __IO uint8_t S1;                                 /**< UART Status Register 1, offset: 0x4 */
-  __IO uint8_t S2;                                 /**< UART Status Register 2, offset: 0x5 */
-  __IO uint8_t C3;                                 /**< UART Control Register 3, offset: 0x6 */
-  __IO uint8_t D;                                  /**< UART Data Register, offset: 0x7 */
-  __IO uint8_t MA1;                                /**< UART Match Address Registers 1, offset: 0x8 */
-  __IO uint8_t MA2;                                /**< UART Match Address Registers 2, offset: 0x9 */
-  __IO uint8_t C4;                                 /**< UART Control Register 4, offset: 0xA */
-  __IO uint8_t C5;                                 /**< UART Control Register 5, offset: 0xB */
-} UART0_Type;
-
-/* ----------------------------------------------------------------------------
-   -- UART0 Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup UART0_Register_Masks UART0 Register Masks
- * @{
- */
-
-/* BDH Bit Fields */
-#define UART0_BDH_SBR_MASK                       0x1Fu
-#define UART0_BDH_SBR_SHIFT                      0
-#define UART0_BDH_SBR(x)                         (((uint8_t)(((uint8_t)(x))<<UART0_BDH_SBR_SHIFT))&UART0_BDH_SBR_MASK)
-#define UART0_BDH_SBNS_MASK                      0x20u
-#define UART0_BDH_SBNS_SHIFT                     5
-#define UART0_BDH_RXEDGIE_MASK                   0x40u
-#define UART0_BDH_RXEDGIE_SHIFT                  6
-#define UART0_BDH_LBKDIE_MASK                    0x80u
-#define UART0_BDH_LBKDIE_SHIFT                   7
-/* BDL Bit Fields */
-#define UART0_BDL_SBR_MASK                       0xFFu
-#define UART0_BDL_SBR_SHIFT                      0
-#define UART0_BDL_SBR(x)                         (((uint8_t)(((uint8_t)(x))<<UART0_BDL_SBR_SHIFT))&UART0_BDL_SBR_MASK)
-/* C1 Bit Fields */
-#define UART0_C1_PT_MASK                         0x1u
-#define UART0_C1_PT_SHIFT                        0
-#define UART0_C1_PE_MASK                         0x2u
-#define UART0_C1_PE_SHIFT                        1
-#define UART0_C1_ILT_MASK                        0x4u
-#define UART0_C1_ILT_SHIFT                       2
-#define UART0_C1_WAKE_MASK                       0x8u
-#define UART0_C1_WAKE_SHIFT                      3
-#define UART0_C1_M_MASK                          0x10u
-#define UART0_C1_M_SHIFT                         4
-#define UART0_C1_RSRC_MASK                       0x20u
-#define UART0_C1_RSRC_SHIFT                      5
-#define UART0_C1_DOZEEN_MASK                     0x40u
-#define UART0_C1_DOZEEN_SHIFT                    6
-#define UART0_C1_LOOPS_MASK                      0x80u
-#define UART0_C1_LOOPS_SHIFT                     7
-/* C2 Bit Fields */
-#define UART0_C2_SBK_MASK                        0x1u
-#define UART0_C2_SBK_SHIFT                       0
-#define UART0_C2_RWU_MASK                        0x2u
-#define UART0_C2_RWU_SHIFT                       1
-#define UART0_C2_RE_MASK                         0x4u
-#define UART0_C2_RE_SHIFT                        2
-#define UART0_C2_TE_MASK                         0x8u
-#define UART0_C2_TE_SHIFT                        3
-#define UART0_C2_ILIE_MASK                       0x10u
-#define UART0_C2_ILIE_SHIFT                      4
-#define UART0_C2_RIE_MASK                        0x20u
-#define UART0_C2_RIE_SHIFT                       5
-#define UART0_C2_TCIE_MASK                       0x40u
-#define UART0_C2_TCIE_SHIFT                      6
-#define UART0_C2_TIE_MASK                        0x80u
-#define UART0_C2_TIE_SHIFT                       7
-/* S1 Bit Fields */
-#define UART0_S1_PF_MASK                         0x1u
-#define UART0_S1_PF_SHIFT                        0
-#define UART0_S1_FE_MASK                         0x2u
-#define UART0_S1_FE_SHIFT                        1
-#define UART0_S1_NF_MASK                         0x4u
-#define UART0_S1_NF_SHIFT                        2
-#define UART0_S1_OR_MASK                         0x8u
-#define UART0_S1_OR_SHIFT                        3
-#define UART0_S1_IDLE_MASK                       0x10u
-#define UART0_S1_IDLE_SHIFT                      4
-#define UART0_S1_RDRF_MASK                       0x20u
-#define UART0_S1_RDRF_SHIFT                      5
-#define UART0_S1_TC_MASK                         0x40u
-#define UART0_S1_TC_SHIFT                        6
-#define UART0_S1_TDRE_MASK                       0x80u
-#define UART0_S1_TDRE_SHIFT                      7
-/* S2 Bit Fields */
-#define UART0_S2_RAF_MASK                        0x1u
-#define UART0_S2_RAF_SHIFT                       0
-#define UART0_S2_LBKDE_MASK                      0x2u
-#define UART0_S2_LBKDE_SHIFT                     1
-#define UART0_S2_BRK13_MASK                      0x4u
-#define UART0_S2_BRK13_SHIFT                     2
-#define UART0_S2_RWUID_MASK                      0x8u
-#define UART0_S2_RWUID_SHIFT                     3
-#define UART0_S2_RXINV_MASK                      0x10u
-#define UART0_S2_RXINV_SHIFT                     4
-#define UART0_S2_MSBF_MASK                       0x20u
-#define UART0_S2_MSBF_SHIFT                      5
-#define UART0_S2_RXEDGIF_MASK                    0x40u
-#define UART0_S2_RXEDGIF_SHIFT                   6
-#define UART0_S2_LBKDIF_MASK                     0x80u
-#define UART0_S2_LBKDIF_SHIFT                    7
-/* C3 Bit Fields */
-#define UART0_C3_PEIE_MASK                       0x1u
-#define UART0_C3_PEIE_SHIFT                      0
-#define UART0_C3_FEIE_MASK                       0x2u
-#define UART0_C3_FEIE_SHIFT                      1
-#define UART0_C3_NEIE_MASK                       0x4u
-#define UART0_C3_NEIE_SHIFT                      2
-#define UART0_C3_ORIE_MASK                       0x8u
-#define UART0_C3_ORIE_SHIFT                      3
-#define UART0_C3_TXINV_MASK                      0x10u
-#define UART0_C3_TXINV_SHIFT                     4
-#define UART0_C3_TXDIR_MASK                      0x20u
-#define UART0_C3_TXDIR_SHIFT                     5
-#define UART0_C3_R9T8_MASK                       0x40u
-#define UART0_C3_R9T8_SHIFT                      6
-#define UART0_C3_R8T9_MASK                       0x80u
-#define UART0_C3_R8T9_SHIFT                      7
-/* D Bit Fields */
-#define UART0_D_R0T0_MASK                        0x1u
-#define UART0_D_R0T0_SHIFT                       0
-#define UART0_D_R1T1_MASK                        0x2u
-#define UART0_D_R1T1_SHIFT                       1
-#define UART0_D_R2T2_MASK                        0x4u
-#define UART0_D_R2T2_SHIFT                       2
-#define UART0_D_R3T3_MASK                        0x8u
-#define UART0_D_R3T3_SHIFT                       3
-#define UART0_D_R4T4_MASK                        0x10u
-#define UART0_D_R4T4_SHIFT                       4
-#define UART0_D_R5T5_MASK                        0x20u
-#define UART0_D_R5T5_SHIFT                       5
-#define UART0_D_R6T6_MASK                        0x40u
-#define UART0_D_R6T6_SHIFT                       6
-#define UART0_D_R7T7_MASK                        0x80u
-#define UART0_D_R7T7_SHIFT                       7
-/* MA1 Bit Fields */
-#define UART0_MA1_MA_MASK                        0xFFu
-#define UART0_MA1_MA_SHIFT                       0
-#define UART0_MA1_MA(x)                          (((uint8_t)(((uint8_t)(x))<<UART0_MA1_MA_SHIFT))&UART0_MA1_MA_MASK)
-/* MA2 Bit Fields */
-#define UART0_MA2_MA_MASK                        0xFFu
-#define UART0_MA2_MA_SHIFT                       0
-#define UART0_MA2_MA(x)                          (((uint8_t)(((uint8_t)(x))<<UART0_MA2_MA_SHIFT))&UART0_MA2_MA_MASK)
-/* C4 Bit Fields */
-#define UART0_C4_OSR_MASK                        0x1Fu
-#define UART0_C4_OSR_SHIFT                       0
-#define UART0_C4_OSR(x)                          (((uint8_t)(((uint8_t)(x))<<UART0_C4_OSR_SHIFT))&UART0_C4_OSR_MASK)
-#define UART0_C4_M10_MASK                        0x20u
-#define UART0_C4_M10_SHIFT                       5
-#define UART0_C4_MAEN2_MASK                      0x40u
-#define UART0_C4_MAEN2_SHIFT                     6
-#define UART0_C4_MAEN1_MASK                      0x80u
-#define UART0_C4_MAEN1_SHIFT                     7
-/* C5 Bit Fields */
-#define UART0_C5_RESYNCDIS_MASK                  0x1u
-#define UART0_C5_RESYNCDIS_SHIFT                 0
-#define UART0_C5_BOTHEDGE_MASK                   0x2u
-#define UART0_C5_BOTHEDGE_SHIFT                  1
-#define UART0_C5_RDMAE_MASK                      0x20u
-#define UART0_C5_RDMAE_SHIFT                     5
-#define UART0_C5_TDMAE_MASK                      0x80u
-#define UART0_C5_TDMAE_SHIFT                     7
-
-/**
- * @}
- */ /* end of group UART0_Register_Masks */
-
-
-/* UART0 - Peripheral instance base addresses */
-/** Peripheral UART0 base address */
-#define UART0_BASE                               (0x4006A000u)
-/** Peripheral UART0 base pointer */
-#define UART0                                    ((UART0_Type *)UART0_BASE)
-/** Array initializer of UART0 peripheral base pointers */
-#define UART0_BASES                              { UART0 }
-
-/**
- * @}
- */ /* end of group UART0_Peripheral_Access_Layer */
-
-
-/*
-** End of section using anonymous unions
-*/
-
-#if defined(__ARMCC_VERSION)
-  #pragma pop
-#elif defined(__CWCC__)
-  #pragma pop
-#elif defined(__GNUC__)
-  /* leave anonymous unions enabled */
-#elif defined(__IAR_SYSTEMS_ICC__)
-  #pragma language=default
-#else
-  #error Not supported compiler type
-#endif
-
-/**
- * @}
- */ /* end of group Peripheral_access_layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- Backward Compatibility
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup Backward_Compatibility_Symbols Backward Compatibility
- * @{
- */
-
-#define DMA_REQC_ARR_DMAC_MASK                   This_symbol_has_been_deprecated
-#define DMA_REQC_ARR_DMAC_SHIFT                  This_symbol_has_been_deprecated
-#define DMA_REQC_ARR_DMAC(x)                     This_symbol_has_been_deprecated
-#define DMA_REQC_ARR_CFSM_MASK                   This_symbol_has_been_deprecated
-#define DMA_REQC_ARR_CFSM_SHIFT                  This_symbol_has_been_deprecated
-#define DMA_REQC0                                This_symbol_has_been_deprecated
-#define DMA_REQC1                                This_symbol_has_been_deprecated
-#define DMA_REQC2                                This_symbol_has_been_deprecated
-#define DMA_REQC3                                This_symbol_has_been_deprecated
-#define MCG_C6_CME0_MASK                         MCG_C6_CME_MASK
-#define MCG_C6_CME0_SHIFT                        MCG_C6_CME_SHIFT
-#define MCM_MATCR_ATC0_MASK                      This_symbol_has_been_deprecated
-#define MCM_MATCR_ATC0_SHIFT                     This_symbol_has_been_deprecated
-#define MCM_MATCR_ATC0(x)                        This_symbol_has_been_deprecated
-#define MCM_MATCR_RO0_MASK                       This_symbol_has_been_deprecated
-#define MCM_MATCR_RO0_SHIFT                      This_symbol_has_been_deprecated
-#define MCM_MATCR_ATC1_MASK                      This_symbol_has_been_deprecated
-#define MCM_MATCR_ATC1_SHIFT                     This_symbol_has_been_deprecated
-#define MCM_MATCR_ATC1(x)                        This_symbol_has_been_deprecated
-#define MCM_MATCR_RO1_MASK                       This_symbol_has_been_deprecated
-#define MCM_MATCR_RO1_SHIFT                      This_symbol_has_been_deprecated
-#define MCM_MATCR_ATC2_MASK                      This_symbol_has_been_deprecated
-#define MCM_MATCR_ATC2_SHIFT                     This_symbol_has_been_deprecated
-#define MCM_MATCR_ATC2(x)                        This_symbol_has_been_deprecated
-#define MCM_MATCR_RO2_MASK                       This_symbol_has_been_deprecated
-#define MCM_MATCR_RO2_SHIFT                      This_symbol_has_been_deprecated
-#define MCM_MATCR_ATC3_MASK                      This_symbol_has_been_deprecated
-#define MCM_MATCR_ATC3_SHIFT                     This_symbol_has_been_deprecated
-#define MCM_MATCR_ATC3(x)                        This_symbol_has_been_deprecated
-#define MCM_MATCR_RO3_MASK                       This_symbol_has_been_deprecated
-#define MCM_MATCR_RO3_SHIFT                      This_symbol_has_been_deprecated
-#define SIM_FCFG2_MAXADDR_MASK                   SIM_FCFG2_MAXADDR0_MASK
-#define SIM_FCFG2_MAXADDR_SHIFT                  SIM_FCFG2_MAXADDR0_SHIFT
-#define SIM_FCFG2_MAXADDR                        SIM_FCFG2_MAXADDR0
-#define SPI_C2_SPLPIE_MASK                       This_symbol_has_been_deprecated
-#define SPI_C2_SPLPIE_SHIFT                      This_symbol_has_been_deprecated
-#define UARTLP_Type                              UART0_Type
-#define UARTLP_BDH_REG                           UART0_BDH_REG
-#define UARTLP_BDL_REG                           UART0_BDL_REG
-#define UARTLP_C1_REG                            UART0_C1_REG
-#define UARTLP_C2_REG                            UART0_C2_REG
-#define UARTLP_S1_REG                            UART0_S1_REG
-#define UARTLP_S2_REG                            UART0_S2_REG
-#define UARTLP_C3_REG                            UART0_C3_REG
-#define UARTLP_D_REG                             UART0_D_REG
-#define UARTLP_MA1_REG                           UART0_MA1_REG
-#define UARTLP_MA2_REG                           UART0_MA2_REG
-#define UARTLP_C4_REG                            UART0_C4_REG
-#define UARTLP_C5_REG                            UART0_C5_REG
-#define UARTLP_BDH_SBR_MASK                      UART0_BDH_SBR_MASK
-#define UARTLP_BDH_SBR_SHIFT                     UART0_BDH_SBR_SHIFT
-#define UARTLP_BDH_SBR(x)                        UART0_BDH_SBR(x)
-#define UARTLP_BDH_SBNS_MASK                     UART0_BDH_SBNS_MASK
-#define UARTLP_BDH_SBNS_SHIFT                    UART0_BDH_SBNS_SHIFT
-#define UARTLP_BDH_RXEDGIE_MASK                  UART0_BDH_RXEDGIE_MASK
-#define UARTLP_BDH_RXEDGIE_SHIFT                 UART0_BDH_RXEDGIE_SHIFT
-#define UARTLP_BDH_LBKDIE_MASK                   UART0_BDH_LBKDIE_MASK
-#define UARTLP_BDH_LBKDIE_SHIFT                  UART0_BDH_LBKDIE_SHIFT
-#define UARTLP_BDL_SBR_MASK                      UART0_BDL_SBR_MASK
-#define UARTLP_BDL_SBR_SHIFT                     UART0_BDL_SBR_SHIFT
-#define UARTLP_BDL_SBR(x)                        UART0_BDL_SBR(x)
-#define UARTLP_C1_PT_MASK                        UART0_C1_PT_MASK
-#define UARTLP_C1_PT_SHIFT                       UART0_C1_PT_SHIFT
-#define UARTLP_C1_PE_MASK                        UART0_C1_PE_MASK
-#define UARTLP_C1_PE_SHIFT                       UART0_C1_PE_SHIFT
-#define UARTLP_C1_ILT_MASK                       UART0_C1_ILT_MASK
-#define UARTLP_C1_ILT_SHIFT                      UART0_C1_ILT_SHIFT
-#define UARTLP_C1_WAKE_MASK                      UART0_C1_WAKE_MASK
-#define UARTLP_C1_WAKE_SHIFT                     UART0_C1_WAKE_SHIFT
-#define UARTLP_C1_M_MASK                         UART0_C1_M_MASK
-#define UARTLP_C1_M_SHIFT                        UART0_C1_M_SHIFT
-#define UARTLP_C1_RSRC_MASK                      UART0_C1_RSRC_MASK
-#define UARTLP_C1_RSRC_SHIFT                     UART0_C1_RSRC_SHIFT
-#define UARTLP_C1_DOZEEN_MASK                    UART0_C1_DOZEEN_MASK
-#define UARTLP_C1_DOZEEN_SHIFT                   UART0_C1_DOZEEN_SHIFT
-#define UARTLP_C1_LOOPS_MASK                     UART0_C1_LOOPS_MASK
-#define UARTLP_C1_LOOPS_SHIFT                    UART0_C1_LOOPS_SHIFT
-#define UARTLP_C2_SBK_MASK                       UART0_C2_SBK_MASK
-#define UARTLP_C2_SBK_SHIFT                      UART0_C2_SBK_SHIFT
-#define UARTLP_C2_RWU_MASK                       UART0_C2_RWU_MASK
-#define UARTLP_C2_RWU_SHIFT                      UART0_C2_RWU_SHIFT
-#define UARTLP_C2_RE_MASK                        UART0_C2_RE_MASK
-#define UARTLP_C2_RE_SHIFT                       UART0_C2_RE_SHIFT
-#define UARTLP_C2_TE_MASK                        UART0_C2_TE_MASK
-#define UARTLP_C2_TE_SHIFT                       UART0_C2_TE_SHIFT
-#define UARTLP_C2_ILIE_MASK                      UART0_C2_ILIE_MASK
-#define UARTLP_C2_ILIE_SHIFT                     UART0_C2_ILIE_SHIFT
-#define UARTLP_C2_RIE_MASK                       UART0_C2_RIE_MASK
-#define UARTLP_C2_RIE_SHIFT                      UART0_C2_RIE_SHIFT
-#define UARTLP_C2_TCIE_MASK                      UART0_C2_TCIE_MASK
-#define UARTLP_C2_TCIE_SHIFT                     UART0_C2_TCIE_SHIFT
-#define UARTLP_C2_TIE_MASK                       UART0_C2_TIE_MASK
-#define UARTLP_C2_TIE_SHIFT                      UART0_C2_TIE_SHIFT
-#define UARTLP_S1_PF_MASK                        UART0_S1_PF_MASK
-#define UARTLP_S1_PF_SHIFT                       UART0_S1_PF_SHIFT
-#define UARTLP_S1_FE_MASK                        UART0_S1_FE_MASK
-#define UARTLP_S1_FE_SHIFT                       UART0_S1_FE_SHIFT
-#define UARTLP_S1_NF_MASK                        UART0_S1_NF_MASK
-#define UARTLP_S1_NF_SHIFT                       UART0_S1_NF_SHIFT
-#define UARTLP_S1_OR_MASK                        UART0_S1_OR_MASK
-#define UARTLP_S1_OR_SHIFT                       UART0_S1_OR_SHIFT
-#define UARTLP_S1_IDLE_MASK                      UART0_S1_IDLE_MASK
-#define UARTLP_S1_IDLE_SHIFT                     UART0_S1_IDLE_SHIFT
-#define UARTLP_S1_RDRF_MASK                      UART0_S1_RDRF_MASK
-#define UARTLP_S1_RDRF_SHIFT                     UART0_S1_RDRF_SHIFT
-#define UARTLP_S1_TC_MASK                        UART0_S1_TC_MASK
-#define UARTLP_S1_TC_SHIFT                       UART0_S1_TC_SHIFT
-#define UARTLP_S1_TDRE_MASK                      UART0_S1_TDRE_MASK
-#define UARTLP_S1_TDRE_SHIFT                     UART0_S1_TDRE_SHIFT
-#define UARTLP_S2_RAF_MASK                       UART0_S2_RAF_MASK
-#define UARTLP_S2_RAF_SHIFT                      UART0_S2_RAF_SHIFT
-#define UARTLP_S2_LBKDE_MASK                     UART0_S2_LBKDE_MASK
-#define UARTLP_S2_LBKDE_SHIFT                    UART0_S2_LBKDE_SHIFT
-#define UARTLP_S2_BRK13_MASK                     UART0_S2_BRK13_MASK
-#define UARTLP_S2_BRK13_SHIFT                    UART0_S2_BRK13_SHIFT
-#define UARTLP_S2_RWUID_MASK                     UART0_S2_RWUID_MASK
-#define UARTLP_S2_RWUID_SHIFT                    UART0_S2_RWUID_SHIFT
-#define UARTLP_S2_RXINV_MASK                     UART0_S2_RXINV_MASK
-#define UARTLP_S2_RXINV_SHIFT                    UART0_S2_RXINV_SHIFT
-#define UARTLP_S2_MSBF_MASK                      UART0_S2_MSBF_MASK
-#define UARTLP_S2_MSBF_SHIFT                     UART0_S2_MSBF_SHIFT
-#define UARTLP_S2_RXEDGIF_MASK                   UART0_S2_RXEDGIF_MASK
-#define UARTLP_S2_RXEDGIF_SHIFT                  UART0_S2_RXEDGIF_SHIFT
-#define UARTLP_S2_LBKDIF_MASK                    UART0_S2_LBKDIF_MASK
-#define UARTLP_S2_LBKDIF_SHIFT                   UART0_S2_LBKDIF_SHIFT
-#define UARTLP_C3_PEIE_MASK                      UART0_C3_PEIE_MASK
-#define UARTLP_C3_PEIE_SHIFT                     UART0_C3_PEIE_SHIFT
-#define UARTLP_C3_FEIE_MASK                      UART0_C3_FEIE_MASK
-#define UARTLP_C3_FEIE_SHIFT                     UART0_C3_FEIE_SHIFT
-#define UARTLP_C3_NEIE_MASK                      UART0_C3_NEIE_MASK
-#define UARTLP_C3_NEIE_SHIFT                     UART0_C3_NEIE_SHIFT
-#define UARTLP_C3_ORIE_MASK                      UART0_C3_ORIE_MASK
-#define UARTLP_C3_ORIE_SHIFT                     UART0_C3_ORIE_SHIFT
-#define UARTLP_C3_TXINV_MASK                     UART0_C3_TXINV_MASK
-#define UARTLP_C3_TXINV_SHIFT                    UART0_C3_TXINV_SHIFT
-#define UARTLP_C3_TXDIR_MASK                     UART0_C3_TXDIR_MASK
-#define UARTLP_C3_TXDIR_SHIFT                    UART0_C3_TXDIR_SHIFT
-#define UARTLP_C3_R9T8_MASK                      UART0_C3_R9T8_MASK
-#define UARTLP_C3_R9T8_SHIFT                     UART0_C3_R9T8_SHIFT
-#define UARTLP_C3_R8T9_MASK                      UART0_C3_R8T9_MASK
-#define UARTLP_C3_R8T9_SHIFT                     UART0_C3_R8T9_SHIFT
-#define UARTLP_D_R0T0_MASK                       UART0_D_R0T0_MASK
-#define UARTLP_D_R0T0_SHIFT                      UART0_D_R0T0_SHIFT
-#define UARTLP_D_R1T1_MASK                       UART0_D_R1T1_MASK
-#define UARTLP_D_R1T1_SHIFT                      UART0_D_R1T1_SHIFT
-#define UARTLP_D_R2T2_MASK                       UART0_D_R2T2_MASK
-#define UARTLP_D_R2T2_SHIFT                      UART0_D_R2T2_SHIFT
-#define UARTLP_D_R3T3_MASK                       UART0_D_R3T3_MASK
-#define UARTLP_D_R3T3_SHIFT                      UART0_D_R3T3_SHIFT
-#define UARTLP_D_R4T4_MASK                       UART0_D_R4T4_MASK
-#define UARTLP_D_R4T4_SHIFT                      UART0_D_R4T4_SHIFT
-#define UARTLP_D_R5T5_MASK                       UART0_D_R5T5_MASK
-#define UARTLP_D_R5T5_SHIFT                      UART0_D_R5T5_SHIFT
-#define UARTLP_D_R6T6_MASK                       UART0_D_R6T6_MASK
-#define UARTLP_D_R6T6_SHIFT                      UART0_D_R6T6_SHIFT
-#define UARTLP_D_R7T7_MASK                       UART0_D_R7T7_MASK
-#define UARTLP_D_R7T7_SHIFT                      UART0_D_R7T7_SHIFT
-#define UARTLP_MA1_MA_MASK                       UART0_MA1_MA_MASK
-#define UARTLP_MA1_MA_SHIFT                      UART0_MA1_MA_SHIFT
-#define UARTLP_MA1_MA(x)                         UART0_MA1_MA(x)
-#define UARTLP_MA2_MA_MASK                       UART0_MA2_MA_MASK
-#define UARTLP_MA2_MA_SHIFT                      UART0_MA2_MA_SHIFT
-#define UARTLP_MA2_MA(x)                         UART0_MA2_MA(x)
-#define UARTLP_C4_OSR_MASK                       UART0_C4_OSR_MASK
-#define UARTLP_C4_OSR_SHIFT                      UART0_C4_OSR_SHIFT
-#define UARTLP_C4_OSR(x)                         UART0_C4_OSR(x)
-#define UARTLP_C4_M10_MASK                       UART0_C4_M10_MASK
-#define UARTLP_C4_M10_SHIFT                      UART0_C4_M10_SHIFT
-#define UARTLP_C4_MAEN2_MASK                     UART0_C4_MAEN2_MASK
-#define UARTLP_C4_MAEN2_SHIFT                    UART0_C4_MAEN2_SHIFT
-#define UARTLP_C4_MAEN1_MASK                     UART0_C4_MAEN1_MASK
-#define UARTLP_C4_MAEN1_SHIFT                    UART0_C4_MAEN1_SHIFT
-#define UARTLP_C5_RESYNCDIS_MASK                 UART0_C5_RESYNCDIS_MASK
-#define UARTLP_C5_RESYNCDIS_SHIFT                UART0_C5_RESYNCDIS_SHIFT
-#define UARTLP_C5_BOTHEDGE_MASK                  UART0_C5_BOTHEDGE_MASK
-#define UARTLP_C5_BOTHEDGE_SHIFT                 UART0_C5_BOTHEDGE_SHIFT
-#define UARTLP_C5_RDMAE_MASK                     UART0_C5_RDMAE_MASK
-#define UARTLP_C5_RDMAE_SHIFT                    UART0_C5_RDMAE_SHIFT
-#define UARTLP_C5_TDMAE_MASK                     UART0_C5_TDMAE_MASK
-#define UARTLP_C5_TDMAE_SHIFT                    UART0_C5_TDMAE_SHIFT
-#define UARTLP_BASES                             UARTLP_BASES
-
-/**
- * @}
- */ /* end of group Backward_Compatibility_Symbols */
-
-
-#endif  /* #if !defined(MKL05Z4_H_) */
-
-/* MKL05Z4.h, eof. */
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL05Z/TOOLCHAIN_ARM_STD/MKL05Z4.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-LR_IROM1 0x00000000 0x8000  {    ; load region size_region (32k)
-  ER_IROM1 0x00000000 0x8000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  ; 8_byte_aligned(48 vect * 4 bytes) =  8_byte_aligned(0xC0) = 0xC0
-  ; 0x1000 - 0xC0 = 0xF40
-  RW_IRAM1 0x1FFFFCC0 0xF40 {
-   .ANY (+RW +ZI)
-  }
-}
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL05Z/TOOLCHAIN_ARM_STD/startup_MKL05Z4.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,332 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_MKL25Z4.s
-; * @purpose: CMSIS Cortex-M0plus Core Device Startup File for the
-; *           MKL05Z4
-; * @version: 1.1
-; * @date:    2012-6-21
-; *
-; * Copyright: 1997 - 2012 Freescale Semiconductor, Inc. All Rights Reserved.
-;*
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; *****************************************************************************/
-
-
-__initial_sp        EQU     0x20000C00  ; Top of RAM
-
-                PRESERVE8
-                THUMB
-
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-                EXPORT  __Vectors_End
-                EXPORT  __Vectors_Size
-
-__Vectors       DCD     __initial_sp  ; Top of Stack
-                DCD     Reset_Handler  ; Reset Handler
-                DCD     NMI_Handler  ; NMI Handler
-                DCD     HardFault_Handler  ; Hard Fault Handler
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     SVC_Handler  ; SVCall Handler
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     PendSV_Handler  ; PendSV Handler
-                DCD     SysTick_Handler  ; SysTick Handler
-
-                ; External Interrupts
-                DCD     DMA0_IRQHandler  ; DMA channel 0 transfer complete/error interrupt
-                DCD     DMA1_IRQHandler  ; DMA channel 1 transfer complete/error interrupt
-                DCD     DMA2_IRQHandler  ; DMA channel 2 transfer complete/error interrupt
-                DCD     DMA3_IRQHandler  ; DMA channel 3 transfer complete/error interrupt
-                DCD     Reserved20_IRQHandler  ; Reserved interrupt 20
-                DCD     FTFA_IRQHandler  ; FTFA command complete/read collision interrupt
-                DCD     LVD_LVW_IRQHandler  ; Low Voltage Detect, Low Voltage Warning
-                DCD     LLW_IRQHandler  ; Low Leakage Wakeup
-                DCD     I2C0_IRQHandler  ; I2C0 interrupt
-                DCD     Reserved_25_IRQHandler  ; Reserved interrupt 25
-                DCD     SPI0_IRQHandler  ; SPI0 interrupt
-                DCD     Reserved_27_IRQHandler  ; Reserved interrupt 27
-                DCD     UART0_IRQHandler  ; UART0 status and error interrupt
-                DCD     Reserved_29_IRQHandler  ; Reserved interrupt 29
-                DCD     Reserved_30_IRQHandler  ; Reserved interrupt 30
-                DCD     ADC0_IRQHandler  ; ADC0 interrupt
-                DCD     CMP0_IRQHandler  ; CMP0 interrupt
-                DCD     TPM0_IRQHandler  ; TPM0 fault, overflow and channels interrupt
-                DCD     TPM1_IRQHandler  ; TPM1 fault, overflow and channels interrupt
-                DCD     Reserved_35_IRQHandler  ; Reserved interrupt 35
-                DCD     RTC_IRQHandler  ; RTC interrupt
-                DCD     RTC_Seconds_IRQHandler  ; RTC seconds interrupt
-                DCD     PIT_IRQHandler  ; PIT timer channel 0 interrupt
-                DCD     Reserved_39_IRQHandler  ; Reserved interrupt 39
-                DCD     Reserved_40_IRQHandler  ; Reserved interrupt 40
-                DCD     DAC0_IRQHandler  ; DAC0 interrupt
-                DCD     TSI0_IRQHandler  ; TSI0 interrupt
-                DCD     MCG_IRQHandler  ; MCG interrupt
-                DCD     LPTimer_IRQHandler  ; LPTimer interrupt
-                DCD     Reserved_45_IRQHandler  ; Reserved interrupt 45
-                DCD     PORTA_IRQHandler  ; Port A interrupt
-                DCD     PORTB_IRQHandler  ; Port B interrupt
-__Vectors_End
-
-__Vectors_Size 	EQU     __Vectors_End - __Vectors
-
-; <h> Flash Configuration
-;   <i> 16-byte flash configuration field that stores default protection settings (loaded on reset)
-;   <i> and security information that allows the MCU to restrict acces to the FTFL module.
-;   <h> Backdoor Comparison Key
-;     <o0>  Backdoor Key 0  <0x0-0xFF:2>
-;     <o1>  Backdoor Key 1  <0x0-0xFF:2>
-;     <o2>  Backdoor Key 2  <0x0-0xFF:2>
-;     <o3>  Backdoor Key 3  <0x0-0xFF:2>
-;     <o4>  Backdoor Key 4  <0x0-0xFF:2>
-;     <o5>  Backdoor Key 5  <0x0-0xFF:2>
-;     <o6>  Backdoor Key 6  <0x0-0xFF:2>
-;     <o7>  Backdoor Key 7  <0x0-0xFF:2>
-BackDoorK0      EQU     0xFF
-BackDoorK1      EQU     0xFF
-BackDoorK2      EQU     0xFF
-BackDoorK3      EQU     0xFF
-BackDoorK4      EQU     0xFF
-BackDoorK5      EQU     0xFF
-BackDoorK6      EQU     0xFF
-BackDoorK7      EQU     0xFF
-;   </h>
-;   <h> Program flash protection bytes (FPROT)
-;     <i> Each program flash region can be protected from program and erase operation by setting the associated PROT bit.
-;     <i> Each bit protects a 1/32 region of the program flash memory.
-;     <h> FPROT0
-;       <i> Program flash protection bytes
-;       <i> 1/32 - 8/32 region
-;       <o.0>   FPROT0.0
-;       <o.1>   FPROT0.1
-;       <o.2>   FPROT0.2
-;       <o.3>   FPROT0.3
-;       <o.4>   FPROT0.4
-;       <o.5>   FPROT0.5
-;       <o.6>   FPROT0.6
-;       <o.7>   FPROT0.7
-nFPROT0         EQU     0x00
-FPROT0          EQU     nFPROT0:EOR:0xFF
-;     </h>
-;     <h> FPROT1
-;       <i> Program Flash Region Protect Register 1
-;       <i> 9/32 - 16/32 region
-;       <o.0>   FPROT1.0
-;       <o.1>   FPROT1.1
-;       <o.2>   FPROT1.2
-;       <o.3>   FPROT1.3
-;       <o.4>   FPROT1.4
-;       <o.5>   FPROT1.5
-;       <o.6>   FPROT1.6
-;       <o.7>   FPROT1.7
-nFPROT1         EQU     0x00
-FPROT1          EQU     nFPROT1:EOR:0xFF
-;     </h>
-;     <h> FPROT2
-;       <i> Program Flash Region Protect Register 2
-;       <i> 17/32 - 24/32 region
-;       <o.0>   FPROT2.0
-;       <o.1>   FPROT2.1
-;       <o.2>   FPROT2.2
-;       <o.3>   FPROT2.3
-;       <o.4>   FPROT2.4
-;       <o.5>   FPROT2.5
-;       <o.6>   FPROT2.6
-;       <o.7>   FPROT2.7
-nFPROT2         EQU     0x00
-FPROT2          EQU     nFPROT2:EOR:0xFF
-;     </h>
-;     <h> FPROT3
-;       <i> Program Flash Region Protect Register 3
-;       <i> 25/32 - 32/32 region
-;       <o.0>   FPROT3.0
-;       <o.1>   FPROT3.1
-;       <o.2>   FPROT3.2
-;       <o.3>   FPROT3.3
-;       <o.4>   FPROT3.4
-;       <o.5>   FPROT3.5
-;       <o.6>   FPROT3.6
-;       <o.7>   FPROT3.7
-nFPROT3         EQU     0x00
-FPROT3          EQU     nFPROT3:EOR:0xFF
-;     </h>
-;   </h>
-;   </h>
-;   <h> Flash nonvolatile option byte (FOPT)
-;     <i> Allows the user to customize the operation of the MCU at boot time.
-;     <o.0>  LPBOOT0
-;       <0=> Core and system clock divider (OUTDIV1) is 0x7 (divide by 8) or 0x3 (divide by 4)
-;       <1=> Core and system clock divider (OUTDIV1) is 0x1 (divide by 2) or 0x0 (divide by 1)
-;     <o.4>  LPBOOT1
-;       <0=> Core and system clock divider (OUTDIV1) is 0x7 (divide by 8) or 0x1 (divide by 2)
-;       <1=> Core and system clock divider (OUTDIV1) is 0x3 (divide by 4) or 0x0 (divide by 1)
-;     <o.2>  NMI_DIS
-;       <0=> NMI interrupts are always blocked
-;       <1=> NMI pin/interrupts reset default to enabled
-;     <o.3>  RESET_PIN_CFG
-;       <0=> RESET pin is disabled following a POR and cannot be enabled as RESET function
-;       <1=> RESET pin is dedicated
-;     <o.3>  FAST_INIT
-;       <0=> Slower initialization
-;       <1=> Fast Initialization
-FOPT            EQU     0xFF
-;   </h>
-;   <h> Flash security byte (FSEC)
-;     <i> WARNING: If SEC field is configured as "MCU security status is secure" and MEEN field is configured as "Mass erase is disabled",
-;     <i> MCU's security status cannot be set back to unsecure state since Mass erase via the debugger is blocked !!!
-;     <o.0..1> SEC
-;       <2=> MCU security status is unsecure
-;       <3=> MCU security status is secure
-;         <i> Flash Security
-;         <i> This bits define the security state of the MCU.
-;     <o.2..3> FSLACC
-;       <2=> Freescale factory access denied
-;       <3=> Freescale factory access granted
-;         <i> Freescale Failure Analysis Access Code
-;         <i> This bits define the security state of the MCU.
-;     <o.4..5> MEEN
-;       <2=> Mass erase is disabled
-;       <3=> Mass erase is enabled
-;         <i> Mass Erase Enable Bits
-;         <i> Enables and disables mass erase capability of the FTFL module
-;     <o.6..7> KEYEN
-;       <2=> Backdoor key access enabled
-;       <3=> Backdoor key access disabled
-;         <i> Backdoor key Security Enable
-;         <i> These bits enable and disable backdoor key access to the FTFL module.
-FSEC            EQU     0xFE
-;   </h>
-
-                IF      :LNOT::DEF:RAM_TARGET
-                AREA    |.ARM.__at_0x400|, CODE, READONLY
-                DCB     BackDoorK0, BackDoorK1, BackDoorK2, BackDoorK3
-                DCB     BackDoorK4, BackDoorK5, BackDoorK6, BackDoorK7
-                DCB     FPROT0,     FPROT1,     FPROT2,     FPROT3
-                DCB     FSEC,       FOPT,       0xFF,     0xFF
-                ENDIF
-
-                AREA    |.text|, CODE, READONLY
-
-
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-
-; Dummy Exception Handlers (infinite loops which can be modified)
-
-NMI_Handler     PROC
-                EXPORT  NMI_Handler               [WEAK]
-                B       .
-                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-                EXPORT  DMA0_IRQHandler     [WEAK]
-                EXPORT  DMA1_IRQHandler     [WEAK]
-                EXPORT  DMA2_IRQHandler     [WEAK]
-                EXPORT  DMA3_IRQHandler     [WEAK]
-                EXPORT  Reserved20_IRQHandler     [WEAK]
-                EXPORT  FTFA_IRQHandler     [WEAK]
-                EXPORT  LVD_LVW_IRQHandler     [WEAK]
-                EXPORT  LLW_IRQHandler     [WEAK]
-                EXPORT  I2C0_IRQHandler     [WEAK]
-                EXPORT  Reserved_25_IRQHandler     [WEAK]
-                EXPORT  SPI0_IRQHandler     [WEAK]
-                EXPORT  Reserved_27_IRQHandler     [WEAK]
-                EXPORT  UART0_IRQHandler     [WEAK]
-                EXPORT  Reserved_29_IRQHandler     [WEAK]
-                EXPORT  Reserved_30_IRQHandler     [WEAK]
-                EXPORT  ADC0_IRQHandler     [WEAK]
-                EXPORT  CMP0_IRQHandler     [WEAK]
-                EXPORT  TPM0_IRQHandler     [WEAK]
-                EXPORT  TPM1_IRQHandler     [WEAK]
-                EXPORT  Reserved_35_IRQHandler     [WEAK]
-                EXPORT  RTC_IRQHandler     [WEAK]
-                EXPORT  RTC_Seconds_IRQHandler     [WEAK]
-                EXPORT  PIT_IRQHandler     [WEAK]
-                EXPORT  Reserved_39_IRQHandler     [WEAK]
-                EXPORT  Reserved_40_IRQHandler     [WEAK]
-                EXPORT  DAC0_IRQHandler     [WEAK]
-                EXPORT  TSI0_IRQHandler     [WEAK]
-                EXPORT  MCG_IRQHandler     [WEAK]
-                EXPORT  LPTimer_IRQHandler     [WEAK]
-                EXPORT  Reserved_45_IRQHandler     [WEAK]
-                EXPORT  PORTA_IRQHandler     [WEAK]
-                EXPORT  PORTB_IRQHandler     [WEAK]
-                EXPORT  DefaultISR                      [WEAK]
-
-DMA0_IRQHandler
-DMA1_IRQHandler
-DMA2_IRQHandler
-DMA3_IRQHandler
-Reserved20_IRQHandler
-FTFA_IRQHandler
-LVD_LVW_IRQHandler
-LLW_IRQHandler
-I2C0_IRQHandler
-Reserved_25_IRQHandler
-SPI0_IRQHandler
-Reserved_27_IRQHandler
-UART0_IRQHandler
-Reserved_29_IRQHandler
-Reserved_30_IRQHandler
-ADC0_IRQHandler
-CMP0_IRQHandler
-TPM0_IRQHandler
-TPM1_IRQHandler
-Reserved_35_IRQHandler
-RTC_IRQHandler
-RTC_Seconds_IRQHandler
-PIT_IRQHandler
-Reserved_39_IRQHandler
-Reserved_40_IRQHandler
-DAC0_IRQHandler
-TSI0_IRQHandler
-MCG_IRQHandler
-LPTimer_IRQHandler
-Reserved_45_IRQHandler
-PORTA_IRQHandler
-PORTB_IRQHandler
-DefaultISR
-
-                B       .
-
-                ENDP
-
-
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL05Z/TOOLCHAIN_ARM_STD/sys.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library - stackheap
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * Setup a fixed single stack/heap memory model, 
- *  between the top of the RW/ZI region and the stackpointer
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-#include <rt_misc.h>
-#include <stdint.h>
-
-extern char Image$$RW_IRAM1$$ZI$$Limit[];
-
-extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
-    uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
-    uint32_t sp_limit = __current_sp();
-
-    zi_limit = (zi_limit + 7) & ~0x7;    // ensure zi_limit is 8-byte aligned
-
-    struct __initial_stackheap r;
-    r.heap_base = zi_limit;
-    r.heap_limit = sp_limit;
-    return r;
-}
-
-#ifdef __cplusplus
-}
-#endif 
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL05Z/cmsis.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-/* mbed Microcontroller Library - CMSIS
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- *
- * A generic CMSIS include header, pulling in KL05Z specifics
- */
-
-#ifndef MBED_CMSIS_H
-#define MBED_CMSIS_H
-
-#include "MKL05Z4.h"
-#include "cmsis_nvic.h"
-
-#endif
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL05Z/cmsis_nvic.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic for KL05Z
- * Copyright (c) 2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */
-#include "cmsis_nvic.h"
-
-#define NVIC_RAM_VECTOR_ADDRESS (0x1FFFFC00)  // Vectors positioned at start of RAM
-#define NVIC_FLASH_VECTOR_ADDRESS (0x0)       // Initial vector position in flash
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
-    uint32_t *vectors = (uint32_t*)SCB->VTOR;
-    uint32_t i;
-
-    // Copy and switch to dynamic vectors if the first time called
-    if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
-        uint32_t *old_vectors = vectors;
-        vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
-        for (i=0; i<NVIC_NUM_VECTORS; i++) {
-            vectors[i] = old_vectors[i];
-        }
-        SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
-    }
-    vectors[IRQn + 16] = vector;
-}
-
-uint32_t NVIC_GetVector(IRQn_Type IRQn) {
-    uint32_t *vectors = (uint32_t*)SCB->VTOR;
-    return vectors[IRQn + 16];
-}
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL05Z/cmsis_nvic.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */ 
-
-#ifndef MBED_CMSIS_NVIC_H
-#define MBED_CMSIS_NVIC_H
-
-#include "cmsis.h"
-
-#define NVIC_NUM_VECTORS      (16 + 32)   // CORE + MCU Peripherals
-#define NVIC_USER_IRQ_OFFSET  16
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
-uint32_t NVIC_GetVector(IRQn_Type IRQn);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL05Z/system_MKL05Z4.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +0,0 @@
-#include <stdint.h>
-#include "MKL05Z4.h"
-
-#define DISABLE_WDOG     1
-
-/* Predefined clock setups
-         Multipurpose Clock Generator (MCG) in FLL Engaged Internal (FEI) mode
-         Reference clock source for MCG module is the slow internal clock source 32.768kHz
-         Core clock = 47.97MHz, BusClock = 23.48MHz
-*/
-
-#define CPU_XTAL_CLK_HZ                 32768u    /* Value of the external crystal or oscillator clock frequency in Hz */
-#define CPU_INT_SLOW_CLK_HZ             32768u    /* Value of the slow internal oscillator clock frequency in Hz  */
-#define CPU_INT_FAST_CLK_HZ             4000000u  /* Value of the fast internal oscillator clock frequency in Hz  */
-#define DEFAULT_SYSTEM_CLOCK            47972352u /* Default System clock value */
-
-uint32_t SystemCoreClock = DEFAULT_SYSTEM_CLOCK;
-
-void SystemInit(void) {
-#if (DISABLE_WDOG)
-    /* Disable the WDOG module */
-    /* SIM_COPC: COPT=0,COPCLKS=0,COPW=0 */
-    SIM->COPC = (uint32_t)0x00u;
-#endif /* (DISABLE_WDOG) */
-
-    SIM->SCGC5 |= (SIM_SCGC5_PORTB_MASK | SIM_SCGC5_PORTA_MASK); /* Enable clock gate for ports to enable pin routing */
-    /* SIM_SCGC5: LPTMR=1 */
-    SIM->SCGC5 |= SIM_SCGC5_LPTMR_MASK;
-    /* SIM_CLKDIV1: OUTDIV1=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,OUTDIV4=1,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0 */
-    SIM->CLKDIV1 = (SIM_CLKDIV1_OUTDIV1(0x00) | SIM_CLKDIV1_OUTDIV4(0x01)); /* Update system prescalers */
-    /* SIM_SOPT1: OSC32KSEL=0 */
-    SIM->SOPT1 &= (uint32_t)~(uint32_t)(SIM_SOPT1_OSC32KSEL(0x03)); /* System oscillator drives 32 kHz clock for various peripherals */
-    /* SIM_SOPT2: TPMSRC=2 */
-    SIM->SOPT2 = (uint32_t)((SIM->SOPT2 & (uint32_t)~(uint32_t)(SIM_SOPT2_TPMSRC(0x01))) |
-                 (uint32_t)(SIM_SOPT2_TPMSRC(0x02)));                      /* Set the TPM clock */
-    /* PORTA_PCR3: ISF=0,MUX=0 */
-    PORTA->PCR[3] &= (uint32_t)~(uint32_t)((PORT_PCR_ISF_MASK | PORT_PCR_MUX(0x07)));
-    /* MCG_SC: FCRDIV=1 */
-    MCG->SC = (uint8_t)((MCG->SC & (uint8_t)~(uint8_t)(MCG_SC_FCRDIV(0x06))) |
-              (uint8_t)(MCG_SC_FCRDIV(0x01)));
-    /* Switch to FEI Mode */
-    /* MCG_C1: CLKS=0,FRDIV=0,IREFS=1,IRCLKEN=1,IREFSTEN=0 */
-    MCG->C1 = MCG_C1_CLKS(0x00) | MCG_C1_FRDIV(0x00) |
-             MCG_C1_IREFS_MASK | MCG_C1_IRCLKEN_MASK;
-    /* MCG_C2: LOCRE0=0,??=0,RANGE0=0,HGO0=0,EREFS0=0,LP=0,IRCS=1 */
-    MCG->C2 = (MCG_C2_RANGE0(0x00) | MCG_C2_IRCS_MASK);
-    /* MCG_C4: DMX32=1,DRST_DRS=1 */
-    MCG->C4 = (uint8_t)((MCG->C4 & (uint8_t)~(uint8_t)(MCG_C4_DRST_DRS(0x02))) |
-              (uint8_t)(MCG_C4_DMX32_MASK | MCG_C4_DRST_DRS(0x01)));
-    /* OSC0_CR: ERCLKEN=1,??=0,EREFSTEN=0,??=0,SC2P=0,SC4P=0,SC8P=0,SC16P=0 */
-    OSC0->CR = OSC_CR_ERCLKEN_MASK;
-    while((MCG->S & MCG_S_IREFST_MASK) == 0x00U) { /* Check that the source of the FLL reference clock is the internal reference clock. */
-    }
-    while((MCG->S & 0x0CU) != 0x00U) {    /* Wait until output of the FLL is selected */
-    }
-}
-
-void SystemCoreClockUpdate(void) {
-    uint32_t MCGOUTClock;
-    uint8_t Divider;
-
-    if ((MCG->C1 & MCG_C1_CLKS_MASK) == 0x0u) {
-        /* FLL is selected */
-        if ((MCG->C1 & MCG_C1_IREFS_MASK) == 0x0u) {
-            /* External reference clock is selected */
-            MCGOUTClock = CPU_XTAL_CLK_HZ; /* System oscillator drives MCG clock */
-            Divider = (uint8_t)(1u << ((MCG->C1 & MCG_C1_FRDIV_MASK) >> MCG_C1_FRDIV_SHIFT));
-            MCGOUTClock = (MCGOUTClock / Divider);  /* Calculate the divided FLL reference clock */
-            if ((MCG->C2 & MCG_C2_RANGE0_MASK) != 0x0u) {
-                MCGOUTClock /= 32u;  /* If high range is enabled, additional 32 divider is active */
-            }
-        } else {
-          MCGOUTClock = CPU_INT_SLOW_CLK_HZ;  /* The slow internal reference clock is selected */
-        }
-
-        /* Select correct multiplier to calculate the MCG output clock  */
-        switch (MCG->C4 & (MCG_C4_DMX32_MASK | MCG_C4_DRST_DRS_MASK)) {
-            case 0x0u:
-                MCGOUTClock *= 640u;
-                break;
-            case 0x20u:
-                MCGOUTClock *= 1280u;
-                break;
-            case 0x40u:
-                MCGOUTClock *= 1920u;
-                break;
-            case 0x60u:
-                MCGOUTClock *= 2560u;
-                break;
-            case 0x80u:
-                MCGOUTClock *= 732u;
-                break;
-            case 0xA0u:
-                MCGOUTClock *= 1464u;
-                break;
-            case 0xC0u:
-                MCGOUTClock *= 2197u;
-                break;
-            case 0xE0u:
-                MCGOUTClock *= 2929u;
-                break;
-            default:
-                break;
-        }
-    } else if ((MCG->C1 & MCG_C1_CLKS_MASK) == 0x40u) {
-        /* Internal reference clock is selected */
-        if ((MCG->C2 & MCG_C2_IRCS_MASK) == 0x0u) {
-            MCGOUTClock = CPU_INT_SLOW_CLK_HZ;  /* Slow internal reference clock selected */
-        } else {
-            MCGOUTClock = CPU_INT_FAST_CLK_HZ / (1 << ((MCG->SC & MCG_SC_FCRDIV_MASK) >> MCG_SC_FCRDIV_SHIFT));  /* Fast internal reference clock selected */
-        }
-    } else if ((MCG->C1 & MCG_C1_CLKS_MASK) == 0x80u) {
-        /* External reference clock is selected */
-        MCGOUTClock = CPU_XTAL_CLK_HZ; /* System oscillator drives MCG clock */
-    } else {
-        /* Reserved value */
-        return;
-    }
-
-    SystemCoreClock = (MCGOUTClock / (1u + ((SIM->CLKDIV1 & SIM_CLKDIV1_OUTDIV1_MASK) >> SIM_CLKDIV1_OUTDIV1_SHIFT)));
-
-}
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL05Z/system_MKL05Z4.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
-** ###################################################################
-**     Processor:           MKL05Z128VLK4
-**     Compilers:           ARM Compiler
-**                          Freescale C/C++ for Embedded ARM
-**                          GNU C Compiler
-**                          IAR ANSI C/C++ Compiler for ARM
-**
-**     Reference manual:    KL05RM, Rev.1, Jun 2012
-**     Version:             rev. 1.1, 2012-06-21
-**
-**     Abstract:
-**         Provides a system configuration function and a global variable that
-**         contains the system frequency. It configures the device and initializes
-**         the oscillator (PLL) that is part of the microcontroller device.
-**
-**     Copyright: 2012 Freescale Semiconductor, Inc. All Rights Reserved.
-**
-**     http:                 www.freescale.com
-**     mail:                 support@freescale.com
-**
-**     Revisions:
-**     - rev. 1.0 (2012-06-13)
-**         Initial version.
-**     - rev. 1.1 (2012-06-21)
-**         Update according to reference manual rev. 1.
-**
-** ###################################################################
-*/
-
-/**
- * @file MKL05Z4
- * @version 1.1
- * @date 2012-06-21
- * @brief Device specific configuration file for MKL05Z4 (header file)
- *
- * Provides a system configuration function and a global variable that contains
- * the system frequency. It configures the device and initializes the oscillator
- * (PLL) that is part of the microcontroller device.
- */
-
-#ifndef SYSTEM_MKL05Z4_H_
-#define SYSTEM_MKL05Z4_H_                        /**< Symbol preventing repeated inclusion */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-/**
- * @brief System clock frequency (core clock)
- *
- * The system clock frequency supplied to the SysTick timer and the processor
- * core clock. This variable can be used by the user application to setup the
- * SysTick timer or configure other parameters. It may also be used by debugger to
- * query the frequency of the debug timer or configure the trace clock speed
- * SystemCoreClock is initialized with a correct predefined value.
- */
-extern uint32_t SystemCoreClock;
-
-/**
- * @brief Setup the microcontroller system.
- *
- * Typically this function configures the oscillator (PLL) that is part of the
- * microcontroller device. For systems with variable clock speed it also updates
- * the variable SystemCoreClock. SystemInit is called from startup_device file.
- */
-void SystemInit (void);
-
-/**
- * @brief Updates the SystemCoreClock variable.
- *
- * It must be called whenever the core clock is changed during program
- * execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates
- * the current core clock.
- */
-void SystemCoreClockUpdate (void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /* #if !defined(SYSTEM_MKL05Z4_H_) */
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL25Z/MKL25Z4.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4155 +0,0 @@
-/*
-** ###################################################################
-**     Processor:           MKL25Z128VLK4
-**     Compilers:           ARM Compiler
-**                          Freescale C/C++ for Embedded ARM
-**                          GNU C Compiler
-**                          IAR ANSI C/C++ Compiler for ARM
-**
-**     Reference manual:    KL25RM, Rev.1, Jun 2012
-**     Version:             rev. 1.1, 2012-06-21
-**
-**     Abstract:
-**         CMSIS Peripheral Access Layer for MKL25Z4
-**
-**     Copyright: 1997 - 2012 Freescale Semiconductor, Inc. All Rights Reserved.
-**
-**     http:                 www.freescale.com
-**     mail:                 support@freescale.com
-**
-**     Revisions:
-**     - rev. 1.0 (2012-06-13)
-**         Initial version.
-**     - rev. 1.1 (2012-06-21)
-**         Update according to reference manual rev. 1.
-**
-** ###################################################################
-*/
-
-/**
- * @file MKL25Z4.h
- * @version 1.1
- * @date 2012-06-21
- * @brief CMSIS Peripheral Access Layer for MKL25Z4
- *
- * CMSIS Peripheral Access Layer for MKL25Z4
- */
-
-#if !defined(MKL25Z4_H_)
-#define MKL25Z4_H_                               /**< Symbol preventing repeated inclusion */
-
-/** Memory map major version (memory maps with equal major version number are
- * compatible) */
-#define MCU_MEM_MAP_VERSION 0x0100u
-/** Memory map minor version */
-#define MCU_MEM_MAP_VERSION_MINOR 0x0001u
-
-
-/* ----------------------------------------------------------------------------
-   -- Interrupt vector numbers
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup Interrupt_vector_numbers Interrupt vector numbers
- * @{
- */
-
-/** Interrupt Number Definitions */
-typedef enum IRQn {
-  /* Core interrupts */
-  NonMaskableInt_IRQn          = -14,              /**< Non Maskable Interrupt */
-  HardFault_IRQn               = -13,              /**< Cortex-M0 SV Hard Fault Interrupt */
-  SVCall_IRQn                  = -5,               /**< Cortex-M0 SV Call Interrupt */
-  PendSV_IRQn                  = -2,               /**< Cortex-M0 Pend SV Interrupt */
-  SysTick_IRQn                 = -1,               /**< Cortex-M0 System Tick Interrupt */
-
-  /* Device specific interrupts */
-  DMA0_IRQn                    = 0,                /**< DMA channel 0 transfer complete interrupt */
-  DMA1_IRQn                    = 1,                /**< DMA channel 1 transfer complete interrupt */
-  DMA2_IRQn                    = 2,                /**< DMA channel 2 transfer complete interrupt */
-  DMA3_IRQn                    = 3,                /**< DMA channel 3 transfer complete interrupt */
-  Reserved20_IRQn              = 4,                /**< Reserved interrupt 20 */
-  FTFA_IRQn                    = 5,                /**< FTFA interrupt */
-  LVD_LVW_IRQn                 = 6,                /**< Low Voltage Detect, Low Voltage Warning */
-  LLW_IRQn                     = 7,                /**< Low Leakage Wakeup */
-  I2C0_IRQn                    = 8,                /**< I2C0 interrupt */
-  I2C1_IRQn                    = 9,                /**< I2C0 interrupt 25 */
-  SPI0_IRQn                    = 10,               /**< SPI0 interrupt */
-  SPI1_IRQn                    = 11,               /**< SPI1 interrupt */
-  UART0_IRQn                   = 12,               /**< UART0 status/error interrupt */
-  UART1_IRQn                   = 13,               /**< UART1 status/error interrupt */
-  UART2_IRQn                   = 14,               /**< UART2 status/error interrupt */
-  ADC0_IRQn                    = 15,               /**< ADC0 interrupt */
-  CMP0_IRQn                    = 16,               /**< CMP0 interrupt */
-  TPM0_IRQn                    = 17,               /**< TPM0 fault, overflow and channels interrupt */
-  TPM1_IRQn                    = 18,               /**< TPM1 fault, overflow and channels interrupt */
-  TPM2_IRQn                    = 19,               /**< TPM2 fault, overflow and channels interrupt */
-  RTC_IRQn                     = 20,               /**< RTC interrupt */
-  RTC_Seconds_IRQn             = 21,               /**< RTC seconds interrupt */
-  PIT_IRQn                     = 22,               /**< PIT timer interrupt */
-  Reserved39_IRQn              = 23,               /**< Reserved interrupt 39 */
-  USB0_IRQn                    = 24,               /**< USB0 interrupt */
-  DAC0_IRQn                    = 25,               /**< DAC interrupt */
-  TSI0_IRQn                    = 26,               /**< TSI0 interrupt */
-  MCG_IRQn                     = 27,               /**< MCG interrupt */
-  LPTimer_IRQn                 = 28,               /**< LPTimer interrupt */
-  Reserved45_IRQn              = 29,               /**< Reserved interrupt 45 */
-  PORTA_IRQn                   = 30,               /**< Port A interrupt */
-  PORTD_IRQn                   = 31                /**< Port D interrupt */
-} IRQn_Type;
-
-/**
- * @}
- */ /* end of group Interrupt_vector_numbers */
-
-
-/* ----------------------------------------------------------------------------
-   -- Cortex M0 Core Configuration
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup Cortex_Core_Configuration Cortex M0 Core Configuration
- * @{
- */
-
-#define __CM0PLUS_REV                  0x0000    /**< Core revision r0p0 */
-#define __MPU_PRESENT                  0         /**< Defines if an MPU is present or not */
-#define __VTOR_PRESENT                 1         /**< Defines if an MPU is present or not */
-#define __NVIC_PRIO_BITS               2         /**< Number of priority bits implemented in the NVIC */
-#define __Vendor_SysTickConfig         0         /**< Vendor specific implementation of SysTickConfig is defined */
-
-#include "core_cm0plus.h"              /* Core Peripheral Access Layer */
-#include "system_MKL25Z4.h"            /* Device specific configuration file */
-
-/**
- * @}
- */ /* end of group Cortex_Core_Configuration */
-
-
-/* ----------------------------------------------------------------------------
-   -- Device Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup Peripheral_access_layer Device Peripheral Access Layer
- * @{
- */
-
-
-/*
-** Start of section using anonymous unions
-*/
-
-#if defined(__ARMCC_VERSION)
-  #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 language=extended
-#else
-  #error Not supported compiler type
-#endif
-
-/* ----------------------------------------------------------------------------
-   -- ADC Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup ADC_Peripheral_Access_Layer ADC Peripheral Access Layer
- * @{
- */
-
-/** ADC - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t SC1[2];                            /**< ADC Status and Control Registers 1, array offset: 0x0, array step: 0x4 */
-  __IO uint32_t CFG1;                              /**< ADC Configuration Register 1, offset: 0x8 */
-  __IO uint32_t CFG2;                              /**< ADC Configuration Register 2, offset: 0xC */
-  __I  uint32_t R[2];                              /**< ADC Data Result Register, array offset: 0x10, array step: 0x4 */
-  __IO uint32_t CV1;                               /**< Compare Value Registers, offset: 0x18 */
-  __IO uint32_t CV2;                               /**< Compare Value Registers, offset: 0x1C */
-  __IO uint32_t SC2;                               /**< Status and Control Register 2, offset: 0x20 */
-  __IO uint32_t SC3;                               /**< Status and Control Register 3, offset: 0x24 */
-  __IO uint32_t OFS;                               /**< ADC Offset Correction Register, offset: 0x28 */
-  __IO uint32_t PG;                                /**< ADC Plus-Side Gain Register, offset: 0x2C */
-  __IO uint32_t MG;                                /**< ADC Minus-Side Gain Register, offset: 0x30 */
-  __IO uint32_t CLPD;                              /**< ADC Plus-Side General Calibration Value Register, offset: 0x34 */
-  __IO uint32_t CLPS;                              /**< ADC Plus-Side General Calibration Value Register, offset: 0x38 */
-  __IO uint32_t CLP4;                              /**< ADC Plus-Side General Calibration Value Register, offset: 0x3C */
-  __IO uint32_t CLP3;                              /**< ADC Plus-Side General Calibration Value Register, offset: 0x40 */
-  __IO uint32_t CLP2;                              /**< ADC Plus-Side General Calibration Value Register, offset: 0x44 */
-  __IO uint32_t CLP1;                              /**< ADC Plus-Side General Calibration Value Register, offset: 0x48 */
-  __IO uint32_t CLP0;                              /**< ADC Plus-Side General Calibration Value Register, offset: 0x4C */
-       uint8_t RESERVED_0[4];
-  __IO uint32_t CLMD;                              /**< ADC Minus-Side General Calibration Value Register, offset: 0x54 */
-  __IO uint32_t CLMS;                              /**< ADC Minus-Side General Calibration Value Register, offset: 0x58 */
-  __IO uint32_t CLM4;                              /**< ADC Minus-Side General Calibration Value Register, offset: 0x5C */
-  __IO uint32_t CLM3;                              /**< ADC Minus-Side General Calibration Value Register, offset: 0x60 */
-  __IO uint32_t CLM2;                              /**< ADC Minus-Side General Calibration Value Register, offset: 0x64 */
-  __IO uint32_t CLM1;                              /**< ADC Minus-Side General Calibration Value Register, offset: 0x68 */
-  __IO uint32_t CLM0;                              /**< ADC Minus-Side General Calibration Value Register, offset: 0x6C */
-} ADC_Type;
-
-/* ----------------------------------------------------------------------------
-   -- ADC Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup ADC_Register_Masks ADC Register Masks
- * @{
- */
-
-/* SC1 Bit Fields */
-#define ADC_SC1_ADCH_MASK                        0x1Fu
-#define ADC_SC1_ADCH_SHIFT                       0
-#define ADC_SC1_ADCH(x)                          (((uint32_t)(((uint32_t)(x))<<ADC_SC1_ADCH_SHIFT))&ADC_SC1_ADCH_MASK)
-#define ADC_SC1_DIFF_MASK                        0x20u
-#define ADC_SC1_DIFF_SHIFT                       5
-#define ADC_SC1_AIEN_MASK                        0x40u
-#define ADC_SC1_AIEN_SHIFT                       6
-#define ADC_SC1_COCO_MASK                        0x80u
-#define ADC_SC1_COCO_SHIFT                       7
-/* CFG1 Bit Fields */
-#define ADC_CFG1_ADICLK_MASK                     0x3u
-#define ADC_CFG1_ADICLK_SHIFT                    0
-#define ADC_CFG1_ADICLK(x)                       (((uint32_t)(((uint32_t)(x))<<ADC_CFG1_ADICLK_SHIFT))&ADC_CFG1_ADICLK_MASK)
-#define ADC_CFG1_MODE_MASK                       0xCu
-#define ADC_CFG1_MODE_SHIFT                      2
-#define ADC_CFG1_MODE(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CFG1_MODE_SHIFT))&ADC_CFG1_MODE_MASK)
-#define ADC_CFG1_ADLSMP_MASK                     0x10u
-#define ADC_CFG1_ADLSMP_SHIFT                    4
-#define ADC_CFG1_ADIV_MASK                       0x60u
-#define ADC_CFG1_ADIV_SHIFT                      5
-#define ADC_CFG1_ADIV(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CFG1_ADIV_SHIFT))&ADC_CFG1_ADIV_MASK)
-#define ADC_CFG1_ADLPC_MASK                      0x80u
-#define ADC_CFG1_ADLPC_SHIFT                     7
-/* CFG2 Bit Fields */
-#define ADC_CFG2_ADLSTS_MASK                     0x3u
-#define ADC_CFG2_ADLSTS_SHIFT                    0
-#define ADC_CFG2_ADLSTS(x)                       (((uint32_t)(((uint32_t)(x))<<ADC_CFG2_ADLSTS_SHIFT))&ADC_CFG2_ADLSTS_MASK)
-#define ADC_CFG2_ADHSC_MASK                      0x4u
-#define ADC_CFG2_ADHSC_SHIFT                     2
-#define ADC_CFG2_ADACKEN_MASK                    0x8u
-#define ADC_CFG2_ADACKEN_SHIFT                   3
-#define ADC_CFG2_MUXSEL_MASK                     0x10u
-#define ADC_CFG2_MUXSEL_SHIFT                    4
-/* R Bit Fields */
-#define ADC_R_D_MASK                             0xFFFFu
-#define ADC_R_D_SHIFT                            0
-#define ADC_R_D(x)                               (((uint32_t)(((uint32_t)(x))<<ADC_R_D_SHIFT))&ADC_R_D_MASK)
-/* CV1 Bit Fields */
-#define ADC_CV1_CV_MASK                          0xFFFFu
-#define ADC_CV1_CV_SHIFT                         0
-#define ADC_CV1_CV(x)                            (((uint32_t)(((uint32_t)(x))<<ADC_CV1_CV_SHIFT))&ADC_CV1_CV_MASK)
-/* CV2 Bit Fields */
-#define ADC_CV2_CV_MASK                          0xFFFFu
-#define ADC_CV2_CV_SHIFT                         0
-#define ADC_CV2_CV(x)                            (((uint32_t)(((uint32_t)(x))<<ADC_CV2_CV_SHIFT))&ADC_CV2_CV_MASK)
-/* SC2 Bit Fields */
-#define ADC_SC2_REFSEL_MASK                      0x3u
-#define ADC_SC2_REFSEL_SHIFT                     0
-#define ADC_SC2_REFSEL(x)                        (((uint32_t)(((uint32_t)(x))<<ADC_SC2_REFSEL_SHIFT))&ADC_SC2_REFSEL_MASK)
-#define ADC_SC2_DMAEN_MASK                       0x4u
-#define ADC_SC2_DMAEN_SHIFT                      2
-#define ADC_SC2_ACREN_MASK                       0x8u
-#define ADC_SC2_ACREN_SHIFT                      3
-#define ADC_SC2_ACFGT_MASK                       0x10u
-#define ADC_SC2_ACFGT_SHIFT                      4
-#define ADC_SC2_ACFE_MASK                        0x20u
-#define ADC_SC2_ACFE_SHIFT                       5
-#define ADC_SC2_ADTRG_MASK                       0x40u
-#define ADC_SC2_ADTRG_SHIFT                      6
-#define ADC_SC2_ADACT_MASK                       0x80u
-#define ADC_SC2_ADACT_SHIFT                      7
-/* SC3 Bit Fields */
-#define ADC_SC3_AVGS_MASK                        0x3u
-#define ADC_SC3_AVGS_SHIFT                       0
-#define ADC_SC3_AVGS(x)                          (((uint32_t)(((uint32_t)(x))<<ADC_SC3_AVGS_SHIFT))&ADC_SC3_AVGS_MASK)
-#define ADC_SC3_AVGE_MASK                        0x4u
-#define ADC_SC3_AVGE_SHIFT                       2
-#define ADC_SC3_ADCO_MASK                        0x8u
-#define ADC_SC3_ADCO_SHIFT                       3
-#define ADC_SC3_CALF_MASK                        0x40u
-#define ADC_SC3_CALF_SHIFT                       6
-#define ADC_SC3_CAL_MASK                         0x80u
-#define ADC_SC3_CAL_SHIFT                        7
-/* OFS Bit Fields */
-#define ADC_OFS_OFS_MASK                         0xFFFFu
-#define ADC_OFS_OFS_SHIFT                        0
-#define ADC_OFS_OFS(x)                           (((uint32_t)(((uint32_t)(x))<<ADC_OFS_OFS_SHIFT))&ADC_OFS_OFS_MASK)
-/* PG Bit Fields */
-#define ADC_PG_PG_MASK                           0xFFFFu
-#define ADC_PG_PG_SHIFT                          0
-#define ADC_PG_PG(x)                             (((uint32_t)(((uint32_t)(x))<<ADC_PG_PG_SHIFT))&ADC_PG_PG_MASK)
-/* MG Bit Fields */
-#define ADC_MG_MG_MASK                           0xFFFFu
-#define ADC_MG_MG_SHIFT                          0
-#define ADC_MG_MG(x)                             (((uint32_t)(((uint32_t)(x))<<ADC_MG_MG_SHIFT))&ADC_MG_MG_MASK)
-/* CLPD Bit Fields */
-#define ADC_CLPD_CLPD_MASK                       0x3Fu
-#define ADC_CLPD_CLPD_SHIFT                      0
-#define ADC_CLPD_CLPD(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLPD_CLPD_SHIFT))&ADC_CLPD_CLPD_MASK)
-/* CLPS Bit Fields */
-#define ADC_CLPS_CLPS_MASK                       0x3Fu
-#define ADC_CLPS_CLPS_SHIFT                      0
-#define ADC_CLPS_CLPS(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLPS_CLPS_SHIFT))&ADC_CLPS_CLPS_MASK)
-/* CLP4 Bit Fields */
-#define ADC_CLP4_CLP4_MASK                       0x3FFu
-#define ADC_CLP4_CLP4_SHIFT                      0
-#define ADC_CLP4_CLP4(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLP4_CLP4_SHIFT))&ADC_CLP4_CLP4_MASK)
-/* CLP3 Bit Fields */
-#define ADC_CLP3_CLP3_MASK                       0x1FFu
-#define ADC_CLP3_CLP3_SHIFT                      0
-#define ADC_CLP3_CLP3(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLP3_CLP3_SHIFT))&ADC_CLP3_CLP3_MASK)
-/* CLP2 Bit Fields */
-#define ADC_CLP2_CLP2_MASK                       0xFFu
-#define ADC_CLP2_CLP2_SHIFT                      0
-#define ADC_CLP2_CLP2(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLP2_CLP2_SHIFT))&ADC_CLP2_CLP2_MASK)
-/* CLP1 Bit Fields */
-#define ADC_CLP1_CLP1_MASK                       0x7Fu
-#define ADC_CLP1_CLP1_SHIFT                      0
-#define ADC_CLP1_CLP1(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLP1_CLP1_SHIFT))&ADC_CLP1_CLP1_MASK)
-/* CLP0 Bit Fields */
-#define ADC_CLP0_CLP0_MASK                       0x3Fu
-#define ADC_CLP0_CLP0_SHIFT                      0
-#define ADC_CLP0_CLP0(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLP0_CLP0_SHIFT))&ADC_CLP0_CLP0_MASK)
-/* CLMD Bit Fields */
-#define ADC_CLMD_CLMD_MASK                       0x3Fu
-#define ADC_CLMD_CLMD_SHIFT                      0
-#define ADC_CLMD_CLMD(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLMD_CLMD_SHIFT))&ADC_CLMD_CLMD_MASK)
-/* CLMS Bit Fields */
-#define ADC_CLMS_CLMS_MASK                       0x3Fu
-#define ADC_CLMS_CLMS_SHIFT                      0
-#define ADC_CLMS_CLMS(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLMS_CLMS_SHIFT))&ADC_CLMS_CLMS_MASK)
-/* CLM4 Bit Fields */
-#define ADC_CLM4_CLM4_MASK                       0x3FFu
-#define ADC_CLM4_CLM4_SHIFT                      0
-#define ADC_CLM4_CLM4(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLM4_CLM4_SHIFT))&ADC_CLM4_CLM4_MASK)
-/* CLM3 Bit Fields */
-#define ADC_CLM3_CLM3_MASK                       0x1FFu
-#define ADC_CLM3_CLM3_SHIFT                      0
-#define ADC_CLM3_CLM3(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLM3_CLM3_SHIFT))&ADC_CLM3_CLM3_MASK)
-/* CLM2 Bit Fields */
-#define ADC_CLM2_CLM2_MASK                       0xFFu
-#define ADC_CLM2_CLM2_SHIFT                      0
-#define ADC_CLM2_CLM2(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLM2_CLM2_SHIFT))&ADC_CLM2_CLM2_MASK)
-/* CLM1 Bit Fields */
-#define ADC_CLM1_CLM1_MASK                       0x7Fu
-#define ADC_CLM1_CLM1_SHIFT                      0
-#define ADC_CLM1_CLM1(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLM1_CLM1_SHIFT))&ADC_CLM1_CLM1_MASK)
-/* CLM0 Bit Fields */
-#define ADC_CLM0_CLM0_MASK                       0x3Fu
-#define ADC_CLM0_CLM0_SHIFT                      0
-#define ADC_CLM0_CLM0(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLM0_CLM0_SHIFT))&ADC_CLM0_CLM0_MASK)
-
-/**
- * @}
- */ /* end of group ADC_Register_Masks */
-
-
-/* ADC - Peripheral instance base addresses */
-/** Peripheral ADC0 base address */
-#define ADC0_BASE                                (0x4003B000u)
-/** Peripheral ADC0 base pointer */
-#define ADC0                                     ((ADC_Type *)ADC0_BASE)
-/** Array initializer of ADC peripheral base pointers */
-#define ADC_BASES                                { ADC0 }
-
-/**
- * @}
- */ /* end of group ADC_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- CMP Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup CMP_Peripheral_Access_Layer CMP Peripheral Access Layer
- * @{
- */
-
-/** CMP - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t CR0;                                /**< CMP Control Register 0, offset: 0x0 */
-  __IO uint8_t CR1;                                /**< CMP Control Register 1, offset: 0x1 */
-  __IO uint8_t FPR;                                /**< CMP Filter Period Register, offset: 0x2 */
-  __IO uint8_t SCR;                                /**< CMP Status and Control Register, offset: 0x3 */
-  __IO uint8_t DACCR;                              /**< DAC Control Register, offset: 0x4 */
-  __IO uint8_t MUXCR;                              /**< MUX Control Register, offset: 0x5 */
-} CMP_Type;
-
-/* ----------------------------------------------------------------------------
-   -- CMP Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup CMP_Register_Masks CMP Register Masks
- * @{
- */
-
-/* CR0 Bit Fields */
-#define CMP_CR0_HYSTCTR_MASK                     0x3u
-#define CMP_CR0_HYSTCTR_SHIFT                    0
-#define CMP_CR0_HYSTCTR(x)                       (((uint8_t)(((uint8_t)(x))<<CMP_CR0_HYSTCTR_SHIFT))&CMP_CR0_HYSTCTR_MASK)
-#define CMP_CR0_FILTER_CNT_MASK                  0x70u
-#define CMP_CR0_FILTER_CNT_SHIFT                 4
-#define CMP_CR0_FILTER_CNT(x)                    (((uint8_t)(((uint8_t)(x))<<CMP_CR0_FILTER_CNT_SHIFT))&CMP_CR0_FILTER_CNT_MASK)
-/* CR1 Bit Fields */
-#define CMP_CR1_EN_MASK                          0x1u
-#define CMP_CR1_EN_SHIFT                         0
-#define CMP_CR1_OPE_MASK                         0x2u
-#define CMP_CR1_OPE_SHIFT                        1
-#define CMP_CR1_COS_MASK                         0x4u
-#define CMP_CR1_COS_SHIFT                        2
-#define CMP_CR1_INV_MASK                         0x8u
-#define CMP_CR1_INV_SHIFT                        3
-#define CMP_CR1_PMODE_MASK                       0x10u
-#define CMP_CR1_PMODE_SHIFT                      4
-#define CMP_CR1_TRIGM_MASK                       0x20u
-#define CMP_CR1_TRIGM_SHIFT                      5
-#define CMP_CR1_WE_MASK                          0x40u
-#define CMP_CR1_WE_SHIFT                         6
-#define CMP_CR1_SE_MASK                          0x80u
-#define CMP_CR1_SE_SHIFT                         7
-/* FPR Bit Fields */
-#define CMP_FPR_FILT_PER_MASK                    0xFFu
-#define CMP_FPR_FILT_PER_SHIFT                   0
-#define CMP_FPR_FILT_PER(x)                      (((uint8_t)(((uint8_t)(x))<<CMP_FPR_FILT_PER_SHIFT))&CMP_FPR_FILT_PER_MASK)
-/* SCR Bit Fields */
-#define CMP_SCR_COUT_MASK                        0x1u
-#define CMP_SCR_COUT_SHIFT                       0
-#define CMP_SCR_CFF_MASK                         0x2u
-#define CMP_SCR_CFF_SHIFT                        1
-#define CMP_SCR_CFR_MASK                         0x4u
-#define CMP_SCR_CFR_SHIFT                        2
-#define CMP_SCR_IEF_MASK                         0x8u
-#define CMP_SCR_IEF_SHIFT                        3
-#define CMP_SCR_IER_MASK                         0x10u
-#define CMP_SCR_IER_SHIFT                        4
-#define CMP_SCR_DMAEN_MASK                       0x40u
-#define CMP_SCR_DMAEN_SHIFT                      6
-/* DACCR Bit Fields */
-#define CMP_DACCR_VOSEL_MASK                     0x3Fu
-#define CMP_DACCR_VOSEL_SHIFT                    0
-#define CMP_DACCR_VOSEL(x)                       (((uint8_t)(((uint8_t)(x))<<CMP_DACCR_VOSEL_SHIFT))&CMP_DACCR_VOSEL_MASK)
-#define CMP_DACCR_VRSEL_MASK                     0x40u
-#define CMP_DACCR_VRSEL_SHIFT                    6
-#define CMP_DACCR_DACEN_MASK                     0x80u
-#define CMP_DACCR_DACEN_SHIFT                    7
-/* MUXCR Bit Fields */
-#define CMP_MUXCR_MSEL_MASK                      0x7u
-#define CMP_MUXCR_MSEL_SHIFT                     0
-#define CMP_MUXCR_MSEL(x)                        (((uint8_t)(((uint8_t)(x))<<CMP_MUXCR_MSEL_SHIFT))&CMP_MUXCR_MSEL_MASK)
-#define CMP_MUXCR_PSEL_MASK                      0x38u
-#define CMP_MUXCR_PSEL_SHIFT                     3
-#define CMP_MUXCR_PSEL(x)                        (((uint8_t)(((uint8_t)(x))<<CMP_MUXCR_PSEL_SHIFT))&CMP_MUXCR_PSEL_MASK)
-#define CMP_MUXCR_PSTM_MASK                      0x40u
-#define CMP_MUXCR_PSTM_SHIFT                     6
-
-/**
- * @}
- */ /* end of group CMP_Register_Masks */
-
-
-/* CMP - Peripheral instance base addresses */
-/** Peripheral CMP0 base address */
-#define CMP0_BASE                                (0x40073000u)
-/** Peripheral CMP0 base pointer */
-#define CMP0                                     ((CMP_Type *)CMP0_BASE)
-/** Array initializer of CMP peripheral base pointers */
-#define CMP_BASES                                { CMP0 }
-
-/**
- * @}
- */ /* end of group CMP_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- DAC Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup DAC_Peripheral_Access_Layer DAC Peripheral Access Layer
- * @{
- */
-
-/** DAC - Register Layout Typedef */
-typedef struct {
-  struct {                                         /* offset: 0x0, array step: 0x2 */
-    __IO uint8_t DATL;                               /**< DAC Data Low Register, array offset: 0x0, array step: 0x2 */
-    __IO uint8_t DATH;                               /**< DAC Data High Register, array offset: 0x1, array step: 0x2 */
-  } DAT[2];
-       uint8_t RESERVED_0[28];
-  __IO uint8_t SR;                                 /**< DAC Status Register, offset: 0x20 */
-  __IO uint8_t C0;                                 /**< DAC Control Register, offset: 0x21 */
-  __IO uint8_t C1;                                 /**< DAC Control Register 1, offset: 0x22 */
-  __IO uint8_t C2;                                 /**< DAC Control Register 2, offset: 0x23 */
-} DAC_Type;
-
-/* ----------------------------------------------------------------------------
-   -- DAC Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup DAC_Register_Masks DAC Register Masks
- * @{
- */
-
-/* DATL Bit Fields */
-#define DAC_DATL_DATA0_MASK                      0xFFu
-#define DAC_DATL_DATA0_SHIFT                     0
-#define DAC_DATL_DATA0(x)                        (((uint8_t)(((uint8_t)(x))<<DAC_DATL_DATA0_SHIFT))&DAC_DATL_DATA0_MASK)
-/* DATH Bit Fields */
-#define DAC_DATH_DATA1_MASK                      0xFu
-#define DAC_DATH_DATA1_SHIFT                     0
-#define DAC_DATH_DATA1(x)                        (((uint8_t)(((uint8_t)(x))<<DAC_DATH_DATA1_SHIFT))&DAC_DATH_DATA1_MASK)
-/* SR Bit Fields */
-#define DAC_SR_DACBFRPBF_MASK                    0x1u
-#define DAC_SR_DACBFRPBF_SHIFT                   0
-#define DAC_SR_DACBFRPTF_MASK                    0x2u
-#define DAC_SR_DACBFRPTF_SHIFT                   1
-/* C0 Bit Fields */
-#define DAC_C0_DACBBIEN_MASK                     0x1u
-#define DAC_C0_DACBBIEN_SHIFT                    0
-#define DAC_C0_DACBTIEN_MASK                     0x2u
-#define DAC_C0_DACBTIEN_SHIFT                    1
-#define DAC_C0_LPEN_MASK                         0x8u
-#define DAC_C0_LPEN_SHIFT                        3
-#define DAC_C0_DACSWTRG_MASK                     0x10u
-#define DAC_C0_DACSWTRG_SHIFT                    4
-#define DAC_C0_DACTRGSEL_MASK                    0x20u
-#define DAC_C0_DACTRGSEL_SHIFT                   5
-#define DAC_C0_DACRFS_MASK                       0x40u
-#define DAC_C0_DACRFS_SHIFT                      6
-#define DAC_C0_DACEN_MASK                        0x80u
-#define DAC_C0_DACEN_SHIFT                       7
-/* C1 Bit Fields */
-#define DAC_C1_DACBFEN_MASK                      0x1u
-#define DAC_C1_DACBFEN_SHIFT                     0
-#define DAC_C1_DACBFMD_MASK                      0x4u
-#define DAC_C1_DACBFMD_SHIFT                     2
-#define DAC_C1_DMAEN_MASK                        0x80u
-#define DAC_C1_DMAEN_SHIFT                       7
-/* C2 Bit Fields */
-#define DAC_C2_DACBFUP_MASK                      0x1u
-#define DAC_C2_DACBFUP_SHIFT                     0
-#define DAC_C2_DACBFRP_MASK                      0x10u
-#define DAC_C2_DACBFRP_SHIFT                     4
-
-/**
- * @}
- */ /* end of group DAC_Register_Masks */
-
-
-/* DAC - Peripheral instance base addresses */
-/** Peripheral DAC0 base address */
-#define DAC0_BASE                                (0x4003F000u)
-/** Peripheral DAC0 base pointer */
-#define DAC0                                     ((DAC_Type *)DAC0_BASE)
-/** Array initializer of DAC peripheral base pointers */
-#define DAC_BASES                                { DAC0 }
-
-/**
- * @}
- */ /* end of group DAC_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- DMA Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup DMA_Peripheral_Access_Layer DMA Peripheral Access Layer
- * @{
- */
-
-/** DMA - Register Layout Typedef */
-typedef struct {
-  union {                                          /* offset: 0x0 */
-    __IO uint8_t REQC_ARR[4];                        /**< DMA_REQC0 register...DMA_REQC3 register., array offset: 0x0, array step: 0x1 */
-  };
-       uint8_t RESERVED_0[252];
-  struct {                                         /* offset: 0x100, array step: 0x10 */
-    __IO uint32_t SAR;                               /**< Source Address Register, array offset: 0x100, array step: 0x10 */
-    __IO uint32_t DAR;                               /**< Destination Address Register, array offset: 0x104, array step: 0x10 */
-    union {                                          /* offset: 0x108, array step: 0x10 */
-      __IO uint32_t DSR_BCR;                           /**< DMA Status Register / Byte Count Register, array offset: 0x108, array step: 0x10 */
-      struct {                                         /* offset: 0x108, array step: 0x10 */
-             uint8_t RESERVED_0[3];
-        __IO uint8_t DSR;                                /**< DMA_DSR0 register...DMA_DSR3 register., array offset: 0x10B, array step: 0x10 */
-      } DMA_DSR_ACCESS8BIT;
-    };
-    __IO uint32_t DCR;                               /**< DMA Control Register, array offset: 0x10C, array step: 0x10 */
-  } DMA[4];
-} DMA_Type;
-
-/* ----------------------------------------------------------------------------
-   -- DMA Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup DMA_Register_Masks DMA Register Masks
- * @{
- */
-
-/* REQC_ARR Bit Fields */
-#define DMA_REQC_ARR_DMAC_MASK                   0xFu
-#define DMA_REQC_ARR_DMAC_SHIFT                  0
-#define DMA_REQC_ARR_DMAC(x)                     (((uint8_t)(((uint8_t)(x))<<DMA_REQC_ARR_DMAC_SHIFT))&DMA_REQC_ARR_DMAC_MASK)
-#define DMA_REQC_ARR_CFSM_MASK                   0x80u
-#define DMA_REQC_ARR_CFSM_SHIFT                  7
-/* SAR Bit Fields */
-#define DMA_SAR_SAR_MASK                         0xFFFFFFFFu
-#define DMA_SAR_SAR_SHIFT                        0
-#define DMA_SAR_SAR(x)                           (((uint32_t)(((uint32_t)(x))<<DMA_SAR_SAR_SHIFT))&DMA_SAR_SAR_MASK)
-/* DAR Bit Fields */
-#define DMA_DAR_DAR_MASK                         0xFFFFFFFFu
-#define DMA_DAR_DAR_SHIFT                        0
-#define DMA_DAR_DAR(x)                           (((uint32_t)(((uint32_t)(x))<<DMA_DAR_DAR_SHIFT))&DMA_DAR_DAR_MASK)
-/* DSR_BCR Bit Fields */
-#define DMA_DSR_BCR_BCR_MASK                     0xFFFFFFu
-#define DMA_DSR_BCR_BCR_SHIFT                    0
-#define DMA_DSR_BCR_BCR(x)                       (((uint32_t)(((uint32_t)(x))<<DMA_DSR_BCR_BCR_SHIFT))&DMA_DSR_BCR_BCR_MASK)
-#define DMA_DSR_BCR_DONE_MASK                    0x1000000u
-#define DMA_DSR_BCR_DONE_SHIFT                   24
-#define DMA_DSR_BCR_BSY_MASK                     0x2000000u
-#define DMA_DSR_BCR_BSY_SHIFT                    25
-#define DMA_DSR_BCR_REQ_MASK                     0x4000000u
-#define DMA_DSR_BCR_REQ_SHIFT                    26
-#define DMA_DSR_BCR_BED_MASK                     0x10000000u
-#define DMA_DSR_BCR_BED_SHIFT                    28
-#define DMA_DSR_BCR_BES_MASK                     0x20000000u
-#define DMA_DSR_BCR_BES_SHIFT                    29
-#define DMA_DSR_BCR_CE_MASK                      0x40000000u
-#define DMA_DSR_BCR_CE_SHIFT                     30
-/* DCR Bit Fields */
-#define DMA_DCR_LCH2_MASK                        0x3u
-#define DMA_DCR_LCH2_SHIFT                       0
-#define DMA_DCR_LCH2(x)                          (((uint32_t)(((uint32_t)(x))<<DMA_DCR_LCH2_SHIFT))&DMA_DCR_LCH2_MASK)
-#define DMA_DCR_LCH1_MASK                        0xCu
-#define DMA_DCR_LCH1_SHIFT                       2
-#define DMA_DCR_LCH1(x)                          (((uint32_t)(((uint32_t)(x))<<DMA_DCR_LCH1_SHIFT))&DMA_DCR_LCH1_MASK)
-#define DMA_DCR_LINKCC_MASK                      0x30u
-#define DMA_DCR_LINKCC_SHIFT                     4
-#define DMA_DCR_LINKCC(x)                        (((uint32_t)(((uint32_t)(x))<<DMA_DCR_LINKCC_SHIFT))&DMA_DCR_LINKCC_MASK)
-#define DMA_DCR_D_REQ_MASK                       0x80u
-#define DMA_DCR_D_REQ_SHIFT                      7
-#define DMA_DCR_DMOD_MASK                        0xF00u
-#define DMA_DCR_DMOD_SHIFT                       8
-#define DMA_DCR_DMOD(x)                          (((uint32_t)(((uint32_t)(x))<<DMA_DCR_DMOD_SHIFT))&DMA_DCR_DMOD_MASK)
-#define DMA_DCR_SMOD_MASK                        0xF000u
-#define DMA_DCR_SMOD_SHIFT                       12
-#define DMA_DCR_SMOD(x)                          (((uint32_t)(((uint32_t)(x))<<DMA_DCR_SMOD_SHIFT))&DMA_DCR_SMOD_MASK)
-#define DMA_DCR_START_MASK                       0x10000u
-#define DMA_DCR_START_SHIFT                      16
-#define DMA_DCR_DSIZE_MASK                       0x60000u
-#define DMA_DCR_DSIZE_SHIFT                      17
-#define DMA_DCR_DSIZE(x)                         (((uint32_t)(((uint32_t)(x))<<DMA_DCR_DSIZE_SHIFT))&DMA_DCR_DSIZE_MASK)
-#define DMA_DCR_DINC_MASK                        0x80000u
-#define DMA_DCR_DINC_SHIFT                       19
-#define DMA_DCR_SSIZE_MASK                       0x300000u
-#define DMA_DCR_SSIZE_SHIFT                      20
-#define DMA_DCR_SSIZE(x)                         (((uint32_t)(((uint32_t)(x))<<DMA_DCR_SSIZE_SHIFT))&DMA_DCR_SSIZE_MASK)
-#define DMA_DCR_SINC_MASK                        0x400000u
-#define DMA_DCR_SINC_SHIFT                       22
-#define DMA_DCR_EADREQ_MASK                      0x800000u
-#define DMA_DCR_EADREQ_SHIFT                     23
-#define DMA_DCR_AA_MASK                          0x10000000u
-#define DMA_DCR_AA_SHIFT                         28
-#define DMA_DCR_CS_MASK                          0x20000000u
-#define DMA_DCR_CS_SHIFT                         29
-#define DMA_DCR_ERQ_MASK                         0x40000000u
-#define DMA_DCR_ERQ_SHIFT                        30
-#define DMA_DCR_EINT_MASK                        0x80000000u
-#define DMA_DCR_EINT_SHIFT                       31
-
-/**
- * @}
- */ /* end of group DMA_Register_Masks */
-
-
-/* DMA - Peripheral instance base addresses */
-/** Peripheral DMA base address */
-#define DMA_BASE                                 (0x40008000u)
-/** Peripheral DMA base pointer */
-#define DMA0                                     ((DMA_Type *)DMA_BASE)
-/** Array initializer of DMA peripheral base pointers */
-#define DMA_BASES                                { DMA0 }
-
-/**
- * @}
- */ /* end of group DMA_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- DMAMUX Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup DMAMUX_Peripheral_Access_Layer DMAMUX Peripheral Access Layer
- * @{
- */
-
-/** DMAMUX - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t CHCFG[4];                           /**< Channel Configuration register, array offset: 0x0, array step: 0x1 */
-} DMAMUX_Type;
-
-/* ----------------------------------------------------------------------------
-   -- DMAMUX Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup DMAMUX_Register_Masks DMAMUX Register Masks
- * @{
- */
-
-/* CHCFG Bit Fields */
-#define DMAMUX_CHCFG_SOURCE_MASK                 0x3Fu
-#define DMAMUX_CHCFG_SOURCE_SHIFT                0
-#define DMAMUX_CHCFG_SOURCE(x)                   (((uint8_t)(((uint8_t)(x))<<DMAMUX_CHCFG_SOURCE_SHIFT))&DMAMUX_CHCFG_SOURCE_MASK)
-#define DMAMUX_CHCFG_TRIG_MASK                   0x40u
-#define DMAMUX_CHCFG_TRIG_SHIFT                  6
-#define DMAMUX_CHCFG_ENBL_MASK                   0x80u
-#define DMAMUX_CHCFG_ENBL_SHIFT                  7
-
-/**
- * @}
- */ /* end of group DMAMUX_Register_Masks */
-
-
-/* DMAMUX - Peripheral instance base addresses */
-/** Peripheral DMAMUX0 base address */
-#define DMAMUX0_BASE                             (0x40021000u)
-/** Peripheral DMAMUX0 base pointer */
-#define DMAMUX0                                  ((DMAMUX_Type *)DMAMUX0_BASE)
-/** Array initializer of DMAMUX peripheral base pointers */
-#define DMAMUX_BASES                             { DMAMUX0 }
-
-/**
- * @}
- */ /* end of group DMAMUX_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- FGPIO Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup FGPIO_Peripheral_Access_Layer FGPIO Peripheral Access Layer
- * @{
- */
-
-/** FGPIO - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t PDOR;                              /**< Port Data Output Register, offset: 0x0 */
-  __O  uint32_t PSOR;                              /**< Port Set Output Register, offset: 0x4 */
-  __O  uint32_t PCOR;                              /**< Port Clear Output Register, offset: 0x8 */
-  __O  uint32_t PTOR;                              /**< Port Toggle Output Register, offset: 0xC */
-  __I  uint32_t PDIR;                              /**< Port Data Input Register, offset: 0x10 */
-  __IO uint32_t PDDR;                              /**< Port Data Direction Register, offset: 0x14 */
-} FGPIO_Type;
-
-/* ----------------------------------------------------------------------------
-   -- FGPIO Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup FGPIO_Register_Masks FGPIO Register Masks
- * @{
- */
-
-/* PDOR Bit Fields */
-#define FGPIO_PDOR_PDO_MASK                      0xFFFFFFFFu
-#define FGPIO_PDOR_PDO_SHIFT                     0
-#define FGPIO_PDOR_PDO(x)                        (((uint32_t)(((uint32_t)(x))<<FGPIO_PDOR_PDO_SHIFT))&FGPIO_PDOR_PDO_MASK)
-/* PSOR Bit Fields */
-#define FGPIO_PSOR_PTSO_MASK                     0xFFFFFFFFu
-#define FGPIO_PSOR_PTSO_SHIFT                    0
-#define FGPIO_PSOR_PTSO(x)                       (((uint32_t)(((uint32_t)(x))<<FGPIO_PSOR_PTSO_SHIFT))&FGPIO_PSOR_PTSO_MASK)
-/* PCOR Bit Fields */
-#define FGPIO_PCOR_PTCO_MASK                     0xFFFFFFFFu
-#define FGPIO_PCOR_PTCO_SHIFT                    0
-#define FGPIO_PCOR_PTCO(x)                       (((uint32_t)(((uint32_t)(x))<<FGPIO_PCOR_PTCO_SHIFT))&FGPIO_PCOR_PTCO_MASK)
-/* PTOR Bit Fields */
-#define FGPIO_PTOR_PTTO_MASK                     0xFFFFFFFFu
-#define FGPIO_PTOR_PTTO_SHIFT                    0
-#define FGPIO_PTOR_PTTO(x)                       (((uint32_t)(((uint32_t)(x))<<FGPIO_PTOR_PTTO_SHIFT))&FGPIO_PTOR_PTTO_MASK)
-/* PDIR Bit Fields */
-#define FGPIO_PDIR_PDI_MASK                      0xFFFFFFFFu
-#define FGPIO_PDIR_PDI_SHIFT                     0
-#define FGPIO_PDIR_PDI(x)                        (((uint32_t)(((uint32_t)(x))<<FGPIO_PDIR_PDI_SHIFT))&FGPIO_PDIR_PDI_MASK)
-/* PDDR Bit Fields */
-#define FGPIO_PDDR_PDD_MASK                      0xFFFFFFFFu
-#define FGPIO_PDDR_PDD_SHIFT                     0
-#define FGPIO_PDDR_PDD(x)                        (((uint32_t)(((uint32_t)(x))<<FGPIO_PDDR_PDD_SHIFT))&FGPIO_PDDR_PDD_MASK)
-
-/**
- * @}
- */ /* end of group FGPIO_Register_Masks */
-
-
-/* FGPIO - Peripheral instance base addresses */
-/** Peripheral FPTA base address */
-#define FPTA_BASE                                (0xF80FF000u)
-/** Peripheral FPTA base pointer */
-#define FPTA                                     ((FGPIO_Type *)FPTA_BASE)
-/** Peripheral FPTB base address */
-#define FPTB_BASE                                (0xF80FF040u)
-/** Peripheral FPTB base pointer */
-#define FPTB                                     ((FGPIO_Type *)FPTB_BASE)
-/** Peripheral FPTC base address */
-#define FPTC_BASE                                (0xF80FF080u)
-/** Peripheral FPTC base pointer */
-#define FPTC                                     ((FGPIO_Type *)FPTC_BASE)
-/** Peripheral FPTD base address */
-#define FPTD_BASE                                (0xF80FF0C0u)
-/** Peripheral FPTD base pointer */
-#define FPTD                                     ((FGPIO_Type *)FPTD_BASE)
-/** Peripheral FPTE base address */
-#define FPTE_BASE                                (0xF80FF100u)
-/** Peripheral FPTE base pointer */
-#define FPTE                                     ((FGPIO_Type *)FPTE_BASE)
-/** Array initializer of FGPIO peripheral base pointers */
-#define FGPIO_BASES                              { FPTA, FPTB, FPTC, FPTD, FPTE }
-
-/**
- * @}
- */ /* end of group FGPIO_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- FTFA Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup FTFA_Peripheral_Access_Layer FTFA Peripheral Access Layer
- * @{
- */
-
-/** FTFA - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t FSTAT;                              /**< Flash Status Register, offset: 0x0 */
-  __IO uint8_t FCNFG;                              /**< Flash Configuration Register, offset: 0x1 */
-  __I  uint8_t FSEC;                               /**< Flash Security Register, offset: 0x2 */
-  __I  uint8_t FOPT;                               /**< Flash Option Register, offset: 0x3 */
-  __IO uint8_t FCCOB3;                             /**< Flash Common Command Object Registers, offset: 0x4 */
-  __IO uint8_t FCCOB2;                             /**< Flash Common Command Object Registers, offset: 0x5 */
-  __IO uint8_t FCCOB1;                             /**< Flash Common Command Object Registers, offset: 0x6 */
-  __IO uint8_t FCCOB0;                             /**< Flash Common Command Object Registers, offset: 0x7 */
-  __IO uint8_t FCCOB7;                             /**< Flash Common Command Object Registers, offset: 0x8 */
-  __IO uint8_t FCCOB6;                             /**< Flash Common Command Object Registers, offset: 0x9 */
-  __IO uint8_t FCCOB5;                             /**< Flash Common Command Object Registers, offset: 0xA */
-  __IO uint8_t FCCOB4;                             /**< Flash Common Command Object Registers, offset: 0xB */
-  __IO uint8_t FCCOBB;                             /**< Flash Common Command Object Registers, offset: 0xC */
-  __IO uint8_t FCCOBA;                             /**< Flash Common Command Object Registers, offset: 0xD */
-  __IO uint8_t FCCOB9;                             /**< Flash Common Command Object Registers, offset: 0xE */
-  __IO uint8_t FCCOB8;                             /**< Flash Common Command Object Registers, offset: 0xF */
-  __IO uint8_t FPROT3;                             /**< Program Flash Protection Registers, offset: 0x10 */
-  __IO uint8_t FPROT2;                             /**< Program Flash Protection Registers, offset: 0x11 */
-  __IO uint8_t FPROT1;                             /**< Program Flash Protection Registers, offset: 0x12 */
-  __IO uint8_t FPROT0;                             /**< Program Flash Protection Registers, offset: 0x13 */
-} FTFA_Type;
-
-/* ----------------------------------------------------------------------------
-   -- FTFA Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup FTFA_Register_Masks FTFA Register Masks
- * @{
- */
-
-/* FSTAT Bit Fields */
-#define FTFA_FSTAT_MGSTAT0_MASK                  0x1u
-#define FTFA_FSTAT_MGSTAT0_SHIFT                 0
-#define FTFA_FSTAT_FPVIOL_MASK                   0x10u
-#define FTFA_FSTAT_FPVIOL_SHIFT                  4
-#define FTFA_FSTAT_ACCERR_MASK                   0x20u
-#define FTFA_FSTAT_ACCERR_SHIFT                  5
-#define FTFA_FSTAT_RDCOLERR_MASK                 0x40u
-#define FTFA_FSTAT_RDCOLERR_SHIFT                6
-#define FTFA_FSTAT_CCIF_MASK                     0x80u
-#define FTFA_FSTAT_CCIF_SHIFT                    7
-/* FCNFG Bit Fields */
-#define FTFA_FCNFG_ERSSUSP_MASK                  0x10u
-#define FTFA_FCNFG_ERSSUSP_SHIFT                 4
-#define FTFA_FCNFG_ERSAREQ_MASK                  0x20u
-#define FTFA_FCNFG_ERSAREQ_SHIFT                 5
-#define FTFA_FCNFG_RDCOLLIE_MASK                 0x40u
-#define FTFA_FCNFG_RDCOLLIE_SHIFT                6
-#define FTFA_FCNFG_CCIE_MASK                     0x80u
-#define FTFA_FCNFG_CCIE_SHIFT                    7
-/* FSEC Bit Fields */
-#define FTFA_FSEC_SEC_MASK                       0x3u
-#define FTFA_FSEC_SEC_SHIFT                      0
-#define FTFA_FSEC_SEC(x)                         (((uint8_t)(((uint8_t)(x))<<FTFA_FSEC_SEC_SHIFT))&FTFA_FSEC_SEC_MASK)
-#define FTFA_FSEC_FSLACC_MASK                    0xCu
-#define FTFA_FSEC_FSLACC_SHIFT                   2
-#define FTFA_FSEC_FSLACC(x)                      (((uint8_t)(((uint8_t)(x))<<FTFA_FSEC_FSLACC_SHIFT))&FTFA_FSEC_FSLACC_MASK)
-#define FTFA_FSEC_MEEN_MASK                      0x30u
-#define FTFA_FSEC_MEEN_SHIFT                     4
-#define FTFA_FSEC_MEEN(x)                        (((uint8_t)(((uint8_t)(x))<<FTFA_FSEC_MEEN_SHIFT))&FTFA_FSEC_MEEN_MASK)
-#define FTFA_FSEC_KEYEN_MASK                     0xC0u
-#define FTFA_FSEC_KEYEN_SHIFT                    6
-#define FTFA_FSEC_KEYEN(x)                       (((uint8_t)(((uint8_t)(x))<<FTFA_FSEC_KEYEN_SHIFT))&FTFA_FSEC_KEYEN_MASK)
-/* FOPT Bit Fields */
-#define FTFA_FOPT_OPT_MASK                       0xFFu
-#define FTFA_FOPT_OPT_SHIFT                      0
-#define FTFA_FOPT_OPT(x)                         (((uint8_t)(((uint8_t)(x))<<FTFA_FOPT_OPT_SHIFT))&FTFA_FOPT_OPT_MASK)
-/* FCCOB3 Bit Fields */
-#define FTFA_FCCOB3_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB3_CCOBn_SHIFT                  0
-#define FTFA_FCCOB3_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB3_CCOBn_SHIFT))&FTFA_FCCOB3_CCOBn_MASK)
-/* FCCOB2 Bit Fields */
-#define FTFA_FCCOB2_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB2_CCOBn_SHIFT                  0
-#define FTFA_FCCOB2_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB2_CCOBn_SHIFT))&FTFA_FCCOB2_CCOBn_MASK)
-/* FCCOB1 Bit Fields */
-#define FTFA_FCCOB1_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB1_CCOBn_SHIFT                  0
-#define FTFA_FCCOB1_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB1_CCOBn_SHIFT))&FTFA_FCCOB1_CCOBn_MASK)
-/* FCCOB0 Bit Fields */
-#define FTFA_FCCOB0_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB0_CCOBn_SHIFT                  0
-#define FTFA_FCCOB0_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB0_CCOBn_SHIFT))&FTFA_FCCOB0_CCOBn_MASK)
-/* FCCOB7 Bit Fields */
-#define FTFA_FCCOB7_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB7_CCOBn_SHIFT                  0
-#define FTFA_FCCOB7_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB7_CCOBn_SHIFT))&FTFA_FCCOB7_CCOBn_MASK)
-/* FCCOB6 Bit Fields */
-#define FTFA_FCCOB6_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB6_CCOBn_SHIFT                  0
-#define FTFA_FCCOB6_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB6_CCOBn_SHIFT))&FTFA_FCCOB6_CCOBn_MASK)
-/* FCCOB5 Bit Fields */
-#define FTFA_FCCOB5_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB5_CCOBn_SHIFT                  0
-#define FTFA_FCCOB5_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB5_CCOBn_SHIFT))&FTFA_FCCOB5_CCOBn_MASK)
-/* FCCOB4 Bit Fields */
-#define FTFA_FCCOB4_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB4_CCOBn_SHIFT                  0
-#define FTFA_FCCOB4_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB4_CCOBn_SHIFT))&FTFA_FCCOB4_CCOBn_MASK)
-/* FCCOBB Bit Fields */
-#define FTFA_FCCOBB_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOBB_CCOBn_SHIFT                  0
-#define FTFA_FCCOBB_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOBB_CCOBn_SHIFT))&FTFA_FCCOBB_CCOBn_MASK)
-/* FCCOBA Bit Fields */
-#define FTFA_FCCOBA_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOBA_CCOBn_SHIFT                  0
-#define FTFA_FCCOBA_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOBA_CCOBn_SHIFT))&FTFA_FCCOBA_CCOBn_MASK)
-/* FCCOB9 Bit Fields */
-#define FTFA_FCCOB9_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB9_CCOBn_SHIFT                  0
-#define FTFA_FCCOB9_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB9_CCOBn_SHIFT))&FTFA_FCCOB9_CCOBn_MASK)
-/* FCCOB8 Bit Fields */
-#define FTFA_FCCOB8_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB8_CCOBn_SHIFT                  0
-#define FTFA_FCCOB8_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB8_CCOBn_SHIFT))&FTFA_FCCOB8_CCOBn_MASK)
-/* FPROT3 Bit Fields */
-#define FTFA_FPROT3_PROT_MASK                    0xFFu
-#define FTFA_FPROT3_PROT_SHIFT                   0
-#define FTFA_FPROT3_PROT(x)                      (((uint8_t)(((uint8_t)(x))<<FTFA_FPROT3_PROT_SHIFT))&FTFA_FPROT3_PROT_MASK)
-/* FPROT2 Bit Fields */
-#define FTFA_FPROT2_PROT_MASK                    0xFFu
-#define FTFA_FPROT2_PROT_SHIFT                   0
-#define FTFA_FPROT2_PROT(x)                      (((uint8_t)(((uint8_t)(x))<<FTFA_FPROT2_PROT_SHIFT))&FTFA_FPROT2_PROT_MASK)
-/* FPROT1 Bit Fields */
-#define FTFA_FPROT1_PROT_MASK                    0xFFu
-#define FTFA_FPROT1_PROT_SHIFT                   0
-#define FTFA_FPROT1_PROT(x)                      (((uint8_t)(((uint8_t)(x))<<FTFA_FPROT1_PROT_SHIFT))&FTFA_FPROT1_PROT_MASK)
-/* FPROT0 Bit Fields */
-#define FTFA_FPROT0_PROT_MASK                    0xFFu
-#define FTFA_FPROT0_PROT_SHIFT                   0
-#define FTFA_FPROT0_PROT(x)                      (((uint8_t)(((uint8_t)(x))<<FTFA_FPROT0_PROT_SHIFT))&FTFA_FPROT0_PROT_MASK)
-
-/**
- * @}
- */ /* end of group FTFA_Register_Masks */
-
-
-/* FTFA - Peripheral instance base addresses */
-/** Peripheral FTFA base address */
-#define FTFA_BASE                                (0x40020000u)
-/** Peripheral FTFA base pointer */
-#define FTFA                                     ((FTFA_Type *)FTFA_BASE)
-/** Array initializer of FTFA peripheral base pointers */
-#define FTFA_BASES                               { FTFA }
-
-/**
- * @}
- */ /* end of group FTFA_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- GPIO Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup GPIO_Peripheral_Access_Layer GPIO Peripheral Access Layer
- * @{
- */
-
-/** GPIO - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t PDOR;                              /**< Port Data Output Register, offset: 0x0 */
-  __O  uint32_t PSOR;                              /**< Port Set Output Register, offset: 0x4 */
-  __O  uint32_t PCOR;                              /**< Port Clear Output Register, offset: 0x8 */
-  __O  uint32_t PTOR;                              /**< Port Toggle Output Register, offset: 0xC */
-  __I  uint32_t PDIR;                              /**< Port Data Input Register, offset: 0x10 */
-  __IO uint32_t PDDR;                              /**< Port Data Direction Register, offset: 0x14 */
-} GPIO_Type;
-
-/* ----------------------------------------------------------------------------
-   -- GPIO Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup GPIO_Register_Masks GPIO Register Masks
- * @{
- */
-
-/* PDOR Bit Fields */
-#define GPIO_PDOR_PDO_MASK                       0xFFFFFFFFu
-#define GPIO_PDOR_PDO_SHIFT                      0
-#define GPIO_PDOR_PDO(x)                         (((uint32_t)(((uint32_t)(x))<<GPIO_PDOR_PDO_SHIFT))&GPIO_PDOR_PDO_MASK)
-/* PSOR Bit Fields */
-#define GPIO_PSOR_PTSO_MASK                      0xFFFFFFFFu
-#define GPIO_PSOR_PTSO_SHIFT                     0
-#define GPIO_PSOR_PTSO(x)                        (((uint32_t)(((uint32_t)(x))<<GPIO_PSOR_PTSO_SHIFT))&GPIO_PSOR_PTSO_MASK)
-/* PCOR Bit Fields */
-#define GPIO_PCOR_PTCO_MASK                      0xFFFFFFFFu
-#define GPIO_PCOR_PTCO_SHIFT                     0
-#define GPIO_PCOR_PTCO(x)                        (((uint32_t)(((uint32_t)(x))<<GPIO_PCOR_PTCO_SHIFT))&GPIO_PCOR_PTCO_MASK)
-/* PTOR Bit Fields */
-#define GPIO_PTOR_PTTO_MASK                      0xFFFFFFFFu
-#define GPIO_PTOR_PTTO_SHIFT                     0
-#define GPIO_PTOR_PTTO(x)                        (((uint32_t)(((uint32_t)(x))<<GPIO_PTOR_PTTO_SHIFT))&GPIO_PTOR_PTTO_MASK)
-/* PDIR Bit Fields */
-#define GPIO_PDIR_PDI_MASK                       0xFFFFFFFFu
-#define GPIO_PDIR_PDI_SHIFT                      0
-#define GPIO_PDIR_PDI(x)                         (((uint32_t)(((uint32_t)(x))<<GPIO_PDIR_PDI_SHIFT))&GPIO_PDIR_PDI_MASK)
-/* PDDR Bit Fields */
-#define GPIO_PDDR_PDD_MASK                       0xFFFFFFFFu
-#define GPIO_PDDR_PDD_SHIFT                      0
-#define GPIO_PDDR_PDD(x)                         (((uint32_t)(((uint32_t)(x))<<GPIO_PDDR_PDD_SHIFT))&GPIO_PDDR_PDD_MASK)
-
-/**
- * @}
- */ /* end of group GPIO_Register_Masks */
-
-
-/* GPIO - Peripheral instance base addresses */
-/** Peripheral PTA base address */
-#define PTA_BASE                                 (0x400FF000u)
-/** Peripheral PTA base pointer */
-#define PTA                                      ((GPIO_Type *)PTA_BASE)
-/** Peripheral PTB base address */
-#define PTB_BASE                                 (0x400FF040u)
-/** Peripheral PTB base pointer */
-#define PTB                                      ((GPIO_Type *)PTB_BASE)
-/** Peripheral PTC base address */
-#define PTC_BASE                                 (0x400FF080u)
-/** Peripheral PTC base pointer */
-#define PTC                                      ((GPIO_Type *)PTC_BASE)
-/** Peripheral PTD base address */
-#define PTD_BASE                                 (0x400FF0C0u)
-/** Peripheral PTD base pointer */
-#define PTD                                      ((GPIO_Type *)PTD_BASE)
-/** Peripheral PTE base address */
-#define PTE_BASE                                 (0x400FF100u)
-/** Peripheral PTE base pointer */
-#define PTE                                      ((GPIO_Type *)PTE_BASE)
-/** Array initializer of GPIO peripheral base pointers */
-#define GPIO_BASES                               { PTA, PTB, PTC, PTD, PTE }
-
-/**
- * @}
- */ /* end of group GPIO_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- I2C Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup I2C_Peripheral_Access_Layer I2C Peripheral Access Layer
- * @{
- */
-
-/** I2C - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t A1;                                 /**< I2C Address Register 1, offset: 0x0 */
-  __IO uint8_t F;                                  /**< I2C Frequency Divider register, offset: 0x1 */
-  __IO uint8_t C1;                                 /**< I2C Control Register 1, offset: 0x2 */
-  __IO uint8_t S;                                  /**< I2C Status register, offset: 0x3 */
-  __IO uint8_t D;                                  /**< I2C Data I/O register, offset: 0x4 */
-  __IO uint8_t C2;                                 /**< I2C Control Register 2, offset: 0x5 */
-  __IO uint8_t FLT;                                /**< I2C Programmable Input Glitch Filter register, offset: 0x6 */
-  __IO uint8_t RA;                                 /**< I2C Range Address register, offset: 0x7 */
-  __IO uint8_t SMB;                                /**< I2C SMBus Control and Status register, offset: 0x8 */
-  __IO uint8_t A2;                                 /**< I2C Address Register 2, offset: 0x9 */
-  __IO uint8_t SLTH;                               /**< I2C SCL Low Timeout Register High, offset: 0xA */
-  __IO uint8_t SLTL;                               /**< I2C SCL Low Timeout Register Low, offset: 0xB */
-} I2C_Type;
-
-/* ----------------------------------------------------------------------------
-   -- I2C Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup I2C_Register_Masks I2C Register Masks
- * @{
- */
-
-/* A1 Bit Fields */
-#define I2C_A1_AD_MASK                           0xFEu
-#define I2C_A1_AD_SHIFT                          1
-#define I2C_A1_AD(x)                             (((uint8_t)(((uint8_t)(x))<<I2C_A1_AD_SHIFT))&I2C_A1_AD_MASK)
-/* F Bit Fields */
-#define I2C_F_ICR_MASK                           0x3Fu
-#define I2C_F_ICR_SHIFT                          0
-#define I2C_F_ICR(x)                             (((uint8_t)(((uint8_t)(x))<<I2C_F_ICR_SHIFT))&I2C_F_ICR_MASK)
-#define I2C_F_MULT_MASK                          0xC0u
-#define I2C_F_MULT_SHIFT                         6
-#define I2C_F_MULT(x)                            (((uint8_t)(((uint8_t)(x))<<I2C_F_MULT_SHIFT))&I2C_F_MULT_MASK)
-/* C1 Bit Fields */
-#define I2C_C1_DMAEN_MASK                        0x1u
-#define I2C_C1_DMAEN_SHIFT                       0
-#define I2C_C1_WUEN_MASK                         0x2u
-#define I2C_C1_WUEN_SHIFT                        1
-#define I2C_C1_RSTA_MASK                         0x4u
-#define I2C_C1_RSTA_SHIFT                        2
-#define I2C_C1_TXAK_MASK                         0x8u
-#define I2C_C1_TXAK_SHIFT                        3
-#define I2C_C1_TX_MASK                           0x10u
-#define I2C_C1_TX_SHIFT                          4
-#define I2C_C1_MST_MASK                          0x20u
-#define I2C_C1_MST_SHIFT                         5
-#define I2C_C1_IICIE_MASK                        0x40u
-#define I2C_C1_IICIE_SHIFT                       6
-#define I2C_C1_IICEN_MASK                        0x80u
-#define I2C_C1_IICEN_SHIFT                       7
-/* S Bit Fields */
-#define I2C_S_RXAK_MASK                          0x1u
-#define I2C_S_RXAK_SHIFT                         0
-#define I2C_S_IICIF_MASK                         0x2u
-#define I2C_S_IICIF_SHIFT                        1
-#define I2C_S_SRW_MASK                           0x4u
-#define I2C_S_SRW_SHIFT                          2
-#define I2C_S_RAM_MASK                           0x8u
-#define I2C_S_RAM_SHIFT                          3
-#define I2C_S_ARBL_MASK                          0x10u
-#define I2C_S_ARBL_SHIFT                         4
-#define I2C_S_BUSY_MASK                          0x20u
-#define I2C_S_BUSY_SHIFT                         5
-#define I2C_S_IAAS_MASK                          0x40u
-#define I2C_S_IAAS_SHIFT                         6
-#define I2C_S_TCF_MASK                           0x80u
-#define I2C_S_TCF_SHIFT                          7
-/* D Bit Fields */
-#define I2C_D_DATA_MASK                          0xFFu
-#define I2C_D_DATA_SHIFT                         0
-#define I2C_D_DATA(x)                            (((uint8_t)(((uint8_t)(x))<<I2C_D_DATA_SHIFT))&I2C_D_DATA_MASK)
-/* C2 Bit Fields */
-#define I2C_C2_AD_MASK                           0x7u
-#define I2C_C2_AD_SHIFT                          0
-#define I2C_C2_AD(x)                             (((uint8_t)(((uint8_t)(x))<<I2C_C2_AD_SHIFT))&I2C_C2_AD_MASK)
-#define I2C_C2_RMEN_MASK                         0x8u
-#define I2C_C2_RMEN_SHIFT                        3
-#define I2C_C2_SBRC_MASK                         0x10u
-#define I2C_C2_SBRC_SHIFT                        4
-#define I2C_C2_HDRS_MASK                         0x20u
-#define I2C_C2_HDRS_SHIFT                        5
-#define I2C_C2_ADEXT_MASK                        0x40u
-#define I2C_C2_ADEXT_SHIFT                       6
-#define I2C_C2_GCAEN_MASK                        0x80u
-#define I2C_C2_GCAEN_SHIFT                       7
-/* FLT Bit Fields */
-#define I2C_FLT_FLT_MASK                         0x1Fu
-#define I2C_FLT_FLT_SHIFT                        0
-#define I2C_FLT_FLT(x)                           (((uint8_t)(((uint8_t)(x))<<I2C_FLT_FLT_SHIFT))&I2C_FLT_FLT_MASK)
-#define I2C_FLT_STOPIE_MASK                      0x20u
-#define I2C_FLT_STOPIE_SHIFT                     5
-#define I2C_FLT_STOPF_MASK                       0x40u
-#define I2C_FLT_STOPF_SHIFT                      6
-#define I2C_FLT_SHEN_MASK                        0x80u
-#define I2C_FLT_SHEN_SHIFT                       7
-/* RA Bit Fields */
-#define I2C_RA_RAD_MASK                          0xFEu
-#define I2C_RA_RAD_SHIFT                         1
-#define I2C_RA_RAD(x)                            (((uint8_t)(((uint8_t)(x))<<I2C_RA_RAD_SHIFT))&I2C_RA_RAD_MASK)
-/* SMB Bit Fields */
-#define I2C_SMB_SHTF2IE_MASK                     0x1u
-#define I2C_SMB_SHTF2IE_SHIFT                    0
-#define I2C_SMB_SHTF2_MASK                       0x2u
-#define I2C_SMB_SHTF2_SHIFT                      1
-#define I2C_SMB_SHTF1_MASK                       0x4u
-#define I2C_SMB_SHTF1_SHIFT                      2
-#define I2C_SMB_SLTF_MASK                        0x8u
-#define I2C_SMB_SLTF_SHIFT                       3
-#define I2C_SMB_TCKSEL_MASK                      0x10u
-#define I2C_SMB_TCKSEL_SHIFT                     4
-#define I2C_SMB_SIICAEN_MASK                     0x20u
-#define I2C_SMB_SIICAEN_SHIFT                    5
-#define I2C_SMB_ALERTEN_MASK                     0x40u
-#define I2C_SMB_ALERTEN_SHIFT                    6
-#define I2C_SMB_FACK_MASK                        0x80u
-#define I2C_SMB_FACK_SHIFT                       7
-/* A2 Bit Fields */
-#define I2C_A2_SAD_MASK                          0xFEu
-#define I2C_A2_SAD_SHIFT                         1
-#define I2C_A2_SAD(x)                            (((uint8_t)(((uint8_t)(x))<<I2C_A2_SAD_SHIFT))&I2C_A2_SAD_MASK)
-/* SLTH Bit Fields */
-#define I2C_SLTH_SSLT_MASK                       0xFFu
-#define I2C_SLTH_SSLT_SHIFT                      0
-#define I2C_SLTH_SSLT(x)                         (((uint8_t)(((uint8_t)(x))<<I2C_SLTH_SSLT_SHIFT))&I2C_SLTH_SSLT_MASK)
-/* SLTL Bit Fields */
-#define I2C_SLTL_SSLT_MASK                       0xFFu
-#define I2C_SLTL_SSLT_SHIFT                      0
-#define I2C_SLTL_SSLT(x)                         (((uint8_t)(((uint8_t)(x))<<I2C_SLTL_SSLT_SHIFT))&I2C_SLTL_SSLT_MASK)
-
-/**
- * @}
- */ /* end of group I2C_Register_Masks */
-
-
-/* I2C - Peripheral instance base addresses */
-/** Peripheral I2C0 base address */
-#define I2C0_BASE                                (0x40066000u)
-/** Peripheral I2C0 base pointer */
-#define I2C0                                     ((I2C_Type *)I2C0_BASE)
-/** Peripheral I2C1 base address */
-#define I2C1_BASE                                (0x40067000u)
-/** Peripheral I2C1 base pointer */
-#define I2C1                                     ((I2C_Type *)I2C1_BASE)
-/** Array initializer of I2C peripheral base pointers */
-#define I2C_BASES                                { I2C0, I2C1 }
-
-/**
- * @}
- */ /* end of group I2C_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- LLWU Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup LLWU_Peripheral_Access_Layer LLWU Peripheral Access Layer
- * @{
- */
-
-/** LLWU - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t PE1;                                /**< LLWU Pin Enable 1 register, offset: 0x0 */
-  __IO uint8_t PE2;                                /**< LLWU Pin Enable 2 register, offset: 0x1 */
-  __IO uint8_t PE3;                                /**< LLWU Pin Enable 3 register, offset: 0x2 */
-  __IO uint8_t PE4;                                /**< LLWU Pin Enable 4 register, offset: 0x3 */
-  __IO uint8_t ME;                                 /**< LLWU Module Enable register, offset: 0x4 */
-  __IO uint8_t F1;                                 /**< LLWU Flag 1 register, offset: 0x5 */
-  __IO uint8_t F2;                                 /**< LLWU Flag 2 register, offset: 0x6 */
-  __I  uint8_t F3;                                 /**< LLWU Flag 3 register, offset: 0x7 */
-  __IO uint8_t FILT1;                              /**< LLWU Pin Filter 1 register, offset: 0x8 */
-  __IO uint8_t FILT2;                              /**< LLWU Pin Filter 2 register, offset: 0x9 */
-} LLWU_Type;
-
-/* ----------------------------------------------------------------------------
-   -- LLWU Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup LLWU_Register_Masks LLWU Register Masks
- * @{
- */
-
-/* PE1 Bit Fields */
-#define LLWU_PE1_WUPE0_MASK                      0x3u
-#define LLWU_PE1_WUPE0_SHIFT                     0
-#define LLWU_PE1_WUPE0(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE1_WUPE0_SHIFT))&LLWU_PE1_WUPE0_MASK)
-#define LLWU_PE1_WUPE1_MASK                      0xCu
-#define LLWU_PE1_WUPE1_SHIFT                     2
-#define LLWU_PE1_WUPE1(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE1_WUPE1_SHIFT))&LLWU_PE1_WUPE1_MASK)
-#define LLWU_PE1_WUPE2_MASK                      0x30u
-#define LLWU_PE1_WUPE2_SHIFT                     4
-#define LLWU_PE1_WUPE2(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE1_WUPE2_SHIFT))&LLWU_PE1_WUPE2_MASK)
-#define LLWU_PE1_WUPE3_MASK                      0xC0u
-#define LLWU_PE1_WUPE3_SHIFT                     6
-#define LLWU_PE1_WUPE3(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE1_WUPE3_SHIFT))&LLWU_PE1_WUPE3_MASK)
-/* PE2 Bit Fields */
-#define LLWU_PE2_WUPE4_MASK                      0x3u
-#define LLWU_PE2_WUPE4_SHIFT                     0
-#define LLWU_PE2_WUPE4(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE2_WUPE4_SHIFT))&LLWU_PE2_WUPE4_MASK)
-#define LLWU_PE2_WUPE5_MASK                      0xCu
-#define LLWU_PE2_WUPE5_SHIFT                     2
-#define LLWU_PE2_WUPE5(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE2_WUPE5_SHIFT))&LLWU_PE2_WUPE5_MASK)
-#define LLWU_PE2_WUPE6_MASK                      0x30u
-#define LLWU_PE2_WUPE6_SHIFT                     4
-#define LLWU_PE2_WUPE6(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE2_WUPE6_SHIFT))&LLWU_PE2_WUPE6_MASK)
-#define LLWU_PE2_WUPE7_MASK                      0xC0u
-#define LLWU_PE2_WUPE7_SHIFT                     6
-#define LLWU_PE2_WUPE7(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE2_WUPE7_SHIFT))&LLWU_PE2_WUPE7_MASK)
-/* PE3 Bit Fields */
-#define LLWU_PE3_WUPE8_MASK                      0x3u
-#define LLWU_PE3_WUPE8_SHIFT                     0
-#define LLWU_PE3_WUPE8(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE3_WUPE8_SHIFT))&LLWU_PE3_WUPE8_MASK)
-#define LLWU_PE3_WUPE9_MASK                      0xCu
-#define LLWU_PE3_WUPE9_SHIFT                     2
-#define LLWU_PE3_WUPE9(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE3_WUPE9_SHIFT))&LLWU_PE3_WUPE9_MASK)
-#define LLWU_PE3_WUPE10_MASK                     0x30u
-#define LLWU_PE3_WUPE10_SHIFT                    4
-#define LLWU_PE3_WUPE10(x)                       (((uint8_t)(((uint8_t)(x))<<LLWU_PE3_WUPE10_SHIFT))&LLWU_PE3_WUPE10_MASK)
-#define LLWU_PE3_WUPE11_MASK                     0xC0u
-#define LLWU_PE3_WUPE11_SHIFT                    6
-#define LLWU_PE3_WUPE11(x)                       (((uint8_t)(((uint8_t)(x))<<LLWU_PE3_WUPE11_SHIFT))&LLWU_PE3_WUPE11_MASK)
-/* PE4 Bit Fields */
-#define LLWU_PE4_WUPE12_MASK                     0x3u
-#define LLWU_PE4_WUPE12_SHIFT                    0
-#define LLWU_PE4_WUPE12(x)                       (((uint8_t)(((uint8_t)(x))<<LLWU_PE4_WUPE12_SHIFT))&LLWU_PE4_WUPE12_MASK)
-#define LLWU_PE4_WUPE13_MASK                     0xCu
-#define LLWU_PE4_WUPE13_SHIFT                    2
-#define LLWU_PE4_WUPE13(x)                       (((uint8_t)(((uint8_t)(x))<<LLWU_PE4_WUPE13_SHIFT))&LLWU_PE4_WUPE13_MASK)
-#define LLWU_PE4_WUPE14_MASK                     0x30u
-#define LLWU_PE4_WUPE14_SHIFT                    4
-#define LLWU_PE4_WUPE14(x)                       (((uint8_t)(((uint8_t)(x))<<LLWU_PE4_WUPE14_SHIFT))&LLWU_PE4_WUPE14_MASK)
-#define LLWU_PE4_WUPE15_MASK                     0xC0u
-#define LLWU_PE4_WUPE15_SHIFT                    6
-#define LLWU_PE4_WUPE15(x)                       (((uint8_t)(((uint8_t)(x))<<LLWU_PE4_WUPE15_SHIFT))&LLWU_PE4_WUPE15_MASK)
-/* ME Bit Fields */
-#define LLWU_ME_WUME0_MASK                       0x1u
-#define LLWU_ME_WUME0_SHIFT                      0
-#define LLWU_ME_WUME1_MASK                       0x2u
-#define LLWU_ME_WUME1_SHIFT                      1
-#define LLWU_ME_WUME2_MASK                       0x4u
-#define LLWU_ME_WUME2_SHIFT                      2
-#define LLWU_ME_WUME3_MASK                       0x8u
-#define LLWU_ME_WUME3_SHIFT                      3
-#define LLWU_ME_WUME4_MASK                       0x10u
-#define LLWU_ME_WUME4_SHIFT                      4
-#define LLWU_ME_WUME5_MASK                       0x20u
-#define LLWU_ME_WUME5_SHIFT                      5
-#define LLWU_ME_WUME6_MASK                       0x40u
-#define LLWU_ME_WUME6_SHIFT                      6
-#define LLWU_ME_WUME7_MASK                       0x80u
-#define LLWU_ME_WUME7_SHIFT                      7
-/* F1 Bit Fields */
-#define LLWU_F1_WUF0_MASK                        0x1u
-#define LLWU_F1_WUF0_SHIFT                       0
-#define LLWU_F1_WUF1_MASK                        0x2u
-#define LLWU_F1_WUF1_SHIFT                       1
-#define LLWU_F1_WUF2_MASK                        0x4u
-#define LLWU_F1_WUF2_SHIFT                       2
-#define LLWU_F1_WUF3_MASK                        0x8u
-#define LLWU_F1_WUF3_SHIFT                       3
-#define LLWU_F1_WUF4_MASK                        0x10u
-#define LLWU_F1_WUF4_SHIFT                       4
-#define LLWU_F1_WUF5_MASK                        0x20u
-#define LLWU_F1_WUF5_SHIFT                       5
-#define LLWU_F1_WUF6_MASK                        0x40u
-#define LLWU_F1_WUF6_SHIFT                       6
-#define LLWU_F1_WUF7_MASK                        0x80u
-#define LLWU_F1_WUF7_SHIFT                       7
-/* F2 Bit Fields */
-#define LLWU_F2_WUF8_MASK                        0x1u
-#define LLWU_F2_WUF8_SHIFT                       0
-#define LLWU_F2_WUF9_MASK                        0x2u
-#define LLWU_F2_WUF9_SHIFT                       1
-#define LLWU_F2_WUF10_MASK                       0x4u
-#define LLWU_F2_WUF10_SHIFT                      2
-#define LLWU_F2_WUF11_MASK                       0x8u
-#define LLWU_F2_WUF11_SHIFT                      3
-#define LLWU_F2_WUF12_MASK                       0x10u
-#define LLWU_F2_WUF12_SHIFT                      4
-#define LLWU_F2_WUF13_MASK                       0x20u
-#define LLWU_F2_WUF13_SHIFT                      5
-#define LLWU_F2_WUF14_MASK                       0x40u
-#define LLWU_F2_WUF14_SHIFT                      6
-#define LLWU_F2_WUF15_MASK                       0x80u
-#define LLWU_F2_WUF15_SHIFT                      7
-/* F3 Bit Fields */
-#define LLWU_F3_MWUF0_MASK                       0x1u
-#define LLWU_F3_MWUF0_SHIFT                      0
-#define LLWU_F3_MWUF1_MASK                       0x2u
-#define LLWU_F3_MWUF1_SHIFT                      1
-#define LLWU_F3_MWUF2_MASK                       0x4u
-#define LLWU_F3_MWUF2_SHIFT                      2
-#define LLWU_F3_MWUF3_MASK                       0x8u
-#define LLWU_F3_MWUF3_SHIFT                      3
-#define LLWU_F3_MWUF4_MASK                       0x10u
-#define LLWU_F3_MWUF4_SHIFT                      4
-#define LLWU_F3_MWUF5_MASK                       0x20u
-#define LLWU_F3_MWUF5_SHIFT                      5
-#define LLWU_F3_MWUF6_MASK                       0x40u
-#define LLWU_F3_MWUF6_SHIFT                      6
-#define LLWU_F3_MWUF7_MASK                       0x80u
-#define LLWU_F3_MWUF7_SHIFT                      7
-/* FILT1 Bit Fields */
-#define LLWU_FILT1_FILTSEL_MASK                  0xFu
-#define LLWU_FILT1_FILTSEL_SHIFT                 0
-#define LLWU_FILT1_FILTSEL(x)                    (((uint8_t)(((uint8_t)(x))<<LLWU_FILT1_FILTSEL_SHIFT))&LLWU_FILT1_FILTSEL_MASK)
-#define LLWU_FILT1_FILTE_MASK                    0x60u
-#define LLWU_FILT1_FILTE_SHIFT                   5
-#define LLWU_FILT1_FILTE(x)                      (((uint8_t)(((uint8_t)(x))<<LLWU_FILT1_FILTE_SHIFT))&LLWU_FILT1_FILTE_MASK)
-#define LLWU_FILT1_FILTF_MASK                    0x80u
-#define LLWU_FILT1_FILTF_SHIFT                   7
-/* FILT2 Bit Fields */
-#define LLWU_FILT2_FILTSEL_MASK                  0xFu
-#define LLWU_FILT2_FILTSEL_SHIFT                 0
-#define LLWU_FILT2_FILTSEL(x)                    (((uint8_t)(((uint8_t)(x))<<LLWU_FILT2_FILTSEL_SHIFT))&LLWU_FILT2_FILTSEL_MASK)
-#define LLWU_FILT2_FILTE_MASK                    0x60u
-#define LLWU_FILT2_FILTE_SHIFT                   5
-#define LLWU_FILT2_FILTE(x)                      (((uint8_t)(((uint8_t)(x))<<LLWU_FILT2_FILTE_SHIFT))&LLWU_FILT2_FILTE_MASK)
-#define LLWU_FILT2_FILTF_MASK                    0x80u
-#define LLWU_FILT2_FILTF_SHIFT                   7
-
-/**
- * @}
- */ /* end of group LLWU_Register_Masks */
-
-
-/* LLWU - Peripheral instance base addresses */
-/** Peripheral LLWU base address */
-#define LLWU_BASE                                (0x4007C000u)
-/** Peripheral LLWU base pointer */
-#define LLWU                                     ((LLWU_Type *)LLWU_BASE)
-/** Array initializer of LLWU peripheral base pointers */
-#define LLWU_BASES                               { LLWU }
-
-/**
- * @}
- */ /* end of group LLWU_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- LPTMR Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup LPTMR_Peripheral_Access_Layer LPTMR Peripheral Access Layer
- * @{
- */
-
-/** LPTMR - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t CSR;                               /**< Low Power Timer Control Status Register, offset: 0x0 */
-  __IO uint32_t PSR;                               /**< Low Power Timer Prescale Register, offset: 0x4 */
-  __IO uint32_t CMR;                               /**< Low Power Timer Compare Register, offset: 0x8 */
-  __I  uint32_t CNR;                               /**< Low Power Timer Counter Register, offset: 0xC */
-} LPTMR_Type;
-
-/* ----------------------------------------------------------------------------
-   -- LPTMR Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup LPTMR_Register_Masks LPTMR Register Masks
- * @{
- */
-
-/* CSR Bit Fields */
-#define LPTMR_CSR_TEN_MASK                       0x1u
-#define LPTMR_CSR_TEN_SHIFT                      0
-#define LPTMR_CSR_TMS_MASK                       0x2u
-#define LPTMR_CSR_TMS_SHIFT                      1
-#define LPTMR_CSR_TFC_MASK                       0x4u
-#define LPTMR_CSR_TFC_SHIFT                      2
-#define LPTMR_CSR_TPP_MASK                       0x8u
-#define LPTMR_CSR_TPP_SHIFT                      3
-#define LPTMR_CSR_TPS_MASK                       0x30u
-#define LPTMR_CSR_TPS_SHIFT                      4
-#define LPTMR_CSR_TPS(x)                         (((uint32_t)(((uint32_t)(x))<<LPTMR_CSR_TPS_SHIFT))&LPTMR_CSR_TPS_MASK)
-#define LPTMR_CSR_TIE_MASK                       0x40u
-#define LPTMR_CSR_TIE_SHIFT                      6
-#define LPTMR_CSR_TCF_MASK                       0x80u
-#define LPTMR_CSR_TCF_SHIFT                      7
-/* PSR Bit Fields */
-#define LPTMR_PSR_PCS_MASK                       0x3u
-#define LPTMR_PSR_PCS_SHIFT                      0
-#define LPTMR_PSR_PCS(x)                         (((uint32_t)(((uint32_t)(x))<<LPTMR_PSR_PCS_SHIFT))&LPTMR_PSR_PCS_MASK)
-#define LPTMR_PSR_PBYP_MASK                      0x4u
-#define LPTMR_PSR_PBYP_SHIFT                     2
-#define LPTMR_PSR_PRESCALE_MASK                  0x78u
-#define LPTMR_PSR_PRESCALE_SHIFT                 3
-#define LPTMR_PSR_PRESCALE(x)                    (((uint32_t)(((uint32_t)(x))<<LPTMR_PSR_PRESCALE_SHIFT))&LPTMR_PSR_PRESCALE_MASK)
-/* CMR Bit Fields */
-#define LPTMR_CMR_COMPARE_MASK                   0xFFFFu
-#define LPTMR_CMR_COMPARE_SHIFT                  0
-#define LPTMR_CMR_COMPARE(x)                     (((uint32_t)(((uint32_t)(x))<<LPTMR_CMR_COMPARE_SHIFT))&LPTMR_CMR_COMPARE_MASK)
-/* CNR Bit Fields */
-#define LPTMR_CNR_COUNTER_MASK                   0xFFFFu
-#define LPTMR_CNR_COUNTER_SHIFT                  0
-#define LPTMR_CNR_COUNTER(x)                     (((uint32_t)(((uint32_t)(x))<<LPTMR_CNR_COUNTER_SHIFT))&LPTMR_CNR_COUNTER_MASK)
-
-/**
- * @}
- */ /* end of group LPTMR_Register_Masks */
-
-
-/* LPTMR - Peripheral instance base addresses */
-/** Peripheral LPTMR0 base address */
-#define LPTMR0_BASE                              (0x40040000u)
-/** Peripheral LPTMR0 base pointer */
-#define LPTMR0                                   ((LPTMR_Type *)LPTMR0_BASE)
-/** Array initializer of LPTMR peripheral base pointers */
-#define LPTMR_BASES                              { LPTMR0 }
-
-/**
- * @}
- */ /* end of group LPTMR_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- MCG Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MCG_Peripheral_Access_Layer MCG Peripheral Access Layer
- * @{
- */
-
-/** MCG - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t C1;                                 /**< MCG Control 1 Register, offset: 0x0 */
-  __IO uint8_t C2;                                 /**< MCG Control 2 Register, offset: 0x1 */
-  __IO uint8_t C3;                                 /**< MCG Control 3 Register, offset: 0x2 */
-  __IO uint8_t C4;                                 /**< MCG Control 4 Register, offset: 0x3 */
-  __IO uint8_t C5;                                 /**< MCG Control 5 Register, offset: 0x4 */
-  __IO uint8_t C6;                                 /**< MCG Control 6 Register, offset: 0x5 */
-  __I  uint8_t S;                                  /**< MCG Status Register, offset: 0x6 */
-       uint8_t RESERVED_0[1];
-  __IO uint8_t SC;                                 /**< MCG Status and Control Register, offset: 0x8 */
-       uint8_t RESERVED_1[1];
-  __IO uint8_t ATCVH;                              /**< MCG Auto Trim Compare Value High Register, offset: 0xA */
-  __IO uint8_t ATCVL;                              /**< MCG Auto Trim Compare Value Low Register, offset: 0xB */
-  __I  uint8_t C7;                                 /**< MCG Control 7 Register, offset: 0xC */
-  __IO uint8_t C8;                                 /**< MCG Control 8 Register, offset: 0xD */
-  __I  uint8_t C9;                                 /**< MCG Control 9 Register, offset: 0xE */
-  __I  uint8_t C10;                                /**< MCG Control 10 Register, offset: 0xF */
-} MCG_Type;
-
-/* ----------------------------------------------------------------------------
-   -- MCG Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MCG_Register_Masks MCG Register Masks
- * @{
- */
-
-/* C1 Bit Fields */
-#define MCG_C1_IREFSTEN_MASK                     0x1u
-#define MCG_C1_IREFSTEN_SHIFT                    0
-#define MCG_C1_IRCLKEN_MASK                      0x2u
-#define MCG_C1_IRCLKEN_SHIFT                     1
-#define MCG_C1_IREFS_MASK                        0x4u
-#define MCG_C1_IREFS_SHIFT                       2
-#define MCG_C1_FRDIV_MASK                        0x38u
-#define MCG_C1_FRDIV_SHIFT                       3
-#define MCG_C1_FRDIV(x)                          (((uint8_t)(((uint8_t)(x))<<MCG_C1_FRDIV_SHIFT))&MCG_C1_FRDIV_MASK)
-#define MCG_C1_CLKS_MASK                         0xC0u
-#define MCG_C1_CLKS_SHIFT                        6
-#define MCG_C1_CLKS(x)                           (((uint8_t)(((uint8_t)(x))<<MCG_C1_CLKS_SHIFT))&MCG_C1_CLKS_MASK)
-/* C2 Bit Fields */
-#define MCG_C2_IRCS_MASK                         0x1u
-#define MCG_C2_IRCS_SHIFT                        0
-#define MCG_C2_LP_MASK                           0x2u
-#define MCG_C2_LP_SHIFT                          1
-#define MCG_C2_EREFS0_MASK                       0x4u
-#define MCG_C2_EREFS0_SHIFT                      2
-#define MCG_C2_HGO0_MASK                         0x8u
-#define MCG_C2_HGO0_SHIFT                        3
-#define MCG_C2_RANGE0_MASK                       0x30u
-#define MCG_C2_RANGE0_SHIFT                      4
-#define MCG_C2_RANGE0(x)                         (((uint8_t)(((uint8_t)(x))<<MCG_C2_RANGE0_SHIFT))&MCG_C2_RANGE0_MASK)
-#define MCG_C2_LOCRE0_MASK                       0x80u
-#define MCG_C2_LOCRE0_SHIFT                      7
-/* C3 Bit Fields */
-#define MCG_C3_SCTRIM_MASK                       0xFFu
-#define MCG_C3_SCTRIM_SHIFT                      0
-#define MCG_C3_SCTRIM(x)                         (((uint8_t)(((uint8_t)(x))<<MCG_C3_SCTRIM_SHIFT))&MCG_C3_SCTRIM_MASK)
-/* C4 Bit Fields */
-#define MCG_C4_SCFTRIM_MASK                      0x1u
-#define MCG_C4_SCFTRIM_SHIFT                     0
-#define MCG_C4_FCTRIM_MASK                       0x1Eu
-#define MCG_C4_FCTRIM_SHIFT                      1
-#define MCG_C4_FCTRIM(x)                         (((uint8_t)(((uint8_t)(x))<<MCG_C4_FCTRIM_SHIFT))&MCG_C4_FCTRIM_MASK)
-#define MCG_C4_DRST_DRS_MASK                     0x60u
-#define MCG_C4_DRST_DRS_SHIFT                    5
-#define MCG_C4_DRST_DRS(x)                       (((uint8_t)(((uint8_t)(x))<<MCG_C4_DRST_DRS_SHIFT))&MCG_C4_DRST_DRS_MASK)
-#define MCG_C4_DMX32_MASK                        0x80u
-#define MCG_C4_DMX32_SHIFT                       7
-/* C5 Bit Fields */
-#define MCG_C5_PRDIV0_MASK                       0x1Fu
-#define MCG_C5_PRDIV0_SHIFT                      0
-#define MCG_C5_PRDIV0(x)                         (((uint8_t)(((uint8_t)(x))<<MCG_C5_PRDIV0_SHIFT))&MCG_C5_PRDIV0_MASK)
-#define MCG_C5_PLLSTEN0_MASK                     0x20u
-#define MCG_C5_PLLSTEN0_SHIFT                    5
-#define MCG_C5_PLLCLKEN0_MASK                    0x40u
-#define MCG_C5_PLLCLKEN0_SHIFT                   6
-/* C6 Bit Fields */
-#define MCG_C6_VDIV0_MASK                        0x1Fu
-#define MCG_C6_VDIV0_SHIFT                       0
-#define MCG_C6_VDIV0(x)                          (((uint8_t)(((uint8_t)(x))<<MCG_C6_VDIV0_SHIFT))&MCG_C6_VDIV0_MASK)
-#define MCG_C6_CME0_MASK                         0x20u
-#define MCG_C6_CME0_SHIFT                        5
-#define MCG_C6_PLLS_MASK                         0x40u
-#define MCG_C6_PLLS_SHIFT                        6
-#define MCG_C6_LOLIE0_MASK                       0x80u
-#define MCG_C6_LOLIE0_SHIFT                      7
-/* S Bit Fields */
-#define MCG_S_IRCST_MASK                         0x1u
-#define MCG_S_IRCST_SHIFT                        0
-#define MCG_S_OSCINIT0_MASK                      0x2u
-#define MCG_S_OSCINIT0_SHIFT                     1
-#define MCG_S_CLKST_MASK                         0xCu
-#define MCG_S_CLKST_SHIFT                        2
-#define MCG_S_CLKST(x)                           (((uint8_t)(((uint8_t)(x))<<MCG_S_CLKST_SHIFT))&MCG_S_CLKST_MASK)
-#define MCG_S_IREFST_MASK                        0x10u
-#define MCG_S_IREFST_SHIFT                       4
-#define MCG_S_PLLST_MASK                         0x20u
-#define MCG_S_PLLST_SHIFT                        5
-#define MCG_S_LOCK0_MASK                         0x40u
-#define MCG_S_LOCK0_SHIFT                        6
-#define MCG_S_LOLS_MASK                          0x80u
-#define MCG_S_LOLS_SHIFT                         7
-/* SC Bit Fields */
-#define MCG_SC_LOCS0_MASK                        0x1u
-#define MCG_SC_LOCS0_SHIFT                       0
-#define MCG_SC_FCRDIV_MASK                       0xEu
-#define MCG_SC_FCRDIV_SHIFT                      1
-#define MCG_SC_FCRDIV(x)                         (((uint8_t)(((uint8_t)(x))<<MCG_SC_FCRDIV_SHIFT))&MCG_SC_FCRDIV_MASK)
-#define MCG_SC_FLTPRSRV_MASK                     0x10u
-#define MCG_SC_FLTPRSRV_SHIFT                    4
-#define MCG_SC_ATMF_MASK                         0x20u
-#define MCG_SC_ATMF_SHIFT                        5
-#define MCG_SC_ATMS_MASK                         0x40u
-#define MCG_SC_ATMS_SHIFT                        6
-#define MCG_SC_ATME_MASK                         0x80u
-#define MCG_SC_ATME_SHIFT                        7
-/* ATCVH Bit Fields */
-#define MCG_ATCVH_ATCVH_MASK                     0xFFu
-#define MCG_ATCVH_ATCVH_SHIFT                    0
-#define MCG_ATCVH_ATCVH(x)                       (((uint8_t)(((uint8_t)(x))<<MCG_ATCVH_ATCVH_SHIFT))&MCG_ATCVH_ATCVH_MASK)
-/* ATCVL Bit Fields */
-#define MCG_ATCVL_ATCVL_MASK                     0xFFu
-#define MCG_ATCVL_ATCVL_SHIFT                    0
-#define MCG_ATCVL_ATCVL(x)                       (((uint8_t)(((uint8_t)(x))<<MCG_ATCVL_ATCVL_SHIFT))&MCG_ATCVL_ATCVL_MASK)
-/* C8 Bit Fields */
-#define MCG_C8_LOLRE_MASK                        0x40u
-#define MCG_C8_LOLRE_SHIFT                       6
-
-/**
- * @}
- */ /* end of group MCG_Register_Masks */
-
-
-/* MCG - Peripheral instance base addresses */
-/** Peripheral MCG base address */
-#define MCG_BASE                                 (0x40064000u)
-/** Peripheral MCG base pointer */
-#define MCG                                      ((MCG_Type *)MCG_BASE)
-/** Array initializer of MCG peripheral base pointers */
-#define MCG_BASES                                { MCG }
-
-/**
- * @}
- */ /* end of group MCG_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- MCM Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MCM_Peripheral_Access_Layer MCM Peripheral Access Layer
- * @{
- */
-
-/** MCM - Register Layout Typedef */
-typedef struct {
-       uint8_t RESERVED_0[8];
-  __I  uint16_t PLASC;                             /**< Crossbar Switch (AXBS) Slave Configuration, offset: 0x8 */
-  __I  uint16_t PLAMC;                             /**< Crossbar Switch (AXBS) Master Configuration, offset: 0xA */
-  __IO uint32_t PLACR;                             /**< Platform Control Register, offset: 0xC */
-       uint8_t RESERVED_1[48];
-  __IO uint32_t CPO;                               /**< Compute Operation Control Register, offset: 0x40 */
-} MCM_Type;
-
-/* ----------------------------------------------------------------------------
-   -- MCM Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MCM_Register_Masks MCM Register Masks
- * @{
- */
-
-/* PLASC Bit Fields */
-#define MCM_PLASC_ASC_MASK                       0xFFu
-#define MCM_PLASC_ASC_SHIFT                      0
-#define MCM_PLASC_ASC(x)                         (((uint16_t)(((uint16_t)(x))<<MCM_PLASC_ASC_SHIFT))&MCM_PLASC_ASC_MASK)
-/* PLAMC Bit Fields */
-#define MCM_PLAMC_AMC_MASK                       0xFFu
-#define MCM_PLAMC_AMC_SHIFT                      0
-#define MCM_PLAMC_AMC(x)                         (((uint16_t)(((uint16_t)(x))<<MCM_PLAMC_AMC_SHIFT))&MCM_PLAMC_AMC_MASK)
-/* PLACR Bit Fields */
-#define MCM_PLACR_ARB_MASK                       0x200u
-#define MCM_PLACR_ARB_SHIFT                      9
-#define MCM_PLACR_CFCC_MASK                      0x400u
-#define MCM_PLACR_CFCC_SHIFT                     10
-#define MCM_PLACR_DFCDA_MASK                     0x800u
-#define MCM_PLACR_DFCDA_SHIFT                    11
-#define MCM_PLACR_DFCIC_MASK                     0x1000u
-#define MCM_PLACR_DFCIC_SHIFT                    12
-#define MCM_PLACR_DFCC_MASK                      0x2000u
-#define MCM_PLACR_DFCC_SHIFT                     13
-#define MCM_PLACR_EFDS_MASK                      0x4000u
-#define MCM_PLACR_EFDS_SHIFT                     14
-#define MCM_PLACR_DFCS_MASK                      0x8000u
-#define MCM_PLACR_DFCS_SHIFT                     15
-#define MCM_PLACR_ESFC_MASK                      0x10000u
-#define MCM_PLACR_ESFC_SHIFT                     16
-/* CPO Bit Fields */
-#define MCM_CPO_CPOREQ_MASK                      0x1u
-#define MCM_CPO_CPOREQ_SHIFT                     0
-#define MCM_CPO_CPOACK_MASK                      0x2u
-#define MCM_CPO_CPOACK_SHIFT                     1
-#define MCM_CPO_CPOWOI_MASK                      0x4u
-#define MCM_CPO_CPOWOI_SHIFT                     2
-
-/**
- * @}
- */ /* end of group MCM_Register_Masks */
-
-
-/* MCM - Peripheral instance base addresses */
-/** Peripheral MCM base address */
-#define MCM_BASE                                 (0xF0003000u)
-/** Peripheral MCM base pointer */
-#define MCM                                      ((MCM_Type *)MCM_BASE)
-/** Array initializer of MCM peripheral base pointers */
-#define MCM_BASES                                { MCM }
-
-/**
- * @}
- */ /* end of group MCM_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- MTB Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MTB_Peripheral_Access_Layer MTB Peripheral Access Layer
- * @{
- */
-
-/** MTB - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t POSITION;                          /**< MTB Position Register, offset: 0x0 */
-  __IO uint32_t MASTER;                            /**< MTB Master Register, offset: 0x4 */
-  __IO uint32_t FLOW;                              /**< MTB Flow Register, offset: 0x8 */
-  __I  uint32_t BASE;                              /**< MTB Base Register, offset: 0xC */
-       uint8_t RESERVED_0[3824];
-  __I  uint32_t MODECTRL;                          /**< Integration Mode Control Register, offset: 0xF00 */
-       uint8_t RESERVED_1[156];
-  __I  uint32_t TAGSET;                            /**< Claim TAG Set Register, offset: 0xFA0 */
-  __I  uint32_t TAGCLEAR;                          /**< Claim TAG Clear Register, offset: 0xFA4 */
-       uint8_t RESERVED_2[8];
-  __I  uint32_t LOCKACCESS;                        /**< Lock Access Register, offset: 0xFB0 */
-  __I  uint32_t LOCKSTAT;                          /**< Lock Status Register, offset: 0xFB4 */
-  __I  uint32_t AUTHSTAT;                          /**< Authentication Status Register, offset: 0xFB8 */
-  __I  uint32_t DEVICEARCH;                        /**< Device Architecture Register, offset: 0xFBC */
-       uint8_t RESERVED_3[8];
-  __I  uint32_t DEVICECFG;                         /**< Device Configuration Register, offset: 0xFC8 */
-  __I  uint32_t DEVICETYPID;                       /**< Device Type Identifier Register, offset: 0xFCC */
-  __I  uint32_t PERIPHID[8];                       /**< Peripheral ID Register, array offset: 0xFD0, array step: 0x4 */
-  __I  uint32_t COMPID[4];                         /**< Component ID Register, array offset: 0xFF0, array step: 0x4 */
-} MTB_Type;
-
-/* ----------------------------------------------------------------------------
-   -- MTB Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MTB_Register_Masks MTB Register Masks
- * @{
- */
-
-/* POSITION Bit Fields */
-#define MTB_POSITION_WRAP_MASK                   0x4u
-#define MTB_POSITION_WRAP_SHIFT                  2
-#define MTB_POSITION_POINTER_MASK                0xFFFFFFF8u
-#define MTB_POSITION_POINTER_SHIFT               3
-#define MTB_POSITION_POINTER(x)                  (((uint32_t)(((uint32_t)(x))<<MTB_POSITION_POINTER_SHIFT))&MTB_POSITION_POINTER_MASK)
-/* MASTER Bit Fields */
-#define MTB_MASTER_MASK_MASK                     0x1Fu
-#define MTB_MASTER_MASK_SHIFT                    0
-#define MTB_MASTER_MASK(x)                       (((uint32_t)(((uint32_t)(x))<<MTB_MASTER_MASK_SHIFT))&MTB_MASTER_MASK_MASK)
-#define MTB_MASTER_TSTARTEN_MASK                 0x20u
-#define MTB_MASTER_TSTARTEN_SHIFT                5
-#define MTB_MASTER_TSTOPEN_MASK                  0x40u
-#define MTB_MASTER_TSTOPEN_SHIFT                 6
-#define MTB_MASTER_SFRWPRIV_MASK                 0x80u
-#define MTB_MASTER_SFRWPRIV_SHIFT                7
-#define MTB_MASTER_RAMPRIV_MASK                  0x100u
-#define MTB_MASTER_RAMPRIV_SHIFT                 8
-#define MTB_MASTER_HALTREQ_MASK                  0x200u
-#define MTB_MASTER_HALTREQ_SHIFT                 9
-#define MTB_MASTER_EN_MASK                       0x80000000u
-#define MTB_MASTER_EN_SHIFT                      31
-/* FLOW Bit Fields */
-#define MTB_FLOW_AUTOSTOP_MASK                   0x1u
-#define MTB_FLOW_AUTOSTOP_SHIFT                  0
-#define MTB_FLOW_AUTOHALT_MASK                   0x2u
-#define MTB_FLOW_AUTOHALT_SHIFT                  1
-#define MTB_FLOW_WATERMARK_MASK                  0xFFFFFFF8u
-#define MTB_FLOW_WATERMARK_SHIFT                 3
-#define MTB_FLOW_WATERMARK(x)                    (((uint32_t)(((uint32_t)(x))<<MTB_FLOW_WATERMARK_SHIFT))&MTB_FLOW_WATERMARK_MASK)
-/* BASE Bit Fields */
-#define MTB_BASE_BASEADDR_MASK                   0xFFFFFFFFu
-#define MTB_BASE_BASEADDR_SHIFT                  0
-#define MTB_BASE_BASEADDR(x)                     (((uint32_t)(((uint32_t)(x))<<MTB_BASE_BASEADDR_SHIFT))&MTB_BASE_BASEADDR_MASK)
-/* MODECTRL Bit Fields */
-#define MTB_MODECTRL_MODECTRL_MASK               0xFFFFFFFFu
-#define MTB_MODECTRL_MODECTRL_SHIFT              0
-#define MTB_MODECTRL_MODECTRL(x)                 (((uint32_t)(((uint32_t)(x))<<MTB_MODECTRL_MODECTRL_SHIFT))&MTB_MODECTRL_MODECTRL_MASK)
-/* TAGSET Bit Fields */
-#define MTB_TAGSET_TAGSET_MASK                   0xFFFFFFFFu
-#define MTB_TAGSET_TAGSET_SHIFT                  0
-#define MTB_TAGSET_TAGSET(x)                     (((uint32_t)(((uint32_t)(x))<<MTB_TAGSET_TAGSET_SHIFT))&MTB_TAGSET_TAGSET_MASK)
-/* TAGCLEAR Bit Fields */
-#define MTB_TAGCLEAR_TAGCLEAR_MASK               0xFFFFFFFFu
-#define MTB_TAGCLEAR_TAGCLEAR_SHIFT              0
-#define MTB_TAGCLEAR_TAGCLEAR(x)                 (((uint32_t)(((uint32_t)(x))<<MTB_TAGCLEAR_TAGCLEAR_SHIFT))&MTB_TAGCLEAR_TAGCLEAR_MASK)
-/* LOCKACCESS Bit Fields */
-#define MTB_LOCKACCESS_LOCKACCESS_MASK           0xFFFFFFFFu
-#define MTB_LOCKACCESS_LOCKACCESS_SHIFT          0
-#define MTB_LOCKACCESS_LOCKACCESS(x)             (((uint32_t)(((uint32_t)(x))<<MTB_LOCKACCESS_LOCKACCESS_SHIFT))&MTB_LOCKACCESS_LOCKACCESS_MASK)
-/* LOCKSTAT Bit Fields */
-#define MTB_LOCKSTAT_LOCKSTAT_MASK               0xFFFFFFFFu
-#define MTB_LOCKSTAT_LOCKSTAT_SHIFT              0
-#define MTB_LOCKSTAT_LOCKSTAT(x)                 (((uint32_t)(((uint32_t)(x))<<MTB_LOCKSTAT_LOCKSTAT_SHIFT))&MTB_LOCKSTAT_LOCKSTAT_MASK)
-/* AUTHSTAT Bit Fields */
-#define MTB_AUTHSTAT_BIT0_MASK                   0x1u
-#define MTB_AUTHSTAT_BIT0_SHIFT                  0
-#define MTB_AUTHSTAT_BIT1_MASK                   0x2u
-#define MTB_AUTHSTAT_BIT1_SHIFT                  1
-#define MTB_AUTHSTAT_BIT2_MASK                   0x4u
-#define MTB_AUTHSTAT_BIT2_SHIFT                  2
-#define MTB_AUTHSTAT_BIT3_MASK                   0x8u
-#define MTB_AUTHSTAT_BIT3_SHIFT                  3
-/* DEVICEARCH Bit Fields */
-#define MTB_DEVICEARCH_DEVICEARCH_MASK           0xFFFFFFFFu
-#define MTB_DEVICEARCH_DEVICEARCH_SHIFT          0
-#define MTB_DEVICEARCH_DEVICEARCH(x)             (((uint32_t)(((uint32_t)(x))<<MTB_DEVICEARCH_DEVICEARCH_SHIFT))&MTB_DEVICEARCH_DEVICEARCH_MASK)
-/* DEVICECFG Bit Fields */
-#define MTB_DEVICECFG_DEVICECFG_MASK             0xFFFFFFFFu
-#define MTB_DEVICECFG_DEVICECFG_SHIFT            0
-#define MTB_DEVICECFG_DEVICECFG(x)               (((uint32_t)(((uint32_t)(x))<<MTB_DEVICECFG_DEVICECFG_SHIFT))&MTB_DEVICECFG_DEVICECFG_MASK)
-/* DEVICETYPID Bit Fields */
-#define MTB_DEVICETYPID_DEVICETYPID_MASK         0xFFFFFFFFu
-#define MTB_DEVICETYPID_DEVICETYPID_SHIFT        0
-#define MTB_DEVICETYPID_DEVICETYPID(x)           (((uint32_t)(((uint32_t)(x))<<MTB_DEVICETYPID_DEVICETYPID_SHIFT))&MTB_DEVICETYPID_DEVICETYPID_MASK)
-/* PERIPHID Bit Fields */
-#define MTB_PERIPHID_PERIPHID_MASK               0xFFFFFFFFu
-#define MTB_PERIPHID_PERIPHID_SHIFT              0
-#define MTB_PERIPHID_PERIPHID(x)                 (((uint32_t)(((uint32_t)(x))<<MTB_PERIPHID_PERIPHID_SHIFT))&MTB_PERIPHID_PERIPHID_MASK)
-/* COMPID Bit Fields */
-#define MTB_COMPID_COMPID_MASK                   0xFFFFFFFFu
-#define MTB_COMPID_COMPID_SHIFT                  0
-#define MTB_COMPID_COMPID(x)                     (((uint32_t)(((uint32_t)(x))<<MTB_COMPID_COMPID_SHIFT))&MTB_COMPID_COMPID_MASK)
-
-/**
- * @}
- */ /* end of group MTB_Register_Masks */
-
-
-/* MTB - Peripheral instance base addresses */
-/** Peripheral MTB base address */
-#define MTB_BASE                                 (0xF0000000u)
-/** Peripheral MTB base pointer */
-#define MTB                                      ((MTB_Type *)MTB_BASE)
-/** Array initializer of MTB peripheral base pointers */
-#define MTB_BASES                                { MTB }
-
-/**
- * @}
- */ /* end of group MTB_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- MTBDWT Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MTBDWT_Peripheral_Access_Layer MTBDWT Peripheral Access Layer
- * @{
- */
-
-/** MTBDWT - Register Layout Typedef */
-typedef struct {
-  __I  uint32_t CTRL;                              /**< MTB DWT Control Register, offset: 0x0 */
-       uint8_t RESERVED_0[28];
-  struct {                                         /* offset: 0x20, array step: 0x10 */
-    __IO uint32_t COMP;                              /**< MTB_DWT Comparator Register, array offset: 0x20, array step: 0x10 */
-    __IO uint32_t MASK;                              /**< MTB_DWT Comparator Mask Register, array offset: 0x24, array step: 0x10 */
-    __IO uint32_t FCT;                               /**< MTB_DWT Comparator Function Register 0..MTB_DWT Comparator Function Register 1, array offset: 0x28, array step: 0x10 */
-         uint8_t RESERVED_0[4];
-  } COMPARATOR[2];
-       uint8_t RESERVED_1[448];
-  __IO uint32_t TBCTRL;                            /**< MTB_DWT Trace Buffer Control Register, offset: 0x200 */
-       uint8_t RESERVED_2[3524];
-  __I  uint32_t DEVICECFG;                         /**< Device Configuration Register, offset: 0xFC8 */
-  __I  uint32_t DEVICETYPID;                       /**< Device Type Identifier Register, offset: 0xFCC */
-  __I  uint32_t PERIPHID[8];                       /**< Peripheral ID Register, array offset: 0xFD0, array step: 0x4 */
-  __I  uint32_t COMPID[4];                         /**< Component ID Register, array offset: 0xFF0, array step: 0x4 */
-} MTBDWT_Type;
-
-/* ----------------------------------------------------------------------------
-   -- MTBDWT Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MTBDWT_Register_Masks MTBDWT Register Masks
- * @{
- */
-
-/* CTRL Bit Fields */
-#define MTBDWT_CTRL_DWTCFGCTRL_MASK              0xFFFFFFFu
-#define MTBDWT_CTRL_DWTCFGCTRL_SHIFT             0
-#define MTBDWT_CTRL_DWTCFGCTRL(x)                (((uint32_t)(((uint32_t)(x))<<MTBDWT_CTRL_DWTCFGCTRL_SHIFT))&MTBDWT_CTRL_DWTCFGCTRL_MASK)
-#define MTBDWT_CTRL_NUMCMP_MASK                  0xF0000000u
-#define MTBDWT_CTRL_NUMCMP_SHIFT                 28
-#define MTBDWT_CTRL_NUMCMP(x)                    (((uint32_t)(((uint32_t)(x))<<MTBDWT_CTRL_NUMCMP_SHIFT))&MTBDWT_CTRL_NUMCMP_MASK)
-/* COMP Bit Fields */
-#define MTBDWT_COMP_COMP_MASK                    0xFFFFFFFFu
-#define MTBDWT_COMP_COMP_SHIFT                   0
-#define MTBDWT_COMP_COMP(x)                      (((uint32_t)(((uint32_t)(x))<<MTBDWT_COMP_COMP_SHIFT))&MTBDWT_COMP_COMP_MASK)
-/* MASK Bit Fields */
-#define MTBDWT_MASK_MASK_MASK                    0x1Fu
-#define MTBDWT_MASK_MASK_SHIFT                   0
-#define MTBDWT_MASK_MASK(x)                      (((uint32_t)(((uint32_t)(x))<<MTBDWT_MASK_MASK_SHIFT))&MTBDWT_MASK_MASK_MASK)
-/* FCT Bit Fields */
-#define MTBDWT_FCT_FUNCTION_MASK                 0xFu
-#define MTBDWT_FCT_FUNCTION_SHIFT                0
-#define MTBDWT_FCT_FUNCTION(x)                   (((uint32_t)(((uint32_t)(x))<<MTBDWT_FCT_FUNCTION_SHIFT))&MTBDWT_FCT_FUNCTION_MASK)
-#define MTBDWT_FCT_DATAVMATCH_MASK               0x100u
-#define MTBDWT_FCT_DATAVMATCH_SHIFT              8
-#define MTBDWT_FCT_DATAVSIZE_MASK                0xC00u
-#define MTBDWT_FCT_DATAVSIZE_SHIFT               10
-#define MTBDWT_FCT_DATAVSIZE(x)                  (((uint32_t)(((uint32_t)(x))<<MTBDWT_FCT_DATAVSIZE_SHIFT))&MTBDWT_FCT_DATAVSIZE_MASK)
-#define MTBDWT_FCT_DATAVADDR0_MASK               0xF000u
-#define MTBDWT_FCT_DATAVADDR0_SHIFT              12
-#define MTBDWT_FCT_DATAVADDR0(x)                 (((uint32_t)(((uint32_t)(x))<<MTBDWT_FCT_DATAVADDR0_SHIFT))&MTBDWT_FCT_DATAVADDR0_MASK)
-#define MTBDWT_FCT_MATCHED_MASK                  0x1000000u
-#define MTBDWT_FCT_MATCHED_SHIFT                 24
-/* TBCTRL Bit Fields */
-#define MTBDWT_TBCTRL_ACOMP0_MASK                0x1u
-#define MTBDWT_TBCTRL_ACOMP0_SHIFT               0
-#define MTBDWT_TBCTRL_ACOMP1_MASK                0x2u
-#define MTBDWT_TBCTRL_ACOMP1_SHIFT               1
-#define MTBDWT_TBCTRL_NUMCOMP_MASK               0xF0000000u
-#define MTBDWT_TBCTRL_NUMCOMP_SHIFT              28
-#define MTBDWT_TBCTRL_NUMCOMP(x)                 (((uint32_t)(((uint32_t)(x))<<MTBDWT_TBCTRL_NUMCOMP_SHIFT))&MTBDWT_TBCTRL_NUMCOMP_MASK)
-/* DEVICECFG Bit Fields */
-#define MTBDWT_DEVICECFG_DEVICECFG_MASK          0xFFFFFFFFu
-#define MTBDWT_DEVICECFG_DEVICECFG_SHIFT         0
-#define MTBDWT_DEVICECFG_DEVICECFG(x)            (((uint32_t)(((uint32_t)(x))<<MTBDWT_DEVICECFG_DEVICECFG_SHIFT))&MTBDWT_DEVICECFG_DEVICECFG_MASK)
-/* DEVICETYPID Bit Fields */
-#define MTBDWT_DEVICETYPID_DEVICETYPID_MASK      0xFFFFFFFFu
-#define MTBDWT_DEVICETYPID_DEVICETYPID_SHIFT     0
-#define MTBDWT_DEVICETYPID_DEVICETYPID(x)        (((uint32_t)(((uint32_t)(x))<<MTBDWT_DEVICETYPID_DEVICETYPID_SHIFT))&MTBDWT_DEVICETYPID_DEVICETYPID_MASK)
-/* PERIPHID Bit Fields */
-#define MTBDWT_PERIPHID_PERIPHID_MASK            0xFFFFFFFFu
-#define MTBDWT_PERIPHID_PERIPHID_SHIFT           0
-#define MTBDWT_PERIPHID_PERIPHID(x)              (((uint32_t)(((uint32_t)(x))<<MTBDWT_PERIPHID_PERIPHID_SHIFT))&MTBDWT_PERIPHID_PERIPHID_MASK)
-/* COMPID Bit Fields */
-#define MTBDWT_COMPID_COMPID_MASK                0xFFFFFFFFu
-#define MTBDWT_COMPID_COMPID_SHIFT               0
-#define MTBDWT_COMPID_COMPID(x)                  (((uint32_t)(((uint32_t)(x))<<MTBDWT_COMPID_COMPID_SHIFT))&MTBDWT_COMPID_COMPID_MASK)
-
-/**
- * @}
- */ /* end of group MTBDWT_Register_Masks */
-
-
-/* MTBDWT - Peripheral instance base addresses */
-/** Peripheral MTBDWT base address */
-#define MTBDWT_BASE                              (0xF0001000u)
-/** Peripheral MTBDWT base pointer */
-#define MTBDWT                                   ((MTBDWT_Type *)MTBDWT_BASE)
-/** Array initializer of MTBDWT peripheral base pointers */
-#define MTBDWT_BASES                             { MTBDWT }
-
-/**
- * @}
- */ /* end of group MTBDWT_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- NV Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup NV_Peripheral_Access_Layer NV Peripheral Access Layer
- * @{
- */
-
-/** NV - Register Layout Typedef */
-typedef struct {
-  __I  uint8_t BACKKEY3;                           /**< Backdoor Comparison Key 3., offset: 0x0 */
-  __I  uint8_t BACKKEY2;                           /**< Backdoor Comparison Key 2., offset: 0x1 */
-  __I  uint8_t BACKKEY1;                           /**< Backdoor Comparison Key 1., offset: 0x2 */
-  __I  uint8_t BACKKEY0;                           /**< Backdoor Comparison Key 0., offset: 0x3 */
-  __I  uint8_t BACKKEY7;                           /**< Backdoor Comparison Key 7., offset: 0x4 */
-  __I  uint8_t BACKKEY6;                           /**< Backdoor Comparison Key 6., offset: 0x5 */
-  __I  uint8_t BACKKEY5;                           /**< Backdoor Comparison Key 5., offset: 0x6 */
-  __I  uint8_t BACKKEY4;                           /**< Backdoor Comparison Key 4., offset: 0x7 */
-  __I  uint8_t FPROT3;                             /**< Non-volatile P-Flash Protection 1 - Low Register, offset: 0x8 */
-  __I  uint8_t FPROT2;                             /**< Non-volatile P-Flash Protection 1 - High Register, offset: 0x9 */
-  __I  uint8_t FPROT1;                             /**< Non-volatile P-Flash Protection 0 - Low Register, offset: 0xA */
-  __I  uint8_t FPROT0;                             /**< Non-volatile P-Flash Protection 0 - High Register, offset: 0xB */
-  __I  uint8_t FSEC;                               /**< Non-volatile Flash Security Register, offset: 0xC */
-  __I  uint8_t FOPT;                               /**< Non-volatile Flash Option Register, offset: 0xD */
-} NV_Type;
-
-/* ----------------------------------------------------------------------------
-   -- NV Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup NV_Register_Masks NV Register Masks
- * @{
- */
-
-/* BACKKEY3 Bit Fields */
-#define NV_BACKKEY3_KEY_MASK                     0xFFu
-#define NV_BACKKEY3_KEY_SHIFT                    0
-#define NV_BACKKEY3_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY3_KEY_SHIFT))&NV_BACKKEY3_KEY_MASK)
-/* BACKKEY2 Bit Fields */
-#define NV_BACKKEY2_KEY_MASK                     0xFFu
-#define NV_BACKKEY2_KEY_SHIFT                    0
-#define NV_BACKKEY2_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY2_KEY_SHIFT))&NV_BACKKEY2_KEY_MASK)
-/* BACKKEY1 Bit Fields */
-#define NV_BACKKEY1_KEY_MASK                     0xFFu
-#define NV_BACKKEY1_KEY_SHIFT                    0
-#define NV_BACKKEY1_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY1_KEY_SHIFT))&NV_BACKKEY1_KEY_MASK)
-/* BACKKEY0 Bit Fields */
-#define NV_BACKKEY0_KEY_MASK                     0xFFu
-#define NV_BACKKEY0_KEY_SHIFT                    0
-#define NV_BACKKEY0_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY0_KEY_SHIFT))&NV_BACKKEY0_KEY_MASK)
-/* BACKKEY7 Bit Fields */
-#define NV_BACKKEY7_KEY_MASK                     0xFFu
-#define NV_BACKKEY7_KEY_SHIFT                    0
-#define NV_BACKKEY7_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY7_KEY_SHIFT))&NV_BACKKEY7_KEY_MASK)
-/* BACKKEY6 Bit Fields */
-#define NV_BACKKEY6_KEY_MASK                     0xFFu
-#define NV_BACKKEY6_KEY_SHIFT                    0
-#define NV_BACKKEY6_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY6_KEY_SHIFT))&NV_BACKKEY6_KEY_MASK)
-/* BACKKEY5 Bit Fields */
-#define NV_BACKKEY5_KEY_MASK                     0xFFu
-#define NV_BACKKEY5_KEY_SHIFT                    0
-#define NV_BACKKEY5_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY5_KEY_SHIFT))&NV_BACKKEY5_KEY_MASK)
-/* BACKKEY4 Bit Fields */
-#define NV_BACKKEY4_KEY_MASK                     0xFFu
-#define NV_BACKKEY4_KEY_SHIFT                    0
-#define NV_BACKKEY4_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY4_KEY_SHIFT))&NV_BACKKEY4_KEY_MASK)
-/* FPROT3 Bit Fields */
-#define NV_FPROT3_PROT_MASK                      0xFFu
-#define NV_FPROT3_PROT_SHIFT                     0
-#define NV_FPROT3_PROT(x)                        (((uint8_t)(((uint8_t)(x))<<NV_FPROT3_PROT_SHIFT))&NV_FPROT3_PROT_MASK)
-/* FPROT2 Bit Fields */
-#define NV_FPROT2_PROT_MASK                      0xFFu
-#define NV_FPROT2_PROT_SHIFT                     0
-#define NV_FPROT2_PROT(x)                        (((uint8_t)(((uint8_t)(x))<<NV_FPROT2_PROT_SHIFT))&NV_FPROT2_PROT_MASK)
-/* FPROT1 Bit Fields */
-#define NV_FPROT1_PROT_MASK                      0xFFu
-#define NV_FPROT1_PROT_SHIFT                     0
-#define NV_FPROT1_PROT(x)                        (((uint8_t)(((uint8_t)(x))<<NV_FPROT1_PROT_SHIFT))&NV_FPROT1_PROT_MASK)
-/* FPROT0 Bit Fields */
-#define NV_FPROT0_PROT_MASK                      0xFFu
-#define NV_FPROT0_PROT_SHIFT                     0
-#define NV_FPROT0_PROT(x)                        (((uint8_t)(((uint8_t)(x))<<NV_FPROT0_PROT_SHIFT))&NV_FPROT0_PROT_MASK)
-/* FSEC Bit Fields */
-#define NV_FSEC_SEC_MASK                         0x3u
-#define NV_FSEC_SEC_SHIFT                        0
-#define NV_FSEC_SEC(x)                           (((uint8_t)(((uint8_t)(x))<<NV_FSEC_SEC_SHIFT))&NV_FSEC_SEC_MASK)
-#define NV_FSEC_FSLACC_MASK                      0xCu
-#define NV_FSEC_FSLACC_SHIFT                     2
-#define NV_FSEC_FSLACC(x)                        (((uint8_t)(((uint8_t)(x))<<NV_FSEC_FSLACC_SHIFT))&NV_FSEC_FSLACC_MASK)
-#define NV_FSEC_MEEN_MASK                        0x30u
-#define NV_FSEC_MEEN_SHIFT                       4
-#define NV_FSEC_MEEN(x)                          (((uint8_t)(((uint8_t)(x))<<NV_FSEC_MEEN_SHIFT))&NV_FSEC_MEEN_MASK)
-#define NV_FSEC_KEYEN_MASK                       0xC0u
-#define NV_FSEC_KEYEN_SHIFT                      6
-#define NV_FSEC_KEYEN(x)                         (((uint8_t)(((uint8_t)(x))<<NV_FSEC_KEYEN_SHIFT))&NV_FSEC_KEYEN_MASK)
-/* FOPT Bit Fields */
-#define NV_FOPT_LPBOOT0_MASK                     0x1u
-#define NV_FOPT_LPBOOT0_SHIFT                    0
-#define NV_FOPT_NMI_DIS_MASK                     0x4u
-#define NV_FOPT_NMI_DIS_SHIFT                    2
-#define NV_FOPT_RESET_PIN_CFG_MASK               0x8u
-#define NV_FOPT_RESET_PIN_CFG_SHIFT              3
-#define NV_FOPT_LPBOOT1_MASK                     0x10u
-#define NV_FOPT_LPBOOT1_SHIFT                    4
-#define NV_FOPT_FAST_INIT_MASK                   0x20u
-#define NV_FOPT_FAST_INIT_SHIFT                  5
-
-/**
- * @}
- */ /* end of group NV_Register_Masks */
-
-
-/* NV - Peripheral instance base addresses */
-/** Peripheral FTFA_FlashConfig base address */
-#define FTFA_FlashConfig_BASE                    (0x400u)
-/** Peripheral FTFA_FlashConfig base pointer */
-#define FTFA_FlashConfig                         ((NV_Type *)FTFA_FlashConfig_BASE)
-/** Array initializer of NV peripheral base pointers */
-#define NV_BASES                                 { FTFA_FlashConfig }
-
-/**
- * @}
- */ /* end of group NV_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- OSC Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup OSC_Peripheral_Access_Layer OSC Peripheral Access Layer
- * @{
- */
-
-/** OSC - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t CR;                                 /**< OSC Control Register, offset: 0x0 */
-} OSC_Type;
-
-/* ----------------------------------------------------------------------------
-   -- OSC Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup OSC_Register_Masks OSC Register Masks
- * @{
- */
-
-/* CR Bit Fields */
-#define OSC_CR_SC16P_MASK                        0x1u
-#define OSC_CR_SC16P_SHIFT                       0
-#define OSC_CR_SC8P_MASK                         0x2u
-#define OSC_CR_SC8P_SHIFT                        1
-#define OSC_CR_SC4P_MASK                         0x4u
-#define OSC_CR_SC4P_SHIFT                        2
-#define OSC_CR_SC2P_MASK                         0x8u
-#define OSC_CR_SC2P_SHIFT                        3
-#define OSC_CR_EREFSTEN_MASK                     0x20u
-#define OSC_CR_EREFSTEN_SHIFT                    5
-#define OSC_CR_ERCLKEN_MASK                      0x80u
-#define OSC_CR_ERCLKEN_SHIFT                     7
-
-/**
- * @}
- */ /* end of group OSC_Register_Masks */
-
-
-/* OSC - Peripheral instance base addresses */
-/** Peripheral OSC0 base address */
-#define OSC0_BASE                                (0x40065000u)
-/** Peripheral OSC0 base pointer */
-#define OSC0                                     ((OSC_Type *)OSC0_BASE)
-/** Array initializer of OSC peripheral base pointers */
-#define OSC_BASES                                { OSC0 }
-
-/**
- * @}
- */ /* end of group OSC_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- PIT Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup PIT_Peripheral_Access_Layer PIT Peripheral Access Layer
- * @{
- */
-
-/** PIT - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t MCR;                               /**< PIT Module Control Register, offset: 0x0 */
-       uint8_t RESERVED_0[220];
-  __I  uint32_t LTMR64H;                           /**< PIT Upper Lifetime Timer Register, offset: 0xE0 */
-  __I  uint32_t LTMR64L;                           /**< PIT Lower Lifetime Timer Register, offset: 0xE4 */
-       uint8_t RESERVED_1[24];
-  struct {                                         /* offset: 0x100, array step: 0x10 */
-    __IO uint32_t LDVAL;                             /**< Timer Load Value Register, array offset: 0x100, array step: 0x10 */
-    __I  uint32_t CVAL;                              /**< Current Timer Value Register, array offset: 0x104, array step: 0x10 */
-    __IO uint32_t TCTRL;                             /**< Timer Control Register, array offset: 0x108, array step: 0x10 */
-    __IO uint32_t TFLG;                              /**< Timer Flag Register, array offset: 0x10C, array step: 0x10 */
-  } CHANNEL[2];
-} PIT_Type;
-
-/* ----------------------------------------------------------------------------
-   -- PIT Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup PIT_Register_Masks PIT Register Masks
- * @{
- */
-
-/* MCR Bit Fields */
-#define PIT_MCR_FRZ_MASK                         0x1u
-#define PIT_MCR_FRZ_SHIFT                        0
-#define PIT_MCR_MDIS_MASK                        0x2u
-#define PIT_MCR_MDIS_SHIFT                       1
-/* LTMR64H Bit Fields */
-#define PIT_LTMR64H_LTH_MASK                     0xFFFFFFFFu
-#define PIT_LTMR64H_LTH_SHIFT                    0
-#define PIT_LTMR64H_LTH(x)                       (((uint32_t)(((uint32_t)(x))<<PIT_LTMR64H_LTH_SHIFT))&PIT_LTMR64H_LTH_MASK)
-/* LTMR64L Bit Fields */
-#define PIT_LTMR64L_LTL_MASK                     0xFFFFFFFFu
-#define PIT_LTMR64L_LTL_SHIFT                    0
-#define PIT_LTMR64L_LTL(x)                       (((uint32_t)(((uint32_t)(x))<<PIT_LTMR64L_LTL_SHIFT))&PIT_LTMR64L_LTL_MASK)
-/* LDVAL Bit Fields */
-#define PIT_LDVAL_TSV_MASK                       0xFFFFFFFFu
-#define PIT_LDVAL_TSV_SHIFT                      0
-#define PIT_LDVAL_TSV(x)                         (((uint32_t)(((uint32_t)(x))<<PIT_LDVAL_TSV_SHIFT))&PIT_LDVAL_TSV_MASK)
-/* CVAL Bit Fields */
-#define PIT_CVAL_TVL_MASK                        0xFFFFFFFFu
-#define PIT_CVAL_TVL_SHIFT                       0
-#define PIT_CVAL_TVL(x)                          (((uint32_t)(((uint32_t)(x))<<PIT_CVAL_TVL_SHIFT))&PIT_CVAL_TVL_MASK)
-/* TCTRL Bit Fields */
-#define PIT_TCTRL_TEN_MASK                       0x1u
-#define PIT_TCTRL_TEN_SHIFT                      0
-#define PIT_TCTRL_TIE_MASK                       0x2u
-#define PIT_TCTRL_TIE_SHIFT                      1
-#define PIT_TCTRL_CHN_MASK                       0x4u
-#define PIT_TCTRL_CHN_SHIFT                      2
-/* TFLG Bit Fields */
-#define PIT_TFLG_TIF_MASK                        0x1u
-#define PIT_TFLG_TIF_SHIFT                       0
-
-/**
- * @}
- */ /* end of group PIT_Register_Masks */
-
-
-/* PIT - Peripheral instance base addresses */
-/** Peripheral PIT base address */
-#define PIT_BASE                                 (0x40037000u)
-/** Peripheral PIT base pointer */
-#define PIT                                      ((PIT_Type *)PIT_BASE)
-/** Array initializer of PIT peripheral base pointers */
-#define PIT_BASES                                { PIT }
-
-/**
- * @}
- */ /* end of group PIT_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- PMC Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup PMC_Peripheral_Access_Layer PMC Peripheral Access Layer
- * @{
- */
-
-/** PMC - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t LVDSC1;                             /**< Low Voltage Detect Status And Control 1 register, offset: 0x0 */
-  __IO uint8_t LVDSC2;                             /**< Low Voltage Detect Status And Control 2 register, offset: 0x1 */
-  __IO uint8_t REGSC;                              /**< Regulator Status And Control register, offset: 0x2 */
-} PMC_Type;
-
-/* ----------------------------------------------------------------------------
-   -- PMC Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup PMC_Register_Masks PMC Register Masks
- * @{
- */
-
-/* LVDSC1 Bit Fields */
-#define PMC_LVDSC1_LVDV_MASK                     0x3u
-#define PMC_LVDSC1_LVDV_SHIFT                    0
-#define PMC_LVDSC1_LVDV(x)                       (((uint8_t)(((uint8_t)(x))<<PMC_LVDSC1_LVDV_SHIFT))&PMC_LVDSC1_LVDV_MASK)
-#define PMC_LVDSC1_LVDRE_MASK                    0x10u
-#define PMC_LVDSC1_LVDRE_SHIFT                   4
-#define PMC_LVDSC1_LVDIE_MASK                    0x20u
-#define PMC_LVDSC1_LVDIE_SHIFT                   5
-#define PMC_LVDSC1_LVDACK_MASK                   0x40u
-#define PMC_LVDSC1_LVDACK_SHIFT                  6
-#define PMC_LVDSC1_LVDF_MASK                     0x80u
-#define PMC_LVDSC1_LVDF_SHIFT                    7
-/* LVDSC2 Bit Fields */
-#define PMC_LVDSC2_LVWV_MASK                     0x3u
-#define PMC_LVDSC2_LVWV_SHIFT                    0
-#define PMC_LVDSC2_LVWV(x)                       (((uint8_t)(((uint8_t)(x))<<PMC_LVDSC2_LVWV_SHIFT))&PMC_LVDSC2_LVWV_MASK)
-#define PMC_LVDSC2_LVWIE_MASK                    0x20u
-#define PMC_LVDSC2_LVWIE_SHIFT                   5
-#define PMC_LVDSC2_LVWACK_MASK                   0x40u
-#define PMC_LVDSC2_LVWACK_SHIFT                  6
-#define PMC_LVDSC2_LVWF_MASK                     0x80u
-#define PMC_LVDSC2_LVWF_SHIFT                    7
-/* REGSC Bit Fields */
-#define PMC_REGSC_BGBE_MASK                      0x1u
-#define PMC_REGSC_BGBE_SHIFT                     0
-#define PMC_REGSC_REGONS_MASK                    0x4u
-#define PMC_REGSC_REGONS_SHIFT                   2
-#define PMC_REGSC_ACKISO_MASK                    0x8u
-#define PMC_REGSC_ACKISO_SHIFT                   3
-#define PMC_REGSC_BGEN_MASK                      0x10u
-#define PMC_REGSC_BGEN_SHIFT                     4
-
-/**
- * @}
- */ /* end of group PMC_Register_Masks */
-
-
-/* PMC - Peripheral instance base addresses */
-/** Peripheral PMC base address */
-#define PMC_BASE                                 (0x4007D000u)
-/** Peripheral PMC base pointer */
-#define PMC                                      ((PMC_Type *)PMC_BASE)
-/** Array initializer of PMC peripheral base pointers */
-#define PMC_BASES                                { PMC }
-
-/**
- * @}
- */ /* end of group PMC_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- PORT Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup PORT_Peripheral_Access_Layer PORT Peripheral Access Layer
- * @{
- */
-
-/** PORT - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t PCR[32];                           /**< Pin Control Register n, array offset: 0x0, array step: 0x4 */
-  __O  uint32_t GPCLR;                             /**< Global Pin Control Low Register, offset: 0x80 */
-  __O  uint32_t GPCHR;                             /**< Global Pin Control High Register, offset: 0x84 */
-       uint8_t RESERVED_0[24];
-  __IO uint32_t ISFR;                              /**< Interrupt Status Flag Register, offset: 0xA0 */
-} PORT_Type;
-
-/* ----------------------------------------------------------------------------
-   -- PORT Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup PORT_Register_Masks PORT Register Masks
- * @{
- */
-
-/* PCR Bit Fields */
-#define PORT_PCR_PS_MASK                         0x1u
-#define PORT_PCR_PS_SHIFT                        0
-#define PORT_PCR_PE_MASK                         0x2u
-#define PORT_PCR_PE_SHIFT                        1
-#define PORT_PCR_SRE_MASK                        0x4u
-#define PORT_PCR_SRE_SHIFT                       2
-#define PORT_PCR_PFE_MASK                        0x10u
-#define PORT_PCR_PFE_SHIFT                       4
-#define PORT_PCR_DSE_MASK                        0x40u
-#define PORT_PCR_DSE_SHIFT                       6
-#define PORT_PCR_MUX_MASK                        0x700u
-#define PORT_PCR_MUX_SHIFT                       8
-#define PORT_PCR_MUX(x)                          (((uint32_t)(((uint32_t)(x))<<PORT_PCR_MUX_SHIFT))&PORT_PCR_MUX_MASK)
-#define PORT_PCR_IRQC_MASK                       0xF0000u
-#define PORT_PCR_IRQC_SHIFT                      16
-#define PORT_PCR_IRQC(x)                         (((uint32_t)(((uint32_t)(x))<<PORT_PCR_IRQC_SHIFT))&PORT_PCR_IRQC_MASK)
-#define PORT_PCR_ISF_MASK                        0x1000000u
-#define PORT_PCR_ISF_SHIFT                       24
-/* GPCLR Bit Fields */
-#define PORT_GPCLR_GPWD_MASK                     0xFFFFu
-#define PORT_GPCLR_GPWD_SHIFT                    0
-#define PORT_GPCLR_GPWD(x)                       (((uint32_t)(((uint32_t)(x))<<PORT_GPCLR_GPWD_SHIFT))&PORT_GPCLR_GPWD_MASK)
-#define PORT_GPCLR_GPWE_MASK                     0xFFFF0000u
-#define PORT_GPCLR_GPWE_SHIFT                    16
-#define PORT_GPCLR_GPWE(x)                       (((uint32_t)(((uint32_t)(x))<<PORT_GPCLR_GPWE_SHIFT))&PORT_GPCLR_GPWE_MASK)
-/* GPCHR Bit Fields */
-#define PORT_GPCHR_GPWD_MASK                     0xFFFFu
-#define PORT_GPCHR_GPWD_SHIFT                    0
-#define PORT_GPCHR_GPWD(x)                       (((uint32_t)(((uint32_t)(x))<<PORT_GPCHR_GPWD_SHIFT))&PORT_GPCHR_GPWD_MASK)
-#define PORT_GPCHR_GPWE_MASK                     0xFFFF0000u
-#define PORT_GPCHR_GPWE_SHIFT                    16
-#define PORT_GPCHR_GPWE(x)                       (((uint32_t)(((uint32_t)(x))<<PORT_GPCHR_GPWE_SHIFT))&PORT_GPCHR_GPWE_MASK)
-/* ISFR Bit Fields */
-#define PORT_ISFR_ISF_MASK                       0xFFFFFFFFu
-#define PORT_ISFR_ISF_SHIFT                      0
-#define PORT_ISFR_ISF(x)                         (((uint32_t)(((uint32_t)(x))<<PORT_ISFR_ISF_SHIFT))&PORT_ISFR_ISF_MASK)
-
-/**
- * @}
- */ /* end of group PORT_Register_Masks */
-
-
-/* PORT - Peripheral instance base addresses */
-/** Peripheral PORTA base address */
-#define PORTA_BASE                               (0x40049000u)
-/** Peripheral PORTA base pointer */
-#define PORTA                                    ((PORT_Type *)PORTA_BASE)
-/** Peripheral PORTB base address */
-#define PORTB_BASE                               (0x4004A000u)
-/** Peripheral PORTB base pointer */
-#define PORTB                                    ((PORT_Type *)PORTB_BASE)
-/** Peripheral PORTC base address */
-#define PORTC_BASE                               (0x4004B000u)
-/** Peripheral PORTC base pointer */
-#define PORTC                                    ((PORT_Type *)PORTC_BASE)
-/** Peripheral PORTD base address */
-#define PORTD_BASE                               (0x4004C000u)
-/** Peripheral PORTD base pointer */
-#define PORTD                                    ((PORT_Type *)PORTD_BASE)
-/** Peripheral PORTE base address */
-#define PORTE_BASE                               (0x4004D000u)
-/** Peripheral PORTE base pointer */
-#define PORTE                                    ((PORT_Type *)PORTE_BASE)
-/** Array initializer of PORT peripheral base pointers */
-#define PORT_BASES                               { PORTA, PORTB, PORTC, PORTD, PORTE }
-
-/**
- * @}
- */ /* end of group PORT_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- RCM Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup RCM_Peripheral_Access_Layer RCM Peripheral Access Layer
- * @{
- */
-
-/** RCM - Register Layout Typedef */
-typedef struct {
-  __I  uint8_t SRS0;                               /**< System Reset Status Register 0, offset: 0x0 */
-  __I  uint8_t SRS1;                               /**< System Reset Status Register 1, offset: 0x1 */
-       uint8_t RESERVED_0[2];
-  __IO uint8_t RPFC;                               /**< Reset Pin Filter Control register, offset: 0x4 */
-  __IO uint8_t RPFW;                               /**< Reset Pin Filter Width register, offset: 0x5 */
-} RCM_Type;
-
-/* ----------------------------------------------------------------------------
-   -- RCM Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup RCM_Register_Masks RCM Register Masks
- * @{
- */
-
-/* SRS0 Bit Fields */
-#define RCM_SRS0_WAKEUP_MASK                     0x1u
-#define RCM_SRS0_WAKEUP_SHIFT                    0
-#define RCM_SRS0_LVD_MASK                        0x2u
-#define RCM_SRS0_LVD_SHIFT                       1
-#define RCM_SRS0_LOC_MASK                        0x4u
-#define RCM_SRS0_LOC_SHIFT                       2
-#define RCM_SRS0_LOL_MASK                        0x8u
-#define RCM_SRS0_LOL_SHIFT                       3
-#define RCM_SRS0_WDOG_MASK                       0x20u
-#define RCM_SRS0_WDOG_SHIFT                      5
-#define RCM_SRS0_PIN_MASK                        0x40u
-#define RCM_SRS0_PIN_SHIFT                       6
-#define RCM_SRS0_POR_MASK                        0x80u
-#define RCM_SRS0_POR_SHIFT                       7
-/* SRS1 Bit Fields */
-#define RCM_SRS1_LOCKUP_MASK                     0x2u
-#define RCM_SRS1_LOCKUP_SHIFT                    1
-#define RCM_SRS1_SW_MASK                         0x4u
-#define RCM_SRS1_SW_SHIFT                        2
-#define RCM_SRS1_MDM_AP_MASK                     0x8u
-#define RCM_SRS1_MDM_AP_SHIFT                    3
-#define RCM_SRS1_SACKERR_MASK                    0x20u
-#define RCM_SRS1_SACKERR_SHIFT                   5
-/* RPFC Bit Fields */
-#define RCM_RPFC_RSTFLTSRW_MASK                  0x3u
-#define RCM_RPFC_RSTFLTSRW_SHIFT                 0
-#define RCM_RPFC_RSTFLTSRW(x)                    (((uint8_t)(((uint8_t)(x))<<RCM_RPFC_RSTFLTSRW_SHIFT))&RCM_RPFC_RSTFLTSRW_MASK)
-#define RCM_RPFC_RSTFLTSS_MASK                   0x4u
-#define RCM_RPFC_RSTFLTSS_SHIFT                  2
-/* RPFW Bit Fields */
-#define RCM_RPFW_RSTFLTSEL_MASK                  0x1Fu
-#define RCM_RPFW_RSTFLTSEL_SHIFT                 0
-#define RCM_RPFW_RSTFLTSEL(x)                    (((uint8_t)(((uint8_t)(x))<<RCM_RPFW_RSTFLTSEL_SHIFT))&RCM_RPFW_RSTFLTSEL_MASK)
-
-/**
- * @}
- */ /* end of group RCM_Register_Masks */
-
-
-/* RCM - Peripheral instance base addresses */
-/** Peripheral RCM base address */
-#define RCM_BASE                                 (0x4007F000u)
-/** Peripheral RCM base pointer */
-#define RCM                                      ((RCM_Type *)RCM_BASE)
-/** Array initializer of RCM peripheral base pointers */
-#define RCM_BASES                                { RCM }
-
-/**
- * @}
- */ /* end of group RCM_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- ROM Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup ROM_Peripheral_Access_Layer ROM Peripheral Access Layer
- * @{
- */
-
-/** ROM - Register Layout Typedef */
-typedef struct {
-  __I  uint32_t ENTRY[3];                          /**< Entry, array offset: 0x0, array step: 0x4 */
-  __I  uint32_t TABLEMARK;                         /**< End of Table Marker Register, offset: 0xC */
-       uint8_t RESERVED_0[4028];
-  __I  uint32_t SYSACCESS;                         /**< System Access Register, offset: 0xFCC */
-  __I  uint32_t PERIPHID4;                         /**< Peripheral ID Register, offset: 0xFD0 */
-  __I  uint32_t PERIPHID5;                         /**< Peripheral ID Register, offset: 0xFD4 */
-  __I  uint32_t PERIPHID6;                         /**< Peripheral ID Register, offset: 0xFD8 */
-  __I  uint32_t PERIPHID7;                         /**< Peripheral ID Register, offset: 0xFDC */
-  __I  uint32_t PERIPHID0;                         /**< Peripheral ID Register, offset: 0xFE0 */
-  __I  uint32_t PERIPHID1;                         /**< Peripheral ID Register, offset: 0xFE4 */
-  __I  uint32_t PERIPHID2;                         /**< Peripheral ID Register, offset: 0xFE8 */
-  __I  uint32_t PERIPHID3;                         /**< Peripheral ID Register, offset: 0xFEC */
-  __I  uint32_t COMPID[4];                         /**< Component ID Register, array offset: 0xFF0, array step: 0x4 */
-} ROM_Type;
-
-/* ----------------------------------------------------------------------------
-   -- ROM Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup ROM_Register_Masks ROM Register Masks
- * @{
- */
-
-/* ENTRY Bit Fields */
-#define ROM_ENTRY_ENTRY_MASK                     0xFFFFFFFFu
-#define ROM_ENTRY_ENTRY_SHIFT                    0
-#define ROM_ENTRY_ENTRY(x)                       (((uint32_t)(((uint32_t)(x))<<ROM_ENTRY_ENTRY_SHIFT))&ROM_ENTRY_ENTRY_MASK)
-/* TABLEMARK Bit Fields */
-#define ROM_TABLEMARK_MARK_MASK                  0xFFFFFFFFu
-#define ROM_TABLEMARK_MARK_SHIFT                 0
-#define ROM_TABLEMARK_MARK(x)                    (((uint32_t)(((uint32_t)(x))<<ROM_TABLEMARK_MARK_SHIFT))&ROM_TABLEMARK_MARK_MASK)
-/* SYSACCESS Bit Fields */
-#define ROM_SYSACCESS_SYSACCESS_MASK             0xFFFFFFFFu
-#define ROM_SYSACCESS_SYSACCESS_SHIFT            0
-#define ROM_SYSACCESS_SYSACCESS(x)               (((uint32_t)(((uint32_t)(x))<<ROM_SYSACCESS_SYSACCESS_SHIFT))&ROM_SYSACCESS_SYSACCESS_MASK)
-/* PERIPHID4 Bit Fields */
-#define ROM_PERIPHID4_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID4_PERIPHID_SHIFT             0
-#define ROM_PERIPHID4_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID4_PERIPHID_SHIFT))&ROM_PERIPHID4_PERIPHID_MASK)
-/* PERIPHID5 Bit Fields */
-#define ROM_PERIPHID5_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID5_PERIPHID_SHIFT             0
-#define ROM_PERIPHID5_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID5_PERIPHID_SHIFT))&ROM_PERIPHID5_PERIPHID_MASK)
-/* PERIPHID6 Bit Fields */
-#define ROM_PERIPHID6_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID6_PERIPHID_SHIFT             0
-#define ROM_PERIPHID6_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID6_PERIPHID_SHIFT))&ROM_PERIPHID6_PERIPHID_MASK)
-/* PERIPHID7 Bit Fields */
-#define ROM_PERIPHID7_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID7_PERIPHID_SHIFT             0
-#define ROM_PERIPHID7_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID7_PERIPHID_SHIFT))&ROM_PERIPHID7_PERIPHID_MASK)
-/* PERIPHID0 Bit Fields */
-#define ROM_PERIPHID0_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID0_PERIPHID_SHIFT             0
-#define ROM_PERIPHID0_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID0_PERIPHID_SHIFT))&ROM_PERIPHID0_PERIPHID_MASK)
-/* PERIPHID1 Bit Fields */
-#define ROM_PERIPHID1_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID1_PERIPHID_SHIFT             0
-#define ROM_PERIPHID1_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID1_PERIPHID_SHIFT))&ROM_PERIPHID1_PERIPHID_MASK)
-/* PERIPHID2 Bit Fields */
-#define ROM_PERIPHID2_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID2_PERIPHID_SHIFT             0
-#define ROM_PERIPHID2_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID2_PERIPHID_SHIFT))&ROM_PERIPHID2_PERIPHID_MASK)
-/* PERIPHID3 Bit Fields */
-#define ROM_PERIPHID3_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID3_PERIPHID_SHIFT             0
-#define ROM_PERIPHID3_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID3_PERIPHID_SHIFT))&ROM_PERIPHID3_PERIPHID_MASK)
-/* COMPID Bit Fields */
-#define ROM_COMPID_COMPID_MASK                   0xFFFFFFFFu
-#define ROM_COMPID_COMPID_SHIFT                  0
-#define ROM_COMPID_COMPID(x)                     (((uint32_t)(((uint32_t)(x))<<ROM_COMPID_COMPID_SHIFT))&ROM_COMPID_COMPID_MASK)
-
-/**
- * @}
- */ /* end of group ROM_Register_Masks */
-
-
-/* ROM - Peripheral instance base addresses */
-/** Peripheral ROM base address */
-#define ROM_BASE                                 (0xF0002000u)
-/** Peripheral ROM base pointer */
-#define ROM                                      ((ROM_Type *)ROM_BASE)
-/** Array initializer of ROM peripheral base pointers */
-#define ROM_BASES                                { ROM }
-
-/**
- * @}
- */ /* end of group ROM_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- RTC Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup RTC_Peripheral_Access_Layer RTC Peripheral Access Layer
- * @{
- */
-
-/** RTC - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t TSR;                               /**< RTC Time Seconds Register, offset: 0x0 */
-  __IO uint32_t TPR;                               /**< RTC Time Prescaler Register, offset: 0x4 */
-  __IO uint32_t TAR;                               /**< RTC Time Alarm Register, offset: 0x8 */
-  __IO uint32_t TCR;                               /**< RTC Time Compensation Register, offset: 0xC */
-  __IO uint32_t CR;                                /**< RTC Control Register, offset: 0x10 */
-  __IO uint32_t SR;                                /**< RTC Status Register, offset: 0x14 */
-  __IO uint32_t LR;                                /**< RTC Lock Register, offset: 0x18 */
-  __IO uint32_t IER;                               /**< RTC Interrupt Enable Register, offset: 0x1C */
-} RTC_Type;
-
-/* ----------------------------------------------------------------------------
-   -- RTC Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup RTC_Register_Masks RTC Register Masks
- * @{
- */
-
-/* TSR Bit Fields */
-#define RTC_TSR_TSR_MASK                         0xFFFFFFFFu
-#define RTC_TSR_TSR_SHIFT                        0
-#define RTC_TSR_TSR(x)                           (((uint32_t)(((uint32_t)(x))<<RTC_TSR_TSR_SHIFT))&RTC_TSR_TSR_MASK)
-/* TPR Bit Fields */
-#define RTC_TPR_TPR_MASK                         0xFFFFu
-#define RTC_TPR_TPR_SHIFT                        0
-#define RTC_TPR_TPR(x)                           (((uint32_t)(((uint32_t)(x))<<RTC_TPR_TPR_SHIFT))&RTC_TPR_TPR_MASK)
-/* TAR Bit Fields */
-#define RTC_TAR_TAR_MASK                         0xFFFFFFFFu
-#define RTC_TAR_TAR_SHIFT                        0
-#define RTC_TAR_TAR(x)                           (((uint32_t)(((uint32_t)(x))<<RTC_TAR_TAR_SHIFT))&RTC_TAR_TAR_MASK)
-/* TCR Bit Fields */
-#define RTC_TCR_TCR_MASK                         0xFFu
-#define RTC_TCR_TCR_SHIFT                        0
-#define RTC_TCR_TCR(x)                           (((uint32_t)(((uint32_t)(x))<<RTC_TCR_TCR_SHIFT))&RTC_TCR_TCR_MASK)
-#define RTC_TCR_CIR_MASK                         0xFF00u
-#define RTC_TCR_CIR_SHIFT                        8
-#define RTC_TCR_CIR(x)                           (((uint32_t)(((uint32_t)(x))<<RTC_TCR_CIR_SHIFT))&RTC_TCR_CIR_MASK)
-#define RTC_TCR_TCV_MASK                         0xFF0000u
-#define RTC_TCR_TCV_SHIFT                        16
-#define RTC_TCR_TCV(x)                           (((uint32_t)(((uint32_t)(x))<<RTC_TCR_TCV_SHIFT))&RTC_TCR_TCV_MASK)
-#define RTC_TCR_CIC_MASK                         0xFF000000u
-#define RTC_TCR_CIC_SHIFT                        24
-#define RTC_TCR_CIC(x)                           (((uint32_t)(((uint32_t)(x))<<RTC_TCR_CIC_SHIFT))&RTC_TCR_CIC_MASK)
-/* CR Bit Fields */
-#define RTC_CR_SWR_MASK                          0x1u
-#define RTC_CR_SWR_SHIFT                         0
-#define RTC_CR_WPE_MASK                          0x2u
-#define RTC_CR_WPE_SHIFT                         1
-#define RTC_CR_SUP_MASK                          0x4u
-#define RTC_CR_SUP_SHIFT                         2
-#define RTC_CR_UM_MASK                           0x8u
-#define RTC_CR_UM_SHIFT                          3
-#define RTC_CR_OSCE_MASK                         0x100u
-#define RTC_CR_OSCE_SHIFT                        8
-#define RTC_CR_CLKO_MASK                         0x200u
-#define RTC_CR_CLKO_SHIFT                        9
-#define RTC_CR_SC16P_MASK                        0x400u
-#define RTC_CR_SC16P_SHIFT                       10
-#define RTC_CR_SC8P_MASK                         0x800u
-#define RTC_CR_SC8P_SHIFT                        11
-#define RTC_CR_SC4P_MASK                         0x1000u
-#define RTC_CR_SC4P_SHIFT                        12
-#define RTC_CR_SC2P_MASK                         0x2000u
-#define RTC_CR_SC2P_SHIFT                        13
-/* SR Bit Fields */
-#define RTC_SR_TIF_MASK                          0x1u
-#define RTC_SR_TIF_SHIFT                         0
-#define RTC_SR_TOF_MASK                          0x2u
-#define RTC_SR_TOF_SHIFT                         1
-#define RTC_SR_TAF_MASK                          0x4u
-#define RTC_SR_TAF_SHIFT                         2
-#define RTC_SR_TCE_MASK                          0x10u
-#define RTC_SR_TCE_SHIFT                         4
-/* LR Bit Fields */
-#define RTC_LR_TCL_MASK                          0x8u
-#define RTC_LR_TCL_SHIFT                         3
-#define RTC_LR_CRL_MASK                          0x10u
-#define RTC_LR_CRL_SHIFT                         4
-#define RTC_LR_SRL_MASK                          0x20u
-#define RTC_LR_SRL_SHIFT                         5
-#define RTC_LR_LRL_MASK                          0x40u
-#define RTC_LR_LRL_SHIFT                         6
-/* IER Bit Fields */
-#define RTC_IER_TIIE_MASK                        0x1u
-#define RTC_IER_TIIE_SHIFT                       0
-#define RTC_IER_TOIE_MASK                        0x2u
-#define RTC_IER_TOIE_SHIFT                       1
-#define RTC_IER_TAIE_MASK                        0x4u
-#define RTC_IER_TAIE_SHIFT                       2
-#define RTC_IER_TSIE_MASK                        0x10u
-#define RTC_IER_TSIE_SHIFT                       4
-#define RTC_IER_WPON_MASK                        0x80u
-#define RTC_IER_WPON_SHIFT                       7
-
-/**
- * @}
- */ /* end of group RTC_Register_Masks */
-
-
-/* RTC - Peripheral instance base addresses */
-/** Peripheral RTC base address */
-#define RTC_BASE                                 (0x4003D000u)
-/** Peripheral RTC base pointer */
-#define RTC                                      ((RTC_Type *)RTC_BASE)
-/** Array initializer of RTC peripheral base pointers */
-#define RTC_BASES                                { RTC }
-
-/**
- * @}
- */ /* end of group RTC_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- SIM Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup SIM_Peripheral_Access_Layer SIM Peripheral Access Layer
- * @{
- */
-
-/** SIM - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t SOPT1;                             /**< System Options Register 1, offset: 0x0 */
-  __IO uint32_t SOPT1CFG;                          /**< SOPT1 Configuration Register, offset: 0x4 */
-       uint8_t RESERVED_0[4092];
-  __IO uint32_t SOPT2;                             /**< System Options Register 2, offset: 0x1004 */
-       uint8_t RESERVED_1[4];
-  __IO uint32_t SOPT4;                             /**< System Options Register 4, offset: 0x100C */
-  __IO uint32_t SOPT5;                             /**< System Options Register 5, offset: 0x1010 */
-       uint8_t RESERVED_2[4];
-  __IO uint32_t SOPT7;                             /**< System Options Register 7, offset: 0x1018 */
-       uint8_t RESERVED_3[8];
-  __I  uint32_t SDID;                              /**< System Device Identification Register, offset: 0x1024 */
-       uint8_t RESERVED_4[12];
-  __IO uint32_t SCGC4;                             /**< System Clock Gating Control Register 4, offset: 0x1034 */
-  __IO uint32_t SCGC5;                             /**< System Clock Gating Control Register 5, offset: 0x1038 */
-  __IO uint32_t SCGC6;                             /**< System Clock Gating Control Register 6, offset: 0x103C */
-  __IO uint32_t SCGC7;                             /**< System Clock Gating Control Register 7, offset: 0x1040 */
-  __IO uint32_t CLKDIV1;                           /**< System Clock Divider Register 1, offset: 0x1044 */
-       uint8_t RESERVED_5[4];
-  __IO uint32_t FCFG1;                             /**< Flash Configuration Register 1, offset: 0x104C */
-  __I  uint32_t FCFG2;                             /**< Flash Configuration Register 2, offset: 0x1050 */
-       uint8_t RESERVED_6[4];
-  __I  uint32_t UIDMH;                             /**< Unique Identification Register Mid-High, offset: 0x1058 */
-  __I  uint32_t UIDML;                             /**< Unique Identification Register Mid Low, offset: 0x105C */
-  __I  uint32_t UIDL;                              /**< Unique Identification Register Low, offset: 0x1060 */
-       uint8_t RESERVED_7[156];
-  __IO uint32_t COPC;                              /**< COP Control Register, offset: 0x1100 */
-  __O  uint32_t SRVCOP;                            /**< Service COP Register, offset: 0x1104 */
-} SIM_Type;
-
-/* ----------------------------------------------------------------------------
-   -- SIM Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup SIM_Register_Masks SIM Register Masks
- * @{
- */
-
-/* SOPT1 Bit Fields */
-#define SIM_SOPT1_OSC32KSEL_MASK                 0xC0000u
-#define SIM_SOPT1_OSC32KSEL_SHIFT                18
-#define SIM_SOPT1_OSC32KSEL(x)                   (((uint32_t)(((uint32_t)(x))<<SIM_SOPT1_OSC32KSEL_SHIFT))&SIM_SOPT1_OSC32KSEL_MASK)
-#define SIM_SOPT1_USBVSTBY_MASK                  0x20000000u
-#define SIM_SOPT1_USBVSTBY_SHIFT                 29
-#define SIM_SOPT1_USBSSTBY_MASK                  0x40000000u
-#define SIM_SOPT1_USBSSTBY_SHIFT                 30
-#define SIM_SOPT1_USBREGEN_MASK                  0x80000000u
-#define SIM_SOPT1_USBREGEN_SHIFT                 31
-/* SOPT1CFG Bit Fields */
-#define SIM_SOPT1CFG_URWE_MASK                   0x1000000u
-#define SIM_SOPT1CFG_URWE_SHIFT                  24
-#define SIM_SOPT1CFG_UVSWE_MASK                  0x2000000u
-#define SIM_SOPT1CFG_UVSWE_SHIFT                 25
-#define SIM_SOPT1CFG_USSWE_MASK                  0x4000000u
-#define SIM_SOPT1CFG_USSWE_SHIFT                 26
-/* SOPT2 Bit Fields */
-#define SIM_SOPT2_RTCCLKOUTSEL_MASK              0x10u
-#define SIM_SOPT2_RTCCLKOUTSEL_SHIFT             4
-#define SIM_SOPT2_CLKOUTSEL_MASK                 0xE0u
-#define SIM_SOPT2_CLKOUTSEL_SHIFT                5
-#define SIM_SOPT2_CLKOUTSEL(x)                   (((uint32_t)(((uint32_t)(x))<<SIM_SOPT2_CLKOUTSEL_SHIFT))&SIM_SOPT2_CLKOUTSEL_MASK)
-#define SIM_SOPT2_PLLFLLSEL_MASK                 0x10000u
-#define SIM_SOPT2_PLLFLLSEL_SHIFT                16
-#define SIM_SOPT2_USBSRC_MASK                    0x40000u
-#define SIM_SOPT2_USBSRC_SHIFT                   18
-#define SIM_SOPT2_TPMSRC_MASK                    0x3000000u
-#define SIM_SOPT2_TPMSRC_SHIFT                   24
-#define SIM_SOPT2_TPMSRC(x)                      (((uint32_t)(((uint32_t)(x))<<SIM_SOPT2_TPMSRC_SHIFT))&SIM_SOPT2_TPMSRC_MASK)
-#define SIM_SOPT2_UART0SRC_MASK                  0xC000000u
-#define SIM_SOPT2_UART0SRC_SHIFT                 26
-#define SIM_SOPT2_UART0SRC(x)                    (((uint32_t)(((uint32_t)(x))<<SIM_SOPT2_UART0SRC_SHIFT))&SIM_SOPT2_UART0SRC_MASK)
-/* SOPT4 Bit Fields */
-#define SIM_SOPT4_TPM1CH0SRC_MASK                0x40000u
-#define SIM_SOPT4_TPM1CH0SRC_SHIFT               18
-#define SIM_SOPT4_TPM2CH0SRC_MASK                0x100000u
-#define SIM_SOPT4_TPM2CH0SRC_SHIFT               20
-#define SIM_SOPT4_TPM0CLKSEL_MASK                0x1000000u
-#define SIM_SOPT4_TPM0CLKSEL_SHIFT               24
-#define SIM_SOPT4_TPM1CLKSEL_MASK                0x2000000u
-#define SIM_SOPT4_TPM1CLKSEL_SHIFT               25
-#define SIM_SOPT4_TPM2CLKSEL_MASK                0x4000000u
-#define SIM_SOPT4_TPM2CLKSEL_SHIFT               26
-/* SOPT5 Bit Fields */
-#define SIM_SOPT5_UART0TXSRC_MASK                0x3u
-#define SIM_SOPT5_UART0TXSRC_SHIFT               0
-#define SIM_SOPT5_UART0TXSRC(x)                  (((uint32_t)(((uint32_t)(x))<<SIM_SOPT5_UART0TXSRC_SHIFT))&SIM_SOPT5_UART0TXSRC_MASK)
-#define SIM_SOPT5_UART0RXSRC_MASK                0x4u
-#define SIM_SOPT5_UART0RXSRC_SHIFT               2
-#define SIM_SOPT5_UART1TXSRC_MASK                0x30u
-#define SIM_SOPT5_UART1TXSRC_SHIFT               4
-#define SIM_SOPT5_UART1TXSRC(x)                  (((uint32_t)(((uint32_t)(x))<<SIM_SOPT5_UART1TXSRC_SHIFT))&SIM_SOPT5_UART1TXSRC_MASK)
-#define SIM_SOPT5_UART1RXSRC_MASK                0x40u
-#define SIM_SOPT5_UART1RXSRC_SHIFT               6
-#define SIM_SOPT5_UART0ODE_MASK                  0x10000u
-#define SIM_SOPT5_UART0ODE_SHIFT                 16
-#define SIM_SOPT5_UART1ODE_MASK                  0x20000u
-#define SIM_SOPT5_UART1ODE_SHIFT                 17
-#define SIM_SOPT5_UART2ODE_MASK                  0x40000u
-#define SIM_SOPT5_UART2ODE_SHIFT                 18
-/* SOPT7 Bit Fields */
-#define SIM_SOPT7_ADC0TRGSEL_MASK                0xFu
-#define SIM_SOPT7_ADC0TRGSEL_SHIFT               0
-#define SIM_SOPT7_ADC0TRGSEL(x)                  (((uint32_t)(((uint32_t)(x))<<SIM_SOPT7_ADC0TRGSEL_SHIFT))&SIM_SOPT7_ADC0TRGSEL_MASK)
-#define SIM_SOPT7_ADC0PRETRGSEL_MASK             0x10u
-#define SIM_SOPT7_ADC0PRETRGSEL_SHIFT            4
-#define SIM_SOPT7_ADC0ALTTRGEN_MASK              0x80u
-#define SIM_SOPT7_ADC0ALTTRGEN_SHIFT             7
-/* SDID Bit Fields */
-#define SIM_SDID_PINID_MASK                      0xFu
-#define SIM_SDID_PINID_SHIFT                     0
-#define SIM_SDID_PINID(x)                        (((uint32_t)(((uint32_t)(x))<<SIM_SDID_PINID_SHIFT))&SIM_SDID_PINID_MASK)
-#define SIM_SDID_DIEID_MASK                      0xF80u
-#define SIM_SDID_DIEID_SHIFT                     7
-#define SIM_SDID_DIEID(x)                        (((uint32_t)(((uint32_t)(x))<<SIM_SDID_DIEID_SHIFT))&SIM_SDID_DIEID_MASK)
-#define SIM_SDID_REVID_MASK                      0xF000u
-#define SIM_SDID_REVID_SHIFT                     12
-#define SIM_SDID_REVID(x)                        (((uint32_t)(((uint32_t)(x))<<SIM_SDID_REVID_SHIFT))&SIM_SDID_REVID_MASK)
-#define SIM_SDID_SRAMSIZE_MASK                   0xF0000u
-#define SIM_SDID_SRAMSIZE_SHIFT                  16
-#define SIM_SDID_SRAMSIZE(x)                     (((uint32_t)(((uint32_t)(x))<<SIM_SDID_SRAMSIZE_SHIFT))&SIM_SDID_SRAMSIZE_MASK)
-#define SIM_SDID_SERIESID_MASK                   0xF00000u
-#define SIM_SDID_SERIESID_SHIFT                  20
-#define SIM_SDID_SERIESID(x)                     (((uint32_t)(((uint32_t)(x))<<SIM_SDID_SERIESID_SHIFT))&SIM_SDID_SERIESID_MASK)
-#define SIM_SDID_SUBFAMID_MASK                   0xF000000u
-#define SIM_SDID_SUBFAMID_SHIFT                  24
-#define SIM_SDID_SUBFAMID(x)                     (((uint32_t)(((uint32_t)(x))<<SIM_SDID_SUBFAMID_SHIFT))&SIM_SDID_SUBFAMID_MASK)
-#define SIM_SDID_FAMID_MASK                      0xF0000000u
-#define SIM_SDID_FAMID_SHIFT                     28
-#define SIM_SDID_FAMID(x)                        (((uint32_t)(((uint32_t)(x))<<SIM_SDID_FAMID_SHIFT))&SIM_SDID_FAMID_MASK)
-/* SCGC4 Bit Fields */
-#define SIM_SCGC4_I2C0_MASK                      0x40u
-#define SIM_SCGC4_I2C0_SHIFT                     6
-#define SIM_SCGC4_I2C1_MASK                      0x80u
-#define SIM_SCGC4_I2C1_SHIFT                     7
-#define SIM_SCGC4_UART0_MASK                     0x400u
-#define SIM_SCGC4_UART0_SHIFT                    10
-#define SIM_SCGC4_UART1_MASK                     0x800u
-#define SIM_SCGC4_UART1_SHIFT                    11
-#define SIM_SCGC4_UART2_MASK                     0x1000u
-#define SIM_SCGC4_UART2_SHIFT                    12
-#define SIM_SCGC4_USBOTG_MASK                    0x40000u
-#define SIM_SCGC4_USBOTG_SHIFT                   18
-#define SIM_SCGC4_CMP_MASK                       0x80000u
-#define SIM_SCGC4_CMP_SHIFT                      19
-#define SIM_SCGC4_SPI0_MASK                      0x400000u
-#define SIM_SCGC4_SPI0_SHIFT                     22
-#define SIM_SCGC4_SPI1_MASK                      0x800000u
-#define SIM_SCGC4_SPI1_SHIFT                     23
-/* SCGC5 Bit Fields */
-#define SIM_SCGC5_LPTMR_MASK                     0x1u
-#define SIM_SCGC5_LPTMR_SHIFT                    0
-#define SIM_SCGC5_TSI_MASK                       0x20u
-#define SIM_SCGC5_TSI_SHIFT                      5
-#define SIM_SCGC5_PORTA_MASK                     0x200u
-#define SIM_SCGC5_PORTA_SHIFT                    9
-#define SIM_SCGC5_PORTB_MASK                     0x400u
-#define SIM_SCGC5_PORTB_SHIFT                    10
-#define SIM_SCGC5_PORTC_MASK                     0x800u
-#define SIM_SCGC5_PORTC_SHIFT                    11
-#define SIM_SCGC5_PORTD_MASK                     0x1000u
-#define SIM_SCGC5_PORTD_SHIFT                    12
-#define SIM_SCGC5_PORTE_MASK                     0x2000u
-#define SIM_SCGC5_PORTE_SHIFT                    13
-/* SCGC6 Bit Fields */
-#define SIM_SCGC6_FTF_MASK                       0x1u
-#define SIM_SCGC6_FTF_SHIFT                      0
-#define SIM_SCGC6_DMAMUX_MASK                    0x2u
-#define SIM_SCGC6_DMAMUX_SHIFT                   1
-#define SIM_SCGC6_PIT_MASK                       0x800000u
-#define SIM_SCGC6_PIT_SHIFT                      23
-#define SIM_SCGC6_TPM0_MASK                      0x1000000u
-#define SIM_SCGC6_TPM0_SHIFT                     24
-#define SIM_SCGC6_TPM1_MASK                      0x2000000u
-#define SIM_SCGC6_TPM1_SHIFT                     25
-#define SIM_SCGC6_TPM2_MASK                      0x4000000u
-#define SIM_SCGC6_TPM2_SHIFT                     26
-#define SIM_SCGC6_ADC0_MASK                      0x8000000u
-#define SIM_SCGC6_ADC0_SHIFT                     27
-#define SIM_SCGC6_RTC_MASK                       0x20000000u
-#define SIM_SCGC6_RTC_SHIFT                      29
-#define SIM_SCGC6_DAC0_MASK                      0x80000000u
-#define SIM_SCGC6_DAC0_SHIFT                     31
-/* SCGC7 Bit Fields */
-#define SIM_SCGC7_DMA_MASK                       0x100u
-#define SIM_SCGC7_DMA_SHIFT                      8
-/* CLKDIV1 Bit Fields */
-#define SIM_CLKDIV1_OUTDIV4_MASK                 0x70000u
-#define SIM_CLKDIV1_OUTDIV4_SHIFT                16
-#define SIM_CLKDIV1_OUTDIV4(x)                   (((uint32_t)(((uint32_t)(x))<<SIM_CLKDIV1_OUTDIV4_SHIFT))&SIM_CLKDIV1_OUTDIV4_MASK)
-#define SIM_CLKDIV1_OUTDIV1_MASK                 0xF0000000u
-#define SIM_CLKDIV1_OUTDIV1_SHIFT                28
-#define SIM_CLKDIV1_OUTDIV1(x)                   (((uint32_t)(((uint32_t)(x))<<SIM_CLKDIV1_OUTDIV1_SHIFT))&SIM_CLKDIV1_OUTDIV1_MASK)
-/* FCFG1 Bit Fields */
-#define SIM_FCFG1_FLASHDIS_MASK                  0x1u
-#define SIM_FCFG1_FLASHDIS_SHIFT                 0
-#define SIM_FCFG1_FLASHDOZE_MASK                 0x2u
-#define SIM_FCFG1_FLASHDOZE_SHIFT                1
-#define SIM_FCFG1_PFSIZE_MASK                    0xF000000u
-#define SIM_FCFG1_PFSIZE_SHIFT                   24
-#define SIM_FCFG1_PFSIZE(x)                      (((uint32_t)(((uint32_t)(x))<<SIM_FCFG1_PFSIZE_SHIFT))&SIM_FCFG1_PFSIZE_MASK)
-/* FCFG2 Bit Fields */
-#define SIM_FCFG2_MAXADDR_MASK                   0x7F000000u
-#define SIM_FCFG2_MAXADDR_SHIFT                  24
-#define SIM_FCFG2_MAXADDR(x)                     (((uint32_t)(((uint32_t)(x))<<SIM_FCFG2_MAXADDR_SHIFT))&SIM_FCFG2_MAXADDR_MASK)
-/* UIDMH Bit Fields */
-#define SIM_UIDMH_UID_MASK                       0xFFFFu
-#define SIM_UIDMH_UID_SHIFT                      0
-#define SIM_UIDMH_UID(x)                         (((uint32_t)(((uint32_t)(x))<<SIM_UIDMH_UID_SHIFT))&SIM_UIDMH_UID_MASK)
-/* UIDML Bit Fields */
-#define SIM_UIDML_UID_MASK                       0xFFFFFFFFu
-#define SIM_UIDML_UID_SHIFT                      0
-#define SIM_UIDML_UID(x)                         (((uint32_t)(((uint32_t)(x))<<SIM_UIDML_UID_SHIFT))&SIM_UIDML_UID_MASK)
-/* UIDL Bit Fields */
-#define SIM_UIDL_UID_MASK                        0xFFFFFFFFu
-#define SIM_UIDL_UID_SHIFT                       0
-#define SIM_UIDL_UID(x)                          (((uint32_t)(((uint32_t)(x))<<SIM_UIDL_UID_SHIFT))&SIM_UIDL_UID_MASK)
-/* COPC Bit Fields */
-#define SIM_COPC_COPW_MASK                       0x1u
-#define SIM_COPC_COPW_SHIFT                      0
-#define SIM_COPC_COPCLKS_MASK                    0x2u
-#define SIM_COPC_COPCLKS_SHIFT                   1
-#define SIM_COPC_COPT_MASK                       0xCu
-#define SIM_COPC_COPT_SHIFT                      2
-#define SIM_COPC_COPT(x)                         (((uint32_t)(((uint32_t)(x))<<SIM_COPC_COPT_SHIFT))&SIM_COPC_COPT_MASK)
-/* SRVCOP Bit Fields */
-#define SIM_SRVCOP_SRVCOP_MASK                   0xFFu
-#define SIM_SRVCOP_SRVCOP_SHIFT                  0
-#define SIM_SRVCOP_SRVCOP(x)                     (((uint32_t)(((uint32_t)(x))<<SIM_SRVCOP_SRVCOP_SHIFT))&SIM_SRVCOP_SRVCOP_MASK)
-
-/**
- * @}
- */ /* end of group SIM_Register_Masks */
-
-
-/* SIM - Peripheral instance base addresses */
-/** Peripheral SIM base address */
-#define SIM_BASE                                 (0x40047000u)
-/** Peripheral SIM base pointer */
-#define SIM                                      ((SIM_Type *)SIM_BASE)
-/** Array initializer of SIM peripheral base pointers */
-#define SIM_BASES                                { SIM }
-
-/**
- * @}
- */ /* end of group SIM_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- SMC Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup SMC_Peripheral_Access_Layer SMC Peripheral Access Layer
- * @{
- */
-
-/** SMC - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t PMPROT;                             /**< Power Mode Protection register, offset: 0x0 */
-  __IO uint8_t PMCTRL;                             /**< Power Mode Control register, offset: 0x1 */
-  __IO uint8_t STOPCTRL;                           /**< Stop Control Register, offset: 0x2 */
-  __I  uint8_t PMSTAT;                             /**< Power Mode Status register, offset: 0x3 */
-} SMC_Type;
-
-/* ----------------------------------------------------------------------------
-   -- SMC Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup SMC_Register_Masks SMC Register Masks
- * @{
- */
-
-/* PMPROT Bit Fields */
-#define SMC_PMPROT_AVLLS_MASK                    0x2u
-#define SMC_PMPROT_AVLLS_SHIFT                   1
-#define SMC_PMPROT_ALLS_MASK                     0x8u
-#define SMC_PMPROT_ALLS_SHIFT                    3
-#define SMC_PMPROT_AVLP_MASK                     0x20u
-#define SMC_PMPROT_AVLP_SHIFT                    5
-/* PMCTRL Bit Fields */
-#define SMC_PMCTRL_STOPM_MASK                    0x7u
-#define SMC_PMCTRL_STOPM_SHIFT                   0
-#define SMC_PMCTRL_STOPM(x)                      (((uint8_t)(((uint8_t)(x))<<SMC_PMCTRL_STOPM_SHIFT))&SMC_PMCTRL_STOPM_MASK)
-#define SMC_PMCTRL_STOPA_MASK                    0x8u
-#define SMC_PMCTRL_STOPA_SHIFT                   3
-#define SMC_PMCTRL_RUNM_MASK                     0x60u
-#define SMC_PMCTRL_RUNM_SHIFT                    5
-#define SMC_PMCTRL_RUNM(x)                       (((uint8_t)(((uint8_t)(x))<<SMC_PMCTRL_RUNM_SHIFT))&SMC_PMCTRL_RUNM_MASK)
-/* STOPCTRL Bit Fields */
-#define SMC_STOPCTRL_VLLSM_MASK                  0x7u
-#define SMC_STOPCTRL_VLLSM_SHIFT                 0
-#define SMC_STOPCTRL_VLLSM(x)                    (((uint8_t)(((uint8_t)(x))<<SMC_STOPCTRL_VLLSM_SHIFT))&SMC_STOPCTRL_VLLSM_MASK)
-#define SMC_STOPCTRL_PORPO_MASK                  0x20u
-#define SMC_STOPCTRL_PORPO_SHIFT                 5
-#define SMC_STOPCTRL_PSTOPO_MASK                 0xC0u
-#define SMC_STOPCTRL_PSTOPO_SHIFT                6
-#define SMC_STOPCTRL_PSTOPO(x)                   (((uint8_t)(((uint8_t)(x))<<SMC_STOPCTRL_PSTOPO_SHIFT))&SMC_STOPCTRL_PSTOPO_MASK)
-/* PMSTAT Bit Fields */
-#define SMC_PMSTAT_PMSTAT_MASK                   0x7Fu
-#define SMC_PMSTAT_PMSTAT_SHIFT                  0
-#define SMC_PMSTAT_PMSTAT(x)                     (((uint8_t)(((uint8_t)(x))<<SMC_PMSTAT_PMSTAT_SHIFT))&SMC_PMSTAT_PMSTAT_MASK)
-
-/**
- * @}
- */ /* end of group SMC_Register_Masks */
-
-
-/* SMC - Peripheral instance base addresses */
-/** Peripheral SMC base address */
-#define SMC_BASE                                 (0x4007E000u)
-/** Peripheral SMC base pointer */
-#define SMC                                      ((SMC_Type *)SMC_BASE)
-/** Array initializer of SMC peripheral base pointers */
-#define SMC_BASES                                { SMC }
-
-/**
- * @}
- */ /* end of group SMC_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- SPI Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup SPI_Peripheral_Access_Layer SPI Peripheral Access Layer
- * @{
- */
-
-/** SPI - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t C1;                                 /**< SPI control register 1, offset: 0x0 */
-  __IO uint8_t C2;                                 /**< SPI control register 2, offset: 0x1 */
-  __IO uint8_t BR;                                 /**< SPI baud rate register, offset: 0x2 */
-  __I  uint8_t S;                                  /**< SPI status register, offset: 0x3 */
-       uint8_t RESERVED_0[1];
-  __IO uint8_t D;                                  /**< SPI data register, offset: 0x5 */
-       uint8_t RESERVED_1[1];
-  __IO uint8_t M;                                  /**< SPI match register, offset: 0x7 */
-} SPI_Type;
-
-/* ----------------------------------------------------------------------------
-   -- SPI Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup SPI_Register_Masks SPI Register Masks
- * @{
- */
-
-/* C1 Bit Fields */
-#define SPI_C1_LSBFE_MASK                        0x1u
-#define SPI_C1_LSBFE_SHIFT                       0
-#define SPI_C1_SSOE_MASK                         0x2u
-#define SPI_C1_SSOE_SHIFT                        1
-#define SPI_C1_CPHA_MASK                         0x4u
-#define SPI_C1_CPHA_SHIFT                        2
-#define SPI_C1_CPOL_MASK                         0x8u
-#define SPI_C1_CPOL_SHIFT                        3
-#define SPI_C1_MSTR_MASK                         0x10u
-#define SPI_C1_MSTR_SHIFT                        4
-#define SPI_C1_SPTIE_MASK                        0x20u
-#define SPI_C1_SPTIE_SHIFT                       5
-#define SPI_C1_SPE_MASK                          0x40u
-#define SPI_C1_SPE_SHIFT                         6
-#define SPI_C1_SPIE_MASK                         0x80u
-#define SPI_C1_SPIE_SHIFT                        7
-/* C2 Bit Fields */
-#define SPI_C2_SPC0_MASK                         0x1u
-#define SPI_C2_SPC0_SHIFT                        0
-#define SPI_C2_SPISWAI_MASK                      0x2u
-#define SPI_C2_SPISWAI_SHIFT                     1
-#define SPI_C2_RXDMAE_MASK                       0x4u
-#define SPI_C2_RXDMAE_SHIFT                      2
-#define SPI_C2_BIDIROE_MASK                      0x8u
-#define SPI_C2_BIDIROE_SHIFT                     3
-#define SPI_C2_MODFEN_MASK                       0x10u
-#define SPI_C2_MODFEN_SHIFT                      4
-#define SPI_C2_TXDMAE_MASK                       0x20u
-#define SPI_C2_TXDMAE_SHIFT                      5
-#define SPI_C2_SPLPIE_MASK                       0x40u
-#define SPI_C2_SPLPIE_SHIFT                      6
-#define SPI_C2_SPMIE_MASK                        0x80u
-#define SPI_C2_SPMIE_SHIFT                       7
-/* BR Bit Fields */
-#define SPI_BR_SPR_MASK                          0xFu
-#define SPI_BR_SPR_SHIFT                         0
-#define SPI_BR_SPR(x)                            (((uint8_t)(((uint8_t)(x))<<SPI_BR_SPR_SHIFT))&SPI_BR_SPR_MASK)
-#define SPI_BR_SPPR_MASK                         0x70u
-#define SPI_BR_SPPR_SHIFT                        4
-#define SPI_BR_SPPR(x)                           (((uint8_t)(((uint8_t)(x))<<SPI_BR_SPPR_SHIFT))&SPI_BR_SPPR_MASK)
-/* S Bit Fields */
-#define SPI_S_MODF_MASK                          0x10u
-#define SPI_S_MODF_SHIFT                         4
-#define SPI_S_SPTEF_MASK                         0x20u
-#define SPI_S_SPTEF_SHIFT                        5
-#define SPI_S_SPMF_MASK                          0x40u
-#define SPI_S_SPMF_SHIFT                         6
-#define SPI_S_SPRF_MASK                          0x80u
-#define SPI_S_SPRF_SHIFT                         7
-/* D Bit Fields */
-#define SPI_D_Bits_MASK                          0xFFu
-#define SPI_D_Bits_SHIFT                         0
-#define SPI_D_Bits(x)                            (((uint8_t)(((uint8_t)(x))<<SPI_D_Bits_SHIFT))&SPI_D_Bits_MASK)
-/* M Bit Fields */
-#define SPI_M_Bits_MASK                          0xFFu
-#define SPI_M_Bits_SHIFT                         0
-#define SPI_M_Bits(x)                            (((uint8_t)(((uint8_t)(x))<<SPI_M_Bits_SHIFT))&SPI_M_Bits_MASK)
-
-/**
- * @}
- */ /* end of group SPI_Register_Masks */
-
-
-/* SPI - Peripheral instance base addresses */
-/** Peripheral SPI0 base address */
-#define SPI0_BASE                                (0x40076000u)
-/** Peripheral SPI0 base pointer */
-#define SPI0                                     ((SPI_Type *)SPI0_BASE)
-/** Peripheral SPI1 base address */
-#define SPI1_BASE                                (0x40077000u)
-/** Peripheral SPI1 base pointer */
-#define SPI1                                     ((SPI_Type *)SPI1_BASE)
-/** Array initializer of SPI peripheral base pointers */
-#define SPI_BASES                                { SPI0, SPI1 }
-
-/**
- * @}
- */ /* end of group SPI_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- TPM Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup TPM_Peripheral_Access_Layer TPM Peripheral Access Layer
- * @{
- */
-
-/** TPM - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t SC;                                /**< Status and Control, offset: 0x0 */
-  __IO uint32_t CNT;                               /**< Counter, offset: 0x4 */
-  __IO uint32_t MOD;                               /**< Modulo, offset: 0x8 */
-  struct {                                         /* offset: 0xC, array step: 0x8 */
-    __IO uint32_t CnSC;                              /**< Channel (n) Status and Control, array offset: 0xC, array step: 0x8 */
-    __IO uint32_t CnV;                               /**< Channel (n) Value, array offset: 0x10, array step: 0x8 */
-  } CONTROLS[6];
-       uint8_t RESERVED_0[20];
-  __IO uint32_t STATUS;                            /**< Capture and Compare Status, offset: 0x50 */
-       uint8_t RESERVED_1[48];
-  __IO uint32_t CONF;                              /**< Configuration, offset: 0x84 */
-} TPM_Type;
-
-/* ----------------------------------------------------------------------------
-   -- TPM Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup TPM_Register_Masks TPM Register Masks
- * @{
- */
-
-/* SC Bit Fields */
-#define TPM_SC_PS_MASK                           0x7u
-#define TPM_SC_PS_SHIFT                          0
-#define TPM_SC_PS(x)                             (((uint32_t)(((uint32_t)(x))<<TPM_SC_PS_SHIFT))&TPM_SC_PS_MASK)
-#define TPM_SC_CMOD_MASK                         0x18u
-#define TPM_SC_CMOD_SHIFT                        3
-#define TPM_SC_CMOD(x)                           (((uint32_t)(((uint32_t)(x))<<TPM_SC_CMOD_SHIFT))&TPM_SC_CMOD_MASK)
-#define TPM_SC_CPWMS_MASK                        0x20u
-#define TPM_SC_CPWMS_SHIFT                       5
-#define TPM_SC_TOIE_MASK                         0x40u
-#define TPM_SC_TOIE_SHIFT                        6
-#define TPM_SC_TOF_MASK                          0x80u
-#define TPM_SC_TOF_SHIFT                         7
-#define TPM_SC_DMA_MASK                          0x100u
-#define TPM_SC_DMA_SHIFT                         8
-/* CNT Bit Fields */
-#define TPM_CNT_COUNT_MASK                       0xFFFFu
-#define TPM_CNT_COUNT_SHIFT                      0
-#define TPM_CNT_COUNT(x)                         (((uint32_t)(((uint32_t)(x))<<TPM_CNT_COUNT_SHIFT))&TPM_CNT_COUNT_MASK)
-/* MOD Bit Fields */
-#define TPM_MOD_MOD_MASK                         0xFFFFu
-#define TPM_MOD_MOD_SHIFT                        0
-#define TPM_MOD_MOD(x)                           (((uint32_t)(((uint32_t)(x))<<TPM_MOD_MOD_SHIFT))&TPM_MOD_MOD_MASK)
-/* CnSC Bit Fields */
-#define TPM_CnSC_DMA_MASK                        0x1u
-#define TPM_CnSC_DMA_SHIFT                       0
-#define TPM_CnSC_ELSA_MASK                       0x4u
-#define TPM_CnSC_ELSA_SHIFT                      2
-#define TPM_CnSC_ELSB_MASK                       0x8u
-#define TPM_CnSC_ELSB_SHIFT                      3
-#define TPM_CnSC_MSA_MASK                        0x10u
-#define TPM_CnSC_MSA_SHIFT                       4
-#define TPM_CnSC_MSB_MASK                        0x20u
-#define TPM_CnSC_MSB_SHIFT                       5
-#define TPM_CnSC_CHIE_MASK                       0x40u
-#define TPM_CnSC_CHIE_SHIFT                      6
-#define TPM_CnSC_CHF_MASK                        0x80u
-#define TPM_CnSC_CHF_SHIFT                       7
-/* CnV Bit Fields */
-#define TPM_CnV_VAL_MASK                         0xFFFFu
-#define TPM_CnV_VAL_SHIFT                        0
-#define TPM_CnV_VAL(x)                           (((uint32_t)(((uint32_t)(x))<<TPM_CnV_VAL_SHIFT))&TPM_CnV_VAL_MASK)
-/* STATUS Bit Fields */
-#define TPM_STATUS_CH0F_MASK                     0x1u
-#define TPM_STATUS_CH0F_SHIFT                    0
-#define TPM_STATUS_CH1F_MASK                     0x2u
-#define TPM_STATUS_CH1F_SHIFT                    1
-#define TPM_STATUS_CH2F_MASK                     0x4u
-#define TPM_STATUS_CH2F_SHIFT                    2
-#define TPM_STATUS_CH3F_MASK                     0x8u
-#define TPM_STATUS_CH3F_SHIFT                    3
-#define TPM_STATUS_CH4F_MASK                     0x10u
-#define TPM_STATUS_CH4F_SHIFT                    4
-#define TPM_STATUS_CH5F_MASK                     0x20u
-#define TPM_STATUS_CH5F_SHIFT                    5
-#define TPM_STATUS_TOF_MASK                      0x100u
-#define TPM_STATUS_TOF_SHIFT                     8
-/* CONF Bit Fields */
-#define TPM_CONF_DOZEEN_MASK                     0x20u
-#define TPM_CONF_DOZEEN_SHIFT                    5
-#define TPM_CONF_DBGMODE_MASK                    0xC0u
-#define TPM_CONF_DBGMODE_SHIFT                   6
-#define TPM_CONF_DBGMODE(x)                      (((uint32_t)(((uint32_t)(x))<<TPM_CONF_DBGMODE_SHIFT))&TPM_CONF_DBGMODE_MASK)
-#define TPM_CONF_GTBEEN_MASK                     0x200u
-#define TPM_CONF_GTBEEN_SHIFT                    9
-#define TPM_CONF_CSOT_MASK                       0x10000u
-#define TPM_CONF_CSOT_SHIFT                      16
-#define TPM_CONF_CSOO_MASK                       0x20000u
-#define TPM_CONF_CSOO_SHIFT                      17
-#define TPM_CONF_CROT_MASK                       0x40000u
-#define TPM_CONF_CROT_SHIFT                      18
-#define TPM_CONF_TRGSEL_MASK                     0xF000000u
-#define TPM_CONF_TRGSEL_SHIFT                    24
-#define TPM_CONF_TRGSEL(x)                       (((uint32_t)(((uint32_t)(x))<<TPM_CONF_TRGSEL_SHIFT))&TPM_CONF_TRGSEL_MASK)
-
-/**
- * @}
- */ /* end of group TPM_Register_Masks */
-
-
-/* TPM - Peripheral instance base addresses */
-/** Peripheral TPM0 base address */
-#define TPM0_BASE                                (0x40038000u)
-/** Peripheral TPM0 base pointer */
-#define TPM0                                     ((TPM_Type *)TPM0_BASE)
-/** Peripheral TPM1 base address */
-#define TPM1_BASE                                (0x40039000u)
-/** Peripheral TPM1 base pointer */
-#define TPM1                                     ((TPM_Type *)TPM1_BASE)
-/** Peripheral TPM2 base address */
-#define TPM2_BASE                                (0x4003A000u)
-/** Peripheral TPM2 base pointer */
-#define TPM2                                     ((TPM_Type *)TPM2_BASE)
-/** Array initializer of TPM peripheral base pointers */
-#define TPM_BASES                                { TPM0, TPM1, TPM2 }
-
-/**
- * @}
- */ /* end of group TPM_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- TSI Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup TSI_Peripheral_Access_Layer TSI Peripheral Access Layer
- * @{
- */
-
-/** TSI - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t GENCS;                             /**< TSI General Control and Status Register, offset: 0x0 */
-  __IO uint32_t DATA;                              /**< TSI DATA Register, offset: 0x4 */
-  __IO uint32_t TSHD;                              /**< TSI Threshold Register, offset: 0x8 */
-} TSI_Type;
-
-/* ----------------------------------------------------------------------------
-   -- TSI Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup TSI_Register_Masks TSI Register Masks
- * @{
- */
-
-/* GENCS Bit Fields */
-#define TSI_GENCS_CURSW_MASK                     0x2u
-#define TSI_GENCS_CURSW_SHIFT                    1
-#define TSI_GENCS_EOSF_MASK                      0x4u
-#define TSI_GENCS_EOSF_SHIFT                     2
-#define TSI_GENCS_SCNIP_MASK                     0x8u
-#define TSI_GENCS_SCNIP_SHIFT                    3
-#define TSI_GENCS_STM_MASK                       0x10u
-#define TSI_GENCS_STM_SHIFT                      4
-#define TSI_GENCS_STPE_MASK                      0x20u
-#define TSI_GENCS_STPE_SHIFT                     5
-#define TSI_GENCS_TSIIEN_MASK                    0x40u
-#define TSI_GENCS_TSIIEN_SHIFT                   6
-#define TSI_GENCS_TSIEN_MASK                     0x80u
-#define TSI_GENCS_TSIEN_SHIFT                    7
-#define TSI_GENCS_NSCN_MASK                      0x1F00u
-#define TSI_GENCS_NSCN_SHIFT                     8
-#define TSI_GENCS_NSCN(x)                        (((uint32_t)(((uint32_t)(x))<<TSI_GENCS_NSCN_SHIFT))&TSI_GENCS_NSCN_MASK)
-#define TSI_GENCS_PS_MASK                        0xE000u
-#define TSI_GENCS_PS_SHIFT                       13
-#define TSI_GENCS_PS(x)                          (((uint32_t)(((uint32_t)(x))<<TSI_GENCS_PS_SHIFT))&TSI_GENCS_PS_MASK)
-#define TSI_GENCS_EXTCHRG_MASK                   0x70000u
-#define TSI_GENCS_EXTCHRG_SHIFT                  16
-#define TSI_GENCS_EXTCHRG(x)                     (((uint32_t)(((uint32_t)(x))<<TSI_GENCS_EXTCHRG_SHIFT))&TSI_GENCS_EXTCHRG_MASK)
-#define TSI_GENCS_DVOLT_MASK                     0x180000u
-#define TSI_GENCS_DVOLT_SHIFT                    19
-#define TSI_GENCS_DVOLT(x)                       (((uint32_t)(((uint32_t)(x))<<TSI_GENCS_DVOLT_SHIFT))&TSI_GENCS_DVOLT_MASK)
-#define TSI_GENCS_REFCHRG_MASK                   0xE00000u
-#define TSI_GENCS_REFCHRG_SHIFT                  21
-#define TSI_GENCS_REFCHRG(x)                     (((uint32_t)(((uint32_t)(x))<<TSI_GENCS_REFCHRG_SHIFT))&TSI_GENCS_REFCHRG_MASK)
-#define TSI_GENCS_MODE_MASK                      0xF000000u
-#define TSI_GENCS_MODE_SHIFT                     24
-#define TSI_GENCS_MODE(x)                        (((uint32_t)(((uint32_t)(x))<<TSI_GENCS_MODE_SHIFT))&TSI_GENCS_MODE_MASK)
-#define TSI_GENCS_ESOR_MASK                      0x10000000u
-#define TSI_GENCS_ESOR_SHIFT                     28
-#define TSI_GENCS_OUTRGF_MASK                    0x80000000u
-#define TSI_GENCS_OUTRGF_SHIFT                   31
-/* DATA Bit Fields */
-#define TSI_DATA_TSICNT_MASK                     0xFFFFu
-#define TSI_DATA_TSICNT_SHIFT                    0
-#define TSI_DATA_TSICNT(x)                       (((uint32_t)(((uint32_t)(x))<<TSI_DATA_TSICNT_SHIFT))&TSI_DATA_TSICNT_MASK)
-#define TSI_DATA_SWTS_MASK                       0x400000u
-#define TSI_DATA_SWTS_SHIFT                      22
-#define TSI_DATA_DMAEN_MASK                      0x800000u
-#define TSI_DATA_DMAEN_SHIFT                     23
-#define TSI_DATA_TSICH_MASK                      0xF0000000u
-#define TSI_DATA_TSICH_SHIFT                     28
-#define TSI_DATA_TSICH(x)                        (((uint32_t)(((uint32_t)(x))<<TSI_DATA_TSICH_SHIFT))&TSI_DATA_TSICH_MASK)
-/* TSHD Bit Fields */
-#define TSI_TSHD_THRESL_MASK                     0xFFFFu
-#define TSI_TSHD_THRESL_SHIFT                    0
-#define TSI_TSHD_THRESL(x)                       (((uint32_t)(((uint32_t)(x))<<TSI_TSHD_THRESL_SHIFT))&TSI_TSHD_THRESL_MASK)
-#define TSI_TSHD_THRESH_MASK                     0xFFFF0000u
-#define TSI_TSHD_THRESH_SHIFT                    16
-#define TSI_TSHD_THRESH(x)                       (((uint32_t)(((uint32_t)(x))<<TSI_TSHD_THRESH_SHIFT))&TSI_TSHD_THRESH_MASK)
-
-/**
- * @}
- */ /* end of group TSI_Register_Masks */
-
-
-/* TSI - Peripheral instance base addresses */
-/** Peripheral TSI0 base address */
-#define TSI0_BASE                                (0x40045000u)
-/** Peripheral TSI0 base pointer */
-#define TSI0                                     ((TSI_Type *)TSI0_BASE)
-/** Array initializer of TSI peripheral base pointers */
-#define TSI_BASES                                { TSI0 }
-
-/**
- * @}
- */ /* end of group TSI_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- UART Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup UART_Peripheral_Access_Layer UART Peripheral Access Layer
- * @{
- */
-
-/** UART - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t BDH;                                /**< UART Baud Rate Register: High, offset: 0x0 */
-  __IO uint8_t BDL;                                /**< UART Baud Rate Register: Low, offset: 0x1 */
-  __IO uint8_t C1;                                 /**< UART Control Register 1, offset: 0x2 */
-  __IO uint8_t C2;                                 /**< UART Control Register 2, offset: 0x3 */
-  __I  uint8_t S1;                                 /**< UART Status Register 1, offset: 0x4 */
-  __IO uint8_t S2;                                 /**< UART Status Register 2, offset: 0x5 */
-  __IO uint8_t C3;                                 /**< UART Control Register 3, offset: 0x6 */
-  __IO uint8_t D;                                  /**< UART Data Register, offset: 0x7 */
-  __IO uint8_t C4;                                 /**< UART Control Register 4, offset: 0x8 */
-} UART_Type;
-
-/* ----------------------------------------------------------------------------
-   -- UART Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup UART_Register_Masks UART Register Masks
- * @{
- */
-
-/* BDH Bit Fields */
-#define UART_BDH_SBR_MASK                        0x1Fu
-#define UART_BDH_SBR_SHIFT                       0
-#define UART_BDH_SBR(x)                          (((uint8_t)(((uint8_t)(x))<<UART_BDH_SBR_SHIFT))&UART_BDH_SBR_MASK)
-#define UART_BDH_SBNS_MASK                       0x20u
-#define UART_BDH_SBNS_SHIFT                      5
-#define UART_BDH_RXEDGIE_MASK                    0x40u
-#define UART_BDH_RXEDGIE_SHIFT                   6
-#define UART_BDH_LBKDIE_MASK                     0x80u
-#define UART_BDH_LBKDIE_SHIFT                    7
-/* BDL Bit Fields */
-#define UART_BDL_SBR_MASK                        0xFFu
-#define UART_BDL_SBR_SHIFT                       0
-#define UART_BDL_SBR(x)                          (((uint8_t)(((uint8_t)(x))<<UART_BDL_SBR_SHIFT))&UART_BDL_SBR_MASK)
-/* C1 Bit Fields */
-#define UART_C1_PT_MASK                          0x1u
-#define UART_C1_PT_SHIFT                         0
-#define UART_C1_PE_MASK                          0x2u
-#define UART_C1_PE_SHIFT                         1
-#define UART_C1_ILT_MASK                         0x4u
-#define UART_C1_ILT_SHIFT                        2
-#define UART_C1_WAKE_MASK                        0x8u
-#define UART_C1_WAKE_SHIFT                       3
-#define UART_C1_M_MASK                           0x10u
-#define UART_C1_M_SHIFT                          4
-#define UART_C1_RSRC_MASK                        0x20u
-#define UART_C1_RSRC_SHIFT                       5
-#define UART_C1_UARTSWAI_MASK                    0x40u
-#define UART_C1_UARTSWAI_SHIFT                   6
-#define UART_C1_LOOPS_MASK                       0x80u
-#define UART_C1_LOOPS_SHIFT                      7
-/* C2 Bit Fields */
-#define UART_C2_SBK_MASK                         0x1u
-#define UART_C2_SBK_SHIFT                        0
-#define UART_C2_RWU_MASK                         0x2u
-#define UART_C2_RWU_SHIFT                        1
-#define UART_C2_RE_MASK                          0x4u
-#define UART_C2_RE_SHIFT                         2
-#define UART_C2_TE_MASK                          0x8u
-#define UART_C2_TE_SHIFT                         3
-#define UART_C2_ILIE_MASK                        0x10u
-#define UART_C2_ILIE_SHIFT                       4
-#define UART_C2_RIE_MASK                         0x20u
-#define UART_C2_RIE_SHIFT                        5
-#define UART_C2_TCIE_MASK                        0x40u
-#define UART_C2_TCIE_SHIFT                       6
-#define UART_C2_TIE_MASK                         0x80u
-#define UART_C2_TIE_SHIFT                        7
-/* S1 Bit Fields */
-#define UART_S1_PF_MASK                          0x1u
-#define UART_S1_PF_SHIFT                         0
-#define UART_S1_FE_MASK                          0x2u
-#define UART_S1_FE_SHIFT                         1
-#define UART_S1_NF_MASK                          0x4u
-#define UART_S1_NF_SHIFT                         2
-#define UART_S1_OR_MASK                          0x8u
-#define UART_S1_OR_SHIFT                         3
-#define UART_S1_IDLE_MASK                        0x10u
-#define UART_S1_IDLE_SHIFT                       4
-#define UART_S1_RDRF_MASK                        0x20u
-#define UART_S1_RDRF_SHIFT                       5
-#define UART_S1_TC_MASK                          0x40u
-#define UART_S1_TC_SHIFT                         6
-#define UART_S1_TDRE_MASK                        0x80u
-#define UART_S1_TDRE_SHIFT                       7
-/* S2 Bit Fields */
-#define UART_S2_RAF_MASK                         0x1u
-#define UART_S2_RAF_SHIFT                        0
-#define UART_S2_LBKDE_MASK                       0x2u
-#define UART_S2_LBKDE_SHIFT                      1
-#define UART_S2_BRK13_MASK                       0x4u
-#define UART_S2_BRK13_SHIFT                      2
-#define UART_S2_RWUID_MASK                       0x8u
-#define UART_S2_RWUID_SHIFT                      3
-#define UART_S2_RXINV_MASK                       0x10u
-#define UART_S2_RXINV_SHIFT                      4
-#define UART_S2_RXEDGIF_MASK                     0x40u
-#define UART_S2_RXEDGIF_SHIFT                    6
-#define UART_S2_LBKDIF_MASK                      0x80u
-#define UART_S2_LBKDIF_SHIFT                     7
-/* C3 Bit Fields */
-#define UART_C3_PEIE_MASK                        0x1u
-#define UART_C3_PEIE_SHIFT                       0
-#define UART_C3_FEIE_MASK                        0x2u
-#define UART_C3_FEIE_SHIFT                       1
-#define UART_C3_NEIE_MASK                        0x4u
-#define UART_C3_NEIE_SHIFT                       2
-#define UART_C3_ORIE_MASK                        0x8u
-#define UART_C3_ORIE_SHIFT                       3
-#define UART_C3_TXINV_MASK                       0x10u
-#define UART_C3_TXINV_SHIFT                      4
-#define UART_C3_TXDIR_MASK                       0x20u
-#define UART_C3_TXDIR_SHIFT                      5
-#define UART_C3_T8_MASK                          0x40u
-#define UART_C3_T8_SHIFT                         6
-#define UART_C3_R8_MASK                          0x80u
-#define UART_C3_R8_SHIFT                         7
-/* D Bit Fields */
-#define UART_D_R0T0_MASK                         0x1u
-#define UART_D_R0T0_SHIFT                        0
-#define UART_D_R1T1_MASK                         0x2u
-#define UART_D_R1T1_SHIFT                        1
-#define UART_D_R2T2_MASK                         0x4u
-#define UART_D_R2T2_SHIFT                        2
-#define UART_D_R3T3_MASK                         0x8u
-#define UART_D_R3T3_SHIFT                        3
-#define UART_D_R4T4_MASK                         0x10u
-#define UART_D_R4T4_SHIFT                        4
-#define UART_D_R5T5_MASK                         0x20u
-#define UART_D_R5T5_SHIFT                        5
-#define UART_D_R6T6_MASK                         0x40u
-#define UART_D_R6T6_SHIFT                        6
-#define UART_D_R7T7_MASK                         0x80u
-#define UART_D_R7T7_SHIFT                        7
-/* C4 Bit Fields */
-#define UART_C4_LBKDDMAS_MASK                    0x8u
-#define UART_C4_LBKDDMAS_SHIFT                   3
-#define UART_C4_ILDMAS_MASK                      0x10u
-#define UART_C4_ILDMAS_SHIFT                     4
-#define UART_C4_RDMAS_MASK                       0x20u
-#define UART_C4_RDMAS_SHIFT                      5
-#define UART_C4_TCDMAS_MASK                      0x40u
-#define UART_C4_TCDMAS_SHIFT                     6
-#define UART_C4_TDMAS_MASK                       0x80u
-#define UART_C4_TDMAS_SHIFT                      7
-
-/**
- * @}
- */ /* end of group UART_Register_Masks */
-
-
-/* UART - Peripheral instance base addresses */
-/** Peripheral UART1 base address */
-#define UART1_BASE                               (0x4006B000u)
-/** Peripheral UART1 base pointer */
-#define UART1                                    ((UART_Type *)UART1_BASE)
-/** Peripheral UART2 base address */
-#define UART2_BASE                               (0x4006C000u)
-/** Peripheral UART2 base pointer */
-#define UART2                                    ((UART_Type *)UART2_BASE)
-/** Array initializer of UART peripheral base pointers */
-#define UART_BASES                               { UART1, UART2 }
-
-/**
- * @}
- */ /* end of group UART_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- UARTLP Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup UARTLP_Peripheral_Access_Layer UARTLP Peripheral Access Layer
- * @{
- */
-
-/** UARTLP - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t BDH;                                /**< UART Baud Rate Register High, offset: 0x0 */
-  __IO uint8_t BDL;                                /**< UART Baud Rate Register Low, offset: 0x1 */
-  __IO uint8_t C1;                                 /**< UART Control Register 1, offset: 0x2 */
-  __IO uint8_t C2;                                 /**< UART Control Register 2, offset: 0x3 */
-  __IO uint8_t S1;                                 /**< UART Status Register 1, offset: 0x4 */
-  __IO uint8_t S2;                                 /**< UART Status Register 2, offset: 0x5 */
-  __IO uint8_t C3;                                 /**< UART Control Register 3, offset: 0x6 */
-  __IO uint8_t D;                                  /**< UART Data Register, offset: 0x7 */
-  __IO uint8_t MA1;                                /**< UART Match Address Registers 1, offset: 0x8 */
-  __IO uint8_t MA2;                                /**< UART Match Address Registers 2, offset: 0x9 */
-  __IO uint8_t C4;                                 /**< UART Control Register 4, offset: 0xA */
-  __IO uint8_t C5;                                 /**< UART Control Register 5, offset: 0xB */
-} UARTLP_Type;
-
-/* ----------------------------------------------------------------------------
-   -- UARTLP Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup UARTLP_Register_Masks UARTLP Register Masks
- * @{
- */
-
-/* BDH Bit Fields */
-#define UARTLP_BDH_SBR_MASK                      0x1Fu
-#define UARTLP_BDH_SBR_SHIFT                     0
-#define UARTLP_BDH_SBR(x)                        (((uint8_t)(((uint8_t)(x))<<UARTLP_BDH_SBR_SHIFT))&UARTLP_BDH_SBR_MASK)
-#define UARTLP_BDH_SBNS_MASK                     0x20u
-#define UARTLP_BDH_SBNS_SHIFT                    5
-#define UARTLP_BDH_RXEDGIE_MASK                  0x40u
-#define UARTLP_BDH_RXEDGIE_SHIFT                 6
-#define UARTLP_BDH_LBKDIE_MASK                   0x80u
-#define UARTLP_BDH_LBKDIE_SHIFT                  7
-/* BDL Bit Fields */
-#define UARTLP_BDL_SBR_MASK                      0xFFu
-#define UARTLP_BDL_SBR_SHIFT                     0
-#define UARTLP_BDL_SBR(x)                        (((uint8_t)(((uint8_t)(x))<<UARTLP_BDL_SBR_SHIFT))&UARTLP_BDL_SBR_MASK)
-/* C1 Bit Fields */
-#define UARTLP_C1_PT_MASK                        0x1u
-#define UARTLP_C1_PT_SHIFT                       0
-#define UARTLP_C1_PE_MASK                        0x2u
-#define UARTLP_C1_PE_SHIFT                       1
-#define UARTLP_C1_ILT_MASK                       0x4u
-#define UARTLP_C1_ILT_SHIFT                      2
-#define UARTLP_C1_WAKE_MASK                      0x8u
-#define UARTLP_C1_WAKE_SHIFT                     3
-#define UARTLP_C1_M_MASK                         0x10u
-#define UARTLP_C1_M_SHIFT                        4
-#define UARTLP_C1_RSRC_MASK                      0x20u
-#define UARTLP_C1_RSRC_SHIFT                     5
-#define UARTLP_C1_DOZEEN_MASK                    0x40u
-#define UARTLP_C1_DOZEEN_SHIFT                   6
-#define UARTLP_C1_LOOPS_MASK                     0x80u
-#define UARTLP_C1_LOOPS_SHIFT                    7
-/* C2 Bit Fields */
-#define UARTLP_C2_SBK_MASK                       0x1u
-#define UARTLP_C2_SBK_SHIFT                      0
-#define UARTLP_C2_RWU_MASK                       0x2u
-#define UARTLP_C2_RWU_SHIFT                      1
-#define UARTLP_C2_RE_MASK                        0x4u
-#define UARTLP_C2_RE_SHIFT                       2
-#define UARTLP_C2_TE_MASK                        0x8u
-#define UARTLP_C2_TE_SHIFT                       3
-#define UARTLP_C2_ILIE_MASK                      0x10u
-#define UARTLP_C2_ILIE_SHIFT                     4
-#define UARTLP_C2_RIE_MASK                       0x20u
-#define UARTLP_C2_RIE_SHIFT                      5
-#define UARTLP_C2_TCIE_MASK                      0x40u
-#define UARTLP_C2_TCIE_SHIFT                     6
-#define UARTLP_C2_TIE_MASK                       0x80u
-#define UARTLP_C2_TIE_SHIFT                      7
-/* S1 Bit Fields */
-#define UARTLP_S1_PF_MASK                        0x1u
-#define UARTLP_S1_PF_SHIFT                       0
-#define UARTLP_S1_FE_MASK                        0x2u
-#define UARTLP_S1_FE_SHIFT                       1
-#define UARTLP_S1_NF_MASK                        0x4u
-#define UARTLP_S1_NF_SHIFT                       2
-#define UARTLP_S1_OR_MASK                        0x8u
-#define UARTLP_S1_OR_SHIFT                       3
-#define UARTLP_S1_IDLE_MASK                      0x10u
-#define UARTLP_S1_IDLE_SHIFT                     4
-#define UARTLP_S1_RDRF_MASK                      0x20u
-#define UARTLP_S1_RDRF_SHIFT                     5
-#define UARTLP_S1_TC_MASK                        0x40u
-#define UARTLP_S1_TC_SHIFT                       6
-#define UARTLP_S1_TDRE_MASK                      0x80u
-#define UARTLP_S1_TDRE_SHIFT                     7
-/* S2 Bit Fields */
-#define UARTLP_S2_RAF_MASK                       0x1u
-#define UARTLP_S2_RAF_SHIFT                      0
-#define UARTLP_S2_LBKDE_MASK                     0x2u
-#define UARTLP_S2_LBKDE_SHIFT                    1
-#define UARTLP_S2_BRK13_MASK                     0x4u
-#define UARTLP_S2_BRK13_SHIFT                    2
-#define UARTLP_S2_RWUID_MASK                     0x8u
-#define UARTLP_S2_RWUID_SHIFT                    3
-#define UARTLP_S2_RXINV_MASK                     0x10u
-#define UARTLP_S2_RXINV_SHIFT                    4
-#define UARTLP_S2_MSBF_MASK                      0x20u
-#define UARTLP_S2_MSBF_SHIFT                     5
-#define UARTLP_S2_RXEDGIF_MASK                   0x40u
-#define UARTLP_S2_RXEDGIF_SHIFT                  6
-#define UARTLP_S2_LBKDIF_MASK                    0x80u
-#define UARTLP_S2_LBKDIF_SHIFT                   7
-/* C3 Bit Fields */
-#define UARTLP_C3_PEIE_MASK                      0x1u
-#define UARTLP_C3_PEIE_SHIFT                     0
-#define UARTLP_C3_FEIE_MASK                      0x2u
-#define UARTLP_C3_FEIE_SHIFT                     1
-#define UARTLP_C3_NEIE_MASK                      0x4u
-#define UARTLP_C3_NEIE_SHIFT                     2
-#define UARTLP_C3_ORIE_MASK                      0x8u
-#define UARTLP_C3_ORIE_SHIFT                     3
-#define UARTLP_C3_TXINV_MASK                     0x10u
-#define UARTLP_C3_TXINV_SHIFT                    4
-#define UARTLP_C3_TXDIR_MASK                     0x20u
-#define UARTLP_C3_TXDIR_SHIFT                    5
-#define UARTLP_C3_R9T8_MASK                      0x40u
-#define UARTLP_C3_R9T8_SHIFT                     6
-#define UARTLP_C3_R8T9_MASK                      0x80u
-#define UARTLP_C3_R8T9_SHIFT                     7
-/* D Bit Fields */
-#define UARTLP_D_R0T0_MASK                       0x1u
-#define UARTLP_D_R0T0_SHIFT                      0
-#define UARTLP_D_R1T1_MASK                       0x2u
-#define UARTLP_D_R1T1_SHIFT                      1
-#define UARTLP_D_R2T2_MASK                       0x4u
-#define UARTLP_D_R2T2_SHIFT                      2
-#define UARTLP_D_R3T3_MASK                       0x8u
-#define UARTLP_D_R3T3_SHIFT                      3
-#define UARTLP_D_R4T4_MASK                       0x10u
-#define UARTLP_D_R4T4_SHIFT                      4
-#define UARTLP_D_R5T5_MASK                       0x20u
-#define UARTLP_D_R5T5_SHIFT                      5
-#define UARTLP_D_R6T6_MASK                       0x40u
-#define UARTLP_D_R6T6_SHIFT                      6
-#define UARTLP_D_R7T7_MASK                       0x80u
-#define UARTLP_D_R7T7_SHIFT                      7
-/* MA1 Bit Fields */
-#define UARTLP_MA1_MA_MASK                       0xFFu
-#define UARTLP_MA1_MA_SHIFT                      0
-#define UARTLP_MA1_MA(x)                         (((uint8_t)(((uint8_t)(x))<<UARTLP_MA1_MA_SHIFT))&UARTLP_MA1_MA_MASK)
-/* MA2 Bit Fields */
-#define UARTLP_MA2_MA_MASK                       0xFFu
-#define UARTLP_MA2_MA_SHIFT                      0
-#define UARTLP_MA2_MA(x)                         (((uint8_t)(((uint8_t)(x))<<UARTLP_MA2_MA_SHIFT))&UARTLP_MA2_MA_MASK)
-/* C4 Bit Fields */
-#define UARTLP_C4_OSR_MASK                       0x1Fu
-#define UARTLP_C4_OSR_SHIFT                      0
-#define UARTLP_C4_OSR(x)                         (((uint8_t)(((uint8_t)(x))<<UARTLP_C4_OSR_SHIFT))&UARTLP_C4_OSR_MASK)
-#define UARTLP_C4_M10_MASK                       0x20u
-#define UARTLP_C4_M10_SHIFT                      5
-#define UARTLP_C4_MAEN2_MASK                     0x40u
-#define UARTLP_C4_MAEN2_SHIFT                    6
-#define UARTLP_C4_MAEN1_MASK                     0x80u
-#define UARTLP_C4_MAEN1_SHIFT                    7
-/* C5 Bit Fields */
-#define UARTLP_C5_RESYNCDIS_MASK                 0x1u
-#define UARTLP_C5_RESYNCDIS_SHIFT                0
-#define UARTLP_C5_BOTHEDGE_MASK                  0x2u
-#define UARTLP_C5_BOTHEDGE_SHIFT                 1
-#define UARTLP_C5_RDMAE_MASK                     0x20u
-#define UARTLP_C5_RDMAE_SHIFT                    5
-#define UARTLP_C5_TDMAE_MASK                     0x80u
-#define UARTLP_C5_TDMAE_SHIFT                    7
-
-/**
- * @}
- */ /* end of group UARTLP_Register_Masks */
-
-
-/* UARTLP - Peripheral instance base addresses */
-/** Peripheral UART0 base address */
-#define UART0_BASE                               (0x4006A000u)
-/** Peripheral UART0 base pointer */
-#define UART0                                    ((UARTLP_Type *)UART0_BASE)
-/** Array initializer of UARTLP peripheral base pointers */
-#define UARTLP_BASES                             { UART0 }
-
-/**
- * @}
- */ /* end of group UARTLP_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- USB Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup USB_Peripheral_Access_Layer USB Peripheral Access Layer
- * @{
- */
-
-/** USB - Register Layout Typedef */
-typedef struct {
-  __I  uint8_t PERID;                              /**< Peripheral ID register, offset: 0x0 */
-       uint8_t RESERVED_0[3];
-  __I  uint8_t IDCOMP;                             /**< Peripheral ID Complement register, offset: 0x4 */
-       uint8_t RESERVED_1[3];
-  __I  uint8_t REV;                                /**< Peripheral Revision register, offset: 0x8 */
-       uint8_t RESERVED_2[3];
-  __I  uint8_t ADDINFO;                            /**< Peripheral Additional Info register, offset: 0xC */
-       uint8_t RESERVED_3[3];
-  __IO uint8_t OTGISTAT;                           /**< OTG Interrupt Status register, offset: 0x10 */
-       uint8_t RESERVED_4[3];
-  __IO uint8_t OTGICR;                             /**< OTG Interrupt Control Register, offset: 0x14 */
-       uint8_t RESERVED_5[3];
-  __IO uint8_t OTGSTAT;                            /**< OTG Status register, offset: 0x18 */
-       uint8_t RESERVED_6[3];
-  __IO uint8_t OTGCTL;                             /**< OTG Control register, offset: 0x1C */
-       uint8_t RESERVED_7[99];
-  __IO uint8_t ISTAT;                              /**< Interrupt Status register, offset: 0x80 */
-       uint8_t RESERVED_8[3];
-  __IO uint8_t INTEN;                              /**< Interrupt Enable register, offset: 0x84 */
-       uint8_t RESERVED_9[3];
-  __IO uint8_t ERRSTAT;                            /**< Error Interrupt Status register, offset: 0x88 */
-       uint8_t RESERVED_10[3];
-  __IO uint8_t ERREN;                              /**< Error Interrupt Enable register, offset: 0x8C */
-       uint8_t RESERVED_11[3];
-  __I  uint8_t STAT;                               /**< Status register, offset: 0x90 */
-       uint8_t RESERVED_12[3];
-  __IO uint8_t CTL;                                /**< Control register, offset: 0x94 */
-       uint8_t RESERVED_13[3];
-  __IO uint8_t ADDR;                               /**< Address register, offset: 0x98 */
-       uint8_t RESERVED_14[3];
-  __IO uint8_t BDTPAGE1;                           /**< BDT Page Register 1, offset: 0x9C */
-       uint8_t RESERVED_15[3];
-  __IO uint8_t FRMNUML;                            /**< Frame Number Register Low, offset: 0xA0 */
-       uint8_t RESERVED_16[3];
-  __IO uint8_t FRMNUMH;                            /**< Frame Number Register High, offset: 0xA4 */
-       uint8_t RESERVED_17[3];
-  __IO uint8_t TOKEN;                              /**< Token register, offset: 0xA8 */
-       uint8_t RESERVED_18[3];
-  __IO uint8_t SOFTHLD;                            /**< SOF Threshold Register, offset: 0xAC */
-       uint8_t RESERVED_19[3];
-  __IO uint8_t BDTPAGE2;                           /**< BDT Page Register 2, offset: 0xB0 */
-       uint8_t RESERVED_20[3];
-  __IO uint8_t BDTPAGE3;                           /**< BDT Page Register 3, offset: 0xB4 */
-       uint8_t RESERVED_21[11];
-  struct {                                         /* offset: 0xC0, array step: 0x4 */
-    __IO uint8_t ENDPT;                              /**< Endpoint Control register, array offset: 0xC0, array step: 0x4 */
-         uint8_t RESERVED_0[3];
-  } ENDPOINT[16];
-  __IO uint8_t USBCTRL;                            /**< USB Control register, offset: 0x100 */
-       uint8_t RESERVED_22[3];
-  __I  uint8_t OBSERVE;                            /**< USB OTG Observe register, offset: 0x104 */
-       uint8_t RESERVED_23[3];
-  __IO uint8_t CONTROL;                            /**< USB OTG Control register, offset: 0x108 */
-       uint8_t RESERVED_24[3];
-  __IO uint8_t USBTRC0;                            /**< USB Transceiver Control Register 0, offset: 0x10C */
-} USB_Type;
-
-/* ----------------------------------------------------------------------------
-   -- USB Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup USB_Register_Masks USB Register Masks
- * @{
- */
-
-/* PERID Bit Fields */
-#define USB_PERID_ID_MASK                        0x3Fu
-#define USB_PERID_ID_SHIFT                       0
-#define USB_PERID_ID(x)                          (((uint8_t)(((uint8_t)(x))<<USB_PERID_ID_SHIFT))&USB_PERID_ID_MASK)
-/* IDCOMP Bit Fields */
-#define USB_IDCOMP_NID_MASK                      0x3Fu
-#define USB_IDCOMP_NID_SHIFT                     0
-#define USB_IDCOMP_NID(x)                        (((uint8_t)(((uint8_t)(x))<<USB_IDCOMP_NID_SHIFT))&USB_IDCOMP_NID_MASK)
-/* REV Bit Fields */
-#define USB_REV_REV_MASK                         0xFFu
-#define USB_REV_REV_SHIFT                        0
-#define USB_REV_REV(x)                           (((uint8_t)(((uint8_t)(x))<<USB_REV_REV_SHIFT))&USB_REV_REV_MASK)
-/* ADDINFO Bit Fields */
-#define USB_ADDINFO_IEHOST_MASK                  0x1u
-#define USB_ADDINFO_IEHOST_SHIFT                 0
-#define USB_ADDINFO_IRQNUM_MASK                  0xF8u
-#define USB_ADDINFO_IRQNUM_SHIFT                 3
-#define USB_ADDINFO_IRQNUM(x)                    (((uint8_t)(((uint8_t)(x))<<USB_ADDINFO_IRQNUM_SHIFT))&USB_ADDINFO_IRQNUM_MASK)
-/* OTGISTAT Bit Fields */
-#define USB_OTGISTAT_AVBUSCHG_MASK               0x1u
-#define USB_OTGISTAT_AVBUSCHG_SHIFT              0
-#define USB_OTGISTAT_B_SESS_CHG_MASK             0x4u
-#define USB_OTGISTAT_B_SESS_CHG_SHIFT            2
-#define USB_OTGISTAT_SESSVLDCHG_MASK             0x8u
-#define USB_OTGISTAT_SESSVLDCHG_SHIFT            3
-#define USB_OTGISTAT_LINE_STATE_CHG_MASK         0x20u
-#define USB_OTGISTAT_LINE_STATE_CHG_SHIFT        5
-#define USB_OTGISTAT_ONEMSEC_MASK                0x40u
-#define USB_OTGISTAT_ONEMSEC_SHIFT               6
-#define USB_OTGISTAT_IDCHG_MASK                  0x80u
-#define USB_OTGISTAT_IDCHG_SHIFT                 7
-/* OTGICR Bit Fields */
-#define USB_OTGICR_AVBUSEN_MASK                  0x1u
-#define USB_OTGICR_AVBUSEN_SHIFT                 0
-#define USB_OTGICR_BSESSEN_MASK                  0x4u
-#define USB_OTGICR_BSESSEN_SHIFT                 2
-#define USB_OTGICR_SESSVLDEN_MASK                0x8u
-#define USB_OTGICR_SESSVLDEN_SHIFT               3
-#define USB_OTGICR_LINESTATEEN_MASK              0x20u
-#define USB_OTGICR_LINESTATEEN_SHIFT             5
-#define USB_OTGICR_ONEMSECEN_MASK                0x40u
-#define USB_OTGICR_ONEMSECEN_SHIFT               6
-#define USB_OTGICR_IDEN_MASK                     0x80u
-#define USB_OTGICR_IDEN_SHIFT                    7
-/* OTGSTAT Bit Fields */
-#define USB_OTGSTAT_AVBUSVLD_MASK                0x1u
-#define USB_OTGSTAT_AVBUSVLD_SHIFT               0
-#define USB_OTGSTAT_BSESSEND_MASK                0x4u
-#define USB_OTGSTAT_BSESSEND_SHIFT               2
-#define USB_OTGSTAT_SESS_VLD_MASK                0x8u
-#define USB_OTGSTAT_SESS_VLD_SHIFT               3
-#define USB_OTGSTAT_LINESTATESTABLE_MASK         0x20u
-#define USB_OTGSTAT_LINESTATESTABLE_SHIFT        5
-#define USB_OTGSTAT_ONEMSECEN_MASK               0x40u
-#define USB_OTGSTAT_ONEMSECEN_SHIFT              6
-#define USB_OTGSTAT_ID_MASK                      0x80u
-#define USB_OTGSTAT_ID_SHIFT                     7
-/* OTGCTL Bit Fields */
-#define USB_OTGCTL_OTGEN_MASK                    0x4u
-#define USB_OTGCTL_OTGEN_SHIFT                   2
-#define USB_OTGCTL_DMLOW_MASK                    0x10u
-#define USB_OTGCTL_DMLOW_SHIFT                   4
-#define USB_OTGCTL_DPLOW_MASK                    0x20u
-#define USB_OTGCTL_DPLOW_SHIFT                   5
-#define USB_OTGCTL_DPHIGH_MASK                   0x80u
-#define USB_OTGCTL_DPHIGH_SHIFT                  7
-/* ISTAT Bit Fields */
-#define USB_ISTAT_USBRST_MASK                    0x1u
-#define USB_ISTAT_USBRST_SHIFT                   0
-#define USB_ISTAT_ERROR_MASK                     0x2u
-#define USB_ISTAT_ERROR_SHIFT                    1
-#define USB_ISTAT_SOFTOK_MASK                    0x4u
-#define USB_ISTAT_SOFTOK_SHIFT                   2
-#define USB_ISTAT_TOKDNE_MASK                    0x8u
-#define USB_ISTAT_TOKDNE_SHIFT                   3
-#define USB_ISTAT_SLEEP_MASK                     0x10u
-#define USB_ISTAT_SLEEP_SHIFT                    4
-#define USB_ISTAT_RESUME_MASK                    0x20u
-#define USB_ISTAT_RESUME_SHIFT                   5
-#define USB_ISTAT_ATTACH_MASK                    0x40u
-#define USB_ISTAT_ATTACH_SHIFT                   6
-#define USB_ISTAT_STALL_MASK                     0x80u
-#define USB_ISTAT_STALL_SHIFT                    7
-/* INTEN Bit Fields */
-#define USB_INTEN_USBRSTEN_MASK                  0x1u
-#define USB_INTEN_USBRSTEN_SHIFT                 0
-#define USB_INTEN_ERROREN_MASK                   0x2u
-#define USB_INTEN_ERROREN_SHIFT                  1
-#define USB_INTEN_SOFTOKEN_MASK                  0x4u
-#define USB_INTEN_SOFTOKEN_SHIFT                 2
-#define USB_INTEN_TOKDNEEN_MASK                  0x8u
-#define USB_INTEN_TOKDNEEN_SHIFT                 3
-#define USB_INTEN_SLEEPEN_MASK                   0x10u
-#define USB_INTEN_SLEEPEN_SHIFT                  4
-#define USB_INTEN_RESUMEEN_MASK                  0x20u
-#define USB_INTEN_RESUMEEN_SHIFT                 5
-#define USB_INTEN_ATTACHEN_MASK                  0x40u
-#define USB_INTEN_ATTACHEN_SHIFT                 6
-#define USB_INTEN_STALLEN_MASK                   0x80u
-#define USB_INTEN_STALLEN_SHIFT                  7
-/* ERRSTAT Bit Fields */
-#define USB_ERRSTAT_PIDERR_MASK                  0x1u
-#define USB_ERRSTAT_PIDERR_SHIFT                 0
-#define USB_ERRSTAT_CRC5EOF_MASK                 0x2u
-#define USB_ERRSTAT_CRC5EOF_SHIFT                1
-#define USB_ERRSTAT_CRC16_MASK                   0x4u
-#define USB_ERRSTAT_CRC16_SHIFT                  2
-#define USB_ERRSTAT_DFN8_MASK                    0x8u
-#define USB_ERRSTAT_DFN8_SHIFT                   3
-#define USB_ERRSTAT_BTOERR_MASK                  0x10u
-#define USB_ERRSTAT_BTOERR_SHIFT                 4
-#define USB_ERRSTAT_DMAERR_MASK                  0x20u
-#define USB_ERRSTAT_DMAERR_SHIFT                 5
-#define USB_ERRSTAT_BTSERR_MASK                  0x80u
-#define USB_ERRSTAT_BTSERR_SHIFT                 7
-/* ERREN Bit Fields */
-#define USB_ERREN_PIDERREN_MASK                  0x1u
-#define USB_ERREN_PIDERREN_SHIFT                 0
-#define USB_ERREN_CRC5EOFEN_MASK                 0x2u
-#define USB_ERREN_CRC5EOFEN_SHIFT                1
-#define USB_ERREN_CRC16EN_MASK                   0x4u
-#define USB_ERREN_CRC16EN_SHIFT                  2
-#define USB_ERREN_DFN8EN_MASK                    0x8u
-#define USB_ERREN_DFN8EN_SHIFT                   3
-#define USB_ERREN_BTOERREN_MASK                  0x10u
-#define USB_ERREN_BTOERREN_SHIFT                 4
-#define USB_ERREN_DMAERREN_MASK                  0x20u
-#define USB_ERREN_DMAERREN_SHIFT                 5
-#define USB_ERREN_BTSERREN_MASK                  0x80u
-#define USB_ERREN_BTSERREN_SHIFT                 7
-/* STAT Bit Fields */
-#define USB_STAT_ODD_MASK                        0x4u
-#define USB_STAT_ODD_SHIFT                       2
-#define USB_STAT_TX_MASK                         0x8u
-#define USB_STAT_TX_SHIFT                        3
-#define USB_STAT_ENDP_MASK                       0xF0u
-#define USB_STAT_ENDP_SHIFT                      4
-#define USB_STAT_ENDP(x)                         (((uint8_t)(((uint8_t)(x))<<USB_STAT_ENDP_SHIFT))&USB_STAT_ENDP_MASK)
-/* CTL Bit Fields */
-#define USB_CTL_USBENSOFEN_MASK                  0x1u
-#define USB_CTL_USBENSOFEN_SHIFT                 0
-#define USB_CTL_ODDRST_MASK                      0x2u
-#define USB_CTL_ODDRST_SHIFT                     1
-#define USB_CTL_RESUME_MASK                      0x4u
-#define USB_CTL_RESUME_SHIFT                     2
-#define USB_CTL_HOSTMODEEN_MASK                  0x8u
-#define USB_CTL_HOSTMODEEN_SHIFT                 3
-#define USB_CTL_RESET_MASK                       0x10u
-#define USB_CTL_RESET_SHIFT                      4
-#define USB_CTL_TXSUSPENDTOKENBUSY_MASK          0x20u
-#define USB_CTL_TXSUSPENDTOKENBUSY_SHIFT         5
-#define USB_CTL_SE0_MASK                         0x40u
-#define USB_CTL_SE0_SHIFT                        6
-#define USB_CTL_JSTATE_MASK                      0x80u
-#define USB_CTL_JSTATE_SHIFT                     7
-/* ADDR Bit Fields */
-#define USB_ADDR_ADDR_MASK                       0x7Fu
-#define USB_ADDR_ADDR_SHIFT                      0
-#define USB_ADDR_ADDR(x)                         (((uint8_t)(((uint8_t)(x))<<USB_ADDR_ADDR_SHIFT))&USB_ADDR_ADDR_MASK)
-#define USB_ADDR_LSEN_MASK                       0x80u
-#define USB_ADDR_LSEN_SHIFT                      7
-/* BDTPAGE1 Bit Fields */
-#define USB_BDTPAGE1_BDTBA_MASK                  0xFEu
-#define USB_BDTPAGE1_BDTBA_SHIFT                 1
-#define USB_BDTPAGE1_BDTBA(x)                    (((uint8_t)(((uint8_t)(x))<<USB_BDTPAGE1_BDTBA_SHIFT))&USB_BDTPAGE1_BDTBA_MASK)
-/* FRMNUML Bit Fields */
-#define USB_FRMNUML_FRM_MASK                     0xFFu
-#define USB_FRMNUML_FRM_SHIFT                    0
-#define USB_FRMNUML_FRM(x)                       (((uint8_t)(((uint8_t)(x))<<USB_FRMNUML_FRM_SHIFT))&USB_FRMNUML_FRM_MASK)
-/* FRMNUMH Bit Fields */
-#define USB_FRMNUMH_FRM_MASK                     0x7u
-#define USB_FRMNUMH_FRM_SHIFT                    0
-#define USB_FRMNUMH_FRM(x)                       (((uint8_t)(((uint8_t)(x))<<USB_FRMNUMH_FRM_SHIFT))&USB_FRMNUMH_FRM_MASK)
-/* TOKEN Bit Fields */
-#define USB_TOKEN_TOKENENDPT_MASK                0xFu
-#define USB_TOKEN_TOKENENDPT_SHIFT               0
-#define USB_TOKEN_TOKENENDPT(x)                  (((uint8_t)(((uint8_t)(x))<<USB_TOKEN_TOKENENDPT_SHIFT))&USB_TOKEN_TOKENENDPT_MASK)
-#define USB_TOKEN_TOKENPID_MASK                  0xF0u
-#define USB_TOKEN_TOKENPID_SHIFT                 4
-#define USB_TOKEN_TOKENPID(x)                    (((uint8_t)(((uint8_t)(x))<<USB_TOKEN_TOKENPID_SHIFT))&USB_TOKEN_TOKENPID_MASK)
-/* SOFTHLD Bit Fields */
-#define USB_SOFTHLD_CNT_MASK                     0xFFu
-#define USB_SOFTHLD_CNT_SHIFT                    0
-#define USB_SOFTHLD_CNT(x)                       (((uint8_t)(((uint8_t)(x))<<USB_SOFTHLD_CNT_SHIFT))&USB_SOFTHLD_CNT_MASK)
-/* BDTPAGE2 Bit Fields */
-#define USB_BDTPAGE2_BDTBA_MASK                  0xFFu
-#define USB_BDTPAGE2_BDTBA_SHIFT                 0
-#define USB_BDTPAGE2_BDTBA(x)                    (((uint8_t)(((uint8_t)(x))<<USB_BDTPAGE2_BDTBA_SHIFT))&USB_BDTPAGE2_BDTBA_MASK)
-/* BDTPAGE3 Bit Fields */
-#define USB_BDTPAGE3_BDTBA_MASK                  0xFFu
-#define USB_BDTPAGE3_BDTBA_SHIFT                 0
-#define USB_BDTPAGE3_BDTBA(x)                    (((uint8_t)(((uint8_t)(x))<<USB_BDTPAGE3_BDTBA_SHIFT))&USB_BDTPAGE3_BDTBA_MASK)
-/* ENDPT Bit Fields */
-#define USB_ENDPT_EPHSHK_MASK                    0x1u
-#define USB_ENDPT_EPHSHK_SHIFT                   0
-#define USB_ENDPT_EPSTALL_MASK                   0x2u
-#define USB_ENDPT_EPSTALL_SHIFT                  1
-#define USB_ENDPT_EPTXEN_MASK                    0x4u
-#define USB_ENDPT_EPTXEN_SHIFT                   2
-#define USB_ENDPT_EPRXEN_MASK                    0x8u
-#define USB_ENDPT_EPRXEN_SHIFT                   3
-#define USB_ENDPT_EPCTLDIS_MASK                  0x10u
-#define USB_ENDPT_EPCTLDIS_SHIFT                 4
-#define USB_ENDPT_RETRYDIS_MASK                  0x40u
-#define USB_ENDPT_RETRYDIS_SHIFT                 6
-#define USB_ENDPT_HOSTWOHUB_MASK                 0x80u
-#define USB_ENDPT_HOSTWOHUB_SHIFT                7
-/* USBCTRL Bit Fields */
-#define USB_USBCTRL_PDE_MASK                     0x40u
-#define USB_USBCTRL_PDE_SHIFT                    6
-#define USB_USBCTRL_SUSP_MASK                    0x80u
-#define USB_USBCTRL_SUSP_SHIFT                   7
-/* OBSERVE Bit Fields */
-#define USB_OBSERVE_DMPD_MASK                    0x10u
-#define USB_OBSERVE_DMPD_SHIFT                   4
-#define USB_OBSERVE_DPPD_MASK                    0x40u
-#define USB_OBSERVE_DPPD_SHIFT                   6
-#define USB_OBSERVE_DPPU_MASK                    0x80u
-#define USB_OBSERVE_DPPU_SHIFT                   7
-/* CONTROL Bit Fields */
-#define USB_CONTROL_DPPULLUPNONOTG_MASK          0x10u
-#define USB_CONTROL_DPPULLUPNONOTG_SHIFT         4
-/* USBTRC0 Bit Fields */
-#define USB_USBTRC0_USB_RESUME_INT_MASK          0x1u
-#define USB_USBTRC0_USB_RESUME_INT_SHIFT         0
-#define USB_USBTRC0_SYNC_DET_MASK                0x2u
-#define USB_USBTRC0_SYNC_DET_SHIFT               1
-#define USB_USBTRC0_USBRESMEN_MASK               0x20u
-#define USB_USBTRC0_USBRESMEN_SHIFT              5
-#define USB_USBTRC0_USBRESET_MASK                0x80u
-#define USB_USBTRC0_USBRESET_SHIFT               7
-
-/**
- * @}
- */ /* end of group USB_Register_Masks */
-
-
-/* USB - Peripheral instance base addresses */
-/** Peripheral USB0 base address */
-#define USB0_BASE                                (0x40072000u)
-/** Peripheral USB0 base pointer */
-#define USB0                                     ((USB_Type *)USB0_BASE)
-/** Array initializer of USB peripheral base pointers */
-#define USB_BASES                                { USB0 }
-
-/**
- * @}
- */ /* end of group USB_Peripheral_Access_Layer */
-
-
-/*
-** End of section using anonymous unions
-*/
-
-#if defined(__ARMCC_VERSION)
-  #pragma pop
-#elif defined(__CWCC__)
-  #pragma pop
-#elif defined(__GNUC__)
-  /* leave anonymous unions enabled */
-#elif defined(__IAR_SYSTEMS_ICC__)
-  #pragma language=default
-#else
-  #error Not supported compiler type
-#endif
-
-/**
- * @}
- */ /* end of group Peripheral_access_layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- Backward Compatibility
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup Backward_Compatibility_Symbols Backward Compatibility
- * @{
- */
-
-/* No backward compatibility issues. */
-
-/**
- * @}
- */ /* end of group Backward_Compatibility_Symbols */
-
-
-#endif  /* #if !defined(MKL25Z4_H_) */
-
-/* MKL25Z4.h, eof. */
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_ARM_MICRO/MKL25Z4.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-
-LR_IROM1 0x00000000 0x20000  {    ; load region size_region (32k)
-  ER_IROM1 0x00000000 0x20000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  ; 8_byte_aligned(48 vect * 4 bytes) =  8_byte_aligned(0xC0) = 0xC0
-  ; 0x4000 - 0xC0 = 0x3F40
-  RW_IRAM1 0x1FFFF0C0 0x3F40 {
-   .ANY (+RW +ZI)
-  }
-}
-
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_ARM_MICRO/startup_MKL25Z4.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,353 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_MKL25Z4.s
-; * @purpose: CMSIS Cortex-M0plus Core Device Startup File for the
-; *           MKL25Z4
-; * @version: 1.1
-; * @date:    2012-6-21
-; *
-; * Copyright: 1997 - 2012 Freescale Semiconductor, Inc. All Rights Reserved.
-;*
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; *****************************************************************************/
-
-
-; <h> Stack Configuration
-;   <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
-; </h>
-
-Stack_Size      EQU     0x00000400
-
-                AREA    STACK, NOINIT, READWRITE, ALIGN=3
-                EXPORT  __initial_sp
-
-Stack_Mem       SPACE   Stack_Size
-__initial_sp        EQU     0x20003000  ; Top of RAM
-
-
-Heap_Size       EQU     0x00000000
-
-                AREA    HEAP, NOINIT, READWRITE, ALIGN=3
-                EXPORT  __heap_base
-                EXPORT  __heap_limit
-
-__heap_base
-Heap_Mem        SPACE   Heap_Size
-__heap_limit
-
-                PRESERVE8
-                THUMB
-
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-                EXPORT  __Vectors_End
-                EXPORT  __Vectors_Size
-
-__Vectors       DCD     __initial_sp  ; Top of Stack
-                DCD     Reset_Handler  ; Reset Handler
-                DCD     NMI_Handler  ; NMI Handler
-                DCD     HardFault_Handler  ; Hard Fault Handler
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     SVC_Handler  ; SVCall Handler
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     PendSV_Handler  ; PendSV Handler
-                DCD     SysTick_Handler  ; SysTick Handler
-
-                ; External Interrupts
-                DCD     DMA0_IRQHandler  ; DMA channel 0 transfer complete interrupt
-                DCD     DMA1_IRQHandler  ; DMA channel 1 transfer complete interrupt
-                DCD     DMA2_IRQHandler  ; DMA channel 2 transfer complete interrupt
-                DCD     DMA3_IRQHandler  ; DMA channel 3 transfer complete interrupt
-                DCD     Reserved20_IRQHandler  ; Reserved interrupt 20
-                DCD     FTFA_IRQHandler  ; FTFA interrupt
-                DCD     LVD_LVW_IRQHandler  ; Low Voltage Detect, Low Voltage Warning
-                DCD     LLW_IRQHandler  ; Low Leakage Wakeup
-                DCD     I2C0_IRQHandler  ; I2C0 interrupt
-                DCD     I2C1_IRQHandler  ; I2C0 interrupt 25
-                DCD     SPI0_IRQHandler  ; SPI0 interrupt
-                DCD     SPI1_IRQHandler  ; SPI1 interrupt
-                DCD     UART0_IRQHandler  ; UART0 status/error interrupt
-                DCD     UART1_IRQHandler  ; UART1 status/error interrupt
-                DCD     UART2_IRQHandler  ; UART2 status/error interrupt
-                DCD     ADC0_IRQHandler  ; ADC0 interrupt
-                DCD     CMP0_IRQHandler  ; CMP0 interrupt
-                DCD     TPM0_IRQHandler  ; TPM0 fault, overflow and channels interrupt
-                DCD     TPM1_IRQHandler  ; TPM1 fault, overflow and channels interrupt
-                DCD     TPM2_IRQHandler  ; TPM2 fault, overflow and channels interrupt
-                DCD     RTC_IRQHandler  ; RTC interrupt
-                DCD     RTC_Seconds_IRQHandler  ; RTC seconds interrupt
-                DCD     PIT_IRQHandler  ; PIT timer interrupt
-                DCD     Reserved39_IRQHandler  ; Reserved interrupt 39
-                DCD     USB0_IRQHandler  ; USB0 interrupt
-                DCD     DAC0_IRQHandler  ; DAC interrupt
-                DCD     TSI0_IRQHandler  ; TSI0 interrupt
-                DCD     MCG_IRQHandler  ; MCG interrupt
-                DCD     LPTimer_IRQHandler  ; LPTimer interrupt
-                DCD     Reserved45_IRQHandler  ; Reserved interrupt 45
-                DCD     PORTA_IRQHandler  ; Port A interrupt
-                DCD     PORTD_IRQHandler  ; Port D interrupt
-__Vectors_End
-
-__Vectors_Size 	EQU     __Vectors_End - __Vectors
-
-; <h> Flash Configuration
-;   <i> 16-byte flash configuration field that stores default protection settings (loaded on reset)
-;   <i> and security information that allows the MCU to restrict acces to the FTFL module.
-;   <h> Backdoor Comparison Key
-;     <o0>  Backdoor Key 0  <0x0-0xFF:2>
-;     <o1>  Backdoor Key 1  <0x0-0xFF:2>
-;     <o2>  Backdoor Key 2  <0x0-0xFF:2>
-;     <o3>  Backdoor Key 3  <0x0-0xFF:2>
-;     <o4>  Backdoor Key 4  <0x0-0xFF:2>
-;     <o5>  Backdoor Key 5  <0x0-0xFF:2>
-;     <o6>  Backdoor Key 6  <0x0-0xFF:2>
-;     <o7>  Backdoor Key 7  <0x0-0xFF:2>
-BackDoorK0      EQU     0xFF
-BackDoorK1      EQU     0xFF
-BackDoorK2      EQU     0xFF
-BackDoorK3      EQU     0xFF
-BackDoorK4      EQU     0xFF
-BackDoorK5      EQU     0xFF
-BackDoorK6      EQU     0xFF
-BackDoorK7      EQU     0xFF
-;   </h>
-;   <h> Program flash protection bytes (FPROT)
-;     <i> Each program flash region can be protected from program and erase operation by setting the associated PROT bit.
-;     <i> Each bit protects a 1/32 region of the program flash memory.
-;     <h> FPROT0
-;       <i> Program flash protection bytes
-;       <i> 1/32 - 8/32 region
-;       <o.0>   FPROT0.0
-;       <o.1>   FPROT0.1
-;       <o.2>   FPROT0.2
-;       <o.3>   FPROT0.3
-;       <o.4>   FPROT0.4
-;       <o.5>   FPROT0.5
-;       <o.6>   FPROT0.6
-;       <o.7>   FPROT0.7
-nFPROT0         EQU     0x00
-FPROT0          EQU     nFPROT0:EOR:0xFF
-;     </h>
-;     <h> FPROT1
-;       <i> Program Flash Region Protect Register 1
-;       <i> 9/32 - 16/32 region
-;       <o.0>   FPROT1.0
-;       <o.1>   FPROT1.1
-;       <o.2>   FPROT1.2
-;       <o.3>   FPROT1.3
-;       <o.4>   FPROT1.4
-;       <o.5>   FPROT1.5
-;       <o.6>   FPROT1.6
-;       <o.7>   FPROT1.7
-nFPROT1         EQU     0x00
-FPROT1          EQU     nFPROT1:EOR:0xFF
-;     </h>
-;     <h> FPROT2
-;       <i> Program Flash Region Protect Register 2
-;       <i> 17/32 - 24/32 region
-;       <o.0>   FPROT2.0
-;       <o.1>   FPROT2.1
-;       <o.2>   FPROT2.2
-;       <o.3>   FPROT2.3
-;       <o.4>   FPROT2.4
-;       <o.5>   FPROT2.5
-;       <o.6>   FPROT2.6
-;       <o.7>   FPROT2.7
-nFPROT2         EQU     0x00
-FPROT2          EQU     nFPROT2:EOR:0xFF
-;     </h>
-;     <h> FPROT3
-;       <i> Program Flash Region Protect Register 3
-;       <i> 25/32 - 32/32 region
-;       <o.0>   FPROT3.0
-;       <o.1>   FPROT3.1
-;       <o.2>   FPROT3.2
-;       <o.3>   FPROT3.3
-;       <o.4>   FPROT3.4
-;       <o.5>   FPROT3.5
-;       <o.6>   FPROT3.6
-;       <o.7>   FPROT3.7
-nFPROT3         EQU     0x00
-FPROT3          EQU     nFPROT3:EOR:0xFF
-;     </h>
-;   </h>
-;   </h>
-;   <h> Flash nonvolatile option byte (FOPT)
-;     <i> Allows the user to customize the operation of the MCU at boot time.
-;     <o.0>  LPBOOT0
-;       <0=> Core and system clock divider (OUTDIV1) is 0x7 (divide by 8) or 0x3 (divide by 4)
-;       <1=> Core and system clock divider (OUTDIV1) is 0x1 (divide by 2) or 0x0 (divide by 1)
-;     <o.4>  LPBOOT1
-;       <0=> Core and system clock divider (OUTDIV1) is 0x7 (divide by 8) or 0x1 (divide by 2)
-;       <1=> Core and system clock divider (OUTDIV1) is 0x3 (divide by 4) or 0x0 (divide by 1)
-;     <o.2>  NMI_DIS
-;       <0=> NMI interrupts are always blocked
-;       <1=> NMI pin/interrupts reset default to enabled
-;     <o.3>  RESET_PIN_CFG
-;       <0=> RESET pin is disabled following a POR and cannot be enabled as RESET function
-;       <1=> RESET pin is dedicated
-;     <o.3>  FAST_INIT
-;       <0=> Slower initialization
-;       <1=> Fast Initialization
-FOPT            EQU     0xFF
-;   </h>
-;   <h> Flash security byte (FSEC)
-;     <i> WARNING: If SEC field is configured as "MCU security status is secure" and MEEN field is configured as "Mass erase is disabled",
-;     <i> MCU's security status cannot be set back to unsecure state since Mass erase via the debugger is blocked !!!
-;     <o.0..1> SEC
-;       <2=> MCU security status is unsecure
-;       <3=> MCU security status is secure
-;         <i> Flash Security
-;         <i> This bits define the security state of the MCU.
-;     <o.2..3> FSLACC
-;       <2=> Freescale factory access denied
-;       <3=> Freescale factory access granted
-;         <i> Freescale Failure Analysis Access Code
-;         <i> This bits define the security state of the MCU.
-;     <o.4..5> MEEN
-;       <2=> Mass erase is disabled
-;       <3=> Mass erase is enabled
-;         <i> Mass Erase Enable Bits
-;         <i> Enables and disables mass erase capability of the FTFL module
-;     <o.6..7> KEYEN
-;       <2=> Backdoor key access enabled
-;       <3=> Backdoor key access disabled
-;         <i> Backdoor key Security Enable
-;         <i> These bits enable and disable backdoor key access to the FTFL module.
-FSEC            EQU     0xFE
-;   </h>
-
-                IF      :LNOT::DEF:RAM_TARGET
-                AREA    |.ARM.__at_0x400|, CODE, READONLY
-                DCB     BackDoorK0, BackDoorK1, BackDoorK2, BackDoorK3
-                DCB     BackDoorK4, BackDoorK5, BackDoorK6, BackDoorK7
-                DCB     FPROT0,     FPROT1,     FPROT2,     FPROT3
-                DCB     FSEC,       FOPT,       0xFF,     0xFF
-                ENDIF
-
-                AREA    |.text|, CODE, READONLY
-
-
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-
-; Dummy Exception Handlers (infinite loops which can be modified)
-
-NMI_Handler     PROC
-                EXPORT  NMI_Handler               [WEAK]
-                B       .
-                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-                EXPORT  DMA0_IRQHandler     [WEAK]
-                EXPORT  DMA1_IRQHandler     [WEAK]
-                EXPORT  DMA2_IRQHandler     [WEAK]
-                EXPORT  DMA3_IRQHandler     [WEAK]
-                EXPORT  Reserved20_IRQHandler     [WEAK]
-                EXPORT  FTFA_IRQHandler     [WEAK]
-                EXPORT  LVD_LVW_IRQHandler     [WEAK]
-                EXPORT  LLW_IRQHandler     [WEAK]
-                EXPORT  I2C0_IRQHandler     [WEAK]
-                EXPORT  I2C1_IRQHandler     [WEAK]
-                EXPORT  SPI0_IRQHandler     [WEAK]
-                EXPORT  SPI1_IRQHandler     [WEAK]
-                EXPORT  UART0_IRQHandler     [WEAK]
-                EXPORT  UART1_IRQHandler     [WEAK]
-                EXPORT  UART2_IRQHandler     [WEAK]
-                EXPORT  ADC0_IRQHandler     [WEAK]
-                EXPORT  CMP0_IRQHandler     [WEAK]
-                EXPORT  TPM0_IRQHandler     [WEAK]
-                EXPORT  TPM1_IRQHandler     [WEAK]
-                EXPORT  TPM2_IRQHandler     [WEAK]
-                EXPORT  RTC_IRQHandler     [WEAK]
-                EXPORT  RTC_Seconds_IRQHandler     [WEAK]
-                EXPORT  PIT_IRQHandler     [WEAK]
-                EXPORT  Reserved39_IRQHandler     [WEAK]
-                EXPORT  USB0_IRQHandler     [WEAK]
-                EXPORT  DAC0_IRQHandler     [WEAK]
-                EXPORT  TSI0_IRQHandler     [WEAK]
-                EXPORT  MCG_IRQHandler     [WEAK]
-                EXPORT  LPTimer_IRQHandler     [WEAK]
-                EXPORT  Reserved45_IRQHandler     [WEAK]
-                EXPORT  PORTA_IRQHandler     [WEAK]
-                EXPORT  PORTD_IRQHandler     [WEAK]
-                EXPORT  DefaultISR                      [WEAK]
-
-DMA0_IRQHandler
-DMA1_IRQHandler
-DMA2_IRQHandler
-DMA3_IRQHandler
-Reserved20_IRQHandler
-FTFA_IRQHandler
-LVD_LVW_IRQHandler
-LLW_IRQHandler
-I2C0_IRQHandler
-I2C1_IRQHandler
-SPI0_IRQHandler
-SPI1_IRQHandler
-UART0_IRQHandler
-UART1_IRQHandler
-UART2_IRQHandler
-ADC0_IRQHandler
-CMP0_IRQHandler
-TPM0_IRQHandler
-TPM1_IRQHandler
-TPM2_IRQHandler
-RTC_IRQHandler
-RTC_Seconds_IRQHandler
-PIT_IRQHandler
-Reserved39_IRQHandler
-USB0_IRQHandler
-DAC0_IRQHandler
-TSI0_IRQHandler
-MCG_IRQHandler
-LPTimer_IRQHandler
-Reserved45_IRQHandler
-PORTA_IRQHandler
-PORTD_IRQHandler
-DefaultISR
-
-                B       .
-
-                ENDP
-
-
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_ARM_MICRO/sys.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library - stackheap
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * Setup a fixed single stack/heap memory model, 
- *  between the top of the RW/ZI region and the stackpointer
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-#include <rt_misc.h>
-#include <stdint.h>
-
-extern char Image$$RW_IRAM1$$ZI$$Limit[];
-
-extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
-    uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
-    uint32_t sp_limit = __current_sp();
-
-    zi_limit = (zi_limit + 7) & ~0x7;    // ensure zi_limit is 8-byte aligned
-
-    struct __initial_stackheap r;
-    r.heap_base = zi_limit;
-    r.heap_limit = sp_limit;
-    return r;
-}
-
-#ifdef __cplusplus
-}
-#endif 
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_ARM_STD/MKL25Z4.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-
-LR_IROM1 0x00000000 0x20000  {    ; load region size_region (32k)
-  ER_IROM1 0x00000000 0x20000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  ; 8_byte_aligned(48 vect * 4 bytes) =  8_byte_aligned(0xC0) = 0xC0
-  ; 0x4000 - 0xC0 = 0x3F40
-  RW_IRAM1 0x1FFFF0C0 0x3F40 {
-   .ANY (+RW +ZI)
-  }
-}
-
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_ARM_STD/startup_MKL25Z4.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,332 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_MKL25Z4.s
-; * @purpose: CMSIS Cortex-M0plus Core Device Startup File for the
-; *           MKL25Z4
-; * @version: 1.1
-; * @date:    2012-6-21
-; *
-; * Copyright: 1997 - 2012 Freescale Semiconductor, Inc. All Rights Reserved.
-;*
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; *****************************************************************************/
-
-
-__initial_sp        EQU     0x20003000  ; Top of RAM
-
-                PRESERVE8
-                THUMB
-
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-                EXPORT  __Vectors_End
-                EXPORT  __Vectors_Size
-
-__Vectors       DCD     __initial_sp  ; Top of Stack
-                DCD     Reset_Handler  ; Reset Handler
-                DCD     NMI_Handler  ; NMI Handler
-                DCD     HardFault_Handler  ; Hard Fault Handler
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     SVC_Handler  ; SVCall Handler
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     PendSV_Handler  ; PendSV Handler
-                DCD     SysTick_Handler  ; SysTick Handler
-
-                ; External Interrupts
-                DCD     DMA0_IRQHandler  ; DMA channel 0 transfer complete interrupt
-                DCD     DMA1_IRQHandler  ; DMA channel 1 transfer complete interrupt
-                DCD     DMA2_IRQHandler  ; DMA channel 2 transfer complete interrupt
-                DCD     DMA3_IRQHandler  ; DMA channel 3 transfer complete interrupt
-                DCD     Reserved20_IRQHandler  ; Reserved interrupt 20
-                DCD     FTFA_IRQHandler  ; FTFA interrupt
-                DCD     LVD_LVW_IRQHandler  ; Low Voltage Detect, Low Voltage Warning
-                DCD     LLW_IRQHandler  ; Low Leakage Wakeup
-                DCD     I2C0_IRQHandler  ; I2C0 interrupt
-                DCD     I2C1_IRQHandler  ; I2C0 interrupt 25
-                DCD     SPI0_IRQHandler  ; SPI0 interrupt
-                DCD     SPI1_IRQHandler  ; SPI1 interrupt
-                DCD     UART0_IRQHandler  ; UART0 status/error interrupt
-                DCD     UART1_IRQHandler  ; UART1 status/error interrupt
-                DCD     UART2_IRQHandler  ; UART2 status/error interrupt
-                DCD     ADC0_IRQHandler  ; ADC0 interrupt
-                DCD     CMP0_IRQHandler  ; CMP0 interrupt
-                DCD     TPM0_IRQHandler  ; TPM0 fault, overflow and channels interrupt
-                DCD     TPM1_IRQHandler  ; TPM1 fault, overflow and channels interrupt
-                DCD     TPM2_IRQHandler  ; TPM2 fault, overflow and channels interrupt
-                DCD     RTC_IRQHandler  ; RTC interrupt
-                DCD     RTC_Seconds_IRQHandler  ; RTC seconds interrupt
-                DCD     PIT_IRQHandler  ; PIT timer interrupt
-                DCD     Reserved39_IRQHandler  ; Reserved interrupt 39
-                DCD     USB0_IRQHandler  ; USB0 interrupt
-                DCD     DAC0_IRQHandler  ; DAC interrupt
-                DCD     TSI0_IRQHandler  ; TSI0 interrupt
-                DCD     MCG_IRQHandler  ; MCG interrupt
-                DCD     LPTimer_IRQHandler  ; LPTimer interrupt
-                DCD     Reserved45_IRQHandler  ; Reserved interrupt 45
-                DCD     PORTA_IRQHandler  ; Port A interrupt
-                DCD     PORTD_IRQHandler  ; Port D interrupt
-__Vectors_End
-
-__Vectors_Size 	EQU     __Vectors_End - __Vectors
-
-; <h> Flash Configuration
-;   <i> 16-byte flash configuration field that stores default protection settings (loaded on reset)
-;   <i> and security information that allows the MCU to restrict acces to the FTFL module.
-;   <h> Backdoor Comparison Key
-;     <o0>  Backdoor Key 0  <0x0-0xFF:2>
-;     <o1>  Backdoor Key 1  <0x0-0xFF:2>
-;     <o2>  Backdoor Key 2  <0x0-0xFF:2>
-;     <o3>  Backdoor Key 3  <0x0-0xFF:2>
-;     <o4>  Backdoor Key 4  <0x0-0xFF:2>
-;     <o5>  Backdoor Key 5  <0x0-0xFF:2>
-;     <o6>  Backdoor Key 6  <0x0-0xFF:2>
-;     <o7>  Backdoor Key 7  <0x0-0xFF:2>
-BackDoorK0      EQU     0xFF
-BackDoorK1      EQU     0xFF
-BackDoorK2      EQU     0xFF
-BackDoorK3      EQU     0xFF
-BackDoorK4      EQU     0xFF
-BackDoorK5      EQU     0xFF
-BackDoorK6      EQU     0xFF
-BackDoorK7      EQU     0xFF
-;   </h>
-;   <h> Program flash protection bytes (FPROT)
-;     <i> Each program flash region can be protected from program and erase operation by setting the associated PROT bit.
-;     <i> Each bit protects a 1/32 region of the program flash memory.
-;     <h> FPROT0
-;       <i> Program flash protection bytes
-;       <i> 1/32 - 8/32 region
-;       <o.0>   FPROT0.0
-;       <o.1>   FPROT0.1
-;       <o.2>   FPROT0.2
-;       <o.3>   FPROT0.3
-;       <o.4>   FPROT0.4
-;       <o.5>   FPROT0.5
-;       <o.6>   FPROT0.6
-;       <o.7>   FPROT0.7
-nFPROT0         EQU     0x00
-FPROT0          EQU     nFPROT0:EOR:0xFF
-;     </h>
-;     <h> FPROT1
-;       <i> Program Flash Region Protect Register 1
-;       <i> 9/32 - 16/32 region
-;       <o.0>   FPROT1.0
-;       <o.1>   FPROT1.1
-;       <o.2>   FPROT1.2
-;       <o.3>   FPROT1.3
-;       <o.4>   FPROT1.4
-;       <o.5>   FPROT1.5
-;       <o.6>   FPROT1.6
-;       <o.7>   FPROT1.7
-nFPROT1         EQU     0x00
-FPROT1          EQU     nFPROT1:EOR:0xFF
-;     </h>
-;     <h> FPROT2
-;       <i> Program Flash Region Protect Register 2
-;       <i> 17/32 - 24/32 region
-;       <o.0>   FPROT2.0
-;       <o.1>   FPROT2.1
-;       <o.2>   FPROT2.2
-;       <o.3>   FPROT2.3
-;       <o.4>   FPROT2.4
-;       <o.5>   FPROT2.5
-;       <o.6>   FPROT2.6
-;       <o.7>   FPROT2.7
-nFPROT2         EQU     0x00
-FPROT2          EQU     nFPROT2:EOR:0xFF
-;     </h>
-;     <h> FPROT3
-;       <i> Program Flash Region Protect Register 3
-;       <i> 25/32 - 32/32 region
-;       <o.0>   FPROT3.0
-;       <o.1>   FPROT3.1
-;       <o.2>   FPROT3.2
-;       <o.3>   FPROT3.3
-;       <o.4>   FPROT3.4
-;       <o.5>   FPROT3.5
-;       <o.6>   FPROT3.6
-;       <o.7>   FPROT3.7
-nFPROT3         EQU     0x00
-FPROT3          EQU     nFPROT3:EOR:0xFF
-;     </h>
-;   </h>
-;   </h>
-;   <h> Flash nonvolatile option byte (FOPT)
-;     <i> Allows the user to customize the operation of the MCU at boot time.
-;     <o.0>  LPBOOT0
-;       <0=> Core and system clock divider (OUTDIV1) is 0x7 (divide by 8) or 0x3 (divide by 4)
-;       <1=> Core and system clock divider (OUTDIV1) is 0x1 (divide by 2) or 0x0 (divide by 1)
-;     <o.4>  LPBOOT1
-;       <0=> Core and system clock divider (OUTDIV1) is 0x7 (divide by 8) or 0x1 (divide by 2)
-;       <1=> Core and system clock divider (OUTDIV1) is 0x3 (divide by 4) or 0x0 (divide by 1)
-;     <o.2>  NMI_DIS
-;       <0=> NMI interrupts are always blocked
-;       <1=> NMI pin/interrupts reset default to enabled
-;     <o.3>  RESET_PIN_CFG
-;       <0=> RESET pin is disabled following a POR and cannot be enabled as RESET function
-;       <1=> RESET pin is dedicated
-;     <o.3>  FAST_INIT
-;       <0=> Slower initialization
-;       <1=> Fast Initialization
-FOPT            EQU     0xFF
-;   </h>
-;   <h> Flash security byte (FSEC)
-;     <i> WARNING: If SEC field is configured as "MCU security status is secure" and MEEN field is configured as "Mass erase is disabled",
-;     <i> MCU's security status cannot be set back to unsecure state since Mass erase via the debugger is blocked !!!
-;     <o.0..1> SEC
-;       <2=> MCU security status is unsecure
-;       <3=> MCU security status is secure
-;         <i> Flash Security
-;         <i> This bits define the security state of the MCU.
-;     <o.2..3> FSLACC
-;       <2=> Freescale factory access denied
-;       <3=> Freescale factory access granted
-;         <i> Freescale Failure Analysis Access Code
-;         <i> This bits define the security state of the MCU.
-;     <o.4..5> MEEN
-;       <2=> Mass erase is disabled
-;       <3=> Mass erase is enabled
-;         <i> Mass Erase Enable Bits
-;         <i> Enables and disables mass erase capability of the FTFL module
-;     <o.6..7> KEYEN
-;       <2=> Backdoor key access enabled
-;       <3=> Backdoor key access disabled
-;         <i> Backdoor key Security Enable
-;         <i> These bits enable and disable backdoor key access to the FTFL module.
-FSEC            EQU     0xFE
-;   </h>
-
-                IF      :LNOT::DEF:RAM_TARGET
-                AREA    |.ARM.__at_0x400|, CODE, READONLY
-                DCB     BackDoorK0, BackDoorK1, BackDoorK2, BackDoorK3
-                DCB     BackDoorK4, BackDoorK5, BackDoorK6, BackDoorK7
-                DCB     FPROT0,     FPROT1,     FPROT2,     FPROT3
-                DCB     FSEC,       FOPT,       0xFF,     0xFF
-                ENDIF
-
-                AREA    |.text|, CODE, READONLY
-
-
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-
-; Dummy Exception Handlers (infinite loops which can be modified)
-
-NMI_Handler     PROC
-                EXPORT  NMI_Handler               [WEAK]
-                B       .
-                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-                EXPORT  DMA0_IRQHandler     [WEAK]
-                EXPORT  DMA1_IRQHandler     [WEAK]
-                EXPORT  DMA2_IRQHandler     [WEAK]
-                EXPORT  DMA3_IRQHandler     [WEAK]
-                EXPORT  Reserved20_IRQHandler     [WEAK]
-                EXPORT  FTFA_IRQHandler     [WEAK]
-                EXPORT  LVD_LVW_IRQHandler     [WEAK]
-                EXPORT  LLW_IRQHandler     [WEAK]
-                EXPORT  I2C0_IRQHandler     [WEAK]
-                EXPORT  I2C1_IRQHandler     [WEAK]
-                EXPORT  SPI0_IRQHandler     [WEAK]
-                EXPORT  SPI1_IRQHandler     [WEAK]
-                EXPORT  UART0_IRQHandler     [WEAK]
-                EXPORT  UART1_IRQHandler     [WEAK]
-                EXPORT  UART2_IRQHandler     [WEAK]
-                EXPORT  ADC0_IRQHandler     [WEAK]
-                EXPORT  CMP0_IRQHandler     [WEAK]
-                EXPORT  TPM0_IRQHandler     [WEAK]
-                EXPORT  TPM1_IRQHandler     [WEAK]
-                EXPORT  TPM2_IRQHandler     [WEAK]
-                EXPORT  RTC_IRQHandler     [WEAK]
-                EXPORT  RTC_Seconds_IRQHandler     [WEAK]
-                EXPORT  PIT_IRQHandler     [WEAK]
-                EXPORT  Reserved39_IRQHandler     [WEAK]
-                EXPORT  USB0_IRQHandler     [WEAK]
-                EXPORT  DAC0_IRQHandler     [WEAK]
-                EXPORT  TSI0_IRQHandler     [WEAK]
-                EXPORT  MCG_IRQHandler     [WEAK]
-                EXPORT  LPTimer_IRQHandler     [WEAK]
-                EXPORT  Reserved45_IRQHandler     [WEAK]
-                EXPORT  PORTA_IRQHandler     [WEAK]
-                EXPORT  PORTD_IRQHandler     [WEAK]
-                EXPORT  DefaultISR                      [WEAK]
-
-DMA0_IRQHandler
-DMA1_IRQHandler
-DMA2_IRQHandler
-DMA3_IRQHandler
-Reserved20_IRQHandler
-FTFA_IRQHandler
-LVD_LVW_IRQHandler
-LLW_IRQHandler
-I2C0_IRQHandler
-I2C1_IRQHandler
-SPI0_IRQHandler
-SPI1_IRQHandler
-UART0_IRQHandler
-UART1_IRQHandler
-UART2_IRQHandler
-ADC0_IRQHandler
-CMP0_IRQHandler
-TPM0_IRQHandler
-TPM1_IRQHandler
-TPM2_IRQHandler
-RTC_IRQHandler
-RTC_Seconds_IRQHandler
-PIT_IRQHandler
-Reserved39_IRQHandler
-USB0_IRQHandler
-DAC0_IRQHandler
-TSI0_IRQHandler
-MCG_IRQHandler
-LPTimer_IRQHandler
-Reserved45_IRQHandler
-PORTA_IRQHandler
-PORTD_IRQHandler
-DefaultISR
-
-                B       .
-
-                ENDP
-
-
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_ARM_STD/sys.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library - stackheap
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * Setup a fixed single stack/heap memory model, 
- *  between the top of the RW/ZI region and the stackpointer
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-#include <rt_misc.h>
-#include <stdint.h>
-
-extern char Image$$RW_IRAM1$$ZI$$Limit[];
-
-extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
-    uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
-    uint32_t sp_limit = __current_sp();
-
-    zi_limit = (zi_limit + 7) & ~0x7;    // ensure zi_limit is 8-byte aligned
-
-    struct __initial_stackheap r;
-    r.heap_base = zi_limit;
-    r.heap_limit = sp_limit;
-    return r;
-}
-
-#ifdef __cplusplus
-}
-#endif 
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_GCC_ARM/MKL25Z4.ld	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +0,0 @@
-/*
- * KL25Z ARM GCC linker script file
- */
-
-MEMORY
-{
-  VECTORS (rx) : ORIGIN = 0x00000000, LENGTH = 0x00000400
-  FLASH_PROTECTION	(rx) : ORIGIN = 0x00000400, LENGTH = 0x00000010
-  FLASH (rx) : ORIGIN = 0x00000410, LENGTH = 128K - 0x00000410
-  RAM (rwx) : ORIGIN = 0x1FFFF0C0, LENGTH = 16K - 0xC0
-}
-
-/* Linker script to place sections and symbol values. Should be used together
- * with other linker script that defines memory regions FLASH and RAM.
- * It references following symbols, which must be defined in code:
- * _reset_init : Entry of reset handler
- *
- * It defines following symbols, which code can use without definition:
- * __exidx_start
- * __exidx_end
- * __etext
- * __data_start__
- * __preinit_array_start
- * __preinit_array_end
- * __init_array_start
- * __init_array_end
- * __fini_array_start
- * __fini_array_end
- * __data_end__
- * __bss_start__
- * __bss_end__
- * __end__
- * end
- * __HeapLimit
- * __StackLimit
- * __StackTop
- * __stack
- */
-ENTRY(Reset_Handler)
-
-SECTIONS
-{
-    .isr_vector :
-    {
-        __vector_table = .;
-        KEEP(*(.vector_table))
-        *(.text.Reset_Handler)
-        *(.text.System_Init)
-         . = ALIGN(4);
-    } > VECTORS
-
-    .flash_protect :
-    {
-        KEEP(*(.kinetis_flash_config_field))
-         . = ALIGN(4);
-    } > FLASH_PROTECTION
-
-    .text :
-    {
-        *(.text*)
-
-        KEEP(*(.init))
-        KEEP(*(.fini))
-
-        /* .ctors */
-        *crtbegin.o(.ctors)
-        *crtbegin?.o(.ctors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
-        *(SORT(.ctors.*))
-        *(.ctors)
-
-        /* .dtors */
-        *crtbegin.o(.dtors)
-        *crtbegin?.o(.dtors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
-        *(SORT(.dtors.*))
-        *(.dtors)
-
-        *(.rodata*)
-
-        KEEP(*(.eh_frame*))
-    } > FLASH
-
-    .ARM.extab :
-    {
-        *(.ARM.extab* .gnu.linkonce.armextab.*)
-    } > FLASH
-
-    __exidx_start = .;
-    .ARM.exidx :
-    {
-        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-    } > FLASH
-    __exidx_end = .;
-
-    __etext = .;
-
-    .data : AT (__etext)
-    {
-        __data_start__ = .;
-        *(vtable)
-        *(.data*)
-
-        . = ALIGN(4);
-        /* preinit data */
-        PROVIDE_HIDDEN (__preinit_array_start = .);
-        KEEP(*(.preinit_array))
-        PROVIDE_HIDDEN (__preinit_array_end = .);
-
-        . = ALIGN(4);
-        /* init data */
-        PROVIDE_HIDDEN (__init_array_start = .);
-        KEEP(*(SORT(.init_array.*)))
-        KEEP(*(.init_array))
-        PROVIDE_HIDDEN (__init_array_end = .);
-
-
-        . = ALIGN(4);
-        /* finit data */
-        PROVIDE_HIDDEN (__fini_array_start = .);
-        KEEP(*(SORT(.fini_array.*)))
-        KEEP(*(.fini_array))
-        PROVIDE_HIDDEN (__fini_array_end = .);
-
-        . = ALIGN(4);
-        /* All data end */
-        __data_end__ = .;
-
-    } > RAM
-
-    .bss :
-    {
-        __bss_start__ = .;
-        *(.bss*)
-        *(COMMON)
-        __bss_end__ = .;
-    } > RAM
-
-    .heap :
-    {
-        __end__ = .;
-        end = __end__;
-        *(.heap*)
-        __HeapLimit = .;
-    } > RAM
-
-    /* .stack_dummy section doesn't contains any symbols. It is only
-     * used for linker to calculate size of stack sections, and assign
-     * values to stack symbols later */
-    .stack_dummy :
-    {
-        *(.stack)
-    } > RAM
-
-    /* Set stack top to end of RAM, and stack limit move down by
-     * size of stack_dummy section */
-    __StackTop = ORIGIN(RAM) + LENGTH(RAM);
-    __StackLimit = __StackTop - SIZEOF(.stack_dummy);
-    PROVIDE(__stack = __StackTop);
-
-    /* Check if data + heap + stack exceeds RAM limit */
-    ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
-}
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_GCC_ARM/startup_MKL25Z4.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,236 +0,0 @@
-/* KL25Z startup ARM GCC
- * Purpose: startup file for Cortex-M0 devices. Should use with
- *   GCC for ARM Embedded Processors
- * Version: V1.2
- * Date: 15 Nov 2011
- *
- * Copyright (c) 2011, 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 the ARM Limited 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 ARM LIMITED 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.
- */
-    .syntax unified
-    .arch armv6-m
-
-/* Memory Model
-   The HEAP starts at the end of the DATA section and grows upward.
-
-   The STACK starts at the end of the RAM and grows downward.
-
-   The HEAP and stack STACK are only checked at compile time:
-   (DATA_SIZE + HEAP_SIZE + STACK_SIZE) < RAM_SIZE
-
-   This is just a check for the bare minimum for the Heap+Stack area before
-   aborting compilation, it is not the run time limit:
-   Heap_Size + Stack_Size = 0x80 + 0x80 = 0x100
- */
-    .section .stack
-    .align 3
-#ifdef __STACK_SIZE
-    .equ    Stack_Size, __STACK_SIZE
-#else
-    .equ    Stack_Size, 0x80
-#endif
-    .globl    __StackTop
-    .globl    __StackLimit
-__StackLimit:
-    .space    Stack_Size
-    .size __StackLimit, . - __StackLimit
-__StackTop:
-    .size __StackTop, . - __StackTop
-
-    .section .heap
-    .align 3
-#ifdef __HEAP_SIZE
-    .equ    Heap_Size, __HEAP_SIZE
-#else
-    .equ    Heap_Size, 0x80
-#endif
-    .globl    __HeapBase
-    .globl    __HeapLimit
-__HeapBase:
-    .space    Heap_Size
-    .size __HeapBase, . - __HeapBase
-__HeapLimit:
-    .size __HeapLimit, . - __HeapLimit
-
-    .section .vector_table,"a",%progbits
-    .align 2
-    .globl __isr_vector
-__isr_vector:
-    .long    __StackTop            /* Top of Stack */
-    .long    Reset_Handler         /* Reset Handler */
-    .long    NMI_Handler           /* NMI Handler */
-    .long    HardFault_Handler     /* Hard Fault Handler */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    SVC_Handler           /* SVCall Handler */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    PendSV_Handler        /* PendSV Handler */
-    .long    SysTick_Handler       /* SysTick Handler */
-
-    /* External interrupts */
-    .long   DMA0_IRQHandler         /* DMA channel 0 transfer complete interrupt */
-    .long   DMA1_IRQHandler         /* DMA channel 1 transfer complete interrupt */
-    .long   DMA2_IRQHandler         /* DMA channel 2 transfer complete interrupt */
-    .long   DMA3_IRQHandler         /* DMA channel 3 transfer complete interrupt */
-    .long   Default_Handler         /* Reserved interrupt 20 */
-    .long   FTFA_IRQHandler         /* FTFA interrupt */
-    .long   LVD_LVW_IRQHandler      /* Low Voltage Detect, Low Voltage Warning */
-    .long   LLW_IRQHandler          /* Low Leakage Wakeup */
-    .long   I2C0_IRQHandler         /* I2C0 interrupt */
-    .long   I2C1_IRQHandler         /* I2C0 interrupt 25 */
-    .long   SPI0_IRQHandler         /* SPI0 interrupt */
-    .long   SPI1_IRQHandler         /* SPI1 interrupt */
-    .long   UART0_IRQHandler        /* UART0 status/error interrupt */
-    .long   UART1_IRQHandler        /* UART1 status/error interrupt */
-    .long   UART2_IRQHandler        /* UART2 status/error interrupt */
-    .long   ADC0_IRQHandler         /* ADC0 interrupt */
-    .long   CMP0_IRQHandler         /* CMP0 interrupt */
-    .long   TPM0_IRQHandler         /* TPM0 fault, overflow and channels interrupt */
-    .long   TPM1_IRQHandler         /* TPM1 fault, overflow and channels interrupt */
-    .long   TPM2_IRQHandler         /* TPM2 fault, overflow and channels interrupt */
-    .long   RTC_IRQHandler          /* RTC interrupt */
-    .long   RTC_Seconds_IRQHandler  /* RTC seconds interrupt */
-    .long   PIT_IRQHandler          /* PIT timer interrupt */
-    .long   Default_Handler         /* Reserved interrupt 39 */
-    .long   USB0_IRQHandler         /* USB0 interrupt */
-    .long   DAC0_IRQHandler         /* DAC interrupt */
-    .long   TSI0_IRQHandler         /* TSI0 interrupt */
-    .long   MCG_IRQHandler          /* MCG interrupt */
-    .long   LPTimer_IRQHandler      /* LPTimer interrupt */
-    .long   Default_Handler         /* Reserved interrupt 45 */
-    .long   PORTA_IRQHandler        /* Port A interrupt */
-    .long   PORTD_IRQHandler        /* Port D interrupt */
-
-    .size    __isr_vector, . - __isr_vector
-
-    .section .text.Reset_Handler
-    .thumb
-    .thumb_func
-    .align 2
-    .globl    Reset_Handler
-    .type    Reset_Handler, %function
-Reset_Handler:
-/*     Loop to copy data from read only memory to RAM. The ranges
- *      of copy from/to are specified by following symbols evaluated in
- *      linker script.
- *      __etext: End of code section, i.e., begin of data sections to copy from.
- *      __data_start__/__data_end__: RAM address range that data should be
- *      copied to. Both must be aligned to 4 bytes boundary.  */
-
-    ldr    r1, =__etext
-    ldr    r2, =__data_start__
-    ldr    r3, =__data_end__
-
-    subs    r3, r2
-    ble    .flash_to_ram_loop_end
-
-    movs    r4, 0
-.flash_to_ram_loop:
-    ldr    r0, [r1,r4]
-    str    r0, [r2,r4]
-    adds    r4, 4
-    cmp    r4, r3
-    blt    .flash_to_ram_loop
-.flash_to_ram_loop_end:
-
-    ldr    r0, =SystemInit
-    blx    r0
-    ldr    r0, =_start
-    bx    r0
-    .pool
-    .size Reset_Handler, . - Reset_Handler
-
-    .text
-/*    Macro to define default handlers. Default handler
- *    will be weak symbol and just dead loops. They can be
- *    overwritten by other handlers */
-    .macro    def_default_handler    handler_name
-    .align 1
-    .thumb_func
-    .weak    \handler_name
-    .type    \handler_name, %function
-\handler_name :
-    b    .
-    .size    \handler_name, . - \handler_name
-    .endm
-
-    def_default_handler     NMI_Handler
-    def_default_handler     HardFault_Handler
-    def_default_handler     SVC_Handler
-    def_default_handler     PendSV_Handler
-    def_default_handler     SysTick_Handler
-    def_default_handler     Default_Handler
-
-    def_default_handler     DMA0_IRQHandler
-    def_default_handler     DMA1_IRQHandler
-    def_default_handler     DMA2_IRQHandler
-    def_default_handler     DMA3_IRQHandler
-    def_default_handler     FTFA_IRQHandler
-    def_default_handler     LVD_LVW_IRQHandler
-    def_default_handler     LLW_IRQHandler
-    def_default_handler     I2C0_IRQHandler
-    def_default_handler     I2C1_IRQHandler
-    def_default_handler     SPI0_IRQHandler
-    def_default_handler     SPI1_IRQHandler
-    def_default_handler     UART0_IRQHandler
-    def_default_handler     UART1_IRQHandler
-    def_default_handler     UART2_IRQHandler
-    def_default_handler     ADC0_IRQHandler
-    def_default_handler     CMP0_IRQHandler
-    def_default_handler     TPM0_IRQHandler
-    def_default_handler     TPM1_IRQHandler
-    def_default_handler     TPM2_IRQHandler
-    def_default_handler     RTC_IRQHandler
-    def_default_handler     RTC_Seconds_IRQHandler
-    def_default_handler     PIT_IRQHandler
-    def_default_handler     USB0_IRQHandler
-    def_default_handler     DAC0_IRQHandler
-    def_default_handler     TSI0_IRQHandler
-    def_default_handler     MCG_IRQHandler
-    def_default_handler     LPTimer_IRQHandler
-    def_default_handler     PORTA_IRQHandler
-    def_default_handler     PORTD_IRQHandler
-
-    .weak   DEF_IRQHandler
-    .set    DEF_IRQHandler, Default_Handler
-
-/* Flash protection region, placed at 0x400 */
-    .text
-    .thumb
-    .align 2
-    .section .kinetis_flash_config_field,"a",%progbits
-kinetis_flash_config:
-    .long 0xffffffff
-    .long 0xffffffff
-    .long 0xffffffff
-    .long 0xfffffffe
-
-    .end
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_GCC_CW_EWL/MKL25Z4.ld	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,197 +0,0 @@
-/*
-*****************************************************************************
-**
-**  File        : KL25Z128M4_flash.ld
-**
-**  Default linker command file for Flash targets
-**
-*****************************************************************************
-*/
-/* Entry Point */
-ENTRY(__thumb_startup)
-
-/* Highest address of the user mode stack */
-_estack = 0x20003000;    /* end of SRAM */
-__SP_INIT = _estack;
-
-/* Generate a link error if heap and stack don't fit into RAM */
-__heap_size = 0x400;				/* required amount of heap  */
-__stack_size = 0x400; 				/* required amount of stack */
-
-/* Specify the memory areas */
-MEMORY
-{
-  m_interrupts	(rx) : ORIGIN = 0x00000000, LENGTH = 0xC0
-  m_cfmprotrom 	(rx) : ORIGIN = 0x00000400, LENGTH = 0x10
-  m_text 		(rx) : ORIGIN = 0x00000800, LENGTH = 128K - 0x800
-  m_data 	   (rwx) : ORIGIN = 0x1FFFF000, LENGTH = 16K		/* SRAM */
-}
-
-		
-/* Define output sections */
-SECTIONS
-{
-  /* The startup code goes first into Flash */
-  .interrupts :
-  {
-	__vector_table = .;
-    . = ALIGN(4);
-    KEEP(*(.vectortable)) /* Startup code */
-    . = ALIGN(4);
-  } > m_interrupts
-  
-  .cfmprotect :
-  {
-    . = ALIGN(4);
-	KEEP(*(.cfmconfig))	/* Flash Configuration Field (FCF) */
-	. = ALIGN(4);
-  } > m_cfmprotrom
-
-  /* The program code and other data goes into Flash */
-  .text :
-  {
-    . = ALIGN(4);
-    *(.text)           /* .text sections (code) */
-    *(.text*)          /* .text* sections (code) */
-    *(.rodata)         /* .rodata sections (constants, strings, etc.) */
-    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
-    *(.glue_7)         /* glue arm to thumb code */
-    *(.glue_7t)        /* glue thumb to arm code */
-    *(.eh_frame)
-
-    KEEP (*(.init))
-    KEEP (*(.fini))
-
-    . = ALIGN(4);
-    _etext = .;        /* define a global symbols at end of code */
-  } > m_text
-
-  .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } > m_text
-  .ARM : {
-    __exidx_start = .;
-      *(.ARM.exidx*)
-      __exidx_end = .;
-  } > m_text
-  
-  .ctors :
-  {
-    __CTOR_LIST__ = .;
-    /* gcc uses crtbegin.o to find the start of
-       the constructors, so we make sure it is
-       first.  Because this is a wildcard, it
-       doesn't matter if the user does not
-       actually link against crtbegin.o; the
-       linker won't look for a file to match a
-       wildcard.  The wildcard also means that it
-       doesn't matter which directory crtbegin.o
-       is in.  */
-    KEEP (*crtbegin.o(.ctors))
-    /* We don't want to include the .ctor section from
-       from the crtend.o file until after the sorted ctors.
-       The .ctor section from the crtend file contains the
-       end of ctors marker and it must be last */
-    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
-    KEEP (*(SORT(.ctors.*)))
-    KEEP (*(.ctors))
-    __CTOR_END__ = .;
-  } > m_text  
-  .dtors :
-  {
-    __DTOR_LIST__ = .;
-    KEEP (*crtbegin.o(.dtors))
-    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
-    KEEP (*(SORT(.dtors.*)))
-    KEEP (*(.dtors))
-    __DTOR_END__ = .;
-  } > m_text  
-
-  .preinit_array :
-  {
-    PROVIDE_HIDDEN (__preinit_array_start = .);
-    KEEP (*(.preinit_array*))
-    PROVIDE_HIDDEN (__preinit_array_end = .);
-  } > m_text
-  .init_array :
-  {
-    PROVIDE_HIDDEN (__init_array_start = .);
-    KEEP (*(SORT(.init_array.*)))
-    KEEP (*(.init_array*))
-    PROVIDE_HIDDEN (__init_array_end = .);
-  } > m_text
-  .fini_array :
-  {
-    PROVIDE_HIDDEN (__fini_array_start = .);
-    KEEP (*(SORT(.fini_array.*)))
-    KEEP (*(.fini_array*))
-    PROVIDE_HIDDEN (__fini_array_end = .);
-	
-	___ROM_AT = .;
-  } > m_text
-
-  /* reserve MTB memory at the beginning of m_data */
-  .mtb : /* MTB buffer address as defined by the hardware */
-  {
-    . = ALIGN(8);
-    _mtb_start = .;
-    KEEP(*(.mtb_buf)) /* need to KEEP Micro Trace Buffer as not referenced by application */
-    . = ALIGN(8);
-    _mtb_end = .;
-  } > m_data  
-
-  /* Initialized data sections goes into RAM, load LMA copy after code */
-  .data : AT(___ROM_AT)
-  {
-    . = ALIGN(4);
-    __sinit__ = .;
-    _sdata = .;        /* create a global symbol at data start */
-    *(.data)           /* .data sections */
-    *(.data*)          /* .data* sections */
-
-    . = ALIGN(4);
-    _edata = .;        /* define a global symbol at data end */
-  } > m_data
-  
-  ___data_size = _edata - _sdata;
-  
-  /* Uninitialized data section */
-  . = ALIGN(4);
-  .bss :
-  {
-    /* This is used by the startup in order to initialize the .bss section */
-    __START_BSS = .;
-	PROVIDE ( __bss_start__ = __START_BSS );
-    *(.bss)
-    *(.bss*)
-    *(COMMON)
-
-    . = ALIGN(4);
-    __END_BSS = .;
-	PROVIDE ( __bss_end__ = __END_BSS );
-  } > m_data
-
-  _romp_at = ___ROM_AT + SIZEOF(.data);
-  .romp : AT(_romp_at)
-  {
-	__S_romp = _romp_at;
-    LONG(___ROM_AT);
-    LONG(_sdata);
-    LONG(___data_size);
-    LONG(0);
-    LONG(0);
-    LONG(0);
-  } > m_data
- 
-  /* User_heap_stack section, used to check that there is enough RAM left */
-  ._user_heap_stack :
-  {
-    . = ALIGN(4);
-    PROVIDE ( end = . );
-    PROVIDE ( _end = . );
-	__heap_addr = .;
-    . = . + __heap_size;
-    . = . + __stack_size;
-    . = ALIGN(4);
-  } > m_data
-  
-  .ARM.attributes 0 : { *(.ARM.attributes) }
-}
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_GCC_CW_EWL/startup_MKL25Z4.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-#include <string.h>
-#include <stdlib.h>
-
-#include "cmsis.h"
-
-// Linker Script
-extern unsigned long _estack;
-extern char __S_romp[];
-
-extern char __START_BSS[];
-extern char __END_BSS[];
-
-// CRT0
-extern void __init_registers();
-extern void __copy_rom_sections_to_ram(void);
-extern void __call_static_initializers(void);
-extern void __init_user();
-
-// User/mbed Defined
-extern int main();
-extern void mbed_exit(int return_code);
-
-void _ExitProcess(int return_code) {
-    mbed_exit(return_code);
-}
-
-void __thumb_startup(void) {
-    // Setup registers
-    __init_registers();
-    
-    // Disable the Watchdog because it may reset the core before entering main().
-    SIM->COPC = 0x0;
-    
-    //  zero-fill the .bss section
-    memset(__START_BSS, 0, (__END_BSS - __START_BSS));
-    
-    if (__S_romp != 0L)
-        __copy_rom_sections_to_ram();
-    
-    //  call C++ static initializers
-    __call_static_initializers();
-    
-    // initializations before main, user specific
-    __init_user();
-    
-    exit(main());
-    
-    //  should never get here
-    while (1);
-}
-
-void Default_Handler() {
-    __asm("bkpt");
-}
-
-/* Weak definitions of handlers point to Default_Handler if not implemented */
-void NMI_Handler() __attribute__ ((weak, alias("Default_Handler")));
-void HardFault_Handler() __attribute__ ((weak, alias("Default_Handler")));
-void SVC_Handler() __attribute__ ((weak, alias("Default_Handler")));
-void PendSV_Handler() __attribute__ ((weak, alias("Default_Handler")));
-void SysTick_Handler() __attribute__ ((weak, alias("Default_Handler")));
-
-void DMA0_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void DMA1_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void DMA2_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void DMA3_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void MCM_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void FTFL_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void PMC_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void LLW_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void I2C0_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void I2C1_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void SPI0_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void SPI1_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void UART0_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void UART1_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void UART2_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void ADC0_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void CMP0_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void FTM0_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void FTM1_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void FTM2_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void RTC_Alarm_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void RTC_Seconds_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void PIT_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void USBOTG_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void DAC0_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void TSI0_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void MCG_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void LPTimer_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void PORTA_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-void PORTD_IRQHandler() __attribute__ ((weak, alias("Default_Handler")));
-
-/* The Interrupt Vector Table */
-void (* const InterruptVector[])() __attribute__ ((section(".vectortable"))) = {
-    /* Processor exceptions */
-    (void(*)(void)) &_estack,
-    __thumb_startup,
-    NMI_Handler,
-    HardFault_Handler,
-    0,
-    0,
-    0,
-    0,
-    0,
-    0,
-    0,
-    SVC_Handler,
-    0,
-    0,
-    PendSV_Handler,
-    SysTick_Handler,
-
-    /* Interrupts */
-    DMA0_IRQHandler, /* DMA Channel 0 Transfer Complete and Error */
-    DMA1_IRQHandler, /* DMA Channel 1 Transfer Complete and Error */
-    DMA2_IRQHandler, /* DMA Channel 2 Transfer Complete and Error */
-    DMA3_IRQHandler, /* DMA Channel 3 Transfer Complete and Error */
-    MCM_IRQHandler, /* Normal Interrupt */
-    FTFL_IRQHandler, /* FTFL Interrupt */
-    PMC_IRQHandler, /* PMC Interrupt */
-    LLW_IRQHandler, /* Low Leakage Wake-up */
-    I2C0_IRQHandler, /* I2C0 interrupt */
-    I2C1_IRQHandler, /* I2C1 interrupt */
-    SPI0_IRQHandler, /* SPI0 Interrupt */
-    SPI1_IRQHandler, /* SPI1 Interrupt */
-    UART0_IRQHandler, /* UART0 Status and Error interrupt */
-    UART1_IRQHandler, /* UART1 Status and Error interrupt */
-    UART2_IRQHandler, /* UART2 Status and Error interrupt */
-    ADC0_IRQHandler, /* ADC0 interrupt */
-    CMP0_IRQHandler, /* CMP0 interrupt */
-    FTM0_IRQHandler, /* FTM0 fault, overflow and channels interrupt */
-    FTM1_IRQHandler, /* FTM1 fault, overflow and channels interrupt */
-    FTM2_IRQHandler, /* FTM2 fault, overflow and channels interrupt */
-    RTC_Alarm_IRQHandler, /* RTC Alarm interrupt */
-    RTC_Seconds_IRQHandler, /* RTC Seconds interrupt */
-    PIT_IRQHandler, /* PIT timer all channels interrupt */
-    Default_Handler, /* Reserved interrupt 39/23 */
-    USBOTG_IRQHandler, /* USB interrupt */
-    DAC0_IRQHandler, /* DAC0 interrupt */
-    TSI0_IRQHandler, /* TSI0 Interrupt */
-    MCG_IRQHandler, /* MCG Interrupt */
-    LPTimer_IRQHandler, /* LPTimer interrupt */
-    Default_Handler, /* Reserved interrupt 45/29 */
-    PORTA_IRQHandler, /* Port A interrupt */
-    PORTD_IRQHandler /* Port D interrupt */
-};
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_GCC_CW_NEWLIB/MKL25Z4.ld	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-/* Linker script for mbed LPC1768 */
-
-/* Linker script to configure memory regions. */
-MEMORY
-{
-  FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 128K
-  RAM (rwx) : ORIGIN = 0x1FFFF0C0, LENGTH = 0x3F40
-}
-
-/* Linker script to place sections and symbol values. Should be used together
- * with other linker script that defines memory regions FLASH and RAM.
- * It references following symbols, which must be defined in code:
- *   Reset_Handler : Entry of reset handler
- * 
- * It defines following symbols, which code can use without definition:
- *   __exidx_start
- *   __exidx_end
- *   __etext
- *   __data_start__
- *   __preinit_array_start
- *   __preinit_array_end
- *   __init_array_start
- *   __init_array_end
- *   __fini_array_start
- *   __fini_array_end
- *   __data_end__
- *   __bss_start__
- *   __bss_end__
- *   __end__
- *   end
- *   __HeapLimit
- *   __StackLimit
- *   __StackTop
- *   __stack
- */
-ENTRY(Reset_Handler)
-
-SECTIONS
-{
-    .text :
-    {
-        KEEP(*(.isr_vector))
-        *(.text.Reset_Handler)
-        *(.text.SystemInit)
-        
-        /* Only vectors and code running at reset are safe to be in first 512
-           bytes since RAM can be mapped into this area for RAM based interrupt
-           vectors. */
-        . = 0x00000200;
-        *(.text*)
-
-        KEEP(*(.init))
-        KEEP(*(.fini))
-
-        /* .ctors */
-        *crtbegin.o(.ctors)
-        *crtbegin?.o(.ctors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
-        *(SORT(.ctors.*))
-        *(.ctors)
-
-        /* .dtors */
-        *crtbegin.o(.dtors)
-        *crtbegin?.o(.dtors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
-        *(SORT(.dtors.*))
-        *(.dtors)
-
-        *(.rodata*)
-
-        KEEP(*(.eh_frame*))
-    } > FLASH
-
-    .ARM.extab : 
-    {
-        *(.ARM.extab* .gnu.linkonce.armextab.*)
-    } > FLASH
-
-    __exidx_start = .;
-    .ARM.exidx :
-    {
-        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-    } > FLASH
-    __exidx_end = .;
-
-    __etext = .;
-        
-    .data : AT (__etext)
-    {
-        __data_start__ = .;
-        *(vtable)
-        *(.data*)
-
-        . = ALIGN(4);
-        /* preinit data */
-        PROVIDE (__preinit_array_start = .);
-        KEEP(*(.preinit_array))
-        PROVIDE (__preinit_array_end = .);
-
-        . = ALIGN(4);
-        /* init data */
-        PROVIDE (__init_array_start = .);
-        KEEP(*(SORT(.init_array.*)))
-        KEEP(*(.init_array))
-        PROVIDE (__init_array_end = .);
-
-
-        . = ALIGN(4);
-        /* finit data */
-        PROVIDE (__fini_array_start = .);
-        KEEP(*(SORT(.fini_array.*)))
-        KEEP(*(.fini_array))
-        PROVIDE (__fini_array_end = .);
-
-        . = ALIGN(4);
-        /* All data end */
-        __data_end__ = .;
-
-    } > RAM
-
-    .bss :
-    {
-        __bss_start__ = .;
-        *(.bss*)
-        *(COMMON)
-        __bss_end__ = .;
-    } > RAM
-    
-    .heap :
-    {
-        __end__ = .;
-        end = __end__;
-        *(.heap*)
-        __HeapLimit = .;
-    } > RAM
-
-    /* .stack_dummy section doesn't contains any symbols. It is only
-     * used for linker to calculate size of stack sections, and assign
-     * values to stack symbols later */
-    .stack_dummy :
-    {
-        *(.stack)
-    } > RAM
-
-    /* Set stack top to end of RAM, and stack limit move down by
-     * size of stack_dummy section */
-    __StackTop = ORIGIN(RAM) + LENGTH(RAM);
-    __StackLimit = __StackTop - SIZEOF(.stack_dummy);
-    PROVIDE(__stack = __StackTop);
-    
-    /* Check if data + heap + stack exceeds RAM limit */
-    ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
-}
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL25Z/TOOLCHAIN_GCC_CW_NEWLIB/startup_MKL25Z4.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,226 +0,0 @@
-/* File: startup_ARMCM0.S
- * Purpose: startup file for Cortex-M0 devices. Should use with 
- *   GCC for ARM Embedded Processors
- * Version: V1.2
- * Date: 15 Nov 2011
- * 
- * Copyright (c) 2011, 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 the ARM Limited 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 ARM LIMITED 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.
- */
-    .syntax unified
-    .arch armv6-m
-
-/* Memory Model
-   The HEAP starts at the end of the DATA section and grows upward.
-   
-   The STACK starts at the end of the RAM and grows downward.
-   
-   The HEAP and stack STACK are only checked at compile time:
-   (DATA_SIZE + HEAP_SIZE + STACK_SIZE) < RAM_SIZE
-   
-   This is just a check for the bare minimum for the Heap+Stack area before
-   aborting compilation, it is not the run time limit:
-   Heap_Size + Stack_Size = 0x80 + 0x80 = 0x100
- */
-    .section .stack
-    .align 3
-#ifdef __STACK_SIZE
-    .equ    Stack_Size, __STACK_SIZE
-#else
-    .equ    Stack_Size, 0x80
-#endif
-    .globl    __StackTop
-    .globl    __StackLimit
-__StackLimit:
-    .space    Stack_Size
-    .size __StackLimit, . - __StackLimit
-__StackTop:
-    .size __StackTop, . - __StackTop
-
-    .section .heap
-    .align 3
-#ifdef __HEAP_SIZE
-    .equ    Heap_Size, __HEAP_SIZE
-#else
-    .equ    Heap_Size, 0x80
-#endif
-    .globl    __HeapBase
-    .globl    __HeapLimit
-__HeapBase:
-    .space    Heap_Size
-    .size __HeapBase, . - __HeapBase
-__HeapLimit:
-    .size __HeapLimit, . - __HeapLimit
-    
-    .section .isr_vector
-    .align 2
-    .globl __isr_vector
-__isr_vector:
-    .long    __StackTop            /* Top of Stack */
-    .long    Reset_Handler         /* Reset Handler */
-    .long    NMI_Handler           /* NMI Handler */
-    .long    HardFault_Handler     /* Hard Fault Handler */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    SVC_Handler           /* SVCall Handler */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    PendSV_Handler        /* PendSV Handler */
-    .long    SysTick_Handler       /* SysTick Handler */
-
-    /* External interrupts */
-    .long   DMA0_IRQHandler         /* DMA channel 0 transfer complete interrupt */
-    .long   DMA1_IRQHandler         /* DMA channel 1 transfer complete interrupt */
-    .long   DMA2_IRQHandler         /* DMA channel 2 transfer complete interrupt */
-    .long   DMA3_IRQHandler         /* DMA channel 3 transfer complete interrupt */
-    .long   Reserved20_IRQHandler   /* Reserved interrupt 20 */
-    .long   FTFA_IRQHandler         /* FTFA interrupt */
-    .long   LVD_LVW_IRQHandler      /* Low Voltage Detect, Low Voltage Warning */
-    .long   LLW_IRQHandler          /* Low Leakage Wakeup */
-    .long   I2C0_IRQHandler         /* I2C0 interrupt */
-    .long   I2C1_IRQHandler         /* I2C0 interrupt 25 */
-    .long   SPI0_IRQHandler         /* SPI0 interrupt */
-    .long   SPI1_IRQHandler         /* SPI1 interrupt */
-    .long   UART0_IRQHandler        /* UART0 status/error interrupt */
-    .long   UART1_IRQHandler        /* UART1 status/error interrupt */
-    .long   UART2_IRQHandler        /* UART2 status/error interrupt */
-    .long   ADC0_IRQHandler         /* ADC0 interrupt */
-    .long   CMP0_IRQHandler         /* CMP0 interrupt */
-    .long   TPM0_IRQHandler         /* TPM0 fault, overflow and channels interrupt */
-    .long   TPM1_IRQHandler         /* TPM1 fault, overflow and channels interrupt */
-    .long   TPM2_IRQHandler         /* TPM2 fault, overflow and channels interrupt */
-    .long   RTC_IRQHandler          /* RTC interrupt */
-    .long   RTC_Seconds_IRQHandler  /* RTC seconds interrupt */
-    .long   PIT_IRQHandler          /* PIT timer interrupt */
-    .long   Reserved39_IRQHandler   /* Reserved interrupt 39 */
-    .long   USB0_IRQHandler         /* USB0 interrupt */
-    .long   DAC0_IRQHandler         /* DAC interrupt */
-    .long   TSI0_IRQHandler         /* TSI0 interrupt */
-    .long   MCG_IRQHandler          /* MCG interrupt */
-    .long   LPTimer_IRQHandler      /* LPTimer interrupt */
-    .long   Reserved45_IRQHandler   /* Reserved interrupt 45 */
-    .long   PORTA_IRQHandler        /* Port A interrupt */
-    .long   PORTD_IRQHandler        /* Port D interrupt */
-    
-    .size    __isr_vector, . - __isr_vector
-
-    .section .text.Reset_Handler
-    .thumb
-    .thumb_func
-    .align 2
-    .globl    Reset_Handler
-    .type    Reset_Handler, %function
-Reset_Handler:
-/*     Loop to copy data from read only memory to RAM. The ranges
- *      of copy from/to are specified by following symbols evaluated in 
- *      linker script.
- *      __etext: End of code section, i.e., begin of data sections to copy from.
- *      __data_start__/__data_end__: RAM address range that data should be
- *      copied to. Both must be aligned to 4 bytes boundary.  */
-
-    ldr    r1, =__etext
-    ldr    r2, =__data_start__
-    ldr    r3, =__data_end__
-
-    subs    r3, r2
-    ble    .flash_to_ram_loop_end
-
-    movs    r4, 0
-.flash_to_ram_loop:
-    ldr    r0, [r1,r4]
-    str    r0, [r2,r4]
-    adds    r4, 4
-    cmp    r4, r3
-    blt    .flash_to_ram_loop
-.flash_to_ram_loop_end:
-
-    ldr    r0, =SystemInit
-    blx    r0
-    ldr    r0, =_start
-    bx    r0
-    .pool
-    .size Reset_Handler, . - Reset_Handler
-    
-    .text
-/*    Macro to define default handlers. Default handler
- *    will be weak symbol and just dead loops. They can be
- *    overwritten by other handlers */
-    .macro    def_default_handler    handler_name
-    .align 1
-    .thumb_func
-    .weak    \handler_name
-    .type    \handler_name, %function
-\handler_name :
-    b    .
-    .size    \handler_name, . - \handler_name
-    .endm
-    
-    def_default_handler     NMI_Handler
-    def_default_handler     HardFault_Handler
-    def_default_handler     SVC_Handler
-    def_default_handler     PendSV_Handler
-    def_default_handler     SysTick_Handler
-    def_default_handler     DMA0_IRQHandler
-    def_default_handler     DMA1_IRQHandler
-    def_default_handler     DMA2_IRQHandler
-    def_default_handler     DMA3_IRQHandler
-    def_default_handler     Reserved20_IRQHandler
-    def_default_handler     FTFA_IRQHandler
-    def_default_handler     LVD_LVW_IRQHandler
-    def_default_handler     LLW_IRQHandler
-    def_default_handler     I2C0_IRQHandler
-    def_default_handler     I2C1_IRQHandler
-    def_default_handler     SPI0_IRQHandler
-    def_default_handler     SPI1_IRQHandler
-    def_default_handler     UART0_IRQHandler
-    def_default_handler     UART1_IRQHandler
-    def_default_handler     UART2_IRQHandler
-    def_default_handler     ADC0_IRQHandler
-    def_default_handler     CMP0_IRQHandler
-    def_default_handler     TPM0_IRQHandler
-    def_default_handler     TPM1_IRQHandler
-    def_default_handler     TPM2_IRQHandler
-    def_default_handler     RTC_IRQHandler
-    def_default_handler     RTC_Seconds_IRQHandler
-    def_default_handler     PIT_IRQHandler
-    def_default_handler     Reserved39_IRQHandler
-    def_default_handler     USB0_IRQHandler
-    def_default_handler     DAC0_IRQHandler
-    def_default_handler     TSI0_IRQHandler
-    def_default_handler     MCG_IRQHandler
-    def_default_handler     LPTimer_IRQHandler
-    def_default_handler     Reserved45_IRQHandler
-    def_default_handler     PORTA_IRQHandler
-    def_default_handler     PORTD_IRQHandler
-
-    .weak    DEF_IRQHandler
-    .set    DEF_IRQHandler, Default_Handler
-
-    .end
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL25Z/cmsis.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-/* mbed Microcontroller Library - CMSIS
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * A generic CMSIS include header, pulling in LPC11U24 specifics
- */
-
-#ifndef MBED_CMSIS_H
-#define MBED_CMSIS_H
-
-#include "MKL25Z4.h"
-#include "cmsis_nvic.h"
-
-#endif
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL25Z/cmsis_nvic.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic for LPC11U24
- * Copyright (c) 2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */ 
-#include "cmsis_nvic.h"
-
-#define NVIC_RAM_VECTOR_ADDRESS (0x1FFFF000)  // Vectors positioned at start of RAM
-#define NVIC_FLASH_VECTOR_ADDRESS (0x0)       // Initial vector position in flash
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
-    uint32_t *vectors = (uint32_t*)SCB->VTOR;
-    uint32_t i;
-
-    // Copy and switch to dynamic vectors if the first time called
-    if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
-        uint32_t *old_vectors = vectors;
-        vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
-        for (i=0; i<NVIC_NUM_VECTORS; i++) {
-            vectors[i] = old_vectors[i];
-        }
-        SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
-    }
-    vectors[IRQn + 16] = vector;
-}
-
-uint32_t NVIC_GetVector(IRQn_Type IRQn) {
-    uint32_t *vectors = (uint32_t*)SCB->VTOR;
-    return vectors[IRQn + 16];
-}
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL25Z/cmsis_nvic.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */ 
-
-#ifndef MBED_CMSIS_NVIC_H
-#define MBED_CMSIS_NVIC_H
-
-#define NVIC_NUM_VECTORS      (16 + 32)   // CORE + MCU Peripherals
-#define NVIC_USER_IRQ_OFFSET  16
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
-uint32_t NVIC_GetVector(IRQn_Type IRQn);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL25Z/system_MKL25Z4.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,263 +0,0 @@
-/*
-** ###################################################################
-**     Processor:           MKL25Z128VLK4
-**     Compilers:           ARM Compiler
-**                          Freescale C/C++ for Embedded ARM
-**                          GNU C Compiler
-**                          IAR ANSI C/C++ Compiler for ARM
-**
-**     Reference manual:    KL25RM, Rev.1, Jun 2012
-**     Version:             rev. 1.1, 2012-06-21
-**
-**     Abstract:
-**         Provides a system configuration function and a global variable that
-**         contains the system frequency. It configures the device and initializes
-**         the oscillator (PLL) that is part of the microcontroller device.
-**
-**     Copyright: 2012 Freescale Semiconductor, Inc. All Rights Reserved.
-**
-**     http:                 www.freescale.com
-**     mail:                 support@freescale.com
-**
-**     Revisions:
-**     - rev. 1.0 (2012-06-13)
-**         Initial version.
-**     - rev. 1.1 (2012-06-21)
-**         Update according to reference manual rev. 1.
-**
-** ###################################################################
-*/
-
-/**
- * @file MKL25Z4
- * @version 1.1
- * @date 2012-06-21
- * @brief Device specific configuration file for MKL25Z4 (implementation file)
- *
- * Provides a system configuration function and a global variable that contains
- * the system frequency. It configures the device and initializes the oscillator
- * (PLL) that is part of the microcontroller device.
- */
-
-#include <stdint.h>
-#include "MKL25Z4.h"
-
-#define DISABLE_WDOG    1
-
-#define CLOCK_SETUP     1
-/* Predefined clock setups
-   0 ... Multipurpose Clock Generator (MCG) in FLL Engaged Internal (FEI) mode
-         Reference clock source for MCG module is the slow internal clock source 32.768kHz
-         Core clock = 41.94MHz, BusClock = 13.98MHz
-   1 ... Multipurpose Clock Generator (MCG) in PLL Engaged External (PEE) mode
-         Reference clock source for MCG module is an external crystal 8MHz
-         Core clock = 48MHz, BusClock = 24MHz
-   2 ... Multipurpose Clock Generator (MCG) in Bypassed Low Power External (BLPE) mode
-         Core clock/Bus clock derived directly from an external crystal 8MHz with no multiplication
-         Core clock = 8MHz, BusClock = 8MHz
-*/
-
-/*----------------------------------------------------------------------------
-  Define clock source values
- *----------------------------------------------------------------------------*/
-#if (CLOCK_SETUP == 0)
-    #define CPU_XTAL_CLK_HZ                 8000000u /* Value of the external crystal or oscillator clock frequency in Hz */
-    #define CPU_INT_SLOW_CLK_HZ             32768u   /* Value of the slow internal oscillator clock frequency in Hz  */
-    #define CPU_INT_FAST_CLK_HZ             4000000u /* Value of the fast internal oscillator clock frequency in Hz  */
-    #define DEFAULT_SYSTEM_CLOCK            41943040u /* Default System clock value */
-#elif (CLOCK_SETUP == 1)
-    #define CPU_XTAL_CLK_HZ                 8000000u /* Value of the external crystal or oscillator clock frequency in Hz */
-    #define CPU_INT_SLOW_CLK_HZ             32768u   /* Value of the slow internal oscillator clock frequency in Hz  */
-    #define CPU_INT_FAST_CLK_HZ             4000000u /* Value of the fast internal oscillator clock frequency in Hz  */
-    #define DEFAULT_SYSTEM_CLOCK            48000000u /* Default System clock value */
-#elif (CLOCK_SETUP == 2)
-    #define CPU_XTAL_CLK_HZ                 8000000u /* Value of the external crystal or oscillator clock frequency in Hz */
-    #define CPU_INT_SLOW_CLK_HZ             32768u   /* Value of the slow internal oscillator clock frequency in Hz  */
-    #define CPU_INT_FAST_CLK_HZ             4000000u /* Value of the fast internal oscillator clock frequency in Hz  */
-    #define DEFAULT_SYSTEM_CLOCK            8000000u /* Default System clock value */
-#endif /* (CLOCK_SETUP == 2) */
-
-
-/* ----------------------------------------------------------------------------
-   -- Core clock
-   ---------------------------------------------------------------------------- */
-
-uint32_t SystemCoreClock = DEFAULT_SYSTEM_CLOCK;
-
-/* ----------------------------------------------------------------------------
-   -- SystemInit()
-   ---------------------------------------------------------------------------- */
-
-void SystemInit (void) {
-#if (DISABLE_WDOG)
-  /* Disable the WDOG module */
-  /* SIM_COPC: COPT=0,COPCLKS=0,COPW=0 */
-  SIM->COPC = (uint32_t)0x00u;
-#endif /* (DISABLE_WDOG) */
-#if (CLOCK_SETUP == 0)
-  /* SIM->CLKDIV1: OUTDIV1=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,OUTDIV4=2,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0 */
-  SIM->CLKDIV1 = (uint32_t)0x00020000UL; /* Update system prescalers */
-  /* Switch to FEI Mode */
-  /* MCG->C1: CLKS=0,FRDIV=0,IREFS=1,IRCLKEN=1,IREFSTEN=0 */
-  MCG->C1 = (uint8_t)0x06U;
-  /* MCG_C2: LOCRE0=0,??=0,RANGE0=0,HGO0=0,EREFS0=0,LP=0,IRCS=0 */
-  MCG->C2 = (uint8_t)0x00U;
-  /* MCG->C4: DMX32=0,DRST_DRS=1 */
-  MCG->C4 = (uint8_t)((MCG->C4 & (uint8_t)~(uint8_t)0xC0U) | (uint8_t)0x20U);
-  /* OSC0->CR: ERCLKEN=1,??=0,EREFSTEN=0,??=0,SC2P=0,SC4P=0,SC8P=0,SC16P=0 */
-  OSC0->CR = (uint8_t)0x80U;
-  /* MCG->C5: ??=0,PLLCLKEN0=0,PLLSTEN0=0,PRDIV0=0 */
-  MCG->C5 = (uint8_t)0x00U;
-  /* MCG->C6: LOLIE0=0,PLLS=0,CME0=0,VDIV0=0 */
-  MCG->C6 = (uint8_t)0x00U;
-  while((MCG->S & MCG_S_IREFST_MASK) == 0x00U) { /* Check that the source of the FLL reference clock is the internal reference clock. */
-  }
-  while((MCG->S & 0x0CU) != 0x00U) {    /* Wait until output of the FLL is selected */
-  }
-#elif (CLOCK_SETUP == 1)
-  /* SIM->SCGC5: PORTA=1 */
-  SIM->SCGC5 |= (uint32_t)0x0200UL;     /* Enable clock gate for ports to enable pin routing */
-  /* SIM->CLKDIV1: OUTDIV1=1,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,OUTDIV4=1,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0 */
-  SIM->CLKDIV1 = (uint32_t)0x10010000UL; /* Update system prescalers */
-  /* PORTA->PCR18: ISF=0,MUX=0 */
-  PORTA->PCR[18] &= (uint32_t)~0x01000700UL;
-  /* PORTA->PCR19: ISF=0,MUX=0 */
-  PORTA->PCR[19] &= (uint32_t)~0x01000700UL;
-  /* Switch to FBE Mode */
-  /* OSC0->CR: ERCLKEN=1,??=0,EREFSTEN=0,??=0,SC2P=1,SC4P=0,SC8P=0,SC16P=1 */
-  OSC0->CR = (uint8_t)0x89U;
-  /* MCG->C2: LOCRE0=0,??=0,RANGE0=2,HGO0=0,EREFS0=1,LP=0,IRCS=0 */
-  MCG->C2 = (uint8_t)0x24U;
-  /* MCG->C1: CLKS=2,FRDIV=3,IREFS=0,IRCLKEN=1,IREFSTEN=0 */
-  MCG->C1 = (uint8_t)0x9AU;
-  /* MCG->C4: DMX32=0,DRST_DRS=0 */
-  MCG->C4 &= (uint8_t)~(uint8_t)0xE0U;
-  /* MCG->C5: ??=0,PLLCLKEN0=0,PLLSTEN0=0,PRDIV0=1 */
-  MCG->C5 = (uint8_t)0x01U;
-  /* MCG->C6: LOLIE0=0,PLLS=0,CME0=0,VDIV0=0 */
-  MCG->C6 = (uint8_t)0x00U;
-  while((MCG->S & MCG_S_IREFST_MASK) != 0x00U) { /* Check that the source of the FLL reference clock is the external reference clock. */
-  }
-  while((MCG->S & 0x0CU) != 0x08U) {    /* Wait until external reference clock is selected as MCG output */
-  }
-  /* Switch to PBE Mode */
-  /* MCG->C6: LOLIE0=0,PLLS=1,CME0=0,VDIV0=0 */
-  MCG->C6 = (uint8_t)0x40U;
-  while((MCG->S & 0x0CU) != 0x08U) {    /* Wait until external reference clock is selected as MCG output */
-  }
-  while((MCG->S & MCG_S_LOCK0_MASK) == 0x00U) { /* Wait until locked */
-  }
-  /* Switch to PEE Mode */
-  /* MCG->C1: CLKS=0,FRDIV=3,IREFS=0,IRCLKEN=1,IREFSTEN=0 */
-  MCG->C1 = (uint8_t)0x1AU;
-  while((MCG->S & 0x0CU) != 0x0CU) {    /* Wait until output of the PLL is selected */
-  }
-#elif (CLOCK_SETUP == 2)
-  /* SIM->SCGC5: PORTA=1 */
-  SIM->SCGC5 |= (uint32_t)0x0200UL;     /* Enable clock gate for ports to enable pin routing */
-  /* SIM->CLKDIV1: OUTDIV1=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,OUTDIV4=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0 */
-  SIM->CLKDIV1 = (uint32_t)0x00000000UL; /* Update system prescalers */
-  /* PORTA->PCR18: ISF=0,MUX=0 */
-  PORTA->PCR[18] &= (uint32_t)~0x01000700UL;
-  /* PORTA->PCR19: ISF=0,MUX=0 */
-  PORTA->PCR[19] &= (uint32_t)~0x01000700UL;
-  /* Switch to FBE Mode */
-  /* OSC0->CR: ERCLKEN=1,??=0,EREFSTEN=0,??=0,SC2P=1,SC4P=0,SC8P=0,SC16P=1 */
-  OSC0->CR = (uint8_t)0x89U;
-  /* MCG->C2: LOCRE0=0,??=0,RANGE0=2,HGO0=0,EREFS0=1,LP=0,IRCS=0 */
-  MCG->C2 = (uint8_t)0x24U;
-  /* MCG->C1: CLKS=2,FRDIV=3,IREFS=0,IRCLKEN=1,IREFSTEN=0 */
-  MCG->C1 = (uint8_t)0x9AU;
-  /* MCG->C4: DMX32=0,DRST_DRS=0 */
-  MCG->C4 &= (uint8_t)~(uint8_t)0xE0U;
-  /* MCG->C5: ??=0,PLLCLKEN0=0,PLLSTEN0=0,PRDIV0=0 */
-  MCG->C5 = (uint8_t)0x00U;
-  /* MCG->C6: LOLIE0=0,PLLS=0,CME0=0,VDIV0=0 */
-  MCG->C6 = (uint8_t)0x00U;
-  while((MCG->S & MCG_S_IREFST_MASK) != 0x00U) { /* Check that the source of the FLL reference clock is the external reference clock. */
-  }
-  while((MCG->S & 0x0CU) != 0x08U) {    /* Wait until external reference clock is selected as MCG output */
-  }
-  /* Switch to BLPE Mode */
-  /* MCG->C2: LOCRE0=0,??=0,RANGE0=2,HGO0=0,EREFS0=1,LP=1,IRCS=0 */
-  MCG->C2 = (uint8_t)0x26U;
-  while((MCG->S & 0x0CU) != 0x08U) {    /* Wait until external reference clock is selected as MCG output */
-  }
-#endif /* (CLOCK_SETUP == 2) */
-}
-
-/* ----------------------------------------------------------------------------
-   -- SystemCoreClockUpdate()
-   ---------------------------------------------------------------------------- */
-
-void SystemCoreClockUpdate (void) {
-  uint32_t MCGOUTClock;                                                        /* Variable to store output clock frequency of the MCG module */
-  uint8_t Divider;
-
-  if ((MCG->C1 & MCG_C1_CLKS_MASK) == 0x0u) {
-    /* Output of FLL or PLL is selected */
-    if ((MCG->C6 & MCG_C6_PLLS_MASK) == 0x0u) {
-      /* FLL is selected */
-      if ((MCG->C1 & MCG_C1_IREFS_MASK) == 0x0u) {
-        /* External reference clock is selected */
-        MCGOUTClock = CPU_XTAL_CLK_HZ;                                       /* System oscillator drives MCG clock */
-        Divider = (uint8_t)(1u << ((MCG->C1 & MCG_C1_FRDIV_MASK) >> MCG_C1_FRDIV_SHIFT));
-        MCGOUTClock = (MCGOUTClock / Divider);  /* Calculate the divided FLL reference clock */
-        if ((MCG->C2 & MCG_C2_RANGE0_MASK) != 0x0u) {
-          MCGOUTClock /= 32u;                                                  /* If high range is enabled, additional 32 divider is active */
-        } /* ((MCG->C2 & MCG_C2_RANGE0_MASK) != 0x0u) */
-      } else { /* (!((MCG->C1 & MCG_C1_IREFS_MASK) == 0x0u)) */
-        MCGOUTClock = CPU_INT_SLOW_CLK_HZ;                                     /* The slow internal reference clock is selected */
-      } /* (!((MCG->C1 & MCG_C1_IREFS_MASK) == 0x0u)) */
-      /* Select correct multiplier to calculate the MCG output clock  */
-      switch (MCG->C4 & (MCG_C4_DMX32_MASK | MCG_C4_DRST_DRS_MASK)) {
-        case 0x0u:
-          MCGOUTClock *= 640u;
-          break;
-        case 0x20u:
-          MCGOUTClock *= 1280u;
-          break;
-        case 0x40u:
-          MCGOUTClock *= 1920u;
-          break;
-        case 0x60u:
-          MCGOUTClock *= 2560u;
-          break;
-        case 0x80u:
-          MCGOUTClock *= 732u;
-          break;
-        case 0xA0u:
-          MCGOUTClock *= 1464u;
-          break;
-        case 0xC0u:
-          MCGOUTClock *= 2197u;
-          break;
-        case 0xE0u:
-          MCGOUTClock *= 2929u;
-          break;
-        default:
-          break;
-      }
-    } else { /* (!((MCG->C6 & MCG_C6_PLLS_MASK) == 0x0u)) */
-      /* PLL is selected */
-      Divider = (1u + (MCG->C5 & MCG_C5_PRDIV0_MASK));
-      MCGOUTClock = (uint32_t)(CPU_XTAL_CLK_HZ / Divider);                     /* Calculate the PLL reference clock */
-      Divider = ((MCG->C6 & MCG_C6_VDIV0_MASK) + 24u);
-      MCGOUTClock *= Divider;                       /* Calculate the MCG output clock */
-    } /* (!((MCG->C6 & MCG_C6_PLLS_MASK) == 0x0u)) */
-  } else if ((MCG->C1 & MCG_C1_CLKS_MASK) == 0x40u) {
-    /* Internal reference clock is selected */
-    if ((MCG->C2 & MCG_C2_IRCS_MASK) == 0x0u) {
-      MCGOUTClock = CPU_INT_SLOW_CLK_HZ;                                       /* Slow internal reference clock selected */
-    } else { /* (!((MCG->C2 & MCG_C2_IRCS_MASK) == 0x0u)) */
-      MCGOUTClock = CPU_INT_FAST_CLK_HZ / (1 << ((MCG->SC & MCG_SC_FCRDIV_MASK) >> MCG_SC_FCRDIV_SHIFT));  /* Fast internal reference clock selected */
-    } /* (!((MCG->C2 & MCG_C2_IRCS_MASK) == 0x0u)) */
-  } else if ((MCG->C1 & MCG_C1_CLKS_MASK) == 0x80u) {
-    /* External reference clock is selected */
-    MCGOUTClock = CPU_XTAL_CLK_HZ;                                           /* System oscillator drives MCG clock */
-  } else { /* (!((MCG->C1 & MCG_C1_CLKS_MASK) == 0x80u)) */
-    /* Reserved value */
-    return;
-  } /* (!((MCG->C1 & MCG_C1_CLKS_MASK) == 0x80u)) */
-  SystemCoreClock = (MCGOUTClock / (1u + ((SIM->CLKDIV1 & SIM_CLKDIV1_OUTDIV1_MASK) >> SIM_CLKDIV1_OUTDIV1_SHIFT)));
-}
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL25Z/system_MKL25Z4.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
-** ###################################################################
-**     Processor:           MKL25Z128VLK4
-**     Compilers:           ARM Compiler
-**                          Freescale C/C++ for Embedded ARM
-**                          GNU C Compiler
-**                          IAR ANSI C/C++ Compiler for ARM
-**
-**     Reference manual:    KL25RM, Rev.1, Jun 2012
-**     Version:             rev. 1.1, 2012-06-21
-**
-**     Abstract:
-**         Provides a system configuration function and a global variable that
-**         contains the system frequency. It configures the device and initializes
-**         the oscillator (PLL) that is part of the microcontroller device.
-**
-**     Copyright: 2012 Freescale Semiconductor, Inc. All Rights Reserved.
-**
-**     http:                 www.freescale.com
-**     mail:                 support@freescale.com
-**
-**     Revisions:
-**     - rev. 1.0 (2012-06-13)
-**         Initial version.
-**     - rev. 1.1 (2012-06-21)
-**         Update according to reference manual rev. 1.
-**
-** ###################################################################
-*/
-
-/**
- * @file MKL25Z4
- * @version 1.1
- * @date 2012-06-21
- * @brief Device specific configuration file for MKL25Z4 (header file)
- *
- * Provides a system configuration function and a global variable that contains
- * the system frequency. It configures the device and initializes the oscillator
- * (PLL) that is part of the microcontroller device.
- */
-
-#ifndef SYSTEM_MKL25Z4_H_
-#define SYSTEM_MKL25Z4_H_                        /**< Symbol preventing repeated inclusion */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-/**
- * @brief System clock frequency (core clock)
- *
- * The system clock frequency supplied to the SysTick timer and the processor
- * core clock. This variable can be used by the user application to setup the
- * SysTick timer or configure other parameters. It may also be used by debugger to
- * query the frequency of the debug timer or configure the trace clock speed
- * SystemCoreClock is initialized with a correct predefined value.
- */
-extern uint32_t SystemCoreClock;
-
-/**
- * @brief Setup the microcontroller system.
- *
- * Typically this function configures the oscillator (PLL) that is part of the
- * microcontroller device. For systems with variable clock speed it also updates
- * the variable SystemCoreClock. SystemInit is called from startup_device file.
- */
-void SystemInit (void);
-
-/**
- * @brief Updates the SystemCoreClock variable.
- *
- * It must be called whenever the core clock is changed during program
- * execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates
- * the current core clock.
- */
-void SystemCoreClockUpdate (void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /* #if !defined(SYSTEM_MKL25Z4_H_) */
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL46Z/MKL46Z4.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4155 +0,0 @@
-/*
-** ###################################################################
-**     Processor:           MKL46Z128VLK4
-**     Compilers:           ARM Compiler
-**                          Freescale C/C++ for Embedded ARM
-**                          GNU C Compiler
-**                          IAR ANSI C/C++ Compiler for ARM
-**
-**     Reference manual:    KL25RM, Rev.1, Jun 2012
-**     Version:             rev. 1.1, 2012-06-21
-**
-**     Abstract:
-**         CMSIS Peripheral Access Layer for MKL46Z4
-**
-**     Copyright: 1997 - 2012 Freescale Semiconductor, Inc. All Rights Reserved.
-**
-**     http:                 www.freescale.com
-**     mail:                 support@freescale.com
-**
-**     Revisions:
-**     - rev. 1.0 (2012-06-13)
-**         Initial version.
-**     - rev. 1.1 (2012-06-21)
-**         Update according to reference manual rev. 1.
-**
-** ###################################################################
-*/
-
-/**
- * @file MKL46Z4.h
- * @version 1.1
- * @date 2012-06-21
- * @brief CMSIS Peripheral Access Layer for MKL46Z4
- *
- * CMSIS Peripheral Access Layer for MKL46Z4
- */
-
-#if !defined(MKL46Z4_H_)
-#define MKL46Z4_H_                               /**< Symbol preventing repeated inclusion */
-
-/** Memory map major version (memory maps with equal major version number are
- * compatible) */
-#define MCU_MEM_MAP_VERSION 0x0100u
-/** Memory map minor version */
-#define MCU_MEM_MAP_VERSION_MINOR 0x0001u
-
-
-/* ----------------------------------------------------------------------------
-   -- Interrupt vector numbers
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup Interrupt_vector_numbers Interrupt vector numbers
- * @{
- */
-
-/** Interrupt Number Definitions */
-typedef enum IRQn {
-  /* Core interrupts */
-  NonMaskableInt_IRQn          = -14,              /**< Non Maskable Interrupt */
-  HardFault_IRQn               = -13,              /**< Cortex-M0 SV Hard Fault Interrupt */
-  SVCall_IRQn                  = -5,               /**< Cortex-M0 SV Call Interrupt */
-  PendSV_IRQn                  = -2,               /**< Cortex-M0 Pend SV Interrupt */
-  SysTick_IRQn                 = -1,               /**< Cortex-M0 System Tick Interrupt */
-
-  /* Device specific interrupts */
-  DMA0_IRQn                    = 0,                /**< DMA channel 0 transfer complete interrupt */
-  DMA1_IRQn                    = 1,                /**< DMA channel 1 transfer complete interrupt */
-  DMA2_IRQn                    = 2,                /**< DMA channel 2 transfer complete interrupt */
-  DMA3_IRQn                    = 3,                /**< DMA channel 3 transfer complete interrupt */
-  Reserved20_IRQn              = 4,                /**< Reserved interrupt 20 */
-  FTFA_IRQn                    = 5,                /**< FTFA interrupt */
-  LVD_LVW_IRQn                 = 6,                /**< Low Voltage Detect, Low Voltage Warning */
-  LLW_IRQn                     = 7,                /**< Low Leakage Wakeup */
-  I2C0_IRQn                    = 8,                /**< I2C0 interrupt */
-  I2C1_IRQn                    = 9,                /**< I2C0 interrupt 25 */
-  SPI0_IRQn                    = 10,               /**< SPI0 interrupt */
-  SPI1_IRQn                    = 11,               /**< SPI1 interrupt */
-  UART0_IRQn                   = 12,               /**< UART0 status/error interrupt */
-  UART1_IRQn                   = 13,               /**< UART1 status/error interrupt */
-  UART2_IRQn                   = 14,               /**< UART2 status/error interrupt */
-  ADC0_IRQn                    = 15,               /**< ADC0 interrupt */
-  CMP0_IRQn                    = 16,               /**< CMP0 interrupt */
-  TPM0_IRQn                    = 17,               /**< TPM0 fault, overflow and channels interrupt */
-  TPM1_IRQn                    = 18,               /**< TPM1 fault, overflow and channels interrupt */
-  TPM2_IRQn                    = 19,               /**< TPM2 fault, overflow and channels interrupt */
-  RTC_IRQn                     = 20,               /**< RTC interrupt */
-  RTC_Seconds_IRQn             = 21,               /**< RTC seconds interrupt */
-  PIT_IRQn                     = 22,               /**< PIT timer interrupt */
-  Reserved39_IRQn              = 23,               /**< Reserved interrupt 39 */
-  USB0_IRQn                    = 24,               /**< USB0 interrupt */
-  DAC0_IRQn                    = 25,               /**< DAC interrupt */
-  TSI0_IRQn                    = 26,               /**< TSI0 interrupt */
-  MCG_IRQn                     = 27,               /**< MCG interrupt */
-  LPTimer_IRQn                 = 28,               /**< LPTimer interrupt */
-  Reserved45_IRQn              = 29,               /**< Reserved interrupt 45 */
-  PORTA_IRQn                   = 30,               /**< Port A interrupt */
-  PORTD_IRQn                   = 31                /**< Port D interrupt */
-} IRQn_Type;
-
-/**
- * @}
- */ /* end of group Interrupt_vector_numbers */
-
-
-/* ----------------------------------------------------------------------------
-   -- Cortex M0 Core Configuration
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup Cortex_Core_Configuration Cortex M0 Core Configuration
- * @{
- */
-
-#define __CM0PLUS_REV                  0x0000    /**< Core revision r0p0 */
-#define __MPU_PRESENT                  0         /**< Defines if an MPU is present or not */
-#define __VTOR_PRESENT                 1         /**< Defines if an MPU is present or not */
-#define __NVIC_PRIO_BITS               2         /**< Number of priority bits implemented in the NVIC */
-#define __Vendor_SysTickConfig         0         /**< Vendor specific implementation of SysTickConfig is defined */
-
-#include "core_cm0plus.h"              /* Core Peripheral Access Layer */
-#include "system_MKL46Z4.h"            /* Device specific configuration file */
-
-/**
- * @}
- */ /* end of group Cortex_Core_Configuration */
-
-
-/* ----------------------------------------------------------------------------
-   -- Device Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup Peripheral_access_layer Device Peripheral Access Layer
- * @{
- */
-
-
-/*
-** Start of section using anonymous unions
-*/
-
-#if defined(__ARMCC_VERSION)
-  #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 language=extended
-#else
-  #error Not supported compiler type
-#endif
-
-/* ----------------------------------------------------------------------------
-   -- ADC Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup ADC_Peripheral_Access_Layer ADC Peripheral Access Layer
- * @{
- */
-
-/** ADC - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t SC1[2];                            /**< ADC Status and Control Registers 1, array offset: 0x0, array step: 0x4 */
-  __IO uint32_t CFG1;                              /**< ADC Configuration Register 1, offset: 0x8 */
-  __IO uint32_t CFG2;                              /**< ADC Configuration Register 2, offset: 0xC */
-  __I  uint32_t R[2];                              /**< ADC Data Result Register, array offset: 0x10, array step: 0x4 */
-  __IO uint32_t CV1;                               /**< Compare Value Registers, offset: 0x18 */
-  __IO uint32_t CV2;                               /**< Compare Value Registers, offset: 0x1C */
-  __IO uint32_t SC2;                               /**< Status and Control Register 2, offset: 0x20 */
-  __IO uint32_t SC3;                               /**< Status and Control Register 3, offset: 0x24 */
-  __IO uint32_t OFS;                               /**< ADC Offset Correction Register, offset: 0x28 */
-  __IO uint32_t PG;                                /**< ADC Plus-Side Gain Register, offset: 0x2C */
-  __IO uint32_t MG;                                /**< ADC Minus-Side Gain Register, offset: 0x30 */
-  __IO uint32_t CLPD;                              /**< ADC Plus-Side General Calibration Value Register, offset: 0x34 */
-  __IO uint32_t CLPS;                              /**< ADC Plus-Side General Calibration Value Register, offset: 0x38 */
-  __IO uint32_t CLP4;                              /**< ADC Plus-Side General Calibration Value Register, offset: 0x3C */
-  __IO uint32_t CLP3;                              /**< ADC Plus-Side General Calibration Value Register, offset: 0x40 */
-  __IO uint32_t CLP2;                              /**< ADC Plus-Side General Calibration Value Register, offset: 0x44 */
-  __IO uint32_t CLP1;                              /**< ADC Plus-Side General Calibration Value Register, offset: 0x48 */
-  __IO uint32_t CLP0;                              /**< ADC Plus-Side General Calibration Value Register, offset: 0x4C */
-       uint8_t RESERVED_0[4];
-  __IO uint32_t CLMD;                              /**< ADC Minus-Side General Calibration Value Register, offset: 0x54 */
-  __IO uint32_t CLMS;                              /**< ADC Minus-Side General Calibration Value Register, offset: 0x58 */
-  __IO uint32_t CLM4;                              /**< ADC Minus-Side General Calibration Value Register, offset: 0x5C */
-  __IO uint32_t CLM3;                              /**< ADC Minus-Side General Calibration Value Register, offset: 0x60 */
-  __IO uint32_t CLM2;                              /**< ADC Minus-Side General Calibration Value Register, offset: 0x64 */
-  __IO uint32_t CLM1;                              /**< ADC Minus-Side General Calibration Value Register, offset: 0x68 */
-  __IO uint32_t CLM0;                              /**< ADC Minus-Side General Calibration Value Register, offset: 0x6C */
-} ADC_Type;
-
-/* ----------------------------------------------------------------------------
-   -- ADC Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup ADC_Register_Masks ADC Register Masks
- * @{
- */
-
-/* SC1 Bit Fields */
-#define ADC_SC1_ADCH_MASK                        0x1Fu
-#define ADC_SC1_ADCH_SHIFT                       0
-#define ADC_SC1_ADCH(x)                          (((uint32_t)(((uint32_t)(x))<<ADC_SC1_ADCH_SHIFT))&ADC_SC1_ADCH_MASK)
-#define ADC_SC1_DIFF_MASK                        0x20u
-#define ADC_SC1_DIFF_SHIFT                       5
-#define ADC_SC1_AIEN_MASK                        0x40u
-#define ADC_SC1_AIEN_SHIFT                       6
-#define ADC_SC1_COCO_MASK                        0x80u
-#define ADC_SC1_COCO_SHIFT                       7
-/* CFG1 Bit Fields */
-#define ADC_CFG1_ADICLK_MASK                     0x3u
-#define ADC_CFG1_ADICLK_SHIFT                    0
-#define ADC_CFG1_ADICLK(x)                       (((uint32_t)(((uint32_t)(x))<<ADC_CFG1_ADICLK_SHIFT))&ADC_CFG1_ADICLK_MASK)
-#define ADC_CFG1_MODE_MASK                       0xCu
-#define ADC_CFG1_MODE_SHIFT                      2
-#define ADC_CFG1_MODE(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CFG1_MODE_SHIFT))&ADC_CFG1_MODE_MASK)
-#define ADC_CFG1_ADLSMP_MASK                     0x10u
-#define ADC_CFG1_ADLSMP_SHIFT                    4
-#define ADC_CFG1_ADIV_MASK                       0x60u
-#define ADC_CFG1_ADIV_SHIFT                      5
-#define ADC_CFG1_ADIV(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CFG1_ADIV_SHIFT))&ADC_CFG1_ADIV_MASK)
-#define ADC_CFG1_ADLPC_MASK                      0x80u
-#define ADC_CFG1_ADLPC_SHIFT                     7
-/* CFG2 Bit Fields */
-#define ADC_CFG2_ADLSTS_MASK                     0x3u
-#define ADC_CFG2_ADLSTS_SHIFT                    0
-#define ADC_CFG2_ADLSTS(x)                       (((uint32_t)(((uint32_t)(x))<<ADC_CFG2_ADLSTS_SHIFT))&ADC_CFG2_ADLSTS_MASK)
-#define ADC_CFG2_ADHSC_MASK                      0x4u
-#define ADC_CFG2_ADHSC_SHIFT                     2
-#define ADC_CFG2_ADACKEN_MASK                    0x8u
-#define ADC_CFG2_ADACKEN_SHIFT                   3
-#define ADC_CFG2_MUXSEL_MASK                     0x10u
-#define ADC_CFG2_MUXSEL_SHIFT                    4
-/* R Bit Fields */
-#define ADC_R_D_MASK                             0xFFFFu
-#define ADC_R_D_SHIFT                            0
-#define ADC_R_D(x)                               (((uint32_t)(((uint32_t)(x))<<ADC_R_D_SHIFT))&ADC_R_D_MASK)
-/* CV1 Bit Fields */
-#define ADC_CV1_CV_MASK                          0xFFFFu
-#define ADC_CV1_CV_SHIFT                         0
-#define ADC_CV1_CV(x)                            (((uint32_t)(((uint32_t)(x))<<ADC_CV1_CV_SHIFT))&ADC_CV1_CV_MASK)
-/* CV2 Bit Fields */
-#define ADC_CV2_CV_MASK                          0xFFFFu
-#define ADC_CV2_CV_SHIFT                         0
-#define ADC_CV2_CV(x)                            (((uint32_t)(((uint32_t)(x))<<ADC_CV2_CV_SHIFT))&ADC_CV2_CV_MASK)
-/* SC2 Bit Fields */
-#define ADC_SC2_REFSEL_MASK                      0x3u
-#define ADC_SC2_REFSEL_SHIFT                     0
-#define ADC_SC2_REFSEL(x)                        (((uint32_t)(((uint32_t)(x))<<ADC_SC2_REFSEL_SHIFT))&ADC_SC2_REFSEL_MASK)
-#define ADC_SC2_DMAEN_MASK                       0x4u
-#define ADC_SC2_DMAEN_SHIFT                      2
-#define ADC_SC2_ACREN_MASK                       0x8u
-#define ADC_SC2_ACREN_SHIFT                      3
-#define ADC_SC2_ACFGT_MASK                       0x10u
-#define ADC_SC2_ACFGT_SHIFT                      4
-#define ADC_SC2_ACFE_MASK                        0x20u
-#define ADC_SC2_ACFE_SHIFT                       5
-#define ADC_SC2_ADTRG_MASK                       0x40u
-#define ADC_SC2_ADTRG_SHIFT                      6
-#define ADC_SC2_ADACT_MASK                       0x80u
-#define ADC_SC2_ADACT_SHIFT                      7
-/* SC3 Bit Fields */
-#define ADC_SC3_AVGS_MASK                        0x3u
-#define ADC_SC3_AVGS_SHIFT                       0
-#define ADC_SC3_AVGS(x)                          (((uint32_t)(((uint32_t)(x))<<ADC_SC3_AVGS_SHIFT))&ADC_SC3_AVGS_MASK)
-#define ADC_SC3_AVGE_MASK                        0x4u
-#define ADC_SC3_AVGE_SHIFT                       2
-#define ADC_SC3_ADCO_MASK                        0x8u
-#define ADC_SC3_ADCO_SHIFT                       3
-#define ADC_SC3_CALF_MASK                        0x40u
-#define ADC_SC3_CALF_SHIFT                       6
-#define ADC_SC3_CAL_MASK                         0x80u
-#define ADC_SC3_CAL_SHIFT                        7
-/* OFS Bit Fields */
-#define ADC_OFS_OFS_MASK                         0xFFFFu
-#define ADC_OFS_OFS_SHIFT                        0
-#define ADC_OFS_OFS(x)                           (((uint32_t)(((uint32_t)(x))<<ADC_OFS_OFS_SHIFT))&ADC_OFS_OFS_MASK)
-/* PG Bit Fields */
-#define ADC_PG_PG_MASK                           0xFFFFu
-#define ADC_PG_PG_SHIFT                          0
-#define ADC_PG_PG(x)                             (((uint32_t)(((uint32_t)(x))<<ADC_PG_PG_SHIFT))&ADC_PG_PG_MASK)
-/* MG Bit Fields */
-#define ADC_MG_MG_MASK                           0xFFFFu
-#define ADC_MG_MG_SHIFT                          0
-#define ADC_MG_MG(x)                             (((uint32_t)(((uint32_t)(x))<<ADC_MG_MG_SHIFT))&ADC_MG_MG_MASK)
-/* CLPD Bit Fields */
-#define ADC_CLPD_CLPD_MASK                       0x3Fu
-#define ADC_CLPD_CLPD_SHIFT                      0
-#define ADC_CLPD_CLPD(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLPD_CLPD_SHIFT))&ADC_CLPD_CLPD_MASK)
-/* CLPS Bit Fields */
-#define ADC_CLPS_CLPS_MASK                       0x3Fu
-#define ADC_CLPS_CLPS_SHIFT                      0
-#define ADC_CLPS_CLPS(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLPS_CLPS_SHIFT))&ADC_CLPS_CLPS_MASK)
-/* CLP4 Bit Fields */
-#define ADC_CLP4_CLP4_MASK                       0x3FFu
-#define ADC_CLP4_CLP4_SHIFT                      0
-#define ADC_CLP4_CLP4(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLP4_CLP4_SHIFT))&ADC_CLP4_CLP4_MASK)
-/* CLP3 Bit Fields */
-#define ADC_CLP3_CLP3_MASK                       0x1FFu
-#define ADC_CLP3_CLP3_SHIFT                      0
-#define ADC_CLP3_CLP3(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLP3_CLP3_SHIFT))&ADC_CLP3_CLP3_MASK)
-/* CLP2 Bit Fields */
-#define ADC_CLP2_CLP2_MASK                       0xFFu
-#define ADC_CLP2_CLP2_SHIFT                      0
-#define ADC_CLP2_CLP2(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLP2_CLP2_SHIFT))&ADC_CLP2_CLP2_MASK)
-/* CLP1 Bit Fields */
-#define ADC_CLP1_CLP1_MASK                       0x7Fu
-#define ADC_CLP1_CLP1_SHIFT                      0
-#define ADC_CLP1_CLP1(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLP1_CLP1_SHIFT))&ADC_CLP1_CLP1_MASK)
-/* CLP0 Bit Fields */
-#define ADC_CLP0_CLP0_MASK                       0x3Fu
-#define ADC_CLP0_CLP0_SHIFT                      0
-#define ADC_CLP0_CLP0(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLP0_CLP0_SHIFT))&ADC_CLP0_CLP0_MASK)
-/* CLMD Bit Fields */
-#define ADC_CLMD_CLMD_MASK                       0x3Fu
-#define ADC_CLMD_CLMD_SHIFT                      0
-#define ADC_CLMD_CLMD(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLMD_CLMD_SHIFT))&ADC_CLMD_CLMD_MASK)
-/* CLMS Bit Fields */
-#define ADC_CLMS_CLMS_MASK                       0x3Fu
-#define ADC_CLMS_CLMS_SHIFT                      0
-#define ADC_CLMS_CLMS(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLMS_CLMS_SHIFT))&ADC_CLMS_CLMS_MASK)
-/* CLM4 Bit Fields */
-#define ADC_CLM4_CLM4_MASK                       0x3FFu
-#define ADC_CLM4_CLM4_SHIFT                      0
-#define ADC_CLM4_CLM4(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLM4_CLM4_SHIFT))&ADC_CLM4_CLM4_MASK)
-/* CLM3 Bit Fields */
-#define ADC_CLM3_CLM3_MASK                       0x1FFu
-#define ADC_CLM3_CLM3_SHIFT                      0
-#define ADC_CLM3_CLM3(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLM3_CLM3_SHIFT))&ADC_CLM3_CLM3_MASK)
-/* CLM2 Bit Fields */
-#define ADC_CLM2_CLM2_MASK                       0xFFu
-#define ADC_CLM2_CLM2_SHIFT                      0
-#define ADC_CLM2_CLM2(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLM2_CLM2_SHIFT))&ADC_CLM2_CLM2_MASK)
-/* CLM1 Bit Fields */
-#define ADC_CLM1_CLM1_MASK                       0x7Fu
-#define ADC_CLM1_CLM1_SHIFT                      0
-#define ADC_CLM1_CLM1(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLM1_CLM1_SHIFT))&ADC_CLM1_CLM1_MASK)
-/* CLM0 Bit Fields */
-#define ADC_CLM0_CLM0_MASK                       0x3Fu
-#define ADC_CLM0_CLM0_SHIFT                      0
-#define ADC_CLM0_CLM0(x)                         (((uint32_t)(((uint32_t)(x))<<ADC_CLM0_CLM0_SHIFT))&ADC_CLM0_CLM0_MASK)
-
-/**
- * @}
- */ /* end of group ADC_Register_Masks */
-
-
-/* ADC - Peripheral instance base addresses */
-/** Peripheral ADC0 base address */
-#define ADC0_BASE                                (0x4003B000u)
-/** Peripheral ADC0 base pointer */
-#define ADC0                                     ((ADC_Type *)ADC0_BASE)
-/** Array initializer of ADC peripheral base pointers */
-#define ADC_BASES                                { ADC0 }
-
-/**
- * @}
- */ /* end of group ADC_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- CMP Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup CMP_Peripheral_Access_Layer CMP Peripheral Access Layer
- * @{
- */
-
-/** CMP - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t CR0;                                /**< CMP Control Register 0, offset: 0x0 */
-  __IO uint8_t CR1;                                /**< CMP Control Register 1, offset: 0x1 */
-  __IO uint8_t FPR;                                /**< CMP Filter Period Register, offset: 0x2 */
-  __IO uint8_t SCR;                                /**< CMP Status and Control Register, offset: 0x3 */
-  __IO uint8_t DACCR;                              /**< DAC Control Register, offset: 0x4 */
-  __IO uint8_t MUXCR;                              /**< MUX Control Register, offset: 0x5 */
-} CMP_Type;
-
-/* ----------------------------------------------------------------------------
-   -- CMP Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup CMP_Register_Masks CMP Register Masks
- * @{
- */
-
-/* CR0 Bit Fields */
-#define CMP_CR0_HYSTCTR_MASK                     0x3u
-#define CMP_CR0_HYSTCTR_SHIFT                    0
-#define CMP_CR0_HYSTCTR(x)                       (((uint8_t)(((uint8_t)(x))<<CMP_CR0_HYSTCTR_SHIFT))&CMP_CR0_HYSTCTR_MASK)
-#define CMP_CR0_FILTER_CNT_MASK                  0x70u
-#define CMP_CR0_FILTER_CNT_SHIFT                 4
-#define CMP_CR0_FILTER_CNT(x)                    (((uint8_t)(((uint8_t)(x))<<CMP_CR0_FILTER_CNT_SHIFT))&CMP_CR0_FILTER_CNT_MASK)
-/* CR1 Bit Fields */
-#define CMP_CR1_EN_MASK                          0x1u
-#define CMP_CR1_EN_SHIFT                         0
-#define CMP_CR1_OPE_MASK                         0x2u
-#define CMP_CR1_OPE_SHIFT                        1
-#define CMP_CR1_COS_MASK                         0x4u
-#define CMP_CR1_COS_SHIFT                        2
-#define CMP_CR1_INV_MASK                         0x8u
-#define CMP_CR1_INV_SHIFT                        3
-#define CMP_CR1_PMODE_MASK                       0x10u
-#define CMP_CR1_PMODE_SHIFT                      4
-#define CMP_CR1_TRIGM_MASK                       0x20u
-#define CMP_CR1_TRIGM_SHIFT                      5
-#define CMP_CR1_WE_MASK                          0x40u
-#define CMP_CR1_WE_SHIFT                         6
-#define CMP_CR1_SE_MASK                          0x80u
-#define CMP_CR1_SE_SHIFT                         7
-/* FPR Bit Fields */
-#define CMP_FPR_FILT_PER_MASK                    0xFFu
-#define CMP_FPR_FILT_PER_SHIFT                   0
-#define CMP_FPR_FILT_PER(x)                      (((uint8_t)(((uint8_t)(x))<<CMP_FPR_FILT_PER_SHIFT))&CMP_FPR_FILT_PER_MASK)
-/* SCR Bit Fields */
-#define CMP_SCR_COUT_MASK                        0x1u
-#define CMP_SCR_COUT_SHIFT                       0
-#define CMP_SCR_CFF_MASK                         0x2u
-#define CMP_SCR_CFF_SHIFT                        1
-#define CMP_SCR_CFR_MASK                         0x4u
-#define CMP_SCR_CFR_SHIFT                        2
-#define CMP_SCR_IEF_MASK                         0x8u
-#define CMP_SCR_IEF_SHIFT                        3
-#define CMP_SCR_IER_MASK                         0x10u
-#define CMP_SCR_IER_SHIFT                        4
-#define CMP_SCR_DMAEN_MASK                       0x40u
-#define CMP_SCR_DMAEN_SHIFT                      6
-/* DACCR Bit Fields */
-#define CMP_DACCR_VOSEL_MASK                     0x3Fu
-#define CMP_DACCR_VOSEL_SHIFT                    0
-#define CMP_DACCR_VOSEL(x)                       (((uint8_t)(((uint8_t)(x))<<CMP_DACCR_VOSEL_SHIFT))&CMP_DACCR_VOSEL_MASK)
-#define CMP_DACCR_VRSEL_MASK                     0x40u
-#define CMP_DACCR_VRSEL_SHIFT                    6
-#define CMP_DACCR_DACEN_MASK                     0x80u
-#define CMP_DACCR_DACEN_SHIFT                    7
-/* MUXCR Bit Fields */
-#define CMP_MUXCR_MSEL_MASK                      0x7u
-#define CMP_MUXCR_MSEL_SHIFT                     0
-#define CMP_MUXCR_MSEL(x)                        (((uint8_t)(((uint8_t)(x))<<CMP_MUXCR_MSEL_SHIFT))&CMP_MUXCR_MSEL_MASK)
-#define CMP_MUXCR_PSEL_MASK                      0x38u
-#define CMP_MUXCR_PSEL_SHIFT                     3
-#define CMP_MUXCR_PSEL(x)                        (((uint8_t)(((uint8_t)(x))<<CMP_MUXCR_PSEL_SHIFT))&CMP_MUXCR_PSEL_MASK)
-#define CMP_MUXCR_PSTM_MASK                      0x40u
-#define CMP_MUXCR_PSTM_SHIFT                     6
-
-/**
- * @}
- */ /* end of group CMP_Register_Masks */
-
-
-/* CMP - Peripheral instance base addresses */
-/** Peripheral CMP0 base address */
-#define CMP0_BASE                                (0x40073000u)
-/** Peripheral CMP0 base pointer */
-#define CMP0                                     ((CMP_Type *)CMP0_BASE)
-/** Array initializer of CMP peripheral base pointers */
-#define CMP_BASES                                { CMP0 }
-
-/**
- * @}
- */ /* end of group CMP_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- DAC Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup DAC_Peripheral_Access_Layer DAC Peripheral Access Layer
- * @{
- */
-
-/** DAC - Register Layout Typedef */
-typedef struct {
-  struct {                                         /* offset: 0x0, array step: 0x2 */
-    __IO uint8_t DATL;                               /**< DAC Data Low Register, array offset: 0x0, array step: 0x2 */
-    __IO uint8_t DATH;                               /**< DAC Data High Register, array offset: 0x1, array step: 0x2 */
-  } DAT[2];
-       uint8_t RESERVED_0[28];
-  __IO uint8_t SR;                                 /**< DAC Status Register, offset: 0x20 */
-  __IO uint8_t C0;                                 /**< DAC Control Register, offset: 0x21 */
-  __IO uint8_t C1;                                 /**< DAC Control Register 1, offset: 0x22 */
-  __IO uint8_t C2;                                 /**< DAC Control Register 2, offset: 0x23 */
-} DAC_Type;
-
-/* ----------------------------------------------------------------------------
-   -- DAC Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup DAC_Register_Masks DAC Register Masks
- * @{
- */
-
-/* DATL Bit Fields */
-#define DAC_DATL_DATA0_MASK                      0xFFu
-#define DAC_DATL_DATA0_SHIFT                     0
-#define DAC_DATL_DATA0(x)                        (((uint8_t)(((uint8_t)(x))<<DAC_DATL_DATA0_SHIFT))&DAC_DATL_DATA0_MASK)
-/* DATH Bit Fields */
-#define DAC_DATH_DATA1_MASK                      0xFu
-#define DAC_DATH_DATA1_SHIFT                     0
-#define DAC_DATH_DATA1(x)                        (((uint8_t)(((uint8_t)(x))<<DAC_DATH_DATA1_SHIFT))&DAC_DATH_DATA1_MASK)
-/* SR Bit Fields */
-#define DAC_SR_DACBFRPBF_MASK                    0x1u
-#define DAC_SR_DACBFRPBF_SHIFT                   0
-#define DAC_SR_DACBFRPTF_MASK                    0x2u
-#define DAC_SR_DACBFRPTF_SHIFT                   1
-/* C0 Bit Fields */
-#define DAC_C0_DACBBIEN_MASK                     0x1u
-#define DAC_C0_DACBBIEN_SHIFT                    0
-#define DAC_C0_DACBTIEN_MASK                     0x2u
-#define DAC_C0_DACBTIEN_SHIFT                    1
-#define DAC_C0_LPEN_MASK                         0x8u
-#define DAC_C0_LPEN_SHIFT                        3
-#define DAC_C0_DACSWTRG_MASK                     0x10u
-#define DAC_C0_DACSWTRG_SHIFT                    4
-#define DAC_C0_DACTRGSEL_MASK                    0x20u
-#define DAC_C0_DACTRGSEL_SHIFT                   5
-#define DAC_C0_DACRFS_MASK                       0x40u
-#define DAC_C0_DACRFS_SHIFT                      6
-#define DAC_C0_DACEN_MASK                        0x80u
-#define DAC_C0_DACEN_SHIFT                       7
-/* C1 Bit Fields */
-#define DAC_C1_DACBFEN_MASK                      0x1u
-#define DAC_C1_DACBFEN_SHIFT                     0
-#define DAC_C1_DACBFMD_MASK                      0x4u
-#define DAC_C1_DACBFMD_SHIFT                     2
-#define DAC_C1_DMAEN_MASK                        0x80u
-#define DAC_C1_DMAEN_SHIFT                       7
-/* C2 Bit Fields */
-#define DAC_C2_DACBFUP_MASK                      0x1u
-#define DAC_C2_DACBFUP_SHIFT                     0
-#define DAC_C2_DACBFRP_MASK                      0x10u
-#define DAC_C2_DACBFRP_SHIFT                     4
-
-/**
- * @}
- */ /* end of group DAC_Register_Masks */
-
-
-/* DAC - Peripheral instance base addresses */
-/** Peripheral DAC0 base address */
-#define DAC0_BASE                                (0x4003F000u)
-/** Peripheral DAC0 base pointer */
-#define DAC0                                     ((DAC_Type *)DAC0_BASE)
-/** Array initializer of DAC peripheral base pointers */
-#define DAC_BASES                                { DAC0 }
-
-/**
- * @}
- */ /* end of group DAC_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- DMA Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup DMA_Peripheral_Access_Layer DMA Peripheral Access Layer
- * @{
- */
-
-/** DMA - Register Layout Typedef */
-typedef struct {
-  union {                                          /* offset: 0x0 */
-    __IO uint8_t REQC_ARR[4];                        /**< DMA_REQC0 register...DMA_REQC3 register., array offset: 0x0, array step: 0x1 */
-  };
-       uint8_t RESERVED_0[252];
-  struct {                                         /* offset: 0x100, array step: 0x10 */
-    __IO uint32_t SAR;                               /**< Source Address Register, array offset: 0x100, array step: 0x10 */
-    __IO uint32_t DAR;                               /**< Destination Address Register, array offset: 0x104, array step: 0x10 */
-    union {                                          /* offset: 0x108, array step: 0x10 */
-      __IO uint32_t DSR_BCR;                           /**< DMA Status Register / Byte Count Register, array offset: 0x108, array step: 0x10 */
-      struct {                                         /* offset: 0x108, array step: 0x10 */
-             uint8_t RESERVED_0[3];
-        __IO uint8_t DSR;                                /**< DMA_DSR0 register...DMA_DSR3 register., array offset: 0x10B, array step: 0x10 */
-      } DMA_DSR_ACCESS8BIT;
-    };
-    __IO uint32_t DCR;                               /**< DMA Control Register, array offset: 0x10C, array step: 0x10 */
-  } DMA[4];
-} DMA_Type;
-
-/* ----------------------------------------------------------------------------
-   -- DMA Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup DMA_Register_Masks DMA Register Masks
- * @{
- */
-
-/* REQC_ARR Bit Fields */
-#define DMA_REQC_ARR_DMAC_MASK                   0xFu
-#define DMA_REQC_ARR_DMAC_SHIFT                  0
-#define DMA_REQC_ARR_DMAC(x)                     (((uint8_t)(((uint8_t)(x))<<DMA_REQC_ARR_DMAC_SHIFT))&DMA_REQC_ARR_DMAC_MASK)
-#define DMA_REQC_ARR_CFSM_MASK                   0x80u
-#define DMA_REQC_ARR_CFSM_SHIFT                  7
-/* SAR Bit Fields */
-#define DMA_SAR_SAR_MASK                         0xFFFFFFFFu
-#define DMA_SAR_SAR_SHIFT                        0
-#define DMA_SAR_SAR(x)                           (((uint32_t)(((uint32_t)(x))<<DMA_SAR_SAR_SHIFT))&DMA_SAR_SAR_MASK)
-/* DAR Bit Fields */
-#define DMA_DAR_DAR_MASK                         0xFFFFFFFFu
-#define DMA_DAR_DAR_SHIFT                        0
-#define DMA_DAR_DAR(x)                           (((uint32_t)(((uint32_t)(x))<<DMA_DAR_DAR_SHIFT))&DMA_DAR_DAR_MASK)
-/* DSR_BCR Bit Fields */
-#define DMA_DSR_BCR_BCR_MASK                     0xFFFFFFu
-#define DMA_DSR_BCR_BCR_SHIFT                    0
-#define DMA_DSR_BCR_BCR(x)                       (((uint32_t)(((uint32_t)(x))<<DMA_DSR_BCR_BCR_SHIFT))&DMA_DSR_BCR_BCR_MASK)
-#define DMA_DSR_BCR_DONE_MASK                    0x1000000u
-#define DMA_DSR_BCR_DONE_SHIFT                   24
-#define DMA_DSR_BCR_BSY_MASK                     0x2000000u
-#define DMA_DSR_BCR_BSY_SHIFT                    25
-#define DMA_DSR_BCR_REQ_MASK                     0x4000000u
-#define DMA_DSR_BCR_REQ_SHIFT                    26
-#define DMA_DSR_BCR_BED_MASK                     0x10000000u
-#define DMA_DSR_BCR_BED_SHIFT                    28
-#define DMA_DSR_BCR_BES_MASK                     0x20000000u
-#define DMA_DSR_BCR_BES_SHIFT                    29
-#define DMA_DSR_BCR_CE_MASK                      0x40000000u
-#define DMA_DSR_BCR_CE_SHIFT                     30
-/* DCR Bit Fields */
-#define DMA_DCR_LCH2_MASK                        0x3u
-#define DMA_DCR_LCH2_SHIFT                       0
-#define DMA_DCR_LCH2(x)                          (((uint32_t)(((uint32_t)(x))<<DMA_DCR_LCH2_SHIFT))&DMA_DCR_LCH2_MASK)
-#define DMA_DCR_LCH1_MASK                        0xCu
-#define DMA_DCR_LCH1_SHIFT                       2
-#define DMA_DCR_LCH1(x)                          (((uint32_t)(((uint32_t)(x))<<DMA_DCR_LCH1_SHIFT))&DMA_DCR_LCH1_MASK)
-#define DMA_DCR_LINKCC_MASK                      0x30u
-#define DMA_DCR_LINKCC_SHIFT                     4
-#define DMA_DCR_LINKCC(x)                        (((uint32_t)(((uint32_t)(x))<<DMA_DCR_LINKCC_SHIFT))&DMA_DCR_LINKCC_MASK)
-#define DMA_DCR_D_REQ_MASK                       0x80u
-#define DMA_DCR_D_REQ_SHIFT                      7
-#define DMA_DCR_DMOD_MASK                        0xF00u
-#define DMA_DCR_DMOD_SHIFT                       8
-#define DMA_DCR_DMOD(x)                          (((uint32_t)(((uint32_t)(x))<<DMA_DCR_DMOD_SHIFT))&DMA_DCR_DMOD_MASK)
-#define DMA_DCR_SMOD_MASK                        0xF000u
-#define DMA_DCR_SMOD_SHIFT                       12
-#define DMA_DCR_SMOD(x)                          (((uint32_t)(((uint32_t)(x))<<DMA_DCR_SMOD_SHIFT))&DMA_DCR_SMOD_MASK)
-#define DMA_DCR_START_MASK                       0x10000u
-#define DMA_DCR_START_SHIFT                      16
-#define DMA_DCR_DSIZE_MASK                       0x60000u
-#define DMA_DCR_DSIZE_SHIFT                      17
-#define DMA_DCR_DSIZE(x)                         (((uint32_t)(((uint32_t)(x))<<DMA_DCR_DSIZE_SHIFT))&DMA_DCR_DSIZE_MASK)
-#define DMA_DCR_DINC_MASK                        0x80000u
-#define DMA_DCR_DINC_SHIFT                       19
-#define DMA_DCR_SSIZE_MASK                       0x300000u
-#define DMA_DCR_SSIZE_SHIFT                      20
-#define DMA_DCR_SSIZE(x)                         (((uint32_t)(((uint32_t)(x))<<DMA_DCR_SSIZE_SHIFT))&DMA_DCR_SSIZE_MASK)
-#define DMA_DCR_SINC_MASK                        0x400000u
-#define DMA_DCR_SINC_SHIFT                       22
-#define DMA_DCR_EADREQ_MASK                      0x800000u
-#define DMA_DCR_EADREQ_SHIFT                     23
-#define DMA_DCR_AA_MASK                          0x10000000u
-#define DMA_DCR_AA_SHIFT                         28
-#define DMA_DCR_CS_MASK                          0x20000000u
-#define DMA_DCR_CS_SHIFT                         29
-#define DMA_DCR_ERQ_MASK                         0x40000000u
-#define DMA_DCR_ERQ_SHIFT                        30
-#define DMA_DCR_EINT_MASK                        0x80000000u
-#define DMA_DCR_EINT_SHIFT                       31
-
-/**
- * @}
- */ /* end of group DMA_Register_Masks */
-
-
-/* DMA - Peripheral instance base addresses */
-/** Peripheral DMA base address */
-#define DMA_BASE                                 (0x40008000u)
-/** Peripheral DMA base pointer */
-#define DMA0                                     ((DMA_Type *)DMA_BASE)
-/** Array initializer of DMA peripheral base pointers */
-#define DMA_BASES                                { DMA0 }
-
-/**
- * @}
- */ /* end of group DMA_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- DMAMUX Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup DMAMUX_Peripheral_Access_Layer DMAMUX Peripheral Access Layer
- * @{
- */
-
-/** DMAMUX - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t CHCFG[4];                           /**< Channel Configuration register, array offset: 0x0, array step: 0x1 */
-} DMAMUX_Type;
-
-/* ----------------------------------------------------------------------------
-   -- DMAMUX Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup DMAMUX_Register_Masks DMAMUX Register Masks
- * @{
- */
-
-/* CHCFG Bit Fields */
-#define DMAMUX_CHCFG_SOURCE_MASK                 0x3Fu
-#define DMAMUX_CHCFG_SOURCE_SHIFT                0
-#define DMAMUX_CHCFG_SOURCE(x)                   (((uint8_t)(((uint8_t)(x))<<DMAMUX_CHCFG_SOURCE_SHIFT))&DMAMUX_CHCFG_SOURCE_MASK)
-#define DMAMUX_CHCFG_TRIG_MASK                   0x40u
-#define DMAMUX_CHCFG_TRIG_SHIFT                  6
-#define DMAMUX_CHCFG_ENBL_MASK                   0x80u
-#define DMAMUX_CHCFG_ENBL_SHIFT                  7
-
-/**
- * @}
- */ /* end of group DMAMUX_Register_Masks */
-
-
-/* DMAMUX - Peripheral instance base addresses */
-/** Peripheral DMAMUX0 base address */
-#define DMAMUX0_BASE                             (0x40021000u)
-/** Peripheral DMAMUX0 base pointer */
-#define DMAMUX0                                  ((DMAMUX_Type *)DMAMUX0_BASE)
-/** Array initializer of DMAMUX peripheral base pointers */
-#define DMAMUX_BASES                             { DMAMUX0 }
-
-/**
- * @}
- */ /* end of group DMAMUX_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- FGPIO Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup FGPIO_Peripheral_Access_Layer FGPIO Peripheral Access Layer
- * @{
- */
-
-/** FGPIO - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t PDOR;                              /**< Port Data Output Register, offset: 0x0 */
-  __O  uint32_t PSOR;                              /**< Port Set Output Register, offset: 0x4 */
-  __O  uint32_t PCOR;                              /**< Port Clear Output Register, offset: 0x8 */
-  __O  uint32_t PTOR;                              /**< Port Toggle Output Register, offset: 0xC */
-  __I  uint32_t PDIR;                              /**< Port Data Input Register, offset: 0x10 */
-  __IO uint32_t PDDR;                              /**< Port Data Direction Register, offset: 0x14 */
-} FGPIO_Type;
-
-/* ----------------------------------------------------------------------------
-   -- FGPIO Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup FGPIO_Register_Masks FGPIO Register Masks
- * @{
- */
-
-/* PDOR Bit Fields */
-#define FGPIO_PDOR_PDO_MASK                      0xFFFFFFFFu
-#define FGPIO_PDOR_PDO_SHIFT                     0
-#define FGPIO_PDOR_PDO(x)                        (((uint32_t)(((uint32_t)(x))<<FGPIO_PDOR_PDO_SHIFT))&FGPIO_PDOR_PDO_MASK)
-/* PSOR Bit Fields */
-#define FGPIO_PSOR_PTSO_MASK                     0xFFFFFFFFu
-#define FGPIO_PSOR_PTSO_SHIFT                    0
-#define FGPIO_PSOR_PTSO(x)                       (((uint32_t)(((uint32_t)(x))<<FGPIO_PSOR_PTSO_SHIFT))&FGPIO_PSOR_PTSO_MASK)
-/* PCOR Bit Fields */
-#define FGPIO_PCOR_PTCO_MASK                     0xFFFFFFFFu
-#define FGPIO_PCOR_PTCO_SHIFT                    0
-#define FGPIO_PCOR_PTCO(x)                       (((uint32_t)(((uint32_t)(x))<<FGPIO_PCOR_PTCO_SHIFT))&FGPIO_PCOR_PTCO_MASK)
-/* PTOR Bit Fields */
-#define FGPIO_PTOR_PTTO_MASK                     0xFFFFFFFFu
-#define FGPIO_PTOR_PTTO_SHIFT                    0
-#define FGPIO_PTOR_PTTO(x)                       (((uint32_t)(((uint32_t)(x))<<FGPIO_PTOR_PTTO_SHIFT))&FGPIO_PTOR_PTTO_MASK)
-/* PDIR Bit Fields */
-#define FGPIO_PDIR_PDI_MASK                      0xFFFFFFFFu
-#define FGPIO_PDIR_PDI_SHIFT                     0
-#define FGPIO_PDIR_PDI(x)                        (((uint32_t)(((uint32_t)(x))<<FGPIO_PDIR_PDI_SHIFT))&FGPIO_PDIR_PDI_MASK)
-/* PDDR Bit Fields */
-#define FGPIO_PDDR_PDD_MASK                      0xFFFFFFFFu
-#define FGPIO_PDDR_PDD_SHIFT                     0
-#define FGPIO_PDDR_PDD(x)                        (((uint32_t)(((uint32_t)(x))<<FGPIO_PDDR_PDD_SHIFT))&FGPIO_PDDR_PDD_MASK)
-
-/**
- * @}
- */ /* end of group FGPIO_Register_Masks */
-
-
-/* FGPIO - Peripheral instance base addresses */
-/** Peripheral FPTA base address */
-#define FPTA_BASE                                (0xF80FF000u)
-/** Peripheral FPTA base pointer */
-#define FPTA                                     ((FGPIO_Type *)FPTA_BASE)
-/** Peripheral FPTB base address */
-#define FPTB_BASE                                (0xF80FF040u)
-/** Peripheral FPTB base pointer */
-#define FPTB                                     ((FGPIO_Type *)FPTB_BASE)
-/** Peripheral FPTC base address */
-#define FPTC_BASE                                (0xF80FF080u)
-/** Peripheral FPTC base pointer */
-#define FPTC                                     ((FGPIO_Type *)FPTC_BASE)
-/** Peripheral FPTD base address */
-#define FPTD_BASE                                (0xF80FF0C0u)
-/** Peripheral FPTD base pointer */
-#define FPTD                                     ((FGPIO_Type *)FPTD_BASE)
-/** Peripheral FPTE base address */
-#define FPTE_BASE                                (0xF80FF100u)
-/** Peripheral FPTE base pointer */
-#define FPTE                                     ((FGPIO_Type *)FPTE_BASE)
-/** Array initializer of FGPIO peripheral base pointers */
-#define FGPIO_BASES                              { FPTA, FPTB, FPTC, FPTD, FPTE }
-
-/**
- * @}
- */ /* end of group FGPIO_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- FTFA Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup FTFA_Peripheral_Access_Layer FTFA Peripheral Access Layer
- * @{
- */
-
-/** FTFA - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t FSTAT;                              /**< Flash Status Register, offset: 0x0 */
-  __IO uint8_t FCNFG;                              /**< Flash Configuration Register, offset: 0x1 */
-  __I  uint8_t FSEC;                               /**< Flash Security Register, offset: 0x2 */
-  __I  uint8_t FOPT;                               /**< Flash Option Register, offset: 0x3 */
-  __IO uint8_t FCCOB3;                             /**< Flash Common Command Object Registers, offset: 0x4 */
-  __IO uint8_t FCCOB2;                             /**< Flash Common Command Object Registers, offset: 0x5 */
-  __IO uint8_t FCCOB1;                             /**< Flash Common Command Object Registers, offset: 0x6 */
-  __IO uint8_t FCCOB0;                             /**< Flash Common Command Object Registers, offset: 0x7 */
-  __IO uint8_t FCCOB7;                             /**< Flash Common Command Object Registers, offset: 0x8 */
-  __IO uint8_t FCCOB6;                             /**< Flash Common Command Object Registers, offset: 0x9 */
-  __IO uint8_t FCCOB5;                             /**< Flash Common Command Object Registers, offset: 0xA */
-  __IO uint8_t FCCOB4;                             /**< Flash Common Command Object Registers, offset: 0xB */
-  __IO uint8_t FCCOBB;                             /**< Flash Common Command Object Registers, offset: 0xC */
-  __IO uint8_t FCCOBA;                             /**< Flash Common Command Object Registers, offset: 0xD */
-  __IO uint8_t FCCOB9;                             /**< Flash Common Command Object Registers, offset: 0xE */
-  __IO uint8_t FCCOB8;                             /**< Flash Common Command Object Registers, offset: 0xF */
-  __IO uint8_t FPROT3;                             /**< Program Flash Protection Registers, offset: 0x10 */
-  __IO uint8_t FPROT2;                             /**< Program Flash Protection Registers, offset: 0x11 */
-  __IO uint8_t FPROT1;                             /**< Program Flash Protection Registers, offset: 0x12 */
-  __IO uint8_t FPROT0;                             /**< Program Flash Protection Registers, offset: 0x13 */
-} FTFA_Type;
-
-/* ----------------------------------------------------------------------------
-   -- FTFA Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup FTFA_Register_Masks FTFA Register Masks
- * @{
- */
-
-/* FSTAT Bit Fields */
-#define FTFA_FSTAT_MGSTAT0_MASK                  0x1u
-#define FTFA_FSTAT_MGSTAT0_SHIFT                 0
-#define FTFA_FSTAT_FPVIOL_MASK                   0x10u
-#define FTFA_FSTAT_FPVIOL_SHIFT                  4
-#define FTFA_FSTAT_ACCERR_MASK                   0x20u
-#define FTFA_FSTAT_ACCERR_SHIFT                  5
-#define FTFA_FSTAT_RDCOLERR_MASK                 0x40u
-#define FTFA_FSTAT_RDCOLERR_SHIFT                6
-#define FTFA_FSTAT_CCIF_MASK                     0x80u
-#define FTFA_FSTAT_CCIF_SHIFT                    7
-/* FCNFG Bit Fields */
-#define FTFA_FCNFG_ERSSUSP_MASK                  0x10u
-#define FTFA_FCNFG_ERSSUSP_SHIFT                 4
-#define FTFA_FCNFG_ERSAREQ_MASK                  0x20u
-#define FTFA_FCNFG_ERSAREQ_SHIFT                 5
-#define FTFA_FCNFG_RDCOLLIE_MASK                 0x40u
-#define FTFA_FCNFG_RDCOLLIE_SHIFT                6
-#define FTFA_FCNFG_CCIE_MASK                     0x80u
-#define FTFA_FCNFG_CCIE_SHIFT                    7
-/* FSEC Bit Fields */
-#define FTFA_FSEC_SEC_MASK                       0x3u
-#define FTFA_FSEC_SEC_SHIFT                      0
-#define FTFA_FSEC_SEC(x)                         (((uint8_t)(((uint8_t)(x))<<FTFA_FSEC_SEC_SHIFT))&FTFA_FSEC_SEC_MASK)
-#define FTFA_FSEC_FSLACC_MASK                    0xCu
-#define FTFA_FSEC_FSLACC_SHIFT                   2
-#define FTFA_FSEC_FSLACC(x)                      (((uint8_t)(((uint8_t)(x))<<FTFA_FSEC_FSLACC_SHIFT))&FTFA_FSEC_FSLACC_MASK)
-#define FTFA_FSEC_MEEN_MASK                      0x30u
-#define FTFA_FSEC_MEEN_SHIFT                     4
-#define FTFA_FSEC_MEEN(x)                        (((uint8_t)(((uint8_t)(x))<<FTFA_FSEC_MEEN_SHIFT))&FTFA_FSEC_MEEN_MASK)
-#define FTFA_FSEC_KEYEN_MASK                     0xC0u
-#define FTFA_FSEC_KEYEN_SHIFT                    6
-#define FTFA_FSEC_KEYEN(x)                       (((uint8_t)(((uint8_t)(x))<<FTFA_FSEC_KEYEN_SHIFT))&FTFA_FSEC_KEYEN_MASK)
-/* FOPT Bit Fields */
-#define FTFA_FOPT_OPT_MASK                       0xFFu
-#define FTFA_FOPT_OPT_SHIFT                      0
-#define FTFA_FOPT_OPT(x)                         (((uint8_t)(((uint8_t)(x))<<FTFA_FOPT_OPT_SHIFT))&FTFA_FOPT_OPT_MASK)
-/* FCCOB3 Bit Fields */
-#define FTFA_FCCOB3_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB3_CCOBn_SHIFT                  0
-#define FTFA_FCCOB3_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB3_CCOBn_SHIFT))&FTFA_FCCOB3_CCOBn_MASK)
-/* FCCOB2 Bit Fields */
-#define FTFA_FCCOB2_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB2_CCOBn_SHIFT                  0
-#define FTFA_FCCOB2_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB2_CCOBn_SHIFT))&FTFA_FCCOB2_CCOBn_MASK)
-/* FCCOB1 Bit Fields */
-#define FTFA_FCCOB1_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB1_CCOBn_SHIFT                  0
-#define FTFA_FCCOB1_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB1_CCOBn_SHIFT))&FTFA_FCCOB1_CCOBn_MASK)
-/* FCCOB0 Bit Fields */
-#define FTFA_FCCOB0_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB0_CCOBn_SHIFT                  0
-#define FTFA_FCCOB0_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB0_CCOBn_SHIFT))&FTFA_FCCOB0_CCOBn_MASK)
-/* FCCOB7 Bit Fields */
-#define FTFA_FCCOB7_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB7_CCOBn_SHIFT                  0
-#define FTFA_FCCOB7_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB7_CCOBn_SHIFT))&FTFA_FCCOB7_CCOBn_MASK)
-/* FCCOB6 Bit Fields */
-#define FTFA_FCCOB6_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB6_CCOBn_SHIFT                  0
-#define FTFA_FCCOB6_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB6_CCOBn_SHIFT))&FTFA_FCCOB6_CCOBn_MASK)
-/* FCCOB5 Bit Fields */
-#define FTFA_FCCOB5_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB5_CCOBn_SHIFT                  0
-#define FTFA_FCCOB5_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB5_CCOBn_SHIFT))&FTFA_FCCOB5_CCOBn_MASK)
-/* FCCOB4 Bit Fields */
-#define FTFA_FCCOB4_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB4_CCOBn_SHIFT                  0
-#define FTFA_FCCOB4_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB4_CCOBn_SHIFT))&FTFA_FCCOB4_CCOBn_MASK)
-/* FCCOBB Bit Fields */
-#define FTFA_FCCOBB_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOBB_CCOBn_SHIFT                  0
-#define FTFA_FCCOBB_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOBB_CCOBn_SHIFT))&FTFA_FCCOBB_CCOBn_MASK)
-/* FCCOBA Bit Fields */
-#define FTFA_FCCOBA_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOBA_CCOBn_SHIFT                  0
-#define FTFA_FCCOBA_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOBA_CCOBn_SHIFT))&FTFA_FCCOBA_CCOBn_MASK)
-/* FCCOB9 Bit Fields */
-#define FTFA_FCCOB9_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB9_CCOBn_SHIFT                  0
-#define FTFA_FCCOB9_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB9_CCOBn_SHIFT))&FTFA_FCCOB9_CCOBn_MASK)
-/* FCCOB8 Bit Fields */
-#define FTFA_FCCOB8_CCOBn_MASK                   0xFFu
-#define FTFA_FCCOB8_CCOBn_SHIFT                  0
-#define FTFA_FCCOB8_CCOBn(x)                     (((uint8_t)(((uint8_t)(x))<<FTFA_FCCOB8_CCOBn_SHIFT))&FTFA_FCCOB8_CCOBn_MASK)
-/* FPROT3 Bit Fields */
-#define FTFA_FPROT3_PROT_MASK                    0xFFu
-#define FTFA_FPROT3_PROT_SHIFT                   0
-#define FTFA_FPROT3_PROT(x)                      (((uint8_t)(((uint8_t)(x))<<FTFA_FPROT3_PROT_SHIFT))&FTFA_FPROT3_PROT_MASK)
-/* FPROT2 Bit Fields */
-#define FTFA_FPROT2_PROT_MASK                    0xFFu
-#define FTFA_FPROT2_PROT_SHIFT                   0
-#define FTFA_FPROT2_PROT(x)                      (((uint8_t)(((uint8_t)(x))<<FTFA_FPROT2_PROT_SHIFT))&FTFA_FPROT2_PROT_MASK)
-/* FPROT1 Bit Fields */
-#define FTFA_FPROT1_PROT_MASK                    0xFFu
-#define FTFA_FPROT1_PROT_SHIFT                   0
-#define FTFA_FPROT1_PROT(x)                      (((uint8_t)(((uint8_t)(x))<<FTFA_FPROT1_PROT_SHIFT))&FTFA_FPROT1_PROT_MASK)
-/* FPROT0 Bit Fields */
-#define FTFA_FPROT0_PROT_MASK                    0xFFu
-#define FTFA_FPROT0_PROT_SHIFT                   0
-#define FTFA_FPROT0_PROT(x)                      (((uint8_t)(((uint8_t)(x))<<FTFA_FPROT0_PROT_SHIFT))&FTFA_FPROT0_PROT_MASK)
-
-/**
- * @}
- */ /* end of group FTFA_Register_Masks */
-
-
-/* FTFA - Peripheral instance base addresses */
-/** Peripheral FTFA base address */
-#define FTFA_BASE                                (0x40020000u)
-/** Peripheral FTFA base pointer */
-#define FTFA                                     ((FTFA_Type *)FTFA_BASE)
-/** Array initializer of FTFA peripheral base pointers */
-#define FTFA_BASES                               { FTFA }
-
-/**
- * @}
- */ /* end of group FTFA_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- GPIO Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup GPIO_Peripheral_Access_Layer GPIO Peripheral Access Layer
- * @{
- */
-
-/** GPIO - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t PDOR;                              /**< Port Data Output Register, offset: 0x0 */
-  __O  uint32_t PSOR;                              /**< Port Set Output Register, offset: 0x4 */
-  __O  uint32_t PCOR;                              /**< Port Clear Output Register, offset: 0x8 */
-  __O  uint32_t PTOR;                              /**< Port Toggle Output Register, offset: 0xC */
-  __I  uint32_t PDIR;                              /**< Port Data Input Register, offset: 0x10 */
-  __IO uint32_t PDDR;                              /**< Port Data Direction Register, offset: 0x14 */
-} GPIO_Type;
-
-/* ----------------------------------------------------------------------------
-   -- GPIO Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup GPIO_Register_Masks GPIO Register Masks
- * @{
- */
-
-/* PDOR Bit Fields */
-#define GPIO_PDOR_PDO_MASK                       0xFFFFFFFFu
-#define GPIO_PDOR_PDO_SHIFT                      0
-#define GPIO_PDOR_PDO(x)                         (((uint32_t)(((uint32_t)(x))<<GPIO_PDOR_PDO_SHIFT))&GPIO_PDOR_PDO_MASK)
-/* PSOR Bit Fields */
-#define GPIO_PSOR_PTSO_MASK                      0xFFFFFFFFu
-#define GPIO_PSOR_PTSO_SHIFT                     0
-#define GPIO_PSOR_PTSO(x)                        (((uint32_t)(((uint32_t)(x))<<GPIO_PSOR_PTSO_SHIFT))&GPIO_PSOR_PTSO_MASK)
-/* PCOR Bit Fields */
-#define GPIO_PCOR_PTCO_MASK                      0xFFFFFFFFu
-#define GPIO_PCOR_PTCO_SHIFT                     0
-#define GPIO_PCOR_PTCO(x)                        (((uint32_t)(((uint32_t)(x))<<GPIO_PCOR_PTCO_SHIFT))&GPIO_PCOR_PTCO_MASK)
-/* PTOR Bit Fields */
-#define GPIO_PTOR_PTTO_MASK                      0xFFFFFFFFu
-#define GPIO_PTOR_PTTO_SHIFT                     0
-#define GPIO_PTOR_PTTO(x)                        (((uint32_t)(((uint32_t)(x))<<GPIO_PTOR_PTTO_SHIFT))&GPIO_PTOR_PTTO_MASK)
-/* PDIR Bit Fields */
-#define GPIO_PDIR_PDI_MASK                       0xFFFFFFFFu
-#define GPIO_PDIR_PDI_SHIFT                      0
-#define GPIO_PDIR_PDI(x)                         (((uint32_t)(((uint32_t)(x))<<GPIO_PDIR_PDI_SHIFT))&GPIO_PDIR_PDI_MASK)
-/* PDDR Bit Fields */
-#define GPIO_PDDR_PDD_MASK                       0xFFFFFFFFu
-#define GPIO_PDDR_PDD_SHIFT                      0
-#define GPIO_PDDR_PDD(x)                         (((uint32_t)(((uint32_t)(x))<<GPIO_PDDR_PDD_SHIFT))&GPIO_PDDR_PDD_MASK)
-
-/**
- * @}
- */ /* end of group GPIO_Register_Masks */
-
-
-/* GPIO - Peripheral instance base addresses */
-/** Peripheral PTA base address */
-#define PTA_BASE                                 (0x400FF000u)
-/** Peripheral PTA base pointer */
-#define PTA                                      ((GPIO_Type *)PTA_BASE)
-/** Peripheral PTB base address */
-#define PTB_BASE                                 (0x400FF040u)
-/** Peripheral PTB base pointer */
-#define PTB                                      ((GPIO_Type *)PTB_BASE)
-/** Peripheral PTC base address */
-#define PTC_BASE                                 (0x400FF080u)
-/** Peripheral PTC base pointer */
-#define PTC                                      ((GPIO_Type *)PTC_BASE)
-/** Peripheral PTD base address */
-#define PTD_BASE                                 (0x400FF0C0u)
-/** Peripheral PTD base pointer */
-#define PTD                                      ((GPIO_Type *)PTD_BASE)
-/** Peripheral PTE base address */
-#define PTE_BASE                                 (0x400FF100u)
-/** Peripheral PTE base pointer */
-#define PTE                                      ((GPIO_Type *)PTE_BASE)
-/** Array initializer of GPIO peripheral base pointers */
-#define GPIO_BASES                               { PTA, PTB, PTC, PTD, PTE }
-
-/**
- * @}
- */ /* end of group GPIO_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- I2C Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup I2C_Peripheral_Access_Layer I2C Peripheral Access Layer
- * @{
- */
-
-/** I2C - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t A1;                                 /**< I2C Address Register 1, offset: 0x0 */
-  __IO uint8_t F;                                  /**< I2C Frequency Divider register, offset: 0x1 */
-  __IO uint8_t C1;                                 /**< I2C Control Register 1, offset: 0x2 */
-  __IO uint8_t S;                                  /**< I2C Status register, offset: 0x3 */
-  __IO uint8_t D;                                  /**< I2C Data I/O register, offset: 0x4 */
-  __IO uint8_t C2;                                 /**< I2C Control Register 2, offset: 0x5 */
-  __IO uint8_t FLT;                                /**< I2C Programmable Input Glitch Filter register, offset: 0x6 */
-  __IO uint8_t RA;                                 /**< I2C Range Address register, offset: 0x7 */
-  __IO uint8_t SMB;                                /**< I2C SMBus Control and Status register, offset: 0x8 */
-  __IO uint8_t A2;                                 /**< I2C Address Register 2, offset: 0x9 */
-  __IO uint8_t SLTH;                               /**< I2C SCL Low Timeout Register High, offset: 0xA */
-  __IO uint8_t SLTL;                               /**< I2C SCL Low Timeout Register Low, offset: 0xB */
-} I2C_Type;
-
-/* ----------------------------------------------------------------------------
-   -- I2C Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup I2C_Register_Masks I2C Register Masks
- * @{
- */
-
-/* A1 Bit Fields */
-#define I2C_A1_AD_MASK                           0xFEu
-#define I2C_A1_AD_SHIFT                          1
-#define I2C_A1_AD(x)                             (((uint8_t)(((uint8_t)(x))<<I2C_A1_AD_SHIFT))&I2C_A1_AD_MASK)
-/* F Bit Fields */
-#define I2C_F_ICR_MASK                           0x3Fu
-#define I2C_F_ICR_SHIFT                          0
-#define I2C_F_ICR(x)                             (((uint8_t)(((uint8_t)(x))<<I2C_F_ICR_SHIFT))&I2C_F_ICR_MASK)
-#define I2C_F_MULT_MASK                          0xC0u
-#define I2C_F_MULT_SHIFT                         6
-#define I2C_F_MULT(x)                            (((uint8_t)(((uint8_t)(x))<<I2C_F_MULT_SHIFT))&I2C_F_MULT_MASK)
-/* C1 Bit Fields */
-#define I2C_C1_DMAEN_MASK                        0x1u
-#define I2C_C1_DMAEN_SHIFT                       0
-#define I2C_C1_WUEN_MASK                         0x2u
-#define I2C_C1_WUEN_SHIFT                        1
-#define I2C_C1_RSTA_MASK                         0x4u
-#define I2C_C1_RSTA_SHIFT                        2
-#define I2C_C1_TXAK_MASK                         0x8u
-#define I2C_C1_TXAK_SHIFT                        3
-#define I2C_C1_TX_MASK                           0x10u
-#define I2C_C1_TX_SHIFT                          4
-#define I2C_C1_MST_MASK                          0x20u
-#define I2C_C1_MST_SHIFT                         5
-#define I2C_C1_IICIE_MASK                        0x40u
-#define I2C_C1_IICIE_SHIFT                       6
-#define I2C_C1_IICEN_MASK                        0x80u
-#define I2C_C1_IICEN_SHIFT                       7
-/* S Bit Fields */
-#define I2C_S_RXAK_MASK                          0x1u
-#define I2C_S_RXAK_SHIFT                         0
-#define I2C_S_IICIF_MASK                         0x2u
-#define I2C_S_IICIF_SHIFT                        1
-#define I2C_S_SRW_MASK                           0x4u
-#define I2C_S_SRW_SHIFT                          2
-#define I2C_S_RAM_MASK                           0x8u
-#define I2C_S_RAM_SHIFT                          3
-#define I2C_S_ARBL_MASK                          0x10u
-#define I2C_S_ARBL_SHIFT                         4
-#define I2C_S_BUSY_MASK                          0x20u
-#define I2C_S_BUSY_SHIFT                         5
-#define I2C_S_IAAS_MASK                          0x40u
-#define I2C_S_IAAS_SHIFT                         6
-#define I2C_S_TCF_MASK                           0x80u
-#define I2C_S_TCF_SHIFT                          7
-/* D Bit Fields */
-#define I2C_D_DATA_MASK                          0xFFu
-#define I2C_D_DATA_SHIFT                         0
-#define I2C_D_DATA(x)                            (((uint8_t)(((uint8_t)(x))<<I2C_D_DATA_SHIFT))&I2C_D_DATA_MASK)
-/* C2 Bit Fields */
-#define I2C_C2_AD_MASK                           0x7u
-#define I2C_C2_AD_SHIFT                          0
-#define I2C_C2_AD(x)                             (((uint8_t)(((uint8_t)(x))<<I2C_C2_AD_SHIFT))&I2C_C2_AD_MASK)
-#define I2C_C2_RMEN_MASK                         0x8u
-#define I2C_C2_RMEN_SHIFT                        3
-#define I2C_C2_SBRC_MASK                         0x10u
-#define I2C_C2_SBRC_SHIFT                        4
-#define I2C_C2_HDRS_MASK                         0x20u
-#define I2C_C2_HDRS_SHIFT                        5
-#define I2C_C2_ADEXT_MASK                        0x40u
-#define I2C_C2_ADEXT_SHIFT                       6
-#define I2C_C2_GCAEN_MASK                        0x80u
-#define I2C_C2_GCAEN_SHIFT                       7
-/* FLT Bit Fields */
-#define I2C_FLT_FLT_MASK                         0x1Fu
-#define I2C_FLT_FLT_SHIFT                        0
-#define I2C_FLT_FLT(x)                           (((uint8_t)(((uint8_t)(x))<<I2C_FLT_FLT_SHIFT))&I2C_FLT_FLT_MASK)
-#define I2C_FLT_STOPIE_MASK                      0x20u
-#define I2C_FLT_STOPIE_SHIFT                     5
-#define I2C_FLT_STOPF_MASK                       0x40u
-#define I2C_FLT_STOPF_SHIFT                      6
-#define I2C_FLT_SHEN_MASK                        0x80u
-#define I2C_FLT_SHEN_SHIFT                       7
-/* RA Bit Fields */
-#define I2C_RA_RAD_MASK                          0xFEu
-#define I2C_RA_RAD_SHIFT                         1
-#define I2C_RA_RAD(x)                            (((uint8_t)(((uint8_t)(x))<<I2C_RA_RAD_SHIFT))&I2C_RA_RAD_MASK)
-/* SMB Bit Fields */
-#define I2C_SMB_SHTF2IE_MASK                     0x1u
-#define I2C_SMB_SHTF2IE_SHIFT                    0
-#define I2C_SMB_SHTF2_MASK                       0x2u
-#define I2C_SMB_SHTF2_SHIFT                      1
-#define I2C_SMB_SHTF1_MASK                       0x4u
-#define I2C_SMB_SHTF1_SHIFT                      2
-#define I2C_SMB_SLTF_MASK                        0x8u
-#define I2C_SMB_SLTF_SHIFT                       3
-#define I2C_SMB_TCKSEL_MASK                      0x10u
-#define I2C_SMB_TCKSEL_SHIFT                     4
-#define I2C_SMB_SIICAEN_MASK                     0x20u
-#define I2C_SMB_SIICAEN_SHIFT                    5
-#define I2C_SMB_ALERTEN_MASK                     0x40u
-#define I2C_SMB_ALERTEN_SHIFT                    6
-#define I2C_SMB_FACK_MASK                        0x80u
-#define I2C_SMB_FACK_SHIFT                       7
-/* A2 Bit Fields */
-#define I2C_A2_SAD_MASK                          0xFEu
-#define I2C_A2_SAD_SHIFT                         1
-#define I2C_A2_SAD(x)                            (((uint8_t)(((uint8_t)(x))<<I2C_A2_SAD_SHIFT))&I2C_A2_SAD_MASK)
-/* SLTH Bit Fields */
-#define I2C_SLTH_SSLT_MASK                       0xFFu
-#define I2C_SLTH_SSLT_SHIFT                      0
-#define I2C_SLTH_SSLT(x)                         (((uint8_t)(((uint8_t)(x))<<I2C_SLTH_SSLT_SHIFT))&I2C_SLTH_SSLT_MASK)
-/* SLTL Bit Fields */
-#define I2C_SLTL_SSLT_MASK                       0xFFu
-#define I2C_SLTL_SSLT_SHIFT                      0
-#define I2C_SLTL_SSLT(x)                         (((uint8_t)(((uint8_t)(x))<<I2C_SLTL_SSLT_SHIFT))&I2C_SLTL_SSLT_MASK)
-
-/**
- * @}
- */ /* end of group I2C_Register_Masks */
-
-
-/* I2C - Peripheral instance base addresses */
-/** Peripheral I2C0 base address */
-#define I2C0_BASE                                (0x40066000u)
-/** Peripheral I2C0 base pointer */
-#define I2C0                                     ((I2C_Type *)I2C0_BASE)
-/** Peripheral I2C1 base address */
-#define I2C1_BASE                                (0x40067000u)
-/** Peripheral I2C1 base pointer */
-#define I2C1                                     ((I2C_Type *)I2C1_BASE)
-/** Array initializer of I2C peripheral base pointers */
-#define I2C_BASES                                { I2C0, I2C1 }
-
-/**
- * @}
- */ /* end of group I2C_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- LLWU Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup LLWU_Peripheral_Access_Layer LLWU Peripheral Access Layer
- * @{
- */
-
-/** LLWU - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t PE1;                                /**< LLWU Pin Enable 1 register, offset: 0x0 */
-  __IO uint8_t PE2;                                /**< LLWU Pin Enable 2 register, offset: 0x1 */
-  __IO uint8_t PE3;                                /**< LLWU Pin Enable 3 register, offset: 0x2 */
-  __IO uint8_t PE4;                                /**< LLWU Pin Enable 4 register, offset: 0x3 */
-  __IO uint8_t ME;                                 /**< LLWU Module Enable register, offset: 0x4 */
-  __IO uint8_t F1;                                 /**< LLWU Flag 1 register, offset: 0x5 */
-  __IO uint8_t F2;                                 /**< LLWU Flag 2 register, offset: 0x6 */
-  __I  uint8_t F3;                                 /**< LLWU Flag 3 register, offset: 0x7 */
-  __IO uint8_t FILT1;                              /**< LLWU Pin Filter 1 register, offset: 0x8 */
-  __IO uint8_t FILT2;                              /**< LLWU Pin Filter 2 register, offset: 0x9 */
-} LLWU_Type;
-
-/* ----------------------------------------------------------------------------
-   -- LLWU Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup LLWU_Register_Masks LLWU Register Masks
- * @{
- */
-
-/* PE1 Bit Fields */
-#define LLWU_PE1_WUPE0_MASK                      0x3u
-#define LLWU_PE1_WUPE0_SHIFT                     0
-#define LLWU_PE1_WUPE0(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE1_WUPE0_SHIFT))&LLWU_PE1_WUPE0_MASK)
-#define LLWU_PE1_WUPE1_MASK                      0xCu
-#define LLWU_PE1_WUPE1_SHIFT                     2
-#define LLWU_PE1_WUPE1(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE1_WUPE1_SHIFT))&LLWU_PE1_WUPE1_MASK)
-#define LLWU_PE1_WUPE2_MASK                      0x30u
-#define LLWU_PE1_WUPE2_SHIFT                     4
-#define LLWU_PE1_WUPE2(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE1_WUPE2_SHIFT))&LLWU_PE1_WUPE2_MASK)
-#define LLWU_PE1_WUPE3_MASK                      0xC0u
-#define LLWU_PE1_WUPE3_SHIFT                     6
-#define LLWU_PE1_WUPE3(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE1_WUPE3_SHIFT))&LLWU_PE1_WUPE3_MASK)
-/* PE2 Bit Fields */
-#define LLWU_PE2_WUPE4_MASK                      0x3u
-#define LLWU_PE2_WUPE4_SHIFT                     0
-#define LLWU_PE2_WUPE4(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE2_WUPE4_SHIFT))&LLWU_PE2_WUPE4_MASK)
-#define LLWU_PE2_WUPE5_MASK                      0xCu
-#define LLWU_PE2_WUPE5_SHIFT                     2
-#define LLWU_PE2_WUPE5(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE2_WUPE5_SHIFT))&LLWU_PE2_WUPE5_MASK)
-#define LLWU_PE2_WUPE6_MASK                      0x30u
-#define LLWU_PE2_WUPE6_SHIFT                     4
-#define LLWU_PE2_WUPE6(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE2_WUPE6_SHIFT))&LLWU_PE2_WUPE6_MASK)
-#define LLWU_PE2_WUPE7_MASK                      0xC0u
-#define LLWU_PE2_WUPE7_SHIFT                     6
-#define LLWU_PE2_WUPE7(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE2_WUPE7_SHIFT))&LLWU_PE2_WUPE7_MASK)
-/* PE3 Bit Fields */
-#define LLWU_PE3_WUPE8_MASK                      0x3u
-#define LLWU_PE3_WUPE8_SHIFT                     0
-#define LLWU_PE3_WUPE8(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE3_WUPE8_SHIFT))&LLWU_PE3_WUPE8_MASK)
-#define LLWU_PE3_WUPE9_MASK                      0xCu
-#define LLWU_PE3_WUPE9_SHIFT                     2
-#define LLWU_PE3_WUPE9(x)                        (((uint8_t)(((uint8_t)(x))<<LLWU_PE3_WUPE9_SHIFT))&LLWU_PE3_WUPE9_MASK)
-#define LLWU_PE3_WUPE10_MASK                     0x30u
-#define LLWU_PE3_WUPE10_SHIFT                    4
-#define LLWU_PE3_WUPE10(x)                       (((uint8_t)(((uint8_t)(x))<<LLWU_PE3_WUPE10_SHIFT))&LLWU_PE3_WUPE10_MASK)
-#define LLWU_PE3_WUPE11_MASK                     0xC0u
-#define LLWU_PE3_WUPE11_SHIFT                    6
-#define LLWU_PE3_WUPE11(x)                       (((uint8_t)(((uint8_t)(x))<<LLWU_PE3_WUPE11_SHIFT))&LLWU_PE3_WUPE11_MASK)
-/* PE4 Bit Fields */
-#define LLWU_PE4_WUPE12_MASK                     0x3u
-#define LLWU_PE4_WUPE12_SHIFT                    0
-#define LLWU_PE4_WUPE12(x)                       (((uint8_t)(((uint8_t)(x))<<LLWU_PE4_WUPE12_SHIFT))&LLWU_PE4_WUPE12_MASK)
-#define LLWU_PE4_WUPE13_MASK                     0xCu
-#define LLWU_PE4_WUPE13_SHIFT                    2
-#define LLWU_PE4_WUPE13(x)                       (((uint8_t)(((uint8_t)(x))<<LLWU_PE4_WUPE13_SHIFT))&LLWU_PE4_WUPE13_MASK)
-#define LLWU_PE4_WUPE14_MASK                     0x30u
-#define LLWU_PE4_WUPE14_SHIFT                    4
-#define LLWU_PE4_WUPE14(x)                       (((uint8_t)(((uint8_t)(x))<<LLWU_PE4_WUPE14_SHIFT))&LLWU_PE4_WUPE14_MASK)
-#define LLWU_PE4_WUPE15_MASK                     0xC0u
-#define LLWU_PE4_WUPE15_SHIFT                    6
-#define LLWU_PE4_WUPE15(x)                       (((uint8_t)(((uint8_t)(x))<<LLWU_PE4_WUPE15_SHIFT))&LLWU_PE4_WUPE15_MASK)
-/* ME Bit Fields */
-#define LLWU_ME_WUME0_MASK                       0x1u
-#define LLWU_ME_WUME0_SHIFT                      0
-#define LLWU_ME_WUME1_MASK                       0x2u
-#define LLWU_ME_WUME1_SHIFT                      1
-#define LLWU_ME_WUME2_MASK                       0x4u
-#define LLWU_ME_WUME2_SHIFT                      2
-#define LLWU_ME_WUME3_MASK                       0x8u
-#define LLWU_ME_WUME3_SHIFT                      3
-#define LLWU_ME_WUME4_MASK                       0x10u
-#define LLWU_ME_WUME4_SHIFT                      4
-#define LLWU_ME_WUME5_MASK                       0x20u
-#define LLWU_ME_WUME5_SHIFT                      5
-#define LLWU_ME_WUME6_MASK                       0x40u
-#define LLWU_ME_WUME6_SHIFT                      6
-#define LLWU_ME_WUME7_MASK                       0x80u
-#define LLWU_ME_WUME7_SHIFT                      7
-/* F1 Bit Fields */
-#define LLWU_F1_WUF0_MASK                        0x1u
-#define LLWU_F1_WUF0_SHIFT                       0
-#define LLWU_F1_WUF1_MASK                        0x2u
-#define LLWU_F1_WUF1_SHIFT                       1
-#define LLWU_F1_WUF2_MASK                        0x4u
-#define LLWU_F1_WUF2_SHIFT                       2
-#define LLWU_F1_WUF3_MASK                        0x8u
-#define LLWU_F1_WUF3_SHIFT                       3
-#define LLWU_F1_WUF4_MASK                        0x10u
-#define LLWU_F1_WUF4_SHIFT                       4
-#define LLWU_F1_WUF5_MASK                        0x20u
-#define LLWU_F1_WUF5_SHIFT                       5
-#define LLWU_F1_WUF6_MASK                        0x40u
-#define LLWU_F1_WUF6_SHIFT                       6
-#define LLWU_F1_WUF7_MASK                        0x80u
-#define LLWU_F1_WUF7_SHIFT                       7
-/* F2 Bit Fields */
-#define LLWU_F2_WUF8_MASK                        0x1u
-#define LLWU_F2_WUF8_SHIFT                       0
-#define LLWU_F2_WUF9_MASK                        0x2u
-#define LLWU_F2_WUF9_SHIFT                       1
-#define LLWU_F2_WUF10_MASK                       0x4u
-#define LLWU_F2_WUF10_SHIFT                      2
-#define LLWU_F2_WUF11_MASK                       0x8u
-#define LLWU_F2_WUF11_SHIFT                      3
-#define LLWU_F2_WUF12_MASK                       0x10u
-#define LLWU_F2_WUF12_SHIFT                      4
-#define LLWU_F2_WUF13_MASK                       0x20u
-#define LLWU_F2_WUF13_SHIFT                      5
-#define LLWU_F2_WUF14_MASK                       0x40u
-#define LLWU_F2_WUF14_SHIFT                      6
-#define LLWU_F2_WUF15_MASK                       0x80u
-#define LLWU_F2_WUF15_SHIFT                      7
-/* F3 Bit Fields */
-#define LLWU_F3_MWUF0_MASK                       0x1u
-#define LLWU_F3_MWUF0_SHIFT                      0
-#define LLWU_F3_MWUF1_MASK                       0x2u
-#define LLWU_F3_MWUF1_SHIFT                      1
-#define LLWU_F3_MWUF2_MASK                       0x4u
-#define LLWU_F3_MWUF2_SHIFT                      2
-#define LLWU_F3_MWUF3_MASK                       0x8u
-#define LLWU_F3_MWUF3_SHIFT                      3
-#define LLWU_F3_MWUF4_MASK                       0x10u
-#define LLWU_F3_MWUF4_SHIFT                      4
-#define LLWU_F3_MWUF5_MASK                       0x20u
-#define LLWU_F3_MWUF5_SHIFT                      5
-#define LLWU_F3_MWUF6_MASK                       0x40u
-#define LLWU_F3_MWUF6_SHIFT                      6
-#define LLWU_F3_MWUF7_MASK                       0x80u
-#define LLWU_F3_MWUF7_SHIFT                      7
-/* FILT1 Bit Fields */
-#define LLWU_FILT1_FILTSEL_MASK                  0xFu
-#define LLWU_FILT1_FILTSEL_SHIFT                 0
-#define LLWU_FILT1_FILTSEL(x)                    (((uint8_t)(((uint8_t)(x))<<LLWU_FILT1_FILTSEL_SHIFT))&LLWU_FILT1_FILTSEL_MASK)
-#define LLWU_FILT1_FILTE_MASK                    0x60u
-#define LLWU_FILT1_FILTE_SHIFT                   5
-#define LLWU_FILT1_FILTE(x)                      (((uint8_t)(((uint8_t)(x))<<LLWU_FILT1_FILTE_SHIFT))&LLWU_FILT1_FILTE_MASK)
-#define LLWU_FILT1_FILTF_MASK                    0x80u
-#define LLWU_FILT1_FILTF_SHIFT                   7
-/* FILT2 Bit Fields */
-#define LLWU_FILT2_FILTSEL_MASK                  0xFu
-#define LLWU_FILT2_FILTSEL_SHIFT                 0
-#define LLWU_FILT2_FILTSEL(x)                    (((uint8_t)(((uint8_t)(x))<<LLWU_FILT2_FILTSEL_SHIFT))&LLWU_FILT2_FILTSEL_MASK)
-#define LLWU_FILT2_FILTE_MASK                    0x60u
-#define LLWU_FILT2_FILTE_SHIFT                   5
-#define LLWU_FILT2_FILTE(x)                      (((uint8_t)(((uint8_t)(x))<<LLWU_FILT2_FILTE_SHIFT))&LLWU_FILT2_FILTE_MASK)
-#define LLWU_FILT2_FILTF_MASK                    0x80u
-#define LLWU_FILT2_FILTF_SHIFT                   7
-
-/**
- * @}
- */ /* end of group LLWU_Register_Masks */
-
-
-/* LLWU - Peripheral instance base addresses */
-/** Peripheral LLWU base address */
-#define LLWU_BASE                                (0x4007C000u)
-/** Peripheral LLWU base pointer */
-#define LLWU                                     ((LLWU_Type *)LLWU_BASE)
-/** Array initializer of LLWU peripheral base pointers */
-#define LLWU_BASES                               { LLWU }
-
-/**
- * @}
- */ /* end of group LLWU_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- LPTMR Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup LPTMR_Peripheral_Access_Layer LPTMR Peripheral Access Layer
- * @{
- */
-
-/** LPTMR - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t CSR;                               /**< Low Power Timer Control Status Register, offset: 0x0 */
-  __IO uint32_t PSR;                               /**< Low Power Timer Prescale Register, offset: 0x4 */
-  __IO uint32_t CMR;                               /**< Low Power Timer Compare Register, offset: 0x8 */
-  __I  uint32_t CNR;                               /**< Low Power Timer Counter Register, offset: 0xC */
-} LPTMR_Type;
-
-/* ----------------------------------------------------------------------------
-   -- LPTMR Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup LPTMR_Register_Masks LPTMR Register Masks
- * @{
- */
-
-/* CSR Bit Fields */
-#define LPTMR_CSR_TEN_MASK                       0x1u
-#define LPTMR_CSR_TEN_SHIFT                      0
-#define LPTMR_CSR_TMS_MASK                       0x2u
-#define LPTMR_CSR_TMS_SHIFT                      1
-#define LPTMR_CSR_TFC_MASK                       0x4u
-#define LPTMR_CSR_TFC_SHIFT                      2
-#define LPTMR_CSR_TPP_MASK                       0x8u
-#define LPTMR_CSR_TPP_SHIFT                      3
-#define LPTMR_CSR_TPS_MASK                       0x30u
-#define LPTMR_CSR_TPS_SHIFT                      4
-#define LPTMR_CSR_TPS(x)                         (((uint32_t)(((uint32_t)(x))<<LPTMR_CSR_TPS_SHIFT))&LPTMR_CSR_TPS_MASK)
-#define LPTMR_CSR_TIE_MASK                       0x40u
-#define LPTMR_CSR_TIE_SHIFT                      6
-#define LPTMR_CSR_TCF_MASK                       0x80u
-#define LPTMR_CSR_TCF_SHIFT                      7
-/* PSR Bit Fields */
-#define LPTMR_PSR_PCS_MASK                       0x3u
-#define LPTMR_PSR_PCS_SHIFT                      0
-#define LPTMR_PSR_PCS(x)                         (((uint32_t)(((uint32_t)(x))<<LPTMR_PSR_PCS_SHIFT))&LPTMR_PSR_PCS_MASK)
-#define LPTMR_PSR_PBYP_MASK                      0x4u
-#define LPTMR_PSR_PBYP_SHIFT                     2
-#define LPTMR_PSR_PRESCALE_MASK                  0x78u
-#define LPTMR_PSR_PRESCALE_SHIFT                 3
-#define LPTMR_PSR_PRESCALE(x)                    (((uint32_t)(((uint32_t)(x))<<LPTMR_PSR_PRESCALE_SHIFT))&LPTMR_PSR_PRESCALE_MASK)
-/* CMR Bit Fields */
-#define LPTMR_CMR_COMPARE_MASK                   0xFFFFu
-#define LPTMR_CMR_COMPARE_SHIFT                  0
-#define LPTMR_CMR_COMPARE(x)                     (((uint32_t)(((uint32_t)(x))<<LPTMR_CMR_COMPARE_SHIFT))&LPTMR_CMR_COMPARE_MASK)
-/* CNR Bit Fields */
-#define LPTMR_CNR_COUNTER_MASK                   0xFFFFu
-#define LPTMR_CNR_COUNTER_SHIFT                  0
-#define LPTMR_CNR_COUNTER(x)                     (((uint32_t)(((uint32_t)(x))<<LPTMR_CNR_COUNTER_SHIFT))&LPTMR_CNR_COUNTER_MASK)
-
-/**
- * @}
- */ /* end of group LPTMR_Register_Masks */
-
-
-/* LPTMR - Peripheral instance base addresses */
-/** Peripheral LPTMR0 base address */
-#define LPTMR0_BASE                              (0x40040000u)
-/** Peripheral LPTMR0 base pointer */
-#define LPTMR0                                   ((LPTMR_Type *)LPTMR0_BASE)
-/** Array initializer of LPTMR peripheral base pointers */
-#define LPTMR_BASES                              { LPTMR0 }
-
-/**
- * @}
- */ /* end of group LPTMR_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- MCG Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MCG_Peripheral_Access_Layer MCG Peripheral Access Layer
- * @{
- */
-
-/** MCG - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t C1;                                 /**< MCG Control 1 Register, offset: 0x0 */
-  __IO uint8_t C2;                                 /**< MCG Control 2 Register, offset: 0x1 */
-  __IO uint8_t C3;                                 /**< MCG Control 3 Register, offset: 0x2 */
-  __IO uint8_t C4;                                 /**< MCG Control 4 Register, offset: 0x3 */
-  __IO uint8_t C5;                                 /**< MCG Control 5 Register, offset: 0x4 */
-  __IO uint8_t C6;                                 /**< MCG Control 6 Register, offset: 0x5 */
-  __I  uint8_t S;                                  /**< MCG Status Register, offset: 0x6 */
-       uint8_t RESERVED_0[1];
-  __IO uint8_t SC;                                 /**< MCG Status and Control Register, offset: 0x8 */
-       uint8_t RESERVED_1[1];
-  __IO uint8_t ATCVH;                              /**< MCG Auto Trim Compare Value High Register, offset: 0xA */
-  __IO uint8_t ATCVL;                              /**< MCG Auto Trim Compare Value Low Register, offset: 0xB */
-  __I  uint8_t C7;                                 /**< MCG Control 7 Register, offset: 0xC */
-  __IO uint8_t C8;                                 /**< MCG Control 8 Register, offset: 0xD */
-  __I  uint8_t C9;                                 /**< MCG Control 9 Register, offset: 0xE */
-  __I  uint8_t C10;                                /**< MCG Control 10 Register, offset: 0xF */
-} MCG_Type;
-
-/* ----------------------------------------------------------------------------
-   -- MCG Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MCG_Register_Masks MCG Register Masks
- * @{
- */
-
-/* C1 Bit Fields */
-#define MCG_C1_IREFSTEN_MASK                     0x1u
-#define MCG_C1_IREFSTEN_SHIFT                    0
-#define MCG_C1_IRCLKEN_MASK                      0x2u
-#define MCG_C1_IRCLKEN_SHIFT                     1
-#define MCG_C1_IREFS_MASK                        0x4u
-#define MCG_C1_IREFS_SHIFT                       2
-#define MCG_C1_FRDIV_MASK                        0x38u
-#define MCG_C1_FRDIV_SHIFT                       3
-#define MCG_C1_FRDIV(x)                          (((uint8_t)(((uint8_t)(x))<<MCG_C1_FRDIV_SHIFT))&MCG_C1_FRDIV_MASK)
-#define MCG_C1_CLKS_MASK                         0xC0u
-#define MCG_C1_CLKS_SHIFT                        6
-#define MCG_C1_CLKS(x)                           (((uint8_t)(((uint8_t)(x))<<MCG_C1_CLKS_SHIFT))&MCG_C1_CLKS_MASK)
-/* C2 Bit Fields */
-#define MCG_C2_IRCS_MASK                         0x1u
-#define MCG_C2_IRCS_SHIFT                        0
-#define MCG_C2_LP_MASK                           0x2u
-#define MCG_C2_LP_SHIFT                          1
-#define MCG_C2_EREFS0_MASK                       0x4u
-#define MCG_C2_EREFS0_SHIFT                      2
-#define MCG_C2_HGO0_MASK                         0x8u
-#define MCG_C2_HGO0_SHIFT                        3
-#define MCG_C2_RANGE0_MASK                       0x30u
-#define MCG_C2_RANGE0_SHIFT                      4
-#define MCG_C2_RANGE0(x)                         (((uint8_t)(((uint8_t)(x))<<MCG_C2_RANGE0_SHIFT))&MCG_C2_RANGE0_MASK)
-#define MCG_C2_LOCRE0_MASK                       0x80u
-#define MCG_C2_LOCRE0_SHIFT                      7
-/* C3 Bit Fields */
-#define MCG_C3_SCTRIM_MASK                       0xFFu
-#define MCG_C3_SCTRIM_SHIFT                      0
-#define MCG_C3_SCTRIM(x)                         (((uint8_t)(((uint8_t)(x))<<MCG_C3_SCTRIM_SHIFT))&MCG_C3_SCTRIM_MASK)
-/* C4 Bit Fields */
-#define MCG_C4_SCFTRIM_MASK                      0x1u
-#define MCG_C4_SCFTRIM_SHIFT                     0
-#define MCG_C4_FCTRIM_MASK                       0x1Eu
-#define MCG_C4_FCTRIM_SHIFT                      1
-#define MCG_C4_FCTRIM(x)                         (((uint8_t)(((uint8_t)(x))<<MCG_C4_FCTRIM_SHIFT))&MCG_C4_FCTRIM_MASK)
-#define MCG_C4_DRST_DRS_MASK                     0x60u
-#define MCG_C4_DRST_DRS_SHIFT                    5
-#define MCG_C4_DRST_DRS(x)                       (((uint8_t)(((uint8_t)(x))<<MCG_C4_DRST_DRS_SHIFT))&MCG_C4_DRST_DRS_MASK)
-#define MCG_C4_DMX32_MASK                        0x80u
-#define MCG_C4_DMX32_SHIFT                       7
-/* C5 Bit Fields */
-#define MCG_C5_PRDIV0_MASK                       0x1Fu
-#define MCG_C5_PRDIV0_SHIFT                      0
-#define MCG_C5_PRDIV0(x)                         (((uint8_t)(((uint8_t)(x))<<MCG_C5_PRDIV0_SHIFT))&MCG_C5_PRDIV0_MASK)
-#define MCG_C5_PLLSTEN0_MASK                     0x20u
-#define MCG_C5_PLLSTEN0_SHIFT                    5
-#define MCG_C5_PLLCLKEN0_MASK                    0x40u
-#define MCG_C5_PLLCLKEN0_SHIFT                   6
-/* C6 Bit Fields */
-#define MCG_C6_VDIV0_MASK                        0x1Fu
-#define MCG_C6_VDIV0_SHIFT                       0
-#define MCG_C6_VDIV0(x)                          (((uint8_t)(((uint8_t)(x))<<MCG_C6_VDIV0_SHIFT))&MCG_C6_VDIV0_MASK)
-#define MCG_C6_CME0_MASK                         0x20u
-#define MCG_C6_CME0_SHIFT                        5
-#define MCG_C6_PLLS_MASK                         0x40u
-#define MCG_C6_PLLS_SHIFT                        6
-#define MCG_C6_LOLIE0_MASK                       0x80u
-#define MCG_C6_LOLIE0_SHIFT                      7
-/* S Bit Fields */
-#define MCG_S_IRCST_MASK                         0x1u
-#define MCG_S_IRCST_SHIFT                        0
-#define MCG_S_OSCINIT0_MASK                      0x2u
-#define MCG_S_OSCINIT0_SHIFT                     1
-#define MCG_S_CLKST_MASK                         0xCu
-#define MCG_S_CLKST_SHIFT                        2
-#define MCG_S_CLKST(x)                           (((uint8_t)(((uint8_t)(x))<<MCG_S_CLKST_SHIFT))&MCG_S_CLKST_MASK)
-#define MCG_S_IREFST_MASK                        0x10u
-#define MCG_S_IREFST_SHIFT                       4
-#define MCG_S_PLLST_MASK                         0x20u
-#define MCG_S_PLLST_SHIFT                        5
-#define MCG_S_LOCK0_MASK                         0x40u
-#define MCG_S_LOCK0_SHIFT                        6
-#define MCG_S_LOLS_MASK                          0x80u
-#define MCG_S_LOLS_SHIFT                         7
-/* SC Bit Fields */
-#define MCG_SC_LOCS0_MASK                        0x1u
-#define MCG_SC_LOCS0_SHIFT                       0
-#define MCG_SC_FCRDIV_MASK                       0xEu
-#define MCG_SC_FCRDIV_SHIFT                      1
-#define MCG_SC_FCRDIV(x)                         (((uint8_t)(((uint8_t)(x))<<MCG_SC_FCRDIV_SHIFT))&MCG_SC_FCRDIV_MASK)
-#define MCG_SC_FLTPRSRV_MASK                     0x10u
-#define MCG_SC_FLTPRSRV_SHIFT                    4
-#define MCG_SC_ATMF_MASK                         0x20u
-#define MCG_SC_ATMF_SHIFT                        5
-#define MCG_SC_ATMS_MASK                         0x40u
-#define MCG_SC_ATMS_SHIFT                        6
-#define MCG_SC_ATME_MASK                         0x80u
-#define MCG_SC_ATME_SHIFT                        7
-/* ATCVH Bit Fields */
-#define MCG_ATCVH_ATCVH_MASK                     0xFFu
-#define MCG_ATCVH_ATCVH_SHIFT                    0
-#define MCG_ATCVH_ATCVH(x)                       (((uint8_t)(((uint8_t)(x))<<MCG_ATCVH_ATCVH_SHIFT))&MCG_ATCVH_ATCVH_MASK)
-/* ATCVL Bit Fields */
-#define MCG_ATCVL_ATCVL_MASK                     0xFFu
-#define MCG_ATCVL_ATCVL_SHIFT                    0
-#define MCG_ATCVL_ATCVL(x)                       (((uint8_t)(((uint8_t)(x))<<MCG_ATCVL_ATCVL_SHIFT))&MCG_ATCVL_ATCVL_MASK)
-/* C8 Bit Fields */
-#define MCG_C8_LOLRE_MASK                        0x40u
-#define MCG_C8_LOLRE_SHIFT                       6
-
-/**
- * @}
- */ /* end of group MCG_Register_Masks */
-
-
-/* MCG - Peripheral instance base addresses */
-/** Peripheral MCG base address */
-#define MCG_BASE                                 (0x40064000u)
-/** Peripheral MCG base pointer */
-#define MCG                                      ((MCG_Type *)MCG_BASE)
-/** Array initializer of MCG peripheral base pointers */
-#define MCG_BASES                                { MCG }
-
-/**
- * @}
- */ /* end of group MCG_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- MCM Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MCM_Peripheral_Access_Layer MCM Peripheral Access Layer
- * @{
- */
-
-/** MCM - Register Layout Typedef */
-typedef struct {
-       uint8_t RESERVED_0[8];
-  __I  uint16_t PLASC;                             /**< Crossbar Switch (AXBS) Slave Configuration, offset: 0x8 */
-  __I  uint16_t PLAMC;                             /**< Crossbar Switch (AXBS) Master Configuration, offset: 0xA */
-  __IO uint32_t PLACR;                             /**< Platform Control Register, offset: 0xC */
-       uint8_t RESERVED_1[48];
-  __IO uint32_t CPO;                               /**< Compute Operation Control Register, offset: 0x40 */
-} MCM_Type;
-
-/* ----------------------------------------------------------------------------
-   -- MCM Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MCM_Register_Masks MCM Register Masks
- * @{
- */
-
-/* PLASC Bit Fields */
-#define MCM_PLASC_ASC_MASK                       0xFFu
-#define MCM_PLASC_ASC_SHIFT                      0
-#define MCM_PLASC_ASC(x)                         (((uint16_t)(((uint16_t)(x))<<MCM_PLASC_ASC_SHIFT))&MCM_PLASC_ASC_MASK)
-/* PLAMC Bit Fields */
-#define MCM_PLAMC_AMC_MASK                       0xFFu
-#define MCM_PLAMC_AMC_SHIFT                      0
-#define MCM_PLAMC_AMC(x)                         (((uint16_t)(((uint16_t)(x))<<MCM_PLAMC_AMC_SHIFT))&MCM_PLAMC_AMC_MASK)
-/* PLACR Bit Fields */
-#define MCM_PLACR_ARB_MASK                       0x200u
-#define MCM_PLACR_ARB_SHIFT                      9
-#define MCM_PLACR_CFCC_MASK                      0x400u
-#define MCM_PLACR_CFCC_SHIFT                     10
-#define MCM_PLACR_DFCDA_MASK                     0x800u
-#define MCM_PLACR_DFCDA_SHIFT                    11
-#define MCM_PLACR_DFCIC_MASK                     0x1000u
-#define MCM_PLACR_DFCIC_SHIFT                    12
-#define MCM_PLACR_DFCC_MASK                      0x2000u
-#define MCM_PLACR_DFCC_SHIFT                     13
-#define MCM_PLACR_EFDS_MASK                      0x4000u
-#define MCM_PLACR_EFDS_SHIFT                     14
-#define MCM_PLACR_DFCS_MASK                      0x8000u
-#define MCM_PLACR_DFCS_SHIFT                     15
-#define MCM_PLACR_ESFC_MASK                      0x10000u
-#define MCM_PLACR_ESFC_SHIFT                     16
-/* CPO Bit Fields */
-#define MCM_CPO_CPOREQ_MASK                      0x1u
-#define MCM_CPO_CPOREQ_SHIFT                     0
-#define MCM_CPO_CPOACK_MASK                      0x2u
-#define MCM_CPO_CPOACK_SHIFT                     1
-#define MCM_CPO_CPOWOI_MASK                      0x4u
-#define MCM_CPO_CPOWOI_SHIFT                     2
-
-/**
- * @}
- */ /* end of group MCM_Register_Masks */
-
-
-/* MCM - Peripheral instance base addresses */
-/** Peripheral MCM base address */
-#define MCM_BASE                                 (0xF0003000u)
-/** Peripheral MCM base pointer */
-#define MCM                                      ((MCM_Type *)MCM_BASE)
-/** Array initializer of MCM peripheral base pointers */
-#define MCM_BASES                                { MCM }
-
-/**
- * @}
- */ /* end of group MCM_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- MTB Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MTB_Peripheral_Access_Layer MTB Peripheral Access Layer
- * @{
- */
-
-/** MTB - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t POSITION;                          /**< MTB Position Register, offset: 0x0 */
-  __IO uint32_t MASTER;                            /**< MTB Master Register, offset: 0x4 */
-  __IO uint32_t FLOW;                              /**< MTB Flow Register, offset: 0x8 */
-  __I  uint32_t BASE;                              /**< MTB Base Register, offset: 0xC */
-       uint8_t RESERVED_0[3824];
-  __I  uint32_t MODECTRL;                          /**< Integration Mode Control Register, offset: 0xF00 */
-       uint8_t RESERVED_1[156];
-  __I  uint32_t TAGSET;                            /**< Claim TAG Set Register, offset: 0xFA0 */
-  __I  uint32_t TAGCLEAR;                          /**< Claim TAG Clear Register, offset: 0xFA4 */
-       uint8_t RESERVED_2[8];
-  __I  uint32_t LOCKACCESS;                        /**< Lock Access Register, offset: 0xFB0 */
-  __I  uint32_t LOCKSTAT;                          /**< Lock Status Register, offset: 0xFB4 */
-  __I  uint32_t AUTHSTAT;                          /**< Authentication Status Register, offset: 0xFB8 */
-  __I  uint32_t DEVICEARCH;                        /**< Device Architecture Register, offset: 0xFBC */
-       uint8_t RESERVED_3[8];
-  __I  uint32_t DEVICECFG;                         /**< Device Configuration Register, offset: 0xFC8 */
-  __I  uint32_t DEVICETYPID;                       /**< Device Type Identifier Register, offset: 0xFCC */
-  __I  uint32_t PERIPHID[8];                       /**< Peripheral ID Register, array offset: 0xFD0, array step: 0x4 */
-  __I  uint32_t COMPID[4];                         /**< Component ID Register, array offset: 0xFF0, array step: 0x4 */
-} MTB_Type;
-
-/* ----------------------------------------------------------------------------
-   -- MTB Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MTB_Register_Masks MTB Register Masks
- * @{
- */
-
-/* POSITION Bit Fields */
-#define MTB_POSITION_WRAP_MASK                   0x4u
-#define MTB_POSITION_WRAP_SHIFT                  2
-#define MTB_POSITION_POINTER_MASK                0xFFFFFFF8u
-#define MTB_POSITION_POINTER_SHIFT               3
-#define MTB_POSITION_POINTER(x)                  (((uint32_t)(((uint32_t)(x))<<MTB_POSITION_POINTER_SHIFT))&MTB_POSITION_POINTER_MASK)
-/* MASTER Bit Fields */
-#define MTB_MASTER_MASK_MASK                     0x1Fu
-#define MTB_MASTER_MASK_SHIFT                    0
-#define MTB_MASTER_MASK(x)                       (((uint32_t)(((uint32_t)(x))<<MTB_MASTER_MASK_SHIFT))&MTB_MASTER_MASK_MASK)
-#define MTB_MASTER_TSTARTEN_MASK                 0x20u
-#define MTB_MASTER_TSTARTEN_SHIFT                5
-#define MTB_MASTER_TSTOPEN_MASK                  0x40u
-#define MTB_MASTER_TSTOPEN_SHIFT                 6
-#define MTB_MASTER_SFRWPRIV_MASK                 0x80u
-#define MTB_MASTER_SFRWPRIV_SHIFT                7
-#define MTB_MASTER_RAMPRIV_MASK                  0x100u
-#define MTB_MASTER_RAMPRIV_SHIFT                 8
-#define MTB_MASTER_HALTREQ_MASK                  0x200u
-#define MTB_MASTER_HALTREQ_SHIFT                 9
-#define MTB_MASTER_EN_MASK                       0x80000000u
-#define MTB_MASTER_EN_SHIFT                      31
-/* FLOW Bit Fields */
-#define MTB_FLOW_AUTOSTOP_MASK                   0x1u
-#define MTB_FLOW_AUTOSTOP_SHIFT                  0
-#define MTB_FLOW_AUTOHALT_MASK                   0x2u
-#define MTB_FLOW_AUTOHALT_SHIFT                  1
-#define MTB_FLOW_WATERMARK_MASK                  0xFFFFFFF8u
-#define MTB_FLOW_WATERMARK_SHIFT                 3
-#define MTB_FLOW_WATERMARK(x)                    (((uint32_t)(((uint32_t)(x))<<MTB_FLOW_WATERMARK_SHIFT))&MTB_FLOW_WATERMARK_MASK)
-/* BASE Bit Fields */
-#define MTB_BASE_BASEADDR_MASK                   0xFFFFFFFFu
-#define MTB_BASE_BASEADDR_SHIFT                  0
-#define MTB_BASE_BASEADDR(x)                     (((uint32_t)(((uint32_t)(x))<<MTB_BASE_BASEADDR_SHIFT))&MTB_BASE_BASEADDR_MASK)
-/* MODECTRL Bit Fields */
-#define MTB_MODECTRL_MODECTRL_MASK               0xFFFFFFFFu
-#define MTB_MODECTRL_MODECTRL_SHIFT              0
-#define MTB_MODECTRL_MODECTRL(x)                 (((uint32_t)(((uint32_t)(x))<<MTB_MODECTRL_MODECTRL_SHIFT))&MTB_MODECTRL_MODECTRL_MASK)
-/* TAGSET Bit Fields */
-#define MTB_TAGSET_TAGSET_MASK                   0xFFFFFFFFu
-#define MTB_TAGSET_TAGSET_SHIFT                  0
-#define MTB_TAGSET_TAGSET(x)                     (((uint32_t)(((uint32_t)(x))<<MTB_TAGSET_TAGSET_SHIFT))&MTB_TAGSET_TAGSET_MASK)
-/* TAGCLEAR Bit Fields */
-#define MTB_TAGCLEAR_TAGCLEAR_MASK               0xFFFFFFFFu
-#define MTB_TAGCLEAR_TAGCLEAR_SHIFT              0
-#define MTB_TAGCLEAR_TAGCLEAR(x)                 (((uint32_t)(((uint32_t)(x))<<MTB_TAGCLEAR_TAGCLEAR_SHIFT))&MTB_TAGCLEAR_TAGCLEAR_MASK)
-/* LOCKACCESS Bit Fields */
-#define MTB_LOCKACCESS_LOCKACCESS_MASK           0xFFFFFFFFu
-#define MTB_LOCKACCESS_LOCKACCESS_SHIFT          0
-#define MTB_LOCKACCESS_LOCKACCESS(x)             (((uint32_t)(((uint32_t)(x))<<MTB_LOCKACCESS_LOCKACCESS_SHIFT))&MTB_LOCKACCESS_LOCKACCESS_MASK)
-/* LOCKSTAT Bit Fields */
-#define MTB_LOCKSTAT_LOCKSTAT_MASK               0xFFFFFFFFu
-#define MTB_LOCKSTAT_LOCKSTAT_SHIFT              0
-#define MTB_LOCKSTAT_LOCKSTAT(x)                 (((uint32_t)(((uint32_t)(x))<<MTB_LOCKSTAT_LOCKSTAT_SHIFT))&MTB_LOCKSTAT_LOCKSTAT_MASK)
-/* AUTHSTAT Bit Fields */
-#define MTB_AUTHSTAT_BIT0_MASK                   0x1u
-#define MTB_AUTHSTAT_BIT0_SHIFT                  0
-#define MTB_AUTHSTAT_BIT1_MASK                   0x2u
-#define MTB_AUTHSTAT_BIT1_SHIFT                  1
-#define MTB_AUTHSTAT_BIT2_MASK                   0x4u
-#define MTB_AUTHSTAT_BIT2_SHIFT                  2
-#define MTB_AUTHSTAT_BIT3_MASK                   0x8u
-#define MTB_AUTHSTAT_BIT3_SHIFT                  3
-/* DEVICEARCH Bit Fields */
-#define MTB_DEVICEARCH_DEVICEARCH_MASK           0xFFFFFFFFu
-#define MTB_DEVICEARCH_DEVICEARCH_SHIFT          0
-#define MTB_DEVICEARCH_DEVICEARCH(x)             (((uint32_t)(((uint32_t)(x))<<MTB_DEVICEARCH_DEVICEARCH_SHIFT))&MTB_DEVICEARCH_DEVICEARCH_MASK)
-/* DEVICECFG Bit Fields */
-#define MTB_DEVICECFG_DEVICECFG_MASK             0xFFFFFFFFu
-#define MTB_DEVICECFG_DEVICECFG_SHIFT            0
-#define MTB_DEVICECFG_DEVICECFG(x)               (((uint32_t)(((uint32_t)(x))<<MTB_DEVICECFG_DEVICECFG_SHIFT))&MTB_DEVICECFG_DEVICECFG_MASK)
-/* DEVICETYPID Bit Fields */
-#define MTB_DEVICETYPID_DEVICETYPID_MASK         0xFFFFFFFFu
-#define MTB_DEVICETYPID_DEVICETYPID_SHIFT        0
-#define MTB_DEVICETYPID_DEVICETYPID(x)           (((uint32_t)(((uint32_t)(x))<<MTB_DEVICETYPID_DEVICETYPID_SHIFT))&MTB_DEVICETYPID_DEVICETYPID_MASK)
-/* PERIPHID Bit Fields */
-#define MTB_PERIPHID_PERIPHID_MASK               0xFFFFFFFFu
-#define MTB_PERIPHID_PERIPHID_SHIFT              0
-#define MTB_PERIPHID_PERIPHID(x)                 (((uint32_t)(((uint32_t)(x))<<MTB_PERIPHID_PERIPHID_SHIFT))&MTB_PERIPHID_PERIPHID_MASK)
-/* COMPID Bit Fields */
-#define MTB_COMPID_COMPID_MASK                   0xFFFFFFFFu
-#define MTB_COMPID_COMPID_SHIFT                  0
-#define MTB_COMPID_COMPID(x)                     (((uint32_t)(((uint32_t)(x))<<MTB_COMPID_COMPID_SHIFT))&MTB_COMPID_COMPID_MASK)
-
-/**
- * @}
- */ /* end of group MTB_Register_Masks */
-
-
-/* MTB - Peripheral instance base addresses */
-/** Peripheral MTB base address */
-#define MTB_BASE                                 (0xF0000000u)
-/** Peripheral MTB base pointer */
-#define MTB                                      ((MTB_Type *)MTB_BASE)
-/** Array initializer of MTB peripheral base pointers */
-#define MTB_BASES                                { MTB }
-
-/**
- * @}
- */ /* end of group MTB_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- MTBDWT Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MTBDWT_Peripheral_Access_Layer MTBDWT Peripheral Access Layer
- * @{
- */
-
-/** MTBDWT - Register Layout Typedef */
-typedef struct {
-  __I  uint32_t CTRL;                              /**< MTB DWT Control Register, offset: 0x0 */
-       uint8_t RESERVED_0[28];
-  struct {                                         /* offset: 0x20, array step: 0x10 */
-    __IO uint32_t COMP;                              /**< MTB_DWT Comparator Register, array offset: 0x20, array step: 0x10 */
-    __IO uint32_t MASK;                              /**< MTB_DWT Comparator Mask Register, array offset: 0x24, array step: 0x10 */
-    __IO uint32_t FCT;                               /**< MTB_DWT Comparator Function Register 0..MTB_DWT Comparator Function Register 1, array offset: 0x28, array step: 0x10 */
-         uint8_t RESERVED_0[4];
-  } COMPARATOR[2];
-       uint8_t RESERVED_1[448];
-  __IO uint32_t TBCTRL;                            /**< MTB_DWT Trace Buffer Control Register, offset: 0x200 */
-       uint8_t RESERVED_2[3524];
-  __I  uint32_t DEVICECFG;                         /**< Device Configuration Register, offset: 0xFC8 */
-  __I  uint32_t DEVICETYPID;                       /**< Device Type Identifier Register, offset: 0xFCC */
-  __I  uint32_t PERIPHID[8];                       /**< Peripheral ID Register, array offset: 0xFD0, array step: 0x4 */
-  __I  uint32_t COMPID[4];                         /**< Component ID Register, array offset: 0xFF0, array step: 0x4 */
-} MTBDWT_Type;
-
-/* ----------------------------------------------------------------------------
-   -- MTBDWT Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup MTBDWT_Register_Masks MTBDWT Register Masks
- * @{
- */
-
-/* CTRL Bit Fields */
-#define MTBDWT_CTRL_DWTCFGCTRL_MASK              0xFFFFFFFu
-#define MTBDWT_CTRL_DWTCFGCTRL_SHIFT             0
-#define MTBDWT_CTRL_DWTCFGCTRL(x)                (((uint32_t)(((uint32_t)(x))<<MTBDWT_CTRL_DWTCFGCTRL_SHIFT))&MTBDWT_CTRL_DWTCFGCTRL_MASK)
-#define MTBDWT_CTRL_NUMCMP_MASK                  0xF0000000u
-#define MTBDWT_CTRL_NUMCMP_SHIFT                 28
-#define MTBDWT_CTRL_NUMCMP(x)                    (((uint32_t)(((uint32_t)(x))<<MTBDWT_CTRL_NUMCMP_SHIFT))&MTBDWT_CTRL_NUMCMP_MASK)
-/* COMP Bit Fields */
-#define MTBDWT_COMP_COMP_MASK                    0xFFFFFFFFu
-#define MTBDWT_COMP_COMP_SHIFT                   0
-#define MTBDWT_COMP_COMP(x)                      (((uint32_t)(((uint32_t)(x))<<MTBDWT_COMP_COMP_SHIFT))&MTBDWT_COMP_COMP_MASK)
-/* MASK Bit Fields */
-#define MTBDWT_MASK_MASK_MASK                    0x1Fu
-#define MTBDWT_MASK_MASK_SHIFT                   0
-#define MTBDWT_MASK_MASK(x)                      (((uint32_t)(((uint32_t)(x))<<MTBDWT_MASK_MASK_SHIFT))&MTBDWT_MASK_MASK_MASK)
-/* FCT Bit Fields */
-#define MTBDWT_FCT_FUNCTION_MASK                 0xFu
-#define MTBDWT_FCT_FUNCTION_SHIFT                0
-#define MTBDWT_FCT_FUNCTION(x)                   (((uint32_t)(((uint32_t)(x))<<MTBDWT_FCT_FUNCTION_SHIFT))&MTBDWT_FCT_FUNCTION_MASK)
-#define MTBDWT_FCT_DATAVMATCH_MASK               0x100u
-#define MTBDWT_FCT_DATAVMATCH_SHIFT              8
-#define MTBDWT_FCT_DATAVSIZE_MASK                0xC00u
-#define MTBDWT_FCT_DATAVSIZE_SHIFT               10
-#define MTBDWT_FCT_DATAVSIZE(x)                  (((uint32_t)(((uint32_t)(x))<<MTBDWT_FCT_DATAVSIZE_SHIFT))&MTBDWT_FCT_DATAVSIZE_MASK)
-#define MTBDWT_FCT_DATAVADDR0_MASK               0xF000u
-#define MTBDWT_FCT_DATAVADDR0_SHIFT              12
-#define MTBDWT_FCT_DATAVADDR0(x)                 (((uint32_t)(((uint32_t)(x))<<MTBDWT_FCT_DATAVADDR0_SHIFT))&MTBDWT_FCT_DATAVADDR0_MASK)
-#define MTBDWT_FCT_MATCHED_MASK                  0x1000000u
-#define MTBDWT_FCT_MATCHED_SHIFT                 24
-/* TBCTRL Bit Fields */
-#define MTBDWT_TBCTRL_ACOMP0_MASK                0x1u
-#define MTBDWT_TBCTRL_ACOMP0_SHIFT               0
-#define MTBDWT_TBCTRL_ACOMP1_MASK                0x2u
-#define MTBDWT_TBCTRL_ACOMP1_SHIFT               1
-#define MTBDWT_TBCTRL_NUMCOMP_MASK               0xF0000000u
-#define MTBDWT_TBCTRL_NUMCOMP_SHIFT              28
-#define MTBDWT_TBCTRL_NUMCOMP(x)                 (((uint32_t)(((uint32_t)(x))<<MTBDWT_TBCTRL_NUMCOMP_SHIFT))&MTBDWT_TBCTRL_NUMCOMP_MASK)
-/* DEVICECFG Bit Fields */
-#define MTBDWT_DEVICECFG_DEVICECFG_MASK          0xFFFFFFFFu
-#define MTBDWT_DEVICECFG_DEVICECFG_SHIFT         0
-#define MTBDWT_DEVICECFG_DEVICECFG(x)            (((uint32_t)(((uint32_t)(x))<<MTBDWT_DEVICECFG_DEVICECFG_SHIFT))&MTBDWT_DEVICECFG_DEVICECFG_MASK)
-/* DEVICETYPID Bit Fields */
-#define MTBDWT_DEVICETYPID_DEVICETYPID_MASK      0xFFFFFFFFu
-#define MTBDWT_DEVICETYPID_DEVICETYPID_SHIFT     0
-#define MTBDWT_DEVICETYPID_DEVICETYPID(x)        (((uint32_t)(((uint32_t)(x))<<MTBDWT_DEVICETYPID_DEVICETYPID_SHIFT))&MTBDWT_DEVICETYPID_DEVICETYPID_MASK)
-/* PERIPHID Bit Fields */
-#define MTBDWT_PERIPHID_PERIPHID_MASK            0xFFFFFFFFu
-#define MTBDWT_PERIPHID_PERIPHID_SHIFT           0
-#define MTBDWT_PERIPHID_PERIPHID(x)              (((uint32_t)(((uint32_t)(x))<<MTBDWT_PERIPHID_PERIPHID_SHIFT))&MTBDWT_PERIPHID_PERIPHID_MASK)
-/* COMPID Bit Fields */
-#define MTBDWT_COMPID_COMPID_MASK                0xFFFFFFFFu
-#define MTBDWT_COMPID_COMPID_SHIFT               0
-#define MTBDWT_COMPID_COMPID(x)                  (((uint32_t)(((uint32_t)(x))<<MTBDWT_COMPID_COMPID_SHIFT))&MTBDWT_COMPID_COMPID_MASK)
-
-/**
- * @}
- */ /* end of group MTBDWT_Register_Masks */
-
-
-/* MTBDWT - Peripheral instance base addresses */
-/** Peripheral MTBDWT base address */
-#define MTBDWT_BASE                              (0xF0001000u)
-/** Peripheral MTBDWT base pointer */
-#define MTBDWT                                   ((MTBDWT_Type *)MTBDWT_BASE)
-/** Array initializer of MTBDWT peripheral base pointers */
-#define MTBDWT_BASES                             { MTBDWT }
-
-/**
- * @}
- */ /* end of group MTBDWT_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- NV Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup NV_Peripheral_Access_Layer NV Peripheral Access Layer
- * @{
- */
-
-/** NV - Register Layout Typedef */
-typedef struct {
-  __I  uint8_t BACKKEY3;                           /**< Backdoor Comparison Key 3., offset: 0x0 */
-  __I  uint8_t BACKKEY2;                           /**< Backdoor Comparison Key 2., offset: 0x1 */
-  __I  uint8_t BACKKEY1;                           /**< Backdoor Comparison Key 1., offset: 0x2 */
-  __I  uint8_t BACKKEY0;                           /**< Backdoor Comparison Key 0., offset: 0x3 */
-  __I  uint8_t BACKKEY7;                           /**< Backdoor Comparison Key 7., offset: 0x4 */
-  __I  uint8_t BACKKEY6;                           /**< Backdoor Comparison Key 6., offset: 0x5 */
-  __I  uint8_t BACKKEY5;                           /**< Backdoor Comparison Key 5., offset: 0x6 */
-  __I  uint8_t BACKKEY4;                           /**< Backdoor Comparison Key 4., offset: 0x7 */
-  __I  uint8_t FPROT3;                             /**< Non-volatile P-Flash Protection 1 - Low Register, offset: 0x8 */
-  __I  uint8_t FPROT2;                             /**< Non-volatile P-Flash Protection 1 - High Register, offset: 0x9 */
-  __I  uint8_t FPROT1;                             /**< Non-volatile P-Flash Protection 0 - Low Register, offset: 0xA */
-  __I  uint8_t FPROT0;                             /**< Non-volatile P-Flash Protection 0 - High Register, offset: 0xB */
-  __I  uint8_t FSEC;                               /**< Non-volatile Flash Security Register, offset: 0xC */
-  __I  uint8_t FOPT;                               /**< Non-volatile Flash Option Register, offset: 0xD */
-} NV_Type;
-
-/* ----------------------------------------------------------------------------
-   -- NV Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup NV_Register_Masks NV Register Masks
- * @{
- */
-
-/* BACKKEY3 Bit Fields */
-#define NV_BACKKEY3_KEY_MASK                     0xFFu
-#define NV_BACKKEY3_KEY_SHIFT                    0
-#define NV_BACKKEY3_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY3_KEY_SHIFT))&NV_BACKKEY3_KEY_MASK)
-/* BACKKEY2 Bit Fields */
-#define NV_BACKKEY2_KEY_MASK                     0xFFu
-#define NV_BACKKEY2_KEY_SHIFT                    0
-#define NV_BACKKEY2_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY2_KEY_SHIFT))&NV_BACKKEY2_KEY_MASK)
-/* BACKKEY1 Bit Fields */
-#define NV_BACKKEY1_KEY_MASK                     0xFFu
-#define NV_BACKKEY1_KEY_SHIFT                    0
-#define NV_BACKKEY1_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY1_KEY_SHIFT))&NV_BACKKEY1_KEY_MASK)
-/* BACKKEY0 Bit Fields */
-#define NV_BACKKEY0_KEY_MASK                     0xFFu
-#define NV_BACKKEY0_KEY_SHIFT                    0
-#define NV_BACKKEY0_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY0_KEY_SHIFT))&NV_BACKKEY0_KEY_MASK)
-/* BACKKEY7 Bit Fields */
-#define NV_BACKKEY7_KEY_MASK                     0xFFu
-#define NV_BACKKEY7_KEY_SHIFT                    0
-#define NV_BACKKEY7_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY7_KEY_SHIFT))&NV_BACKKEY7_KEY_MASK)
-/* BACKKEY6 Bit Fields */
-#define NV_BACKKEY6_KEY_MASK                     0xFFu
-#define NV_BACKKEY6_KEY_SHIFT                    0
-#define NV_BACKKEY6_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY6_KEY_SHIFT))&NV_BACKKEY6_KEY_MASK)
-/* BACKKEY5 Bit Fields */
-#define NV_BACKKEY5_KEY_MASK                     0xFFu
-#define NV_BACKKEY5_KEY_SHIFT                    0
-#define NV_BACKKEY5_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY5_KEY_SHIFT))&NV_BACKKEY5_KEY_MASK)
-/* BACKKEY4 Bit Fields */
-#define NV_BACKKEY4_KEY_MASK                     0xFFu
-#define NV_BACKKEY4_KEY_SHIFT                    0
-#define NV_BACKKEY4_KEY(x)                       (((uint8_t)(((uint8_t)(x))<<NV_BACKKEY4_KEY_SHIFT))&NV_BACKKEY4_KEY_MASK)
-/* FPROT3 Bit Fields */
-#define NV_FPROT3_PROT_MASK                      0xFFu
-#define NV_FPROT3_PROT_SHIFT                     0
-#define NV_FPROT3_PROT(x)                        (((uint8_t)(((uint8_t)(x))<<NV_FPROT3_PROT_SHIFT))&NV_FPROT3_PROT_MASK)
-/* FPROT2 Bit Fields */
-#define NV_FPROT2_PROT_MASK                      0xFFu
-#define NV_FPROT2_PROT_SHIFT                     0
-#define NV_FPROT2_PROT(x)                        (((uint8_t)(((uint8_t)(x))<<NV_FPROT2_PROT_SHIFT))&NV_FPROT2_PROT_MASK)
-/* FPROT1 Bit Fields */
-#define NV_FPROT1_PROT_MASK                      0xFFu
-#define NV_FPROT1_PROT_SHIFT                     0
-#define NV_FPROT1_PROT(x)                        (((uint8_t)(((uint8_t)(x))<<NV_FPROT1_PROT_SHIFT))&NV_FPROT1_PROT_MASK)
-/* FPROT0 Bit Fields */
-#define NV_FPROT0_PROT_MASK                      0xFFu
-#define NV_FPROT0_PROT_SHIFT                     0
-#define NV_FPROT0_PROT(x)                        (((uint8_t)(((uint8_t)(x))<<NV_FPROT0_PROT_SHIFT))&NV_FPROT0_PROT_MASK)
-/* FSEC Bit Fields */
-#define NV_FSEC_SEC_MASK                         0x3u
-#define NV_FSEC_SEC_SHIFT                        0
-#define NV_FSEC_SEC(x)                           (((uint8_t)(((uint8_t)(x))<<NV_FSEC_SEC_SHIFT))&NV_FSEC_SEC_MASK)
-#define NV_FSEC_FSLACC_MASK                      0xCu
-#define NV_FSEC_FSLACC_SHIFT                     2
-#define NV_FSEC_FSLACC(x)                        (((uint8_t)(((uint8_t)(x))<<NV_FSEC_FSLACC_SHIFT))&NV_FSEC_FSLACC_MASK)
-#define NV_FSEC_MEEN_MASK                        0x30u
-#define NV_FSEC_MEEN_SHIFT                       4
-#define NV_FSEC_MEEN(x)                          (((uint8_t)(((uint8_t)(x))<<NV_FSEC_MEEN_SHIFT))&NV_FSEC_MEEN_MASK)
-#define NV_FSEC_KEYEN_MASK                       0xC0u
-#define NV_FSEC_KEYEN_SHIFT                      6
-#define NV_FSEC_KEYEN(x)                         (((uint8_t)(((uint8_t)(x))<<NV_FSEC_KEYEN_SHIFT))&NV_FSEC_KEYEN_MASK)
-/* FOPT Bit Fields */
-#define NV_FOPT_LPBOOT0_MASK                     0x1u
-#define NV_FOPT_LPBOOT0_SHIFT                    0
-#define NV_FOPT_NMI_DIS_MASK                     0x4u
-#define NV_FOPT_NMI_DIS_SHIFT                    2
-#define NV_FOPT_RESET_PIN_CFG_MASK               0x8u
-#define NV_FOPT_RESET_PIN_CFG_SHIFT              3
-#define NV_FOPT_LPBOOT1_MASK                     0x10u
-#define NV_FOPT_LPBOOT1_SHIFT                    4
-#define NV_FOPT_FAST_INIT_MASK                   0x20u
-#define NV_FOPT_FAST_INIT_SHIFT                  5
-
-/**
- * @}
- */ /* end of group NV_Register_Masks */
-
-
-/* NV - Peripheral instance base addresses */
-/** Peripheral FTFA_FlashConfig base address */
-#define FTFA_FlashConfig_BASE                    (0x400u)
-/** Peripheral FTFA_FlashConfig base pointer */
-#define FTFA_FlashConfig                         ((NV_Type *)FTFA_FlashConfig_BASE)
-/** Array initializer of NV peripheral base pointers */
-#define NV_BASES                                 { FTFA_FlashConfig }
-
-/**
- * @}
- */ /* end of group NV_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- OSC Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup OSC_Peripheral_Access_Layer OSC Peripheral Access Layer
- * @{
- */
-
-/** OSC - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t CR;                                 /**< OSC Control Register, offset: 0x0 */
-} OSC_Type;
-
-/* ----------------------------------------------------------------------------
-   -- OSC Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup OSC_Register_Masks OSC Register Masks
- * @{
- */
-
-/* CR Bit Fields */
-#define OSC_CR_SC16P_MASK                        0x1u
-#define OSC_CR_SC16P_SHIFT                       0
-#define OSC_CR_SC8P_MASK                         0x2u
-#define OSC_CR_SC8P_SHIFT                        1
-#define OSC_CR_SC4P_MASK                         0x4u
-#define OSC_CR_SC4P_SHIFT                        2
-#define OSC_CR_SC2P_MASK                         0x8u
-#define OSC_CR_SC2P_SHIFT                        3
-#define OSC_CR_EREFSTEN_MASK                     0x20u
-#define OSC_CR_EREFSTEN_SHIFT                    5
-#define OSC_CR_ERCLKEN_MASK                      0x80u
-#define OSC_CR_ERCLKEN_SHIFT                     7
-
-/**
- * @}
- */ /* end of group OSC_Register_Masks */
-
-
-/* OSC - Peripheral instance base addresses */
-/** Peripheral OSC0 base address */
-#define OSC0_BASE                                (0x40065000u)
-/** Peripheral OSC0 base pointer */
-#define OSC0                                     ((OSC_Type *)OSC0_BASE)
-/** Array initializer of OSC peripheral base pointers */
-#define OSC_BASES                                { OSC0 }
-
-/**
- * @}
- */ /* end of group OSC_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- PIT Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup PIT_Peripheral_Access_Layer PIT Peripheral Access Layer
- * @{
- */
-
-/** PIT - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t MCR;                               /**< PIT Module Control Register, offset: 0x0 */
-       uint8_t RESERVED_0[220];
-  __I  uint32_t LTMR64H;                           /**< PIT Upper Lifetime Timer Register, offset: 0xE0 */
-  __I  uint32_t LTMR64L;                           /**< PIT Lower Lifetime Timer Register, offset: 0xE4 */
-       uint8_t RESERVED_1[24];
-  struct {                                         /* offset: 0x100, array step: 0x10 */
-    __IO uint32_t LDVAL;                             /**< Timer Load Value Register, array offset: 0x100, array step: 0x10 */
-    __I  uint32_t CVAL;                              /**< Current Timer Value Register, array offset: 0x104, array step: 0x10 */
-    __IO uint32_t TCTRL;                             /**< Timer Control Register, array offset: 0x108, array step: 0x10 */
-    __IO uint32_t TFLG;                              /**< Timer Flag Register, array offset: 0x10C, array step: 0x10 */
-  } CHANNEL[2];
-} PIT_Type;
-
-/* ----------------------------------------------------------------------------
-   -- PIT Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup PIT_Register_Masks PIT Register Masks
- * @{
- */
-
-/* MCR Bit Fields */
-#define PIT_MCR_FRZ_MASK                         0x1u
-#define PIT_MCR_FRZ_SHIFT                        0
-#define PIT_MCR_MDIS_MASK                        0x2u
-#define PIT_MCR_MDIS_SHIFT                       1
-/* LTMR64H Bit Fields */
-#define PIT_LTMR64H_LTH_MASK                     0xFFFFFFFFu
-#define PIT_LTMR64H_LTH_SHIFT                    0
-#define PIT_LTMR64H_LTH(x)                       (((uint32_t)(((uint32_t)(x))<<PIT_LTMR64H_LTH_SHIFT))&PIT_LTMR64H_LTH_MASK)
-/* LTMR64L Bit Fields */
-#define PIT_LTMR64L_LTL_MASK                     0xFFFFFFFFu
-#define PIT_LTMR64L_LTL_SHIFT                    0
-#define PIT_LTMR64L_LTL(x)                       (((uint32_t)(((uint32_t)(x))<<PIT_LTMR64L_LTL_SHIFT))&PIT_LTMR64L_LTL_MASK)
-/* LDVAL Bit Fields */
-#define PIT_LDVAL_TSV_MASK                       0xFFFFFFFFu
-#define PIT_LDVAL_TSV_SHIFT                      0
-#define PIT_LDVAL_TSV(x)                         (((uint32_t)(((uint32_t)(x))<<PIT_LDVAL_TSV_SHIFT))&PIT_LDVAL_TSV_MASK)
-/* CVAL Bit Fields */
-#define PIT_CVAL_TVL_MASK                        0xFFFFFFFFu
-#define PIT_CVAL_TVL_SHIFT                       0
-#define PIT_CVAL_TVL(x)                          (((uint32_t)(((uint32_t)(x))<<PIT_CVAL_TVL_SHIFT))&PIT_CVAL_TVL_MASK)
-/* TCTRL Bit Fields */
-#define PIT_TCTRL_TEN_MASK                       0x1u
-#define PIT_TCTRL_TEN_SHIFT                      0
-#define PIT_TCTRL_TIE_MASK                       0x2u
-#define PIT_TCTRL_TIE_SHIFT                      1
-#define PIT_TCTRL_CHN_MASK                       0x4u
-#define PIT_TCTRL_CHN_SHIFT                      2
-/* TFLG Bit Fields */
-#define PIT_TFLG_TIF_MASK                        0x1u
-#define PIT_TFLG_TIF_SHIFT                       0
-
-/**
- * @}
- */ /* end of group PIT_Register_Masks */
-
-
-/* PIT - Peripheral instance base addresses */
-/** Peripheral PIT base address */
-#define PIT_BASE                                 (0x40037000u)
-/** Peripheral PIT base pointer */
-#define PIT                                      ((PIT_Type *)PIT_BASE)
-/** Array initializer of PIT peripheral base pointers */
-#define PIT_BASES                                { PIT }
-
-/**
- * @}
- */ /* end of group PIT_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- PMC Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup PMC_Peripheral_Access_Layer PMC Peripheral Access Layer
- * @{
- */
-
-/** PMC - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t LVDSC1;                             /**< Low Voltage Detect Status And Control 1 register, offset: 0x0 */
-  __IO uint8_t LVDSC2;                             /**< Low Voltage Detect Status And Control 2 register, offset: 0x1 */
-  __IO uint8_t REGSC;                              /**< Regulator Status And Control register, offset: 0x2 */
-} PMC_Type;
-
-/* ----------------------------------------------------------------------------
-   -- PMC Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup PMC_Register_Masks PMC Register Masks
- * @{
- */
-
-/* LVDSC1 Bit Fields */
-#define PMC_LVDSC1_LVDV_MASK                     0x3u
-#define PMC_LVDSC1_LVDV_SHIFT                    0
-#define PMC_LVDSC1_LVDV(x)                       (((uint8_t)(((uint8_t)(x))<<PMC_LVDSC1_LVDV_SHIFT))&PMC_LVDSC1_LVDV_MASK)
-#define PMC_LVDSC1_LVDRE_MASK                    0x10u
-#define PMC_LVDSC1_LVDRE_SHIFT                   4
-#define PMC_LVDSC1_LVDIE_MASK                    0x20u
-#define PMC_LVDSC1_LVDIE_SHIFT                   5
-#define PMC_LVDSC1_LVDACK_MASK                   0x40u
-#define PMC_LVDSC1_LVDACK_SHIFT                  6
-#define PMC_LVDSC1_LVDF_MASK                     0x80u
-#define PMC_LVDSC1_LVDF_SHIFT                    7
-/* LVDSC2 Bit Fields */
-#define PMC_LVDSC2_LVWV_MASK                     0x3u
-#define PMC_LVDSC2_LVWV_SHIFT                    0
-#define PMC_LVDSC2_LVWV(x)                       (((uint8_t)(((uint8_t)(x))<<PMC_LVDSC2_LVWV_SHIFT))&PMC_LVDSC2_LVWV_MASK)
-#define PMC_LVDSC2_LVWIE_MASK                    0x20u
-#define PMC_LVDSC2_LVWIE_SHIFT                   5
-#define PMC_LVDSC2_LVWACK_MASK                   0x40u
-#define PMC_LVDSC2_LVWACK_SHIFT                  6
-#define PMC_LVDSC2_LVWF_MASK                     0x80u
-#define PMC_LVDSC2_LVWF_SHIFT                    7
-/* REGSC Bit Fields */
-#define PMC_REGSC_BGBE_MASK                      0x1u
-#define PMC_REGSC_BGBE_SHIFT                     0
-#define PMC_REGSC_REGONS_MASK                    0x4u
-#define PMC_REGSC_REGONS_SHIFT                   2
-#define PMC_REGSC_ACKISO_MASK                    0x8u
-#define PMC_REGSC_ACKISO_SHIFT                   3
-#define PMC_REGSC_BGEN_MASK                      0x10u
-#define PMC_REGSC_BGEN_SHIFT                     4
-
-/**
- * @}
- */ /* end of group PMC_Register_Masks */
-
-
-/* PMC - Peripheral instance base addresses */
-/** Peripheral PMC base address */
-#define PMC_BASE                                 (0x4007D000u)
-/** Peripheral PMC base pointer */
-#define PMC                                      ((PMC_Type *)PMC_BASE)
-/** Array initializer of PMC peripheral base pointers */
-#define PMC_BASES                                { PMC }
-
-/**
- * @}
- */ /* end of group PMC_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- PORT Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup PORT_Peripheral_Access_Layer PORT Peripheral Access Layer
- * @{
- */
-
-/** PORT - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t PCR[32];                           /**< Pin Control Register n, array offset: 0x0, array step: 0x4 */
-  __O  uint32_t GPCLR;                             /**< Global Pin Control Low Register, offset: 0x80 */
-  __O  uint32_t GPCHR;                             /**< Global Pin Control High Register, offset: 0x84 */
-       uint8_t RESERVED_0[24];
-  __IO uint32_t ISFR;                              /**< Interrupt Status Flag Register, offset: 0xA0 */
-} PORT_Type;
-
-/* ----------------------------------------------------------------------------
-   -- PORT Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup PORT_Register_Masks PORT Register Masks
- * @{
- */
-
-/* PCR Bit Fields */
-#define PORT_PCR_PS_MASK                         0x1u
-#define PORT_PCR_PS_SHIFT                        0
-#define PORT_PCR_PE_MASK                         0x2u
-#define PORT_PCR_PE_SHIFT                        1
-#define PORT_PCR_SRE_MASK                        0x4u
-#define PORT_PCR_SRE_SHIFT                       2
-#define PORT_PCR_PFE_MASK                        0x10u
-#define PORT_PCR_PFE_SHIFT                       4
-#define PORT_PCR_DSE_MASK                        0x40u
-#define PORT_PCR_DSE_SHIFT                       6
-#define PORT_PCR_MUX_MASK                        0x700u
-#define PORT_PCR_MUX_SHIFT                       8
-#define PORT_PCR_MUX(x)                          (((uint32_t)(((uint32_t)(x))<<PORT_PCR_MUX_SHIFT))&PORT_PCR_MUX_MASK)
-#define PORT_PCR_IRQC_MASK                       0xF0000u
-#define PORT_PCR_IRQC_SHIFT                      16
-#define PORT_PCR_IRQC(x)                         (((uint32_t)(((uint32_t)(x))<<PORT_PCR_IRQC_SHIFT))&PORT_PCR_IRQC_MASK)
-#define PORT_PCR_ISF_MASK                        0x1000000u
-#define PORT_PCR_ISF_SHIFT                       24
-/* GPCLR Bit Fields */
-#define PORT_GPCLR_GPWD_MASK                     0xFFFFu
-#define PORT_GPCLR_GPWD_SHIFT                    0
-#define PORT_GPCLR_GPWD(x)                       (((uint32_t)(((uint32_t)(x))<<PORT_GPCLR_GPWD_SHIFT))&PORT_GPCLR_GPWD_MASK)
-#define PORT_GPCLR_GPWE_MASK                     0xFFFF0000u
-#define PORT_GPCLR_GPWE_SHIFT                    16
-#define PORT_GPCLR_GPWE(x)                       (((uint32_t)(((uint32_t)(x))<<PORT_GPCLR_GPWE_SHIFT))&PORT_GPCLR_GPWE_MASK)
-/* GPCHR Bit Fields */
-#define PORT_GPCHR_GPWD_MASK                     0xFFFFu
-#define PORT_GPCHR_GPWD_SHIFT                    0
-#define PORT_GPCHR_GPWD(x)                       (((uint32_t)(((uint32_t)(x))<<PORT_GPCHR_GPWD_SHIFT))&PORT_GPCHR_GPWD_MASK)
-#define PORT_GPCHR_GPWE_MASK                     0xFFFF0000u
-#define PORT_GPCHR_GPWE_SHIFT                    16
-#define PORT_GPCHR_GPWE(x)                       (((uint32_t)(((uint32_t)(x))<<PORT_GPCHR_GPWE_SHIFT))&PORT_GPCHR_GPWE_MASK)
-/* ISFR Bit Fields */
-#define PORT_ISFR_ISF_MASK                       0xFFFFFFFFu
-#define PORT_ISFR_ISF_SHIFT                      0
-#define PORT_ISFR_ISF(x)                         (((uint32_t)(((uint32_t)(x))<<PORT_ISFR_ISF_SHIFT))&PORT_ISFR_ISF_MASK)
-
-/**
- * @}
- */ /* end of group PORT_Register_Masks */
-
-
-/* PORT - Peripheral instance base addresses */
-/** Peripheral PORTA base address */
-#define PORTA_BASE                               (0x40049000u)
-/** Peripheral PORTA base pointer */
-#define PORTA                                    ((PORT_Type *)PORTA_BASE)
-/** Peripheral PORTB base address */
-#define PORTB_BASE                               (0x4004A000u)
-/** Peripheral PORTB base pointer */
-#define PORTB                                    ((PORT_Type *)PORTB_BASE)
-/** Peripheral PORTC base address */
-#define PORTC_BASE                               (0x4004B000u)
-/** Peripheral PORTC base pointer */
-#define PORTC                                    ((PORT_Type *)PORTC_BASE)
-/** Peripheral PORTD base address */
-#define PORTD_BASE                               (0x4004C000u)
-/** Peripheral PORTD base pointer */
-#define PORTD                                    ((PORT_Type *)PORTD_BASE)
-/** Peripheral PORTE base address */
-#define PORTE_BASE                               (0x4004D000u)
-/** Peripheral PORTE base pointer */
-#define PORTE                                    ((PORT_Type *)PORTE_BASE)
-/** Array initializer of PORT peripheral base pointers */
-#define PORT_BASES                               { PORTA, PORTB, PORTC, PORTD, PORTE }
-
-/**
- * @}
- */ /* end of group PORT_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- RCM Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup RCM_Peripheral_Access_Layer RCM Peripheral Access Layer
- * @{
- */
-
-/** RCM - Register Layout Typedef */
-typedef struct {
-  __I  uint8_t SRS0;                               /**< System Reset Status Register 0, offset: 0x0 */
-  __I  uint8_t SRS1;                               /**< System Reset Status Register 1, offset: 0x1 */
-       uint8_t RESERVED_0[2];
-  __IO uint8_t RPFC;                               /**< Reset Pin Filter Control register, offset: 0x4 */
-  __IO uint8_t RPFW;                               /**< Reset Pin Filter Width register, offset: 0x5 */
-} RCM_Type;
-
-/* ----------------------------------------------------------------------------
-   -- RCM Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup RCM_Register_Masks RCM Register Masks
- * @{
- */
-
-/* SRS0 Bit Fields */
-#define RCM_SRS0_WAKEUP_MASK                     0x1u
-#define RCM_SRS0_WAKEUP_SHIFT                    0
-#define RCM_SRS0_LVD_MASK                        0x2u
-#define RCM_SRS0_LVD_SHIFT                       1
-#define RCM_SRS0_LOC_MASK                        0x4u
-#define RCM_SRS0_LOC_SHIFT                       2
-#define RCM_SRS0_LOL_MASK                        0x8u
-#define RCM_SRS0_LOL_SHIFT                       3
-#define RCM_SRS0_WDOG_MASK                       0x20u
-#define RCM_SRS0_WDOG_SHIFT                      5
-#define RCM_SRS0_PIN_MASK                        0x40u
-#define RCM_SRS0_PIN_SHIFT                       6
-#define RCM_SRS0_POR_MASK                        0x80u
-#define RCM_SRS0_POR_SHIFT                       7
-/* SRS1 Bit Fields */
-#define RCM_SRS1_LOCKUP_MASK                     0x2u
-#define RCM_SRS1_LOCKUP_SHIFT                    1
-#define RCM_SRS1_SW_MASK                         0x4u
-#define RCM_SRS1_SW_SHIFT                        2
-#define RCM_SRS1_MDM_AP_MASK                     0x8u
-#define RCM_SRS1_MDM_AP_SHIFT                    3
-#define RCM_SRS1_SACKERR_MASK                    0x20u
-#define RCM_SRS1_SACKERR_SHIFT                   5
-/* RPFC Bit Fields */
-#define RCM_RPFC_RSTFLTSRW_MASK                  0x3u
-#define RCM_RPFC_RSTFLTSRW_SHIFT                 0
-#define RCM_RPFC_RSTFLTSRW(x)                    (((uint8_t)(((uint8_t)(x))<<RCM_RPFC_RSTFLTSRW_SHIFT))&RCM_RPFC_RSTFLTSRW_MASK)
-#define RCM_RPFC_RSTFLTSS_MASK                   0x4u
-#define RCM_RPFC_RSTFLTSS_SHIFT                  2
-/* RPFW Bit Fields */
-#define RCM_RPFW_RSTFLTSEL_MASK                  0x1Fu
-#define RCM_RPFW_RSTFLTSEL_SHIFT                 0
-#define RCM_RPFW_RSTFLTSEL(x)                    (((uint8_t)(((uint8_t)(x))<<RCM_RPFW_RSTFLTSEL_SHIFT))&RCM_RPFW_RSTFLTSEL_MASK)
-
-/**
- * @}
- */ /* end of group RCM_Register_Masks */
-
-
-/* RCM - Peripheral instance base addresses */
-/** Peripheral RCM base address */
-#define RCM_BASE                                 (0x4007F000u)
-/** Peripheral RCM base pointer */
-#define RCM                                      ((RCM_Type *)RCM_BASE)
-/** Array initializer of RCM peripheral base pointers */
-#define RCM_BASES                                { RCM }
-
-/**
- * @}
- */ /* end of group RCM_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- ROM Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup ROM_Peripheral_Access_Layer ROM Peripheral Access Layer
- * @{
- */
-
-/** ROM - Register Layout Typedef */
-typedef struct {
-  __I  uint32_t ENTRY[3];                          /**< Entry, array offset: 0x0, array step: 0x4 */
-  __I  uint32_t TABLEMARK;                         /**< End of Table Marker Register, offset: 0xC */
-       uint8_t RESERVED_0[4028];
-  __I  uint32_t SYSACCESS;                         /**< System Access Register, offset: 0xFCC */
-  __I  uint32_t PERIPHID4;                         /**< Peripheral ID Register, offset: 0xFD0 */
-  __I  uint32_t PERIPHID5;                         /**< Peripheral ID Register, offset: 0xFD4 */
-  __I  uint32_t PERIPHID6;                         /**< Peripheral ID Register, offset: 0xFD8 */
-  __I  uint32_t PERIPHID7;                         /**< Peripheral ID Register, offset: 0xFDC */
-  __I  uint32_t PERIPHID0;                         /**< Peripheral ID Register, offset: 0xFE0 */
-  __I  uint32_t PERIPHID1;                         /**< Peripheral ID Register, offset: 0xFE4 */
-  __I  uint32_t PERIPHID2;                         /**< Peripheral ID Register, offset: 0xFE8 */
-  __I  uint32_t PERIPHID3;                         /**< Peripheral ID Register, offset: 0xFEC */
-  __I  uint32_t COMPID[4];                         /**< Component ID Register, array offset: 0xFF0, array step: 0x4 */
-} ROM_Type;
-
-/* ----------------------------------------------------------------------------
-   -- ROM Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup ROM_Register_Masks ROM Register Masks
- * @{
- */
-
-/* ENTRY Bit Fields */
-#define ROM_ENTRY_ENTRY_MASK                     0xFFFFFFFFu
-#define ROM_ENTRY_ENTRY_SHIFT                    0
-#define ROM_ENTRY_ENTRY(x)                       (((uint32_t)(((uint32_t)(x))<<ROM_ENTRY_ENTRY_SHIFT))&ROM_ENTRY_ENTRY_MASK)
-/* TABLEMARK Bit Fields */
-#define ROM_TABLEMARK_MARK_MASK                  0xFFFFFFFFu
-#define ROM_TABLEMARK_MARK_SHIFT                 0
-#define ROM_TABLEMARK_MARK(x)                    (((uint32_t)(((uint32_t)(x))<<ROM_TABLEMARK_MARK_SHIFT))&ROM_TABLEMARK_MARK_MASK)
-/* SYSACCESS Bit Fields */
-#define ROM_SYSACCESS_SYSACCESS_MASK             0xFFFFFFFFu
-#define ROM_SYSACCESS_SYSACCESS_SHIFT            0
-#define ROM_SYSACCESS_SYSACCESS(x)               (((uint32_t)(((uint32_t)(x))<<ROM_SYSACCESS_SYSACCESS_SHIFT))&ROM_SYSACCESS_SYSACCESS_MASK)
-/* PERIPHID4 Bit Fields */
-#define ROM_PERIPHID4_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID4_PERIPHID_SHIFT             0
-#define ROM_PERIPHID4_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID4_PERIPHID_SHIFT))&ROM_PERIPHID4_PERIPHID_MASK)
-/* PERIPHID5 Bit Fields */
-#define ROM_PERIPHID5_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID5_PERIPHID_SHIFT             0
-#define ROM_PERIPHID5_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID5_PERIPHID_SHIFT))&ROM_PERIPHID5_PERIPHID_MASK)
-/* PERIPHID6 Bit Fields */
-#define ROM_PERIPHID6_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID6_PERIPHID_SHIFT             0
-#define ROM_PERIPHID6_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID6_PERIPHID_SHIFT))&ROM_PERIPHID6_PERIPHID_MASK)
-/* PERIPHID7 Bit Fields */
-#define ROM_PERIPHID7_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID7_PERIPHID_SHIFT             0
-#define ROM_PERIPHID7_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID7_PERIPHID_SHIFT))&ROM_PERIPHID7_PERIPHID_MASK)
-/* PERIPHID0 Bit Fields */
-#define ROM_PERIPHID0_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID0_PERIPHID_SHIFT             0
-#define ROM_PERIPHID0_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID0_PERIPHID_SHIFT))&ROM_PERIPHID0_PERIPHID_MASK)
-/* PERIPHID1 Bit Fields */
-#define ROM_PERIPHID1_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID1_PERIPHID_SHIFT             0
-#define ROM_PERIPHID1_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID1_PERIPHID_SHIFT))&ROM_PERIPHID1_PERIPHID_MASK)
-/* PERIPHID2 Bit Fields */
-#define ROM_PERIPHID2_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID2_PERIPHID_SHIFT             0
-#define ROM_PERIPHID2_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID2_PERIPHID_SHIFT))&ROM_PERIPHID2_PERIPHID_MASK)
-/* PERIPHID3 Bit Fields */
-#define ROM_PERIPHID3_PERIPHID_MASK              0xFFFFFFFFu
-#define ROM_PERIPHID3_PERIPHID_SHIFT             0
-#define ROM_PERIPHID3_PERIPHID(x)                (((uint32_t)(((uint32_t)(x))<<ROM_PERIPHID3_PERIPHID_SHIFT))&ROM_PERIPHID3_PERIPHID_MASK)
-/* COMPID Bit Fields */
-#define ROM_COMPID_COMPID_MASK                   0xFFFFFFFFu
-#define ROM_COMPID_COMPID_SHIFT                  0
-#define ROM_COMPID_COMPID(x)                     (((uint32_t)(((uint32_t)(x))<<ROM_COMPID_COMPID_SHIFT))&ROM_COMPID_COMPID_MASK)
-
-/**
- * @}
- */ /* end of group ROM_Register_Masks */
-
-
-/* ROM - Peripheral instance base addresses */
-/** Peripheral ROM base address */
-#define ROM_BASE                                 (0xF0002000u)
-/** Peripheral ROM base pointer */
-#define ROM                                      ((ROM_Type *)ROM_BASE)
-/** Array initializer of ROM peripheral base pointers */
-#define ROM_BASES                                { ROM }
-
-/**
- * @}
- */ /* end of group ROM_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- RTC Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup RTC_Peripheral_Access_Layer RTC Peripheral Access Layer
- * @{
- */
-
-/** RTC - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t TSR;                               /**< RTC Time Seconds Register, offset: 0x0 */
-  __IO uint32_t TPR;                               /**< RTC Time Prescaler Register, offset: 0x4 */
-  __IO uint32_t TAR;                               /**< RTC Time Alarm Register, offset: 0x8 */
-  __IO uint32_t TCR;                               /**< RTC Time Compensation Register, offset: 0xC */
-  __IO uint32_t CR;                                /**< RTC Control Register, offset: 0x10 */
-  __IO uint32_t SR;                                /**< RTC Status Register, offset: 0x14 */
-  __IO uint32_t LR;                                /**< RTC Lock Register, offset: 0x18 */
-  __IO uint32_t IER;                               /**< RTC Interrupt Enable Register, offset: 0x1C */
-} RTC_Type;
-
-/* ----------------------------------------------------------------------------
-   -- RTC Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup RTC_Register_Masks RTC Register Masks
- * @{
- */
-
-/* TSR Bit Fields */
-#define RTC_TSR_TSR_MASK                         0xFFFFFFFFu
-#define RTC_TSR_TSR_SHIFT                        0
-#define RTC_TSR_TSR(x)                           (((uint32_t)(((uint32_t)(x))<<RTC_TSR_TSR_SHIFT))&RTC_TSR_TSR_MASK)
-/* TPR Bit Fields */
-#define RTC_TPR_TPR_MASK                         0xFFFFu
-#define RTC_TPR_TPR_SHIFT                        0
-#define RTC_TPR_TPR(x)                           (((uint32_t)(((uint32_t)(x))<<RTC_TPR_TPR_SHIFT))&RTC_TPR_TPR_MASK)
-/* TAR Bit Fields */
-#define RTC_TAR_TAR_MASK                         0xFFFFFFFFu
-#define RTC_TAR_TAR_SHIFT                        0
-#define RTC_TAR_TAR(x)                           (((uint32_t)(((uint32_t)(x))<<RTC_TAR_TAR_SHIFT))&RTC_TAR_TAR_MASK)
-/* TCR Bit Fields */
-#define RTC_TCR_TCR_MASK                         0xFFu
-#define RTC_TCR_TCR_SHIFT                        0
-#define RTC_TCR_TCR(x)                           (((uint32_t)(((uint32_t)(x))<<RTC_TCR_TCR_SHIFT))&RTC_TCR_TCR_MASK)
-#define RTC_TCR_CIR_MASK                         0xFF00u
-#define RTC_TCR_CIR_SHIFT                        8
-#define RTC_TCR_CIR(x)                           (((uint32_t)(((uint32_t)(x))<<RTC_TCR_CIR_SHIFT))&RTC_TCR_CIR_MASK)
-#define RTC_TCR_TCV_MASK                         0xFF0000u
-#define RTC_TCR_TCV_SHIFT                        16
-#define RTC_TCR_TCV(x)                           (((uint32_t)(((uint32_t)(x))<<RTC_TCR_TCV_SHIFT))&RTC_TCR_TCV_MASK)
-#define RTC_TCR_CIC_MASK                         0xFF000000u
-#define RTC_TCR_CIC_SHIFT                        24
-#define RTC_TCR_CIC(x)                           (((uint32_t)(((uint32_t)(x))<<RTC_TCR_CIC_SHIFT))&RTC_TCR_CIC_MASK)
-/* CR Bit Fields */
-#define RTC_CR_SWR_MASK                          0x1u
-#define RTC_CR_SWR_SHIFT                         0
-#define RTC_CR_WPE_MASK                          0x2u
-#define RTC_CR_WPE_SHIFT                         1
-#define RTC_CR_SUP_MASK                          0x4u
-#define RTC_CR_SUP_SHIFT                         2
-#define RTC_CR_UM_MASK                           0x8u
-#define RTC_CR_UM_SHIFT                          3
-#define RTC_CR_OSCE_MASK                         0x100u
-#define RTC_CR_OSCE_SHIFT                        8
-#define RTC_CR_CLKO_MASK                         0x200u
-#define RTC_CR_CLKO_SHIFT                        9
-#define RTC_CR_SC16P_MASK                        0x400u
-#define RTC_CR_SC16P_SHIFT                       10
-#define RTC_CR_SC8P_MASK                         0x800u
-#define RTC_CR_SC8P_SHIFT                        11
-#define RTC_CR_SC4P_MASK                         0x1000u
-#define RTC_CR_SC4P_SHIFT                        12
-#define RTC_CR_SC2P_MASK                         0x2000u
-#define RTC_CR_SC2P_SHIFT                        13
-/* SR Bit Fields */
-#define RTC_SR_TIF_MASK                          0x1u
-#define RTC_SR_TIF_SHIFT                         0
-#define RTC_SR_TOF_MASK                          0x2u
-#define RTC_SR_TOF_SHIFT                         1
-#define RTC_SR_TAF_MASK                          0x4u
-#define RTC_SR_TAF_SHIFT                         2
-#define RTC_SR_TCE_MASK                          0x10u
-#define RTC_SR_TCE_SHIFT                         4
-/* LR Bit Fields */
-#define RTC_LR_TCL_MASK                          0x8u
-#define RTC_LR_TCL_SHIFT                         3
-#define RTC_LR_CRL_MASK                          0x10u
-#define RTC_LR_CRL_SHIFT                         4
-#define RTC_LR_SRL_MASK                          0x20u
-#define RTC_LR_SRL_SHIFT                         5
-#define RTC_LR_LRL_MASK                          0x40u
-#define RTC_LR_LRL_SHIFT                         6
-/* IER Bit Fields */
-#define RTC_IER_TIIE_MASK                        0x1u
-#define RTC_IER_TIIE_SHIFT                       0
-#define RTC_IER_TOIE_MASK                        0x2u
-#define RTC_IER_TOIE_SHIFT                       1
-#define RTC_IER_TAIE_MASK                        0x4u
-#define RTC_IER_TAIE_SHIFT                       2
-#define RTC_IER_TSIE_MASK                        0x10u
-#define RTC_IER_TSIE_SHIFT                       4
-#define RTC_IER_WPON_MASK                        0x80u
-#define RTC_IER_WPON_SHIFT                       7
-
-/**
- * @}
- */ /* end of group RTC_Register_Masks */
-
-
-/* RTC - Peripheral instance base addresses */
-/** Peripheral RTC base address */
-#define RTC_BASE                                 (0x4003D000u)
-/** Peripheral RTC base pointer */
-#define RTC                                      ((RTC_Type *)RTC_BASE)
-/** Array initializer of RTC peripheral base pointers */
-#define RTC_BASES                                { RTC }
-
-/**
- * @}
- */ /* end of group RTC_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- SIM Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup SIM_Peripheral_Access_Layer SIM Peripheral Access Layer
- * @{
- */
-
-/** SIM - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t SOPT1;                             /**< System Options Register 1, offset: 0x0 */
-  __IO uint32_t SOPT1CFG;                          /**< SOPT1 Configuration Register, offset: 0x4 */
-       uint8_t RESERVED_0[4092];
-  __IO uint32_t SOPT2;                             /**< System Options Register 2, offset: 0x1004 */
-       uint8_t RESERVED_1[4];
-  __IO uint32_t SOPT4;                             /**< System Options Register 4, offset: 0x100C */
-  __IO uint32_t SOPT5;                             /**< System Options Register 5, offset: 0x1010 */
-       uint8_t RESERVED_2[4];
-  __IO uint32_t SOPT7;                             /**< System Options Register 7, offset: 0x1018 */
-       uint8_t RESERVED_3[8];
-  __I  uint32_t SDID;                              /**< System Device Identification Register, offset: 0x1024 */
-       uint8_t RESERVED_4[12];
-  __IO uint32_t SCGC4;                             /**< System Clock Gating Control Register 4, offset: 0x1034 */
-  __IO uint32_t SCGC5;                             /**< System Clock Gating Control Register 5, offset: 0x1038 */
-  __IO uint32_t SCGC6;                             /**< System Clock Gating Control Register 6, offset: 0x103C */
-  __IO uint32_t SCGC7;                             /**< System Clock Gating Control Register 7, offset: 0x1040 */
-  __IO uint32_t CLKDIV1;                           /**< System Clock Divider Register 1, offset: 0x1044 */
-       uint8_t RESERVED_5[4];
-  __IO uint32_t FCFG1;                             /**< Flash Configuration Register 1, offset: 0x104C */
-  __I  uint32_t FCFG2;                             /**< Flash Configuration Register 2, offset: 0x1050 */
-       uint8_t RESERVED_6[4];
-  __I  uint32_t UIDMH;                             /**< Unique Identification Register Mid-High, offset: 0x1058 */
-  __I  uint32_t UIDML;                             /**< Unique Identification Register Mid Low, offset: 0x105C */
-  __I  uint32_t UIDL;                              /**< Unique Identification Register Low, offset: 0x1060 */
-       uint8_t RESERVED_7[156];
-  __IO uint32_t COPC;                              /**< COP Control Register, offset: 0x1100 */
-  __O  uint32_t SRVCOP;                            /**< Service COP Register, offset: 0x1104 */
-} SIM_Type;
-
-/* ----------------------------------------------------------------------------
-   -- SIM Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup SIM_Register_Masks SIM Register Masks
- * @{
- */
-
-/* SOPT1 Bit Fields */
-#define SIM_SOPT1_OSC32KSEL_MASK                 0xC0000u
-#define SIM_SOPT1_OSC32KSEL_SHIFT                18
-#define SIM_SOPT1_OSC32KSEL(x)                   (((uint32_t)(((uint32_t)(x))<<SIM_SOPT1_OSC32KSEL_SHIFT))&SIM_SOPT1_OSC32KSEL_MASK)
-#define SIM_SOPT1_USBVSTBY_MASK                  0x20000000u
-#define SIM_SOPT1_USBVSTBY_SHIFT                 29
-#define SIM_SOPT1_USBSSTBY_MASK                  0x40000000u
-#define SIM_SOPT1_USBSSTBY_SHIFT                 30
-#define SIM_SOPT1_USBREGEN_MASK                  0x80000000u
-#define SIM_SOPT1_USBREGEN_SHIFT                 31
-/* SOPT1CFG Bit Fields */
-#define SIM_SOPT1CFG_URWE_MASK                   0x1000000u
-#define SIM_SOPT1CFG_URWE_SHIFT                  24
-#define SIM_SOPT1CFG_UVSWE_MASK                  0x2000000u
-#define SIM_SOPT1CFG_UVSWE_SHIFT                 25
-#define SIM_SOPT1CFG_USSWE_MASK                  0x4000000u
-#define SIM_SOPT1CFG_USSWE_SHIFT                 26
-/* SOPT2 Bit Fields */
-#define SIM_SOPT2_RTCCLKOUTSEL_MASK              0x10u
-#define SIM_SOPT2_RTCCLKOUTSEL_SHIFT             4
-#define SIM_SOPT2_CLKOUTSEL_MASK                 0xE0u
-#define SIM_SOPT2_CLKOUTSEL_SHIFT                5
-#define SIM_SOPT2_CLKOUTSEL(x)                   (((uint32_t)(((uint32_t)(x))<<SIM_SOPT2_CLKOUTSEL_SHIFT))&SIM_SOPT2_CLKOUTSEL_MASK)
-#define SIM_SOPT2_PLLFLLSEL_MASK                 0x10000u
-#define SIM_SOPT2_PLLFLLSEL_SHIFT                16
-#define SIM_SOPT2_USBSRC_MASK                    0x40000u
-#define SIM_SOPT2_USBSRC_SHIFT                   18
-#define SIM_SOPT2_TPMSRC_MASK                    0x3000000u
-#define SIM_SOPT2_TPMSRC_SHIFT                   24
-#define SIM_SOPT2_TPMSRC(x)                      (((uint32_t)(((uint32_t)(x))<<SIM_SOPT2_TPMSRC_SHIFT))&SIM_SOPT2_TPMSRC_MASK)
-#define SIM_SOPT2_UART0SRC_MASK                  0xC000000u
-#define SIM_SOPT2_UART0SRC_SHIFT                 26
-#define SIM_SOPT2_UART0SRC(x)                    (((uint32_t)(((uint32_t)(x))<<SIM_SOPT2_UART0SRC_SHIFT))&SIM_SOPT2_UART0SRC_MASK)
-/* SOPT4 Bit Fields */
-#define SIM_SOPT4_TPM1CH0SRC_MASK                0x40000u
-#define SIM_SOPT4_TPM1CH0SRC_SHIFT               18
-#define SIM_SOPT4_TPM2CH0SRC_MASK                0x100000u
-#define SIM_SOPT4_TPM2CH0SRC_SHIFT               20
-#define SIM_SOPT4_TPM0CLKSEL_MASK                0x1000000u
-#define SIM_SOPT4_TPM0CLKSEL_SHIFT               24
-#define SIM_SOPT4_TPM1CLKSEL_MASK                0x2000000u
-#define SIM_SOPT4_TPM1CLKSEL_SHIFT               25
-#define SIM_SOPT4_TPM2CLKSEL_MASK                0x4000000u
-#define SIM_SOPT4_TPM2CLKSEL_SHIFT               26
-/* SOPT5 Bit Fields */
-#define SIM_SOPT5_UART0TXSRC_MASK                0x3u
-#define SIM_SOPT5_UART0TXSRC_SHIFT               0
-#define SIM_SOPT5_UART0TXSRC(x)                  (((uint32_t)(((uint32_t)(x))<<SIM_SOPT5_UART0TXSRC_SHIFT))&SIM_SOPT5_UART0TXSRC_MASK)
-#define SIM_SOPT5_UART0RXSRC_MASK                0x4u
-#define SIM_SOPT5_UART0RXSRC_SHIFT               2
-#define SIM_SOPT5_UART1TXSRC_MASK                0x30u
-#define SIM_SOPT5_UART1TXSRC_SHIFT               4
-#define SIM_SOPT5_UART1TXSRC(x)                  (((uint32_t)(((uint32_t)(x))<<SIM_SOPT5_UART1TXSRC_SHIFT))&SIM_SOPT5_UART1TXSRC_MASK)
-#define SIM_SOPT5_UART1RXSRC_MASK                0x40u
-#define SIM_SOPT5_UART1RXSRC_SHIFT               6
-#define SIM_SOPT5_UART0ODE_MASK                  0x10000u
-#define SIM_SOPT5_UART0ODE_SHIFT                 16
-#define SIM_SOPT5_UART1ODE_MASK                  0x20000u
-#define SIM_SOPT5_UART1ODE_SHIFT                 17
-#define SIM_SOPT5_UART2ODE_MASK                  0x40000u
-#define SIM_SOPT5_UART2ODE_SHIFT                 18
-/* SOPT7 Bit Fields */
-#define SIM_SOPT7_ADC0TRGSEL_MASK                0xFu
-#define SIM_SOPT7_ADC0TRGSEL_SHIFT               0
-#define SIM_SOPT7_ADC0TRGSEL(x)                  (((uint32_t)(((uint32_t)(x))<<SIM_SOPT7_ADC0TRGSEL_SHIFT))&SIM_SOPT7_ADC0TRGSEL_MASK)
-#define SIM_SOPT7_ADC0PRETRGSEL_MASK             0x10u
-#define SIM_SOPT7_ADC0PRETRGSEL_SHIFT            4
-#define SIM_SOPT7_ADC0ALTTRGEN_MASK              0x80u
-#define SIM_SOPT7_ADC0ALTTRGEN_SHIFT             7
-/* SDID Bit Fields */
-#define SIM_SDID_PINID_MASK                      0xFu
-#define SIM_SDID_PINID_SHIFT                     0
-#define SIM_SDID_PINID(x)                        (((uint32_t)(((uint32_t)(x))<<SIM_SDID_PINID_SHIFT))&SIM_SDID_PINID_MASK)
-#define SIM_SDID_DIEID_MASK                      0xF80u
-#define SIM_SDID_DIEID_SHIFT                     7
-#define SIM_SDID_DIEID(x)                        (((uint32_t)(((uint32_t)(x))<<SIM_SDID_DIEID_SHIFT))&SIM_SDID_DIEID_MASK)
-#define SIM_SDID_REVID_MASK                      0xF000u
-#define SIM_SDID_REVID_SHIFT                     12
-#define SIM_SDID_REVID(x)                        (((uint32_t)(((uint32_t)(x))<<SIM_SDID_REVID_SHIFT))&SIM_SDID_REVID_MASK)
-#define SIM_SDID_SRAMSIZE_MASK                   0xF0000u
-#define SIM_SDID_SRAMSIZE_SHIFT                  16
-#define SIM_SDID_SRAMSIZE(x)                     (((uint32_t)(((uint32_t)(x))<<SIM_SDID_SRAMSIZE_SHIFT))&SIM_SDID_SRAMSIZE_MASK)
-#define SIM_SDID_SERIESID_MASK                   0xF00000u
-#define SIM_SDID_SERIESID_SHIFT                  20
-#define SIM_SDID_SERIESID(x)                     (((uint32_t)(((uint32_t)(x))<<SIM_SDID_SERIESID_SHIFT))&SIM_SDID_SERIESID_MASK)
-#define SIM_SDID_SUBFAMID_MASK                   0xF000000u
-#define SIM_SDID_SUBFAMID_SHIFT                  24
-#define SIM_SDID_SUBFAMID(x)                     (((uint32_t)(((uint32_t)(x))<<SIM_SDID_SUBFAMID_SHIFT))&SIM_SDID_SUBFAMID_MASK)
-#define SIM_SDID_FAMID_MASK                      0xF0000000u
-#define SIM_SDID_FAMID_SHIFT                     28
-#define SIM_SDID_FAMID(x)                        (((uint32_t)(((uint32_t)(x))<<SIM_SDID_FAMID_SHIFT))&SIM_SDID_FAMID_MASK)
-/* SCGC4 Bit Fields */
-#define SIM_SCGC4_I2C0_MASK                      0x40u
-#define SIM_SCGC4_I2C0_SHIFT                     6
-#define SIM_SCGC4_I2C1_MASK                      0x80u
-#define SIM_SCGC4_I2C1_SHIFT                     7
-#define SIM_SCGC4_UART0_MASK                     0x400u
-#define SIM_SCGC4_UART0_SHIFT                    10
-#define SIM_SCGC4_UART1_MASK                     0x800u
-#define SIM_SCGC4_UART1_SHIFT                    11
-#define SIM_SCGC4_UART2_MASK                     0x1000u
-#define SIM_SCGC4_UART2_SHIFT                    12
-#define SIM_SCGC4_USBOTG_MASK                    0x40000u
-#define SIM_SCGC4_USBOTG_SHIFT                   18
-#define SIM_SCGC4_CMP_MASK                       0x80000u
-#define SIM_SCGC4_CMP_SHIFT                      19
-#define SIM_SCGC4_SPI0_MASK                      0x400000u
-#define SIM_SCGC4_SPI0_SHIFT                     22
-#define SIM_SCGC4_SPI1_MASK                      0x800000u
-#define SIM_SCGC4_SPI1_SHIFT                     23
-/* SCGC5 Bit Fields */
-#define SIM_SCGC5_LPTMR_MASK                     0x1u
-#define SIM_SCGC5_LPTMR_SHIFT                    0
-#define SIM_SCGC5_TSI_MASK                       0x20u
-#define SIM_SCGC5_TSI_SHIFT                      5
-#define SIM_SCGC5_PORTA_MASK                     0x200u
-#define SIM_SCGC5_PORTA_SHIFT                    9
-#define SIM_SCGC5_PORTB_MASK                     0x400u
-#define SIM_SCGC5_PORTB_SHIFT                    10
-#define SIM_SCGC5_PORTC_MASK                     0x800u
-#define SIM_SCGC5_PORTC_SHIFT                    11
-#define SIM_SCGC5_PORTD_MASK                     0x1000u
-#define SIM_SCGC5_PORTD_SHIFT                    12
-#define SIM_SCGC5_PORTE_MASK                     0x2000u
-#define SIM_SCGC5_PORTE_SHIFT                    13
-/* SCGC6 Bit Fields */
-#define SIM_SCGC6_FTF_MASK                       0x1u
-#define SIM_SCGC6_FTF_SHIFT                      0
-#define SIM_SCGC6_DMAMUX_MASK                    0x2u
-#define SIM_SCGC6_DMAMUX_SHIFT                   1
-#define SIM_SCGC6_PIT_MASK                       0x800000u
-#define SIM_SCGC6_PIT_SHIFT                      23
-#define SIM_SCGC6_TPM0_MASK                      0x1000000u
-#define SIM_SCGC6_TPM0_SHIFT                     24
-#define SIM_SCGC6_TPM1_MASK                      0x2000000u
-#define SIM_SCGC6_TPM1_SHIFT                     25
-#define SIM_SCGC6_TPM2_MASK                      0x4000000u
-#define SIM_SCGC6_TPM2_SHIFT                     26
-#define SIM_SCGC6_ADC0_MASK                      0x8000000u
-#define SIM_SCGC6_ADC0_SHIFT                     27
-#define SIM_SCGC6_RTC_MASK                       0x20000000u
-#define SIM_SCGC6_RTC_SHIFT                      29
-#define SIM_SCGC6_DAC0_MASK                      0x80000000u
-#define SIM_SCGC6_DAC0_SHIFT                     31
-/* SCGC7 Bit Fields */
-#define SIM_SCGC7_DMA_MASK                       0x100u
-#define SIM_SCGC7_DMA_SHIFT                      8
-/* CLKDIV1 Bit Fields */
-#define SIM_CLKDIV1_OUTDIV4_MASK                 0x70000u
-#define SIM_CLKDIV1_OUTDIV4_SHIFT                16
-#define SIM_CLKDIV1_OUTDIV4(x)                   (((uint32_t)(((uint32_t)(x))<<SIM_CLKDIV1_OUTDIV4_SHIFT))&SIM_CLKDIV1_OUTDIV4_MASK)
-#define SIM_CLKDIV1_OUTDIV1_MASK                 0xF0000000u
-#define SIM_CLKDIV1_OUTDIV1_SHIFT                28
-#define SIM_CLKDIV1_OUTDIV1(x)                   (((uint32_t)(((uint32_t)(x))<<SIM_CLKDIV1_OUTDIV1_SHIFT))&SIM_CLKDIV1_OUTDIV1_MASK)
-/* FCFG1 Bit Fields */
-#define SIM_FCFG1_FLASHDIS_MASK                  0x1u
-#define SIM_FCFG1_FLASHDIS_SHIFT                 0
-#define SIM_FCFG1_FLASHDOZE_MASK                 0x2u
-#define SIM_FCFG1_FLASHDOZE_SHIFT                1
-#define SIM_FCFG1_PFSIZE_MASK                    0xF000000u
-#define SIM_FCFG1_PFSIZE_SHIFT                   24
-#define SIM_FCFG1_PFSIZE(x)                      (((uint32_t)(((uint32_t)(x))<<SIM_FCFG1_PFSIZE_SHIFT))&SIM_FCFG1_PFSIZE_MASK)
-/* FCFG2 Bit Fields */
-#define SIM_FCFG2_MAXADDR_MASK                   0x7F000000u
-#define SIM_FCFG2_MAXADDR_SHIFT                  24
-#define SIM_FCFG2_MAXADDR(x)                     (((uint32_t)(((uint32_t)(x))<<SIM_FCFG2_MAXADDR_SHIFT))&SIM_FCFG2_MAXADDR_MASK)
-/* UIDMH Bit Fields */
-#define SIM_UIDMH_UID_MASK                       0xFFFFu
-#define SIM_UIDMH_UID_SHIFT                      0
-#define SIM_UIDMH_UID(x)                         (((uint32_t)(((uint32_t)(x))<<SIM_UIDMH_UID_SHIFT))&SIM_UIDMH_UID_MASK)
-/* UIDML Bit Fields */
-#define SIM_UIDML_UID_MASK                       0xFFFFFFFFu
-#define SIM_UIDML_UID_SHIFT                      0
-#define SIM_UIDML_UID(x)                         (((uint32_t)(((uint32_t)(x))<<SIM_UIDML_UID_SHIFT))&SIM_UIDML_UID_MASK)
-/* UIDL Bit Fields */
-#define SIM_UIDL_UID_MASK                        0xFFFFFFFFu
-#define SIM_UIDL_UID_SHIFT                       0
-#define SIM_UIDL_UID(x)                          (((uint32_t)(((uint32_t)(x))<<SIM_UIDL_UID_SHIFT))&SIM_UIDL_UID_MASK)
-/* COPC Bit Fields */
-#define SIM_COPC_COPW_MASK                       0x1u
-#define SIM_COPC_COPW_SHIFT                      0
-#define SIM_COPC_COPCLKS_MASK                    0x2u
-#define SIM_COPC_COPCLKS_SHIFT                   1
-#define SIM_COPC_COPT_MASK                       0xCu
-#define SIM_COPC_COPT_SHIFT                      2
-#define SIM_COPC_COPT(x)                         (((uint32_t)(((uint32_t)(x))<<SIM_COPC_COPT_SHIFT))&SIM_COPC_COPT_MASK)
-/* SRVCOP Bit Fields */
-#define SIM_SRVCOP_SRVCOP_MASK                   0xFFu
-#define SIM_SRVCOP_SRVCOP_SHIFT                  0
-#define SIM_SRVCOP_SRVCOP(x)                     (((uint32_t)(((uint32_t)(x))<<SIM_SRVCOP_SRVCOP_SHIFT))&SIM_SRVCOP_SRVCOP_MASK)
-
-/**
- * @}
- */ /* end of group SIM_Register_Masks */
-
-
-/* SIM - Peripheral instance base addresses */
-/** Peripheral SIM base address */
-#define SIM_BASE                                 (0x40047000u)
-/** Peripheral SIM base pointer */
-#define SIM                                      ((SIM_Type *)SIM_BASE)
-/** Array initializer of SIM peripheral base pointers */
-#define SIM_BASES                                { SIM }
-
-/**
- * @}
- */ /* end of group SIM_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- SMC Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup SMC_Peripheral_Access_Layer SMC Peripheral Access Layer
- * @{
- */
-
-/** SMC - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t PMPROT;                             /**< Power Mode Protection register, offset: 0x0 */
-  __IO uint8_t PMCTRL;                             /**< Power Mode Control register, offset: 0x1 */
-  __IO uint8_t STOPCTRL;                           /**< Stop Control Register, offset: 0x2 */
-  __I  uint8_t PMSTAT;                             /**< Power Mode Status register, offset: 0x3 */
-} SMC_Type;
-
-/* ----------------------------------------------------------------------------
-   -- SMC Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup SMC_Register_Masks SMC Register Masks
- * @{
- */
-
-/* PMPROT Bit Fields */
-#define SMC_PMPROT_AVLLS_MASK                    0x2u
-#define SMC_PMPROT_AVLLS_SHIFT                   1
-#define SMC_PMPROT_ALLS_MASK                     0x8u
-#define SMC_PMPROT_ALLS_SHIFT                    3
-#define SMC_PMPROT_AVLP_MASK                     0x20u
-#define SMC_PMPROT_AVLP_SHIFT                    5
-/* PMCTRL Bit Fields */
-#define SMC_PMCTRL_STOPM_MASK                    0x7u
-#define SMC_PMCTRL_STOPM_SHIFT                   0
-#define SMC_PMCTRL_STOPM(x)                      (((uint8_t)(((uint8_t)(x))<<SMC_PMCTRL_STOPM_SHIFT))&SMC_PMCTRL_STOPM_MASK)
-#define SMC_PMCTRL_STOPA_MASK                    0x8u
-#define SMC_PMCTRL_STOPA_SHIFT                   3
-#define SMC_PMCTRL_RUNM_MASK                     0x60u
-#define SMC_PMCTRL_RUNM_SHIFT                    5
-#define SMC_PMCTRL_RUNM(x)                       (((uint8_t)(((uint8_t)(x))<<SMC_PMCTRL_RUNM_SHIFT))&SMC_PMCTRL_RUNM_MASK)
-/* STOPCTRL Bit Fields */
-#define SMC_STOPCTRL_VLLSM_MASK                  0x7u
-#define SMC_STOPCTRL_VLLSM_SHIFT                 0
-#define SMC_STOPCTRL_VLLSM(x)                    (((uint8_t)(((uint8_t)(x))<<SMC_STOPCTRL_VLLSM_SHIFT))&SMC_STOPCTRL_VLLSM_MASK)
-#define SMC_STOPCTRL_PORPO_MASK                  0x20u
-#define SMC_STOPCTRL_PORPO_SHIFT                 5
-#define SMC_STOPCTRL_PSTOPO_MASK                 0xC0u
-#define SMC_STOPCTRL_PSTOPO_SHIFT                6
-#define SMC_STOPCTRL_PSTOPO(x)                   (((uint8_t)(((uint8_t)(x))<<SMC_STOPCTRL_PSTOPO_SHIFT))&SMC_STOPCTRL_PSTOPO_MASK)
-/* PMSTAT Bit Fields */
-#define SMC_PMSTAT_PMSTAT_MASK                   0x7Fu
-#define SMC_PMSTAT_PMSTAT_SHIFT                  0
-#define SMC_PMSTAT_PMSTAT(x)                     (((uint8_t)(((uint8_t)(x))<<SMC_PMSTAT_PMSTAT_SHIFT))&SMC_PMSTAT_PMSTAT_MASK)
-
-/**
- * @}
- */ /* end of group SMC_Register_Masks */
-
-
-/* SMC - Peripheral instance base addresses */
-/** Peripheral SMC base address */
-#define SMC_BASE                                 (0x4007E000u)
-/** Peripheral SMC base pointer */
-#define SMC                                      ((SMC_Type *)SMC_BASE)
-/** Array initializer of SMC peripheral base pointers */
-#define SMC_BASES                                { SMC }
-
-/**
- * @}
- */ /* end of group SMC_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- SPI Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup SPI_Peripheral_Access_Layer SPI Peripheral Access Layer
- * @{
- */
-
-/** SPI - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t C1;                                 /**< SPI control register 1, offset: 0x0 */
-  __IO uint8_t C2;                                 /**< SPI control register 2, offset: 0x1 */
-  __IO uint8_t BR;                                 /**< SPI baud rate register, offset: 0x2 */
-  __I  uint8_t S;                                  /**< SPI status register, offset: 0x3 */
-       uint8_t RESERVED_0[1];
-  __IO uint8_t D;                                  /**< SPI data register, offset: 0x5 */
-       uint8_t RESERVED_1[1];
-  __IO uint8_t M;                                  /**< SPI match register, offset: 0x7 */
-} SPI_Type;
-
-/* ----------------------------------------------------------------------------
-   -- SPI Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup SPI_Register_Masks SPI Register Masks
- * @{
- */
-
-/* C1 Bit Fields */
-#define SPI_C1_LSBFE_MASK                        0x1u
-#define SPI_C1_LSBFE_SHIFT                       0
-#define SPI_C1_SSOE_MASK                         0x2u
-#define SPI_C1_SSOE_SHIFT                        1
-#define SPI_C1_CPHA_MASK                         0x4u
-#define SPI_C1_CPHA_SHIFT                        2
-#define SPI_C1_CPOL_MASK                         0x8u
-#define SPI_C1_CPOL_SHIFT                        3
-#define SPI_C1_MSTR_MASK                         0x10u
-#define SPI_C1_MSTR_SHIFT                        4
-#define SPI_C1_SPTIE_MASK                        0x20u
-#define SPI_C1_SPTIE_SHIFT                       5
-#define SPI_C1_SPE_MASK                          0x40u
-#define SPI_C1_SPE_SHIFT                         6
-#define SPI_C1_SPIE_MASK                         0x80u
-#define SPI_C1_SPIE_SHIFT                        7
-/* C2 Bit Fields */
-#define SPI_C2_SPC0_MASK                         0x1u
-#define SPI_C2_SPC0_SHIFT                        0
-#define SPI_C2_SPISWAI_MASK                      0x2u
-#define SPI_C2_SPISWAI_SHIFT                     1
-#define SPI_C2_RXDMAE_MASK                       0x4u
-#define SPI_C2_RXDMAE_SHIFT                      2
-#define SPI_C2_BIDIROE_MASK                      0x8u
-#define SPI_C2_BIDIROE_SHIFT                     3
-#define SPI_C2_MODFEN_MASK                       0x10u
-#define SPI_C2_MODFEN_SHIFT                      4
-#define SPI_C2_TXDMAE_MASK                       0x20u
-#define SPI_C2_TXDMAE_SHIFT                      5
-#define SPI_C2_SPLPIE_MASK                       0x40u
-#define SPI_C2_SPLPIE_SHIFT                      6
-#define SPI_C2_SPMIE_MASK                        0x80u
-#define SPI_C2_SPMIE_SHIFT                       7
-/* BR Bit Fields */
-#define SPI_BR_SPR_MASK                          0xFu
-#define SPI_BR_SPR_SHIFT                         0
-#define SPI_BR_SPR(x)                            (((uint8_t)(((uint8_t)(x))<<SPI_BR_SPR_SHIFT))&SPI_BR_SPR_MASK)
-#define SPI_BR_SPPR_MASK                         0x70u
-#define SPI_BR_SPPR_SHIFT                        4
-#define SPI_BR_SPPR(x)                           (((uint8_t)(((uint8_t)(x))<<SPI_BR_SPPR_SHIFT))&SPI_BR_SPPR_MASK)
-/* S Bit Fields */
-#define SPI_S_MODF_MASK                          0x10u
-#define SPI_S_MODF_SHIFT                         4
-#define SPI_S_SPTEF_MASK                         0x20u
-#define SPI_S_SPTEF_SHIFT                        5
-#define SPI_S_SPMF_MASK                          0x40u
-#define SPI_S_SPMF_SHIFT                         6
-#define SPI_S_SPRF_MASK                          0x80u
-#define SPI_S_SPRF_SHIFT                         7
-/* D Bit Fields */
-#define SPI_D_Bits_MASK                          0xFFu
-#define SPI_D_Bits_SHIFT                         0
-#define SPI_D_Bits(x)                            (((uint8_t)(((uint8_t)(x))<<SPI_D_Bits_SHIFT))&SPI_D_Bits_MASK)
-/* M Bit Fields */
-#define SPI_M_Bits_MASK                          0xFFu
-#define SPI_M_Bits_SHIFT                         0
-#define SPI_M_Bits(x)                            (((uint8_t)(((uint8_t)(x))<<SPI_M_Bits_SHIFT))&SPI_M_Bits_MASK)
-
-/**
- * @}
- */ /* end of group SPI_Register_Masks */
-
-
-/* SPI - Peripheral instance base addresses */
-/** Peripheral SPI0 base address */
-#define SPI0_BASE                                (0x40076000u)
-/** Peripheral SPI0 base pointer */
-#define SPI0                                     ((SPI_Type *)SPI0_BASE)
-/** Peripheral SPI1 base address */
-#define SPI1_BASE                                (0x40077000u)
-/** Peripheral SPI1 base pointer */
-#define SPI1                                     ((SPI_Type *)SPI1_BASE)
-/** Array initializer of SPI peripheral base pointers */
-#define SPI_BASES                                { SPI0, SPI1 }
-
-/**
- * @}
- */ /* end of group SPI_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- TPM Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup TPM_Peripheral_Access_Layer TPM Peripheral Access Layer
- * @{
- */
-
-/** TPM - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t SC;                                /**< Status and Control, offset: 0x0 */
-  __IO uint32_t CNT;                               /**< Counter, offset: 0x4 */
-  __IO uint32_t MOD;                               /**< Modulo, offset: 0x8 */
-  struct {                                         /* offset: 0xC, array step: 0x8 */
-    __IO uint32_t CnSC;                              /**< Channel (n) Status and Control, array offset: 0xC, array step: 0x8 */
-    __IO uint32_t CnV;                               /**< Channel (n) Value, array offset: 0x10, array step: 0x8 */
-  } CONTROLS[6];
-       uint8_t RESERVED_0[20];
-  __IO uint32_t STATUS;                            /**< Capture and Compare Status, offset: 0x50 */
-       uint8_t RESERVED_1[48];
-  __IO uint32_t CONF;                              /**< Configuration, offset: 0x84 */
-} TPM_Type;
-
-/* ----------------------------------------------------------------------------
-   -- TPM Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup TPM_Register_Masks TPM Register Masks
- * @{
- */
-
-/* SC Bit Fields */
-#define TPM_SC_PS_MASK                           0x7u
-#define TPM_SC_PS_SHIFT                          0
-#define TPM_SC_PS(x)                             (((uint32_t)(((uint32_t)(x))<<TPM_SC_PS_SHIFT))&TPM_SC_PS_MASK)
-#define TPM_SC_CMOD_MASK                         0x18u
-#define TPM_SC_CMOD_SHIFT                        3
-#define TPM_SC_CMOD(x)                           (((uint32_t)(((uint32_t)(x))<<TPM_SC_CMOD_SHIFT))&TPM_SC_CMOD_MASK)
-#define TPM_SC_CPWMS_MASK                        0x20u
-#define TPM_SC_CPWMS_SHIFT                       5
-#define TPM_SC_TOIE_MASK                         0x40u
-#define TPM_SC_TOIE_SHIFT                        6
-#define TPM_SC_TOF_MASK                          0x80u
-#define TPM_SC_TOF_SHIFT                         7
-#define TPM_SC_DMA_MASK                          0x100u
-#define TPM_SC_DMA_SHIFT                         8
-/* CNT Bit Fields */
-#define TPM_CNT_COUNT_MASK                       0xFFFFu
-#define TPM_CNT_COUNT_SHIFT                      0
-#define TPM_CNT_COUNT(x)                         (((uint32_t)(((uint32_t)(x))<<TPM_CNT_COUNT_SHIFT))&TPM_CNT_COUNT_MASK)
-/* MOD Bit Fields */
-#define TPM_MOD_MOD_MASK                         0xFFFFu
-#define TPM_MOD_MOD_SHIFT                        0
-#define TPM_MOD_MOD(x)                           (((uint32_t)(((uint32_t)(x))<<TPM_MOD_MOD_SHIFT))&TPM_MOD_MOD_MASK)
-/* CnSC Bit Fields */
-#define TPM_CnSC_DMA_MASK                        0x1u
-#define TPM_CnSC_DMA_SHIFT                       0
-#define TPM_CnSC_ELSA_MASK                       0x4u
-#define TPM_CnSC_ELSA_SHIFT                      2
-#define TPM_CnSC_ELSB_MASK                       0x8u
-#define TPM_CnSC_ELSB_SHIFT                      3
-#define TPM_CnSC_MSA_MASK                        0x10u
-#define TPM_CnSC_MSA_SHIFT                       4
-#define TPM_CnSC_MSB_MASK                        0x20u
-#define TPM_CnSC_MSB_SHIFT                       5
-#define TPM_CnSC_CHIE_MASK                       0x40u
-#define TPM_CnSC_CHIE_SHIFT                      6
-#define TPM_CnSC_CHF_MASK                        0x80u
-#define TPM_CnSC_CHF_SHIFT                       7
-/* CnV Bit Fields */
-#define TPM_CnV_VAL_MASK                         0xFFFFu
-#define TPM_CnV_VAL_SHIFT                        0
-#define TPM_CnV_VAL(x)                           (((uint32_t)(((uint32_t)(x))<<TPM_CnV_VAL_SHIFT))&TPM_CnV_VAL_MASK)
-/* STATUS Bit Fields */
-#define TPM_STATUS_CH0F_MASK                     0x1u
-#define TPM_STATUS_CH0F_SHIFT                    0
-#define TPM_STATUS_CH1F_MASK                     0x2u
-#define TPM_STATUS_CH1F_SHIFT                    1
-#define TPM_STATUS_CH2F_MASK                     0x4u
-#define TPM_STATUS_CH2F_SHIFT                    2
-#define TPM_STATUS_CH3F_MASK                     0x8u
-#define TPM_STATUS_CH3F_SHIFT                    3
-#define TPM_STATUS_CH4F_MASK                     0x10u
-#define TPM_STATUS_CH4F_SHIFT                    4
-#define TPM_STATUS_CH5F_MASK                     0x20u
-#define TPM_STATUS_CH5F_SHIFT                    5
-#define TPM_STATUS_TOF_MASK                      0x100u
-#define TPM_STATUS_TOF_SHIFT                     8
-/* CONF Bit Fields */
-#define TPM_CONF_DOZEEN_MASK                     0x20u
-#define TPM_CONF_DOZEEN_SHIFT                    5
-#define TPM_CONF_DBGMODE_MASK                    0xC0u
-#define TPM_CONF_DBGMODE_SHIFT                   6
-#define TPM_CONF_DBGMODE(x)                      (((uint32_t)(((uint32_t)(x))<<TPM_CONF_DBGMODE_SHIFT))&TPM_CONF_DBGMODE_MASK)
-#define TPM_CONF_GTBEEN_MASK                     0x200u
-#define TPM_CONF_GTBEEN_SHIFT                    9
-#define TPM_CONF_CSOT_MASK                       0x10000u
-#define TPM_CONF_CSOT_SHIFT                      16
-#define TPM_CONF_CSOO_MASK                       0x20000u
-#define TPM_CONF_CSOO_SHIFT                      17
-#define TPM_CONF_CROT_MASK                       0x40000u
-#define TPM_CONF_CROT_SHIFT                      18
-#define TPM_CONF_TRGSEL_MASK                     0xF000000u
-#define TPM_CONF_TRGSEL_SHIFT                    24
-#define TPM_CONF_TRGSEL(x)                       (((uint32_t)(((uint32_t)(x))<<TPM_CONF_TRGSEL_SHIFT))&TPM_CONF_TRGSEL_MASK)
-
-/**
- * @}
- */ /* end of group TPM_Register_Masks */
-
-
-/* TPM - Peripheral instance base addresses */
-/** Peripheral TPM0 base address */
-#define TPM0_BASE                                (0x40038000u)
-/** Peripheral TPM0 base pointer */
-#define TPM0                                     ((TPM_Type *)TPM0_BASE)
-/** Peripheral TPM1 base address */
-#define TPM1_BASE                                (0x40039000u)
-/** Peripheral TPM1 base pointer */
-#define TPM1                                     ((TPM_Type *)TPM1_BASE)
-/** Peripheral TPM2 base address */
-#define TPM2_BASE                                (0x4003A000u)
-/** Peripheral TPM2 base pointer */
-#define TPM2                                     ((TPM_Type *)TPM2_BASE)
-/** Array initializer of TPM peripheral base pointers */
-#define TPM_BASES                                { TPM0, TPM1, TPM2 }
-
-/**
- * @}
- */ /* end of group TPM_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- TSI Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup TSI_Peripheral_Access_Layer TSI Peripheral Access Layer
- * @{
- */
-
-/** TSI - Register Layout Typedef */
-typedef struct {
-  __IO uint32_t GENCS;                             /**< TSI General Control and Status Register, offset: 0x0 */
-  __IO uint32_t DATA;                              /**< TSI DATA Register, offset: 0x4 */
-  __IO uint32_t TSHD;                              /**< TSI Threshold Register, offset: 0x8 */
-} TSI_Type;
-
-/* ----------------------------------------------------------------------------
-   -- TSI Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup TSI_Register_Masks TSI Register Masks
- * @{
- */
-
-/* GENCS Bit Fields */
-#define TSI_GENCS_CURSW_MASK                     0x2u
-#define TSI_GENCS_CURSW_SHIFT                    1
-#define TSI_GENCS_EOSF_MASK                      0x4u
-#define TSI_GENCS_EOSF_SHIFT                     2
-#define TSI_GENCS_SCNIP_MASK                     0x8u
-#define TSI_GENCS_SCNIP_SHIFT                    3
-#define TSI_GENCS_STM_MASK                       0x10u
-#define TSI_GENCS_STM_SHIFT                      4
-#define TSI_GENCS_STPE_MASK                      0x20u
-#define TSI_GENCS_STPE_SHIFT                     5
-#define TSI_GENCS_TSIIEN_MASK                    0x40u
-#define TSI_GENCS_TSIIEN_SHIFT                   6
-#define TSI_GENCS_TSIEN_MASK                     0x80u
-#define TSI_GENCS_TSIEN_SHIFT                    7
-#define TSI_GENCS_NSCN_MASK                      0x1F00u
-#define TSI_GENCS_NSCN_SHIFT                     8
-#define TSI_GENCS_NSCN(x)                        (((uint32_t)(((uint32_t)(x))<<TSI_GENCS_NSCN_SHIFT))&TSI_GENCS_NSCN_MASK)
-#define TSI_GENCS_PS_MASK                        0xE000u
-#define TSI_GENCS_PS_SHIFT                       13
-#define TSI_GENCS_PS(x)                          (((uint32_t)(((uint32_t)(x))<<TSI_GENCS_PS_SHIFT))&TSI_GENCS_PS_MASK)
-#define TSI_GENCS_EXTCHRG_MASK                   0x70000u
-#define TSI_GENCS_EXTCHRG_SHIFT                  16
-#define TSI_GENCS_EXTCHRG(x)                     (((uint32_t)(((uint32_t)(x))<<TSI_GENCS_EXTCHRG_SHIFT))&TSI_GENCS_EXTCHRG_MASK)
-#define TSI_GENCS_DVOLT_MASK                     0x180000u
-#define TSI_GENCS_DVOLT_SHIFT                    19
-#define TSI_GENCS_DVOLT(x)                       (((uint32_t)(((uint32_t)(x))<<TSI_GENCS_DVOLT_SHIFT))&TSI_GENCS_DVOLT_MASK)
-#define TSI_GENCS_REFCHRG_MASK                   0xE00000u
-#define TSI_GENCS_REFCHRG_SHIFT                  21
-#define TSI_GENCS_REFCHRG(x)                     (((uint32_t)(((uint32_t)(x))<<TSI_GENCS_REFCHRG_SHIFT))&TSI_GENCS_REFCHRG_MASK)
-#define TSI_GENCS_MODE_MASK                      0xF000000u
-#define TSI_GENCS_MODE_SHIFT                     24
-#define TSI_GENCS_MODE(x)                        (((uint32_t)(((uint32_t)(x))<<TSI_GENCS_MODE_SHIFT))&TSI_GENCS_MODE_MASK)
-#define TSI_GENCS_ESOR_MASK                      0x10000000u
-#define TSI_GENCS_ESOR_SHIFT                     28
-#define TSI_GENCS_OUTRGF_MASK                    0x80000000u
-#define TSI_GENCS_OUTRGF_SHIFT                   31
-/* DATA Bit Fields */
-#define TSI_DATA_TSICNT_MASK                     0xFFFFu
-#define TSI_DATA_TSICNT_SHIFT                    0
-#define TSI_DATA_TSICNT(x)                       (((uint32_t)(((uint32_t)(x))<<TSI_DATA_TSICNT_SHIFT))&TSI_DATA_TSICNT_MASK)
-#define TSI_DATA_SWTS_MASK                       0x400000u
-#define TSI_DATA_SWTS_SHIFT                      22
-#define TSI_DATA_DMAEN_MASK                      0x800000u
-#define TSI_DATA_DMAEN_SHIFT                     23
-#define TSI_DATA_TSICH_MASK                      0xF0000000u
-#define TSI_DATA_TSICH_SHIFT                     28
-#define TSI_DATA_TSICH(x)                        (((uint32_t)(((uint32_t)(x))<<TSI_DATA_TSICH_SHIFT))&TSI_DATA_TSICH_MASK)
-/* TSHD Bit Fields */
-#define TSI_TSHD_THRESL_MASK                     0xFFFFu
-#define TSI_TSHD_THRESL_SHIFT                    0
-#define TSI_TSHD_THRESL(x)                       (((uint32_t)(((uint32_t)(x))<<TSI_TSHD_THRESL_SHIFT))&TSI_TSHD_THRESL_MASK)
-#define TSI_TSHD_THRESH_MASK                     0xFFFF0000u
-#define TSI_TSHD_THRESH_SHIFT                    16
-#define TSI_TSHD_THRESH(x)                       (((uint32_t)(((uint32_t)(x))<<TSI_TSHD_THRESH_SHIFT))&TSI_TSHD_THRESH_MASK)
-
-/**
- * @}
- */ /* end of group TSI_Register_Masks */
-
-
-/* TSI - Peripheral instance base addresses */
-/** Peripheral TSI0 base address */
-#define TSI0_BASE                                (0x40045000u)
-/** Peripheral TSI0 base pointer */
-#define TSI0                                     ((TSI_Type *)TSI0_BASE)
-/** Array initializer of TSI peripheral base pointers */
-#define TSI_BASES                                { TSI0 }
-
-/**
- * @}
- */ /* end of group TSI_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- UART Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup UART_Peripheral_Access_Layer UART Peripheral Access Layer
- * @{
- */
-
-/** UART - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t BDH;                                /**< UART Baud Rate Register: High, offset: 0x0 */
-  __IO uint8_t BDL;                                /**< UART Baud Rate Register: Low, offset: 0x1 */
-  __IO uint8_t C1;                                 /**< UART Control Register 1, offset: 0x2 */
-  __IO uint8_t C2;                                 /**< UART Control Register 2, offset: 0x3 */
-  __I  uint8_t S1;                                 /**< UART Status Register 1, offset: 0x4 */
-  __IO uint8_t S2;                                 /**< UART Status Register 2, offset: 0x5 */
-  __IO uint8_t C3;                                 /**< UART Control Register 3, offset: 0x6 */
-  __IO uint8_t D;                                  /**< UART Data Register, offset: 0x7 */
-  __IO uint8_t C4;                                 /**< UART Control Register 4, offset: 0x8 */
-} UART_Type;
-
-/* ----------------------------------------------------------------------------
-   -- UART Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup UART_Register_Masks UART Register Masks
- * @{
- */
-
-/* BDH Bit Fields */
-#define UART_BDH_SBR_MASK                        0x1Fu
-#define UART_BDH_SBR_SHIFT                       0
-#define UART_BDH_SBR(x)                          (((uint8_t)(((uint8_t)(x))<<UART_BDH_SBR_SHIFT))&UART_BDH_SBR_MASK)
-#define UART_BDH_SBNS_MASK                       0x20u
-#define UART_BDH_SBNS_SHIFT                      5
-#define UART_BDH_RXEDGIE_MASK                    0x40u
-#define UART_BDH_RXEDGIE_SHIFT                   6
-#define UART_BDH_LBKDIE_MASK                     0x80u
-#define UART_BDH_LBKDIE_SHIFT                    7
-/* BDL Bit Fields */
-#define UART_BDL_SBR_MASK                        0xFFu
-#define UART_BDL_SBR_SHIFT                       0
-#define UART_BDL_SBR(x)                          (((uint8_t)(((uint8_t)(x))<<UART_BDL_SBR_SHIFT))&UART_BDL_SBR_MASK)
-/* C1 Bit Fields */
-#define UART_C1_PT_MASK                          0x1u
-#define UART_C1_PT_SHIFT                         0
-#define UART_C1_PE_MASK                          0x2u
-#define UART_C1_PE_SHIFT                         1
-#define UART_C1_ILT_MASK                         0x4u
-#define UART_C1_ILT_SHIFT                        2
-#define UART_C1_WAKE_MASK                        0x8u
-#define UART_C1_WAKE_SHIFT                       3
-#define UART_C1_M_MASK                           0x10u
-#define UART_C1_M_SHIFT                          4
-#define UART_C1_RSRC_MASK                        0x20u
-#define UART_C1_RSRC_SHIFT                       5
-#define UART_C1_UARTSWAI_MASK                    0x40u
-#define UART_C1_UARTSWAI_SHIFT                   6
-#define UART_C1_LOOPS_MASK                       0x80u
-#define UART_C1_LOOPS_SHIFT                      7
-/* C2 Bit Fields */
-#define UART_C2_SBK_MASK                         0x1u
-#define UART_C2_SBK_SHIFT                        0
-#define UART_C2_RWU_MASK                         0x2u
-#define UART_C2_RWU_SHIFT                        1
-#define UART_C2_RE_MASK                          0x4u
-#define UART_C2_RE_SHIFT                         2
-#define UART_C2_TE_MASK                          0x8u
-#define UART_C2_TE_SHIFT                         3
-#define UART_C2_ILIE_MASK                        0x10u
-#define UART_C2_ILIE_SHIFT                       4
-#define UART_C2_RIE_MASK                         0x20u
-#define UART_C2_RIE_SHIFT                        5
-#define UART_C2_TCIE_MASK                        0x40u
-#define UART_C2_TCIE_SHIFT                       6
-#define UART_C2_TIE_MASK                         0x80u
-#define UART_C2_TIE_SHIFT                        7
-/* S1 Bit Fields */
-#define UART_S1_PF_MASK                          0x1u
-#define UART_S1_PF_SHIFT                         0
-#define UART_S1_FE_MASK                          0x2u
-#define UART_S1_FE_SHIFT                         1
-#define UART_S1_NF_MASK                          0x4u
-#define UART_S1_NF_SHIFT                         2
-#define UART_S1_OR_MASK                          0x8u
-#define UART_S1_OR_SHIFT                         3
-#define UART_S1_IDLE_MASK                        0x10u
-#define UART_S1_IDLE_SHIFT                       4
-#define UART_S1_RDRF_MASK                        0x20u
-#define UART_S1_RDRF_SHIFT                       5
-#define UART_S1_TC_MASK                          0x40u
-#define UART_S1_TC_SHIFT                         6
-#define UART_S1_TDRE_MASK                        0x80u
-#define UART_S1_TDRE_SHIFT                       7
-/* S2 Bit Fields */
-#define UART_S2_RAF_MASK                         0x1u
-#define UART_S2_RAF_SHIFT                        0
-#define UART_S2_LBKDE_MASK                       0x2u
-#define UART_S2_LBKDE_SHIFT                      1
-#define UART_S2_BRK13_MASK                       0x4u
-#define UART_S2_BRK13_SHIFT                      2
-#define UART_S2_RWUID_MASK                       0x8u
-#define UART_S2_RWUID_SHIFT                      3
-#define UART_S2_RXINV_MASK                       0x10u
-#define UART_S2_RXINV_SHIFT                      4
-#define UART_S2_RXEDGIF_MASK                     0x40u
-#define UART_S2_RXEDGIF_SHIFT                    6
-#define UART_S2_LBKDIF_MASK                      0x80u
-#define UART_S2_LBKDIF_SHIFT                     7
-/* C3 Bit Fields */
-#define UART_C3_PEIE_MASK                        0x1u
-#define UART_C3_PEIE_SHIFT                       0
-#define UART_C3_FEIE_MASK                        0x2u
-#define UART_C3_FEIE_SHIFT                       1
-#define UART_C3_NEIE_MASK                        0x4u
-#define UART_C3_NEIE_SHIFT                       2
-#define UART_C3_ORIE_MASK                        0x8u
-#define UART_C3_ORIE_SHIFT                       3
-#define UART_C3_TXINV_MASK                       0x10u
-#define UART_C3_TXINV_SHIFT                      4
-#define UART_C3_TXDIR_MASK                       0x20u
-#define UART_C3_TXDIR_SHIFT                      5
-#define UART_C3_T8_MASK                          0x40u
-#define UART_C3_T8_SHIFT                         6
-#define UART_C3_R8_MASK                          0x80u
-#define UART_C3_R8_SHIFT                         7
-/* D Bit Fields */
-#define UART_D_R0T0_MASK                         0x1u
-#define UART_D_R0T0_SHIFT                        0
-#define UART_D_R1T1_MASK                         0x2u
-#define UART_D_R1T1_SHIFT                        1
-#define UART_D_R2T2_MASK                         0x4u
-#define UART_D_R2T2_SHIFT                        2
-#define UART_D_R3T3_MASK                         0x8u
-#define UART_D_R3T3_SHIFT                        3
-#define UART_D_R4T4_MASK                         0x10u
-#define UART_D_R4T4_SHIFT                        4
-#define UART_D_R5T5_MASK                         0x20u
-#define UART_D_R5T5_SHIFT                        5
-#define UART_D_R6T6_MASK                         0x40u
-#define UART_D_R6T6_SHIFT                        6
-#define UART_D_R7T7_MASK                         0x80u
-#define UART_D_R7T7_SHIFT                        7
-/* C4 Bit Fields */
-#define UART_C4_LBKDDMAS_MASK                    0x8u
-#define UART_C4_LBKDDMAS_SHIFT                   3
-#define UART_C4_ILDMAS_MASK                      0x10u
-#define UART_C4_ILDMAS_SHIFT                     4
-#define UART_C4_RDMAS_MASK                       0x20u
-#define UART_C4_RDMAS_SHIFT                      5
-#define UART_C4_TCDMAS_MASK                      0x40u
-#define UART_C4_TCDMAS_SHIFT                     6
-#define UART_C4_TDMAS_MASK                       0x80u
-#define UART_C4_TDMAS_SHIFT                      7
-
-/**
- * @}
- */ /* end of group UART_Register_Masks */
-
-
-/* UART - Peripheral instance base addresses */
-/** Peripheral UART1 base address */
-#define UART1_BASE                               (0x4006B000u)
-/** Peripheral UART1 base pointer */
-#define UART1                                    ((UART_Type *)UART1_BASE)
-/** Peripheral UART2 base address */
-#define UART2_BASE                               (0x4006C000u)
-/** Peripheral UART2 base pointer */
-#define UART2                                    ((UART_Type *)UART2_BASE)
-/** Array initializer of UART peripheral base pointers */
-#define UART_BASES                               { UART1, UART2 }
-
-/**
- * @}
- */ /* end of group UART_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- UARTLP Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup UARTLP_Peripheral_Access_Layer UARTLP Peripheral Access Layer
- * @{
- */
-
-/** UARTLP - Register Layout Typedef */
-typedef struct {
-  __IO uint8_t BDH;                                /**< UART Baud Rate Register High, offset: 0x0 */
-  __IO uint8_t BDL;                                /**< UART Baud Rate Register Low, offset: 0x1 */
-  __IO uint8_t C1;                                 /**< UART Control Register 1, offset: 0x2 */
-  __IO uint8_t C2;                                 /**< UART Control Register 2, offset: 0x3 */
-  __IO uint8_t S1;                                 /**< UART Status Register 1, offset: 0x4 */
-  __IO uint8_t S2;                                 /**< UART Status Register 2, offset: 0x5 */
-  __IO uint8_t C3;                                 /**< UART Control Register 3, offset: 0x6 */
-  __IO uint8_t D;                                  /**< UART Data Register, offset: 0x7 */
-  __IO uint8_t MA1;                                /**< UART Match Address Registers 1, offset: 0x8 */
-  __IO uint8_t MA2;                                /**< UART Match Address Registers 2, offset: 0x9 */
-  __IO uint8_t C4;                                 /**< UART Control Register 4, offset: 0xA */
-  __IO uint8_t C5;                                 /**< UART Control Register 5, offset: 0xB */
-} UARTLP_Type;
-
-/* ----------------------------------------------------------------------------
-   -- UARTLP Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup UARTLP_Register_Masks UARTLP Register Masks
- * @{
- */
-
-/* BDH Bit Fields */
-#define UARTLP_BDH_SBR_MASK                      0x1Fu
-#define UARTLP_BDH_SBR_SHIFT                     0
-#define UARTLP_BDH_SBR(x)                        (((uint8_t)(((uint8_t)(x))<<UARTLP_BDH_SBR_SHIFT))&UARTLP_BDH_SBR_MASK)
-#define UARTLP_BDH_SBNS_MASK                     0x20u
-#define UARTLP_BDH_SBNS_SHIFT                    5
-#define UARTLP_BDH_RXEDGIE_MASK                  0x40u
-#define UARTLP_BDH_RXEDGIE_SHIFT                 6
-#define UARTLP_BDH_LBKDIE_MASK                   0x80u
-#define UARTLP_BDH_LBKDIE_SHIFT                  7
-/* BDL Bit Fields */
-#define UARTLP_BDL_SBR_MASK                      0xFFu
-#define UARTLP_BDL_SBR_SHIFT                     0
-#define UARTLP_BDL_SBR(x)                        (((uint8_t)(((uint8_t)(x))<<UARTLP_BDL_SBR_SHIFT))&UARTLP_BDL_SBR_MASK)
-/* C1 Bit Fields */
-#define UARTLP_C1_PT_MASK                        0x1u
-#define UARTLP_C1_PT_SHIFT                       0
-#define UARTLP_C1_PE_MASK                        0x2u
-#define UARTLP_C1_PE_SHIFT                       1
-#define UARTLP_C1_ILT_MASK                       0x4u
-#define UARTLP_C1_ILT_SHIFT                      2
-#define UARTLP_C1_WAKE_MASK                      0x8u
-#define UARTLP_C1_WAKE_SHIFT                     3
-#define UARTLP_C1_M_MASK                         0x10u
-#define UARTLP_C1_M_SHIFT                        4
-#define UARTLP_C1_RSRC_MASK                      0x20u
-#define UARTLP_C1_RSRC_SHIFT                     5
-#define UARTLP_C1_DOZEEN_MASK                    0x40u
-#define UARTLP_C1_DOZEEN_SHIFT                   6
-#define UARTLP_C1_LOOPS_MASK                     0x80u
-#define UARTLP_C1_LOOPS_SHIFT                    7
-/* C2 Bit Fields */
-#define UARTLP_C2_SBK_MASK                       0x1u
-#define UARTLP_C2_SBK_SHIFT                      0
-#define UARTLP_C2_RWU_MASK                       0x2u
-#define UARTLP_C2_RWU_SHIFT                      1
-#define UARTLP_C2_RE_MASK                        0x4u
-#define UARTLP_C2_RE_SHIFT                       2
-#define UARTLP_C2_TE_MASK                        0x8u
-#define UARTLP_C2_TE_SHIFT                       3
-#define UARTLP_C2_ILIE_MASK                      0x10u
-#define UARTLP_C2_ILIE_SHIFT                     4
-#define UARTLP_C2_RIE_MASK                       0x20u
-#define UARTLP_C2_RIE_SHIFT                      5
-#define UARTLP_C2_TCIE_MASK                      0x40u
-#define UARTLP_C2_TCIE_SHIFT                     6
-#define UARTLP_C2_TIE_MASK                       0x80u
-#define UARTLP_C2_TIE_SHIFT                      7
-/* S1 Bit Fields */
-#define UARTLP_S1_PF_MASK                        0x1u
-#define UARTLP_S1_PF_SHIFT                       0
-#define UARTLP_S1_FE_MASK                        0x2u
-#define UARTLP_S1_FE_SHIFT                       1
-#define UARTLP_S1_NF_MASK                        0x4u
-#define UARTLP_S1_NF_SHIFT                       2
-#define UARTLP_S1_OR_MASK                        0x8u
-#define UARTLP_S1_OR_SHIFT                       3
-#define UARTLP_S1_IDLE_MASK                      0x10u
-#define UARTLP_S1_IDLE_SHIFT                     4
-#define UARTLP_S1_RDRF_MASK                      0x20u
-#define UARTLP_S1_RDRF_SHIFT                     5
-#define UARTLP_S1_TC_MASK                        0x40u
-#define UARTLP_S1_TC_SHIFT                       6
-#define UARTLP_S1_TDRE_MASK                      0x80u
-#define UARTLP_S1_TDRE_SHIFT                     7
-/* S2 Bit Fields */
-#define UARTLP_S2_RAF_MASK                       0x1u
-#define UARTLP_S2_RAF_SHIFT                      0
-#define UARTLP_S2_LBKDE_MASK                     0x2u
-#define UARTLP_S2_LBKDE_SHIFT                    1
-#define UARTLP_S2_BRK13_MASK                     0x4u
-#define UARTLP_S2_BRK13_SHIFT                    2
-#define UARTLP_S2_RWUID_MASK                     0x8u
-#define UARTLP_S2_RWUID_SHIFT                    3
-#define UARTLP_S2_RXINV_MASK                     0x10u
-#define UARTLP_S2_RXINV_SHIFT                    4
-#define UARTLP_S2_MSBF_MASK                      0x20u
-#define UARTLP_S2_MSBF_SHIFT                     5
-#define UARTLP_S2_RXEDGIF_MASK                   0x40u
-#define UARTLP_S2_RXEDGIF_SHIFT                  6
-#define UARTLP_S2_LBKDIF_MASK                    0x80u
-#define UARTLP_S2_LBKDIF_SHIFT                   7
-/* C3 Bit Fields */
-#define UARTLP_C3_PEIE_MASK                      0x1u
-#define UARTLP_C3_PEIE_SHIFT                     0
-#define UARTLP_C3_FEIE_MASK                      0x2u
-#define UARTLP_C3_FEIE_SHIFT                     1
-#define UARTLP_C3_NEIE_MASK                      0x4u
-#define UARTLP_C3_NEIE_SHIFT                     2
-#define UARTLP_C3_ORIE_MASK                      0x8u
-#define UARTLP_C3_ORIE_SHIFT                     3
-#define UARTLP_C3_TXINV_MASK                     0x10u
-#define UARTLP_C3_TXINV_SHIFT                    4
-#define UARTLP_C3_TXDIR_MASK                     0x20u
-#define UARTLP_C3_TXDIR_SHIFT                    5
-#define UARTLP_C3_R9T8_MASK                      0x40u
-#define UARTLP_C3_R9T8_SHIFT                     6
-#define UARTLP_C3_R8T9_MASK                      0x80u
-#define UARTLP_C3_R8T9_SHIFT                     7
-/* D Bit Fields */
-#define UARTLP_D_R0T0_MASK                       0x1u
-#define UARTLP_D_R0T0_SHIFT                      0
-#define UARTLP_D_R1T1_MASK                       0x2u
-#define UARTLP_D_R1T1_SHIFT                      1
-#define UARTLP_D_R2T2_MASK                       0x4u
-#define UARTLP_D_R2T2_SHIFT                      2
-#define UARTLP_D_R3T3_MASK                       0x8u
-#define UARTLP_D_R3T3_SHIFT                      3
-#define UARTLP_D_R4T4_MASK                       0x10u
-#define UARTLP_D_R4T4_SHIFT                      4
-#define UARTLP_D_R5T5_MASK                       0x20u
-#define UARTLP_D_R5T5_SHIFT                      5
-#define UARTLP_D_R6T6_MASK                       0x40u
-#define UARTLP_D_R6T6_SHIFT                      6
-#define UARTLP_D_R7T7_MASK                       0x80u
-#define UARTLP_D_R7T7_SHIFT                      7
-/* MA1 Bit Fields */
-#define UARTLP_MA1_MA_MASK                       0xFFu
-#define UARTLP_MA1_MA_SHIFT                      0
-#define UARTLP_MA1_MA(x)                         (((uint8_t)(((uint8_t)(x))<<UARTLP_MA1_MA_SHIFT))&UARTLP_MA1_MA_MASK)
-/* MA2 Bit Fields */
-#define UARTLP_MA2_MA_MASK                       0xFFu
-#define UARTLP_MA2_MA_SHIFT                      0
-#define UARTLP_MA2_MA(x)                         (((uint8_t)(((uint8_t)(x))<<UARTLP_MA2_MA_SHIFT))&UARTLP_MA2_MA_MASK)
-/* C4 Bit Fields */
-#define UARTLP_C4_OSR_MASK                       0x1Fu
-#define UARTLP_C4_OSR_SHIFT                      0
-#define UARTLP_C4_OSR(x)                         (((uint8_t)(((uint8_t)(x))<<UARTLP_C4_OSR_SHIFT))&UARTLP_C4_OSR_MASK)
-#define UARTLP_C4_M10_MASK                       0x20u
-#define UARTLP_C4_M10_SHIFT                      5
-#define UARTLP_C4_MAEN2_MASK                     0x40u
-#define UARTLP_C4_MAEN2_SHIFT                    6
-#define UARTLP_C4_MAEN1_MASK                     0x80u
-#define UARTLP_C4_MAEN1_SHIFT                    7
-/* C5 Bit Fields */
-#define UARTLP_C5_RESYNCDIS_MASK                 0x1u
-#define UARTLP_C5_RESYNCDIS_SHIFT                0
-#define UARTLP_C5_BOTHEDGE_MASK                  0x2u
-#define UARTLP_C5_BOTHEDGE_SHIFT                 1
-#define UARTLP_C5_RDMAE_MASK                     0x20u
-#define UARTLP_C5_RDMAE_SHIFT                    5
-#define UARTLP_C5_TDMAE_MASK                     0x80u
-#define UARTLP_C5_TDMAE_SHIFT                    7
-
-/**
- * @}
- */ /* end of group UARTLP_Register_Masks */
-
-
-/* UARTLP - Peripheral instance base addresses */
-/** Peripheral UART0 base address */
-#define UART0_BASE                               (0x4006A000u)
-/** Peripheral UART0 base pointer */
-#define UART0                                    ((UARTLP_Type *)UART0_BASE)
-/** Array initializer of UARTLP peripheral base pointers */
-#define UARTLP_BASES                             { UART0 }
-
-/**
- * @}
- */ /* end of group UARTLP_Peripheral_Access_Layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- USB Peripheral Access Layer
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup USB_Peripheral_Access_Layer USB Peripheral Access Layer
- * @{
- */
-
-/** USB - Register Layout Typedef */
-typedef struct {
-  __I  uint8_t PERID;                              /**< Peripheral ID register, offset: 0x0 */
-       uint8_t RESERVED_0[3];
-  __I  uint8_t IDCOMP;                             /**< Peripheral ID Complement register, offset: 0x4 */
-       uint8_t RESERVED_1[3];
-  __I  uint8_t REV;                                /**< Peripheral Revision register, offset: 0x8 */
-       uint8_t RESERVED_2[3];
-  __I  uint8_t ADDINFO;                            /**< Peripheral Additional Info register, offset: 0xC */
-       uint8_t RESERVED_3[3];
-  __IO uint8_t OTGISTAT;                           /**< OTG Interrupt Status register, offset: 0x10 */
-       uint8_t RESERVED_4[3];
-  __IO uint8_t OTGICR;                             /**< OTG Interrupt Control Register, offset: 0x14 */
-       uint8_t RESERVED_5[3];
-  __IO uint8_t OTGSTAT;                            /**< OTG Status register, offset: 0x18 */
-       uint8_t RESERVED_6[3];
-  __IO uint8_t OTGCTL;                             /**< OTG Control register, offset: 0x1C */
-       uint8_t RESERVED_7[99];
-  __IO uint8_t ISTAT;                              /**< Interrupt Status register, offset: 0x80 */
-       uint8_t RESERVED_8[3];
-  __IO uint8_t INTEN;                              /**< Interrupt Enable register, offset: 0x84 */
-       uint8_t RESERVED_9[3];
-  __IO uint8_t ERRSTAT;                            /**< Error Interrupt Status register, offset: 0x88 */
-       uint8_t RESERVED_10[3];
-  __IO uint8_t ERREN;                              /**< Error Interrupt Enable register, offset: 0x8C */
-       uint8_t RESERVED_11[3];
-  __I  uint8_t STAT;                               /**< Status register, offset: 0x90 */
-       uint8_t RESERVED_12[3];
-  __IO uint8_t CTL;                                /**< Control register, offset: 0x94 */
-       uint8_t RESERVED_13[3];
-  __IO uint8_t ADDR;                               /**< Address register, offset: 0x98 */
-       uint8_t RESERVED_14[3];
-  __IO uint8_t BDTPAGE1;                           /**< BDT Page Register 1, offset: 0x9C */
-       uint8_t RESERVED_15[3];
-  __IO uint8_t FRMNUML;                            /**< Frame Number Register Low, offset: 0xA0 */
-       uint8_t RESERVED_16[3];
-  __IO uint8_t FRMNUMH;                            /**< Frame Number Register High, offset: 0xA4 */
-       uint8_t RESERVED_17[3];
-  __IO uint8_t TOKEN;                              /**< Token register, offset: 0xA8 */
-       uint8_t RESERVED_18[3];
-  __IO uint8_t SOFTHLD;                            /**< SOF Threshold Register, offset: 0xAC */
-       uint8_t RESERVED_19[3];
-  __IO uint8_t BDTPAGE2;                           /**< BDT Page Register 2, offset: 0xB0 */
-       uint8_t RESERVED_20[3];
-  __IO uint8_t BDTPAGE3;                           /**< BDT Page Register 3, offset: 0xB4 */
-       uint8_t RESERVED_21[11];
-  struct {                                         /* offset: 0xC0, array step: 0x4 */
-    __IO uint8_t ENDPT;                              /**< Endpoint Control register, array offset: 0xC0, array step: 0x4 */
-         uint8_t RESERVED_0[3];
-  } ENDPOINT[16];
-  __IO uint8_t USBCTRL;                            /**< USB Control register, offset: 0x100 */
-       uint8_t RESERVED_22[3];
-  __I  uint8_t OBSERVE;                            /**< USB OTG Observe register, offset: 0x104 */
-       uint8_t RESERVED_23[3];
-  __IO uint8_t CONTROL;                            /**< USB OTG Control register, offset: 0x108 */
-       uint8_t RESERVED_24[3];
-  __IO uint8_t USBTRC0;                            /**< USB Transceiver Control Register 0, offset: 0x10C */
-} USB_Type;
-
-/* ----------------------------------------------------------------------------
-   -- USB Register Masks
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup USB_Register_Masks USB Register Masks
- * @{
- */
-
-/* PERID Bit Fields */
-#define USB_PERID_ID_MASK                        0x3Fu
-#define USB_PERID_ID_SHIFT                       0
-#define USB_PERID_ID(x)                          (((uint8_t)(((uint8_t)(x))<<USB_PERID_ID_SHIFT))&USB_PERID_ID_MASK)
-/* IDCOMP Bit Fields */
-#define USB_IDCOMP_NID_MASK                      0x3Fu
-#define USB_IDCOMP_NID_SHIFT                     0
-#define USB_IDCOMP_NID(x)                        (((uint8_t)(((uint8_t)(x))<<USB_IDCOMP_NID_SHIFT))&USB_IDCOMP_NID_MASK)
-/* REV Bit Fields */
-#define USB_REV_REV_MASK                         0xFFu
-#define USB_REV_REV_SHIFT                        0
-#define USB_REV_REV(x)                           (((uint8_t)(((uint8_t)(x))<<USB_REV_REV_SHIFT))&USB_REV_REV_MASK)
-/* ADDINFO Bit Fields */
-#define USB_ADDINFO_IEHOST_MASK                  0x1u
-#define USB_ADDINFO_IEHOST_SHIFT                 0
-#define USB_ADDINFO_IRQNUM_MASK                  0xF8u
-#define USB_ADDINFO_IRQNUM_SHIFT                 3
-#define USB_ADDINFO_IRQNUM(x)                    (((uint8_t)(((uint8_t)(x))<<USB_ADDINFO_IRQNUM_SHIFT))&USB_ADDINFO_IRQNUM_MASK)
-/* OTGISTAT Bit Fields */
-#define USB_OTGISTAT_AVBUSCHG_MASK               0x1u
-#define USB_OTGISTAT_AVBUSCHG_SHIFT              0
-#define USB_OTGISTAT_B_SESS_CHG_MASK             0x4u
-#define USB_OTGISTAT_B_SESS_CHG_SHIFT            2
-#define USB_OTGISTAT_SESSVLDCHG_MASK             0x8u
-#define USB_OTGISTAT_SESSVLDCHG_SHIFT            3
-#define USB_OTGISTAT_LINE_STATE_CHG_MASK         0x20u
-#define USB_OTGISTAT_LINE_STATE_CHG_SHIFT        5
-#define USB_OTGISTAT_ONEMSEC_MASK                0x40u
-#define USB_OTGISTAT_ONEMSEC_SHIFT               6
-#define USB_OTGISTAT_IDCHG_MASK                  0x80u
-#define USB_OTGISTAT_IDCHG_SHIFT                 7
-/* OTGICR Bit Fields */
-#define USB_OTGICR_AVBUSEN_MASK                  0x1u
-#define USB_OTGICR_AVBUSEN_SHIFT                 0
-#define USB_OTGICR_BSESSEN_MASK                  0x4u
-#define USB_OTGICR_BSESSEN_SHIFT                 2
-#define USB_OTGICR_SESSVLDEN_MASK                0x8u
-#define USB_OTGICR_SESSVLDEN_SHIFT               3
-#define USB_OTGICR_LINESTATEEN_MASK              0x20u
-#define USB_OTGICR_LINESTATEEN_SHIFT             5
-#define USB_OTGICR_ONEMSECEN_MASK                0x40u
-#define USB_OTGICR_ONEMSECEN_SHIFT               6
-#define USB_OTGICR_IDEN_MASK                     0x80u
-#define USB_OTGICR_IDEN_SHIFT                    7
-/* OTGSTAT Bit Fields */
-#define USB_OTGSTAT_AVBUSVLD_MASK                0x1u
-#define USB_OTGSTAT_AVBUSVLD_SHIFT               0
-#define USB_OTGSTAT_BSESSEND_MASK                0x4u
-#define USB_OTGSTAT_BSESSEND_SHIFT               2
-#define USB_OTGSTAT_SESS_VLD_MASK                0x8u
-#define USB_OTGSTAT_SESS_VLD_SHIFT               3
-#define USB_OTGSTAT_LINESTATESTABLE_MASK         0x20u
-#define USB_OTGSTAT_LINESTATESTABLE_SHIFT        5
-#define USB_OTGSTAT_ONEMSECEN_MASK               0x40u
-#define USB_OTGSTAT_ONEMSECEN_SHIFT              6
-#define USB_OTGSTAT_ID_MASK                      0x80u
-#define USB_OTGSTAT_ID_SHIFT                     7
-/* OTGCTL Bit Fields */
-#define USB_OTGCTL_OTGEN_MASK                    0x4u
-#define USB_OTGCTL_OTGEN_SHIFT                   2
-#define USB_OTGCTL_DMLOW_MASK                    0x10u
-#define USB_OTGCTL_DMLOW_SHIFT                   4
-#define USB_OTGCTL_DPLOW_MASK                    0x20u
-#define USB_OTGCTL_DPLOW_SHIFT                   5
-#define USB_OTGCTL_DPHIGH_MASK                   0x80u
-#define USB_OTGCTL_DPHIGH_SHIFT                  7
-/* ISTAT Bit Fields */
-#define USB_ISTAT_USBRST_MASK                    0x1u
-#define USB_ISTAT_USBRST_SHIFT                   0
-#define USB_ISTAT_ERROR_MASK                     0x2u
-#define USB_ISTAT_ERROR_SHIFT                    1
-#define USB_ISTAT_SOFTOK_MASK                    0x4u
-#define USB_ISTAT_SOFTOK_SHIFT                   2
-#define USB_ISTAT_TOKDNE_MASK                    0x8u
-#define USB_ISTAT_TOKDNE_SHIFT                   3
-#define USB_ISTAT_SLEEP_MASK                     0x10u
-#define USB_ISTAT_SLEEP_SHIFT                    4
-#define USB_ISTAT_RESUME_MASK                    0x20u
-#define USB_ISTAT_RESUME_SHIFT                   5
-#define USB_ISTAT_ATTACH_MASK                    0x40u
-#define USB_ISTAT_ATTACH_SHIFT                   6
-#define USB_ISTAT_STALL_MASK                     0x80u
-#define USB_ISTAT_STALL_SHIFT                    7
-/* INTEN Bit Fields */
-#define USB_INTEN_USBRSTEN_MASK                  0x1u
-#define USB_INTEN_USBRSTEN_SHIFT                 0
-#define USB_INTEN_ERROREN_MASK                   0x2u
-#define USB_INTEN_ERROREN_SHIFT                  1
-#define USB_INTEN_SOFTOKEN_MASK                  0x4u
-#define USB_INTEN_SOFTOKEN_SHIFT                 2
-#define USB_INTEN_TOKDNEEN_MASK                  0x8u
-#define USB_INTEN_TOKDNEEN_SHIFT                 3
-#define USB_INTEN_SLEEPEN_MASK                   0x10u
-#define USB_INTEN_SLEEPEN_SHIFT                  4
-#define USB_INTEN_RESUMEEN_MASK                  0x20u
-#define USB_INTEN_RESUMEEN_SHIFT                 5
-#define USB_INTEN_ATTACHEN_MASK                  0x40u
-#define USB_INTEN_ATTACHEN_SHIFT                 6
-#define USB_INTEN_STALLEN_MASK                   0x80u
-#define USB_INTEN_STALLEN_SHIFT                  7
-/* ERRSTAT Bit Fields */
-#define USB_ERRSTAT_PIDERR_MASK                  0x1u
-#define USB_ERRSTAT_PIDERR_SHIFT                 0
-#define USB_ERRSTAT_CRC5EOF_MASK                 0x2u
-#define USB_ERRSTAT_CRC5EOF_SHIFT                1
-#define USB_ERRSTAT_CRC16_MASK                   0x4u
-#define USB_ERRSTAT_CRC16_SHIFT                  2
-#define USB_ERRSTAT_DFN8_MASK                    0x8u
-#define USB_ERRSTAT_DFN8_SHIFT                   3
-#define USB_ERRSTAT_BTOERR_MASK                  0x10u
-#define USB_ERRSTAT_BTOERR_SHIFT                 4
-#define USB_ERRSTAT_DMAERR_MASK                  0x20u
-#define USB_ERRSTAT_DMAERR_SHIFT                 5
-#define USB_ERRSTAT_BTSERR_MASK                  0x80u
-#define USB_ERRSTAT_BTSERR_SHIFT                 7
-/* ERREN Bit Fields */
-#define USB_ERREN_PIDERREN_MASK                  0x1u
-#define USB_ERREN_PIDERREN_SHIFT                 0
-#define USB_ERREN_CRC5EOFEN_MASK                 0x2u
-#define USB_ERREN_CRC5EOFEN_SHIFT                1
-#define USB_ERREN_CRC16EN_MASK                   0x4u
-#define USB_ERREN_CRC16EN_SHIFT                  2
-#define USB_ERREN_DFN8EN_MASK                    0x8u
-#define USB_ERREN_DFN8EN_SHIFT                   3
-#define USB_ERREN_BTOERREN_MASK                  0x10u
-#define USB_ERREN_BTOERREN_SHIFT                 4
-#define USB_ERREN_DMAERREN_MASK                  0x20u
-#define USB_ERREN_DMAERREN_SHIFT                 5
-#define USB_ERREN_BTSERREN_MASK                  0x80u
-#define USB_ERREN_BTSERREN_SHIFT                 7
-/* STAT Bit Fields */
-#define USB_STAT_ODD_MASK                        0x4u
-#define USB_STAT_ODD_SHIFT                       2
-#define USB_STAT_TX_MASK                         0x8u
-#define USB_STAT_TX_SHIFT                        3
-#define USB_STAT_ENDP_MASK                       0xF0u
-#define USB_STAT_ENDP_SHIFT                      4
-#define USB_STAT_ENDP(x)                         (((uint8_t)(((uint8_t)(x))<<USB_STAT_ENDP_SHIFT))&USB_STAT_ENDP_MASK)
-/* CTL Bit Fields */
-#define USB_CTL_USBENSOFEN_MASK                  0x1u
-#define USB_CTL_USBENSOFEN_SHIFT                 0
-#define USB_CTL_ODDRST_MASK                      0x2u
-#define USB_CTL_ODDRST_SHIFT                     1
-#define USB_CTL_RESUME_MASK                      0x4u
-#define USB_CTL_RESUME_SHIFT                     2
-#define USB_CTL_HOSTMODEEN_MASK                  0x8u
-#define USB_CTL_HOSTMODEEN_SHIFT                 3
-#define USB_CTL_RESET_MASK                       0x10u
-#define USB_CTL_RESET_SHIFT                      4
-#define USB_CTL_TXSUSPENDTOKENBUSY_MASK          0x20u
-#define USB_CTL_TXSUSPENDTOKENBUSY_SHIFT         5
-#define USB_CTL_SE0_MASK                         0x40u
-#define USB_CTL_SE0_SHIFT                        6
-#define USB_CTL_JSTATE_MASK                      0x80u
-#define USB_CTL_JSTATE_SHIFT                     7
-/* ADDR Bit Fields */
-#define USB_ADDR_ADDR_MASK                       0x7Fu
-#define USB_ADDR_ADDR_SHIFT                      0
-#define USB_ADDR_ADDR(x)                         (((uint8_t)(((uint8_t)(x))<<USB_ADDR_ADDR_SHIFT))&USB_ADDR_ADDR_MASK)
-#define USB_ADDR_LSEN_MASK                       0x80u
-#define USB_ADDR_LSEN_SHIFT                      7
-/* BDTPAGE1 Bit Fields */
-#define USB_BDTPAGE1_BDTBA_MASK                  0xFEu
-#define USB_BDTPAGE1_BDTBA_SHIFT                 1
-#define USB_BDTPAGE1_BDTBA(x)                    (((uint8_t)(((uint8_t)(x))<<USB_BDTPAGE1_BDTBA_SHIFT))&USB_BDTPAGE1_BDTBA_MASK)
-/* FRMNUML Bit Fields */
-#define USB_FRMNUML_FRM_MASK                     0xFFu
-#define USB_FRMNUML_FRM_SHIFT                    0
-#define USB_FRMNUML_FRM(x)                       (((uint8_t)(((uint8_t)(x))<<USB_FRMNUML_FRM_SHIFT))&USB_FRMNUML_FRM_MASK)
-/* FRMNUMH Bit Fields */
-#define USB_FRMNUMH_FRM_MASK                     0x7u
-#define USB_FRMNUMH_FRM_SHIFT                    0
-#define USB_FRMNUMH_FRM(x)                       (((uint8_t)(((uint8_t)(x))<<USB_FRMNUMH_FRM_SHIFT))&USB_FRMNUMH_FRM_MASK)
-/* TOKEN Bit Fields */
-#define USB_TOKEN_TOKENENDPT_MASK                0xFu
-#define USB_TOKEN_TOKENENDPT_SHIFT               0
-#define USB_TOKEN_TOKENENDPT(x)                  (((uint8_t)(((uint8_t)(x))<<USB_TOKEN_TOKENENDPT_SHIFT))&USB_TOKEN_TOKENENDPT_MASK)
-#define USB_TOKEN_TOKENPID_MASK                  0xF0u
-#define USB_TOKEN_TOKENPID_SHIFT                 4
-#define USB_TOKEN_TOKENPID(x)                    (((uint8_t)(((uint8_t)(x))<<USB_TOKEN_TOKENPID_SHIFT))&USB_TOKEN_TOKENPID_MASK)
-/* SOFTHLD Bit Fields */
-#define USB_SOFTHLD_CNT_MASK                     0xFFu
-#define USB_SOFTHLD_CNT_SHIFT                    0
-#define USB_SOFTHLD_CNT(x)                       (((uint8_t)(((uint8_t)(x))<<USB_SOFTHLD_CNT_SHIFT))&USB_SOFTHLD_CNT_MASK)
-/* BDTPAGE2 Bit Fields */
-#define USB_BDTPAGE2_BDTBA_MASK                  0xFFu
-#define USB_BDTPAGE2_BDTBA_SHIFT                 0
-#define USB_BDTPAGE2_BDTBA(x)                    (((uint8_t)(((uint8_t)(x))<<USB_BDTPAGE2_BDTBA_SHIFT))&USB_BDTPAGE2_BDTBA_MASK)
-/* BDTPAGE3 Bit Fields */
-#define USB_BDTPAGE3_BDTBA_MASK                  0xFFu
-#define USB_BDTPAGE3_BDTBA_SHIFT                 0
-#define USB_BDTPAGE3_BDTBA(x)                    (((uint8_t)(((uint8_t)(x))<<USB_BDTPAGE3_BDTBA_SHIFT))&USB_BDTPAGE3_BDTBA_MASK)
-/* ENDPT Bit Fields */
-#define USB_ENDPT_EPHSHK_MASK                    0x1u
-#define USB_ENDPT_EPHSHK_SHIFT                   0
-#define USB_ENDPT_EPSTALL_MASK                   0x2u
-#define USB_ENDPT_EPSTALL_SHIFT                  1
-#define USB_ENDPT_EPTXEN_MASK                    0x4u
-#define USB_ENDPT_EPTXEN_SHIFT                   2
-#define USB_ENDPT_EPRXEN_MASK                    0x8u
-#define USB_ENDPT_EPRXEN_SHIFT                   3
-#define USB_ENDPT_EPCTLDIS_MASK                  0x10u
-#define USB_ENDPT_EPCTLDIS_SHIFT                 4
-#define USB_ENDPT_RETRYDIS_MASK                  0x40u
-#define USB_ENDPT_RETRYDIS_SHIFT                 6
-#define USB_ENDPT_HOSTWOHUB_MASK                 0x80u
-#define USB_ENDPT_HOSTWOHUB_SHIFT                7
-/* USBCTRL Bit Fields */
-#define USB_USBCTRL_PDE_MASK                     0x40u
-#define USB_USBCTRL_PDE_SHIFT                    6
-#define USB_USBCTRL_SUSP_MASK                    0x80u
-#define USB_USBCTRL_SUSP_SHIFT                   7
-/* OBSERVE Bit Fields */
-#define USB_OBSERVE_DMPD_MASK                    0x10u
-#define USB_OBSERVE_DMPD_SHIFT                   4
-#define USB_OBSERVE_DPPD_MASK                    0x40u
-#define USB_OBSERVE_DPPD_SHIFT                   6
-#define USB_OBSERVE_DPPU_MASK                    0x80u
-#define USB_OBSERVE_DPPU_SHIFT                   7
-/* CONTROL Bit Fields */
-#define USB_CONTROL_DPPULLUPNONOTG_MASK          0x10u
-#define USB_CONTROL_DPPULLUPNONOTG_SHIFT         4
-/* USBTRC0 Bit Fields */
-#define USB_USBTRC0_USB_RESUME_INT_MASK          0x1u
-#define USB_USBTRC0_USB_RESUME_INT_SHIFT         0
-#define USB_USBTRC0_SYNC_DET_MASK                0x2u
-#define USB_USBTRC0_SYNC_DET_SHIFT               1
-#define USB_USBTRC0_USBRESMEN_MASK               0x20u
-#define USB_USBTRC0_USBRESMEN_SHIFT              5
-#define USB_USBTRC0_USBRESET_MASK                0x80u
-#define USB_USBTRC0_USBRESET_SHIFT               7
-
-/**
- * @}
- */ /* end of group USB_Register_Masks */
-
-
-/* USB - Peripheral instance base addresses */
-/** Peripheral USB0 base address */
-#define USB0_BASE                                (0x40072000u)
-/** Peripheral USB0 base pointer */
-#define USB0                                     ((USB_Type *)USB0_BASE)
-/** Array initializer of USB peripheral base pointers */
-#define USB_BASES                                { USB0 }
-
-/**
- * @}
- */ /* end of group USB_Peripheral_Access_Layer */
-
-
-/*
-** End of section using anonymous unions
-*/
-
-#if defined(__ARMCC_VERSION)
-  #pragma pop
-#elif defined(__CWCC__)
-  #pragma pop
-#elif defined(__GNUC__)
-  /* leave anonymous unions enabled */
-#elif defined(__IAR_SYSTEMS_ICC__)
-  #pragma language=default
-#else
-  #error Not supported compiler type
-#endif
-
-/**
- * @}
- */ /* end of group Peripheral_access_layer */
-
-
-/* ----------------------------------------------------------------------------
-   -- Backward Compatibility
-   ---------------------------------------------------------------------------- */
-
-/**
- * @addtogroup Backward_Compatibility_Symbols Backward Compatibility
- * @{
- */
-
-/* No backward compatibility issues. */
-
-/**
- * @}
- */ /* end of group Backward_Compatibility_Symbols */
-
-
-#endif  /* #if !defined(MKL46Z4_H_) */
-
-/* MKL46Z4.h, eof. */
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL46Z/TOOLCHAIN_ARM_STD/MKL46Z4.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-
-LR_IROM1 0x00000000 0x40000  {    ; load region size_region (256k)
-  ER_IROM1 0x00000000 0x40000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  ; 8_byte_aligned(48 vect * 4 bytes) =  8_byte_aligned(0xC0) = 0xC0
-  ; 0x8000 - 0xC0 = 0x7F40
-  RW_IRAM1 0x1FFFE0C0 0x7F40 {
-   .ANY (+RW +ZI)
-  }
-}
-
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL46Z/TOOLCHAIN_ARM_STD/startup_MKL46Z4.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,332 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_MKL46Z4.s
-; * @purpose: CMSIS Cortex-M0plus Core Device Startup File for the
-; *           MKL46Z4
-; * @version: 2.0
-; * @date:    2012-12-12
-; *
-; * Copyright: 1997 - 2013 Freescale Semiconductor, Inc. All Rights Reserved.
-;*
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; *****************************************************************************/
-
-
-__initial_sp        EQU     0x20006000  ; Top of RAM
-
-                PRESERVE8
-                THUMB
-
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-                EXPORT  __Vectors_End
-                EXPORT  __Vectors_Size
-
-__Vectors       DCD     __initial_sp  ; Top of Stack
-                DCD     Reset_Handler  ; Reset Handler
-                DCD     NMI_Handler  ; NMI Handler
-                DCD     HardFault_Handler  ; Hard Fault Handler
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     SVC_Handler  ; SVCall Handler
-                DCD     0  ; Reserved
-                DCD     0  ; Reserved
-                DCD     PendSV_Handler  ; PendSV Handler
-                DCD     SysTick_Handler  ; SysTick Handler
-
-                ; External Interrupts
-                DCD     DMA0_IRQHandler  ; DMA channel 0 transfer complete/error interrupt
-                DCD     DMA1_IRQHandler  ; DMA channel 1 transfer complete/error interrupt
-                DCD     DMA2_IRQHandler  ; DMA channel 2 transfer complete/error interrupt
-                DCD     DMA3_IRQHandler  ; DMA channel 3 transfer complete/error interrupt
-                DCD     Reserved20_IRQHandler  ; Reserved interrupt 20
-                DCD     FTFA_IRQHandler  ; FTFA command complete/read collision interrupt
-                DCD     LVD_LVW_IRQHandler  ; Low Voltage Detect, Low Voltage Warning
-                DCD     LLW_IRQHandler  ; Low Leakage Wakeup
-                DCD     I2C0_IRQHandler  ; I2C0 interrupt
-                DCD     I2C1_IRQHandler  ; I2C0 interrupt 25
-                DCD     SPI0_IRQHandler  ; SPI0 interrupt
-                DCD     SPI1_IRQHandler  ; SPI1 interrupt
-                DCD     UART0_IRQHandler  ; UART0 status/error interrupt
-                DCD     UART1_IRQHandler  ; UART1 status/error interrupt
-                DCD     UART2_IRQHandler  ; UART2 status/error interrupt
-                DCD     ADC0_IRQHandler  ; ADC0 interrupt
-                DCD     CMP0_IRQHandler  ; CMP0 interrupt
-                DCD     TPM0_IRQHandler  ; TPM0 fault, overflow and channels interrupt
-                DCD     TPM1_IRQHandler  ; TPM1 fault, overflow and channels interrupt
-                DCD     TPM2_IRQHandler  ; TPM2 fault, overflow and channels interrupt
-                DCD     RTC_IRQHandler  ; RTC interrupt
-                DCD     RTC_Seconds_IRQHandler  ; RTC seconds interrupt
-                DCD     PIT_IRQHandler  ; PIT timer interrupt
-                DCD     I2S0_IRQHandler  ; I2S0 transmit interrupt
-                DCD     USB0_IRQHandler  ; USB0 interrupt
-                DCD     DAC0_IRQHandler  ; DAC0 interrupt
-                DCD     TSI0_IRQHandler  ; TSI0 interrupt
-                DCD     MCG_IRQHandler  ; MCG interrupt
-                DCD     LPTimer_IRQHandler  ; LPTimer interrupt
-                DCD     LCD_IRQHandler  ; Segment LCD Interrupt
-                DCD     PORTA_IRQHandler  ; Port A interrupt
-                DCD     PORTD_IRQHandler  ; Port D interrupt
-__Vectors_End
-
-__Vectors_Size 	EQU     __Vectors_End - __Vectors
-
-; <h> Flash Configuration
-;   <i> 16-byte flash configuration field that stores default protection settings (loaded on reset)
-;   <i> and security information that allows the MCU to restrict acces to the FTFL module.
-;   <h> Backdoor Comparison Key
-;     <o0>  Backdoor Key 0  <0x0-0xFF:2>
-;     <o1>  Backdoor Key 1  <0x0-0xFF:2>
-;     <o2>  Backdoor Key 2  <0x0-0xFF:2>
-;     <o3>  Backdoor Key 3  <0x0-0xFF:2>
-;     <o4>  Backdoor Key 4  <0x0-0xFF:2>
-;     <o5>  Backdoor Key 5  <0x0-0xFF:2>
-;     <o6>  Backdoor Key 6  <0x0-0xFF:2>
-;     <o7>  Backdoor Key 7  <0x0-0xFF:2>
-BackDoorK0      EQU     0xFF
-BackDoorK1      EQU     0xFF
-BackDoorK2      EQU     0xFF
-BackDoorK3      EQU     0xFF
-BackDoorK4      EQU     0xFF
-BackDoorK5      EQU     0xFF
-BackDoorK6      EQU     0xFF
-BackDoorK7      EQU     0xFF
-;   </h>
-;   <h> Program flash protection bytes (FPROT)
-;     <i> Each program flash region can be protected from program and erase operation by setting the associated PROT bit.
-;     <i> Each bit protects a 1/32 region of the program flash memory.
-;     <h> FPROT0
-;       <i> Program flash protection bytes
-;       <i> 1/32 - 8/32 region
-;       <o.0>   FPROT0.0
-;       <o.1>   FPROT0.1
-;       <o.2>   FPROT0.2
-;       <o.3>   FPROT0.3
-;       <o.4>   FPROT0.4
-;       <o.5>   FPROT0.5
-;       <o.6>   FPROT0.6
-;       <o.7>   FPROT0.7
-nFPROT0         EQU     0x00
-FPROT0          EQU     nFPROT0:EOR:0xFF
-;     </h>
-;     <h> FPROT1
-;       <i> Program Flash Region Protect Register 1
-;       <i> 9/32 - 16/32 region
-;       <o.0>   FPROT1.0
-;       <o.1>   FPROT1.1
-;       <o.2>   FPROT1.2
-;       <o.3>   FPROT1.3
-;       <o.4>   FPROT1.4
-;       <o.5>   FPROT1.5
-;       <o.6>   FPROT1.6
-;       <o.7>   FPROT1.7
-nFPROT1         EQU     0x00
-FPROT1          EQU     nFPROT1:EOR:0xFF
-;     </h>
-;     <h> FPROT2
-;       <i> Program Flash Region Protect Register 2
-;       <i> 17/32 - 24/32 region
-;       <o.0>   FPROT2.0
-;       <o.1>   FPROT2.1
-;       <o.2>   FPROT2.2
-;       <o.3>   FPROT2.3
-;       <o.4>   FPROT2.4
-;       <o.5>   FPROT2.5
-;       <o.6>   FPROT2.6
-;       <o.7>   FPROT2.7
-nFPROT2         EQU     0x00
-FPROT2          EQU     nFPROT2:EOR:0xFF
-;     </h>
-;     <h> FPROT3
-;       <i> Program Flash Region Protect Register 3
-;       <i> 25/32 - 32/32 region
-;       <o.0>   FPROT3.0
-;       <o.1>   FPROT3.1
-;       <o.2>   FPROT3.2
-;       <o.3>   FPROT3.3
-;       <o.4>   FPROT3.4
-;       <o.5>   FPROT3.5
-;       <o.6>   FPROT3.6
-;       <o.7>   FPROT3.7
-nFPROT3         EQU     0x00
-FPROT3          EQU     nFPROT3:EOR:0xFF
-;     </h>
-;   </h>
-;   </h>
-;   <h> Flash nonvolatile option byte (FOPT)
-;     <i> Allows the user to customize the operation of the MCU at boot time.
-;     <o.0>  LPBOOT0
-;       <0=> Core and system clock divider (OUTDIV1) is 0x7 (divide by 8) or 0x3 (divide by 4)
-;       <1=> Core and system clock divider (OUTDIV1) is 0x1 (divide by 2) or 0x0 (divide by 1)
-;     <o.4>  LPBOOT1
-;       <0=> Core and system clock divider (OUTDIV1) is 0x7 (divide by 8) or 0x1 (divide by 2)
-;       <1=> Core and system clock divider (OUTDIV1) is 0x3 (divide by 4) or 0x0 (divide by 1)
-;     <o.2>  NMI_DIS
-;       <0=> NMI interrupts are always blocked
-;       <1=> NMI pin/interrupts reset default to enabled
-;     <o.3>  RESET_PIN_CFG
-;       <0=> RESET pin is disabled following a POR and cannot be enabled as RESET function
-;       <1=> RESET pin is dedicated
-;     <o.3>  FAST_INIT
-;       <0=> Slower initialization
-;       <1=> Fast Initialization
-FOPT            EQU     0xFF
-;   </h>
-;   <h> Flash security byte (FSEC)
-;     <i> WARNING: If SEC field is configured as "MCU security status is secure" and MEEN field is configured as "Mass erase is disabled",
-;     <i> MCU's security status cannot be set back to unsecure state since Mass erase via the debugger is blocked !!!
-;     <o.0..1> SEC
-;       <2=> MCU security status is unsecure
-;       <3=> MCU security status is secure
-;         <i> Flash Security
-;         <i> This bits define the security state of the MCU.
-;     <o.2..3> FSLACC
-;       <2=> Freescale factory access denied
-;       <3=> Freescale factory access granted
-;         <i> Freescale Failure Analysis Access Code
-;         <i> This bits define the security state of the MCU.
-;     <o.4..5> MEEN
-;       <2=> Mass erase is disabled
-;       <3=> Mass erase is enabled
-;         <i> Mass Erase Enable Bits
-;         <i> Enables and disables mass erase capability of the FTFL module
-;     <o.6..7> KEYEN
-;       <2=> Backdoor key access enabled
-;       <3=> Backdoor key access disabled
-;         <i> Backdoor key Security Enable
-;         <i> These bits enable and disable backdoor key access to the FTFL module.
-FSEC            EQU     0xFE
-;   </h>
-
-                IF      :LNOT::DEF:RAM_TARGET
-                AREA    |.ARM.__at_0x400|, CODE, READONLY
-                DCB     BackDoorK0, BackDoorK1, BackDoorK2, BackDoorK3
-                DCB     BackDoorK4, BackDoorK5, BackDoorK6, BackDoorK7
-                DCB     FPROT0,     FPROT1,     FPROT2,     FPROT3
-                DCB     FSEC,       FOPT,       0xFF,     0xFF
-                ENDIF
-
-                AREA    |.text|, CODE, READONLY
-
-
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-
-; Dummy Exception Handlers (infinite loops which can be modified)
-
-NMI_Handler     PROC
-                EXPORT  NMI_Handler               [WEAK]
-                B       .
-                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-                EXPORT  DMA0_IRQHandler     [WEAK]
-                EXPORT  DMA1_IRQHandler     [WEAK]
-                EXPORT  DMA2_IRQHandler     [WEAK]
-                EXPORT  DMA3_IRQHandler     [WEAK]
-                EXPORT  Reserved20_IRQHandler     [WEAK]
-                EXPORT  FTFA_IRQHandler     [WEAK]
-                EXPORT  LVD_LVW_IRQHandler     [WEAK]
-                EXPORT  LLW_IRQHandler     [WEAK]
-                EXPORT  I2C0_IRQHandler     [WEAK]
-                EXPORT  I2C1_IRQHandler     [WEAK]
-                EXPORT  SPI0_IRQHandler     [WEAK]
-                EXPORT  SPI1_IRQHandler     [WEAK]
-                EXPORT  UART0_IRQHandler     [WEAK]
-                EXPORT  UART1_IRQHandler     [WEAK]
-                EXPORT  UART2_IRQHandler     [WEAK]
-                EXPORT  ADC0_IRQHandler     [WEAK]
-                EXPORT  CMP0_IRQHandler     [WEAK]
-                EXPORT  TPM0_IRQHandler     [WEAK]
-                EXPORT  TPM1_IRQHandler     [WEAK]
-                EXPORT  TPM2_IRQHandler     [WEAK]
-                EXPORT  RTC_IRQHandler     [WEAK]
-                EXPORT  RTC_Seconds_IRQHandler     [WEAK]
-                EXPORT  PIT_IRQHandler     [WEAK]
-                EXPORT  I2S0_IRQHandler     [WEAK]
-                EXPORT  USB0_IRQHandler     [WEAK]
-                EXPORT  DAC0_IRQHandler     [WEAK]
-                EXPORT  TSI0_IRQHandler     [WEAK]
-                EXPORT  MCG_IRQHandler     [WEAK]
-                EXPORT  LPTimer_IRQHandler     [WEAK]
-                EXPORT  LCD_IRQHandler     [WEAK]
-                EXPORT  PORTA_IRQHandler     [WEAK]
-                EXPORT  PORTD_IRQHandler     [WEAK]
-                EXPORT  DefaultISR                      [WEAK]
-
-DMA0_IRQHandler
-DMA1_IRQHandler
-DMA2_IRQHandler
-DMA3_IRQHandler
-Reserved20_IRQHandler
-FTFA_IRQHandler
-LVD_LVW_IRQHandler
-LLW_IRQHandler
-I2C0_IRQHandler
-I2C1_IRQHandler
-SPI0_IRQHandler
-SPI1_IRQHandler
-UART0_IRQHandler
-UART1_IRQHandler
-UART2_IRQHandler
-ADC0_IRQHandler
-CMP0_IRQHandler
-TPM0_IRQHandler
-TPM1_IRQHandler
-TPM2_IRQHandler
-RTC_IRQHandler
-RTC_Seconds_IRQHandler
-PIT_IRQHandler
-I2S0_IRQHandler
-USB0_IRQHandler
-DAC0_IRQHandler
-TSI0_IRQHandler
-MCG_IRQHandler
-LPTimer_IRQHandler
-LCD_IRQHandler
-PORTA_IRQHandler
-PORTD_IRQHandler
-DefaultISR
-
-                B       .
-
-                ENDP
-
-
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL46Z/TOOLCHAIN_ARM_STD/sys.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library - stackheap
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * Setup a fixed single stack/heap memory model, 
- *  between the top of the RW/ZI region and the stackpointer
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-#include <rt_misc.h>
-#include <stdint.h>
-
-extern char Image$$RW_IRAM1$$ZI$$Limit[];
-
-extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
-    uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
-    uint32_t sp_limit = __current_sp();
-
-    zi_limit = (zi_limit + 7) & ~0x7;    // ensure zi_limit is 8-byte aligned
-
-    struct __initial_stackheap r;
-    r.heap_base = zi_limit;
-    r.heap_limit = sp_limit;
-    return r;
-}
-
-#ifdef __cplusplus
-}
-#endif 
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL46Z/TOOLCHAIN_GCC_ARM/MKL46Z4.ld	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +0,0 @@
-/*
- * KL46Z ARM GCC linker script file
- */
-
-MEMORY
-{
-  VECTORS (rx) : ORIGIN = 0x00000000, LENGTH = 0x00000400
-  FLASH_PROTECTION (rx) : ORIGIN = 0x00000400, LENGTH = 0x00000010
-  FLASH (rx) : ORIGIN = 0x00000410, LENGTH = 256K - 0x00000410
-  RAM (rwx) : ORIGIN = 0x1FFFE0C0, LENGTH = 32K - 0xC0
-}
-
-/* Linker script to place sections and symbol values. Should be used together
- * with other linker script that defines memory regions FLASH and RAM.
- * It references following symbols, which must be defined in code:
- * _reset_init : Entry of reset handler
- *
- * It defines following symbols, which code can use without definition:
- * __exidx_start
- * __exidx_end
- * __etext
- * __data_start__
- * __preinit_array_start
- * __preinit_array_end
- * __init_array_start
- * __init_array_end
- * __fini_array_start
- * __fini_array_end
- * __data_end__
- * __bss_start__
- * __bss_end__
- * __end__
- * end
- * __HeapLimit
- * __StackLimit
- * __StackTop
- * __stack
- */
-ENTRY(Reset_Handler)
-
-SECTIONS
-{
-    .isr_vector :
-    {
-        __vector_table = .;
-        KEEP(*(.vector_table))
-        *(.text.Reset_Handler)
-        *(.text.System_Init)
-         . = ALIGN(4);
-    } > VECTORS
-
-    .flash_protect :
-    {
-        KEEP(*(.kinetis_flash_config_field))
-         . = ALIGN(4);
-    } > FLASH_PROTECTION
-
-    .text :
-    {
-        *(.text*)
-
-        KEEP(*(.init))
-        KEEP(*(.fini))
-
-        /* .ctors */
-        *crtbegin.o(.ctors)
-        *crtbegin?.o(.ctors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
-        *(SORT(.ctors.*))
-        *(.ctors)
-
-        /* .dtors */
-        *crtbegin.o(.dtors)
-        *crtbegin?.o(.dtors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
-        *(SORT(.dtors.*))
-        *(.dtors)
-
-        *(.rodata*)
-
-        KEEP(*(.eh_frame*))
-    } > FLASH
-
-    .ARM.extab :
-    {
-        *(.ARM.extab* .gnu.linkonce.armextab.*)
-    } > FLASH
-
-    __exidx_start = .;
-    .ARM.exidx :
-    {
-        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-    } > FLASH
-    __exidx_end = .;
-
-    __etext = .;
-
-    .data : AT (__etext)
-    {
-        __data_start__ = .;
-        *(vtable)
-        *(.data*)
-
-        . = ALIGN(4);
-        /* preinit data */
-        PROVIDE_HIDDEN (__preinit_array_start = .);
-        KEEP(*(.preinit_array))
-        PROVIDE_HIDDEN (__preinit_array_end = .);
-
-        . = ALIGN(4);
-        /* init data */
-        PROVIDE_HIDDEN (__init_array_start = .);
-        KEEP(*(SORT(.init_array.*)))
-        KEEP(*(.init_array))
-        PROVIDE_HIDDEN (__init_array_end = .);
-
-
-        . = ALIGN(4);
-        /* finit data */
-        PROVIDE_HIDDEN (__fini_array_start = .);
-        KEEP(*(SORT(.fini_array.*)))
-        KEEP(*(.fini_array))
-        PROVIDE_HIDDEN (__fini_array_end = .);
-
-        . = ALIGN(4);
-        /* All data end */
-        __data_end__ = .;
-
-    } > RAM
-
-    .bss :
-    {
-        __bss_start__ = .;
-        *(.bss*)
-        *(COMMON)
-        __bss_end__ = .;
-    } > RAM
-
-    .heap :
-    {
-        __end__ = .;
-        end = __end__;
-        *(.heap*)
-        __HeapLimit = .;
-    } > RAM
-
-    /* .stack_dummy section doesn't contains any symbols. It is only
-     * used for linker to calculate size of stack sections, and assign
-     * values to stack symbols later */
-    .stack_dummy :
-    {
-        *(.stack)
-    } > RAM
-
-    /* Set stack top to end of RAM, and stack limit move down by
-     * size of stack_dummy section */
-    __StackTop = ORIGIN(RAM) + LENGTH(RAM);
-    __StackLimit = __StackTop - SIZEOF(.stack_dummy);
-    PROVIDE(__stack = __StackTop);
-
-    /* Check if data + heap + stack exceeds RAM limit */
-    ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
-}
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL46Z/TOOLCHAIN_GCC_ARM/startup_MKL46Z4.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,240 +0,0 @@
-/* KL25Z startup ARM GCC
- * Purpose: startup file for Cortex-M0 devices. Should use with
- *   GCC for ARM Embedded Processors
- * Version: V1.2
- * Date: 15 Nov 2011
- *
- * Copyright (c) 2011, 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 the ARM Limited 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 ARM LIMITED 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.
- */
-    .syntax unified
-    .arch armv6-m
-
-/* Memory Model
-   The HEAP starts at the end of the DATA section and grows upward.
-
-   The STACK starts at the end of the RAM and grows downward.
-
-   The HEAP and stack STACK are only checked at compile time:
-   (DATA_SIZE + HEAP_SIZE + STACK_SIZE) < RAM_SIZE
-
-   This is just a check for the bare minimum for the Heap+Stack area before
-   aborting compilation, it is not the run time limit:
-   Heap_Size + Stack_Size = 0x80 + 0x80 = 0x100
- */
-    .section .stack
-    .align 3
-#ifdef __STACK_SIZE
-    .equ    Stack_Size, __STACK_SIZE
-#else
-    .equ    Stack_Size, 0x400
-#endif
-    .globl    __StackTop
-    .globl    __StackLimit
-__StackLimit:
-    .space    Stack_Size
-    .size __StackLimit, . - __StackLimit
-__StackTop:
-    .size __StackTop, . - __StackTop
-
-    .section .heap
-    .align 3
-#ifdef __HEAP_SIZE
-    .equ    Heap_Size, __HEAP_SIZE
-#else
-    .equ    Heap_Size, 0x80
-#endif
-    .globl    __HeapBase
-    .globl    __HeapLimit
-__HeapBase:
-    .space    Heap_Size
-    .size __HeapBase, . - __HeapBase
-__HeapLimit:
-    .size __HeapLimit, . - __HeapLimit
-
-    .section .vector_table,"a",%progbits
-    .align 2
-    .globl __isr_vector
-__isr_vector:
-    .long    __StackTop            /* Top of Stack */
-    .long    Reset_Handler         /* Reset Handler */
-    .long    NMI_Handler           /* NMI Handler */
-    .long    HardFault_Handler     /* Hard Fault Handler */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    SVC_Handler           /* SVCall Handler */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    PendSV_Handler        /* PendSV Handler */
-    .long    SysTick_Handler       /* SysTick Handler */
-
-    /* External interrupts */
-    .long   DMA0_IRQHandler         /* DMA channel 0 transfer complete interrupt */
-    .long   DMA1_IRQHandler         /* DMA channel 1 transfer complete interrupt */
-    .long   DMA2_IRQHandler         /* DMA channel 2 transfer complete interrupt */
-    .long   DMA3_IRQHandler         /* DMA channel 3 transfer complete interrupt */
-    .long   Default_Handler         /* Reserved interrupt 20 */
-    .long   FTFA_IRQHandler         /* FTFA interrupt */
-    .long   LVD_LVW_IRQHandler      /* Low Voltage Detect, Low Voltage Warning */
-    .long   LLW_IRQHandler          /* Low Leakage Wakeup */
-    .long   I2C0_IRQHandler         /* I2C0 interrupt */
-    .long   I2C1_IRQHandler         /* I2C0 interrupt 25 */
-    .long   SPI0_IRQHandler         /* SPI0 interrupt */
-    .long   SPI1_IRQHandler         /* SPI1 interrupt */
-    .long   UART0_IRQHandler        /* UART0 status/error interrupt */
-    .long   UART1_IRQHandler        /* UART1 status/error interrupt */
-    .long   UART2_IRQHandler        /* UART2 status/error interrupt */
-    .long   ADC0_IRQHandler         /* ADC0 interrupt */
-    .long   CMP0_IRQHandler         /* CMP0 interrupt */
-    .long   TPM0_IRQHandler         /* TPM0 fault, overflow and channels interrupt */
-    .long   TPM1_IRQHandler         /* TPM1 fault, overflow and channels interrupt */
-    .long   TPM2_IRQHandler         /* TPM2 fault, overflow and channels interrupt */
-    .long   RTC_IRQHandler          /* RTC interrupt */
-    .long   RTC_Seconds_IRQHandler  /* RTC seconds interrupt */
-    .long   PIT_IRQHandler          /* PIT timer interrupt */
-    .long   I2S_IRQHandler          /* I2S transmit interrupt */
-    .long   USB0_IRQHandler         /* USB0 interrupt */
-    .long   DAC0_IRQHandler         /* DAC interrupt */
-    .long   TSI0_IRQHandler         /* TSI0 interrupt */
-    .long   MCG_IRQHandler          /* MCG interrupt */
-    .long   LPTimer_IRQHandler      /* LPTimer interrupt */
-    .long   LCD_IRQHandler          /* Segment LCD Interrupt*/
-    .long   PORTA_IRQHandler        /* Port A interrupt */
-    .long   PORTD_IRQHandler        /* Port D interrupt */
-
-    .size    __isr_vector, . - __isr_vector
-
-    .section .text.Reset_Handler
-    .thumb
-    .thumb_func
-    .align 2
-    .globl    Reset_Handler
-    .type    Reset_Handler, %function
-Reset_Handler:
-/*     Loop to copy data from read only memory to RAM. The ranges
- *      of copy from/to are specified by following symbols evaluated in
- *      linker script.
- *      __etext: End of code section, i.e., begin of data sections to copy from.
- *      __data_start__/__data_end__: RAM address range that data should be
- *      copied to. Both must be aligned to 4 bytes boundary.  */
-
-    ldr    r1, =__etext
-    ldr    r2, =__data_start__
-    ldr    r3, =__data_end__
-
-    subs    r3, r2
-    ble    .flash_to_ram_loop_end
-
-    movs    r4, 0
-.flash_to_ram_loop:
-    ldr    r0, [r1,r4]
-    str    r0, [r2,r4]
-    adds    r4, 4
-    cmp    r4, r3
-    blt    .flash_to_ram_loop
-.flash_to_ram_loop_end:
-
-    ldr    r0, =SystemInit
-    blx    r0
-    ldr    r0, =_start
-    bx    r0
-    .pool
-    .size Reset_Handler, . - Reset_Handler
-
-    .text
-/*    Macro to define default handlers. Default handler
- *    will be weak symbol and just dead loops. They can be
- *    overwritten by other handlers */
-    .macro    def_default_handler    handler_name
-    .align 1
-    .thumb_func
-    .weak    \handler_name
-    .type    \handler_name, %function
-\handler_name :
-    b    .
-    .size    \handler_name, . - \handler_name
-    .endm
-
-    def_default_handler     NMI_Handler
-    def_default_handler     HardFault_Handler
-    def_default_handler     SVC_Handler
-    def_default_handler     PendSV_Handler
-    def_default_handler     SysTick_Handler
-    def_default_handler     Default_Handler
-
-    def_default_handler     DMA0_IRQHandler
-    def_default_handler     DMA1_IRQHandler
-    def_default_handler     DMA2_IRQHandler
-    def_default_handler     DMA3_IRQHandler
-    def_default_handler     FTFA_IRQHandler
-    def_default_handler     LVD_LVW_IRQHandler
-    def_default_handler     LLW_IRQHandler
-    def_default_handler     I2C0_IRQHandler
-    def_default_handler     I2C1_IRQHandler
-    def_default_handler     SPI0_IRQHandler
-    def_default_handler     SPI1_IRQHandler
-    def_default_handler     UART0_IRQHandler
-    def_default_handler     UART1_IRQHandler
-    def_default_handler     UART2_IRQHandler
-    def_default_handler     ADC0_IRQHandler
-    def_default_handler     CMP0_IRQHandler
-    def_default_handler     TPM0_IRQHandler
-    def_default_handler     TPM1_IRQHandler
-    def_default_handler     TPM2_IRQHandler
-    def_default_handler     RTC_IRQHandler
-    def_default_handler     RTC_Seconds_IRQHandler
-    def_default_handler     PIT_IRQHandler
-    def_default_handler     I2S_IRQHandler
-    def_default_handler     USB0_IRQHandler
-    def_default_handler     DAC0_IRQHandler
-    def_default_handler     TSI0_IRQHandler
-    def_default_handler     MCG_IRQHandler
-    def_default_handler     LPTimer_IRQHandler
-    def_default_handler     LCD_IRQHandler
-    def_default_handler     PORTA_IRQHandler
-    def_default_handler     PORTD_IRQHandler
-   
-
-
-    .weak   DEF_IRQHandler
-    .set    DEF_IRQHandler, Default_Handler
-
-/* Flash protection region, placed at 0x400 */
-    .text
-    .thumb
-    .align 2
-    .section .kinetis_flash_config_field,"a",%progbits
-kinetis_flash_config:
-    .long 0xffffffff
-    .long 0xffffffff
-    .long 0xffffffff
-    .long 0xfffffffe
-
-    .end
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL46Z/cmsis.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-/* mbed Microcontroller Library - CMSIS
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * A generic CMSIS include header, pulling in LPC11U24 specifics
- */
-
-#ifndef MBED_CMSIS_H
-#define MBED_CMSIS_H
-
-#include "MKL46Z4.h"
-#include "cmsis_nvic.h"
-
-#endif
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL46Z/cmsis_nvic.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic for LPC11U24
- * Copyright (c) 2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */
-#include "cmsis_nvic.h"
-
-#define NVIC_RAM_VECTOR_ADDRESS (0x1FFFE000)  // Vectors positioned at start of RAM
-#define NVIC_FLASH_VECTOR_ADDRESS (0x0)       // Initial vector position in flash
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
-    uint32_t *vectors = (uint32_t*)SCB->VTOR;
-    uint32_t i;
-
-    // Copy and switch to dynamic vectors if the first time called
-    if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
-        uint32_t *old_vectors = vectors;
-        vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
-        for (i=0; i<NVIC_NUM_VECTORS; i++) {
-            vectors[i] = old_vectors[i];
-        }
-        SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
-    }
-    vectors[IRQn + 16] = vector;
-}
-
-uint32_t NVIC_GetVector(IRQn_Type IRQn) {
-    uint32_t *vectors = (uint32_t*)SCB->VTOR;
-    return vectors[IRQn + 16];
-}
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL46Z/cmsis_nvic.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */ 
-
-#ifndef MBED_CMSIS_NVIC_H
-#define MBED_CMSIS_NVIC_H
-
-#define NVIC_NUM_VECTORS      (16 + 32)   // CORE + MCU Peripherals
-#define NVIC_USER_IRQ_OFFSET  16
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
-uint32_t NVIC_GetVector(IRQn_Type IRQn);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL46Z/system_MKL46Z4.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,263 +0,0 @@
-/*
-** ###################################################################
-**     Processor:           MKL46Z128VLK4
-**     Compilers:           ARM Compiler
-**                          Freescale C/C++ for Embedded ARM
-**                          GNU C Compiler
-**                          IAR ANSI C/C++ Compiler for ARM
-**
-**     Reference manual:    KL25RM, Rev.1, Jun 2012
-**     Version:             rev. 1.1, 2012-06-21
-**
-**     Abstract:
-**         Provides a system configuration function and a global variable that
-**         contains the system frequency. It configures the device and initializes
-**         the oscillator (PLL) that is part of the microcontroller device.
-**
-**     Copyright: 2012 Freescale Semiconductor, Inc. All Rights Reserved.
-**
-**     http:                 www.freescale.com
-**     mail:                 support@freescale.com
-**
-**     Revisions:
-**     - rev. 1.0 (2012-06-13)
-**         Initial version.
-**     - rev. 1.1 (2012-06-21)
-**         Update according to reference manual rev. 1.
-**
-** ###################################################################
-*/
-
-/**
- * @file MKL46Z4
- * @version 1.1
- * @date 2012-06-21
- * @brief Device specific configuration file for MKL46Z4 (implementation file)
- *
- * Provides a system configuration function and a global variable that contains
- * the system frequency. It configures the device and initializes the oscillator
- * (PLL) that is part of the microcontroller device.
- */
-
-#include <stdint.h>
-#include "MKL46Z4.h"
-
-#define DISABLE_WDOG    1
-
-#define CLOCK_SETUP     1
-/* Predefined clock setups
-   0 ... Multipurpose Clock Generator (MCG) in FLL Engaged Internal (FEI) mode
-         Reference clock source for MCG module is the slow internal clock source 32.768kHz
-         Core clock = 41.94MHz, BusClock = 13.98MHz
-   1 ... Multipurpose Clock Generator (MCG) in PLL Engaged External (PEE) mode
-         Reference clock source for MCG module is an external crystal 8MHz
-         Core clock = 48MHz, BusClock = 24MHz
-   2 ... Multipurpose Clock Generator (MCG) in Bypassed Low Power External (BLPE) mode
-         Core clock/Bus clock derived directly from an external crystal 8MHz with no multiplication
-         Core clock = 8MHz, BusClock = 8MHz
-*/
-
-/*----------------------------------------------------------------------------
-  Define clock source values
- *----------------------------------------------------------------------------*/
-#if (CLOCK_SETUP == 0)
-    #define CPU_XTAL_CLK_HZ                 8000000u /* Value of the external crystal or oscillator clock frequency in Hz */
-    #define CPU_INT_SLOW_CLK_HZ             32768u   /* Value of the slow internal oscillator clock frequency in Hz  */
-    #define CPU_INT_FAST_CLK_HZ             4000000u /* Value of the fast internal oscillator clock frequency in Hz  */
-    #define DEFAULT_SYSTEM_CLOCK            41943040u /* Default System clock value */
-#elif (CLOCK_SETUP == 1)
-    #define CPU_XTAL_CLK_HZ                 8000000u /* Value of the external crystal or oscillator clock frequency in Hz */
-    #define CPU_INT_SLOW_CLK_HZ             32768u   /* Value of the slow internal oscillator clock frequency in Hz  */
-    #define CPU_INT_FAST_CLK_HZ             4000000u /* Value of the fast internal oscillator clock frequency in Hz  */
-    #define DEFAULT_SYSTEM_CLOCK            48000000u /* Default System clock value */
-#elif (CLOCK_SETUP == 2)
-    #define CPU_XTAL_CLK_HZ                 8000000u /* Value of the external crystal or oscillator clock frequency in Hz */
-    #define CPU_INT_SLOW_CLK_HZ             32768u   /* Value of the slow internal oscillator clock frequency in Hz  */
-    #define CPU_INT_FAST_CLK_HZ             4000000u /* Value of the fast internal oscillator clock frequency in Hz  */
-    #define DEFAULT_SYSTEM_CLOCK            8000000u /* Default System clock value */
-#endif /* (CLOCK_SETUP == 2) */
-
-
-/* ----------------------------------------------------------------------------
-   -- Core clock
-   ---------------------------------------------------------------------------- */
-
-uint32_t SystemCoreClock = DEFAULT_SYSTEM_CLOCK;
-
-/* ----------------------------------------------------------------------------
-   -- SystemInit()
-   ---------------------------------------------------------------------------- */
-
-void SystemInit (void) {
-#if (DISABLE_WDOG)
-  /* Disable the WDOG module */
-  /* SIM_COPC: COPT=0,COPCLKS=0,COPW=0 */
-  SIM->COPC = (uint32_t)0x00u;
-#endif /* (DISABLE_WDOG) */
-#if (CLOCK_SETUP == 0)
-  /* SIM->CLKDIV1: OUTDIV1=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,OUTDIV4=2,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0 */
-  SIM->CLKDIV1 = (uint32_t)0x00020000UL; /* Update system prescalers */
-  /* Switch to FEI Mode */
-  /* MCG->C1: CLKS=0,FRDIV=0,IREFS=1,IRCLKEN=1,IREFSTEN=0 */
-  MCG->C1 = (uint8_t)0x06U;
-  /* MCG_C2: LOCRE0=0,??=0,RANGE0=0,HGO0=0,EREFS0=0,LP=0,IRCS=0 */
-  MCG->C2 = (uint8_t)0x00U;
-  /* MCG->C4: DMX32=0,DRST_DRS=1 */
-  MCG->C4 = (uint8_t)((MCG->C4 & (uint8_t)~(uint8_t)0xC0U) | (uint8_t)0x20U);
-  /* OSC0->CR: ERCLKEN=1,??=0,EREFSTEN=0,??=0,SC2P=0,SC4P=0,SC8P=0,SC16P=0 */
-  OSC0->CR = (uint8_t)0x80U;
-  /* MCG->C5: ??=0,PLLCLKEN0=0,PLLSTEN0=0,PRDIV0=0 */
-  MCG->C5 = (uint8_t)0x00U;
-  /* MCG->C6: LOLIE0=0,PLLS=0,CME0=0,VDIV0=0 */
-  MCG->C6 = (uint8_t)0x00U;
-  while((MCG->S & MCG_S_IREFST_MASK) == 0x00U) { /* Check that the source of the FLL reference clock is the internal reference clock. */
-  }
-  while((MCG->S & 0x0CU) != 0x00U) {    /* Wait until output of the FLL is selected */
-  }
-#elif (CLOCK_SETUP == 1)
-  /* SIM->SCGC5: PORTA=1 */
-  SIM->SCGC5 |= (uint32_t)0x0200UL;     /* Enable clock gate for ports to enable pin routing */
-  /* SIM->CLKDIV1: OUTDIV1=1,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,OUTDIV4=1,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0 */
-  SIM->CLKDIV1 = (uint32_t)0x10010000UL; /* Update system prescalers */
-  /* PORTA->PCR18: ISF=0,MUX=0 */
-  PORTA->PCR[18] &= (uint32_t)~0x01000700UL;
-  /* PORTA->PCR19: ISF=0,MUX=0 */
-  PORTA->PCR[19] &= (uint32_t)~0x01000700UL;
-  /* Switch to FBE Mode */
-  /* OSC0->CR: ERCLKEN=1,??=0,EREFSTEN=0,??=0,SC2P=1,SC4P=0,SC8P=0,SC16P=1 */
-  OSC0->CR = (uint8_t)0x89U;
-  /* MCG->C2: LOCRE0=0,??=0,RANGE0=2,HGO0=0,EREFS0=1,LP=0,IRCS=0 */
-  MCG->C2 = (uint8_t)0x24U;
-  /* MCG->C1: CLKS=2,FRDIV=3,IREFS=0,IRCLKEN=1,IREFSTEN=0 */
-  MCG->C1 = (uint8_t)0x9AU;
-  /* MCG->C4: DMX32=0,DRST_DRS=0 */
-  MCG->C4 &= (uint8_t)~(uint8_t)0xE0U;
-  /* MCG->C5: ??=0,PLLCLKEN0=0,PLLSTEN0=0,PRDIV0=1 */
-  MCG->C5 = (uint8_t)0x01U;
-  /* MCG->C6: LOLIE0=0,PLLS=0,CME0=0,VDIV0=0 */
-  MCG->C6 = (uint8_t)0x00U;
-  while((MCG->S & MCG_S_IREFST_MASK) != 0x00U) { /* Check that the source of the FLL reference clock is the external reference clock. */
-  }
-  while((MCG->S & 0x0CU) != 0x08U) {    /* Wait until external reference clock is selected as MCG output */
-  }
-  /* Switch to PBE Mode */
-  /* MCG->C6: LOLIE0=0,PLLS=1,CME0=0,VDIV0=0 */
-  MCG->C6 = (uint8_t)0x40U;
-  while((MCG->S & 0x0CU) != 0x08U) {    /* Wait until external reference clock is selected as MCG output */
-  }
-  while((MCG->S & MCG_S_LOCK0_MASK) == 0x00U) { /* Wait until locked */
-  }
-  /* Switch to PEE Mode */
-  /* MCG->C1: CLKS=0,FRDIV=3,IREFS=0,IRCLKEN=1,IREFSTEN=0 */
-  MCG->C1 = (uint8_t)0x1AU;
-  while((MCG->S & 0x0CU) != 0x0CU) {    /* Wait until output of the PLL is selected */
-  }
-#elif (CLOCK_SETUP == 2)
-  /* SIM->SCGC5: PORTA=1 */
-  SIM->SCGC5 |= (uint32_t)0x0200UL;     /* Enable clock gate for ports to enable pin routing */
-  /* SIM->CLKDIV1: OUTDIV1=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,OUTDIV4=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0 */
-  SIM->CLKDIV1 = (uint32_t)0x00000000UL; /* Update system prescalers */
-  /* PORTA->PCR18: ISF=0,MUX=0 */
-  PORTA->PCR[18] &= (uint32_t)~0x01000700UL;
-  /* PORTA->PCR19: ISF=0,MUX=0 */
-  PORTA->PCR[19] &= (uint32_t)~0x01000700UL;
-  /* Switch to FBE Mode */
-  /* OSC0->CR: ERCLKEN=1,??=0,EREFSTEN=0,??=0,SC2P=1,SC4P=0,SC8P=0,SC16P=1 */
-  OSC0->CR = (uint8_t)0x89U;
-  /* MCG->C2: LOCRE0=0,??=0,RANGE0=2,HGO0=0,EREFS0=1,LP=0,IRCS=0 */
-  MCG->C2 = (uint8_t)0x24U;
-  /* MCG->C1: CLKS=2,FRDIV=3,IREFS=0,IRCLKEN=1,IREFSTEN=0 */
-  MCG->C1 = (uint8_t)0x9AU;
-  /* MCG->C4: DMX32=0,DRST_DRS=0 */
-  MCG->C4 &= (uint8_t)~(uint8_t)0xE0U;
-  /* MCG->C5: ??=0,PLLCLKEN0=0,PLLSTEN0=0,PRDIV0=0 */
-  MCG->C5 = (uint8_t)0x00U;
-  /* MCG->C6: LOLIE0=0,PLLS=0,CME0=0,VDIV0=0 */
-  MCG->C6 = (uint8_t)0x00U;
-  while((MCG->S & MCG_S_IREFST_MASK) != 0x00U) { /* Check that the source of the FLL reference clock is the external reference clock. */
-  }
-  while((MCG->S & 0x0CU) != 0x08U) {    /* Wait until external reference clock is selected as MCG output */
-  }
-  /* Switch to BLPE Mode */
-  /* MCG->C2: LOCRE0=0,??=0,RANGE0=2,HGO0=0,EREFS0=1,LP=1,IRCS=0 */
-  MCG->C2 = (uint8_t)0x26U;
-  while((MCG->S & 0x0CU) != 0x08U) {    /* Wait until external reference clock is selected as MCG output */
-  }
-#endif /* (CLOCK_SETUP == 2) */
-}
-
-/* ----------------------------------------------------------------------------
-   -- SystemCoreClockUpdate()
-   ---------------------------------------------------------------------------- */
-
-void SystemCoreClockUpdate (void) {
-  uint32_t MCGOUTClock;                                                        /* Variable to store output clock frequency of the MCG module */
-  uint8_t Divider;
-
-  if ((MCG->C1 & MCG_C1_CLKS_MASK) == 0x0u) {
-    /* Output of FLL or PLL is selected */
-    if ((MCG->C6 & MCG_C6_PLLS_MASK) == 0x0u) {
-      /* FLL is selected */
-      if ((MCG->C1 & MCG_C1_IREFS_MASK) == 0x0u) {
-        /* External reference clock is selected */
-        MCGOUTClock = CPU_XTAL_CLK_HZ;                                       /* System oscillator drives MCG clock */
-        Divider = (uint8_t)(1u << ((MCG->C1 & MCG_C1_FRDIV_MASK) >> MCG_C1_FRDIV_SHIFT));
-        MCGOUTClock = (MCGOUTClock / Divider);  /* Calculate the divided FLL reference clock */
-        if ((MCG->C2 & MCG_C2_RANGE0_MASK) != 0x0u) {
-          MCGOUTClock /= 32u;                                                  /* If high range is enabled, additional 32 divider is active */
-        } /* ((MCG->C2 & MCG_C2_RANGE0_MASK) != 0x0u) */
-      } else { /* (!((MCG->C1 & MCG_C1_IREFS_MASK) == 0x0u)) */
-        MCGOUTClock = CPU_INT_SLOW_CLK_HZ;                                     /* The slow internal reference clock is selected */
-      } /* (!((MCG->C1 & MCG_C1_IREFS_MASK) == 0x0u)) */
-      /* Select correct multiplier to calculate the MCG output clock  */
-      switch (MCG->C4 & (MCG_C4_DMX32_MASK | MCG_C4_DRST_DRS_MASK)) {
-        case 0x0u:
-          MCGOUTClock *= 640u;
-          break;
-        case 0x20u:
-          MCGOUTClock *= 1280u;
-          break;
-        case 0x40u:
-          MCGOUTClock *= 1920u;
-          break;
-        case 0x60u:
-          MCGOUTClock *= 2560u;
-          break;
-        case 0x80u:
-          MCGOUTClock *= 732u;
-          break;
-        case 0xA0u:
-          MCGOUTClock *= 1464u;
-          break;
-        case 0xC0u:
-          MCGOUTClock *= 2197u;
-          break;
-        case 0xE0u:
-          MCGOUTClock *= 2929u;
-          break;
-        default:
-          break;
-      }
-    } else { /* (!((MCG->C6 & MCG_C6_PLLS_MASK) == 0x0u)) */
-      /* PLL is selected */
-      Divider = (1u + (MCG->C5 & MCG_C5_PRDIV0_MASK));
-      MCGOUTClock = (uint32_t)(CPU_XTAL_CLK_HZ / Divider);                     /* Calculate the PLL reference clock */
-      Divider = ((MCG->C6 & MCG_C6_VDIV0_MASK) + 24u);
-      MCGOUTClock *= Divider;                       /* Calculate the MCG output clock */
-    } /* (!((MCG->C6 & MCG_C6_PLLS_MASK) == 0x0u)) */
-  } else if ((MCG->C1 & MCG_C1_CLKS_MASK) == 0x40u) {
-    /* Internal reference clock is selected */
-    if ((MCG->C2 & MCG_C2_IRCS_MASK) == 0x0u) {
-      MCGOUTClock = CPU_INT_SLOW_CLK_HZ;                                       /* Slow internal reference clock selected */
-    } else { /* (!((MCG->C2 & MCG_C2_IRCS_MASK) == 0x0u)) */
-      MCGOUTClock = CPU_INT_FAST_CLK_HZ / (1 << ((MCG->SC & MCG_SC_FCRDIV_MASK) >> MCG_SC_FCRDIV_SHIFT));  /* Fast internal reference clock selected */
-    } /* (!((MCG->C2 & MCG_C2_IRCS_MASK) == 0x0u)) */
-  } else if ((MCG->C1 & MCG_C1_CLKS_MASK) == 0x80u) {
-    /* External reference clock is selected */
-    MCGOUTClock = CPU_XTAL_CLK_HZ;                                           /* System oscillator drives MCG clock */
-  } else { /* (!((MCG->C1 & MCG_C1_CLKS_MASK) == 0x80u)) */
-    /* Reserved value */
-    return;
-  } /* (!((MCG->C1 & MCG_C1_CLKS_MASK) == 0x80u)) */
-  SystemCoreClock = (MCGOUTClock / (1u + ((SIM->CLKDIV1 & SIM_CLKDIV1_OUTDIV1_MASK) >> SIM_CLKDIV1_OUTDIV1_SHIFT)));
-}
--- a/targets/cmsis/TARGET_Freescale/TARGET_KL46Z/system_MKL46Z4.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
-** ###################################################################
-**     Processor:           MKL46Z128VLK4
-**     Compilers:           ARM Compiler
-**                          Freescale C/C++ for Embedded ARM
-**                          GNU C Compiler
-**                          IAR ANSI C/C++ Compiler for ARM
-**
-**     Reference manual:    KL25RM, Rev.1, Jun 2012
-**     Version:             rev. 1.1, 2012-06-21
-**
-**     Abstract:
-**         Provides a system configuration function and a global variable that
-**         contains the system frequency. It configures the device and initializes
-**         the oscillator (PLL) that is part of the microcontroller device.
-**
-**     Copyright: 2012 Freescale Semiconductor, Inc. All Rights Reserved.
-**
-**     http:                 www.freescale.com
-**     mail:                 support@freescale.com
-**
-**     Revisions:
-**     - rev. 1.0 (2012-06-13)
-**         Initial version.
-**     - rev. 1.1 (2012-06-21)
-**         Update according to reference manual rev. 1.
-**
-** ###################################################################
-*/
-
-/**
- * @file MKL46Z4
- * @version 1.1
- * @date 2012-06-21
- * @brief Device specific configuration file for MKL46Z4 (header file)
- *
- * Provides a system configuration function and a global variable that contains
- * the system frequency. It configures the device and initializes the oscillator
- * (PLL) that is part of the microcontroller device.
- */
-
-#ifndef SYSTEM_MKL46Z4_H_
-#define SYSTEM_MKL46Z4_H_                        /**< Symbol preventing repeated inclusion */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-/**
- * @brief System clock frequency (core clock)
- *
- * The system clock frequency supplied to the SysTick timer and the processor
- * core clock. This variable can be used by the user application to setup the
- * SysTick timer or configure other parameters. It may also be used by debugger to
- * query the frequency of the debug timer or configure the trace clock speed
- * SystemCoreClock is initialized with a correct predefined value.
- */
-extern uint32_t SystemCoreClock;
-
-/**
- * @brief Setup the microcontroller system.
- *
- * Typically this function configures the oscillator (PLL) that is part of the
- * microcontroller device. For systems with variable clock speed it also updates
- * the variable SystemCoreClock. SystemInit is called from startup_device file.
- */
-void SystemInit (void);
-
-/**
- * @brief Updates the SystemCoreClock variable.
- *
- * It must be called whenever the core clock is changed during program
- * execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates
- * the current core clock.
- */
-void SystemCoreClockUpdate (void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /* #if !defined(SYSTEM_MKL46Z4_H_) */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/cmsis/TARGET_NXP/LPC11xx.h	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,602 @@
+/****************************************************************************
+ *   $Id:: LPC11xx.h 9198 2012-05-29 usb00175                     $
+ *   Project: NXP LPC11xx software example  
+ *
+ *   Description:
+ *     CMSIS Cortex-M0 Core Peripheral Access Layer Header File for 
+ *     NXP LPC11xx Device Series 
+ 
+ ****************************************************************************
+ * 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.
+
+* Permission to use, copy, modify, and distribute this software and its 
+* documentation is hereby granted, under NXP Semiconductors' 
+* relevant copyright in the software, without fee, provided 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 __LPC11xx_H__
+#define __LPC11xx_H__
+
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+
+/** @addtogroup LPC11xx_Definitions LPC11xx Definitions
+  This file defines all structures and symbols for LPC11xx:
+    - Registers and bitfields
+    - peripheral base address
+    - peripheral ID
+    - PIO definitions
+  @{
+*/
+
+
+/******************************************************************************/
+/*                Processor and Core Peripherals                              */
+/******************************************************************************/
+/** @addtogroup LPC11xx_CMSIS LPC11xx CMSIS Definitions
+  Configuration of the Cortex-M0 Processor and Core Peripherals
+  @{
+*/
+
+/*
+ * ==========================================================================
+ * ---------- Interrupt Number Definition -----------------------------------
+ * ==========================================================================
+ */
+typedef enum IRQn
+{
+/******  Cortex-M0 Processor Exceptions Numbers ***************************************************/
+  NonMaskableInt_IRQn           = -14,    /*!< 2 Non Maskable Interrupt                           */
+  HardFault_IRQn                = -13,    /*!< 3 Cortex-M0 Hard Fault Interrupt                   */
+  SVCall_IRQn                   = -5,     /*!< 11 Cortex-M0 SV Call Interrupt                     */
+  PendSV_IRQn                   = -2,     /*!< 14 Cortex-M0 Pend SV Interrupt                     */
+  SysTick_IRQn                  = -1,     /*!< 15 Cortex-M0 System Tick Interrupt                 */
+
+/******  LPC11Cxx or LPC11xx Specific Interrupt Numbers *******************************************************/
+  WAKEUP0_IRQn                  = 0,        /*!< All I/O pins can be used as wakeup source.       */
+  WAKEUP1_IRQn                  = 1,        /*!< There are 13 pins in total for LPC11xx           */
+  WAKEUP2_IRQn                  = 2,
+  WAKEUP3_IRQn                  = 3,
+  WAKEUP4_IRQn                  = 4,   
+  WAKEUP5_IRQn                  = 5,        
+  WAKEUP6_IRQn                  = 6,        
+  WAKEUP7_IRQn                  = 7,        
+  WAKEUP8_IRQn                  = 8,        
+  WAKEUP9_IRQn                  = 9,        
+  WAKEUP10_IRQn                 = 10,       
+  WAKEUP11_IRQn                 = 11,       
+  WAKEUP12_IRQn                 = 12,       
+  CAN_IRQn                      = 13,       /*!< CAN Interrupt                                    */
+  SSP1_IRQn                     = 14,       /*!< SSP1 Interrupt                                   */
+  I2C_IRQn                      = 15,       /*!< I2C Interrupt                                    */
+  TIMER_16_0_IRQn               = 16,       /*!< 16-bit Timer0 Interrupt                          */
+  TIMER_16_1_IRQn               = 17,       /*!< 16-bit Timer1 Interrupt                          */
+  TIMER_32_0_IRQn               = 18,       /*!< 32-bit Timer0 Interrupt                          */
+  TIMER_32_1_IRQn               = 19,       /*!< 32-bit Timer1 Interrupt                          */
+  SSP0_IRQn                     = 20,       /*!< SSP0 Interrupt                                   */
+  UART_IRQn                     = 21,       /*!< UART Interrupt                                   */
+  Reserved0_IRQn                = 22,       /*!< Reserved Interrupt                               */
+  Reserved1_IRQn                = 23,       
+  ADC_IRQn                      = 24,       /*!< A/D Converter Interrupt                          */
+  WDT_IRQn                      = 25,       /*!< Watchdog timer Interrupt                         */  
+  BOD_IRQn                      = 26,       /*!< Brown Out Detect(BOD) Interrupt                  */
+  FMC_IRQn                      = 27,       /*!< Flash Memory Controller Interrupt                */
+  EINT3_IRQn                    = 28,       /*!< External Interrupt 3 Interrupt                   */
+  EINT2_IRQn                    = 29,       /*!< External Interrupt 2 Interrupt                   */
+  EINT1_IRQn                    = 30,       /*!< External Interrupt 1 Interrupt                   */
+  EINT0_IRQn                    = 31,       /*!< External Interrupt 0 Interrupt                   */
+} IRQn_Type;
+
+/*
+ * ==========================================================================
+ * ----------- Processor and Core Peripheral Section ------------------------
+ * ==========================================================================
+ */
+
+/* Configuration of the Cortex-M0 Processor and Core Peripherals */
+#define __MPU_PRESENT             0         /*!< MPU present or not                               */
+#define __NVIC_PRIO_BITS          2         /*!< Number of Bits used for Priority Levels          */
+#define __Vendor_SysTickConfig    0         /*!< Set to 1 if different SysTick Config is used     */
+
+/*@}*/ /* end of group LPC11xx_CMSIS */
+
+
+#include "core_cm0.h"                       /* Cortex-M0 processor and core peripherals           */
+#include "system_LPC11xx.h"                 /* System Header                                      */
+
+
+/******************************************************************************/
+/*                Device Specific Peripheral Registers structures             */
+/******************************************************************************/
+
+#if defined ( __CC_ARM   )
+#pragma anon_unions
+#endif
+
+/*------------- System Control (SYSCON) --------------------------------------*/
+/** @addtogroup LPC11xx_SYSCON LPC11xx System Control Block 
+  @{
+*/
+typedef struct
+{
+  __IO uint32_t SYSMEMREMAP;            /*!< Offset: 0x000 System memory remap (R/W) */
+  __IO uint32_t PRESETCTRL;             /*!< Offset: 0x004 Peripheral reset control (R/W) */
+  __IO uint32_t SYSPLLCTRL;             /*!< Offset: 0x008 System PLL control (R/W) */
+  __I uint32_t SYSPLLSTAT;             /*!< Offset: 0x00C System PLL status (R/ ) */
+       uint32_t RESERVED0[4];
+
+  __IO uint32_t SYSOSCCTRL;             /*!< Offset: 0x020 System oscillator control (R/W) */
+  __IO uint32_t WDTOSCCTRL;             /*!< Offset: 0x024 Watchdog oscillator control (R/W) */
+  __IO uint32_t IRCCTRL;                /*!< Offset: 0x028 IRC control (R/W) */
+       uint32_t RESERVED1[1];
+  __IO uint32_t SYSRSTSTAT;             /*!< Offset: 0x030 System reset status Register (R/ ) */
+       uint32_t RESERVED2[3];
+  __IO uint32_t SYSPLLCLKSEL;           /*!< Offset: 0x040 System PLL clock source select (R/W) */	
+  __IO uint32_t SYSPLLCLKUEN;           /*!< Offset: 0x044 System PLL clock source update enable (R/W) */
+       uint32_t RESERVED3[10];
+
+  __IO uint32_t MAINCLKSEL;             /*!< Offset: 0x070 Main clock source select (R/W) */
+  __IO uint32_t MAINCLKUEN;             /*!< Offset: 0x074 Main clock source update enable (R/W) */
+  __IO uint32_t SYSAHBCLKDIV;           /*!< Offset: 0x078 System AHB clock divider (R/W) */
+       uint32_t RESERVED4[1];
+
+  __IO uint32_t SYSAHBCLKCTRL;          /*!< Offset: 0x080 System AHB clock control (R/W) */
+       uint32_t RESERVED5[4];
+  __IO uint32_t SSP0CLKDIV;             /*!< Offset: 0x094 SSP0 clock divider (R/W) */          
+  __IO uint32_t UARTCLKDIV;             /*!< Offset: 0x098 UART clock divider (R/W) */
+  __IO uint32_t SSP1CLKDIV;             /*!< Offset: 0x09C SSP1 clock divider (R/W) */          
+       uint32_t RESERVED6[12];
+
+  __IO uint32_t WDTCLKSEL;              /*!< Offset: 0x0D0 WDT clock source select (R/W) */
+  __IO uint32_t WDTCLKUEN;              /*!< Offset: 0x0D4 WDT clock source update enable (R/W) */
+  __IO uint32_t WDTCLKDIV;              /*!< Offset: 0x0D8 WDT clock divider (R/W) */
+       uint32_t RESERVED8[1];              
+  __IO uint32_t CLKOUTCLKSEL;           /*!< Offset: 0x0E0 CLKOUT clock source select (R/W) */
+  __IO uint32_t CLKOUTUEN;              /*!< Offset: 0x0E4 CLKOUT clock source update enable (R/W) */
+  __IO uint32_t CLKOUTDIV;              /*!< Offset: 0x0E8 CLKOUT clock divider (R/W) */       
+       uint32_t RESERVED9[5];
+  
+  __IO uint32_t PIOPORCAP0;             /*!< Offset: 0x100 POR captured PIO status 0 (R/ ) */           
+  __IO uint32_t PIOPORCAP1;             /*!< Offset: 0x104 POR captured PIO status 1 (R/ ) */   
+       uint32_t RESERVED10[18];
+  __IO uint32_t BODCTRL;                /*!< Offset: 0x150 BOD control (R/W) */
+  __IO uint32_t SYSTCKCAL;              /*!< Offset: 0x154 System tick counter calibration (R/W) */
+       
+       uint32_t RESERVED13[7];
+  __IO uint32_t NMISRC;                 /*!< Offset: 0x174 NMI source selection register (R/W) */
+       uint32_t RESERVED14[34];
+       
+  __IO uint32_t STARTAPRP0;             /*!< Offset: 0x200 Start logic edge control Register 0 (R/W) */     
+  __IO uint32_t STARTERP0;              /*!< Offset: 0x204 Start logic signal enable Register 0 (R/W) */      
+  __O  uint32_t STARTRSRP0CLR;          /*!< Offset: 0x208 Start logic reset Register 0  ( /W) */
+  __I uint32_t STARTSRP0;              /*!< Offset: 0x20C Start logic status Register 0 (R/) */
+  __IO uint32_t STARTAPRP1;             /*!< Offset: 0x210 Start logic edge control Register 0 (R/W). (LPC11UXX only) */     
+  __IO uint32_t STARTERP1;              /*!< Offset: 0x214 Start logic signal enable Register 0 (R/W). (LPC11UXX only) */      
+  __O  uint32_t STARTRSRP1CLR;          /*!< Offset: 0x218 Start logic reset Register 0  ( /W). (LPC11UXX only) */
+  __IO uint32_t STARTSRP1;              /*!< Offset: 0x21C Start logic status Register 0 (R/W). (LPC11UXX only) */
+       uint32_t RESERVED17[4];
+
+  __IO uint32_t PDSLEEPCFG;             /*!< Offset: 0x230 Power-down states in Deep-sleep mode (R/W) */
+  __IO uint32_t PDAWAKECFG;             /*!< Offset: 0x234 Power-down states after wake-up (R/W) */        
+  __IO uint32_t PDRUNCFG;               /*!< Offset: 0x238 Power-down configuration Register (R/W) */
+       uint32_t RESERVED15[110];
+  __I  uint32_t DEVICE_ID;              /*!< Offset: 0x3F4 Device ID (R/ ) */
+} LPC_SYSCON_TypeDef;
+/*@}*/ /* end of group LPC11xx_SYSCON */
+
+
+/*------------- Pin Connect Block (IOCON) --------------------------------*/
+/** @addtogroup LPC11xx_IOCON LPC11xx I/O Configuration Block 
+  @{
+*/
+typedef struct
+{
+  __IO uint32_t PIO2_6;                 /*!< Offset: 0x000 I/O configuration for pin PIO2_6 (R/W) */
+       uint32_t RESERVED0[1];
+  __IO uint32_t PIO2_0;                 /*!< Offset: 0x008 I/O configuration for pin PIO2_0/DTR/SSEL1 (R/W) */
+  __IO uint32_t RESET_PIO0_0;           /*!< Offset: 0x00C I/O configuration for pin RESET/PIO0_0  (R/W) */
+  __IO uint32_t PIO0_1;                 /*!< Offset: 0x010 I/O configuration for pin PIO0_1/CLKOUT/CT32B0_MAT2 (R/W) */
+  __IO uint32_t PIO1_8;                 /*!< Offset: 0x014 I/O configuration for pin PIO1_8/CT16B1_CAP0 (R/W) */
+  __IO uint32_t SSEL1_LOC;              /*!< Offset: 0x018 IOCON SSEL1 location register (IOCON_SSEL1_LOC, address 0x4004 4018) */
+  __IO uint32_t PIO0_2;                 /*!< Offset: 0x01C I/O configuration for pin PIO0_2/SSEL0/CT16B0_CAP0 (R/W) */
+
+  __IO uint32_t PIO2_7;                 /*!< Offset: 0x020 I/O configuration for pin PIO2_7 (R/W) */
+  __IO uint32_t PIO2_8;                 /*!< Offset: 0x024 I/O configuration for pin PIO2_8 (R/W) */
+  __IO uint32_t PIO2_1;                 /*!< Offset: 0x028 I/O configuration for pin PIO2_1/nDSR/SCK1 (R/W) */
+  __IO uint32_t PIO0_3;                 /*!< Offset: 0x02C I/O configuration for pin PIO0_3 (R/W) */
+  __IO uint32_t PIO0_4;                 /*!< Offset: 0x030 I/O configuration for pin PIO0_4/SCL (R/W) */
+  __IO uint32_t PIO0_5;                 /*!< Offset: 0x034 I/O configuration for pin PIO0_5/SDA (R/W) */
+  __IO uint32_t PIO1_9;                 /*!< Offset: 0x038 I/O configuration for pin PIO1_9/CT16B1_MAT0 (R/W) */
+  __IO uint32_t PIO3_4;                 /*!< Offset: 0x03C I/O configuration for pin PIO3_4 (R/W) */
+
+  __IO uint32_t PIO2_4;                 /*!< Offset: 0x040 I/O configuration for pin PIO2_4 (R/W) */
+  __IO uint32_t PIO2_5;                 /*!< Offset: 0x044 I/O configuration for pin PIO2_5 (R/W) */
+  __IO uint32_t PIO3_5;                 /*!< Offset: 0x048 I/O configuration for pin PIO3_5 (R/W) */
+  __IO uint32_t PIO0_6;                 /*!< Offset: 0x04C I/O configuration for pin PIO0_6/SCK0 (R/W) */
+  __IO uint32_t PIO0_7;                 /*!< Offset: 0x050 I/O configuration for pin PIO0_7/nCTS (R/W) */
+  __IO uint32_t PIO2_9;                 /*!< Offset: 0x054 I/O configuration for pin PIO2_9 (R/W) */
+  __IO uint32_t PIO2_10;                /*!< Offset: 0x058 I/O configuration for pin PIO2_10 (R/W) */
+  __IO uint32_t PIO2_2;                 /*!< Offset: 0x05C I/O configuration for pin PIO2_2/DCD/MISO1 (R/W) */
+
+  __IO uint32_t PIO0_8;                 /*!< Offset: 0x060 I/O configuration for pin PIO0_8/MISO0/CT16B0_MAT0 (R/W) */
+  __IO uint32_t PIO0_9;                 /*!< Offset: 0x064 I/O configuration for pin PIO0_9/MOSI0/CT16B0_MAT1 (R/W) */
+  __IO uint32_t SWCLK_PIO0_10;          /*!< Offset: 0x068 I/O configuration for pin SWCLK/PIO0_10/SCK0/CT16B0_MAT2 (R/W) */
+  __IO uint32_t PIO1_10;                /*!< Offset: 0x06C I/O configuration for pin PIO1_10/AD6/CT16B1_MAT1 (R/W) */
+  __IO uint32_t PIO2_11;                /*!< Offset: 0x070 I/O configuration for pin PIO2_11/SCK0 (R/W) */
+  __IO uint32_t R_PIO0_11;              /*!< Offset: 0x074 I/O configuration for pin TDI/PIO0_11/AD0/CT32B0_MAT3 (R/W) */
+  __IO uint32_t R_PIO1_0;               /*!< Offset: 0x078 I/O configuration for pin TMS/PIO1_0/AD1/CT32B1_CAP0 (R/W) */
+  __IO uint32_t R_PIO1_1;               /*!< Offset: 0x07C I/O configuration for pin TDO/PIO1_1/AD2/CT32B1_MAT0 (R/W) */
+
+  __IO uint32_t R_PIO1_2;               /*!< Offset: 0x080 I/O configuration for pin nTRST/PIO1_2/AD3/CT32B1_MAT1 (R/W) */
+  __IO uint32_t PIO3_0;                 /*!< Offset: 0x084 I/O configuration for pin PIO3_0/nDTR (R/W) */
+  __IO uint32_t PIO3_1;                 /*!< Offset: 0x088 I/O configuration for pin PIO3_1/nDSR (R/W) */
+  __IO uint32_t PIO2_3;                 /*!< Offset: 0x08C I/O configuration for pin PIO2_3/RI/MOSI1 (R/W) */
+  __IO uint32_t SWDIO_PIO1_3;           /*!< Offset: 0x090 I/O configuration for pin SWDIO/PIO1_3/AD4/CT32B1_MAT2 (R/W) */
+  __IO uint32_t PIO1_4;                 /*!< Offset: 0x094 I/O configuration for pin PIO1_4/AD5/CT32B1_MAT3 (R/W) */
+  __IO uint32_t PIO1_11;                /*!< Offset: 0x098 I/O configuration for pin PIO1_11/AD7 (R/W) */
+  __IO uint32_t PIO3_2;                 /*!< Offset: 0x09C I/O configuration for pin PIO3_2/nDCD (R/W) */
+
+  __IO uint32_t PIO1_5;                 /*!< Offset: 0x0A0 I/O configuration for pin PIO1_5/nRTS/CT32B0_CAP0 (R/W) */
+  __IO uint32_t PIO1_6;                 /*!< Offset: 0x0A4 I/O configuration for pin PIO1_6/RXD/CT32B0_MAT0 (R/W) */
+  __IO uint32_t PIO1_7;                 /*!< Offset: 0x0A8 I/O configuration for pin PIO1_7/TXD/CT32B0_MAT1 (R/W) */
+  __IO uint32_t PIO3_3;                 /*!< Offset: 0x0AC I/O configuration for pin PIO3_3/nRI (R/W) */
+  __IO uint32_t SCK_LOC;                /*!< Offset: 0x0B0 SCK pin location select Register (R/W) */
+  __IO uint32_t DSR_LOC;                /*!< Offset: 0x0B4 DSR pin location select Register (R/W) */
+  __IO uint32_t DCD_LOC;                /*!< Offset: 0x0B8 DCD pin location select Register (R/W) */
+  __IO uint32_t RI_LOC;                 /*!< Offset: 0x0BC RI pin location Register (R/W) */
+
+  __IO uint32_t CT16B0_CAP0_LOC;        /*!< Offset: 0x0C0 IOCON CT16B0_CAP0 location register (IOCON_CT16B0_CAP0_LOC, address 0x4004 40C0) */
+  __IO uint32_t SCK1_LOC;               /*!< Offset: 0x0C4 IOCON SCK1 location register (IOCON_SCK1_LOC, address 0x4004 40C4) */
+  __IO uint32_t MISO1_LOC;              /*!< Offset: 0x0C8 IOCON MISO1 location register (IOCON_MISO1_LOC, address 0x4004 40C8) */
+  __IO uint32_t MOSI1_LOC;              /*!< Offset: 0x0CC IOCON MOSI1 location register (IOCON_MOSI1_LOC, address 0x4004 40CC) */
+  __IO uint32_t CT32B0_CAP0_LOC;        /*!< Offset: 0x0D0 IOCON CT32B0_CAP0 location register (IOCON_CT32B0_CAP0_LOC, address 0x4004 40D0) */
+  __IO uint32_t RXD_LOC;                /*!< Offset: 0x0D4 IOCON RXD location register (IOCON_RXD_LOC, address 0x4004 40D4) */
+} LPC_IOCON_TypeDef;
+/*@}*/ /* end of group LPC11xx_IOCON */
+
+
+/*------------- Power Management Unit (PMU) --------------------------*/
+/** @addtogroup LPC11xx_PMU LPC11xx Power Management Unit 
+  @{
+*/
+typedef struct
+{
+  __IO uint32_t PCON;                   /*!< Offset: 0x000 Power control Register (R/W) */
+  __IO uint32_t GPREG0;                 /*!< Offset: 0x004 General purpose Register 0 (R/W) */
+  __IO uint32_t GPREG1;                 /*!< Offset: 0x008 General purpose Register 1 (R/W) */
+  __IO uint32_t GPREG2;                 /*!< Offset: 0x00C General purpose Register 2 (R/W) */
+  __IO uint32_t GPREG3;                 /*!< Offset: 0x010 General purpose Register 3 (R/W) */
+  __IO uint32_t GPREG4;                 /*!< Offset: 0x014 General purpose Register 4 (R/W) */
+} LPC_PMU_TypeDef;
+/*@}*/ /* end of group LPC11xx_PMU */
+
+
+
+// ------------------------------------------------------------------------------------------------
+// -----                                       FLASHCTRL                                      -----
+// ------------------------------------------------------------------------------------------------
+
+typedef struct {                            /*!< (@ 0x4003C000) FLASHCTRL Structure    */
+  __I  uint32_t RESERVED0[4];
+  __IO uint32_t FLASHCFG;                   /*!< (@ 0x4003C010) Flash memory access time configuration register */
+  __I  uint32_t RESERVED1[3];
+  __IO uint32_t FMSSTART;                   /*!< (@ 0x4003C020) Signature start address register */
+  __IO uint32_t FMSSTOP;                    /*!< (@ 0x4003C024) Signature stop-address register */
+  __I  uint32_t RESERVED2[1];
+  __I  uint32_t FMSW0;                      /*!< (@ 0x4003C02C) Word 0 [31:0]          */
+  __I  uint32_t FMSW1;                      /*!< (@ 0x4003C030) Word 1 [63:32]         */
+  __I  uint32_t FMSW2;                      /*!< (@ 0x4003C034) Word 2 [95:64]         */
+  __I  uint32_t FMSW3;                      /*!< (@ 0x4003C038) Word 3 [127:96]        */
+  __I  uint32_t RESERVED3[1001];
+  __I  uint32_t FMSTAT;                     /*!< (@ 0x4003CFE0) Signature generation status register */
+  __I  uint32_t RESERVED4[1];
+  __IO uint32_t FMSTATCLR;                  /*!< (@ 0x4003CFE8) Signature generation status clear register */
+} LPC_FLASHCTRL_Type;
+
+
+/*------------- General Purpose Input/Output (GPIO) --------------------------*/
+/** @addtogroup LPC11xx_GPIO LPC11xx General Purpose Input/Output 
+  @{
+*/
+typedef struct
+{
+  union {
+    __IO uint32_t MASKED_ACCESS[4096];  /*!< Offset: 0x0000 to 0x3FFC Port data Register for pins PIOn_0 to PIOn_11 (R/W) */
+    struct {
+         uint32_t RESERVED0[4095];
+    __IO uint32_t DATA;                 /*!< Offset: 0x3FFC Port data Register (R/W) */
+    };
+  };
+       uint32_t RESERVED1[4096];
+  __IO uint32_t DIR;                    /*!< Offset: 0x8000 Data direction Register (R/W) */
+  __IO uint32_t IS;                     /*!< Offset: 0x8004 Interrupt sense Register (R/W) */
+  __IO uint32_t IBE;                    /*!< Offset: 0x8008 Interrupt both edges Register (R/W) */
+  __IO uint32_t IEV;                    /*!< Offset: 0x800C Interrupt event Register  (R/W) */
+  __IO uint32_t IE;                     /*!< Offset: 0x8010 Interrupt mask Register (R/W) */
+  __I uint32_t RIS;                    /*!< Offset: 0x8014 Raw interrupt status Register (R/ ) */
+  __I uint32_t MIS;                    /*!< Offset: 0x8018 Masked interrupt status Register (R/ ) */
+  __O uint32_t IC;                     /*!< Offset: 0x801C Interrupt clear Register (/W) */
+} LPC_GPIO_TypeDef;
+/*@}*/ /* end of group LPC11xx_GPIO */
+
+/*------------- Timer (TMR) --------------------------------------------------*/
+/** @addtogroup LPC11xx_TMR LPC11xx 16/32-bit Counter/Timer 
+  @{
+*/
+typedef struct
+{
+  __IO uint32_t IR;                     /*!< Offset: 0x000 Interrupt Register (R/W) */
+  __IO uint32_t TCR;                    /*!< Offset: 0x004 Timer Control Register (R/W) */
+  __IO uint32_t TC;                     /*!< Offset: 0x008 Timer Counter Register (R/W) */
+  __IO uint32_t PR;                     /*!< Offset: 0x00C Prescale Register (R/W) */
+  __IO uint32_t PC;                     /*!< Offset: 0x010 Prescale Counter Register (R/W) */
+  __IO uint32_t MCR;                    /*!< Offset: 0x014 Match Control Register (R/W) */
+  union {
+  __IO uint32_t MR[4];                  /*!< Offset: Match Register base */
+  struct{
+  __IO uint32_t MR0;                    /*!< Offset: 0x018 Match Register 0 (R/W) */
+  __IO uint32_t MR1;                    /*!< Offset: 0x01C Match Register 1 (R/W) */
+  __IO uint32_t MR2;                    /*!< Offset: 0x020 Match Register 2 (R/W) */
+  __IO uint32_t MR3;                    /*!< Offset: 0x024 Match Register 3 (R/W) */
+  };
+  };
+  __IO uint32_t CCR;                    /*!< Offset: 0x028 Capture Control Register (R/W) */
+  __I  uint32_t CR0;                    /*!< Offset: 0x02C Capture Register 0 (R/ ) */
+  __I  uint32_t CR1;                    /*!< Offset: 0x030 Capture Register 1 (R/ ) */
+       uint32_t RESERVED1[2];
+  __IO uint32_t EMR;                    /*!< Offset: 0x03C External Match Register (R/W) */
+       uint32_t RESERVED2[12];
+  __IO uint32_t CTCR;                   /*!< Offset: 0x070 Count Control Register (R/W) */
+  __IO uint32_t PWMC;                   /*!< Offset: 0x074 PWM Control Register (R/W) */
+} LPC_TMR_TypeDef;
+/*@}*/ /* end of group LPC11xx_TMR */
+
+
+/*------------- Universal Asynchronous Receiver Transmitter (UART) -----------*/
+/** @addtogroup LPC11xx_UART LPC11xx Universal Asynchronous Receiver/Transmitter 
+  @{
+*/
+typedef struct
+{
+  union {
+  __I  uint32_t  RBR;                   /*!< Offset: 0x000 Receiver Buffer  Register (R/ ) */
+  __O  uint32_t  THR;                   /*!< Offset: 0x000 Transmit Holding Register ( /W) */
+  __IO uint32_t  DLL;                   /*!< Offset: 0x000 Divisor Latch LSB (R/W) */
+  };
+  union {
+  __IO uint32_t  DLM;                   /*!< Offset: 0x004 Divisor Latch MSB (R/W) */
+  __IO uint32_t  IER;                   /*!< Offset: 0x000 Interrupt Enable Register (R/W) */
+  };
+  union {
+  __I  uint32_t  IIR;                   /*!< Offset: 0x008 Interrupt ID Register (R/ ) */
+  __O  uint32_t  FCR;                   /*!< Offset: 0x008 FIFO Control Register ( /W) */
+  };
+  __IO uint32_t  LCR;                   /*!< Offset: 0x00C Line Control Register (R/W) */
+  __IO uint32_t  MCR;                   /*!< Offset: 0x010 Modem control Register (R/W) */
+  __I  uint32_t  LSR;                   /*!< Offset: 0x014 Line Status Register (R/ ) */
+  __I  uint32_t  MSR;                   /*!< Offset: 0x018 Modem status Register (R/ ) */
+  __IO uint32_t  SCR;                   /*!< Offset: 0x01C Scratch Pad Register (R/W) */
+  __IO uint32_t  ACR;                   /*!< Offset: 0x020 Auto-baud Control Register (R/W) */
+       uint32_t  RESERVED0;
+  __IO uint32_t  FDR;                   /*!< Offset: 0x028 Fractional Divider Register (R/W) */
+       uint32_t  RESERVED1;
+  __IO uint32_t  TER;                   /*!< Offset: 0x030 Transmit Enable Register (R/W) */
+       uint32_t  RESERVED2[6];
+  __IO uint32_t  RS485CTRL;             /*!< Offset: 0x04C RS-485/EIA-485 Control Register (R/W) */
+  __IO uint32_t  ADRMATCH;              /*!< Offset: 0x050 RS-485/EIA-485 address match Register (R/W) */
+  __IO uint32_t  RS485DLY;              /*!< Offset: 0x054 RS-485/EIA-485 direction control delay Register (R/W) */
+  __I  uint32_t  FIFOLVL;               /*!< Offset: 0x058 FIFO Level Register (R) */
+} LPC_UART_TypeDef;
+/*@}*/ /* end of group LPC11xx_UART */
+
+
+/*------------- Synchronous Serial Communication (SSP) -----------------------*/
+/** @addtogroup LPC11xx_SSP LPC11xx Synchronous Serial Port 
+  @{
+*/
+typedef struct
+{
+  __IO uint32_t CR0;                    /*!< Offset: 0x000 Control Register 0 (R/W) */
+  __IO uint32_t CR1;                    /*!< Offset: 0x004 Control Register 1 (R/W) */
+  __IO uint32_t DR;                     /*!< Offset: 0x008 Data Register (R/W) */
+  __I  uint32_t SR;                     /*!< Offset: 0x00C Status Registe (R/ ) */
+  __IO uint32_t CPSR;                   /*!< Offset: 0x010 Clock Prescale Register (R/W) */
+  __IO uint32_t IMSC;                   /*!< Offset: 0x014 Interrupt Mask Set and Clear Register (R/W) */
+  __I uint32_t RIS;                    /*!< Offset: 0x018 Raw Interrupt Status Register (R/) */
+  __I uint32_t MIS;                    /*!< Offset: 0x01C Masked Interrupt Status Register (R/) */
+  __O uint32_t ICR;                    /*!< Offset: 0x020 SSPICR Interrupt Clear Register (/W) */
+} LPC_SSP_TypeDef;
+/*@}*/ /* end of group LPC11xx_SSP */
+
+
+/*------------- Inter-Integrated Circuit (I2C) -------------------------------*/
+/** @addtogroup LPC11xx_I2C LPC11xx I2C-Bus Interface 
+  @{
+*/
+typedef struct
+{
+  __IO uint32_t CONSET;                 /*!< Offset: 0x000 I2C Control Set Register (R/W) */
+  __I  uint32_t STAT;                   /*!< Offset: 0x004 I2C Status Register (R/ ) */
+  __IO uint32_t DAT;                    /*!< Offset: 0x008 I2C Data Register (R/W) */
+  __IO uint32_t ADR0;                   /*!< Offset: 0x00C I2C Slave Address Register 0 (R/W) */
+  __IO uint32_t SCLH;                   /*!< Offset: 0x010 SCH Duty Cycle Register High Half Word (R/W) */
+  __IO uint32_t SCLL;                   /*!< Offset: 0x014 SCL Duty Cycle Register Low Half Word (R/W) */
+  __O  uint32_t CONCLR;                 /*!< Offset: 0x018 I2C Control Clear Register ( /W) */
+  __IO uint32_t MMCTRL;                 /*!< Offset: 0x01C Monitor mode control register (R/W) */
+  __IO uint32_t ADR1;                   /*!< Offset: 0x020 I2C Slave Address Register 1 (R/W) */
+  __IO uint32_t ADR2;                   /*!< Offset: 0x024 I2C Slave Address Register 2 (R/W) */
+  __IO uint32_t ADR3;                   /*!< Offset: 0x028 I2C Slave Address Register 3 (R/W) */
+  __I  uint32_t DATA_BUFFER;            /*!< Offset: 0x02C Data buffer register ( /W) */
+  __IO uint32_t MASK0;                  /*!< Offset: 0x030 I2C Slave address mask register 0 (R/W) */
+  __IO uint32_t MASK1;                  /*!< Offset: 0x034 I2C Slave address mask register 1 (R/W) */
+  __IO uint32_t MASK2;                  /*!< Offset: 0x038 I2C Slave address mask register 2 (R/W) */
+  __IO uint32_t MASK3;                  /*!< Offset: 0x03C I2C Slave address mask register 3 (R/W) */
+} LPC_I2C_TypeDef;
+/*@}*/ /* end of group LPC11xx_I2C */
+
+
+/*------------- Watchdog Timer (WDT) -----------------------------------------*/
+/** @addtogroup LPC11xx_WDT LPC11xx WatchDog Timer 
+  @{
+*/
+typedef struct
+{
+  __IO uint32_t MOD;                    /*!< Offset: 0x000 Watchdog mode register (R/W) */
+  __IO uint32_t TC;                     /*!< Offset: 0x004 Watchdog timer constant register (R/W) */
+  __O  uint32_t FEED;                   /*!< Offset: 0x008 Watchdog feed sequence register (W) */
+  __I  uint32_t TV;                     /*!< Offset: 0x00C Watchdog timer value register (R) */
+       uint32_t RESERVED0;
+  __IO uint32_t WARNINT;				/*!< Offset: 0x014 Watchdog timer warning int. register (R/W) */
+  __IO uint32_t WINDOW;					/*!< Offset: 0x018 Watchdog timer window value register (R/W) */
+} LPC_WDT_TypeDef;
+/*@}*/ /* end of group LPC11xx_WDT */
+
+
+/*------------- Analog-to-Digital Converter (ADC) ----------------------------*/
+/** @addtogroup LPC11xx_ADC LPC11xx Analog-to-Digital Converter 
+  @{
+*/
+typedef struct
+{
+  __IO uint32_t CR;                     /*!< Offset: 0x000       A/D Control Register (R/W) */
+  __IO uint32_t GDR;                    /*!< Offset: 0x004       A/D Global Data Register (R/W) */
+       uint32_t RESERVED0;
+  __IO uint32_t INTEN;                  /*!< Offset: 0x00C       A/D Interrupt Enable Register (R/W) */
+  __IO uint32_t DR[8];                  /*!< Offset: 0x010-0x02C A/D Channel 0..7 Data Register (R/W) */
+  __I  uint32_t STAT;                   /*!< Offset: 0x030       A/D Status Register (R/ ) */
+} LPC_ADC_TypeDef;
+/*@}*/ /* end of group LPC11xx_ADC */
+
+
+/*------------- CAN Controller (CAN) ----------------------------*/
+/** @addtogroup LPC11xx_CAN LPC11xx Controller Area Network(CAN) 
+  @{
+*/
+typedef struct
+{
+  __IO uint32_t CNTL;				/* 0x000 */
+  __IO uint32_t STAT;
+  __IO uint32_t EC;
+  __IO uint32_t BT;
+  __IO uint32_t INT;
+  __IO uint32_t TEST;
+  __IO uint32_t BRPE;
+       uint32_t RESERVED0;
+  __IO uint32_t IF1_CMDREQ;			/* 0x020 */
+  __IO uint32_t IF1_CMDMSK;
+  __IO uint32_t IF1_MSK1;
+  __IO uint32_t IF1_MSK2;
+  __IO uint32_t IF1_ARB1;
+  __IO uint32_t IF1_ARB2;
+  __IO uint32_t IF1_MCTRL;
+  __IO uint32_t IF1_DA1;
+  __IO uint32_t IF1_DA2;
+  __IO uint32_t IF1_DB1;
+  __IO uint32_t IF1_DB2;
+       uint32_t RESERVED1[13];   
+  __IO uint32_t IF2_CMDREQ;			/* 0x080 */
+  __IO uint32_t IF2_CMDMSK;
+  __IO uint32_t IF2_MSK1;
+  __IO uint32_t IF2_MSK2;
+  __IO uint32_t IF2_ARB1;
+  __IO uint32_t IF2_ARB2;
+  __IO uint32_t IF2_MCTRL;
+  __IO uint32_t IF2_DA1;
+  __IO uint32_t IF2_DA2;
+  __IO uint32_t IF2_DB1;
+  __IO uint32_t IF2_DB2;
+       uint32_t RESERVED2[21];
+  __I  uint32_t TXREQ1;				/* 0x100 */
+  __I  uint32_t TXREQ2;
+       uint32_t RESERVED3[6];
+  __I  uint32_t ND1;				/* 0x120 */
+  __I  uint32_t ND2;
+       uint32_t RESERVED4[6];
+  __I  uint32_t IR1;				/* 0x140 */
+  __I  uint32_t IR2;
+       uint32_t RESERVED5[6];
+  __I  uint32_t MSGV1;				/* 0x160 */
+  __I  uint32_t MSGV2;
+       uint32_t RESERVED6[6];
+  __IO uint32_t CLKDIV;				/* 0x180 */
+} LPC_CAN_TypeDef;
+/*@}*/ /* end of group LPC11xx_CAN */
+
+#if defined ( __CC_ARM   )
+#pragma no_anon_unions
+#endif
+
+/******************************************************************************/
+/*                         Peripheral memory map                              */
+/******************************************************************************/
+/* Base addresses                                                             */
+#define LPC_FLASH_BASE        (0x00000000UL)
+#define LPC_RAM_BASE          (0x10000000UL)
+#define LPC_APB0_BASE         (0x40000000UL)
+#define LPC_AHB_BASE          (0x50000000UL)
+
+/* APB0 peripherals                                                           */
+#define LPC_I2C_BASE          (LPC_APB0_BASE + 0x00000)
+#define LPC_WDT_BASE          (LPC_APB0_BASE + 0x04000)
+#define LPC_UART_BASE         (LPC_APB0_BASE + 0x08000)
+#define LPC_CT16B0_BASE       (LPC_APB0_BASE + 0x0C000)
+#define LPC_CT16B1_BASE       (LPC_APB0_BASE + 0x10000)
+#define LPC_CT32B0_BASE       (LPC_APB0_BASE + 0x14000)
+#define LPC_CT32B1_BASE       (LPC_APB0_BASE + 0x18000)
+#define LPC_ADC_BASE          (LPC_APB0_BASE + 0x1C000)
+#define LPC_PMU_BASE          (LPC_APB0_BASE + 0x38000)
+#define LPC_FLASHCTRL_BASE    (LPC_APB0_BASE + 0x3C000)
+#define LPC_SSP0_BASE         (LPC_APB0_BASE + 0x40000)
+#define LPC_IOCON_BASE        (LPC_APB0_BASE + 0x44000)
+#define LPC_SYSCON_BASE       (LPC_APB0_BASE + 0x48000)
+#define LPC_CAN_BASE          (LPC_APB0_BASE + 0x50000)
+#define LPC_SSP1_BASE         (LPC_APB0_BASE + 0x58000)
+
+/* AHB peripherals                                                            */
+#define LPC_GPIO_BASE         (LPC_AHB_BASE  + 0x00000)
+#define LPC_GPIO0_BASE        (LPC_AHB_BASE  + 0x00000)
+#define LPC_GPIO1_BASE        (LPC_AHB_BASE  + 0x10000)
+#define LPC_GPIO2_BASE        (LPC_AHB_BASE  + 0x20000)
+#define LPC_GPIO3_BASE        (LPC_AHB_BASE  + 0x30000)
+
+/******************************************************************************/
+/*                         Peripheral declaration                             */
+/******************************************************************************/
+#define LPC_I2C               ((LPC_I2C_TypeDef    *) LPC_I2C_BASE   )
+#define LPC_WDT               ((LPC_WDT_TypeDef    *) LPC_WDT_BASE   )
+#define LPC_UART              ((LPC_UART_TypeDef   *) LPC_UART_BASE  )
+#define LPC_TMR16B0           ((LPC_TMR_TypeDef    *) LPC_CT16B0_BASE)
+#define LPC_TMR16B1           ((LPC_TMR_TypeDef    *) LPC_CT16B1_BASE)
+#define LPC_TMR32B0           ((LPC_TMR_TypeDef    *) LPC_CT32B0_BASE)
+#define LPC_TMR32B1           ((LPC_TMR_TypeDef    *) LPC_CT32B1_BASE)
+#define LPC_ADC               ((LPC_ADC_TypeDef    *) LPC_ADC_BASE   )
+#define LPC_PMU               ((LPC_PMU_TypeDef    *) LPC_PMU_BASE   )
+#define LPC_FLASHCTRL         ((LPC_FLASHCTRL_Type *) LPC_FLASHCTRL_BASE)
+#define LPC_SSP0              ((LPC_SSP_TypeDef    *) LPC_SSP0_BASE  )
+#define LPC_SSP1              ((LPC_SSP_TypeDef    *) LPC_SSP1_BASE  )
+#define LPC_CAN               ((LPC_CAN_TypeDef    *) LPC_CAN_BASE   )
+#define LPC_IOCON             ((LPC_IOCON_TypeDef  *) LPC_IOCON_BASE )
+#define LPC_SYSCON            ((LPC_SYSCON_TypeDef *) LPC_SYSCON_BASE)
+#define LPC_GPIO0             ((LPC_GPIO_TypeDef   *) LPC_GPIO0_BASE )
+#define LPC_GPIO1             ((LPC_GPIO_TypeDef   *) LPC_GPIO1_BASE )
+#define LPC_GPIO2             ((LPC_GPIO_TypeDef   *) LPC_GPIO2_BASE )
+#define LPC_GPIO3             ((LPC_GPIO_TypeDef   *) LPC_GPIO3_BASE )
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __LPC11xx_H__ */
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/LPC11Uxx.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,670 +0,0 @@
-
-/****************************************************************************************************//**
- * @file     LPC11Uxx.h
- *
- *
- * @brief    CMSIS Cortex-M0 Core Peripheral Access Layer Header File for
- *           default LPC11Uxx Device Series
- *
- * @version  V0.1
- * @date     21. March 2011
- *
- * @note     Generated with SFDGen V2.6 Build 3j (beta) on Thursday, 17.03.2011 13:19:45
- *
- *           from CMSIS SVD File 'LPC11U1x_svd.xml' Version 0.1,
- *           created on Wednesday, 16.03.2011 20:30:42, last modified on Thursday, 17.03.2011 20:19:40
- *
- *******************************************************************************************************/
-
-// ################################################################################
-// Minor fix 8 April 2011 - changed LPC_CT32B1_BASE from 0x40014000 to 0x40018000
-// ################################################################################
-
-/** @addtogroup NXP
-  * @{
-  */
-
-/** @addtogroup LPC11Uxx
-  * @{
-  */
-
-#ifndef __LPC11UXX_H__
-#define __LPC11UXX_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-
-#if defined ( __CC_ARM   )
-  #pragma anon_unions
-#endif
-
- /* Interrupt Number Definition */
-
-typedef enum {
-// -------------------------  Cortex-M0 Processor Exceptions Numbers  -----------------------------
-  Reset_IRQn                        = -15,  /*!<   1  Reset Vector, invoked on Power up and warm reset */
-  NonMaskableInt_IRQn               = -14,  /*!<   2  Non maskable Interrupt, cannot be stopped or preempted */
-  HardFault_IRQn                    = -13,  /*!<   3  Hard Fault, all classes of Fault */
-  SVCall_IRQn                       = -5,   /*!<  11  System Service Call via SVC instruction */
-  DebugMonitor_IRQn                 = -4,   /*!<  12  Debug Monitor                    */
-  PendSV_IRQn                       = -2,   /*!<  14  Pendable request for system service */
-  SysTick_IRQn                      = -1,   /*!<  15  System Tick Timer                */
-// ---------------------------  LPC11Uxx Specific Interrupt Numbers  ------------------------------
-FLEX_INT0_IRQn                = 0,        /*!< All I/O pins can be routed to below 8 interrupts. */
-  FLEX_INT1_IRQn                = 1,
-  FLEX_INT2_IRQn                = 2,
-  FLEX_INT3_IRQn                = 3,
-  FLEX_INT4_IRQn                = 4,   
-  FLEX_INT5_IRQn                = 5,        
-  FLEX_INT6_IRQn                = 6,        
-  FLEX_INT7_IRQn                = 7,        
-  GINT0_IRQn                    = 8,        /*!< Grouped Interrupt 0                              */
-  GINT1_IRQn                    = 9,        /*!< Grouped Interrupt 1                              */
-  Reserved0_IRQn                = 10,       /*!< Reserved Interrupt                               */
-  Reserved1_IRQn                = 11,       
-  Reserved2_IRQn                = 12,       
-  Reserved3_IRQn                = 13,       
-  SSP1_IRQn                     = 14,       /*!< SSP1 Interrupt                                   */
-  I2C_IRQn                      = 15,       /*!< I2C Interrupt                                    */
-  TIMER_16_0_IRQn               = 16,       /*!< 16-bit Timer0 Interrupt                          */
-  TIMER_16_1_IRQn               = 17,       /*!< 16-bit Timer1 Interrupt                          */
-  TIMER_32_0_IRQn               = 18,       /*!< 32-bit Timer0 Interrupt                          */
-  TIMER_32_1_IRQn               = 19,       /*!< 32-bit Timer1 Interrupt                          */
-  SSP0_IRQn                     = 20,       /*!< SSP0 Interrupt                                   */
-  UART_IRQn                     = 21,       /*!< UART Interrupt                                   */
-  USB_IRQn                      = 22,       /*!< USB IRQ Interrupt                                */
-  USB_FIQn                      = 23,       /*!< USB FIQ Interrupt                                */
-  ADC_IRQn                      = 24,       /*!< A/D Converter Interrupt                          */
-  WDT_IRQn                      = 25,       /*!< Watchdog timer Interrupt                         */  
-  BOD_IRQn                      = 26,       /*!< Brown Out Detect(BOD) Interrupt                  */
-  FMC_IRQn                      = 27,       /*!< Flash Memory Controller Interrupt                */
-  Reserved4_IRQn                = 28,       /*!< Reserved Interrupt                               */
-  Reserved5_IRQn                = 29,       /*!< Reserved Interrupt                               */
-  USBWakeup_IRQn                = 30,       /*!< USB wakeup Interrupt                             */
-  Reserved6_IRQn                = 31,       /*!< Reserved Interrupt                               */
-} IRQn_Type;
-
-
-/** @addtogroup Configuration_of_CMSIS
-  * @{
-  */
-
-/* Processor and Core Peripheral Section */ /* Configuration of the Cortex-M0 Processor and Core Peripherals */
-
-#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 */
-/** @} */ /* End of group Configuration_of_CMSIS */
-
-#include "core_cm0.h"                       /*!< Cortex-M0 processor and core peripherals */
-#include "system_LPC11Uxx.h"                /*!< LPC11Uxx System                       */
-
-/** @addtogroup Device_Peripheral_Registers
-  * @{
-  */
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                          I2C                                         -----
-// ------------------------------------------------------------------------------------------------
-
-
-/**
-  * @brief Product name title=UM10462 Chapter title=LPC11U1x I2C-bus controller Modification date=3/16/2011 Major revision=0 Minor revision=3  (I2C)
-  */
-
-typedef struct {                            /*!< (@ 0x40000000) I2C Structure          */
-  __IO uint32_t CONSET;                     /*!< (@ 0x40000000) I2C Control Set Register */
-  __I  uint32_t STAT;                       /*!< (@ 0x40000004) I2C Status Register */
-  __IO uint32_t DAT;                        /*!< (@ 0x40000008) I2C Data Register.  */
-  __IO uint32_t ADR0;                       /*!< (@ 0x4000000C) I2C Slave Address Register 0 */
-  __IO uint32_t SCLH;                       /*!< (@ 0x40000010) SCH Duty Cycle Register High Half Word */
-  __IO uint32_t SCLL;                       /*!< (@ 0x40000014) SCL Duty Cycle Register Low Half Word */
-  __IO uint32_t CONCLR;                     /*!< (@ 0x40000018) I2C Control Clear Register*/
-  __IO uint32_t MMCTRL;                     /*!< (@ 0x4000001C) Monitor mode control register*/
-  __IO uint32_t ADR1;                       /*!< (@ 0x40000020) I2C Slave Address Register 1*/
-  __IO uint32_t ADR2;                       /*!< (@ 0x40000024) I2C Slave Address Register 2*/
-  __IO uint32_t ADR3;                       /*!< (@ 0x40000028) I2C Slave Address Register 3*/
-  __I  uint32_t DATA_BUFFER;                /*!< (@ 0x4000002C) Data buffer register */
-union{
-  __IO uint32_t MASK[4];                    /*!< (@ 0x40000030) I2C Slave address mask register */
-  struct{
-  __IO uint32_t MASK0;
-  __IO uint32_t MASK1;
-  __IO uint32_t MASK2;
-  __IO uint32_t MASK3;
-  };
-  };
-} LPC_I2C_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                         WWDT                                         -----
-// ------------------------------------------------------------------------------------------------
-
-
-/**
-  * @brief Product name title=UM10462 Chapter title=LPC11U1x Windowed Watchdog Timer (WWDT) Modification date=3/16/2011 Major revision=0 Minor revision=3  (WWDT)
-  */
-
-typedef struct {                            /*!< (@ 0x40004000) WWDT Structure         */
-  __IO uint32_t MOD;                        /*!< (@ 0x40004000) Watchdog mode register*/
-  __IO uint32_t TC;                         /*!< (@ 0x40004004) Watchdog timer constant register */
-  __IO uint32_t FEED;                       /*!< (@ 0x40004008) Watchdog feed sequence register */
-  __I  uint32_t TV;                         /*!< (@ 0x4000400C) Watchdog timer value register */
-  __IO uint32_t CLKSEL;                     /*!< (@ 0x40004010) Watchdog clock select register. */
-  __IO uint32_t WARNINT;                    /*!< (@ 0x40004014) Watchdog Warning Interrupt compare value. */
-  __IO uint32_t WINDOW;                     /*!< (@ 0x40004018) Watchdog Window compare value. */
-} LPC_WWDT_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                         USART                                        -----
-// ------------------------------------------------------------------------------------------------
-
-
-/**
-  * @brief Product name title=UM10462 Chapter title=LPC11U1x USART Modification date=3/16/2011 Major revision=0 Minor revision=3  (USART)
-  */
-
-typedef struct {                            /*!< (@ 0x40008000) USART Structure        */
-  
-  union {
-    __IO uint32_t DLL;                      /*!< (@ 0x40008000) Divisor Latch LSB. Least significant byte of the baud rate divisor value. The full divisor is used to generate a baud rate from the fractional rate divider. (DLAB=1) */
-    __O  uint32_t THR;                      /*!< (@ 0x40008000) Transmit Holding Register. The next character to be transmitted is written here. (DLAB=0) */
-    __I  uint32_t RBR;                      /*!< (@ 0x40008000) Receiver Buffer Register. Contains the next received character to be read. (DLAB=0) */
-  };
-  
-  union {
-    __IO uint32_t IER;                      /*!< (@ 0x40008004) Interrupt Enable Register. Contains individual interrupt enable bits for the 7 potential USART interrupts. (DLAB=0) */
-    __IO uint32_t DLM;                      /*!< (@ 0x40008004) Divisor Latch MSB. Most significant byte of the baud rate divisor value. The full divisor is used to generate a baud rate from the fractional rate divider. (DLAB=1) */
-  };
-  
-  union {
-    __O  uint32_t FCR;                      /*!< (@ 0x40008008) FIFO Control Register. Controls USART FIFO usage and modes. */
-    __I  uint32_t IIR;                      /*!< (@ 0x40008008) Interrupt ID Register. Identifies which interrupt(s) are pending. */
-  };
-  __IO uint32_t LCR;                        /*!< (@ 0x4000800C) Line Control Register. Contains controls for frame formatting and break generation. */
-  __IO uint32_t MCR;                        /*!< (@ 0x40008010) Modem Control Register. */
-  __I  uint32_t LSR;                        /*!< (@ 0x40008014) Line Status Register. Contains flags for transmit and receive status, including line errors. */
-  __I  uint32_t MSR;                        /*!< (@ 0x40008018) Modem Status Register. */
-  __IO uint32_t SCR;                        /*!< (@ 0x4000801C) Scratch Pad Register. Eight-bit temporary storage for software. */
-  __IO uint32_t ACR;                        /*!< (@ 0x40008020) Auto-baud Control Register. Contains controls for the auto-baud feature. */
-  __IO uint32_t ICR;                        /*!< (@ 0x40008024) IrDA Control Register. Enables and configures the IrDA (remote control) mode. */
-  __IO uint32_t FDR;                        /*!< (@ 0x40008028) Fractional Divider Register. Generates a clock input for the baud rate divider. */
-  __IO uint32_t OSR;                        /*!< (@ 0x4000802C) Oversampling Register. Controls the degree of oversampling during each bit time. */
-  __IO uint32_t TER;                        /*!< (@ 0x40008030) Transmit Enable Register. Turns off USART transmitter for use with software flow control. */
-  __I  uint32_t RESERVED0[3];
-  __IO uint32_t HDEN;                       /*!< (@ 0x40008040) Half duplex enable register. */
-  __I  uint32_t RESERVED1;
-  __IO uint32_t SCICTRL;                    /*!< (@ 0x40008048) Smart Card Interface Control register. Enables and configures the Smart Card Interface feature. */
-  __IO uint32_t RS485CTRL;                  /*!< (@ 0x4000804C) RS-485/EIA-485 Control. Contains controls to configure various aspects of RS-485/EIA-485 modes. */
-  __IO uint32_t RS485ADRMATCH;              /*!< (@ 0x40008050) RS-485/EIA-485 address match. Contains the address match value for RS-485/EIA-485 mode. */
-  __IO uint32_t RS485DLY;                   /*!< (@ 0x40008054) RS-485/EIA-485 direction control delay. */
-  __IO uint32_t SYNCCTRL; 
-} LPC_USART_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                        Timer                                       -----
-// ------------------------------------------------------------------------------------------------
-
-
-/**
-  * @brief Product name title=UM10462 Chapter title=LPC11U1x 32-bitcounter/timers CT32B0/1 Modification date=3/16/2011 Major revision=0 Minor revision=3  
-  */
-
-typedef struct {                            /*!< (@ 0x40014000) CT32B0 Structure        */
-  __IO uint32_t IR;                         /*!< (@ 0x40014000) Interrupt Register      */
-  __IO uint32_t TCR;                        /*!< (@ 0x40014004) Timer Control Register  */
-  __IO uint32_t TC;                         /*!< (@ 0x40014008) Timer Counter 		*/
-  __IO uint32_t PR;                         /*!< (@ 0x4001400C) Prescale Register  	*/
-  __IO uint32_t PC;                         /*!< (@ 0x40014010) Prescale Counter	 */
-  __IO uint32_t MCR;                        /*!< (@ 0x40014014) Match Control Register */
-  union {
-  __IO uint32_t MR[4];                      /*!< (@ 0x40014018) Match Register */
-  struct{
-  __IO uint32_t MR0;                        /*!< (@ 0x40018018) Match Register. MR0 */
-  __IO uint32_t MR1;                        /*!< (@ 0x4001801C) Match Register. MR1 */
-  __IO uint32_t MR2;                        /*!< (@ 0x40018020) Match Register. MR2 */
-  __IO uint32_t MR3;                        /*!< (@ 0x40018024) Match Register. MR3 */
-  };
-  };
-  __IO uint32_t CCR;                        /*!< (@ 0x40014028) Capture Control Register */
-  union{
-  __I  uint32_t CR[4];                      /*!< (@ 0x4001402C) Capture Register  */
-    struct{
-  __I  uint32_t CR0;			    /*!< (@ 0x4001802C) Capture Register. CR 0 */
-  __I  uint32_t CR1;			    /*!< (@ 0x40018030) Capture Register. CR 1 */
-  __I  uint32_t CR2;			    /*!< (@ 0x40018034) Capture Register. CR 2 */
-  __I  uint32_t CR3;			    /*!< (@ 0x40018038) Capture Register. CR 3 */
-  };
-  };
-__IO uint32_t EMR;                        /*!< (@ 0x4001403C) External Match Register */
-  __I  uint32_t RESERVED0[12];
-  __IO uint32_t CTCR;                       /*!< (@ 0x40014070) Count Control Register */
-  __IO uint32_t PWMC;                       /*!< (@ 0x40014074) PWM Control Register */
-} LPC_CTxxBx_Type;
-
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                          ADC                                         -----
-// ------------------------------------------------------------------------------------------------
-
-
-/**
-  * @brief Product name title=UM10462 Chapter title=LPC11U1x ADC Modification date=3/16/2011 Major revision=0 Minor revision=3  (ADC)
-  */
-
-typedef struct {                            /*!< (@ 0x4001C000) ADC Structure          */
-  __IO uint32_t CR;                         /*!< (@ 0x4001C000) A/D Control Register */
-  __IO uint32_t GDR;                        /*!< (@ 0x4001C004) A/D Global Data Register */
-  __I  uint32_t RESERVED0[1];
-  __IO uint32_t INTEN;                      /*!< (@ 0x4001C00C) A/D Interrupt Enable Register */
-  union{
-  __I  uint32_t DR[8];                      /*!< (@ 0x4001C010) A/D Channel Data Register*/
-    struct{
-  __IO uint32_t DR0;                      	/*!< (@ 0x40020010) A/D Channel Data Register 0*/
-  __IO uint32_t DR1;                      	/*!< (@ 0x40020014) A/D Channel Data Register 1*/
-  __IO uint32_t DR2;                      	/*!< (@ 0x40020018) A/D Channel Data Register 2*/
-  __IO uint32_t DR3;                      	/*!< (@ 0x4002001C) A/D Channel Data Register 3*/
-  __IO uint32_t DR4;                      	/*!< (@ 0x40020020) A/D Channel Data Register 4*/
-  __IO uint32_t DR5;                      	/*!< (@ 0x40020024) A/D Channel Data Register 5*/
-  __IO uint32_t DR6;                      	/*!< (@ 0x40020028) A/D Channel Data Register 6*/
-  __IO uint32_t DR7;                      	/*!< (@ 0x4002002C) A/D Channel Data Register 7*/
-  };
-  };
-  __I  uint32_t STAT;                       /*!< (@ 0x4001C030) A/D Status Register.  */
-} LPC_ADC_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                          PMU                                         -----
-// ------------------------------------------------------------------------------------------------
-
-
-/**
-  * @brief Product name title=UM10462 Chapter title=LPC11U1x Power Management Unit (PMU) Modification date=3/16/2011 Major revision=0 Minor revision=3  (PMU)
-  */
-
-typedef struct {                            /*!< (@ 0x40038000) PMU Structure          */
-  __IO uint32_t PCON;                       /*!< (@ 0x40038000) Power control register */
-  union{
-  __IO uint32_t GPREG[4];                   /*!< (@ 0x40038004) General purpose register 0 */
-  struct{
-  __IO uint32_t GPREG0;                   	/*!< (@ 0x40038004) General purpose register 0 */
-  __IO uint32_t GPREG1;                   	/*!< (@ 0x40038008) General purpose register 1 */
-  __IO uint32_t GPREG2;                   	/*!< (@ 0x4003800C) General purpose register 2 */
-  __IO uint32_t GPREG3;                   	/*!< (@ 0x40038010) General purpose register 3 */
-  };
-  };
-} LPC_PMU_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                       FLASHCTRL                                      -----
-// ------------------------------------------------------------------------------------------------
-
-
-/**
-  * @brief Product name title=UM10462 Chapter title=LPC11U1x Flash programming firmware Modification date=3/17/2011 Major revision=0 Minor revision=3  (FLASHCTRL)
-  */
-
-typedef struct {                            /*!< (@ 0x4003C000) FLASHCTRL Structure    */
-  __I  uint32_t RESERVED0[4];
-  __IO uint32_t FLASHCFG;                   /*!< (@ 0x4003C010) Flash memory access time configuration register */
-  __I  uint32_t RESERVED1[3];
-  __IO uint32_t FMSSTART;                   /*!< (@ 0x4003C020) Signature start address register */
-  __IO uint32_t FMSSTOP;                    /*!< (@ 0x4003C024) Signature stop-address register */
-  __I  uint32_t RESERVED2[1];
-  __I  uint32_t FMSW0;                      /*!< (@ 0x4003C02C) Word 0 [31:0]          */
-  __I  uint32_t FMSW1;                      /*!< (@ 0x4003C030) Word 1 [63:32]         */
-  __I  uint32_t FMSW2;                      /*!< (@ 0x4003C034) Word 2 [95:64]         */
-  __I  uint32_t FMSW3;                      /*!< (@ 0x4003C038) Word 3 [127:96]        */
-  __I  uint32_t RESERVED3[1001];
-  __I  uint32_t FMSTAT;                     /*!< (@ 0x4003CFE0) Signature generation status register */
-  __I  uint32_t RESERVED4[1];
-  __IO uint32_t FMSTATCLR;                  /*!< (@ 0x4003CFE8) Signature generation status clear register */
-} LPC_FLASHCTRL_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                         SSP0/1                                         -----
-// ------------------------------------------------------------------------------------------------
-
-
-/**
-  * @brief Product name title=UM10462 Chapter title=LPC11U1x SSP/SPI Modification date=3/16/2011 Major revision=0 Minor revision=3  (SSP0)
-  */
-
-typedef struct {                            /*!< (@ 0x40040000) SSP0 Structure         */
-  __IO uint32_t CR0;                        /*!< (@ 0x40040000) Control Register 0. Selects the serial clock rate, bus type, and data size. */
-  __IO uint32_t CR1;                        /*!< (@ 0x40040004) Control Register 1. Selects master/slave and other modes. */
-  __IO uint32_t DR;                         /*!< (@ 0x40040008) Data Register. Writes fill the transmit FIFO, and reads empty the receive FIFO. */
-  __I  uint32_t SR;                         /*!< (@ 0x4004000C) Status Register        */
-  __IO uint32_t CPSR;                       /*!< (@ 0x40040010) Clock Prescale Register */
-  __IO uint32_t IMSC;                       /*!< (@ 0x40040014) Interrupt Mask Set and Clear Register */
-  __I  uint32_t RIS;                        /*!< (@ 0x40040018) Raw Interrupt Status Register */
-  __I  uint32_t MIS;                        /*!< (@ 0x4004001C) Masked Interrupt Status Register */
-  __IO uint32_t ICR;                        /*!< (@ 0x40040020) SSPICR Interrupt Clear Register */
-} LPC_SSPx_Type;
-
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                       IOCONFIG                                       -----
-// ------------------------------------------------------------------------------------------------
-
-
-/**
-  * @brief Product name title=UM10462 Chapter title=LPC11U1x I/O configuration Modification date=3/16/2011 Major revision=0 Minor revision=3  (IOCONFIG)
-  */
-
-typedef struct {                            /*!< (@ 0x40044000) IOCONFIG Structure     */
-  __IO uint32_t RESET_PIO0_0;               /*!< (@ 0x40044000) I/O configuration for pin RESET/PIO0_0 */
-  __IO uint32_t PIO0_1;                     /*!< (@ 0x40044004) I/O configuration for pin PIO0_1/CLKOUT/CT32B0_MAT2/USB_FTOGGLE */
-  __IO uint32_t PIO0_2;                     /*!< (@ 0x40044008) I/O configuration for pin PIO0_2/SSEL0/CT16B0_CAP0 */
-  __IO uint32_t PIO0_3;                     /*!< (@ 0x4004400C) I/O configuration for pin PIO0_3/USB_VBUS */
-  __IO uint32_t PIO0_4;                     /*!< (@ 0x40044010) I/O configuration for pin PIO0_4/SCL */
-  __IO uint32_t PIO0_5;                     /*!< (@ 0x40044014) I/O configuration for pin PIO0_5/SDA */
-  __IO uint32_t PIO0_6;                     /*!< (@ 0x40044018) I/O configuration for pin PIO0_6/USB_CONNECT/SCK0 */
-  __IO uint32_t PIO0_7;                     /*!< (@ 0x4004401C) I/O configuration for pin PIO0_7/CTS */
-  __IO uint32_t PIO0_8;                     /*!< (@ 0x40044020) I/O configuration for pin PIO0_8/MISO0/CT16B0_MAT0 */
-  __IO uint32_t PIO0_9;                     /*!< (@ 0x40044024) I/O configuration for pin PIO0_9/MOSI0/CT16B0_MAT1 */
-  __IO uint32_t SWCLK_PIO0_10;              /*!< (@ 0x40044028) I/O configuration for pin SWCLK/PIO0_10/ SCK0/CT16B0_MAT2 */
-  __IO uint32_t TDI_PIO0_11;                /*!< (@ 0x4004402C) I/O configuration for pin TDI/PIO0_11/AD0/CT32B0_MAT3 */
-  __IO uint32_t TMS_PIO0_12;                /*!< (@ 0x40044030) I/O configuration for pin TMS/PIO0_12/AD1/CT32B1_CAP0 */
-  __IO uint32_t TDO_PIO0_13;                /*!< (@ 0x40044034) I/O configuration for pin TDO/PIO0_13/AD2/CT32B1_MAT0 */
-  __IO uint32_t TRST_PIO0_14;               /*!< (@ 0x40044038) I/O configuration for pin TRST/PIO0_14/AD3/CT32B1_MAT1 */
-  __IO uint32_t SWDIO_PIO0_15;              /*!< (@ 0x4004403C) I/O configuration for pin SWDIO/PIO0_15/AD4/CT32B1_MAT2 */
-  __IO uint32_t PIO0_16;                    /*!< (@ 0x40044040) I/O configuration for pin PIO0_16/AD5/CT32B1_MAT3/ WAKEUP */
-  __IO uint32_t PIO0_17;                    /*!< (@ 0x40044044) I/O configuration for pin PIO0_17/RTS/CT32B0_CAP0/SCLK */
-  __IO uint32_t PIO0_18;                    /*!< (@ 0x40044048) I/O configuration for pin PIO0_18/RXD/CT32B0_MAT0 */
-  __IO uint32_t PIO0_19;                    /*!< (@ 0x4004404C) I/O configuration for pin PIO0_19/TXD/CT32B0_MAT1 */
-  __IO uint32_t PIO0_20;                    /*!< (@ 0x40044050) I/O configuration for pin PIO0_20/CT16B1_CAP0 */
-  __IO uint32_t PIO0_21;                    /*!< (@ 0x40044054) I/O configuration for pin PIO0_21/CT16B1_MAT0/MOSI1 */
-  __IO uint32_t PIO0_22;                    /*!< (@ 0x40044058) I/O configuration for pin PIO0_22/AD6/CT16B1_MAT1/MISO1 */
-  __IO uint32_t PIO0_23;                    /*!< (@ 0x4004405C) I/O configuration for pin PIO0_23/AD7 */
-  __IO uint32_t PIO1_0;                 /*!< Offset: 0x060 */
-  __IO uint32_t PIO1_1;         
-  __IO uint32_t PIO1_2;       
-  __IO uint32_t PIO1_3;      
-  __IO uint32_t PIO1_4;                 /*!< Offset: 0x070 */
-  __IO uint32_t PIO1_5;                     /*!< (@ 0x40044074) I/O configuration for pin PIO1_5/CT32B1_CAP1 */
-  __IO uint32_t PIO1_6;     
-  __IO uint32_t PIO1_7;       
-  __IO uint32_t PIO1_8;                 /*!< Offset: 0x080 */
-  __IO uint32_t PIO1_9;        
-  __IO uint32_t PIO1_10;        
-  __IO uint32_t PIO1_11;       
-  __IO uint32_t PIO1_12;                /*!< Offset: 0x090 */
-  __IO uint32_t PIO1_13;                    /*!< (@ 0x40044094) I/O configuration for pin PIO1_13/DTR/CT16B0_MAT0/TXD */
-  __IO uint32_t PIO1_14;                    /*!< (@ 0x40044098) I/O configuration for pin PIO1_14/DSR/CT16B0_MAT1/RXD */
-  __IO uint32_t PIO1_15;                    /*!< (@ 0x4004409C) I/O configuration for pin PIO1_15/DCD/ CT16B0_MAT2/SCK1 */
-  __IO uint32_t PIO1_16;                    /*!< (@ 0x400440A0) I/O configuration for pin PIO1_16/RI/CT16B0_CAP0 */
-  __IO uint32_t PIO1_17;
-  __IO uint32_t PIO1_18;
-  __IO uint32_t PIO1_19;                    /*!< (@ 0x400440AC) I/O configuration for pin PIO1_19/DTR/SSEL1 */
-  __IO uint32_t PIO1_20;                    /*!< (@ 0x400440B0) I/O configuration for pin PIO1_20/DSR/SCK1 */
-  __IO uint32_t PIO1_21;                    /*!< (@ 0x400440B4) I/O configuration for pin PIO1_21/DCD/MISO1 */
-  __IO uint32_t PIO1_22;                    /*!< (@ 0x400440B8) I/O configuration for pin PIO1_22/RI/MOSI1 */
-  __IO uint32_t PIO1_23;                    /*!< (@ 0x400440BC) I/O configuration for pin PIO1_23/CT16B1_MAT1/SSEL1 */
-  __IO uint32_t PIO1_24;                    /*!< (@ 0x400440C0) I/O configuration for pin PIO1_24/ CT32B0_MAT0 */
-  __IO uint32_t PIO1_25;                    /*!< (@ 0x400440C4) I/O configuration for pin PIO1_25/CT32B0_MAT1 */
-  __IO uint32_t PIO1_26;                    /*!< (@ 0x400440C8) I/O configuration for pin PIO1_26/CT32B0_MAT2/ RXD */
-  __IO uint32_t PIO1_27;                    /*!< (@ 0x400440CC) I/O configuration for pin PIO1_27/CT32B0_MAT3/ TXD */
-  __IO uint32_t PIO1_28;                    /*!< (@ 0x400440D0) I/O configuration for pin PIO1_28/CT32B0_CAP0/ SCLK */
-  __IO uint32_t PIO1_29;                    /*!< (@ 0x400440D4) I/O configuration for pin PIO1_29/SCK0/ CT32B0_CAP1 */
-  __IO uint32_t PIO1_30;
-  __IO uint32_t PIO1_31;                    /*!< (@ 0x400440DC) I/O configuration for pin PIO1_31 */
-} LPC_IOCON_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                        SYSCON                                        -----
-// ------------------------------------------------------------------------------------------------
-
-
-/**
-  * @brief Product name title=UM10462 Chapter title=LPC11U1x System control block Modification date=3/16/2011 Major revision=0 Minor revision=3  (SYSCON)
-  */
-
-typedef struct {                            /*!< (@ 0x40048000) SYSCON Structure       */
-  __IO uint32_t SYSMEMREMAP;                /*!< (@ 0x40048000) System memory remap    */
-  __IO uint32_t PRESETCTRL;                 /*!< (@ 0x40048004) Peripheral reset control */
-  __IO uint32_t SYSPLLCTRL;                 /*!< (@ 0x40048008) System PLL control     */
-  __I  uint32_t SYSPLLSTAT;                 /*!< (@ 0x4004800C) System PLL status      */
-  __IO uint32_t USBPLLCTRL;                 /*!< (@ 0x40048010) USB PLL control        */
-  __I  uint32_t USBPLLSTAT;                 /*!< (@ 0x40048014) USB PLL status         */
-  __I  uint32_t RESERVED0[2];
-  __IO uint32_t SYSOSCCTRL;                 /*!< (@ 0x40048020) System oscillator control */
-  __IO uint32_t WDTOSCCTRL;                 /*!< (@ 0x40048024) Watchdog oscillator control */
-  __I  uint32_t RESERVED1[2];
-  __IO uint32_t SYSRSTSTAT;                 /*!< (@ 0x40048030) System reset status register */
-  __I  uint32_t RESERVED2[3];
-  __IO uint32_t SYSPLLCLKSEL;               /*!< (@ 0x40048040) System PLL clock source select */
-  __IO uint32_t SYSPLLCLKUEN;               /*!< (@ 0x40048044) System PLL clock source update enable */
-  __IO uint32_t USBPLLCLKSEL;               /*!< (@ 0x40048048) USB PLL clock source select */
-  __IO uint32_t USBPLLCLKUEN;               /*!< (@ 0x4004804C) USB PLL clock source update enable */
-  __I  uint32_t RESERVED3[8];
-  __IO uint32_t MAINCLKSEL;                 /*!< (@ 0x40048070) Main clock source select */
-  __IO uint32_t MAINCLKUEN;                 /*!< (@ 0x40048074) Main clock source update enable */
-  __IO uint32_t SYSAHBCLKDIV;               /*!< (@ 0x40048078) System clock divider   */
-  __I  uint32_t RESERVED4[1];
-  __IO uint32_t SYSAHBCLKCTRL;              /*!< (@ 0x40048080) System clock control   */
-  __I  uint32_t RESERVED5[4];
-  __IO uint32_t SSP0CLKDIV;                 /*!< (@ 0x40048094) SSP0 clock divider     */
-  __IO uint32_t UARTCLKDIV;                 /*!< (@ 0x40048098) UART clock divider     */
-  __IO uint32_t SSP1CLKDIV;                 /*!< (@ 0x4004809C) SSP1 clock divider     */
-  __I  uint32_t RESERVED6[8];
-  __IO uint32_t USBCLKSEL;                  /*!< (@ 0x400480C0) USB clock source select */
-  __IO uint32_t USBCLKUEN;                  /*!< (@ 0x400480C4) USB clock source update enable */
-  __IO uint32_t USBCLKDIV;                  /*!< (@ 0x400480C8) USB clock source divider */
-  __I  uint32_t RESERVED7[5];
-  __IO uint32_t CLKOUTSEL;                  /*!< (@ 0x400480E0) CLKOUT clock source select */
-  __IO uint32_t CLKOUTUEN;                  /*!< (@ 0x400480E4) CLKOUT clock source update enable */
-  __IO uint32_t CLKOUTDIV;                  /*!< (@ 0x400480E8) CLKOUT clock divider   */
-  __I  uint32_t RESERVED8[5];
-  __I  uint32_t PIOPORCAP0;                 /*!< (@ 0x40048100) POR captured PIO status 0 */
-  __I  uint32_t PIOPORCAP1;                 /*!< (@ 0x40048104) POR captured PIO status 1 */
-  __I  uint32_t RESERVED9[18];
-  __IO uint32_t BODCTRL;                    /*!< (@ 0x40048150) Brown-Out Detect       */
-  __IO uint32_t SYSTCKCAL;                  /*!< (@ 0x40048154) System tick counter calibration */
-  __I  uint32_t RESERVED10[6];
-  __IO uint32_t IRQLATENCY;                 /*!< (@ 0x40048170) IQR delay */
-  __IO uint32_t NMISRC;                     /*!< (@ 0x40048174) NMI Source Control     */
-  __IO uint32_t PINTSEL[8];                 /*!< (@ 0x40048178) GPIO Pin Interrupt Select register 0 */
-  __IO uint32_t USBCLKCTRL;                 /*!< (@ 0x40048198) USB clock control      */
-  __I  uint32_t USBCLKST;                   /*!< (@ 0x4004819C) USB clock status       */
-  __I  uint32_t RESERVED11[25];
-  __IO uint32_t STARTERP0;                  /*!< (@ 0x40048204) Start logic 0 interrupt wake-up enable register 0 */
-  __I  uint32_t RESERVED12[3];
-  __IO uint32_t STARTERP1;                  /*!< (@ 0x40048214) Start logic 1 interrupt wake-up enable register 1 */
-  __I  uint32_t RESERVED13[6];
-  __IO uint32_t PDSLEEPCFG;                 /*!< (@ 0x40048230) Power-down states in deep-sleep mode */
-  __IO uint32_t PDAWAKECFG;                 /*!< (@ 0x40048234) Power-down states for wake-up from deep-sleep */
-  __IO uint32_t PDRUNCFG;                   /*!< (@ 0x40048238) Power configuration register */
-  __I  uint32_t RESERVED14[110];
-  __I  uint32_t DEVICE_ID;                  /*!< (@ 0x400483F4) Device ID              */
-} LPC_SYSCON_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                     GPIO_PIN_INT                                     -----
-// ------------------------------------------------------------------------------------------------
-
-
-/**
-  * @brief Product name title=UM10462 Chapter title=LPC11U1x GPIO Modification date=3/17/2011 Major revision=0 Minor revision=3  (GPIO_PIN_INT)
-  */
-
-typedef struct {                            /*!< (@ 0x4004C000) GPIO_PIN_INT Structure */
-  __IO uint32_t ISEL;                       /*!< (@ 0x4004C000) Pin Interrupt Mode register */
-  __IO uint32_t IENR;                       /*!< (@ 0x4004C004) Pin Interrupt Enable (Rising) register */
-  __IO uint32_t SIENR;                      /*!< (@ 0x4004C008) Set Pin Interrupt Enable (Rising) register */
-  __IO uint32_t CIENR;                      /*!< (@ 0x4004C00C) Clear Pin Interrupt Enable (Rising) register */
-  __IO uint32_t IENF;                       /*!< (@ 0x4004C010) Pin Interrupt Enable Falling Edge / Active Level register */
-  __IO uint32_t SIENF;                      /*!< (@ 0x4004C014) Set Pin Interrupt Enable Falling Edge / Active Level register */
-  __IO uint32_t CIENF;                      /*!< (@ 0x4004C018) Clear Pin Interrupt Enable Falling Edge / Active Level address */
-  __IO uint32_t RISE;                       /*!< (@ 0x4004C01C) Pin Interrupt Rising Edge register */
-  __IO uint32_t FALL;                       /*!< (@ 0x4004C020) Pin Interrupt Falling Edge register */
-  __IO uint32_t IST;                        /*!< (@ 0x4004C024) Pin Interrupt Status register */
-} LPC_GPIO_PIN_INT_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                    GPIO_GROUP_INT0/1                                   -----
-// ------------------------------------------------------------------------------------------------
-
-
-/**
-  * @brief Product name title=UM10462 Chapter title=LPC11U1x GPIO Modification date=3/17/2011 Major revision=0 Minor revision=3  (GPIO_GROUP_INT0)
-  */
-
-typedef struct {                            /*!< (@ 0x4005C000) GPIO_GROUP_INT0 Structure */
-  __IO uint32_t CTRL;                       /*!< (@ 0x4005C000) GPIO grouped interrupt control register */
-  __I  uint32_t RESERVED0[7];
-  __IO uint32_t PORT_POL[2];                /*!< (@ 0x4005C020) GPIO grouped interrupt port 0 polarity register */
-  __I  uint32_t RESERVED1[6];
-  __IO uint32_t PORT_ENA[2];                /*!< (@ 0x4005C040) GPIO grouped interrupt port 0/1 enable register */
-} LPC_GPIO_GROUP_INTx_Type;
-
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                          USB                                         -----
-// ------------------------------------------------------------------------------------------------
-
-
-/**
-  * @brief Product name title=UM10462 Chapter title=LPC11U1x USB2.0device controller Modification date=3/16/2011 Major revision=0 Minor revision=3  (USB)
-  */
-
-typedef struct {                            /*!< (@ 0x40080000) USB Structure          */
-  __IO uint32_t DEVCMDSTAT;                 /*!< (@ 0x40080000) USB Device Command/Status register */
-  __IO uint32_t INFO;                       /*!< (@ 0x40080004) USB Info register      */
-  __IO uint32_t EPLISTSTART;                /*!< (@ 0x40080008) USB EP Command/Status List start address */
-  __IO uint32_t DATABUFSTART;               /*!< (@ 0x4008000C) USB Data buffer start address */
-  __IO uint32_t LPM;                        /*!< (@ 0x40080010) Link Power Management register */
-  __IO uint32_t EPSKIP;                     /*!< (@ 0x40080014) USB Endpoint skip      */
-  __IO uint32_t EPINUSE;                    /*!< (@ 0x40080018) USB Endpoint Buffer in use */
-  __IO uint32_t EPBUFCFG;                   /*!< (@ 0x4008001C) USB Endpoint Buffer Configuration register */
-  __IO uint32_t INTSTAT;                    /*!< (@ 0x40080020) USB interrupt status register */
-  __IO uint32_t INTEN;                      /*!< (@ 0x40080024) USB interrupt enable register */
-  __IO uint32_t INTSETSTAT;                 /*!< (@ 0x40080028) USB set interrupt status register */
-  __IO uint32_t INTROUTING;                 /*!< (@ 0x4008002C) USB interrupt routing register */
-  __I  uint32_t RESERVED0[1];
-  __I  uint32_t EPTOGGLE;                   /*!< (@ 0x40080034) USB Endpoint toggle register */
-} LPC_USB_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                       GPIO_PORT                                      -----
-// ------------------------------------------------------------------------------------------------
-
-
-/**
-  * @brief Product name title=UM10462 Chapter title=LPC11U1x GPIO Modification date=3/17/2011 Major revision=0 Minor revision=3  (GPIO_PORT)
-  */
-
-typedef struct {                            
-  union {
-    struct {
-      __IO uint8_t B0[32];                       /*!< (@ 0x50000000) Byte pin registers port 0; pins PIO0_0 to PIO0_31 */
-      __IO uint8_t B1[32];                       /*!< (@ 0x50000020) Byte pin registers port 1 */
-    };
-    __IO uint8_t B[64];                       /*!< (@ 0x50000000) Byte pin registers port 0/1 */
-  };
-  __I  uint32_t RESERVED0[1008];
-  union {
-    struct {
-      __IO uint32_t W0[32];                      /*!< (@ 0x50001000) Word pin registers port 0 */
-      __IO uint32_t W1[32];                      /*!< (@ 0x50001080) Word pin registers port 1 */
-    };
-    __IO uint32_t W[64];                       /*!< (@ 0x50001000) Word pin registers port 0/1 */
-  };
-       uint32_t RESERVED1[960];
-  __IO uint32_t DIR[2];			/* 0x2000 */
-       uint32_t RESERVED2[30];
-  __IO uint32_t MASK[2];		/* 0x2080 */
-       uint32_t RESERVED3[30];
-  __IO uint32_t PIN[2];			/* 0x2100 */
-       uint32_t RESERVED4[30];
-  __IO uint32_t MPIN[2];		/* 0x2180 */
-       uint32_t RESERVED5[30];
-  __IO uint32_t SET[2];			/* 0x2200 */
-       uint32_t RESERVED6[30];
-  __O  uint32_t CLR[2];			/* 0x2280 */
-       uint32_t RESERVED7[30];
-  __O  uint32_t NOT[2];			/* 0x2300 */
-} LPC_GPIO_Type;
-
-
-#if defined ( __CC_ARM   )
-  #pragma no_anon_unions
-#endif
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                 Peripheral memory map                                -----
-// ------------------------------------------------------------------------------------------------
-
-#define LPC_I2C_BASE              (0x40000000)
-#define LPC_WWDT_BASE             (0x40004000)
-#define LPC_USART_BASE            (0x40008000)
-#define LPC_CT16B0_BASE           (0x4000C000)
-#define LPC_CT16B1_BASE           (0x40010000)
-#define LPC_CT32B0_BASE           (0x40014000)
-#define LPC_CT32B1_BASE           (0x40018000)
-#define LPC_ADC_BASE              (0x4001C000)
-#define LPC_PMU_BASE              (0x40038000)
-#define LPC_FLASHCTRL_BASE        (0x4003C000)
-#define LPC_SSP0_BASE             (0x40040000)
-#define LPC_SSP1_BASE             (0x40058000)
-#define LPC_IOCON_BASE            (0x40044000)
-#define LPC_SYSCON_BASE           (0x40048000)
-#define LPC_GPIO_PIN_INT_BASE     (0x4004C000)
-#define LPC_GPIO_GROUP_INT0_BASE  (0x4005C000)
-#define LPC_GPIO_GROUP_INT1_BASE  (0x40060000)
-#define LPC_USB_BASE              (0x40080000)
-#define LPC_GPIO_BASE             (0x50000000)
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                Peripheral declaration                                -----
-// ------------------------------------------------------------------------------------------------
-
-#define LPC_I2C                   ((LPC_I2C_Type            *) LPC_I2C_BASE)
-#define LPC_WWDT                  ((LPC_WWDT_Type           *) LPC_WWDT_BASE)
-#define LPC_USART                 ((LPC_USART_Type          *) LPC_USART_BASE)
-#define LPC_CT16B0                ((LPC_CTxxBx_Type         *) LPC_CT16B0_BASE)
-#define LPC_CT16B1                ((LPC_CTxxBx_Type         *) LPC_CT16B1_BASE)
-#define LPC_CT32B0                ((LPC_CTxxBx_Type         *) LPC_CT32B0_BASE)
-#define LPC_CT32B1                ((LPC_CTxxBx_Type         *) LPC_CT32B1_BASE)
-#define LPC_ADC                   ((LPC_ADC_Type            *) LPC_ADC_BASE)
-#define LPC_PMU                   ((LPC_PMU_Type            *) LPC_PMU_BASE)
-#define LPC_FLASHCTRL             ((LPC_FLASHCTRL_Type      *) LPC_FLASHCTRL_BASE)
-#define LPC_SSP0                  ((LPC_SSPx_Type           *) LPC_SSP0_BASE)
-#define LPC_SSP1                  ((LPC_SSPx_Type           *) LPC_SSP1_BASE)
-#define LPC_IOCON                 ((LPC_IOCON_Type          *) LPC_IOCON_BASE)
-#define LPC_SYSCON                ((LPC_SYSCON_Type         *) LPC_SYSCON_BASE)
-#define LPC_GPIO_PIN_INT          ((LPC_GPIO_PIN_INT_Type   *) LPC_GPIO_PIN_INT_BASE)
-#define LPC_GPIO_GROUP_INT0       ((LPC_GPIO_GROUP_INTx_Type*) LPC_GPIO_GROUP_INT0_BASE)
-#define LPC_GPIO_GROUP_INT1       ((LPC_GPIO_GROUP_INTx_Type*) LPC_GPIO_GROUP_INT1_BASE)
-#define LPC_USB                   ((LPC_USB_Type            *) LPC_USB_BASE)
-#define LPC_GPIO                  ((LPC_GPIO_Type           *) LPC_GPIO_BASE)
-
-
-/** @} */ /* End of group Device_Peripheral_Registers */
-/** @} */ /* End of group (null) */
-/** @} */ /* End of group LPC11Uxx */
-
-#ifdef __cplusplus
-}
-#endif 
-
-
-#endif  // __LPC11UXX_H__
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_MICRO/TARGET_LPC11U24_301/LPC11U24.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-
-LR_IROM1 0x00000000 0x8000  {    ; load region size_region (32k)
-  ER_IROM1 0x00000000 0x8000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  ; 8_byte_aligned(48 vect * 4 bytes) =  8_byte_aligned(0xC0) = 0xC0
-  ; 6KB - 0xC0 = 0x1740
-  RW_IRAM1 0x100000C0 0x1740  {
-   .ANY (+RW +ZI)
-  }
-  RW_IRAM2 0x20004000 0x800   { ; RW data, USB RAM
-   .ANY (USBRAM)
-  }
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_MICRO/TARGET_LPC11U24_301/startup_LPC11xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,325 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_LPC11xx.s
-; * @purpose: CMSIS Cortex-M0 Core Device Startup File 
-; *           for the NXP LPC11xx Device Series 
-; * @version: V1.0
-; * @date:    25. Nov. 2008
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; * Copyright (C) 2008 ARM Limited. All rights reserved.
-; * ARM Limited (ARM) is supplying this software for use with Cortex-M0 
-; * processor based microcontrollers.  This file can be freely distributed 
-; * within development tools that are supporting such ARM based processors. 
-; *
-; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
-; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
-; *
-; *****************************************************************************/
-
-Stack_Size      EQU     0x00000400
-
-                AREA    STACK, NOINIT, READWRITE, ALIGN=3
-                EXPORT  __initial_sp
-
-Stack_Mem       SPACE   Stack_Size
-__initial_sp        EQU     0x10001800  ; Top of RAM from LPC11U
-
-
-Heap_Size       EQU     0x00000000
-
-                AREA    HEAP, NOINIT, READWRITE, ALIGN=3
-                EXPORT  __heap_base
-                EXPORT  __heap_limit
-
-__heap_base
-Heap_Mem        SPACE   Heap_Size
-__heap_limit
-
-                PRESERVE8
-                THUMB
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-
-__Vectors       DCD     __initial_sp              ; Top of Stack
-                DCD     Reset_Handler             ; Reset Handler
-                DCD     NMI_Handler               ; NMI Handler
-                DCD     HardFault_Handler         ; Hard Fault Handler
-                DCD     MemManage_Handler         ; MPU Fault Handler
-                DCD     BusFault_Handler          ; Bus Fault Handler
-                DCD     UsageFault_Handler        ; Usage Fault Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     SVC_Handler               ; SVCall Handler
-                DCD     DebugMon_Handler          ; Debug Monitor Handler
-                DCD     0                         ; Reserved
-                DCD     PendSV_Handler            ; PendSV Handler
-                DCD     SysTick_Handler           ; SysTick Handler
-
-                ; External Interrupts
-				; for LPC11Uxx (With USB)
-                DCD     FLEX_INT0_IRQHandler      ; All GPIO pin can be routed to FLEX_INTx
-                DCD     FLEX_INT1_IRQHandler          
-                DCD     FLEX_INT2_IRQHandler                       
-                DCD     FLEX_INT3_IRQHandler                         
-                DCD     FLEX_INT4_IRQHandler                        
-                DCD     FLEX_INT5_IRQHandler
-                DCD     FLEX_INT6_IRQHandler
-                DCD     FLEX_INT7_IRQHandler                       
-                DCD     GINT0_IRQHandler                         
-                DCD     GINT1_IRQHandler          ; PIO0 (0:7)              
-                DCD     Reserved_IRQHandler	      ; Reserved
-                DCD     Reserved_IRQHandler
-                DCD     Reserved_IRQHandler       
-                DCD     Reserved_IRQHandler                       
-                DCD     SSP1_IRQHandler           ; SSP1               
-                DCD     I2C_IRQHandler            ; I2C
-                DCD     TIMER16_0_IRQHandler      ; 16-bit Timer0
-                DCD     TIMER16_1_IRQHandler      ; 16-bit Timer1
-                DCD     TIMER32_0_IRQHandler      ; 32-bit Timer0
-                DCD     TIMER32_1_IRQHandler      ; 32-bit Timer1
-                DCD     SSP0_IRQHandler           ; SSP0
-                DCD     UART_IRQHandler           ; UART
-                DCD     USB_IRQHandler            ; USB IRQ
-                DCD     USB_FIQHandler            ; USB FIQ
-                DCD     ADC_IRQHandler            ; A/D Converter
-                DCD     WDT_IRQHandler            ; Watchdog timer
-                DCD     BOD_IRQHandler            ; Brown Out Detect
-                DCD     FMC_IRQHandler            ; IP2111 Flash Memory Controller
-                DCD     Reserved_IRQHandler	    ; Reserved
-                DCD     Reserved_IRQHandler       ; Reserved
-                DCD     USBWakeup_IRQHandler      ; USB wake up
-                DCD     Reserved_IRQHandler       ; Reserved
-	
-	;; 48 vector entries. We pad to 128 to fill the 0x0 - 0x1FF REMAP address space
-                
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-	
-                IF      :LNOT::DEF:NO_CRP
-                AREA    |.ARM.__at_0x02FC|, CODE, READONLY
-CRP_Key         DCD     0xFFFFFFFF
-                ENDIF
-
-
-                AREA    |.text|, CODE, READONLY
-
-
-	
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-; Dummy Exception Handlers (infinite loops which can be modified)                
-
-; now, under COMMON NMI.c and NMI.h, a real NMI handler is created if NMI is enabled 
-; for particular peripheral.
-;NMI_Handler     PROC
-;                EXPORT  NMI_Handler               [WEAK]
-;                B       .
-;                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-MemManage_Handler\
-                PROC
-                EXPORT  MemManage_Handler         [WEAK]
-                B       .
-                ENDP
-BusFault_Handler\
-                PROC
-                EXPORT  BusFault_Handler          [WEAK]
-                B       .
-                ENDP
-UsageFault_Handler\
-                PROC
-                EXPORT  UsageFault_Handler        [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-DebugMon_Handler\
-                PROC
-                EXPORT  DebugMon_Handler          [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-Reserved_IRQHandler PROC
-                EXPORT  Reserved_IRQHandler       [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-; for LPC11Uxx (With USB)
-                EXPORT  NMI_Handler               [WEAK]
-                EXPORT  FLEX_INT0_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT1_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT2_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT3_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT4_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT5_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT6_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT7_IRQHandler      [WEAK]
-                EXPORT  GINT0_IRQHandler          [WEAK]
-                EXPORT  GINT1_IRQHandler          [WEAK]
-                EXPORT  SSP1_IRQHandler           [WEAK]
-                EXPORT  I2C_IRQHandler            [WEAK]
-                EXPORT  TIMER16_0_IRQHandler      [WEAK]
-                EXPORT  TIMER16_1_IRQHandler      [WEAK]
-                EXPORT  TIMER32_0_IRQHandler      [WEAK]
-                EXPORT  TIMER32_1_IRQHandler      [WEAK]
-                EXPORT  SSP0_IRQHandler           [WEAK]
-                EXPORT  UART_IRQHandler           [WEAK]
-
-                EXPORT  USB_IRQHandler            [WEAK]
-                EXPORT  USB_FIQHandler            [WEAK]
-                EXPORT  ADC_IRQHandler            [WEAK]
-                EXPORT  WDT_IRQHandler            [WEAK]
-                EXPORT  BOD_IRQHandler            [WEAK]
-                EXPORT  FMC_IRQHandler            [WEAK]
-                EXPORT	USBWakeup_IRQHandler      [WEAK]
-
-NMI_Handler
-FLEX_INT0_IRQHandler
-FLEX_INT1_IRQHandler
-FLEX_INT2_IRQHandler
-FLEX_INT3_IRQHandler
-FLEX_INT4_IRQHandler
-FLEX_INT5_IRQHandler
-FLEX_INT6_IRQHandler
-FLEX_INT7_IRQHandler
-GINT0_IRQHandler
-GINT1_IRQHandler
-SSP1_IRQHandler
-I2C_IRQHandler
-TIMER16_0_IRQHandler
-TIMER16_1_IRQHandler
-TIMER32_0_IRQHandler
-TIMER32_1_IRQHandler
-SSP0_IRQHandler
-UART_IRQHandler
-USB_IRQHandler
-USB_FIQHandler
-ADC_IRQHandler
-WDT_IRQHandler
-BOD_IRQHandler
-FMC_IRQHandler
-USBWakeup_IRQHandler
-
-                B       .
-
-                ENDP
-
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_MICRO/TARGET_LPC11U24_401/LPC11U24.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-
-LR_IROM1 0x00000000 0x8000  {    ; load region size_region (32k)
-  ER_IROM1 0x00000000 0x8000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  ; 8_byte_aligned(48 vect * 4 bytes) =  8_byte_aligned(0xC0) = 0xC0
-  ; 8KB - 0xC0 = 0x1F40
-  RW_IRAM1 0x100000C0 0x1F40  {
-   .ANY (+RW +ZI)
-  }
-  RW_IRAM2 0x20004000 0x800   { ; RW data, USB RAM
-   .ANY (USBRAM)
-  }
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_MICRO/TARGET_LPC11U24_401/startup_LPC11xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,325 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_LPC11xx.s
-; * @purpose: CMSIS Cortex-M0 Core Device Startup File 
-; *           for the NXP LPC11xx Device Series 
-; * @version: V1.0
-; * @date:    25. Nov. 2008
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; * Copyright (C) 2008 ARM Limited. All rights reserved.
-; * ARM Limited (ARM) is supplying this software for use with Cortex-M0 
-; * processor based microcontrollers.  This file can be freely distributed 
-; * within development tools that are supporting such ARM based processors. 
-; *
-; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
-; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
-; *
-; *****************************************************************************/
-
-Stack_Size      EQU     0x00000400
-
-                AREA    STACK, NOINIT, READWRITE, ALIGN=3
-                EXPORT  __initial_sp
-
-Stack_Mem       SPACE   Stack_Size
-__initial_sp        EQU     0x10002000  ; Top of RAM from LPC11U
-
-
-Heap_Size       EQU     0x00000000
-
-                AREA    HEAP, NOINIT, READWRITE, ALIGN=3
-                EXPORT  __heap_base
-                EXPORT  __heap_limit
-
-__heap_base
-Heap_Mem        SPACE   Heap_Size
-__heap_limit
-
-                PRESERVE8
-                THUMB
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-
-__Vectors       DCD     __initial_sp              ; Top of Stack
-                DCD     Reset_Handler             ; Reset Handler
-                DCD     NMI_Handler               ; NMI Handler
-                DCD     HardFault_Handler         ; Hard Fault Handler
-                DCD     MemManage_Handler         ; MPU Fault Handler
-                DCD     BusFault_Handler          ; Bus Fault Handler
-                DCD     UsageFault_Handler        ; Usage Fault Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     SVC_Handler               ; SVCall Handler
-                DCD     DebugMon_Handler          ; Debug Monitor Handler
-                DCD     0                         ; Reserved
-                DCD     PendSV_Handler            ; PendSV Handler
-                DCD     SysTick_Handler           ; SysTick Handler
-
-                ; External Interrupts
-				; for LPC11Uxx (With USB)
-                DCD     FLEX_INT0_IRQHandler      ; All GPIO pin can be routed to FLEX_INTx
-                DCD     FLEX_INT1_IRQHandler          
-                DCD     FLEX_INT2_IRQHandler                       
-                DCD     FLEX_INT3_IRQHandler                         
-                DCD     FLEX_INT4_IRQHandler                        
-                DCD     FLEX_INT5_IRQHandler
-                DCD     FLEX_INT6_IRQHandler
-                DCD     FLEX_INT7_IRQHandler                       
-                DCD     GINT0_IRQHandler                         
-                DCD     GINT1_IRQHandler          ; PIO0 (0:7)              
-                DCD     Reserved_IRQHandler	      ; Reserved
-                DCD     Reserved_IRQHandler
-                DCD     Reserved_IRQHandler       
-                DCD     Reserved_IRQHandler                       
-                DCD     SSP1_IRQHandler           ; SSP1               
-                DCD     I2C_IRQHandler            ; I2C
-                DCD     TIMER16_0_IRQHandler      ; 16-bit Timer0
-                DCD     TIMER16_1_IRQHandler      ; 16-bit Timer1
-                DCD     TIMER32_0_IRQHandler      ; 32-bit Timer0
-                DCD     TIMER32_1_IRQHandler      ; 32-bit Timer1
-                DCD     SSP0_IRQHandler           ; SSP0
-                DCD     UART_IRQHandler           ; UART
-                DCD     USB_IRQHandler            ; USB IRQ
-                DCD     USB_FIQHandler            ; USB FIQ
-                DCD     ADC_IRQHandler            ; A/D Converter
-                DCD     WDT_IRQHandler            ; Watchdog timer
-                DCD     BOD_IRQHandler            ; Brown Out Detect
-                DCD     FMC_IRQHandler            ; IP2111 Flash Memory Controller
-                DCD     Reserved_IRQHandler	    ; Reserved
-                DCD     Reserved_IRQHandler       ; Reserved
-                DCD     USBWakeup_IRQHandler      ; USB wake up
-                DCD     Reserved_IRQHandler       ; Reserved
-	
-	;; 48 vector entries. We pad to 128 to fill the 0x0 - 0x1FF REMAP address space
-                
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-	
-                IF      :LNOT::DEF:NO_CRP
-                AREA    |.ARM.__at_0x02FC|, CODE, READONLY
-CRP_Key         DCD     0xFFFFFFFF
-                ENDIF
-
-
-                AREA    |.text|, CODE, READONLY
-
-
-	
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-; Dummy Exception Handlers (infinite loops which can be modified)                
-
-; now, under COMMON NMI.c and NMI.h, a real NMI handler is created if NMI is enabled 
-; for particular peripheral.
-;NMI_Handler     PROC
-;                EXPORT  NMI_Handler               [WEAK]
-;                B       .
-;                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-MemManage_Handler\
-                PROC
-                EXPORT  MemManage_Handler         [WEAK]
-                B       .
-                ENDP
-BusFault_Handler\
-                PROC
-                EXPORT  BusFault_Handler          [WEAK]
-                B       .
-                ENDP
-UsageFault_Handler\
-                PROC
-                EXPORT  UsageFault_Handler        [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-DebugMon_Handler\
-                PROC
-                EXPORT  DebugMon_Handler          [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-Reserved_IRQHandler PROC
-                EXPORT  Reserved_IRQHandler       [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-; for LPC11Uxx (With USB)
-                EXPORT  NMI_Handler               [WEAK]
-                EXPORT  FLEX_INT0_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT1_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT2_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT3_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT4_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT5_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT6_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT7_IRQHandler      [WEAK]
-                EXPORT  GINT0_IRQHandler          [WEAK]
-                EXPORT  GINT1_IRQHandler          [WEAK]
-                EXPORT  SSP1_IRQHandler           [WEAK]
-                EXPORT  I2C_IRQHandler            [WEAK]
-                EXPORT  TIMER16_0_IRQHandler      [WEAK]
-                EXPORT  TIMER16_1_IRQHandler      [WEAK]
-                EXPORT  TIMER32_0_IRQHandler      [WEAK]
-                EXPORT  TIMER32_1_IRQHandler      [WEAK]
-                EXPORT  SSP0_IRQHandler           [WEAK]
-                EXPORT  UART_IRQHandler           [WEAK]
-
-                EXPORT  USB_IRQHandler            [WEAK]
-                EXPORT  USB_FIQHandler            [WEAK]
-                EXPORT  ADC_IRQHandler            [WEAK]
-                EXPORT  WDT_IRQHandler            [WEAK]
-                EXPORT  BOD_IRQHandler            [WEAK]
-                EXPORT  FMC_IRQHandler            [WEAK]
-                EXPORT	USBWakeup_IRQHandler      [WEAK]
-
-NMI_Handler
-FLEX_INT0_IRQHandler
-FLEX_INT1_IRQHandler
-FLEX_INT2_IRQHandler
-FLEX_INT3_IRQHandler
-FLEX_INT4_IRQHandler
-FLEX_INT5_IRQHandler
-FLEX_INT6_IRQHandler
-FLEX_INT7_IRQHandler
-GINT0_IRQHandler
-GINT1_IRQHandler
-SSP1_IRQHandler
-I2C_IRQHandler
-TIMER16_0_IRQHandler
-TIMER16_1_IRQHandler
-TIMER32_0_IRQHandler
-TIMER32_1_IRQHandler
-SSP0_IRQHandler
-UART_IRQHandler
-USB_IRQHandler
-USB_FIQHandler
-ADC_IRQHandler
-WDT_IRQHandler
-BOD_IRQHandler
-FMC_IRQHandler
-USBWakeup_IRQHandler
-
-                B       .
-
-                ENDP
-
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_MICRO/TARGET_LPC11U35_401/LPC11U35.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-
-LR_IROM1 0x00000000 0x10000  {    ; load region size_region (64k)
-  ER_IROM1 0x00000000 0x10000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  ; 8_byte_aligned(48 vect * 4 bytes) =  8_byte_aligned(0xC0) = 0xC0
-  ; 8KB - 0xC0 = 0x1F40
-  RW_IRAM1 0x100000C0 0x1F40  {
-   .ANY (+RW +ZI)
-  }
-  RW_IRAM2 0x20004000 0x800   { ; RW data, USB RAM
-   .ANY (USBRAM)
-  }
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_MICRO/TARGET_LPC11U35_401/startup_LPC11xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,325 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_LPC11xx.s
-; * @purpose: CMSIS Cortex-M0 Core Device Startup File 
-; *           for the NXP LPC11xx Device Series 
-; * @version: V1.0
-; * @date:    25. Nov. 2008
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; * Copyright (C) 2008 ARM Limited. All rights reserved.
-; * ARM Limited (ARM) is supplying this software for use with Cortex-M0 
-; * processor based microcontrollers.  This file can be freely distributed 
-; * within development tools that are supporting such ARM based processors. 
-; *
-; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
-; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
-; *
-; *****************************************************************************/
-
-Stack_Size      EQU     0x00000400
-
-                AREA    STACK, NOINIT, READWRITE, ALIGN=3
-                EXPORT  __initial_sp
-
-Stack_Mem       SPACE   Stack_Size
-__initial_sp        EQU     0x10002000  ; Top of RAM from LPC11U
-
-
-Heap_Size       EQU     0x00000000
-
-                AREA    HEAP, NOINIT, READWRITE, ALIGN=3
-                EXPORT  __heap_base
-                EXPORT  __heap_limit
-
-__heap_base
-Heap_Mem        SPACE   Heap_Size
-__heap_limit
-
-                PRESERVE8
-                THUMB
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-
-__Vectors       DCD     __initial_sp              ; Top of Stack
-                DCD     Reset_Handler             ; Reset Handler
-                DCD     NMI_Handler               ; NMI Handler
-                DCD     HardFault_Handler         ; Hard Fault Handler
-                DCD     MemManage_Handler         ; MPU Fault Handler
-                DCD     BusFault_Handler          ; Bus Fault Handler
-                DCD     UsageFault_Handler        ; Usage Fault Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     SVC_Handler               ; SVCall Handler
-                DCD     DebugMon_Handler          ; Debug Monitor Handler
-                DCD     0                         ; Reserved
-                DCD     PendSV_Handler            ; PendSV Handler
-                DCD     SysTick_Handler           ; SysTick Handler
-
-                ; External Interrupts
-				; for LPC11Uxx (With USB)
-                DCD     FLEX_INT0_IRQHandler      ; All GPIO pin can be routed to FLEX_INTx
-                DCD     FLEX_INT1_IRQHandler          
-                DCD     FLEX_INT2_IRQHandler                       
-                DCD     FLEX_INT3_IRQHandler                         
-                DCD     FLEX_INT4_IRQHandler                        
-                DCD     FLEX_INT5_IRQHandler
-                DCD     FLEX_INT6_IRQHandler
-                DCD     FLEX_INT7_IRQHandler                       
-                DCD     GINT0_IRQHandler                         
-                DCD     GINT1_IRQHandler          ; PIO0 (0:7)              
-                DCD     Reserved_IRQHandler	      ; Reserved
-                DCD     Reserved_IRQHandler
-                DCD     Reserved_IRQHandler       
-                DCD     Reserved_IRQHandler                       
-                DCD     SSP1_IRQHandler           ; SSP1               
-                DCD     I2C_IRQHandler            ; I2C
-                DCD     TIMER16_0_IRQHandler      ; 16-bit Timer0
-                DCD     TIMER16_1_IRQHandler      ; 16-bit Timer1
-                DCD     TIMER32_0_IRQHandler      ; 32-bit Timer0
-                DCD     TIMER32_1_IRQHandler      ; 32-bit Timer1
-                DCD     SSP0_IRQHandler           ; SSP0
-                DCD     UART_IRQHandler           ; UART
-                DCD     USB_IRQHandler            ; USB IRQ
-                DCD     USB_FIQHandler            ; USB FIQ
-                DCD     ADC_IRQHandler            ; A/D Converter
-                DCD     WDT_IRQHandler            ; Watchdog timer
-                DCD     BOD_IRQHandler            ; Brown Out Detect
-                DCD     FMC_IRQHandler            ; IP2111 Flash Memory Controller
-                DCD     Reserved_IRQHandler	    ; Reserved
-                DCD     Reserved_IRQHandler       ; Reserved
-                DCD     USBWakeup_IRQHandler      ; USB wake up
-                DCD     Reserved_IRQHandler       ; Reserved
-	
-	;; 48 vector entries. We pad to 128 to fill the 0x0 - 0x1FF REMAP address space
-                
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-	
-                IF      :LNOT::DEF:NO_CRP
-                AREA    |.ARM.__at_0x02FC|, CODE, READONLY
-CRP_Key         DCD     0xFFFFFFFF
-                ENDIF
-
-
-                AREA    |.text|, CODE, READONLY
-
-
-	
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-; Dummy Exception Handlers (infinite loops which can be modified)                
-
-; now, under COMMON NMI.c and NMI.h, a real NMI handler is created if NMI is enabled 
-; for particular peripheral.
-;NMI_Handler     PROC
-;                EXPORT  NMI_Handler               [WEAK]
-;                B       .
-;                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-MemManage_Handler\
-                PROC
-                EXPORT  MemManage_Handler         [WEAK]
-                B       .
-                ENDP
-BusFault_Handler\
-                PROC
-                EXPORT  BusFault_Handler          [WEAK]
-                B       .
-                ENDP
-UsageFault_Handler\
-                PROC
-                EXPORT  UsageFault_Handler        [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-DebugMon_Handler\
-                PROC
-                EXPORT  DebugMon_Handler          [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-Reserved_IRQHandler PROC
-                EXPORT  Reserved_IRQHandler       [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-; for LPC11Uxx (With USB)
-                EXPORT  NMI_Handler               [WEAK]
-                EXPORT  FLEX_INT0_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT1_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT2_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT3_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT4_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT5_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT6_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT7_IRQHandler      [WEAK]
-                EXPORT  GINT0_IRQHandler          [WEAK]
-                EXPORT  GINT1_IRQHandler          [WEAK]
-                EXPORT  SSP1_IRQHandler           [WEAK]
-                EXPORT  I2C_IRQHandler            [WEAK]
-                EXPORT  TIMER16_0_IRQHandler      [WEAK]
-                EXPORT  TIMER16_1_IRQHandler      [WEAK]
-                EXPORT  TIMER32_0_IRQHandler      [WEAK]
-                EXPORT  TIMER32_1_IRQHandler      [WEAK]
-                EXPORT  SSP0_IRQHandler           [WEAK]
-                EXPORT  UART_IRQHandler           [WEAK]
-
-                EXPORT  USB_IRQHandler            [WEAK]
-                EXPORT  USB_FIQHandler            [WEAK]
-                EXPORT  ADC_IRQHandler            [WEAK]
-                EXPORT  WDT_IRQHandler            [WEAK]
-                EXPORT  BOD_IRQHandler            [WEAK]
-                EXPORT  FMC_IRQHandler            [WEAK]
-                EXPORT	USBWakeup_IRQHandler      [WEAK]
-
-NMI_Handler
-FLEX_INT0_IRQHandler
-FLEX_INT1_IRQHandler
-FLEX_INT2_IRQHandler
-FLEX_INT3_IRQHandler
-FLEX_INT4_IRQHandler
-FLEX_INT5_IRQHandler
-FLEX_INT6_IRQHandler
-FLEX_INT7_IRQHandler
-GINT0_IRQHandler
-GINT1_IRQHandler
-SSP1_IRQHandler
-I2C_IRQHandler
-TIMER16_0_IRQHandler
-TIMER16_1_IRQHandler
-TIMER32_0_IRQHandler
-TIMER32_1_IRQHandler
-SSP0_IRQHandler
-UART_IRQHandler
-USB_IRQHandler
-USB_FIQHandler
-ADC_IRQHandler
-WDT_IRQHandler
-BOD_IRQHandler
-FMC_IRQHandler
-USBWakeup_IRQHandler
-
-                B       .
-
-                ENDP
-
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_MICRO/sys.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library - stackheap
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * Setup a fixed single stack/heap memory model, 
- *  between the top of the RW/ZI region and the stackpointer
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-#include <rt_misc.h>
-#include <stdint.h>
-
-extern char Image$$RW_IRAM1$$ZI$$Limit[];
-
-extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
-    uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
-    uint32_t sp_limit = __current_sp();
-
-    zi_limit = (zi_limit + 7) & ~0x7;    // ensure zi_limit is 8-byte aligned
-
-    struct __initial_stackheap r;
-    r.heap_base = zi_limit;
-    r.heap_limit = sp_limit;
-    return r;
-}
-
-#ifdef __cplusplus
-}
-#endif 
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_STD/TARGET_LPC11U24_301/LPC11U24.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-
-LR_IROM1 0x00000000 0x8000  {    ; load region size_region (32k)
-  ER_IROM1 0x00000000 0x8000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  ; 8_byte_aligned(48 vect * 4 bytes) =  8_byte_aligned(0xC0) = 0xC0
-  ; 6KB - 0xC0 = 0x1740
-  RW_IRAM1 0x100000C0 0x1740  {
-   .ANY (+RW +ZI)
-  }
-  RW_IRAM2 0x20004000 0x800   { ; RW data, USB RAM
-   .ANY (USBRAM)
-  }
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_STD/TARGET_LPC11U24_301/startup_LPC11xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,308 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_LPC11xx.s
-; * @purpose: CMSIS Cortex-M0 Core Device Startup File 
-; *           for the NXP LPC11xx Device Series 
-; * @version: V1.0
-; * @date:    25. Nov. 2008
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; * Copyright (C) 2008 ARM Limited. All rights reserved.
-; * ARM Limited (ARM) is supplying this software for use with Cortex-M0 
-; * processor based microcontrollers.  This file can be freely distributed 
-; * within development tools that are supporting such ARM based processors. 
-; *
-; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
-; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
-; *
-; *****************************************************************************/
-
-__initial_sp        EQU     0x10001800  ; Top of RAM from LPC11U
-
-                PRESERVE8
-                THUMB
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-
-__Vectors       DCD     __initial_sp              ; Top of Stack
-                DCD     Reset_Handler             ; Reset Handler
-                DCD     NMI_Handler               ; NMI Handler
-                DCD     HardFault_Handler         ; Hard Fault Handler
-                DCD     MemManage_Handler         ; MPU Fault Handler
-                DCD     BusFault_Handler          ; Bus Fault Handler
-                DCD     UsageFault_Handler        ; Usage Fault Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     SVC_Handler               ; SVCall Handler
-                DCD     DebugMon_Handler          ; Debug Monitor Handler
-                DCD     0                         ; Reserved
-                DCD     PendSV_Handler            ; PendSV Handler
-                DCD     SysTick_Handler           ; SysTick Handler
-
-                ; External Interrupts
-				; for LPC11Uxx (With USB)
-                DCD     FLEX_INT0_IRQHandler      ; All GPIO pin can be routed to FLEX_INTx
-                DCD     FLEX_INT1_IRQHandler          
-                DCD     FLEX_INT2_IRQHandler                       
-                DCD     FLEX_INT3_IRQHandler                         
-                DCD     FLEX_INT4_IRQHandler                        
-                DCD     FLEX_INT5_IRQHandler
-                DCD     FLEX_INT6_IRQHandler
-                DCD     FLEX_INT7_IRQHandler                       
-                DCD     GINT0_IRQHandler                         
-                DCD     GINT1_IRQHandler          ; PIO0 (0:7)              
-                DCD     Reserved_IRQHandler	      ; Reserved
-                DCD     Reserved_IRQHandler
-                DCD     Reserved_IRQHandler       
-                DCD     Reserved_IRQHandler                       
-                DCD     SSP1_IRQHandler           ; SSP1               
-                DCD     I2C_IRQHandler            ; I2C
-                DCD     TIMER16_0_IRQHandler      ; 16-bit Timer0
-                DCD     TIMER16_1_IRQHandler      ; 16-bit Timer1
-                DCD     TIMER32_0_IRQHandler      ; 32-bit Timer0
-                DCD     TIMER32_1_IRQHandler      ; 32-bit Timer1
-                DCD     SSP0_IRQHandler           ; SSP0
-                DCD     UART_IRQHandler           ; UART
-                DCD     USB_IRQHandler            ; USB IRQ
-                DCD     USB_FIQHandler            ; USB FIQ
-                DCD     ADC_IRQHandler            ; A/D Converter
-                DCD     WDT_IRQHandler            ; Watchdog timer
-                DCD     BOD_IRQHandler            ; Brown Out Detect
-                DCD     FMC_IRQHandler            ; IP2111 Flash Memory Controller
-                DCD     Reserved_IRQHandler	    ; Reserved
-                DCD     Reserved_IRQHandler       ; Reserved
-                DCD     USBWakeup_IRQHandler      ; USB wake up
-                DCD     Reserved_IRQHandler       ; Reserved
-	
-	;; 48 vector entries. We pad to 128 to fill the 0x0 - 0x1FF REMAP address space
-                
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-	
-                IF      :LNOT::DEF:NO_CRP
-                AREA    |.ARM.__at_0x02FC|, CODE, READONLY
-CRP_Key         DCD     0xFFFFFFFF
-                ENDIF
-
-
-                AREA    |.text|, CODE, READONLY
-
-
-	
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-; Dummy Exception Handlers (infinite loops which can be modified)                
-
-; now, under COMMON NMI.c and NMI.h, a real NMI handler is created if NMI is enabled 
-; for particular peripheral.
-;NMI_Handler     PROC
-;                EXPORT  NMI_Handler               [WEAK]
-;                B       .
-;                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-MemManage_Handler\
-                PROC
-                EXPORT  MemManage_Handler         [WEAK]
-                B       .
-                ENDP
-BusFault_Handler\
-                PROC
-                EXPORT  BusFault_Handler          [WEAK]
-                B       .
-                ENDP
-UsageFault_Handler\
-                PROC
-                EXPORT  UsageFault_Handler        [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-DebugMon_Handler\
-                PROC
-                EXPORT  DebugMon_Handler          [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-Reserved_IRQHandler PROC
-                EXPORT  Reserved_IRQHandler       [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-; for LPC11Uxx (With USB)
-                EXPORT  NMI_Handler               [WEAK]
-                EXPORT  FLEX_INT0_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT1_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT2_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT3_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT4_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT5_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT6_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT7_IRQHandler      [WEAK]
-                EXPORT  GINT0_IRQHandler          [WEAK]
-                EXPORT  GINT1_IRQHandler          [WEAK]
-                EXPORT  SSP1_IRQHandler           [WEAK]
-                EXPORT  I2C_IRQHandler            [WEAK]
-                EXPORT  TIMER16_0_IRQHandler      [WEAK]
-                EXPORT  TIMER16_1_IRQHandler      [WEAK]
-                EXPORT  TIMER32_0_IRQHandler      [WEAK]
-                EXPORT  TIMER32_1_IRQHandler      [WEAK]
-                EXPORT  SSP0_IRQHandler           [WEAK]
-                EXPORT  UART_IRQHandler           [WEAK]
-
-                EXPORT  USB_IRQHandler            [WEAK]
-                EXPORT  USB_FIQHandler            [WEAK]
-                EXPORT  ADC_IRQHandler            [WEAK]
-                EXPORT  WDT_IRQHandler            [WEAK]
-                EXPORT  BOD_IRQHandler            [WEAK]
-                EXPORT  FMC_IRQHandler            [WEAK]
-                EXPORT	USBWakeup_IRQHandler      [WEAK]
-
-NMI_Handler
-FLEX_INT0_IRQHandler
-FLEX_INT1_IRQHandler
-FLEX_INT2_IRQHandler
-FLEX_INT3_IRQHandler
-FLEX_INT4_IRQHandler
-FLEX_INT5_IRQHandler
-FLEX_INT6_IRQHandler
-FLEX_INT7_IRQHandler
-GINT0_IRQHandler
-GINT1_IRQHandler
-SSP1_IRQHandler
-I2C_IRQHandler
-TIMER16_0_IRQHandler
-TIMER16_1_IRQHandler
-TIMER32_0_IRQHandler
-TIMER32_1_IRQHandler
-SSP0_IRQHandler
-UART_IRQHandler
-USB_IRQHandler
-USB_FIQHandler
-ADC_IRQHandler
-WDT_IRQHandler
-BOD_IRQHandler
-FMC_IRQHandler
-USBWakeup_IRQHandler
-
-                B       .
-
-                ENDP
-
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_STD/TARGET_LPC11U24_401/LPC11U24.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-
-LR_IROM1 0x00000000 0x8000  {    ; load region size_region (32k)
-  ER_IROM1 0x00000000 0x8000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  ; 8_byte_aligned(48 vect * 4 bytes) =  8_byte_aligned(0xC0) = 0xC0
-  ; 8KB - 0xC0 = 0x1F40
-  RW_IRAM1 0x100000C0 0x1F40  {
-   .ANY (+RW +ZI)
-  }
-  RW_IRAM2 0x20004000 0x800   { ; RW data, USB RAM
-   .ANY (USBRAM)
-  }
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_STD/TARGET_LPC11U24_401/startup_LPC11xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,308 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_LPC11xx.s
-; * @purpose: CMSIS Cortex-M0 Core Device Startup File 
-; *           for the NXP LPC11xx Device Series 
-; * @version: V1.0
-; * @date:    25. Nov. 2008
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; * Copyright (C) 2008 ARM Limited. All rights reserved.
-; * ARM Limited (ARM) is supplying this software for use with Cortex-M0 
-; * processor based microcontrollers.  This file can be freely distributed 
-; * within development tools that are supporting such ARM based processors. 
-; *
-; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
-; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
-; *
-; *****************************************************************************/
-
-__initial_sp        EQU     0x10002000  ; Top of RAM from LPC11U
-
-                PRESERVE8
-                THUMB
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-
-__Vectors       DCD     __initial_sp              ; Top of Stack
-                DCD     Reset_Handler             ; Reset Handler
-                DCD     NMI_Handler               ; NMI Handler
-                DCD     HardFault_Handler         ; Hard Fault Handler
-                DCD     MemManage_Handler         ; MPU Fault Handler
-                DCD     BusFault_Handler          ; Bus Fault Handler
-                DCD     UsageFault_Handler        ; Usage Fault Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     SVC_Handler               ; SVCall Handler
-                DCD     DebugMon_Handler          ; Debug Monitor Handler
-                DCD     0                         ; Reserved
-                DCD     PendSV_Handler            ; PendSV Handler
-                DCD     SysTick_Handler           ; SysTick Handler
-
-                ; External Interrupts
-				; for LPC11Uxx (With USB)
-                DCD     FLEX_INT0_IRQHandler      ; All GPIO pin can be routed to FLEX_INTx
-                DCD     FLEX_INT1_IRQHandler          
-                DCD     FLEX_INT2_IRQHandler                       
-                DCD     FLEX_INT3_IRQHandler                         
-                DCD     FLEX_INT4_IRQHandler                        
-                DCD     FLEX_INT5_IRQHandler
-                DCD     FLEX_INT6_IRQHandler
-                DCD     FLEX_INT7_IRQHandler                       
-                DCD     GINT0_IRQHandler                         
-                DCD     GINT1_IRQHandler          ; PIO0 (0:7)              
-                DCD     Reserved_IRQHandler	      ; Reserved
-                DCD     Reserved_IRQHandler
-                DCD     Reserved_IRQHandler       
-                DCD     Reserved_IRQHandler                       
-                DCD     SSP1_IRQHandler           ; SSP1               
-                DCD     I2C_IRQHandler            ; I2C
-                DCD     TIMER16_0_IRQHandler      ; 16-bit Timer0
-                DCD     TIMER16_1_IRQHandler      ; 16-bit Timer1
-                DCD     TIMER32_0_IRQHandler      ; 32-bit Timer0
-                DCD     TIMER32_1_IRQHandler      ; 32-bit Timer1
-                DCD     SSP0_IRQHandler           ; SSP0
-                DCD     UART_IRQHandler           ; UART
-                DCD     USB_IRQHandler            ; USB IRQ
-                DCD     USB_FIQHandler            ; USB FIQ
-                DCD     ADC_IRQHandler            ; A/D Converter
-                DCD     WDT_IRQHandler            ; Watchdog timer
-                DCD     BOD_IRQHandler            ; Brown Out Detect
-                DCD     FMC_IRQHandler            ; IP2111 Flash Memory Controller
-                DCD     Reserved_IRQHandler	    ; Reserved
-                DCD     Reserved_IRQHandler       ; Reserved
-                DCD     USBWakeup_IRQHandler      ; USB wake up
-                DCD     Reserved_IRQHandler       ; Reserved
-	
-	;; 48 vector entries. We pad to 128 to fill the 0x0 - 0x1FF REMAP address space
-                
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-	
-                IF      :LNOT::DEF:NO_CRP
-                AREA    |.ARM.__at_0x02FC|, CODE, READONLY
-CRP_Key         DCD     0xFFFFFFFF
-                ENDIF
-
-
-                AREA    |.text|, CODE, READONLY
-
-
-	
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-; Dummy Exception Handlers (infinite loops which can be modified)                
-
-; now, under COMMON NMI.c and NMI.h, a real NMI handler is created if NMI is enabled 
-; for particular peripheral.
-;NMI_Handler     PROC
-;                EXPORT  NMI_Handler               [WEAK]
-;                B       .
-;                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-MemManage_Handler\
-                PROC
-                EXPORT  MemManage_Handler         [WEAK]
-                B       .
-                ENDP
-BusFault_Handler\
-                PROC
-                EXPORT  BusFault_Handler          [WEAK]
-                B       .
-                ENDP
-UsageFault_Handler\
-                PROC
-                EXPORT  UsageFault_Handler        [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-DebugMon_Handler\
-                PROC
-                EXPORT  DebugMon_Handler          [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-Reserved_IRQHandler PROC
-                EXPORT  Reserved_IRQHandler       [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-; for LPC11Uxx (With USB)
-                EXPORT  NMI_Handler               [WEAK]
-                EXPORT  FLEX_INT0_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT1_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT2_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT3_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT4_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT5_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT6_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT7_IRQHandler      [WEAK]
-                EXPORT  GINT0_IRQHandler          [WEAK]
-                EXPORT  GINT1_IRQHandler          [WEAK]
-                EXPORT  SSP1_IRQHandler           [WEAK]
-                EXPORT  I2C_IRQHandler            [WEAK]
-                EXPORT  TIMER16_0_IRQHandler      [WEAK]
-                EXPORT  TIMER16_1_IRQHandler      [WEAK]
-                EXPORT  TIMER32_0_IRQHandler      [WEAK]
-                EXPORT  TIMER32_1_IRQHandler      [WEAK]
-                EXPORT  SSP0_IRQHandler           [WEAK]
-                EXPORT  UART_IRQHandler           [WEAK]
-
-                EXPORT  USB_IRQHandler            [WEAK]
-                EXPORT  USB_FIQHandler            [WEAK]
-                EXPORT  ADC_IRQHandler            [WEAK]
-                EXPORT  WDT_IRQHandler            [WEAK]
-                EXPORT  BOD_IRQHandler            [WEAK]
-                EXPORT  FMC_IRQHandler            [WEAK]
-                EXPORT	USBWakeup_IRQHandler      [WEAK]
-
-NMI_Handler
-FLEX_INT0_IRQHandler
-FLEX_INT1_IRQHandler
-FLEX_INT2_IRQHandler
-FLEX_INT3_IRQHandler
-FLEX_INT4_IRQHandler
-FLEX_INT5_IRQHandler
-FLEX_INT6_IRQHandler
-FLEX_INT7_IRQHandler
-GINT0_IRQHandler
-GINT1_IRQHandler
-SSP1_IRQHandler
-I2C_IRQHandler
-TIMER16_0_IRQHandler
-TIMER16_1_IRQHandler
-TIMER32_0_IRQHandler
-TIMER32_1_IRQHandler
-SSP0_IRQHandler
-UART_IRQHandler
-USB_IRQHandler
-USB_FIQHandler
-ADC_IRQHandler
-WDT_IRQHandler
-BOD_IRQHandler
-FMC_IRQHandler
-USBWakeup_IRQHandler
-
-                B       .
-
-                ENDP
-
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_STD/TARGET_LPC11U35_401/LPC11U35.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-
-LR_IROM1 0x00000000 0x10000  {    ; load region size_region (64k)
-  ER_IROM1 0x00000000 0x10000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  ; 8_byte_aligned(48 vect * 4 bytes) =  8_byte_aligned(0xC0) = 0xC0
-  ; 8KB - 0xC0 = 0x1F40
-  RW_IRAM1 0x100000C0 0x1F40  {
-   .ANY (+RW +ZI)
-  }
-  RW_IRAM2 0x20004000 0x800   { ; RW data, USB RAM
-   .ANY (USBRAM)
-  }
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_STD/TARGET_LPC11U35_401/startup_LPC11xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,308 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_LPC11xx.s
-; * @purpose: CMSIS Cortex-M0 Core Device Startup File 
-; *           for the NXP LPC11xx Device Series 
-; * @version: V1.0
-; * @date:    25. Nov. 2008
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; * Copyright (C) 2008 ARM Limited. All rights reserved.
-; * ARM Limited (ARM) is supplying this software for use with Cortex-M0 
-; * processor based microcontrollers.  This file can be freely distributed 
-; * within development tools that are supporting such ARM based processors. 
-; *
-; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
-; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
-; *
-; *****************************************************************************/
-
-__initial_sp        EQU     0x10002000  ; Top of RAM from LPC11U
-
-                PRESERVE8
-                THUMB
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-
-__Vectors       DCD     __initial_sp              ; Top of Stack
-                DCD     Reset_Handler             ; Reset Handler
-                DCD     NMI_Handler               ; NMI Handler
-                DCD     HardFault_Handler         ; Hard Fault Handler
-                DCD     MemManage_Handler         ; MPU Fault Handler
-                DCD     BusFault_Handler          ; Bus Fault Handler
-                DCD     UsageFault_Handler        ; Usage Fault Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     SVC_Handler               ; SVCall Handler
-                DCD     DebugMon_Handler          ; Debug Monitor Handler
-                DCD     0                         ; Reserved
-                DCD     PendSV_Handler            ; PendSV Handler
-                DCD     SysTick_Handler           ; SysTick Handler
-
-                ; External Interrupts
-				; for LPC11Uxx (With USB)
-                DCD     FLEX_INT0_IRQHandler      ; All GPIO pin can be routed to FLEX_INTx
-                DCD     FLEX_INT1_IRQHandler          
-                DCD     FLEX_INT2_IRQHandler                       
-                DCD     FLEX_INT3_IRQHandler                         
-                DCD     FLEX_INT4_IRQHandler                        
-                DCD     FLEX_INT5_IRQHandler
-                DCD     FLEX_INT6_IRQHandler
-                DCD     FLEX_INT7_IRQHandler                       
-                DCD     GINT0_IRQHandler                         
-                DCD     GINT1_IRQHandler          ; PIO0 (0:7)              
-                DCD     Reserved_IRQHandler	      ; Reserved
-                DCD     Reserved_IRQHandler
-                DCD     Reserved_IRQHandler       
-                DCD     Reserved_IRQHandler                       
-                DCD     SSP1_IRQHandler           ; SSP1               
-                DCD     I2C_IRQHandler            ; I2C
-                DCD     TIMER16_0_IRQHandler      ; 16-bit Timer0
-                DCD     TIMER16_1_IRQHandler      ; 16-bit Timer1
-                DCD     TIMER32_0_IRQHandler      ; 32-bit Timer0
-                DCD     TIMER32_1_IRQHandler      ; 32-bit Timer1
-                DCD     SSP0_IRQHandler           ; SSP0
-                DCD     UART_IRQHandler           ; UART
-                DCD     USB_IRQHandler            ; USB IRQ
-                DCD     USB_FIQHandler            ; USB FIQ
-                DCD     ADC_IRQHandler            ; A/D Converter
-                DCD     WDT_IRQHandler            ; Watchdog timer
-                DCD     BOD_IRQHandler            ; Brown Out Detect
-                DCD     FMC_IRQHandler            ; IP2111 Flash Memory Controller
-                DCD     Reserved_IRQHandler	    ; Reserved
-                DCD     Reserved_IRQHandler       ; Reserved
-                DCD     USBWakeup_IRQHandler      ; USB wake up
-                DCD     Reserved_IRQHandler       ; Reserved
-	
-	;; 48 vector entries. We pad to 128 to fill the 0x0 - 0x1FF REMAP address space
-                
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-	
-                IF      :LNOT::DEF:NO_CRP
-                AREA    |.ARM.__at_0x02FC|, CODE, READONLY
-CRP_Key         DCD     0xFFFFFFFF
-                ENDIF
-
-
-                AREA    |.text|, CODE, READONLY
-
-
-	
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-; Dummy Exception Handlers (infinite loops which can be modified)                
-
-; now, under COMMON NMI.c and NMI.h, a real NMI handler is created if NMI is enabled 
-; for particular peripheral.
-;NMI_Handler     PROC
-;                EXPORT  NMI_Handler               [WEAK]
-;                B       .
-;                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-MemManage_Handler\
-                PROC
-                EXPORT  MemManage_Handler         [WEAK]
-                B       .
-                ENDP
-BusFault_Handler\
-                PROC
-                EXPORT  BusFault_Handler          [WEAK]
-                B       .
-                ENDP
-UsageFault_Handler\
-                PROC
-                EXPORT  UsageFault_Handler        [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-DebugMon_Handler\
-                PROC
-                EXPORT  DebugMon_Handler          [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-Reserved_IRQHandler PROC
-                EXPORT  Reserved_IRQHandler       [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-; for LPC11Uxx (With USB)
-                EXPORT  NMI_Handler               [WEAK]
-                EXPORT  FLEX_INT0_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT1_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT2_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT3_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT4_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT5_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT6_IRQHandler      [WEAK]
-                EXPORT  FLEX_INT7_IRQHandler      [WEAK]
-                EXPORT  GINT0_IRQHandler          [WEAK]
-                EXPORT  GINT1_IRQHandler          [WEAK]
-                EXPORT  SSP1_IRQHandler           [WEAK]
-                EXPORT  I2C_IRQHandler            [WEAK]
-                EXPORT  TIMER16_0_IRQHandler      [WEAK]
-                EXPORT  TIMER16_1_IRQHandler      [WEAK]
-                EXPORT  TIMER32_0_IRQHandler      [WEAK]
-                EXPORT  TIMER32_1_IRQHandler      [WEAK]
-                EXPORT  SSP0_IRQHandler           [WEAK]
-                EXPORT  UART_IRQHandler           [WEAK]
-
-                EXPORT  USB_IRQHandler            [WEAK]
-                EXPORT  USB_FIQHandler            [WEAK]
-                EXPORT  ADC_IRQHandler            [WEAK]
-                EXPORT  WDT_IRQHandler            [WEAK]
-                EXPORT  BOD_IRQHandler            [WEAK]
-                EXPORT  FMC_IRQHandler            [WEAK]
-                EXPORT	USBWakeup_IRQHandler      [WEAK]
-
-NMI_Handler
-FLEX_INT0_IRQHandler
-FLEX_INT1_IRQHandler
-FLEX_INT2_IRQHandler
-FLEX_INT3_IRQHandler
-FLEX_INT4_IRQHandler
-FLEX_INT5_IRQHandler
-FLEX_INT6_IRQHandler
-FLEX_INT7_IRQHandler
-GINT0_IRQHandler
-GINT1_IRQHandler
-SSP1_IRQHandler
-I2C_IRQHandler
-TIMER16_0_IRQHandler
-TIMER16_1_IRQHandler
-TIMER32_0_IRQHandler
-TIMER32_1_IRQHandler
-SSP0_IRQHandler
-UART_IRQHandler
-USB_IRQHandler
-USB_FIQHandler
-ADC_IRQHandler
-WDT_IRQHandler
-BOD_IRQHandler
-FMC_IRQHandler
-USBWakeup_IRQHandler
-
-                B       .
-
-                ENDP
-
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_ARM_STD/sys.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library - stackheap
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * Setup a fixed single stack/heap memory model, 
- *  between the top of the RW/ZI region and the stackpointer
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-#include <rt_misc.h>
-#include <stdint.h>
-
-extern char Image$$RW_IRAM1$$ZI$$Limit[];
-
-extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
-    uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
-    uint32_t sp_limit = __current_sp();
-
-    zi_limit = (zi_limit + 7) & ~0x7;    // ensure zi_limit is 8-byte aligned
-
-    struct __initial_stackheap r;
-    r.heap_base = zi_limit;
-    r.heap_limit = sp_limit;
-    return r;
-}
-
-#ifdef __cplusplus
-}
-#endif 
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11U24_301/LPC11U24.ld	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-/* Linker script for mbed LPC1768 */
-
-/* Linker script to configure memory regions. */
-MEMORY
-{
-  FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 32K
-  RAM (rwx) : ORIGIN = 0x100000C0, LENGTH = 0x1740
-  USB_RAM (rwx): ORIGIN = 0x20004000, LENGTH = 0x800
-}
-
-/* Linker script to place sections and symbol values. Should be used together
- * with other linker script that defines memory regions FLASH and RAM.
- * It references following symbols, which must be defined in code:
- *   Reset_Handler : Entry of reset handler
- * 
- * It defines following symbols, which code can use without definition:
- *   __exidx_start
- *   __exidx_end
- *   __etext
- *   __data_start__
- *   __preinit_array_start
- *   __preinit_array_end
- *   __init_array_start
- *   __init_array_end
- *   __fini_array_start
- *   __fini_array_end
- *   __data_end__
- *   __bss_start__
- *   __bss_end__
- *   __end__
- *   end
- *   __HeapLimit
- *   __StackLimit
- *   __StackTop
- *   __stack
- */
-ENTRY(Reset_Handler)
-
-SECTIONS
-{
-    .text :
-    {
-        KEEP(*(.isr_vector))
-        *(.text.Reset_Handler)
-        *(.text.SystemInit)
-        
-        /* Only vectors and code running at reset are safe to be in first 512
-           bytes since RAM can be mapped into this area for RAM based interrupt
-           vectors. */
-        . = 0x00000200;
-        *(.text*)
-
-        KEEP(*(.init))
-        KEEP(*(.fini))
-
-        /* .ctors */
-        *crtbegin.o(.ctors)
-        *crtbegin?.o(.ctors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
-        *(SORT(.ctors.*))
-        *(.ctors)
-
-        /* .dtors */
-        *crtbegin.o(.dtors)
-        *crtbegin?.o(.dtors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
-        *(SORT(.dtors.*))
-        *(.dtors)
-
-        *(.rodata*)
-
-        KEEP(*(.eh_frame*))
-    } > FLASH
-
-    .ARM.extab : 
-    {
-        *(.ARM.extab* .gnu.linkonce.armextab.*)
-    } > FLASH
-
-    __exidx_start = .;
-    .ARM.exidx :
-    {
-        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-    } > FLASH
-    __exidx_end = .;
-
-    __etext = .;
-        
-    .data : AT (__etext)
-    {
-        __data_start__ = .;
-        *(vtable)
-        *(.data*)
-
-        . = ALIGN(4);
-        /* preinit data */
-        PROVIDE (__preinit_array_start = .);
-        KEEP(*(.preinit_array))
-        PROVIDE (__preinit_array_end = .);
-
-        . = ALIGN(4);
-        /* init data */
-        PROVIDE (__init_array_start = .);
-        KEEP(*(SORT(.init_array.*)))
-        KEEP(*(.init_array))
-        PROVIDE (__init_array_end = .);
-
-
-        . = ALIGN(4);
-        /* finit data */
-        PROVIDE (__fini_array_start = .);
-        KEEP(*(SORT(.fini_array.*)))
-        KEEP(*(.fini_array))
-        PROVIDE (__fini_array_end = .);
-
-        . = ALIGN(4);
-        /* All data end */
-        __data_end__ = .;
-
-    } > RAM
-
-    .bss :
-    {
-        __bss_start__ = .;
-        *(.bss*)
-        *(COMMON)
-        __bss_end__ = .;
-    } > RAM
-    
-    .heap :
-    {
-        __end__ = .;
-        end = __end__;
-        *(.heap*)
-        __HeapLimit = .;
-    } > RAM
-
-    /* .stack_dummy section doesn't contains any symbols. It is only
-     * used for linker to calculate size of stack sections, and assign
-     * values to stack symbols later */
-    .stack_dummy :
-    {
-        *(.stack)
-    } > RAM
-
-    /* Set stack top to end of RAM, and stack limit move down by
-     * size of stack_dummy section */
-    __StackTop = ORIGIN(RAM) + LENGTH(RAM);
-    __StackLimit = __StackTop - SIZEOF(.stack_dummy);
-    PROVIDE(__stack = __StackTop);
-    
-    /* Check if data + heap + stack exceeds RAM limit */
-    ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11U24_401/LPC11U24.ld	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-/* Linker script for mbed LPC1768 */
-
-/* Linker script to configure memory regions. */
-MEMORY
-{
-  FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 32K
-  RAM (rwx) : ORIGIN = 0x100000C0, LENGTH = 0x1F40
-  USB_RAM (rwx): ORIGIN = 0x20004000, LENGTH = 0x800
-}
-
-/* Linker script to place sections and symbol values. Should be used together
- * with other linker script that defines memory regions FLASH and RAM.
- * It references following symbols, which must be defined in code:
- *   Reset_Handler : Entry of reset handler
- * 
- * It defines following symbols, which code can use without definition:
- *   __exidx_start
- *   __exidx_end
- *   __etext
- *   __data_start__
- *   __preinit_array_start
- *   __preinit_array_end
- *   __init_array_start
- *   __init_array_end
- *   __fini_array_start
- *   __fini_array_end
- *   __data_end__
- *   __bss_start__
- *   __bss_end__
- *   __end__
- *   end
- *   __HeapLimit
- *   __StackLimit
- *   __StackTop
- *   __stack
- */
-ENTRY(Reset_Handler)
-
-SECTIONS
-{
-    .text :
-    {
-        KEEP(*(.isr_vector))
-        *(.text.Reset_Handler)
-        *(.text.SystemInit)
-        
-        /* Only vectors and code running at reset are safe to be in first 512
-           bytes since RAM can be mapped into this area for RAM based interrupt
-           vectors. */
-        . = 0x00000200;
-        *(.text*)
-
-        KEEP(*(.init))
-        KEEP(*(.fini))
-
-        /* .ctors */
-        *crtbegin.o(.ctors)
-        *crtbegin?.o(.ctors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
-        *(SORT(.ctors.*))
-        *(.ctors)
-
-        /* .dtors */
-        *crtbegin.o(.dtors)
-        *crtbegin?.o(.dtors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
-        *(SORT(.dtors.*))
-        *(.dtors)
-
-        *(.rodata*)
-
-        KEEP(*(.eh_frame*))
-    } > FLASH
-
-    .ARM.extab : 
-    {
-        *(.ARM.extab* .gnu.linkonce.armextab.*)
-    } > FLASH
-
-    __exidx_start = .;
-    .ARM.exidx :
-    {
-        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-    } > FLASH
-    __exidx_end = .;
-
-    __etext = .;
-        
-    .data : AT (__etext)
-    {
-        __data_start__ = .;
-        *(vtable)
-        *(.data*)
-
-        . = ALIGN(4);
-        /* preinit data */
-        PROVIDE (__preinit_array_start = .);
-        KEEP(*(.preinit_array))
-        PROVIDE (__preinit_array_end = .);
-
-        . = ALIGN(4);
-        /* init data */
-        PROVIDE (__init_array_start = .);
-        KEEP(*(SORT(.init_array.*)))
-        KEEP(*(.init_array))
-        PROVIDE (__init_array_end = .);
-
-
-        . = ALIGN(4);
-        /* finit data */
-        PROVIDE (__fini_array_start = .);
-        KEEP(*(SORT(.fini_array.*)))
-        KEEP(*(.fini_array))
-        PROVIDE (__fini_array_end = .);
-
-        . = ALIGN(4);
-        /* All data end */
-        __data_end__ = .;
-
-    } > RAM
-
-    .bss :
-    {
-        __bss_start__ = .;
-        *(.bss*)
-        *(COMMON)
-        __bss_end__ = .;
-    } > RAM
-    
-    .heap :
-    {
-        __end__ = .;
-        end = __end__;
-        *(.heap*)
-        __HeapLimit = .;
-    } > RAM
-
-    /* .stack_dummy section doesn't contains any symbols. It is only
-     * used for linker to calculate size of stack sections, and assign
-     * values to stack symbols later */
-    .stack_dummy :
-    {
-        *(.stack)
-    } > RAM
-
-    /* Set stack top to end of RAM, and stack limit move down by
-     * size of stack_dummy section */
-    __StackTop = ORIGIN(RAM) + LENGTH(RAM);
-    __StackLimit = __StackTop - SIZEOF(.stack_dummy);
-    PROVIDE(__stack = __StackTop);
-    
-    /* Check if data + heap + stack exceeds RAM limit */
-    ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11U35_401/LPC11U35.ld	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-/* Linker script to configure memory regions. */
-MEMORY
-{
-  FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 64K
-  RAM (rwx) : ORIGIN = 0x100000C0, LENGTH = 0x1F40
-  USB_RAM (rwx): ORIGIN = 0x20004000, LENGTH = 0x800
-}
-
-/* Linker script to place sections and symbol values. Should be used together
- * with other linker script that defines memory regions FLASH and RAM.
- * It references following symbols, which must be defined in code:
- *   Reset_Handler : Entry of reset handler
- * 
- * It defines following symbols, which code can use without definition:
- *   __exidx_start
- *   __exidx_end
- *   __etext
- *   __data_start__
- *   __preinit_array_start
- *   __preinit_array_end
- *   __init_array_start
- *   __init_array_end
- *   __fini_array_start
- *   __fini_array_end
- *   __data_end__
- *   __bss_start__
- *   __bss_end__
- *   __end__
- *   end
- *   __HeapLimit
- *   __StackLimit
- *   __StackTop
- *   __stack
- */
-ENTRY(Reset_Handler)
-
-SECTIONS
-{
-    .text :
-    {
-        KEEP(*(.isr_vector))
-        *(.text.Reset_Handler)
-        *(.text.SystemInit)
-        
-        /* Only vectors and code running at reset are safe to be in first 512
-           bytes since RAM can be mapped into this area for RAM based interrupt
-           vectors. */
-        . = 0x00000200;
-        *(.text*)
-
-        KEEP(*(.init))
-        KEEP(*(.fini))
-
-        /* .ctors */
-        *crtbegin.o(.ctors)
-        *crtbegin?.o(.ctors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
-        *(SORT(.ctors.*))
-        *(.ctors)
-
-        /* .dtors */
-        *crtbegin.o(.dtors)
-        *crtbegin?.o(.dtors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
-        *(SORT(.dtors.*))
-        *(.dtors)
-
-        *(.rodata*)
-
-        KEEP(*(.eh_frame*))
-    } > FLASH
-
-    .ARM.extab : 
-    {
-        *(.ARM.extab* .gnu.linkonce.armextab.*)
-    } > FLASH
-
-    __exidx_start = .;
-    .ARM.exidx :
-    {
-        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-    } > FLASH
-    __exidx_end = .;
-
-    __etext = .;
-        
-    .data : AT (__etext)
-    {
-        __data_start__ = .;
-        *(vtable)
-        *(.data*)
-
-        . = ALIGN(4);
-        /* preinit data */
-        PROVIDE (__preinit_array_start = .);
-        KEEP(*(.preinit_array))
-        PROVIDE (__preinit_array_end = .);
-
-        . = ALIGN(4);
-        /* init data */
-        PROVIDE (__init_array_start = .);
-        KEEP(*(SORT(.init_array.*)))
-        KEEP(*(.init_array))
-        PROVIDE (__init_array_end = .);
-
-
-        . = ALIGN(4);
-        /* finit data */
-        PROVIDE (__fini_array_start = .);
-        KEEP(*(SORT(.fini_array.*)))
-        KEEP(*(.fini_array))
-        PROVIDE (__fini_array_end = .);
-
-        . = ALIGN(4);
-        /* All data end */
-        __data_end__ = .;
-
-    } > RAM
-
-    .bss :
-    {
-        __bss_start__ = .;
-        *(.bss*)
-        *(COMMON)
-        __bss_end__ = .;
-    } > RAM
-    
-    .heap :
-    {
-        __end__ = .;
-        end = __end__;
-        *(.heap*)
-        __HeapLimit = .;
-    } > RAM
-
-    /* .stack_dummy section doesn't contains any symbols. It is only
-     * used for linker to calculate size of stack sections, and assign
-     * values to stack symbols later */
-    .stack_dummy :
-    {
-        *(.stack)
-    } > RAM
-
-    /* Set stack top to end of RAM, and stack limit move down by
-     * size of stack_dummy section */
-    __StackTop = ORIGIN(RAM) + LENGTH(RAM);
-    __StackLimit = __StackTop - SIZEOF(.stack_dummy);
-    PROVIDE(__stack = __StackTop);
-    
-    /* Check if data + heap + stack exceeds RAM limit */
-    ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/startup_LPC11xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,213 +0,0 @@
-/* File: startup_ARMCM0.S
- * Purpose: startup file for Cortex-M0 devices. Should use with 
- *   GCC for ARM Embedded Processors
- * Version: V1.2
- * Date: 15 Nov 2011
- * 
- * Copyright (c) 2011, 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 the ARM Limited 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 ARM LIMITED 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.
- */
-    .syntax unified
-    .arch armv6-m
-
-/* Memory Model
-   The HEAP starts at the end of the DATA section and grows upward.
-   
-   The STACK starts at the end of the RAM and grows downward.
-   
-   The HEAP and stack STACK are only checked at compile time:
-   (DATA_SIZE + HEAP_SIZE + STACK_SIZE) < RAM_SIZE
-   
-   This is just a check for the bare minimum for the Heap+Stack area before
-   aborting compilation, it is not the run time limit:
-   Heap_Size + Stack_Size = 0x80 + 0x80 = 0x100
- */
-    .section .stack
-    .align 3
-#ifdef __STACK_SIZE
-    .equ    Stack_Size, __STACK_SIZE
-#else
-    .equ    Stack_Size, 0x80
-#endif
-    .globl    __StackTop
-    .globl    __StackLimit
-__StackLimit:
-    .space    Stack_Size
-    .size __StackLimit, . - __StackLimit
-__StackTop:
-    .size __StackTop, . - __StackTop
-
-    .section .heap
-    .align 3
-#ifdef __HEAP_SIZE
-    .equ    Heap_Size, __HEAP_SIZE
-#else
-    .equ    Heap_Size, 0x80
-#endif
-    .globl    __HeapBase
-    .globl    __HeapLimit
-__HeapBase:
-    .space    Heap_Size
-    .size __HeapBase, . - __HeapBase
-__HeapLimit:
-    .size __HeapLimit, . - __HeapLimit
-    
-    .section .isr_vector
-    .align 2
-    .globl __isr_vector
-__isr_vector:
-    .long    __StackTop            /* Top of Stack */
-    .long    Reset_Handler         /* Reset Handler */
-    .long    NMI_Handler           /* NMI Handler */
-    .long    HardFault_Handler     /* Hard Fault Handler */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    SVC_Handler           /* SVCall Handler */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    PendSV_Handler        /* PendSV Handler */
-    .long    SysTick_Handler       /* SysTick Handler */
-
-/* LPC11xx interrupts */
-    .long   WAKEUP_IRQHandler         /* 16  0 Wake-up on  pin  PIO0_0             */
-    .long   WAKEUP_IRQHandler         /* 17  1 Wake-up on  pin  PIO0_1             */
-    .long   WAKEUP_IRQHandler         /* 18  2 Wake-up on  pin  PIO0_2             */
-    .long   WAKEUP_IRQHandler         /* 19  3 Wake-up on  pin  PIO0_3             */
-    .long   WAKEUP_IRQHandler         /* 20  4 Wake-up on  pin  PIO0_4             */
-    .long   WAKEUP_IRQHandler         /* 21  5 Wake-up on  pin  PIO0_5             */
-    .long   WAKEUP_IRQHandler         /* 22  6 Wake-up on  pin  PIO0_6             */
-    .long   WAKEUP_IRQHandler         /* 23  7 Wake-up on  pin  PIO0_7             */
-    .long   WAKEUP_IRQHandler         /* 24  8 Wake-up on  pin  PIO0_8             */
-    .long   WAKEUP_IRQHandler         /* 25  9 Wake-up on  pin  PIO0_9             */
-    .long   WAKEUP_IRQHandler         /* 26 10 Wake-up on  pin  PIO0_10            */
-    .long   WAKEUP_IRQHandler         /* 27 11 Wake-up on  pin  PIO0_11            */
-    .long   WAKEUP_IRQHandler         /* 28 12 Wake-up on  pin  PIO1_0             */
-    .long   Default_Handler           /* 29 13                                     */
-    .long   SSP1_IRQHandler           /* 30 14 SSP1                                */
-    .long   I2C_IRQHandler            /* 31 15 I2C0 SI (state change)              */
-    .long   TIMER16_0_IRQHandler      /* 32 16 CT16B0 16 bit timer 0               */
-    .long   TIMER16_1_IRQHandler      /* 33 17 CT16B1 16 bit timer 1               */
-    .long   TIMER32_0_IRQHandler      /* 34 18 CT32B0 32 bit timer 0               */
-    .long   TIMER32_1_IRQHandler      /* 35 19 CT32B1 32 bit timer 1               */
-    .long   SSP0_IRQHandler           /* 36 20 SSP                                 */
-    .long   UART_IRQHandler           /* 37 21 UART                                */
-    .long   Default_Handler           /* 38 22                                     */
-    .long   Default_Handler           /* 39 23                                     */
-    .long   ADC_IRQHandler            /* 40 24 ADC end of conversion               */
-    .long   WDT_IRQHandler            /* 41 25 Watchdog interrupt (WDINT)          */
-    .long   BOD_IRQHandler            /* 42 26 BOD Brown-out detect                */
-    .long   Default_Handler           /* 43 27                                     */
-    .long   PIOINT3_IRQHandler        /* 44 28 PIO_3  GPIO interrupt status of port 3 */
-    .long   PIOINT2_IRQHandler        /* 45 29 PIO_2  GPIO interrupt status of port 2 */
-    .long   PIOINT1_IRQHandler        /* 46 30 PIO_1  GPIO interrupt status of port 1 */
-    .long   PIOINT0_IRQHandler        /* 47 31 PIO_0  GPIO interrupt status of port 0 */
-    
-    .size    __isr_vector, . - __isr_vector
-
-    .section .text.Reset_Handler
-    .thumb
-    .thumb_func
-    .align 2
-    .globl    Reset_Handler
-    .type    Reset_Handler, %function
-Reset_Handler:
-/*     Loop to copy data from read only memory to RAM. The ranges
- *      of copy from/to are specified by following symbols evaluated in 
- *      linker script.
- *      __etext: End of code section, i.e., begin of data sections to copy from.
- *      __data_start__/__data_end__: RAM address range that data should be
- *      copied to. Both must be aligned to 4 bytes boundary.  */
-
-    ldr    r1, =__etext
-    ldr    r2, =__data_start__
-    ldr    r3, =__data_end__
-
-    subs    r3, r2
-    ble    .flash_to_ram_loop_end
-
-    movs    r4, 0
-.flash_to_ram_loop:
-    ldr    r0, [r1,r4]
-    str    r0, [r2,r4]
-    adds    r4, 4
-    cmp    r4, r3
-    blt    .flash_to_ram_loop
-.flash_to_ram_loop_end:
-
-    ldr    r0, =SystemInit
-    blx    r0
-    ldr    r0, =_start
-    bx    r0
-    .pool
-    .size Reset_Handler, . - Reset_Handler
-    
-    .text
-/*    Macro to define default handlers. Default handler
- *    will be weak symbol and just dead loops. They can be
- *    overwritten by other handlers */
-    .macro    def_default_handler    handler_name
-    .align 1
-    .thumb_func
-    .weak    \handler_name
-    .type    \handler_name, %function
-\handler_name :
-    b    .
-    .size    \handler_name, . - \handler_name
-    .endm
-    
-    def_default_handler    NMI_Handler
-    def_default_handler    HardFault_Handler
-    def_default_handler    SVC_Handler
-    def_default_handler    PendSV_Handler
-    def_default_handler    SysTick_Handler
-    def_default_handler    Default_Handler
-    
-    def_default_handler    WAKEUP_IRQHandler
-    def_default_handler    SSP1_IRQHandler
-    def_default_handler    I2C_IRQHandler
-    def_default_handler    TIMER16_0_IRQHandler
-    def_default_handler    TIMER16_1_IRQHandler
-    def_default_handler    TIMER32_0_IRQHandler
-    def_default_handler    TIMER32_1_IRQHandler
-    def_default_handler    SSP0_IRQHandler
-    def_default_handler    UART_IRQHandler
-    def_default_handler    ADC_IRQHandler
-    def_default_handler    WDT_IRQHandler
-    def_default_handler    BOD_IRQHandler
-    def_default_handler    PIOINT3_IRQHandler
-    def_default_handler    PIOINT2_IRQHandler
-    def_default_handler    PIOINT1_IRQHandler
-    def_default_handler    PIOINT0_IRQHandler
-
-    .weak    DEF_IRQHandler
-    .set    DEF_IRQHandler, Default_Handler
-
-    .end
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_CR/LPC11U24.ld	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-/* mbed - LPC11U24 linker script
- * Based linker script generated by Code Red Technologies Red Suite 4.1
- */
-GROUP(libgcc.a libc.a libstdc++.a libm.a libcr_newlib_nohost.a crti.o crtn.o crtbegin.o crtend.o)
-
-MEMORY
-{
-  /* Define each memory region */
-  MFlash32 (rx) : ORIGIN = 0x0, LENGTH = 0x8000 /* 32k */
-  RamLoc8 (rwx) : ORIGIN = 0x100000C0, LENGTH = 0x1F40 /* 8k */
-  RamUsb2 (rwx) : ORIGIN = 0x20004000, LENGTH = 0x800 /* 2k */
-}
-  /* Define a symbol for the top of each memory region */
-  __top_MFlash32 = 0x0 + 0x8000;
-  __top_RamLoc8 = 0x10000000 + 0x2000;
-  __top_RamUsb2 = 0x20004000 + 0x800;
-
-ENTRY(ResetISR)
-
-SECTIONS
-{
-
-    /* MAIN TEXT SECTION */ 
-    .text : ALIGN(4)
-    {
-        FILL(0xff)
-        KEEP(*(.isr_vector))
-        
-        /* Global Section Table */
-        . = ALIGN(4) ;
-        __section_table_start = .;
-        __data_section_table = .;
-        LONG(LOADADDR(.data));
-        LONG(    ADDR(.data)) ;
-        LONG(  SIZEOF(.data));
-        LONG(LOADADDR(.data_RAM2));
-        LONG(    ADDR(.data_RAM2)) ;
-        LONG(  SIZEOF(.data_RAM2));
-        __data_section_table_end = .;
-        __bss_section_table = .;
-        LONG(    ADDR(.bss));
-        LONG(  SIZEOF(.bss));
-        LONG(    ADDR(.bss_RAM2));
-        LONG(  SIZEOF(.bss_RAM2));
-        __bss_section_table_end = .;
-        __section_table_end = . ;
-        /* End of Global Section Table */
-        
-
-        *(.after_vectors*)
-        
-        *(.text*)
-        *(.rodata .rodata.*)
-        . = ALIGN(4);
-        
-        /* C++ constructors etc */
-        . = ALIGN(4);
-        KEEP(*(.init))
-        
-        . = ALIGN(4);
-        __preinit_array_start = .;
-        KEEP (*(.preinit_array))
-        __preinit_array_end = .;
-        
-        . = ALIGN(4);
-        __init_array_start = .;
-        KEEP (*(SORT(.init_array.*)))
-        KEEP (*(.init_array))
-        __init_array_end = .;
-        
-        KEEP(*(.fini));
-        
-        . = ALIGN(0x4);
-        KEEP (*crtbegin.o(.ctors))
-        KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
-        KEEP (*(SORT(.ctors.*)))
-        KEEP (*crtend.o(.ctors))
-        
-        . = ALIGN(0x4);
-        KEEP (*crtbegin.o(.dtors))
-        KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
-        KEEP (*(SORT(.dtors.*)))
-        KEEP (*crtend.o(.dtors))
-        /* End C++ */
-    } > MFlash32
-
-    /*
-     * for exception handling/unwind - some Newlib functions (in common
-     * with C++ and STDC++) use this.
-     */
-    .ARM.extab : ALIGN(4)
-    {
-        *(.ARM.extab* .gnu.linkonce.armextab.*)
-    } > MFlash32
-    __exidx_start = .;
-    
-    .ARM.exidx : ALIGN(4)
-    {
-        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-    } > MFlash32
-    __exidx_end = .;
-    
-    _etext = .;
-        
-    
-    .data_RAM2 : ALIGN(4)
-    {
-       FILL(0xff)
-        *(.data.$RAM2*)
-        *(.data.$RamUsb2*)
-       . = ALIGN(4) ;
-    } > RamUsb2 AT>MFlash32
-    
-    /* MAIN DATA SECTION */
-
-    .uninit_RESERVED : ALIGN(4)
-    {
-        KEEP(*(.bss.$RESERVED*))
-    } > RamLoc8
-
-    .data : ALIGN(4)
-    {
-        FILL(0xff)
-        _data = .;
-        *(vtable)
-        *(.data*)
-        . = ALIGN(4) ;
-        _edata = .;
-    } > RamLoc8 AT>MFlash32
-
-    
-    .bss_RAM2 : ALIGN(4)
-    {
-        *(.bss.$RAM2*)
-        *(.bss.$RamUsb2*)
-       . = ALIGN(4) ;
-    } > RamUsb2
-
-    /* MAIN BSS SECTION */
-    .bss : ALIGN(4)
-    {
-        _bss = .;
-        *(.bss*)
-        *(COMMON)
-        . = ALIGN(4) ;
-        _ebss = .;
-        PROVIDE(end = .);
-    } > RamLoc8
-    
-    PROVIDE(_pvHeapStart = .);
-    PROVIDE(_vStackTop = __top_RamLoc8 - 0);
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_CR/startup_LPC11xx.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-extern "C" {
-
-#include "LPC11Uxx.h"
-
-#define WEAK          __attribute__ ((weak))
-#define ALIAS(f)      __attribute__ ((weak, alias (#f)))
-#define AFTER_VECTORS __attribute__ ((section(".after_vectors")))
-
-     void ResetISR            (void);
-WEAK void NMI_Handler         (void);
-WEAK void HardFault_Handler   (void);
-WEAK void SVCall_Handler      (void);
-WEAK void PendSV_Handler      (void);
-WEAK void SysTick_Handler     (void);
-WEAK void IntDefaultHandler   (void);
-     void FLEX_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void FLEX_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void FLEX_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void FLEX_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void FLEX_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void FLEX_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void FLEX_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void FLEX_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void GINT0_IRQHandler    (void) ALIAS(IntDefaultHandler);
-     void GINT1_IRQHandler    (void) ALIAS(IntDefaultHandler);
-     void SSP1_IRQHandler     (void) ALIAS(IntDefaultHandler);
-     void I2C_IRQHandler      (void) ALIAS(IntDefaultHandler);
-     void TIMER16_0_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void TIMER16_1_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void TIMER32_0_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void TIMER32_1_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void SSP0_IRQHandler     (void) ALIAS(IntDefaultHandler);
-     void UART_IRQHandler     (void) ALIAS(IntDefaultHandler);
-     void USB_IRQHandler      (void) ALIAS(IntDefaultHandler);
-     void USB_FIQHandler      (void) ALIAS(IntDefaultHandler);
-     void ADC_IRQHandler      (void) ALIAS(IntDefaultHandler);
-     void WDT_IRQHandler      (void) ALIAS(IntDefaultHandler);
-     void BOD_IRQHandler      (void) ALIAS(IntDefaultHandler);
-     void FMC_IRQHandler      (void) ALIAS(IntDefaultHandler);
-     void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
-
-extern void __libc_init_array(void);
-extern int main(void);
-extern void _vStackTop(void);
-
-extern void (* const g_pfnVectors[])(void);
-__attribute__ ((section(".isr_vector")))
-void (* const g_pfnVectors[])(void) = {
-    &_vStackTop,
-    ResetISR,
-    NMI_Handler,
-    HardFault_Handler,
-    0,
-    0,
-    0,
-    0,
-    0,
-    0,
-    0,
-    SVCall_Handler,
-    0,
-    0,
-    PendSV_Handler,
-    SysTick_Handler,
-    FLEX_INT0_IRQHandler,
-    FLEX_INT1_IRQHandler,
-    FLEX_INT2_IRQHandler,
-    FLEX_INT3_IRQHandler,
-    FLEX_INT4_IRQHandler,
-    FLEX_INT5_IRQHandler,
-    FLEX_INT6_IRQHandler,
-    FLEX_INT7_IRQHandler,
-    GINT0_IRQHandler,
-    GINT1_IRQHandler,
-    0,
-    0,
-    0,
-    0,
-    SSP1_IRQHandler,
-    I2C_IRQHandler,
-    TIMER16_0_IRQHandler,
-    TIMER16_1_IRQHandler,
-    TIMER32_0_IRQHandler,
-    TIMER32_1_IRQHandler,
-    SSP0_IRQHandler,
-    UART_IRQHandler,
-    USB_IRQHandler,
-    USB_FIQHandler,
-    ADC_IRQHandler,
-    WDT_IRQHandler,
-    BOD_IRQHandler,
-    FMC_IRQHandler,
-    0,
-    0,
-    USBWakeup_IRQHandler,
-    0,
-};
-
-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++;
-}
-
-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;
-}
-
-extern unsigned int __data_section_table;
-extern unsigned int __data_section_table_end;
-extern unsigned int __bss_section_table_end;
-
-AFTER_VECTORS void ResetISR(void) {
-    unsigned int LoadAddr, ExeAddr, SectionLen;
-    unsigned int *SectionTableAddr;
-    
-    // Data Init
-    SectionTableAddr = &__data_section_table;
-    while (SectionTableAddr < &__data_section_table_end) {
-        LoadAddr = *SectionTableAddr++;
-        ExeAddr = *SectionTableAddr++;
-        SectionLen = *SectionTableAddr++;
-        data_init(LoadAddr, ExeAddr, SectionLen);
-    }
-    
-    // BSS Init
-    while (SectionTableAddr < &__bss_section_table_end) {
-        ExeAddr = *SectionTableAddr++;
-        SectionLen = *SectionTableAddr++;
-        bss_init(ExeAddr, SectionLen);
-    }
-    
-    SystemInit();
-    __libc_init_array();
-    main();
-    while (1) {;}
-}
-
-AFTER_VECTORS void NMI_Handler      (void) {while(1){}}
-AFTER_VECTORS void HardFault_Handler(void) {while(1){}}
-AFTER_VECTORS void SVCall_Handler   (void) {while(1){}}
-AFTER_VECTORS void PendSV_Handler   (void) {while(1){}}
-AFTER_VECTORS void SysTick_Handler  (void) {while(1){}}
-AFTER_VECTORS void IntDefaultHandler(void) {while(1){}}
-
-#include <stdlib.h>
-
-void *operator new  (size_t size) {return malloc(size);}
-void *operator new[](size_t size) {return malloc(size);}
-
-void operator delete  (void *p) {free(p);}
-void operator delete[](void *p) {free(p);}
-
-int __aeabi_atexit(void *object, void (*destructor)(void *), void *dso_handle) {
-    return 0;
-}
-
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_CS/LPC11U24.ld	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +0,0 @@
-/* Linker script for mbed LPC1768
- *
- * Version:CodeSourcery Sourcery G++ Lite 2007q3-53
- * BugURL:https://support.codesourcery.com/GNUToolchain/
- *
- *  Copyright 2007 CodeSourcery.
- *
- * The authors hereby grant permission to use, copy, modify, distribute,
- * and license this software and its documentation for any purpose, provided
- * that existing copyright notices are retained in all copies and that this
- * notice is included verbatim in any distributions. No written agreement,
- * license, or royalty fee is required for any of the authorized uses.
- * Modifications to this software may be copyrighted by their authors
- * and need not follow the licensing terms described here, provided that
- * the new terms are clearly indicated on the first page of each file where
- * they apply. */
-
-OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
-ENTRY(__cs3_reset_cortex_m)
-SEARCH_DIR(.)
-
-/*
-ram ORIGIN: 8_byte_aligned(48 vect * 4 bytes) =  8_byte_aligned(0xC0) = 0xC0
-ram LENGTH: 8KB - 0xC0 = 0xF40
-*/
-MEMORY
-{
-  rom (rx)  : ORIGIN = 0x00000000, LENGTH = 32K
-  
-  ram (rwx) : ORIGIN = 0x100000C0, LENGTH = 0x1F40
-  usb_ram (rwx) : ORIGIN = 0x20004000, LENGTH = 0x800
-}
-
-/* These force the linker to search for particular symbols from
- * the start of the link process and thus ensure the user's
- * overrides are picked up
- */
-EXTERN(__cs3_reset_cortex_m)
-EXTERN(__cs3_interrupt_vector_cortex_m)
-EXTERN(__cs3_start_c main __cs3_stack __cs3_stack_size __cs3_heap_end)
-
-PROVIDE(__cs3_stack = __cs3_region_start_ram + __cs3_region_size_ram);
-PROVIDE(__cs3_stack_size = __cs3_region_start_ram + __cs3_region_size_ram - _end);
-PROVIDE(__cs3_heap_start = _end);
-PROVIDE(__cs3_heap_end = __cs3_region_start_ram + __cs3_region_size_ram);
-
-SECTIONS
-{
-  .text :
-  {
-    CREATE_OBJECT_SYMBOLS
-    __cs3_region_start_rom = .;
-    *(.cs3.region-head.rom)
-    __cs3_interrupt_vector = __cs3_interrupt_vector_cortex_m;
-    *(.cs3.interrupt_vector)
-    /* Make sure we pulled in an interrupt vector.  */
-    ASSERT (. != __cs3_interrupt_vector_cortex_m, "No interrupt vector");
-    *(.rom)
-    *(.rom.b)
-
-    __cs3_reset = __cs3_reset_cortex_m;
-    *(.cs3.reset)
-    /* Make sure we pulled in some reset code.  */
-    ASSERT (. != __cs3_reset, "No reset code");
-
-    *(.text .text.* .gnu.linkonce.t.*)
-    *(.plt)
-    *(.gnu.warning)
-    *(.glue_7t) *(.glue_7) *(.vfp11_veneer)
-
-    *(.rodata .rodata.* .gnu.linkonce.r.*)
-
-    *(.ARM.extab* .gnu.linkonce.armextab.*)
-    *(.gcc_except_table)
-    *(.eh_frame_hdr)
-    *(.eh_frame)
-
-    . = ALIGN(4);
-    KEEP(*(.init))
-
-    . = ALIGN(4);
-    __preinit_array_start = .;
-    KEEP (*(.preinit_array))
-    __preinit_array_end = .;
-
-    . = ALIGN(4);
-    __init_array_start = .;
-    KEEP (*(SORT(.init_array.*)))
-    KEEP (*(.init_array))
-    __init_array_end = .;
-
-    . = ALIGN(0x4);
-    KEEP (*crtbegin.o(.ctors))
-    KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
-    KEEP (*(SORT(.ctors.*)))
-    KEEP (*crtend.o(.ctors))
-
-    . = ALIGN(4);
-    KEEP(*(.fini))
-
-    . = ALIGN(4);
-    __fini_array_start = .;
-    KEEP (*(.fini_array))
-    KEEP (*(SORT(.fini_array.*)))
-    __fini_array_end = .;
-
-    KEEP (*crtbegin.o(.dtors))
-    KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
-    KEEP (*(SORT(.dtors.*)))
-    KEEP (*crtend.o(.dtors))
-
-    . = ALIGN(4);
-    __cs3_regions = .;
-    LONG (0)
-    LONG (__cs3_region_init_ram)
-    LONG (__cs3_region_start_ram)
-    LONG (__cs3_region_init_size_ram)
-    LONG (__cs3_region_zero_size_ram)
-  }
-
-  /* .ARM.exidx is sorted, so has to go in its own output section.  */
-  __exidx_start = .;
-  .ARM.exidx :
-  {
-    *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-  } >rom
-  __exidx_end = .;
-  .text.align :
-  {
-    . = ALIGN(8);
-    _etext = .;
-  } >rom
-  __cs3_region_size_rom = LENGTH(rom);
-  __cs3_region_num = 1;
-  
-  .data :
-  {
-    __cs3_region_start_ram = .;
-    *(.cs3.region-head.ram)
-    KEEP(*(.jcr))
-    *(.got.plt) *(.got)
-    *(.shdata)
-    *(.data .data.* .gnu.linkonce.d.*)
-    *(.ram)
-    . = ALIGN (8);
-    _edata = .;
-  } >ram AT>rom
-  .bss :
-  {
-    *(.shbss)
-    *(.bss .bss.* .gnu.linkonce.b.*)
-    *(COMMON)
-    *(.ram.b)
-    . = ALIGN (8);
-    _end = .;
-    __end = .;
-  } >ram AT>rom
-  
-  .heap (NOLOAD) :
-  {
-    *(.heap)
-  } >ram
-  .stack (__cs3_stack - __cs3_stack_size) (NOLOAD):
-  {
-    *(.stack)
-    _estack = .;
-    PROVIDE(estack = .);
-  } >ram
-
-  __cs3_region_init_ram = LOADADDR (.data);
-  __cs3_region_init_size_ram = _edata - __cs3_region_start_ram;
-  __cs3_region_zero_size_ram = _end - _edata;
-  __cs3_region_size_ram = LENGTH(ram);
-  __cs3_region_num = 1;
-
-  .stab 0 (NOLOAD) : { *(.stab) }
-  .stabstr 0 (NOLOAD) : { *(.stabstr) }
-  /* DWARF debug sections.
-   * Symbols in the DWARF debugging sections are relative to the beginning
-   * of the section so we begin them at 0.  */
-  /* DWARF 1 */
-  .debug          0 : { *(.debug) }
-  .line           0 : { *(.line) }
-  /* GNU DWARF 1 extensions */
-  .debug_srcinfo  0 : { *(.debug_srcinfo) }
-  .debug_sfnames  0 : { *(.debug_sfnames) }
-  /* DWARF 1.1 and DWARF 2 */
-  .debug_aranges  0 : { *(.debug_aranges) }
-  .debug_pubnames 0 : { *(.debug_pubnames) }
-  /* DWARF 2 */
-  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
-  .debug_abbrev   0 : { *(.debug_abbrev) }
-  .debug_line     0 : { *(.debug_line) }
-  .debug_frame    0 : { *(.debug_frame) }
-  .debug_str      0 : { *(.debug_str) }
-  .debug_loc      0 : { *(.debug_loc) }
-  .debug_macinfo  0 : { *(.debug_macinfo) }
-  /* SGI/MIPS DWARF 2 extensions */
-  .debug_weaknames 0 : { *(.debug_weaknames) }
-  .debug_funcnames 0 : { *(.debug_funcnames) }
-  .debug_typenames 0 : { *(.debug_typenames) }
-  .debug_varnames  0 : { *(.debug_varnames) }
-
-  .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
-  .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }
-  /DISCARD/ : { *(.note.GNU-stack) }
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_CS/startup_LPC11xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-    .equ    Stack_Size, 0x80
-    .section ".stack", "w"
-    .align  3
-    .globl  __cs3_stack_mem
-    .globl  __cs3_stack_size
-__cs3_stack_mem:
-    .if     Stack_Size
-    .space  Stack_Size
-    .endif
-    .size   __cs3_stack_mem,  . - __cs3_stack_mem
-    .set    __cs3_stack_size, . - __cs3_stack_mem
-
-    .equ    Heap_Size,  0x80
-    .section ".heap", "w"
-    .align  3
-    .globl  __cs3_heap_start
-    .globl  __cs3_heap_end
-__cs3_heap_start:
-    .if     Heap_Size
-    .space  Heap_Size
-    .endif
-__cs3_heap_end:
-
-    .section ".cs3.interrupt_vector"
-    .globl  __cs3_interrupt_vector_cortex_m
-    .type   __cs3_interrupt_vector_cortex_m, %object
-
-__cs3_interrupt_vector_cortex_m:
-    .long   __cs3_stack
-    .long   __cs3_reset
-    .long   NMI_Handler
-    .long   HardFault_Handler
-    .long   0
-    .long   0
-    .long   0
-    .long   0
-    .long   0
-    .long   0
-    .long   0
-    .long   SVC_Handler
-    .long   0
-    .long   0
-    .long   PendSV_Handler
-    .long   SysTick_Handler
-
-    .long   DEF_IRQHandler
-
-    .size   __cs3_interrupt_vector_cortex_m, . - __cs3_interrupt_vector_cortex_m
-
-    .thumb
-
-    .section .cs3.reset,"x",%progbits
-    .thumb_func
-    .globl  __cs3_reset_cortex_m
-    .type   __cs3_reset_cortex_m, %function
-__cs3_reset_cortex_m:
-    .fnstart
-    LDR     R0, =SystemInit
-    BLX     R0
-    LDR     R0,=__cs3_start_c
-    BX      R0
-    .pool
-    .cantunwind
-    .fnend
-    .size   __cs3_reset_cortex_m,.-__cs3_reset_cortex_m
-
-    .section ".text"
-
-    .weak   NMI_Handler
-    .type   NMI_Handler, %function
-NMI_Handler:
-    B       .
-    .size   NMI_Handler, . - NMI_Handler
-
-    .weak   HardFault_Handler
-    .type   HardFault_Handler, %function
-HardFault_Handler:
-    B       .
-    .size   HardFault_Handler, . - HardFault_Handler
-
-    .weak   SVC_Handler
-    .type   SVC_Handler, %function
-SVC_Handler:
-    B       .
-    .size   SVC_Handler, . - SVC_Handler
-
-    .weak   PendSV_Handler
-    .type   PendSV_Handler, %function
-PendSV_Handler:
-    B       .
-    .size   PendSV_Handler, . - PendSV_Handler
-
-    .weak   SysTick_Handler
-    .type   SysTick_Handler, %function
-SysTick_Handler:
-    B       .
-    .size   SysTick_Handler, . - SysTick_Handler
-
-    .globl  Default_Handler
-    .type   Default_Handler, %function
-Default_Handler:
-    B       .
-    .size   Default_Handler, . - Default_Handler
-
-    .macro  IRQ handler
-    .weak   \handler
-    .set    \handler, Default_Handler
-    .endm
-
-    IRQ     DEF_IRQHandler
-
-    .end
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_CS/sys.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-#include "cmsis.h"
-#include <sys/types.h>
-#include <errno.h>
-
-extern "C" {
-
-struct SCS3Regions {
-    unsigned long   Dummy;
-    unsigned long*  InitRam;
-    unsigned long*  StartRam;
-    unsigned long   InitSizeRam;
-    unsigned long   ZeroSizeRam;
-};
-
-extern unsigned long __cs3_regions;
-extern unsigned long __cs3_heap_start;
-
-int  main(void);
-void __libc_init_array(void);
-void exit(int ErrorCode);
-
-static void *heap_pointer = NULL;
-
-void __cs3_start_c(void) {
-    static SCS3Regions* pCS3Regions = (SCS3Regions*)&__cs3_regions;
-    unsigned long* pulDest;
-    unsigned long* pulSrc;
-    unsigned long  ByteCount;
-    unsigned long  i;
-    
-    pulSrc = pCS3Regions->InitRam;
-    pulDest = pCS3Regions->StartRam;
-    ByteCount = pCS3Regions->InitSizeRam;
-    if (pulSrc != pulDest) {
-        for(i = 0 ; i < ByteCount ; i += sizeof(unsigned long)) {
-            *(pulDest++) = *(pulSrc++);
-        }
-    } else {
-        pulDest = (unsigned long*)(void*)((char*)pulDest + ByteCount);
-    }
-    
-    ByteCount = pCS3Regions->ZeroSizeRam;
-    for(i = 0 ; i < ByteCount ; i += sizeof(unsigned long)) {
-        *(pulDest++) = 0;
-    }
-    
-    heap_pointer = &__cs3_heap_start;
-     __libc_init_array();
-    exit(main());
-}
-
-int _kill(int pid, int sig) {
-    errno = EINVAL;
-    return -1;
-}
-
-void _exit(int status) {
-    exit(status);
-}
-
-int _getpid(void) {
-    return 1;
-}
-
-void *_sbrk(unsigned int incr) {
-    void *mem;
-    
-    unsigned int next = ((((unsigned int)heap_pointer + incr) + 7) & ~7);
-    if (next > __get_MSP()) {
-        mem = NULL;
-    } else {
-        mem = (void *)heap_pointer;
-    }
-    heap_pointer = (void *)next;
-    
-    return mem;
-}
-
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/cmsis.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-/* mbed Microcontroller Library - CMSIS
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * A generic CMSIS include header, pulling in LPC11U24 specifics
- */
-
-#ifndef MBED_CMSIS_H
-#define MBED_CMSIS_H
-
-#include "LPC11Uxx.h"
-#include "cmsis_nvic.h"
-
-#endif
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/cmsis_nvic.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic for LPC11U24
- * Copyright (c) 2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */ 
-
-#include "cmsis_nvic.h"
-
-/* In the M0, there is no VTOR. In the LPC range such as the LPC11U,
- * whilst the vector table may only be something like 48 entries (192 bytes, 0xC0), 
- * the SYSMEMREMAP register actually remaps the memory from 0x10000000-0x100001FF 
- * to adress 0x0-0x1FF. In this case, RAM can be addressed at both 0x10000000 and 0x0
- * 
- * If we just copy the vectors to RAM and switch the SYSMEMMAP, any accesses to FLASH
- * above the vector table before 0x200 will actually go to RAM. So we need to provide 
- * a solution where the compiler gets the right results based on the memory map
- *
- * Option 1 - We allocate and copy 0x200 of RAM rather than just the table
- *  - const data and instructions before 0x200 will be copied to and fetched/exec from RAM
- *  - RAM overhead: 0x200 - 0xC0 = 320 bytes, FLASH overhead: 0
- * 
- * Option 2 - We pad the flash to 0x200 to ensure the compiler doesn't allocate anything there  
- *  - No flash accesses will go to ram, as there will be nothing there
- *  - RAM only needs to be allocated for the vectors, as all other ram addresses are normal
- *  - RAM overhead: 0, FLASH overhead: 320 bytes
- *
- * Option 2 is the one to go for, as RAM is the most valuable resource
- */
-
-#define NVIC_RAM_VECTOR_ADDRESS (0x10000000)  // Vectors positioned at start of RAM
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
-    int i;
-    // Space for dynamic vectors, initialised to allocate in R/W
-    static volatile uint32_t* vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
-    
-    // Copy and switch to dynamic vectors if first time called
-    if((LPC_SYSCON->SYSMEMREMAP & 0x3) != 0x1) {     
-      uint32_t *old_vectors = (uint32_t *)0;         // FLASH vectors are at 0x0
-      for(i = 0; i < NVIC_NUM_VECTORS; i++) {    
-            vectors[i] = old_vectors[i];
-        }
-        LPC_SYSCON->SYSMEMREMAP = 0x1; // Remaps 0x0-0x1FF FLASH block to RAM block
-    }
-
-    // Set the vector 
-    vectors[IRQn + 16] = vector; 
-}
-
-uint32_t NVIC_GetVector(IRQn_Type IRQn) {
-    // We can always read vectors at 0x0, as the addresses are remapped
-    uint32_t *vectors = (uint32_t*)0; 
-
-    // Return the vector
-    return vectors[IRQn + 16];
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/cmsis_nvic.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */ 
-
-#ifndef MBED_CMSIS_NVIC_H
-#define MBED_CMSIS_NVIC_H
-
-#include "cmsis.h"
-
-#define NVIC_NUM_VECTORS      (16 + 32)   // CORE + MCU Peripherals
-#define NVIC_USER_IRQ_OFFSET  16
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
-uint32_t NVIC_GetVector(IRQn_Type IRQn);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/power_api.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/****************************************************************************
- *   $Id:: power_api.h 6249 2011-01-25 19:23:47Z usb01267                   $
- *   Project: NXP LPC11Uxx software example  
- *
- *   Description:
- *     Power API Header File for NXP LPC11Uxx Device Series 
- *
- ****************************************************************************
- * 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 __LPC11UXX_POWER_API_H__
-#define __LPC11UXX_POWER_API_H__
-
-#ifdef __cplusplus
- extern "C" {
-#endif 
-
-#define PWRROMD_PRESENT
-
-typedef	struct _PWRD {
-  void (*set_pll)(unsigned int cmd[], unsigned int resp[]);
-  void (*set_power)(unsigned int cmd[], unsigned int resp[]);
-}  PWRD;
-
-typedef	struct _ROM {
-#ifdef USBROMD_PRESENT
-   const USB * pUSBD;
-#else
-   const unsigned p_usbd;
-#endif /* USBROMD_PRESENT */
-   const unsigned p_clib;
-   const unsigned p_cand;
-#ifdef PWRROMD_PRESENT
-   const PWRD * pPWRD;
-#else
-   const unsigned p_pwrd;
-#endif /* PWRROMD_PRESENT */
-   const unsigned p_dev1;
-   const unsigned p_dev2;
-   const unsigned p_dev3;
-   const unsigned p_dev4; 
-}  ROM;
-
-//PLL setup related definitions
-#define	CPU_FREQ_EQU  		0       //main PLL freq must be equal to the specified 
-#define	CPU_FREQ_LTE		1       //main PLL freq must be less than or equal the specified
-#define	CPU_FREQ_GTE		2       //main PLL freq must be greater than or equal the specified
-#define	CPU_FREQ_APPROX		3       //main PLL freq must be as close as possible the specified
-
-#define	PLL_CMD_SUCCESS		0       //PLL setup successfully found
-#define	PLL_INVALID_FREQ	1       //specified freq out of range (either input or output)
-#define	PLL_INVALID_MODE	2       //invalid mode (see above for valid) specified
-#define	PLL_FREQ_NOT_FOUND	3       //specified freq not found under specified conditions
-#define	PLL_NOT_LOCKED		4       //PLL not locked => no changes to the PLL setup
-
-//power setup elated definitions
-#define	PARAM_DEFAULT			0   //default power settings (voltage regulator, flash interface)
-#define	PARAM_CPU_PERFORMANCE	1   //setup for maximum CPU performance (higher current, more computation)
-#define	PARAM_EFFICIENCY		2   //balanced setting (power vs CPU performance)
-#define	PARAM_LOW_CURRENT		3   //lowest active current, lowest CPU performance
-
-#define	PARAM_CMD_SUCCESS		0   //power setting successfully found
-#define	PARAM_INVALID_FREQ		1   //specified freq out of range (=0 or > 50 MHz)
-#define	PARAM_INVALID_MODE		2   //specified mode not valid (see above for valid)
-
-#define MAX_CLOCK_KHZ_PARAM                50000
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /* __LPC11UXX_POWER_API_H__ */
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/system_LPC11Uxx.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,450 +0,0 @@
-/******************************************************************************
- * @file     system_LPC11Uxx.c
- * @purpose  CMSIS Cortex-M3 Device Peripheral Access Layer Source File
- *           for the NXP LPC13xx Device Series
- * @version  V1.10
- * @date     24. November 2010
- *
- * @note
- * Copyright (C) 2009-2010 ARM Limited. All rights reserved.
- *
- * @par
- * ARM Limited (ARM) is supplying this software for use with Cortex-M 
- * processor based microcontrollers.  This file can be freely distributed 
- * within development tools that are supporting such ARM based processors. 
- *
- * @par
- * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- *
- ******************************************************************************/
-
-
-#include <stdint.h>
-#include "LPC11Uxx.h"
-
-/*
-//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-*/
-
-/*--------------------- Clock Configuration ----------------------------------
-//
-// <e> Clock Configuration
-//   <h> System Oscillator Control Register (SYSOSCCTRL)
-//     <o1.0>      BYPASS: System Oscillator Bypass Enable
-//                     <i> If enabled then PLL input (sys_osc_clk) is fed
-//                     <i> directly from XTALIN and XTALOUT pins.
-//     <o1.9>      FREQRANGE: System Oscillator Frequency Range
-//                     <i> Determines frequency range for Low-power oscillator.
-//                   <0=> 1 - 20 MHz
-//                   <1=> 15 - 25 MHz
-//   </h>
-//
-//   <h> Watchdog Oscillator Control Register (WDTOSCCTRL)
-//     <o2.0..4>   DIVSEL: Select Divider for Fclkana
-//                     <i> wdt_osc_clk = Fclkana/ (2 * (1 + DIVSEL))
-//                   <0-31>
-//     <o2.5..8>   FREQSEL: Select Watchdog Oscillator Analog Output Frequency (Fclkana)
-//                   <0=> Undefined
-//                   <1=> 0.5 MHz
-//                   <2=> 0.8 MHz
-//                   <3=> 1.1 MHz
-//                   <4=> 1.4 MHz
-//                   <5=> 1.6 MHz
-//                   <6=> 1.8 MHz
-//                   <7=> 2.0 MHz
-//                   <8=> 2.2 MHz
-//                   <9=> 2.4 MHz
-//                   <10=> 2.6 MHz
-//                   <11=> 2.7 MHz
-//                   <12=> 2.9 MHz
-//                   <13=> 3.1 MHz
-//                   <14=> 3.2 MHz
-//                   <15=> 3.4 MHz
-//   </h>
-//
-//   <h> System PLL Control Register (SYSPLLCTRL)
-//                   <i> F_clkout = M * F_clkin = F_CCO / (2 * P)
-//                   <i> F_clkin must be in the range of  10 MHz to  25 MHz
-//                   <i> F_CCO   must be in the range of 156 MHz to 320 MHz
-//     <o3.0..4>   MSEL: Feedback Divider Selection
-//                     <i> M = MSEL + 1
-//                   <0-31>
-//     <o3.5..6>   PSEL: Post Divider Selection
-//                   <0=> P = 1
-//                   <1=> P = 2
-//                   <2=> P = 4
-//                   <3=> P = 8
-//   </h>
-//
-//   <h> System PLL Clock Source Select Register (SYSPLLCLKSEL)
-//     <o4.0..1>   SEL: System PLL Clock Source
-//                   <0=> IRC Oscillator
-//                   <1=> System Oscillator
-//                   <2=> Reserved
-//                   <3=> Reserved
-//   </h>
-//
-//   <h> Main Clock Source Select Register (MAINCLKSEL)
-//     <o5.0..1>   SEL: Clock Source for Main Clock
-//                   <0=> IRC Oscillator
-//                   <1=> Input Clock to System PLL
-//                   <2=> WDT Oscillator
-//                   <3=> System PLL Clock Out
-//   </h>
-//
-//   <h> System AHB Clock Divider Register (SYSAHBCLKDIV)
-//     <o6.0..7>   DIV: System AHB Clock Divider
-//                     <i> Divides main clock to provide system clock to core, memories, and peripherals.
-//                     <i> 0 = is disabled
-//                   <0-255>
-//   </h>
-//
-//   <h> USB PLL Control Register (USBPLLCTRL)
-//                   <i> F_clkout = M * F_clkin = F_CCO / (2 * P)
-//                   <i> F_clkin must be in the range of  10 MHz to  25 MHz
-//                   <i> F_CCO   must be in the range of 156 MHz to 320 MHz
-//     <o7.0..4>   MSEL: Feedback Divider Selection
-//                     <i> M = MSEL + 1
-//                   <0-31>
-//     <o7.5..6>   PSEL: Post Divider Selection
-//                   <0=> P = 1
-//                   <1=> P = 2
-//                   <2=> P = 4
-//                   <3=> P = 8
-//   </h>
-//
-//   <h> USB PLL Clock Source Select Register (USBPLLCLKSEL)
-//     <o8.0..1>   SEL: USB PLL Clock Source
-//                     <i> USB PLL clock source must be switched to System Oscillator for correct USB operation
-//                   <0=> IRC Oscillator
-//                   <1=> System Oscillator
-//                   <2=> Reserved
-//                   <3=> Reserved
-//   </h>
-//
-//   <h> USB Clock Source Select Register (USBCLKSEL)
-//     <o9.0..1>   SEL: System PLL Clock Source
-//                   <0=> USB PLL out
-//                   <1=> Main clock
-//                   <2=> Reserved
-//                   <3=> Reserved
-//   </h>
-//
-//   <h> USB Clock Divider Register (USBCLKDIV)
-//     <o10.0..7>  DIV: USB Clock Divider
-//                     <i> Divides USB clock to 48 MHz.
-//                     <i> 0 = is disabled
-//                   <0-255>
-//   </h>
-// </e>
-*/
-#define CLOCK_SETUP           1
-#define SYSOSCCTRL_Val        0x00000000              // Reset: 0x000
-#define WDTOSCCTRL_Val        0x00000000              // Reset: 0x000
-#define SYSPLLCTRL_Val        0x00000023              // Reset: 0x000
-#define SYSPLLCLKSEL_Val      0x00000001              // Reset: 0x000
-#define MAINCLKSEL_Val        0x00000003              // Reset: 0x000
-#define SYSAHBCLKDIV_Val      0x00000001              // Reset: 0x001
-#define USBPLLCTRL_Val        0x00000023              // Reset: 0x000
-#define USBPLLCLKSEL_Val      0x00000001              // Reset: 0x000
-#define USBCLKSEL_Val         0x00000000              // Reset: 0x000
-#define USBCLKDIV_Val         0x00000001              // Reset: 0x001
-
-/*
-//-------- <<< end of configuration section >>> ------------------------------
-*/
-
-/*----------------------------------------------------------------------------
-  Check the register settings
- *----------------------------------------------------------------------------*/
-#define CHECK_RANGE(val, min, max)                ((val < min) || (val > max))
-#define CHECK_RSVD(val, mask)                     (val & mask)
-
-/* Clock Configuration -------------------------------------------------------*/
-#if (CHECK_RSVD((SYSOSCCTRL_Val),  ~0x00000003))
-   #error "SYSOSCCTRL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((WDTOSCCTRL_Val),  ~0x000001FF))
-   #error "WDTOSCCTRL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RANGE((SYSPLLCLKSEL_Val), 0, 2))
-   #error "SYSPLLCLKSEL: Value out of range!"
-#endif
-
-#if (CHECK_RSVD((SYSPLLCTRL_Val),  ~0x000001FF))
-   #error "SYSPLLCTRL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((MAINCLKSEL_Val),  ~0x00000003))
-   #error "MAINCLKSEL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RANGE((SYSAHBCLKDIV_Val), 0, 255))
-   #error "SYSAHBCLKDIV: Value out of range!"
-#endif
-
-#if (CHECK_RANGE((USBPLLCLKSEL_Val), 0, 1))
-   #error "USBPLLCLKSEL: Value out of range!"
-#endif
-
-#if (CHECK_RSVD((USBPLLCTRL_Val),  ~0x000001FF))
-   #error "USBPLLCTRL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RANGE((USBCLKSEL_Val), 0, 1))
-   #error "USBCLKSEL: Value out of range!"
-#endif
-
-#if (CHECK_RANGE((USBCLKDIV_Val), 0, 255))
-   #error "USBCLKDIV: Value out of range!"
-#endif
-
-
-/*----------------------------------------------------------------------------
-  DEFINES
- *----------------------------------------------------------------------------*/
-    
-/*----------------------------------------------------------------------------
-  Define clocks
- *----------------------------------------------------------------------------*/
-#define __XTAL            (12000000UL)    /* Oscillator frequency             */
-#define __SYS_OSC_CLK     (    __XTAL)    /* Main oscillator frequency        */
-#define __IRC_OSC_CLK     (12000000UL)    /* Internal RC oscillator frequency */
-
-
-#define __FREQSEL   ((WDTOSCCTRL_Val >> 5) & 0x0F)
-#define __DIVSEL   (((WDTOSCCTRL_Val & 0x1F) << 1) + 2)
-
-#if (CLOCK_SETUP)                         /* Clock Setup              */
-  #if  (__FREQSEL ==  0)
-    #define __WDT_OSC_CLK        ( 0)                  /* undefined */
-  #elif (__FREQSEL ==  1)
-    #define __WDT_OSC_CLK        ( 500000 / __DIVSEL)
-  #elif (__FREQSEL ==  2)
-    #define __WDT_OSC_CLK        ( 800000 / __DIVSEL)
-  #elif (__FREQSEL ==  3)
-    #define __WDT_OSC_CLK        (1100000 / __DIVSEL)
-  #elif (__FREQSEL ==  4)
-    #define __WDT_OSC_CLK        (1400000 / __DIVSEL)
-  #elif (__FREQSEL ==  5)
-    #define __WDT_OSC_CLK        (1600000 / __DIVSEL)
-  #elif (__FREQSEL ==  6)
-    #define __WDT_OSC_CLK        (1800000 / __DIVSEL)
-  #elif (__FREQSEL ==  7)
-    #define __WDT_OSC_CLK        (2000000 / __DIVSEL)
-  #elif (__FREQSEL ==  8)
-    #define __WDT_OSC_CLK        (2200000 / __DIVSEL)
-  #elif (__FREQSEL ==  9)
-    #define __WDT_OSC_CLK        (2400000 / __DIVSEL)
-  #elif (__FREQSEL == 10)
-    #define __WDT_OSC_CLK        (2600000 / __DIVSEL)
-  #elif (__FREQSEL == 11)
-    #define __WDT_OSC_CLK        (2700000 / __DIVSEL)
-  #elif (__FREQSEL == 12)
-    #define __WDT_OSC_CLK        (2900000 / __DIVSEL)
-  #elif (__FREQSEL == 13)
-    #define __WDT_OSC_CLK        (3100000 / __DIVSEL)
-  #elif (__FREQSEL == 14)
-    #define __WDT_OSC_CLK        (3200000 / __DIVSEL)
-  #else
-    #define __WDT_OSC_CLK        (3400000 / __DIVSEL)
-  #endif
-
-  /* sys_pllclkin calculation */
-  #if   ((SYSPLLCLKSEL_Val & 0x03) == 0)
-    #define __SYS_PLLCLKIN           (__IRC_OSC_CLK)
-  #elif ((SYSPLLCLKSEL_Val & 0x03) == 1)
-    #define __SYS_PLLCLKIN           (__SYS_OSC_CLK)
-  #else
-    #define __SYS_PLLCLKIN           (0)
-  #endif
-
-  #define  __SYS_PLLCLKOUT         (__SYS_PLLCLKIN * ((SYSPLLCTRL_Val & 0x01F) + 1))
-
-  /* main clock calculation */
-  #if   ((MAINCLKSEL_Val & 0x03) == 0)
-    #define __MAIN_CLOCK             (__IRC_OSC_CLK)
-  #elif ((MAINCLKSEL_Val & 0x03) == 1)
-    #define __MAIN_CLOCK             (__SYS_PLLCLKIN)
-  #elif ((MAINCLKSEL_Val & 0x03) == 2)
-    #if (__FREQSEL ==  0)
-      #error "MAINCLKSEL: WDT Oscillator selected but FREQSEL is undefined!"
-    #else
-      #define __MAIN_CLOCK           (__WDT_OSC_CLK)
-    #endif
-  #elif ((MAINCLKSEL_Val & 0x03) == 3)
-    #define __MAIN_CLOCK             (__SYS_PLLCLKOUT)
-  #else
-    #define __MAIN_CLOCK             (0)
-  #endif
-
-  #define __SYSTEM_CLOCK             (__MAIN_CLOCK / SYSAHBCLKDIV_Val)         
-
-#else
-  #define __SYSTEM_CLOCK             (__IRC_OSC_CLK)
-#endif  // CLOCK_SETUP 
-
-
-/*----------------------------------------------------------------------------
-  Clock Variable definitions
- *----------------------------------------------------------------------------*/
-uint32_t SystemCoreClock = __SYSTEM_CLOCK;/*!< System Clock Frequency (Core Clock)*/
-
-
-/*----------------------------------------------------------------------------
-  Clock functions
- *----------------------------------------------------------------------------*/
-void SystemCoreClockUpdate (void)            /* Get Core Clock Frequency      */
-{
-  uint32_t wdt_osc = 0;
-
-  /* Determine clock frequency according to clock register values             */
-  switch ((LPC_SYSCON->WDTOSCCTRL >> 5) & 0x0F) {
-    case 0:  wdt_osc =       0; break;
-    case 1:  wdt_osc =  500000; break;
-    case 2:  wdt_osc =  800000; break;
-    case 3:  wdt_osc = 1100000; break;
-    case 4:  wdt_osc = 1400000; break;
-    case 5:  wdt_osc = 1600000; break;
-    case 6:  wdt_osc = 1800000; break;
-    case 7:  wdt_osc = 2000000; break;
-    case 8:  wdt_osc = 2200000; break;
-    case 9:  wdt_osc = 2400000; break;
-    case 10: wdt_osc = 2600000; break;
-    case 11: wdt_osc = 2700000; break;
-    case 12: wdt_osc = 2900000; break;
-    case 13: wdt_osc = 3100000; break;
-    case 14: wdt_osc = 3200000; break;
-    case 15: wdt_osc = 3400000; break;
-  }
-  wdt_osc /= ((LPC_SYSCON->WDTOSCCTRL & 0x1F) << 1) + 2;
- 
-  switch (LPC_SYSCON->MAINCLKSEL & 0x03) {
-    case 0:                             /* Internal RC oscillator             */
-      SystemCoreClock = __IRC_OSC_CLK;
-      break;
-    case 1:                             /* Input Clock to System PLL          */
-      switch (LPC_SYSCON->SYSPLLCLKSEL & 0x03) {
-          case 0:                       /* Internal RC oscillator             */
-            SystemCoreClock = __IRC_OSC_CLK;
-            break;
-          case 1:                       /* System oscillator                  */
-            SystemCoreClock = __SYS_OSC_CLK;
-            break;
-          case 2:                       /* Reserved                           */
-          case 3:                       /* Reserved                           */
-            SystemCoreClock = 0;
-            break;
-      }
-      break;
-    case 2:                             /* WDT Oscillator                     */
-      SystemCoreClock = wdt_osc;
-      break;
-    case 3:                             /* System PLL Clock Out               */
-      switch (LPC_SYSCON->SYSPLLCLKSEL & 0x03) {
-          case 0:                       /* Internal RC oscillator             */
-            if (LPC_SYSCON->SYSPLLCTRL & 0x180) {
-              SystemCoreClock = __IRC_OSC_CLK;
-            } else {
-              SystemCoreClock = __IRC_OSC_CLK * ((LPC_SYSCON->SYSPLLCTRL & 0x01F) + 1);
-            }
-            break;
-          case 1:                       /* System oscillator                  */
-            if (LPC_SYSCON->SYSPLLCTRL & 0x180) {
-              SystemCoreClock = __SYS_OSC_CLK;
-            } else {
-              SystemCoreClock = __SYS_OSC_CLK * ((LPC_SYSCON->SYSPLLCTRL & 0x01F) + 1);
-            }
-            break;
-          case 2:                       /* Reserved                           */
-          case 3:                       /* Reserved                           */
-            SystemCoreClock = 0;
-            break;
-      }
-      break;
-  }
-
-  SystemCoreClock /= LPC_SYSCON->SYSAHBCLKDIV;  
-
-}
-
-/**
- * Initialize the system
- *
- * @param  none
- * @return none
- *
- * @brief  Setup the microcontroller system.
- *         Initialize the System.
- */
-void SystemInit (void) {
-  volatile uint32_t i;
-
-#if (CLOCK_SETUP)                                 /* Clock Setup              */
-
-#if ((SYSPLLCLKSEL_Val & 0x03) == 1)
-  LPC_SYSCON->PDRUNCFG     &= ~(1 << 5);          /* Power-up System Osc      */
-  LPC_SYSCON->SYSOSCCTRL    = SYSOSCCTRL_Val;
-  for (i = 0; i < 200; i++) __NOP();
-#endif
-
-  LPC_SYSCON->SYSPLLCLKSEL  = SYSPLLCLKSEL_Val;   /* Select PLL Input         */
-  LPC_SYSCON->SYSPLLCLKUEN  = 0x01;               /* Update Clock Source      */
-  LPC_SYSCON->SYSPLLCLKUEN  = 0x00;               /* Toggle Update Register   */
-  LPC_SYSCON->SYSPLLCLKUEN  = 0x01;
-  while (!(LPC_SYSCON->SYSPLLCLKUEN & 0x01));     /* Wait Until Updated       */
-#if ((MAINCLKSEL_Val & 0x03) == 3)                /* Main Clock is PLL Out    */
-  LPC_SYSCON->SYSPLLCTRL    = SYSPLLCTRL_Val;
-  LPC_SYSCON->PDRUNCFG     &= ~(1 << 7);          /* Power-up SYSPLL          */
-  while (!(LPC_SYSCON->SYSPLLSTAT & 0x01));	      /* Wait Until PLL Locked    */
-#endif
-
-#if (((MAINCLKSEL_Val & 0x03) == 2) )
-  LPC_SYSCON->WDTOSCCTRL    = WDTOSCCTRL_Val;
-  LPC_SYSCON->PDRUNCFG     &= ~(1 << 6);          /* Power-up WDT Clock       */
-  for (i = 0; i < 200; i++) __NOP();
-#endif
-
-  LPC_SYSCON->MAINCLKSEL    = MAINCLKSEL_Val;     /* Select PLL Clock Output  */
-  LPC_SYSCON->MAINCLKUEN    = 0x01;               /* Update MCLK Clock Source */
-  LPC_SYSCON->MAINCLKUEN    = 0x00;               /* Toggle Update Register   */
-  LPC_SYSCON->MAINCLKUEN    = 0x01;
-  while (!(LPC_SYSCON->MAINCLKUEN & 0x01));       /* Wait Until Updated       */
-
-  LPC_SYSCON->SYSAHBCLKDIV  = SYSAHBCLKDIV_Val;
-
-#if ((USBCLKDIV_Val & 0x1FF) != 0)                /* USB clock is used        */
-  LPC_SYSCON->PDRUNCFG     &= ~(1 << 10);         /* Power-up USB PHY         */
-
-#if ((USBCLKSEL_Val & 0x003) == 0)                /* USB clock is USB PLL out */
-  LPC_SYSCON->PDRUNCFG     &= ~(1 <<  8);         /* Power-up USB PLL         */
-  LPC_SYSCON->USBPLLCLKSEL  = USBPLLCLKSEL_Val;   /* Select PLL Input         */
-  LPC_SYSCON->USBPLLCLKUEN  = 0x01;               /* Update Clock Source      */
-  LPC_SYSCON->USBPLLCLKUEN  = 0x00;               /* Toggle Update Register   */
-  LPC_SYSCON->USBPLLCLKUEN  = 0x01;
-  while (!(LPC_SYSCON->USBPLLCLKUEN & 0x01));     /* Wait Until Updated       */
-  LPC_SYSCON->USBPLLCTRL    = USBPLLCTRL_Val;
-  while (!(LPC_SYSCON->USBPLLSTAT   & 0x01));     /* Wait Until PLL Locked    */
-  LPC_SYSCON->USBCLKSEL     = 0x00;               /* Select USB PLL           */
-#endif
-
-  LPC_SYSCON->USBCLKSEL     = USBCLKSEL_Val;      /* Select USB Clock         */
-  LPC_SYSCON->USBCLKDIV     = USBCLKDIV_Val;      /* Set USB clock divider    */
-
-#else                                             /* USB clock is not used    */                        
-  LPC_SYSCON->PDRUNCFG     |=  (1 << 10);         /* Power-down USB PHY       */
-  LPC_SYSCON->PDRUNCFG     |=  (1 <<  8);         /* Power-down USB PLL       */
-#endif
-
-#endif
-
-  /* System clock to the IOCON needs to be enabled or
-  most of the I/O related peripherals won't work. */
-  LPC_SYSCON->SYSAHBCLKCTRL |= (1<<16);
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/system_LPC11Uxx.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/**************************************************************************//**
- * @file     system_LPC11Uxx.h
- * @brief    CMSIS Cortex-M0 Device Peripheral Access Layer Header File
- *           for the NXP LPC11Uxx Device Series
- * @version  V1.10
- * @date     24. November 2010
- *
- * @note
- * Copyright (C) 2009-2010 ARM Limited. All rights reserved.
- *
- * @par
- * ARM Limited (ARM) is supplying this software for use with Cortex-M 
- * processor based microcontrollers.  This file can be freely distributed 
- * within development tools that are supporting such ARM based processors. 
- *
- * @par
- * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- *
- ******************************************************************************/
-
-
-#ifndef __SYSTEM_LPC11Uxx_H
-#define __SYSTEM_LPC11Uxx_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-extern uint32_t SystemCoreClock;     /*!< System Clock Frequency (Core Clock)  */
-
-
-/**
- * Initialize the system
- *
- * @param  none
- * @return none
- *
- * @brief  Setup the microcontroller system.
- *         Initialize the System and update the SystemCoreClock variable.
- */
-extern void SystemInit (void);
-
-/**
- * Update SystemCoreClock variable
- *
- * @param  none
- * @return none
- *
- * @brief  Updates the SystemCoreClock with current core Clock 
- *         retrieved from cpu registers.
- */
-extern void SystemCoreClockUpdate (void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __SYSTEM_LPC11Uxx_H */
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/LPC11xx.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,602 +0,0 @@
-/****************************************************************************
- *   $Id:: LPC11xx.h 9198 2012-05-29 usb00175                     $
- *   Project: NXP LPC11xx software example  
- *
- *   Description:
- *     CMSIS Cortex-M0 Core Peripheral Access Layer Header File for 
- *     NXP LPC11xx Device Series 
- 
- ****************************************************************************
- * 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.
-
-* Permission to use, copy, modify, and distribute this software and its 
-* documentation is hereby granted, under NXP Semiconductors' 
-* relevant copyright in the software, without fee, provided 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 __LPC11xx_H__
-#define __LPC11xx_H__
-
-#ifdef __cplusplus
- extern "C" {
-#endif 
-
-/** @addtogroup LPC11xx_Definitions LPC11xx Definitions
-  This file defines all structures and symbols for LPC11xx:
-    - Registers and bitfields
-    - peripheral base address
-    - peripheral ID
-    - PIO definitions
-  @{
-*/
-
-
-/******************************************************************************/
-/*                Processor and Core Peripherals                              */
-/******************************************************************************/
-/** @addtogroup LPC11xx_CMSIS LPC11xx CMSIS Definitions
-  Configuration of the Cortex-M0 Processor and Core Peripherals
-  @{
-*/
-
-/*
- * ==========================================================================
- * ---------- Interrupt Number Definition -----------------------------------
- * ==========================================================================
- */
-typedef enum IRQn
-{
-/******  Cortex-M0 Processor Exceptions Numbers ***************************************************/
-  NonMaskableInt_IRQn           = -14,    /*!< 2 Non Maskable Interrupt                           */
-  HardFault_IRQn                = -13,    /*!< 3 Cortex-M0 Hard Fault Interrupt                   */
-  SVCall_IRQn                   = -5,     /*!< 11 Cortex-M0 SV Call Interrupt                     */
-  PendSV_IRQn                   = -2,     /*!< 14 Cortex-M0 Pend SV Interrupt                     */
-  SysTick_IRQn                  = -1,     /*!< 15 Cortex-M0 System Tick Interrupt                 */
-
-/******  LPC11Cxx or LPC11xx Specific Interrupt Numbers *******************************************************/
-  WAKEUP0_IRQn                  = 0,        /*!< All I/O pins can be used as wakeup source.       */
-  WAKEUP1_IRQn                  = 1,        /*!< There are 13 pins in total for LPC11xx           */
-  WAKEUP2_IRQn                  = 2,
-  WAKEUP3_IRQn                  = 3,
-  WAKEUP4_IRQn                  = 4,   
-  WAKEUP5_IRQn                  = 5,        
-  WAKEUP6_IRQn                  = 6,        
-  WAKEUP7_IRQn                  = 7,        
-  WAKEUP8_IRQn                  = 8,        
-  WAKEUP9_IRQn                  = 9,        
-  WAKEUP10_IRQn                 = 10,       
-  WAKEUP11_IRQn                 = 11,       
-  WAKEUP12_IRQn                 = 12,       
-  CAN_IRQn                      = 13,       /*!< CAN Interrupt                                    */
-  SSP1_IRQn                     = 14,       /*!< SSP1 Interrupt                                   */
-  I2C_IRQn                      = 15,       /*!< I2C Interrupt                                    */
-  TIMER_16_0_IRQn               = 16,       /*!< 16-bit Timer0 Interrupt                          */
-  TIMER_16_1_IRQn               = 17,       /*!< 16-bit Timer1 Interrupt                          */
-  TIMER_32_0_IRQn               = 18,       /*!< 32-bit Timer0 Interrupt                          */
-  TIMER_32_1_IRQn               = 19,       /*!< 32-bit Timer1 Interrupt                          */
-  SSP0_IRQn                     = 20,       /*!< SSP0 Interrupt                                   */
-  UART_IRQn                     = 21,       /*!< UART Interrupt                                   */
-  Reserved0_IRQn                = 22,       /*!< Reserved Interrupt                               */
-  Reserved1_IRQn                = 23,       
-  ADC_IRQn                      = 24,       /*!< A/D Converter Interrupt                          */
-  WDT_IRQn                      = 25,       /*!< Watchdog timer Interrupt                         */  
-  BOD_IRQn                      = 26,       /*!< Brown Out Detect(BOD) Interrupt                  */
-  FMC_IRQn                      = 27,       /*!< Flash Memory Controller Interrupt                */
-  EINT3_IRQn                    = 28,       /*!< External Interrupt 3 Interrupt                   */
-  EINT2_IRQn                    = 29,       /*!< External Interrupt 2 Interrupt                   */
-  EINT1_IRQn                    = 30,       /*!< External Interrupt 1 Interrupt                   */
-  EINT0_IRQn                    = 31,       /*!< External Interrupt 0 Interrupt                   */
-} IRQn_Type;
-
-/*
- * ==========================================================================
- * ----------- Processor and Core Peripheral Section ------------------------
- * ==========================================================================
- */
-
-/* Configuration of the Cortex-M0 Processor and Core Peripherals */
-#define __MPU_PRESENT             0         /*!< MPU present or not                               */
-#define __NVIC_PRIO_BITS          2         /*!< Number of Bits used for Priority Levels          */
-#define __Vendor_SysTickConfig    0         /*!< Set to 1 if different SysTick Config is used     */
-
-/*@}*/ /* end of group LPC11xx_CMSIS */
-
-
-#include "core_cm0.h"                       /* Cortex-M0 processor and core peripherals           */
-#include "system_LPC11xx.h"                 /* System Header                                      */
-
-
-/******************************************************************************/
-/*                Device Specific Peripheral Registers structures             */
-/******************************************************************************/
-
-#if defined ( __CC_ARM   )
-#pragma anon_unions
-#endif
-
-/*------------- System Control (SYSCON) --------------------------------------*/
-/** @addtogroup LPC11xx_SYSCON LPC11xx System Control Block 
-  @{
-*/
-typedef struct
-{
-  __IO uint32_t SYSMEMREMAP;            /*!< Offset: 0x000 System memory remap (R/W) */
-  __IO uint32_t PRESETCTRL;             /*!< Offset: 0x004 Peripheral reset control (R/W) */
-  __IO uint32_t SYSPLLCTRL;             /*!< Offset: 0x008 System PLL control (R/W) */
-  __I uint32_t SYSPLLSTAT;             /*!< Offset: 0x00C System PLL status (R/ ) */
-       uint32_t RESERVED0[4];
-
-  __IO uint32_t SYSOSCCTRL;             /*!< Offset: 0x020 System oscillator control (R/W) */
-  __IO uint32_t WDTOSCCTRL;             /*!< Offset: 0x024 Watchdog oscillator control (R/W) */
-  __IO uint32_t IRCCTRL;                /*!< Offset: 0x028 IRC control (R/W) */
-       uint32_t RESERVED1[1];
-  __IO uint32_t SYSRSTSTAT;             /*!< Offset: 0x030 System reset status Register (R/ ) */
-       uint32_t RESERVED2[3];
-  __IO uint32_t SYSPLLCLKSEL;           /*!< Offset: 0x040 System PLL clock source select (R/W) */	
-  __IO uint32_t SYSPLLCLKUEN;           /*!< Offset: 0x044 System PLL clock source update enable (R/W) */
-       uint32_t RESERVED3[10];
-
-  __IO uint32_t MAINCLKSEL;             /*!< Offset: 0x070 Main clock source select (R/W) */
-  __IO uint32_t MAINCLKUEN;             /*!< Offset: 0x074 Main clock source update enable (R/W) */
-  __IO uint32_t SYSAHBCLKDIV;           /*!< Offset: 0x078 System AHB clock divider (R/W) */
-       uint32_t RESERVED4[1];
-
-  __IO uint32_t SYSAHBCLKCTRL;          /*!< Offset: 0x080 System AHB clock control (R/W) */
-       uint32_t RESERVED5[4];
-  __IO uint32_t SSP0CLKDIV;             /*!< Offset: 0x094 SSP0 clock divider (R/W) */          
-  __IO uint32_t UARTCLKDIV;             /*!< Offset: 0x098 UART clock divider (R/W) */
-  __IO uint32_t SSP1CLKDIV;             /*!< Offset: 0x09C SSP1 clock divider (R/W) */          
-       uint32_t RESERVED6[12];
-
-  __IO uint32_t WDTCLKSEL;              /*!< Offset: 0x0D0 WDT clock source select (R/W) */
-  __IO uint32_t WDTCLKUEN;              /*!< Offset: 0x0D4 WDT clock source update enable (R/W) */
-  __IO uint32_t WDTCLKDIV;              /*!< Offset: 0x0D8 WDT clock divider (R/W) */
-       uint32_t RESERVED8[1];              
-  __IO uint32_t CLKOUTCLKSEL;           /*!< Offset: 0x0E0 CLKOUT clock source select (R/W) */
-  __IO uint32_t CLKOUTUEN;              /*!< Offset: 0x0E4 CLKOUT clock source update enable (R/W) */
-  __IO uint32_t CLKOUTDIV;              /*!< Offset: 0x0E8 CLKOUT clock divider (R/W) */       
-       uint32_t RESERVED9[5];
-  
-  __IO uint32_t PIOPORCAP0;             /*!< Offset: 0x100 POR captured PIO status 0 (R/ ) */           
-  __IO uint32_t PIOPORCAP1;             /*!< Offset: 0x104 POR captured PIO status 1 (R/ ) */   
-       uint32_t RESERVED10[18];
-  __IO uint32_t BODCTRL;                /*!< Offset: 0x150 BOD control (R/W) */
-  __IO uint32_t SYSTCKCAL;              /*!< Offset: 0x154 System tick counter calibration (R/W) */
-       
-       uint32_t RESERVED13[7];
-  __IO uint32_t NMISRC;                 /*!< Offset: 0x174 NMI source selection register (R/W) */
-       uint32_t RESERVED14[34];
-       
-  __IO uint32_t STARTAPRP0;             /*!< Offset: 0x200 Start logic edge control Register 0 (R/W) */     
-  __IO uint32_t STARTERP0;              /*!< Offset: 0x204 Start logic signal enable Register 0 (R/W) */      
-  __O  uint32_t STARTRSRP0CLR;          /*!< Offset: 0x208 Start logic reset Register 0  ( /W) */
-  __I uint32_t STARTSRP0;              /*!< Offset: 0x20C Start logic status Register 0 (R/) */
-  __IO uint32_t STARTAPRP1;             /*!< Offset: 0x210 Start logic edge control Register 0 (R/W). (LPC11UXX only) */     
-  __IO uint32_t STARTERP1;              /*!< Offset: 0x214 Start logic signal enable Register 0 (R/W). (LPC11UXX only) */      
-  __O  uint32_t STARTRSRP1CLR;          /*!< Offset: 0x218 Start logic reset Register 0  ( /W). (LPC11UXX only) */
-  __IO uint32_t STARTSRP1;              /*!< Offset: 0x21C Start logic status Register 0 (R/W). (LPC11UXX only) */
-       uint32_t RESERVED17[4];
-
-  __IO uint32_t PDSLEEPCFG;             /*!< Offset: 0x230 Power-down states in Deep-sleep mode (R/W) */
-  __IO uint32_t PDAWAKECFG;             /*!< Offset: 0x234 Power-down states after wake-up (R/W) */        
-  __IO uint32_t PDRUNCFG;               /*!< Offset: 0x238 Power-down configuration Register (R/W) */
-       uint32_t RESERVED15[110];
-  __I  uint32_t DEVICE_ID;              /*!< Offset: 0x3F4 Device ID (R/ ) */
-} LPC_SYSCON_TypeDef;
-/*@}*/ /* end of group LPC11xx_SYSCON */
-
-
-/*------------- Pin Connect Block (IOCON) --------------------------------*/
-/** @addtogroup LPC11xx_IOCON LPC11xx I/O Configuration Block 
-  @{
-*/
-typedef struct
-{
-  __IO uint32_t PIO2_6;                 /*!< Offset: 0x000 I/O configuration for pin PIO2_6 (R/W) */
-       uint32_t RESERVED0[1];
-  __IO uint32_t PIO2_0;                 /*!< Offset: 0x008 I/O configuration for pin PIO2_0/DTR/SSEL1 (R/W) */
-  __IO uint32_t RESET_PIO0_0;           /*!< Offset: 0x00C I/O configuration for pin RESET/PIO0_0  (R/W) */
-  __IO uint32_t PIO0_1;                 /*!< Offset: 0x010 I/O configuration for pin PIO0_1/CLKOUT/CT32B0_MAT2 (R/W) */
-  __IO uint32_t PIO1_8;                 /*!< Offset: 0x014 I/O configuration for pin PIO1_8/CT16B1_CAP0 (R/W) */
-  __IO uint32_t SSEL1_LOC;              /*!< Offset: 0x018 IOCON SSEL1 location register (IOCON_SSEL1_LOC, address 0x4004 4018) */
-  __IO uint32_t PIO0_2;                 /*!< Offset: 0x01C I/O configuration for pin PIO0_2/SSEL0/CT16B0_CAP0 (R/W) */
-
-  __IO uint32_t PIO2_7;                 /*!< Offset: 0x020 I/O configuration for pin PIO2_7 (R/W) */
-  __IO uint32_t PIO2_8;                 /*!< Offset: 0x024 I/O configuration for pin PIO2_8 (R/W) */
-  __IO uint32_t PIO2_1;                 /*!< Offset: 0x028 I/O configuration for pin PIO2_1/nDSR/SCK1 (R/W) */
-  __IO uint32_t PIO0_3;                 /*!< Offset: 0x02C I/O configuration for pin PIO0_3 (R/W) */
-  __IO uint32_t PIO0_4;                 /*!< Offset: 0x030 I/O configuration for pin PIO0_4/SCL (R/W) */
-  __IO uint32_t PIO0_5;                 /*!< Offset: 0x034 I/O configuration for pin PIO0_5/SDA (R/W) */
-  __IO uint32_t PIO1_9;                 /*!< Offset: 0x038 I/O configuration for pin PIO1_9/CT16B1_MAT0 (R/W) */
-  __IO uint32_t PIO3_4;                 /*!< Offset: 0x03C I/O configuration for pin PIO3_4 (R/W) */
-
-  __IO uint32_t PIO2_4;                 /*!< Offset: 0x040 I/O configuration for pin PIO2_4 (R/W) */
-  __IO uint32_t PIO2_5;                 /*!< Offset: 0x044 I/O configuration for pin PIO2_5 (R/W) */
-  __IO uint32_t PIO3_5;                 /*!< Offset: 0x048 I/O configuration for pin PIO3_5 (R/W) */
-  __IO uint32_t PIO0_6;                 /*!< Offset: 0x04C I/O configuration for pin PIO0_6/SCK0 (R/W) */
-  __IO uint32_t PIO0_7;                 /*!< Offset: 0x050 I/O configuration for pin PIO0_7/nCTS (R/W) */
-  __IO uint32_t PIO2_9;                 /*!< Offset: 0x054 I/O configuration for pin PIO2_9 (R/W) */
-  __IO uint32_t PIO2_10;                /*!< Offset: 0x058 I/O configuration for pin PIO2_10 (R/W) */
-  __IO uint32_t PIO2_2;                 /*!< Offset: 0x05C I/O configuration for pin PIO2_2/DCD/MISO1 (R/W) */
-
-  __IO uint32_t PIO0_8;                 /*!< Offset: 0x060 I/O configuration for pin PIO0_8/MISO0/CT16B0_MAT0 (R/W) */
-  __IO uint32_t PIO0_9;                 /*!< Offset: 0x064 I/O configuration for pin PIO0_9/MOSI0/CT16B0_MAT1 (R/W) */
-  __IO uint32_t SWCLK_PIO0_10;          /*!< Offset: 0x068 I/O configuration for pin SWCLK/PIO0_10/SCK0/CT16B0_MAT2 (R/W) */
-  __IO uint32_t PIO1_10;                /*!< Offset: 0x06C I/O configuration for pin PIO1_10/AD6/CT16B1_MAT1 (R/W) */
-  __IO uint32_t PIO2_11;                /*!< Offset: 0x070 I/O configuration for pin PIO2_11/SCK0 (R/W) */
-  __IO uint32_t R_PIO0_11;              /*!< Offset: 0x074 I/O configuration for pin TDI/PIO0_11/AD0/CT32B0_MAT3 (R/W) */
-  __IO uint32_t R_PIO1_0;               /*!< Offset: 0x078 I/O configuration for pin TMS/PIO1_0/AD1/CT32B1_CAP0 (R/W) */
-  __IO uint32_t R_PIO1_1;               /*!< Offset: 0x07C I/O configuration for pin TDO/PIO1_1/AD2/CT32B1_MAT0 (R/W) */
-
-  __IO uint32_t R_PIO1_2;               /*!< Offset: 0x080 I/O configuration for pin nTRST/PIO1_2/AD3/CT32B1_MAT1 (R/W) */
-  __IO uint32_t PIO3_0;                 /*!< Offset: 0x084 I/O configuration for pin PIO3_0/nDTR (R/W) */
-  __IO uint32_t PIO3_1;                 /*!< Offset: 0x088 I/O configuration for pin PIO3_1/nDSR (R/W) */
-  __IO uint32_t PIO2_3;                 /*!< Offset: 0x08C I/O configuration for pin PIO2_3/RI/MOSI1 (R/W) */
-  __IO uint32_t SWDIO_PIO1_3;           /*!< Offset: 0x090 I/O configuration for pin SWDIO/PIO1_3/AD4/CT32B1_MAT2 (R/W) */
-  __IO uint32_t PIO1_4;                 /*!< Offset: 0x094 I/O configuration for pin PIO1_4/AD5/CT32B1_MAT3 (R/W) */
-  __IO uint32_t PIO1_11;                /*!< Offset: 0x098 I/O configuration for pin PIO1_11/AD7 (R/W) */
-  __IO uint32_t PIO3_2;                 /*!< Offset: 0x09C I/O configuration for pin PIO3_2/nDCD (R/W) */
-
-  __IO uint32_t PIO1_5;                 /*!< Offset: 0x0A0 I/O configuration for pin PIO1_5/nRTS/CT32B0_CAP0 (R/W) */
-  __IO uint32_t PIO1_6;                 /*!< Offset: 0x0A4 I/O configuration for pin PIO1_6/RXD/CT32B0_MAT0 (R/W) */
-  __IO uint32_t PIO1_7;                 /*!< Offset: 0x0A8 I/O configuration for pin PIO1_7/TXD/CT32B0_MAT1 (R/W) */
-  __IO uint32_t PIO3_3;                 /*!< Offset: 0x0AC I/O configuration for pin PIO3_3/nRI (R/W) */
-  __IO uint32_t SCK_LOC;                /*!< Offset: 0x0B0 SCK pin location select Register (R/W) */
-  __IO uint32_t DSR_LOC;                /*!< Offset: 0x0B4 DSR pin location select Register (R/W) */
-  __IO uint32_t DCD_LOC;                /*!< Offset: 0x0B8 DCD pin location select Register (R/W) */
-  __IO uint32_t RI_LOC;                 /*!< Offset: 0x0BC RI pin location Register (R/W) */
-
-  __IO uint32_t CT16B0_CAP0_LOC;        /*!< Offset: 0x0C0 IOCON CT16B0_CAP0 location register (IOCON_CT16B0_CAP0_LOC, address 0x4004 40C0) */
-  __IO uint32_t SCK1_LOC;               /*!< Offset: 0x0C4 IOCON SCK1 location register (IOCON_SCK1_LOC, address 0x4004 40C4) */
-  __IO uint32_t MISO1_LOC;              /*!< Offset: 0x0C8 IOCON MISO1 location register (IOCON_MISO1_LOC, address 0x4004 40C8) */
-  __IO uint32_t MOSI1_LOC;              /*!< Offset: 0x0CC IOCON MOSI1 location register (IOCON_MOSI1_LOC, address 0x4004 40CC) */
-  __IO uint32_t CT32B0_CAP0_LOC;        /*!< Offset: 0x0D0 IOCON CT32B0_CAP0 location register (IOCON_CT32B0_CAP0_LOC, address 0x4004 40D0) */
-  __IO uint32_t RXD_LOC;                /*!< Offset: 0x0D4 IOCON RXD location register (IOCON_RXD_LOC, address 0x4004 40D4) */
-} LPC_IOCON_TypeDef;
-/*@}*/ /* end of group LPC11xx_IOCON */
-
-
-/*------------- Power Management Unit (PMU) --------------------------*/
-/** @addtogroup LPC11xx_PMU LPC11xx Power Management Unit 
-  @{
-*/
-typedef struct
-{
-  __IO uint32_t PCON;                   /*!< Offset: 0x000 Power control Register (R/W) */
-  __IO uint32_t GPREG0;                 /*!< Offset: 0x004 General purpose Register 0 (R/W) */
-  __IO uint32_t GPREG1;                 /*!< Offset: 0x008 General purpose Register 1 (R/W) */
-  __IO uint32_t GPREG2;                 /*!< Offset: 0x00C General purpose Register 2 (R/W) */
-  __IO uint32_t GPREG3;                 /*!< Offset: 0x010 General purpose Register 3 (R/W) */
-  __IO uint32_t GPREG4;                 /*!< Offset: 0x014 General purpose Register 4 (R/W) */
-} LPC_PMU_TypeDef;
-/*@}*/ /* end of group LPC11xx_PMU */
-
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                       FLASHCTRL                                      -----
-// ------------------------------------------------------------------------------------------------
-
-typedef struct {                            /*!< (@ 0x4003C000) FLASHCTRL Structure    */
-  __I  uint32_t RESERVED0[4];
-  __IO uint32_t FLASHCFG;                   /*!< (@ 0x4003C010) Flash memory access time configuration register */
-  __I  uint32_t RESERVED1[3];
-  __IO uint32_t FMSSTART;                   /*!< (@ 0x4003C020) Signature start address register */
-  __IO uint32_t FMSSTOP;                    /*!< (@ 0x4003C024) Signature stop-address register */
-  __I  uint32_t RESERVED2[1];
-  __I  uint32_t FMSW0;                      /*!< (@ 0x4003C02C) Word 0 [31:0]          */
-  __I  uint32_t FMSW1;                      /*!< (@ 0x4003C030) Word 1 [63:32]         */
-  __I  uint32_t FMSW2;                      /*!< (@ 0x4003C034) Word 2 [95:64]         */
-  __I  uint32_t FMSW3;                      /*!< (@ 0x4003C038) Word 3 [127:96]        */
-  __I  uint32_t RESERVED3[1001];
-  __I  uint32_t FMSTAT;                     /*!< (@ 0x4003CFE0) Signature generation status register */
-  __I  uint32_t RESERVED4[1];
-  __IO uint32_t FMSTATCLR;                  /*!< (@ 0x4003CFE8) Signature generation status clear register */
-} LPC_FLASHCTRL_Type;
-
-
-/*------------- General Purpose Input/Output (GPIO) --------------------------*/
-/** @addtogroup LPC11xx_GPIO LPC11xx General Purpose Input/Output 
-  @{
-*/
-typedef struct
-{
-  union {
-    __IO uint32_t MASKED_ACCESS[4096];  /*!< Offset: 0x0000 to 0x3FFC Port data Register for pins PIOn_0 to PIOn_11 (R/W) */
-    struct {
-         uint32_t RESERVED0[4095];
-    __IO uint32_t DATA;                 /*!< Offset: 0x3FFC Port data Register (R/W) */
-    };
-  };
-       uint32_t RESERVED1[4096];
-  __IO uint32_t DIR;                    /*!< Offset: 0x8000 Data direction Register (R/W) */
-  __IO uint32_t IS;                     /*!< Offset: 0x8004 Interrupt sense Register (R/W) */
-  __IO uint32_t IBE;                    /*!< Offset: 0x8008 Interrupt both edges Register (R/W) */
-  __IO uint32_t IEV;                    /*!< Offset: 0x800C Interrupt event Register  (R/W) */
-  __IO uint32_t IE;                     /*!< Offset: 0x8010 Interrupt mask Register (R/W) */
-  __I uint32_t RIS;                    /*!< Offset: 0x8014 Raw interrupt status Register (R/ ) */
-  __I uint32_t MIS;                    /*!< Offset: 0x8018 Masked interrupt status Register (R/ ) */
-  __O uint32_t IC;                     /*!< Offset: 0x801C Interrupt clear Register (/W) */
-} LPC_GPIO_TypeDef;
-/*@}*/ /* end of group LPC11xx_GPIO */
-
-/*------------- Timer (TMR) --------------------------------------------------*/
-/** @addtogroup LPC11xx_TMR LPC11xx 16/32-bit Counter/Timer 
-  @{
-*/
-typedef struct
-{
-  __IO uint32_t IR;                     /*!< Offset: 0x000 Interrupt Register (R/W) */
-  __IO uint32_t TCR;                    /*!< Offset: 0x004 Timer Control Register (R/W) */
-  __IO uint32_t TC;                     /*!< Offset: 0x008 Timer Counter Register (R/W) */
-  __IO uint32_t PR;                     /*!< Offset: 0x00C Prescale Register (R/W) */
-  __IO uint32_t PC;                     /*!< Offset: 0x010 Prescale Counter Register (R/W) */
-  __IO uint32_t MCR;                    /*!< Offset: 0x014 Match Control Register (R/W) */
-  union {
-  __IO uint32_t MR[4];                  /*!< Offset: Match Register base */
-  struct{
-  __IO uint32_t MR0;                    /*!< Offset: 0x018 Match Register 0 (R/W) */
-  __IO uint32_t MR1;                    /*!< Offset: 0x01C Match Register 1 (R/W) */
-  __IO uint32_t MR2;                    /*!< Offset: 0x020 Match Register 2 (R/W) */
-  __IO uint32_t MR3;                    /*!< Offset: 0x024 Match Register 3 (R/W) */
-  };
-  };
-  __IO uint32_t CCR;                    /*!< Offset: 0x028 Capture Control Register (R/W) */
-  __I  uint32_t CR0;                    /*!< Offset: 0x02C Capture Register 0 (R/ ) */
-  __I  uint32_t CR1;                    /*!< Offset: 0x030 Capture Register 1 (R/ ) */
-       uint32_t RESERVED1[2];
-  __IO uint32_t EMR;                    /*!< Offset: 0x03C External Match Register (R/W) */
-       uint32_t RESERVED2[12];
-  __IO uint32_t CTCR;                   /*!< Offset: 0x070 Count Control Register (R/W) */
-  __IO uint32_t PWMC;                   /*!< Offset: 0x074 PWM Control Register (R/W) */
-} LPC_TMR_TypeDef;
-/*@}*/ /* end of group LPC11xx_TMR */
-
-
-/*------------- Universal Asynchronous Receiver Transmitter (UART) -----------*/
-/** @addtogroup LPC11xx_UART LPC11xx Universal Asynchronous Receiver/Transmitter 
-  @{
-*/
-typedef struct
-{
-  union {
-  __I  uint32_t  RBR;                   /*!< Offset: 0x000 Receiver Buffer  Register (R/ ) */
-  __O  uint32_t  THR;                   /*!< Offset: 0x000 Transmit Holding Register ( /W) */
-  __IO uint32_t  DLL;                   /*!< Offset: 0x000 Divisor Latch LSB (R/W) */
-  };
-  union {
-  __IO uint32_t  DLM;                   /*!< Offset: 0x004 Divisor Latch MSB (R/W) */
-  __IO uint32_t  IER;                   /*!< Offset: 0x000 Interrupt Enable Register (R/W) */
-  };
-  union {
-  __I  uint32_t  IIR;                   /*!< Offset: 0x008 Interrupt ID Register (R/ ) */
-  __O  uint32_t  FCR;                   /*!< Offset: 0x008 FIFO Control Register ( /W) */
-  };
-  __IO uint32_t  LCR;                   /*!< Offset: 0x00C Line Control Register (R/W) */
-  __IO uint32_t  MCR;                   /*!< Offset: 0x010 Modem control Register (R/W) */
-  __I  uint32_t  LSR;                   /*!< Offset: 0x014 Line Status Register (R/ ) */
-  __I  uint32_t  MSR;                   /*!< Offset: 0x018 Modem status Register (R/ ) */
-  __IO uint32_t  SCR;                   /*!< Offset: 0x01C Scratch Pad Register (R/W) */
-  __IO uint32_t  ACR;                   /*!< Offset: 0x020 Auto-baud Control Register (R/W) */
-       uint32_t  RESERVED0;
-  __IO uint32_t  FDR;                   /*!< Offset: 0x028 Fractional Divider Register (R/W) */
-       uint32_t  RESERVED1;
-  __IO uint32_t  TER;                   /*!< Offset: 0x030 Transmit Enable Register (R/W) */
-       uint32_t  RESERVED2[6];
-  __IO uint32_t  RS485CTRL;             /*!< Offset: 0x04C RS-485/EIA-485 Control Register (R/W) */
-  __IO uint32_t  ADRMATCH;              /*!< Offset: 0x050 RS-485/EIA-485 address match Register (R/W) */
-  __IO uint32_t  RS485DLY;              /*!< Offset: 0x054 RS-485/EIA-485 direction control delay Register (R/W) */
-  __I  uint32_t  FIFOLVL;               /*!< Offset: 0x058 FIFO Level Register (R) */
-} LPC_UART_TypeDef;
-/*@}*/ /* end of group LPC11xx_UART */
-
-
-/*------------- Synchronous Serial Communication (SSP) -----------------------*/
-/** @addtogroup LPC11xx_SSP LPC11xx Synchronous Serial Port 
-  @{
-*/
-typedef struct
-{
-  __IO uint32_t CR0;                    /*!< Offset: 0x000 Control Register 0 (R/W) */
-  __IO uint32_t CR1;                    /*!< Offset: 0x004 Control Register 1 (R/W) */
-  __IO uint32_t DR;                     /*!< Offset: 0x008 Data Register (R/W) */
-  __I  uint32_t SR;                     /*!< Offset: 0x00C Status Registe (R/ ) */
-  __IO uint32_t CPSR;                   /*!< Offset: 0x010 Clock Prescale Register (R/W) */
-  __IO uint32_t IMSC;                   /*!< Offset: 0x014 Interrupt Mask Set and Clear Register (R/W) */
-  __I uint32_t RIS;                    /*!< Offset: 0x018 Raw Interrupt Status Register (R/) */
-  __I uint32_t MIS;                    /*!< Offset: 0x01C Masked Interrupt Status Register (R/) */
-  __O uint32_t ICR;                    /*!< Offset: 0x020 SSPICR Interrupt Clear Register (/W) */
-} LPC_SSP_TypeDef;
-/*@}*/ /* end of group LPC11xx_SSP */
-
-
-/*------------- Inter-Integrated Circuit (I2C) -------------------------------*/
-/** @addtogroup LPC11xx_I2C LPC11xx I2C-Bus Interface 
-  @{
-*/
-typedef struct
-{
-  __IO uint32_t CONSET;                 /*!< Offset: 0x000 I2C Control Set Register (R/W) */
-  __I  uint32_t STAT;                   /*!< Offset: 0x004 I2C Status Register (R/ ) */
-  __IO uint32_t DAT;                    /*!< Offset: 0x008 I2C Data Register (R/W) */
-  __IO uint32_t ADR0;                   /*!< Offset: 0x00C I2C Slave Address Register 0 (R/W) */
-  __IO uint32_t SCLH;                   /*!< Offset: 0x010 SCH Duty Cycle Register High Half Word (R/W) */
-  __IO uint32_t SCLL;                   /*!< Offset: 0x014 SCL Duty Cycle Register Low Half Word (R/W) */
-  __O  uint32_t CONCLR;                 /*!< Offset: 0x018 I2C Control Clear Register ( /W) */
-  __IO uint32_t MMCTRL;                 /*!< Offset: 0x01C Monitor mode control register (R/W) */
-  __IO uint32_t ADR1;                   /*!< Offset: 0x020 I2C Slave Address Register 1 (R/W) */
-  __IO uint32_t ADR2;                   /*!< Offset: 0x024 I2C Slave Address Register 2 (R/W) */
-  __IO uint32_t ADR3;                   /*!< Offset: 0x028 I2C Slave Address Register 3 (R/W) */
-  __I  uint32_t DATA_BUFFER;            /*!< Offset: 0x02C Data buffer register ( /W) */
-  __IO uint32_t MASK0;                  /*!< Offset: 0x030 I2C Slave address mask register 0 (R/W) */
-  __IO uint32_t MASK1;                  /*!< Offset: 0x034 I2C Slave address mask register 1 (R/W) */
-  __IO uint32_t MASK2;                  /*!< Offset: 0x038 I2C Slave address mask register 2 (R/W) */
-  __IO uint32_t MASK3;                  /*!< Offset: 0x03C I2C Slave address mask register 3 (R/W) */
-} LPC_I2C_TypeDef;
-/*@}*/ /* end of group LPC11xx_I2C */
-
-
-/*------------- Watchdog Timer (WDT) -----------------------------------------*/
-/** @addtogroup LPC11xx_WDT LPC11xx WatchDog Timer 
-  @{
-*/
-typedef struct
-{
-  __IO uint32_t MOD;                    /*!< Offset: 0x000 Watchdog mode register (R/W) */
-  __IO uint32_t TC;                     /*!< Offset: 0x004 Watchdog timer constant register (R/W) */
-  __O  uint32_t FEED;                   /*!< Offset: 0x008 Watchdog feed sequence register (W) */
-  __I  uint32_t TV;                     /*!< Offset: 0x00C Watchdog timer value register (R) */
-       uint32_t RESERVED0;
-  __IO uint32_t WARNINT;				/*!< Offset: 0x014 Watchdog timer warning int. register (R/W) */
-  __IO uint32_t WINDOW;					/*!< Offset: 0x018 Watchdog timer window value register (R/W) */
-} LPC_WDT_TypeDef;
-/*@}*/ /* end of group LPC11xx_WDT */
-
-
-/*------------- Analog-to-Digital Converter (ADC) ----------------------------*/
-/** @addtogroup LPC11xx_ADC LPC11xx Analog-to-Digital Converter 
-  @{
-*/
-typedef struct
-{
-  __IO uint32_t CR;                     /*!< Offset: 0x000       A/D Control Register (R/W) */
-  __IO uint32_t GDR;                    /*!< Offset: 0x004       A/D Global Data Register (R/W) */
-       uint32_t RESERVED0;
-  __IO uint32_t INTEN;                  /*!< Offset: 0x00C       A/D Interrupt Enable Register (R/W) */
-  __IO uint32_t DR[8];                  /*!< Offset: 0x010-0x02C A/D Channel 0..7 Data Register (R/W) */
-  __I  uint32_t STAT;                   /*!< Offset: 0x030       A/D Status Register (R/ ) */
-} LPC_ADC_TypeDef;
-/*@}*/ /* end of group LPC11xx_ADC */
-
-
-/*------------- CAN Controller (CAN) ----------------------------*/
-/** @addtogroup LPC11xx_CAN LPC11xx Controller Area Network(CAN) 
-  @{
-*/
-typedef struct
-{
-  __IO uint32_t CNTL;				/* 0x000 */
-  __IO uint32_t STAT;
-  __IO uint32_t EC;
-  __IO uint32_t BT;
-  __IO uint32_t INT;
-  __IO uint32_t TEST;
-  __IO uint32_t BRPE;
-       uint32_t RESERVED0;
-  __IO uint32_t IF1_CMDREQ;			/* 0x020 */
-  __IO uint32_t IF1_CMDMSK;
-  __IO uint32_t IF1_MSK1;
-  __IO uint32_t IF1_MSK2;
-  __IO uint32_t IF1_ARB1;
-  __IO uint32_t IF1_ARB2;
-  __IO uint32_t IF1_MCTRL;
-  __IO uint32_t IF1_DA1;
-  __IO uint32_t IF1_DA2;
-  __IO uint32_t IF1_DB1;
-  __IO uint32_t IF1_DB2;
-       uint32_t RESERVED1[13];   
-  __IO uint32_t IF2_CMDREQ;			/* 0x080 */
-  __IO uint32_t IF2_CMDMSK;
-  __IO uint32_t IF2_MSK1;
-  __IO uint32_t IF2_MSK2;
-  __IO uint32_t IF2_ARB1;
-  __IO uint32_t IF2_ARB2;
-  __IO uint32_t IF2_MCTRL;
-  __IO uint32_t IF2_DA1;
-  __IO uint32_t IF2_DA2;
-  __IO uint32_t IF2_DB1;
-  __IO uint32_t IF2_DB2;
-       uint32_t RESERVED2[21];
-  __I  uint32_t TXREQ1;				/* 0x100 */
-  __I  uint32_t TXREQ2;
-       uint32_t RESERVED3[6];
-  __I  uint32_t ND1;				/* 0x120 */
-  __I  uint32_t ND2;
-       uint32_t RESERVED4[6];
-  __I  uint32_t IR1;				/* 0x140 */
-  __I  uint32_t IR2;
-       uint32_t RESERVED5[6];
-  __I  uint32_t MSGV1;				/* 0x160 */
-  __I  uint32_t MSGV2;
-       uint32_t RESERVED6[6];
-  __IO uint32_t CLKDIV;				/* 0x180 */
-} LPC_CAN_TypeDef;
-/*@}*/ /* end of group LPC11xx_CAN */
-
-#if defined ( __CC_ARM   )
-#pragma no_anon_unions
-#endif
-
-/******************************************************************************/
-/*                         Peripheral memory map                              */
-/******************************************************************************/
-/* Base addresses                                                             */
-#define LPC_FLASH_BASE        (0x00000000UL)
-#define LPC_RAM_BASE          (0x10000000UL)
-#define LPC_APB0_BASE         (0x40000000UL)
-#define LPC_AHB_BASE          (0x50000000UL)
-
-/* APB0 peripherals                                                           */
-#define LPC_I2C_BASE          (LPC_APB0_BASE + 0x00000)
-#define LPC_WDT_BASE          (LPC_APB0_BASE + 0x04000)
-#define LPC_UART_BASE         (LPC_APB0_BASE + 0x08000)
-#define LPC_CT16B0_BASE       (LPC_APB0_BASE + 0x0C000)
-#define LPC_CT16B1_BASE       (LPC_APB0_BASE + 0x10000)
-#define LPC_CT32B0_BASE       (LPC_APB0_BASE + 0x14000)
-#define LPC_CT32B1_BASE       (LPC_APB0_BASE + 0x18000)
-#define LPC_ADC_BASE          (LPC_APB0_BASE + 0x1C000)
-#define LPC_PMU_BASE          (LPC_APB0_BASE + 0x38000)
-#define LPC_FLASHCTRL_BASE    (LPC_APB0_BASE + 0x3C000)
-#define LPC_SSP0_BASE         (LPC_APB0_BASE + 0x40000)
-#define LPC_IOCON_BASE        (LPC_APB0_BASE + 0x44000)
-#define LPC_SYSCON_BASE       (LPC_APB0_BASE + 0x48000)
-#define LPC_CAN_BASE          (LPC_APB0_BASE + 0x50000)
-#define LPC_SSP1_BASE         (LPC_APB0_BASE + 0x58000)
-
-/* AHB peripherals                                                            */
-#define LPC_GPIO_BASE         (LPC_AHB_BASE  + 0x00000)
-#define LPC_GPIO0_BASE        (LPC_AHB_BASE  + 0x00000)
-#define LPC_GPIO1_BASE        (LPC_AHB_BASE  + 0x10000)
-#define LPC_GPIO2_BASE        (LPC_AHB_BASE  + 0x20000)
-#define LPC_GPIO3_BASE        (LPC_AHB_BASE  + 0x30000)
-
-/******************************************************************************/
-/*                         Peripheral declaration                             */
-/******************************************************************************/
-#define LPC_I2C               ((LPC_I2C_TypeDef    *) LPC_I2C_BASE   )
-#define LPC_WDT               ((LPC_WDT_TypeDef    *) LPC_WDT_BASE   )
-#define LPC_UART              ((LPC_UART_TypeDef   *) LPC_UART_BASE  )
-#define LPC_TMR16B0           ((LPC_TMR_TypeDef    *) LPC_CT16B0_BASE)
-#define LPC_TMR16B1           ((LPC_TMR_TypeDef    *) LPC_CT16B1_BASE)
-#define LPC_TMR32B0           ((LPC_TMR_TypeDef    *) LPC_CT32B0_BASE)
-#define LPC_TMR32B1           ((LPC_TMR_TypeDef    *) LPC_CT32B1_BASE)
-#define LPC_ADC               ((LPC_ADC_TypeDef    *) LPC_ADC_BASE   )
-#define LPC_PMU               ((LPC_PMU_TypeDef    *) LPC_PMU_BASE   )
-#define LPC_FLASHCTRL         ((LPC_FLASHCTRL_Type *) LPC_FLASHCTRL_BASE)
-#define LPC_SSP0              ((LPC_SSP_TypeDef    *) LPC_SSP0_BASE  )
-#define LPC_SSP1              ((LPC_SSP_TypeDef    *) LPC_SSP1_BASE  )
-#define LPC_CAN               ((LPC_CAN_TypeDef    *) LPC_CAN_BASE   )
-#define LPC_IOCON             ((LPC_IOCON_TypeDef  *) LPC_IOCON_BASE )
-#define LPC_SYSCON            ((LPC_SYSCON_TypeDef *) LPC_SYSCON_BASE)
-#define LPC_GPIO0             ((LPC_GPIO_TypeDef   *) LPC_GPIO0_BASE )
-#define LPC_GPIO1             ((LPC_GPIO_TypeDef   *) LPC_GPIO1_BASE )
-#define LPC_GPIO2             ((LPC_GPIO_TypeDef   *) LPC_GPIO2_BASE )
-#define LPC_GPIO3             ((LPC_GPIO_TypeDef   *) LPC_GPIO3_BASE )
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /* __LPC11xx_H__ */
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11CXX/system_LPC11xx.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,367 +0,0 @@
-/**************************************************************************//**
- * @file     system_LPC11xx.c
- * @brief    CMSIS Cortex-M0 Device Peripheral Access Layer Source File
- *           for the NXP LPC11xx/LPC11Cxx Devices
- * @version  V1.10
- * @date     24. November 2010
- *
- * @note
- * Copyright (C) 2009-2010 ARM Limited. All rights reserved.
- *
- * @par
- * ARM Limited (ARM) is supplying this software for use with Cortex-M 
- * processor based microcontrollers.  This file can be freely distributed 
- * within development tools that are supporting such ARM based processors. 
- *
- * @par
- * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- *
- ******************************************************************************/
-
-
-#include <stdint.h>
-#include "LPC11xx.h"
-
-/*
-//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-*/
-
-/*--------------------- Clock Configuration ----------------------------------
-//
-// <e> Clock Configuration
-//   <h> System Oscillator Control Register (SYSOSCCTRL)
-//     <o1.0>      BYPASS: System Oscillator Bypass Enable
-//                     <i> If enabled then PLL input (sys_osc_clk) is fed
-//                     <i> directly from XTALIN and XTALOUT pins.
-//     <o1.9>      FREQRANGE: System Oscillator Frequency Range
-//                     <i> Determines frequency range for Low-power oscillator.
-//                   <0=> 1 - 20 MHz
-//                   <1=> 15 - 25 MHz
-//   </h>
-//
-//   <h> Watchdog Oscillator Control Register (WDTOSCCTRL)
-//     <o2.0..4>   DIVSEL: Select Divider for Fclkana
-//                     <i> wdt_osc_clk = Fclkana/ (2 * (1 + DIVSEL))
-//                   <0-31>
-//     <o2.5..8>   FREQSEL: Select Watchdog Oscillator Analog Output Frequency (Fclkana)
-//                   <0=> Undefined
-//                   <1=> 0.5 MHz
-//                   <2=> 0.8 MHz
-//                   <3=> 1.1 MHz
-//                   <4=> 1.4 MHz
-//                   <5=> 1.6 MHz
-//                   <6=> 1.8 MHz
-//                   <7=> 2.0 MHz
-//                   <8=> 2.2 MHz
-//                   <9=> 2.4 MHz
-//                   <10=> 2.6 MHz
-//                   <11=> 2.7 MHz
-//                   <12=> 2.9 MHz
-//                   <13=> 3.1 MHz
-//                   <14=> 3.2 MHz
-//                   <15=> 3.4 MHz
-//   </h>
-//
-//   <h> System PLL Control Register (SYSPLLCTRL)
-//                   <i> F_clkout = M * F_clkin = F_CCO / (2 * P)
-//                   <i> F_clkin must be in the range of  10 MHz to  25 MHz
-//                   <i> F_CCO   must be in the range of 156 MHz to 320 MHz
-//     <o3.0..4>   MSEL: Feedback Divider Selection
-//                     <i> M = MSEL + 1
-//                   <0-31>
-//     <o3.5..6>   PSEL: Post Divider Selection
-//                   <0=> P = 1
-//                   <1=> P = 2
-//                   <2=> P = 4
-//                   <3=> P = 8
-//   </h>
-//
-//   <h> System PLL Clock Source Select Register (SYSPLLCLKSEL)
-//     <o4.0..1>   SEL: System PLL Clock Source
-//                   <0=> IRC Oscillator
-//                   <1=> System Oscillator
-//                   <2=> Reserved
-//                   <3=> Reserved
-//   </h>
-//
-//   <h> Main Clock Source Select Register (MAINCLKSEL)
-//     <o5.0..1>   SEL: Clock Source for Main Clock
-//                   <0=> IRC Oscillator
-//                   <1=> Input Clock to System PLL
-//                   <2=> WDT Oscillator
-//                   <3=> System PLL Clock Out
-//   </h>
-//
-//   <h> System AHB Clock Divider Register (SYSAHBCLKDIV)
-//     <o6.0..7>   DIV: System AHB Clock Divider
-//                     <i> Divides main clock to provide system clock to core, memories, and peripherals.
-//                     <i> 0 = is disabled
-//                   <0-255>
-//   </h>
-// </e>
-*/
-#define CLOCK_SETUP           1
-#define SYSOSCCTRL_Val        0x00000000              // Reset: 0x000
-#define WDTOSCCTRL_Val        0x00000000              // Reset: 0x000
-#define SYSPLLCTRL_Val        0x00000023              // Reset: 0x000
-#define SYSPLLCLKSEL_Val      0x00000001              // Reset: 0x000
-#define MAINCLKSEL_Val        0x00000000              // Reset: 0x000
-#define SYSAHBCLKDIV_Val      0x00000001              // Reset: 0x001
-
-/*
-//-------- <<< end of configuration section >>> ------------------------------
-*/
-
-/*----------------------------------------------------------------------------
-  Check the register settings
- *----------------------------------------------------------------------------*/
-#define CHECK_RANGE(val, min, max)                ((val < min) || (val > max))
-#define CHECK_RSVD(val, mask)                     (val & mask)
-
-/* Clock Configuration -------------------------------------------------------*/
-#if (CHECK_RSVD((SYSOSCCTRL_Val),  ~0x00000003))
-   #error "SYSOSCCTRL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((WDTOSCCTRL_Val),  ~0x000001FF))
-   #error "WDTOSCCTRL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RANGE((SYSPLLCLKSEL_Val), 0, 2))
-   #error "SYSPLLCLKSEL: Value out of range!"
-#endif
-
-#if (CHECK_RSVD((SYSPLLCTRL_Val),  ~0x000001FF))
-   #error "SYSPLLCTRL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((MAINCLKSEL_Val),  ~0x00000003))
-   #error "MAINCLKSEL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RANGE((SYSAHBCLKDIV_Val), 0, 255))
-   #error "SYSAHBCLKDIV: Value out of range!"
-#endif
-
-
-/*----------------------------------------------------------------------------
-  DEFINES
- *----------------------------------------------------------------------------*/
-    
-/*----------------------------------------------------------------------------
-  Define clocks
- *----------------------------------------------------------------------------*/
-#define __XTAL            (12000000UL)    /* Oscillator frequency             */
-#define __SYS_OSC_CLK     (    __XTAL)    /* Main oscillator frequency        */
-#define __IRC_OSC_CLK     (12000000UL)    /* Internal RC oscillator frequency */
-
-
-#define __FREQSEL   ((WDTOSCCTRL_Val >> 5) & 0x0F)
-#define __DIVSEL   (((WDTOSCCTRL_Val & 0x1F) << 1) + 2)
-
-#if (CLOCK_SETUP)                         /* Clock Setup              */
-  #if  (__FREQSEL ==  0)
-    #define __WDT_OSC_CLK        ( 0)                  /* undefined */
-  #elif (__FREQSEL ==  1)
-    #define __WDT_OSC_CLK        ( 500000 / __DIVSEL)
-  #elif (__FREQSEL ==  2)
-    #define __WDT_OSC_CLK        ( 800000 / __DIVSEL)
-  #elif (__FREQSEL ==  3)
-    #define __WDT_OSC_CLK        (1100000 / __DIVSEL)
-  #elif (__FREQSEL ==  4)
-    #define __WDT_OSC_CLK        (1400000 / __DIVSEL)
-  #elif (__FREQSEL ==  5)
-    #define __WDT_OSC_CLK        (1600000 / __DIVSEL)
-  #elif (__FREQSEL ==  6)
-    #define __WDT_OSC_CLK        (1800000 / __DIVSEL)
-  #elif (__FREQSEL ==  7)
-    #define __WDT_OSC_CLK        (2000000 / __DIVSEL)
-  #elif (__FREQSEL ==  8)
-    #define __WDT_OSC_CLK        (2200000 / __DIVSEL)
-  #elif (__FREQSEL ==  9)
-    #define __WDT_OSC_CLK        (2400000 / __DIVSEL)
-  #elif (__FREQSEL == 10)
-    #define __WDT_OSC_CLK        (2600000 / __DIVSEL)
-  #elif (__FREQSEL == 11)
-    #define __WDT_OSC_CLK        (2700000 / __DIVSEL)
-  #elif (__FREQSEL == 12)
-    #define __WDT_OSC_CLK        (2900000 / __DIVSEL)
-  #elif (__FREQSEL == 13)
-    #define __WDT_OSC_CLK        (3100000 / __DIVSEL)
-  #elif (__FREQSEL == 14)
-    #define __WDT_OSC_CLK        (3200000 / __DIVSEL)
-  #else
-    #define __WDT_OSC_CLK        (3400000 / __DIVSEL)
-  #endif
-
-  /* sys_pllclkin calculation */
-  #if   ((SYSPLLCLKSEL_Val & 0x03) == 0)
-    #define __SYS_PLLCLKIN           (__IRC_OSC_CLK)
-  #elif ((SYSPLLCLKSEL_Val & 0x03) == 1)
-    #define __SYS_PLLCLKIN           (__SYS_OSC_CLK)
-  #else
-    #define __SYS_PLLCLKIN           (0)
-  #endif
-
-  #define  __SYS_PLLCLKOUT         (__SYS_PLLCLKIN * ((SYSPLLCTRL_Val & 0x01F) + 1))
-
-  /* main clock calculation */
-  #if   ((MAINCLKSEL_Val & 0x03) == 0)
-    #define __MAIN_CLOCK             (__IRC_OSC_CLK)
-  #elif ((MAINCLKSEL_Val & 0x03) == 1)
-    #define __MAIN_CLOCK             (__SYS_PLLCLKIN)
-  #elif ((MAINCLKSEL_Val & 0x03) == 2)
-    #if (__FREQSEL ==  0)
-      #error "MAINCLKSEL: WDT Oscillator selected but FREQSEL is undefined!"
-    #else
-      #define __MAIN_CLOCK           (__WDT_OSC_CLK)
-    #endif
-  #elif ((MAINCLKSEL_Val & 0x03) == 3)
-    #define __MAIN_CLOCK             (__SYS_PLLCLKOUT)
-  #else
-    #define __MAIN_CLOCK             (0)
-  #endif
-
-  #define __SYSTEM_CLOCK             (__MAIN_CLOCK / SYSAHBCLKDIV_Val)         
-
-#else
-  #define __SYSTEM_CLOCK             (__IRC_OSC_CLK)
-#endif  // CLOCK_SETUP 
-
-
-/*----------------------------------------------------------------------------
-  Clock Variable definitions
- *----------------------------------------------------------------------------*/
-uint32_t SystemCoreClock = __SYSTEM_CLOCK;/*!< System Clock Frequency (Core Clock)*/
-
-
-/*----------------------------------------------------------------------------
-  Clock functions
- *----------------------------------------------------------------------------*/
-void SystemCoreClockUpdate (void)            /* Get Core Clock Frequency      */
-{
-  uint32_t wdt_osc = 0;
-
-  /* Determine clock frequency according to clock register values             */
-  switch ((LPC_SYSCON->WDTOSCCTRL >> 5) & 0x0F) {
-    case 0:  wdt_osc =       0; break;
-    case 1:  wdt_osc =  500000; break;
-    case 2:  wdt_osc =  800000; break;
-    case 3:  wdt_osc = 1100000; break;
-    case 4:  wdt_osc = 1400000; break;
-    case 5:  wdt_osc = 1600000; break;
-    case 6:  wdt_osc = 1800000; break;
-    case 7:  wdt_osc = 2000000; break;
-    case 8:  wdt_osc = 2200000; break;
-    case 9:  wdt_osc = 2400000; break;
-    case 10: wdt_osc = 2600000; break;
-    case 11: wdt_osc = 2700000; break;
-    case 12: wdt_osc = 2900000; break;
-    case 13: wdt_osc = 3100000; break;
-    case 14: wdt_osc = 3200000; break;
-    case 15: wdt_osc = 3400000; break;
-  }
-  wdt_osc /= ((LPC_SYSCON->WDTOSCCTRL & 0x1F) << 1) + 2;
- 
-  switch (LPC_SYSCON->MAINCLKSEL & 0x03) {
-    case 0:                             /* Internal RC oscillator             */
-      SystemCoreClock = __IRC_OSC_CLK;
-      break;
-    case 1:                             /* Input Clock to System PLL          */
-      switch (LPC_SYSCON->SYSPLLCLKSEL & 0x03) {
-          case 0:                       /* Internal RC oscillator             */
-            SystemCoreClock = __IRC_OSC_CLK;
-            break;
-          case 1:                       /* System oscillator                  */
-            SystemCoreClock = __SYS_OSC_CLK;
-            break;
-          case 2:                       /* Reserved                           */
-          case 3:                       /* Reserved                           */
-            SystemCoreClock = 0;
-            break;
-      }
-      break;
-    case 2:                             /* WDT Oscillator                     */
-      SystemCoreClock = wdt_osc;
-      break;
-    case 3:                             /* System PLL Clock Out               */
-      switch (LPC_SYSCON->SYSPLLCLKSEL & 0x03) {
-          case 0:                       /* Internal RC oscillator             */
-            if (LPC_SYSCON->SYSPLLCTRL & 0x180) {
-              SystemCoreClock = __IRC_OSC_CLK;
-            } else {
-              SystemCoreClock = __IRC_OSC_CLK * ((LPC_SYSCON->SYSPLLCTRL & 0x01F) + 1);
-            }
-            break;
-          case 1:                       /* System oscillator                  */
-            if (LPC_SYSCON->SYSPLLCTRL & 0x180) {
-              SystemCoreClock = __SYS_OSC_CLK;
-            } else {
-              SystemCoreClock = __SYS_OSC_CLK * ((LPC_SYSCON->SYSPLLCTRL & 0x01F) + 1);
-            }
-            break;
-          case 2:                       /* Reserved                           */
-          case 3:                       /* Reserved                           */
-            SystemCoreClock = 0;
-            break;
-      }
-      break;
-  }
-
-  SystemCoreClock /= LPC_SYSCON->SYSAHBCLKDIV;  
-
-}
-
-/**
- * Initialize the system
- *
- * @param  none
- * @return none
- *
- * @brief  Setup the microcontroller system.
- *         Initialize the System.
- */
-void SystemInit (void) {
-  volatile uint32_t i;
-
-#if (CLOCK_SETUP)                                 /* Clock Setup              */
-
-#if ((SYSPLLCLKSEL_Val & 0x03) == 1)
-  LPC_SYSCON->PDRUNCFG     &= ~(1 << 5);          /* Power-up System Osc      */
-  LPC_SYSCON->SYSOSCCTRL    = SYSOSCCTRL_Val;
-  for (i = 0; i < 200; i++) __NOP();
-#endif
-
-  LPC_SYSCON->SYSPLLCLKSEL  = SYSPLLCLKSEL_Val;   /* Select PLL Input         */
-  LPC_SYSCON->SYSPLLCLKUEN  = 0x01;               /* Update Clock Source      */
-  LPC_SYSCON->SYSPLLCLKUEN  = 0x00;               /* Toggle Update Register   */
-  LPC_SYSCON->SYSPLLCLKUEN  = 0x01;
-  while (!(LPC_SYSCON->SYSPLLCLKUEN & 0x01));     /* Wait Until Updated       */
-#if ((MAINCLKSEL_Val & 0x03) == 3)                /* Main Clock is PLL Out    */
-  LPC_SYSCON->SYSPLLCTRL    = SYSPLLCTRL_Val;
-  LPC_SYSCON->PDRUNCFG     &= ~(1 << 7);          /* Power-up SYSPLL          */
-  while (!(LPC_SYSCON->SYSPLLSTAT & 0x01));	      /* Wait Until PLL Locked    */
-#endif
-
-#if (((MAINCLKSEL_Val & 0x03) == 2) )
-  LPC_SYSCON->WDTOSCCTRL    = WDTOSCCTRL_Val;
-  LPC_SYSCON->PDRUNCFG     &= ~(1 << 6);          /* Power-up WDT Clock       */
-  for (i = 0; i < 200; i++) __NOP();
-#endif
-
-  LPC_SYSCON->MAINCLKSEL    = MAINCLKSEL_Val;     /* Select PLL Clock Output  */
-  LPC_SYSCON->MAINCLKUEN    = 0x01;               /* Update MCLK Clock Source */
-  LPC_SYSCON->MAINCLKUEN    = 0x00;               /* Toggle Update Register   */
-  LPC_SYSCON->MAINCLKUEN    = 0x01;
-  while (!(LPC_SYSCON->MAINCLKUEN & 0x01));       /* Wait Until Updated       */
-
-  LPC_SYSCON->SYSAHBCLKDIV  = SYSAHBCLKDIV_Val;
-#endif
-   /* System clock to the IOCON needs to be enabled or
-  most of the I/O related peripherals won't work. */
-  LPC_SYSCON->SYSAHBCLKCTRL |= (1<<16);
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11XX/system_LPC11xx.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,367 +0,0 @@
-/**************************************************************************//**
- * @file     system_LPC11xx.c
- * @brief    CMSIS Cortex-M0 Device Peripheral Access Layer Source File
- *           for the NXP LPC11xx/LPC11Cxx Devices
- * @version  V1.10
- * @date     24. November 2010
- *
- * @note
- * Copyright (C) 2009-2010 ARM Limited. All rights reserved.
- *
- * @par
- * ARM Limited (ARM) is supplying this software for use with Cortex-M 
- * processor based microcontrollers.  This file can be freely distributed 
- * within development tools that are supporting such ARM based processors. 
- *
- * @par
- * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- *
- ******************************************************************************/
-
-
-#include <stdint.h>
-#include "LPC11xx.h"
-
-/*
-//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-*/
-
-/*--------------------- Clock Configuration ----------------------------------
-//
-// <e> Clock Configuration
-//   <h> System Oscillator Control Register (SYSOSCCTRL)
-//     <o1.0>      BYPASS: System Oscillator Bypass Enable
-//                     <i> If enabled then PLL input (sys_osc_clk) is fed
-//                     <i> directly from XTALIN and XTALOUT pins.
-//     <o1.9>      FREQRANGE: System Oscillator Frequency Range
-//                     <i> Determines frequency range for Low-power oscillator.
-//                   <0=> 1 - 20 MHz
-//                   <1=> 15 - 25 MHz
-//   </h>
-//
-//   <h> Watchdog Oscillator Control Register (WDTOSCCTRL)
-//     <o2.0..4>   DIVSEL: Select Divider for Fclkana
-//                     <i> wdt_osc_clk = Fclkana/ (2 * (1 + DIVSEL))
-//                   <0-31>
-//     <o2.5..8>   FREQSEL: Select Watchdog Oscillator Analog Output Frequency (Fclkana)
-//                   <0=> Undefined
-//                   <1=> 0.5 MHz
-//                   <2=> 0.8 MHz
-//                   <3=> 1.1 MHz
-//                   <4=> 1.4 MHz
-//                   <5=> 1.6 MHz
-//                   <6=> 1.8 MHz
-//                   <7=> 2.0 MHz
-//                   <8=> 2.2 MHz
-//                   <9=> 2.4 MHz
-//                   <10=> 2.6 MHz
-//                   <11=> 2.7 MHz
-//                   <12=> 2.9 MHz
-//                   <13=> 3.1 MHz
-//                   <14=> 3.2 MHz
-//                   <15=> 3.4 MHz
-//   </h>
-//
-//   <h> System PLL Control Register (SYSPLLCTRL)
-//                   <i> F_clkout = M * F_clkin = F_CCO / (2 * P)
-//                   <i> F_clkin must be in the range of  10 MHz to  25 MHz
-//                   <i> F_CCO   must be in the range of 156 MHz to 320 MHz
-//     <o3.0..4>   MSEL: Feedback Divider Selection
-//                     <i> M = MSEL + 1
-//                   <0-31>
-//     <o3.5..6>   PSEL: Post Divider Selection
-//                   <0=> P = 1
-//                   <1=> P = 2
-//                   <2=> P = 4
-//                   <3=> P = 8
-//   </h>
-//
-//   <h> System PLL Clock Source Select Register (SYSPLLCLKSEL)
-//     <o4.0..1>   SEL: System PLL Clock Source
-//                   <0=> IRC Oscillator
-//                   <1=> System Oscillator
-//                   <2=> Reserved
-//                   <3=> Reserved
-//   </h>
-//
-//   <h> Main Clock Source Select Register (MAINCLKSEL)
-//     <o5.0..1>   SEL: Clock Source for Main Clock
-//                   <0=> IRC Oscillator
-//                   <1=> Input Clock to System PLL
-//                   <2=> WDT Oscillator
-//                   <3=> System PLL Clock Out
-//   </h>
-//
-//   <h> System AHB Clock Divider Register (SYSAHBCLKDIV)
-//     <o6.0..7>   DIV: System AHB Clock Divider
-//                     <i> Divides main clock to provide system clock to core, memories, and peripherals.
-//                     <i> 0 = is disabled
-//                   <0-255>
-//   </h>
-// </e>
-*/
-#define CLOCK_SETUP           1
-#define SYSOSCCTRL_Val        0x00000000              // Reset: 0x000
-#define WDTOSCCTRL_Val        0x00000000              // Reset: 0x000
-#define SYSPLLCTRL_Val        0x00000023              // Reset: 0x000
-#define SYSPLLCLKSEL_Val      0x00000000              // Reset: 0x000	// Define as using IRC
-#define MAINCLKSEL_Val        0x00000003              // Reset: 0x000	// Define as using System PLL clock out
-#define SYSAHBCLKDIV_Val      0x00000001              // Reset: 0x001
-
-/*
-//-------- <<< end of configuration section >>> ------------------------------
-*/
-
-/*----------------------------------------------------------------------------
-  Check the register settings
- *----------------------------------------------------------------------------*/
-#define CHECK_RANGE(val, min, max)                ((val < min) || (val > max))
-#define CHECK_RSVD(val, mask)                     (val & mask)
-
-/* Clock Configuration -------------------------------------------------------*/
-#if (CHECK_RSVD((SYSOSCCTRL_Val),  ~0x00000003))
-   #error "SYSOSCCTRL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((WDTOSCCTRL_Val),  ~0x000001FF))
-   #error "WDTOSCCTRL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RANGE((SYSPLLCLKSEL_Val), 0, 2))
-   #error "SYSPLLCLKSEL: Value out of range!"
-#endif
-
-#if (CHECK_RSVD((SYSPLLCTRL_Val),  ~0x000001FF))
-   #error "SYSPLLCTRL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((MAINCLKSEL_Val),  ~0x00000003))
-   #error "MAINCLKSEL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RANGE((SYSAHBCLKDIV_Val), 0, 255))
-   #error "SYSAHBCLKDIV: Value out of range!"
-#endif
-
-
-/*----------------------------------------------------------------------------
-  DEFINES
- *----------------------------------------------------------------------------*/
-    
-/*----------------------------------------------------------------------------
-  Define clocks
- *----------------------------------------------------------------------------*/
-#define __XTAL            (12000000UL)    /* Oscillator frequency             */
-#define __SYS_OSC_CLK     (    __XTAL)    /* Main oscillator frequency        */
-#define __IRC_OSC_CLK     (12000000UL)    /* Internal RC oscillator frequency */
-
-
-#define __FREQSEL   ((WDTOSCCTRL_Val >> 5) & 0x0F)
-#define __DIVSEL   (((WDTOSCCTRL_Val & 0x1F) << 1) + 2)
-
-#if (CLOCK_SETUP)                         /* Clock Setup              */
-  #if  (__FREQSEL ==  0)
-    #define __WDT_OSC_CLK        ( 0)                  /* undefined */
-  #elif (__FREQSEL ==  1)
-    #define __WDT_OSC_CLK        ( 500000 / __DIVSEL)
-  #elif (__FREQSEL ==  2)
-    #define __WDT_OSC_CLK        ( 800000 / __DIVSEL)
-  #elif (__FREQSEL ==  3)
-    #define __WDT_OSC_CLK        (1100000 / __DIVSEL)
-  #elif (__FREQSEL ==  4)
-    #define __WDT_OSC_CLK        (1400000 / __DIVSEL)
-  #elif (__FREQSEL ==  5)
-    #define __WDT_OSC_CLK        (1600000 / __DIVSEL)
-  #elif (__FREQSEL ==  6)
-    #define __WDT_OSC_CLK        (1800000 / __DIVSEL)
-  #elif (__FREQSEL ==  7)
-    #define __WDT_OSC_CLK        (2000000 / __DIVSEL)
-  #elif (__FREQSEL ==  8)
-    #define __WDT_OSC_CLK        (2200000 / __DIVSEL)
-  #elif (__FREQSEL ==  9)
-    #define __WDT_OSC_CLK        (2400000 / __DIVSEL)
-  #elif (__FREQSEL == 10)
-    #define __WDT_OSC_CLK        (2600000 / __DIVSEL)
-  #elif (__FREQSEL == 11)
-    #define __WDT_OSC_CLK        (2700000 / __DIVSEL)
-  #elif (__FREQSEL == 12)
-    #define __WDT_OSC_CLK        (2900000 / __DIVSEL)
-  #elif (__FREQSEL == 13)
-    #define __WDT_OSC_CLK        (3100000 / __DIVSEL)
-  #elif (__FREQSEL == 14)
-    #define __WDT_OSC_CLK        (3200000 / __DIVSEL)
-  #else
-    #define __WDT_OSC_CLK        (3400000 / __DIVSEL)
-  #endif
-
-  /* sys_pllclkin calculation */
-  #if   ((SYSPLLCLKSEL_Val & 0x03) == 0)
-    #define __SYS_PLLCLKIN           (__IRC_OSC_CLK)
-  #elif ((SYSPLLCLKSEL_Val & 0x03) == 1)
-    #define __SYS_PLLCLKIN           (__SYS_OSC_CLK)
-  #else
-    #define __SYS_PLLCLKIN           (0)
-  #endif
-
-  #define  __SYS_PLLCLKOUT         (__SYS_PLLCLKIN * ((SYSPLLCTRL_Val & 0x01F) + 1))
-
-  /* main clock calculation */
-  #if   ((MAINCLKSEL_Val & 0x03) == 0)
-    #define __MAIN_CLOCK             (__IRC_OSC_CLK)
-  #elif ((MAINCLKSEL_Val & 0x03) == 1)
-    #define __MAIN_CLOCK             (__SYS_PLLCLKIN)
-  #elif ((MAINCLKSEL_Val & 0x03) == 2)
-    #if (__FREQSEL ==  0)
-      #error "MAINCLKSEL: WDT Oscillator selected but FREQSEL is undefined!"
-    #else
-      #define __MAIN_CLOCK           (__WDT_OSC_CLK)
-    #endif
-  #elif ((MAINCLKSEL_Val & 0x03) == 3)
-    #define __MAIN_CLOCK             (__SYS_PLLCLKOUT)
-  #else
-    #define __MAIN_CLOCK             (0)
-  #endif
-
-  #define __SYSTEM_CLOCK             (__MAIN_CLOCK / SYSAHBCLKDIV_Val)         
-
-#else
-  #define __SYSTEM_CLOCK             (__IRC_OSC_CLK)
-#endif  // CLOCK_SETUP 
-
-
-/*----------------------------------------------------------------------------
-  Clock Variable definitions
- *----------------------------------------------------------------------------*/
-uint32_t SystemCoreClock = __SYSTEM_CLOCK;/*!< System Clock Frequency (Core Clock)*/
-
-
-/*----------------------------------------------------------------------------
-  Clock functions
- *----------------------------------------------------------------------------*/
-void SystemCoreClockUpdate (void)            /* Get Core Clock Frequency      */
-{
-  uint32_t wdt_osc = 0;
-
-  /* Determine clock frequency according to clock register values             */
-  switch ((LPC_SYSCON->WDTOSCCTRL >> 5) & 0x0F) {
-    case 0:  wdt_osc =       0; break;
-    case 1:  wdt_osc =  500000; break;
-    case 2:  wdt_osc =  800000; break;
-    case 3:  wdt_osc = 1100000; break;
-    case 4:  wdt_osc = 1400000; break;
-    case 5:  wdt_osc = 1600000; break;
-    case 6:  wdt_osc = 1800000; break;
-    case 7:  wdt_osc = 2000000; break;
-    case 8:  wdt_osc = 2200000; break;
-    case 9:  wdt_osc = 2400000; break;
-    case 10: wdt_osc = 2600000; break;
-    case 11: wdt_osc = 2700000; break;
-    case 12: wdt_osc = 2900000; break;
-    case 13: wdt_osc = 3100000; break;
-    case 14: wdt_osc = 3200000; break;
-    case 15: wdt_osc = 3400000; break;
-  }
-  wdt_osc /= ((LPC_SYSCON->WDTOSCCTRL & 0x1F) << 1) + 2;
- 
-  switch (LPC_SYSCON->MAINCLKSEL & 0x03) {
-    case 0:                             /* Internal RC oscillator             */
-      SystemCoreClock = __IRC_OSC_CLK;
-      break;
-    case 1:                             /* Input Clock to System PLL          */
-      switch (LPC_SYSCON->SYSPLLCLKSEL & 0x03) {
-          case 0:                       /* Internal RC oscillator             */
-            SystemCoreClock = __IRC_OSC_CLK;
-            break;
-          case 1:                       /* System oscillator                  */
-            SystemCoreClock = __SYS_OSC_CLK;
-            break;
-          case 2:                       /* Reserved                           */
-          case 3:                       /* Reserved                           */
-            SystemCoreClock = 0;
-            break;
-      }
-      break;
-    case 2:                             /* WDT Oscillator                     */
-      SystemCoreClock = wdt_osc;
-      break;
-    case 3:                             /* System PLL Clock Out               */
-      switch (LPC_SYSCON->SYSPLLCLKSEL & 0x03) {
-          case 0:                       /* Internal RC oscillator             */
-            if (LPC_SYSCON->SYSPLLCTRL & 0x180) {
-              SystemCoreClock = __IRC_OSC_CLK;
-            } else {
-              SystemCoreClock = __IRC_OSC_CLK * ((LPC_SYSCON->SYSPLLCTRL & 0x01F) + 1);
-            }
-            break;
-          case 1:                       /* System oscillator                  */
-            if (LPC_SYSCON->SYSPLLCTRL & 0x180) {
-              SystemCoreClock = __SYS_OSC_CLK;
-            } else {
-              SystemCoreClock = __SYS_OSC_CLK * ((LPC_SYSCON->SYSPLLCTRL & 0x01F) + 1);
-            }
-            break;
-          case 2:                       /* Reserved                           */
-          case 3:                       /* Reserved                           */
-            SystemCoreClock = 0;
-            break;
-      }
-      break;
-  }
-
-  SystemCoreClock /= LPC_SYSCON->SYSAHBCLKDIV;  
-
-}
-
-/**
- * Initialize the system
- *
- * @param  none
- * @return none
- *
- * @brief  Setup the microcontroller system.
- *         Initialize the System.
- */
-void SystemInit (void) {
-  volatile uint32_t i;
-
-#if (CLOCK_SETUP)                                 /* Clock Setup              */
-
-#if ((SYSPLLCLKSEL_Val & 0x03) == 1)
-  LPC_SYSCON->PDRUNCFG     &= ~(1 << 5);          /* Power-up System Osc      */
-  LPC_SYSCON->SYSOSCCTRL    = SYSOSCCTRL_Val;
-  for (i = 0; i < 200; i++) __NOP();
-#endif
-
-  LPC_SYSCON->SYSPLLCLKSEL  = SYSPLLCLKSEL_Val;   /* Select PLL Input         */
-  LPC_SYSCON->SYSPLLCLKUEN  = 0x01;               /* Update Clock Source      */
-  LPC_SYSCON->SYSPLLCLKUEN  = 0x00;               /* Toggle Update Register   */
-  LPC_SYSCON->SYSPLLCLKUEN  = 0x01;
-  while (!(LPC_SYSCON->SYSPLLCLKUEN & 0x01));     /* Wait Until Updated       */
-#if ((MAINCLKSEL_Val & 0x03) == 3)                /* Main Clock is PLL Out    */
-  LPC_SYSCON->SYSPLLCTRL    = SYSPLLCTRL_Val;
-  LPC_SYSCON->PDRUNCFG     &= ~(1 << 7);          /* Power-up SYSPLL          */
-  while (!(LPC_SYSCON->SYSPLLSTAT & 0x01));	      /* Wait Until PLL Locked    */
-#endif
-
-#if (((MAINCLKSEL_Val & 0x03) == 2) )
-  LPC_SYSCON->WDTOSCCTRL    = WDTOSCCTRL_Val;
-  LPC_SYSCON->PDRUNCFG     &= ~(1 << 6);          /* Power-up WDT Clock       */
-  for (i = 0; i < 200; i++) __NOP();
-#endif
-
-  LPC_SYSCON->MAINCLKSEL    = MAINCLKSEL_Val;     /* Select PLL Clock Output  */
-  LPC_SYSCON->MAINCLKUEN    = 0x01;               /* Update MCLK Clock Source */
-  LPC_SYSCON->MAINCLKUEN    = 0x00;               /* Toggle Update Register   */
-  LPC_SYSCON->MAINCLKUEN    = 0x01;
-  while (!(LPC_SYSCON->MAINCLKUEN & 0x01));       /* Wait Until Updated       */
-
-  LPC_SYSCON->SYSAHBCLKDIV  = SYSAHBCLKDIV_Val;
-#endif
-   /* System clock to the IOCON needs to be enabled or
-  most of the I/O related peripherals won't work. */
-  LPC_SYSCON->SYSAHBCLKCTRL |= (1<<16);
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_ARM_MICRO/TARGET_LPC11CXX/LPC11C24.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-
-LR_IROM1 0x00000000 0x8000  {    ; load region size_region (32k)
-
-  ER_IROM1 0x00000000 0x8000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-
-  ; 48 vectors * 4 bytes = 0xC0 for remap
-  RW_IRAM1 (0x10000000+0xC0) (0x2000-0xC0)  {
-   .ANY (+RW +ZI)
-  }
-
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_ARM_MICRO/TARGET_LPC11CXX/startup_LPC11xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,304 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_LPC11xx.s
-; * @purpose: CMSIS Cortex-M0 Core Device Startup File 
-; *           for the NXP LPC11xx Device Series 
-; * @version: V1.0
-; * @date:    25. Nov. 2008
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; * Copyright (C) 2008 ARM Limited. All rights reserved.
-; * ARM Limited (ARM) is supplying this software for use with Cortex-M0 
-; * processor based microcontrollers.  This file can be freely distributed 
-; * within development tools that are supporting such ARM based processors. 
-; *
-; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
-; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
-; *
-; *****************************************************************************/
-
-Stack_Size      EQU     0x00000400
-
-                AREA    STACK, NOINIT, READWRITE, ALIGN=3
-                EXPORT  __initial_sp
-
-Stack_Mem       SPACE   Stack_Size
-__initial_sp        EQU     0x10002000  ; Top of RAM from LPC1114
-
-
-Heap_Size       EQU     0x00000000
-
-                AREA    HEAP, NOINIT, READWRITE, ALIGN=3
-                EXPORT  __heap_base
-                EXPORT  __heap_limit
-
-__heap_base
-Heap_Mem        SPACE   Heap_Size
-__heap_limit
-
-                PRESERVE8
-                THUMB
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-
-__Vectors       DCD     __initial_sp              ; Top of Stack
-                DCD     Reset_Handler             ; Reset Handler
-                DCD     NMI_Handler               ; NMI Handler
-                DCD     HardFault_Handler         ; Hard Fault Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     SVC_Handler               ; SVCall Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     PendSV_Handler            ; PendSV Handler
-                DCD     SysTick_Handler           ; SysTick Handler
-
-                DCD     SLWU_INT0_IRQHandler      ; Start logic wake-up interrupt 0
-                DCD     SLWU_INT1_IRQHandler      ; Start logic wake-up interrupt 1
-                DCD     SLWU_INT2_IRQHandler      ; Start logic wake-up interrupt 2
-                DCD     SLWU_INT3_IRQHandler      ; Start logic wake-up interrupt 3
-                DCD     SLWU_INT4_IRQHandler      ; Start logic wake-up interrupt 4
-                DCD     SLWU_INT5_IRQHandler      ; Start logic wake-up interrupt 5
-                DCD     SLWU_INT6_IRQHandler      ; Start logic wake-up interrupt 6
-                DCD     SLWU_INT7_IRQHandler      ; Start logic wake-up interrupt 7
-                DCD     SLWU_INT8_IRQHandler      ; Start logic wake-up interrupt 8
-                DCD     SLWU_INT9_IRQHandler      ; Start logic wake-up interrupt 9
-                DCD     SLWU_INT10_IRQHandler     ; Start logic wake-up interrupt 10
-                DCD     SLWU_INT11_IRQHandler     ; Start logic wake-up interrupt 11
-                DCD     SLWU_INT12_IRQHandler     ; Start logic wake-up interrupt 12
-                DCD     C_CAN_IRQHandler          ; C_CAN
-                DCD     SSP1_IRQHandler           ; SSP1
-                DCD     I2C_IRQHandler            ; I2C
-                DCD     TIMER16_0_IRQHandler      ; 16-bit Timer0
-                DCD     TIMER16_1_IRQHandler      ; 16-bit Timer1
-                DCD     TIMER32_0_IRQHandler      ; 32-bit Timer0
-                DCD     TIMER32_1_IRQHandler      ; 32-bit Timer1
-                DCD     SSP0_IRQHandler           ; SSP0
-                DCD     UART_IRQHandler           ; UART
-                DCD     Reserved_IRQHandler       ; Reserved
-                DCD     Reserved_IRQHandler       ; Reserved
-                DCD     ADC_IRQHandler            ; A/D Converter
-                DCD     WDT_IRQHandler            ; Watchdog timer
-                DCD     BOD_IRQHandler            ; Brown Out Detect
-                DCD     Reserved_IRQHandler       ; Reserved
-                DCD     PIO_3_IRQHandler	  ; GPIO interrupt status of port 3
-                DCD     PIO_2_IRQHandler          ; GPIO interrupt status of port 2
-                DCD     PIO_1_IRQHandler          ; GPIO interrupt status of port 1
-                DCD     PIO_0_IRQHandler          ; GPIO interrupt status of port 0
-	
-	;; 48 vector entries. We pad to 128 to fill the 0x0 - 0x1FF REMAP address space
-
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-                IF      :LNOT::DEF:NO_CRP
-                AREA    |.ARM.__at_0x02FC|, CODE, READONLY
-CRP_Key         DCD     0xFFFFFFFF
-                ENDIF
-
-                AREA    |.text|, CODE, READONLY
-
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-; Dummy Exception Handlers (infinite loops which can be modified)
-
-; now, under COMMON NMI.c and NMI.h, a real NMI handler is created if NMI is enabled 
-; for particular peripheral.
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-Reserved_IRQHandler PROC
-                EXPORT  Reserved_IRQHandler       [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-; for LPC1114
-                EXPORT  NMI_Handler               [WEAK]
-                EXPORT  SLWU_INT0_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT1_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT2_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT3_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT4_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT5_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT6_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT7_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT8_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT9_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT10_IRQHandler     [WEAK]
-                EXPORT  SLWU_INT11_IRQHandler     [WEAK]
-                EXPORT  SLWU_INT12_IRQHandler     [WEAK]
-                EXPORT  C_CAN_IRQHandler          [WEAK]
-                EXPORT  SSP1_IRQHandler           [WEAK]
-                EXPORT  I2C_IRQHandler            [WEAK]
-                EXPORT  TIMER16_0_IRQHandler      [WEAK]
-                EXPORT  TIMER16_1_IRQHandler      [WEAK]
-                EXPORT  TIMER32_0_IRQHandler      [WEAK]
-                EXPORT  TIMER32_1_IRQHandler      [WEAK]
-                EXPORT  SSP0_IRQHandler           [WEAK]
-                EXPORT  UART_IRQHandler           [WEAK]
-                EXPORT  ADC_IRQHandler            [WEAK]
-                EXPORT  WDT_IRQHandler            [WEAK]
-                EXPORT  BOD_IRQHandler            [WEAK]
-                EXPORT  PIO_3_IRQHandler          [WEAK]
-                EXPORT  PIO_2_IRQHandler          [WEAK]
-                EXPORT  PIO_1_IRQHandler          [WEAK]
-                EXPORT  PIO_0_IRQHandler          [WEAK]
-
-NMI_Handler
-
-SLWU_INT0_IRQHandler
-SLWU_INT1_IRQHandler
-SLWU_INT2_IRQHandler
-SLWU_INT3_IRQHandler
-SLWU_INT4_IRQHandler
-SLWU_INT5_IRQHandler
-SLWU_INT6_IRQHandler
-SLWU_INT7_IRQHandler
-SLWU_INT8_IRQHandler
-SLWU_INT9_IRQHandler
-SLWU_INT10_IRQHandler
-SLWU_INT11_IRQHandler
-SLWU_INT12_IRQHandler
-C_CAN_IRQHandler
-SSP1_IRQHandler
-I2C_IRQHandler
-TIMER16_0_IRQHandler
-TIMER16_1_IRQHandler
-TIMER32_0_IRQHandler
-TIMER32_1_IRQHandler
-SSP0_IRQHandler
-UART_IRQHandler
-ADC_IRQHandler
-WDT_IRQHandler
-BOD_IRQHandler
-PIO_3_IRQHandler
-PIO_2_IRQHandler
-PIO_1_IRQHandler
-PIO_0_IRQHandler
-
-                B       .
-
-                ENDP
-
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_ARM_MICRO/TARGET_LPC11XX/LPC1114.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-
-LR_IROM1 0x00000000 0x8000  {    ; load region size_region (32k)
-
-  ER_IROM1 0x00000000 0x8000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-
-  ; 48 vectors * 4 bytes = 0xC0 for remap
-  RW_IRAM1 (0x10000000+0xC0) (0x1000-0xC0)  {
-   .ANY (+RW +ZI)
-  }
-
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_ARM_MICRO/TARGET_LPC11XX/startup_LPC11xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,304 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_LPC11xx.s
-; * @purpose: CMSIS Cortex-M0 Core Device Startup File 
-; *           for the NXP LPC11xx Device Series 
-; * @version: V1.0
-; * @date:    25. Nov. 2008
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; * Copyright (C) 2008 ARM Limited. All rights reserved.
-; * ARM Limited (ARM) is supplying this software for use with Cortex-M0 
-; * processor based microcontrollers.  This file can be freely distributed 
-; * within development tools that are supporting such ARM based processors. 
-; *
-; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
-; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
-; *
-; *****************************************************************************/
-
-Stack_Size      EQU     0x00000400
-
-                AREA    STACK, NOINIT, READWRITE, ALIGN=3
-                EXPORT  __initial_sp
-
-Stack_Mem       SPACE   Stack_Size
-__initial_sp        EQU     0x10001000  ; Top of RAM from LPC1114
-
-
-Heap_Size       EQU     0x00000000
-
-                AREA    HEAP, NOINIT, READWRITE, ALIGN=3
-                EXPORT  __heap_base
-                EXPORT  __heap_limit
-
-__heap_base
-Heap_Mem        SPACE   Heap_Size
-__heap_limit
-
-                PRESERVE8
-                THUMB
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-
-__Vectors       DCD     __initial_sp              ; Top of Stack
-                DCD     Reset_Handler             ; Reset Handler
-                DCD     NMI_Handler               ; NMI Handler
-                DCD     HardFault_Handler         ; Hard Fault Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     SVC_Handler               ; SVCall Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     PendSV_Handler            ; PendSV Handler
-                DCD     SysTick_Handler           ; SysTick Handler
-
-                DCD     SLWU_INT0_IRQHandler      ; Start logic wake-up interrupt 0
-                DCD     SLWU_INT1_IRQHandler      ; Start logic wake-up interrupt 1
-                DCD     SLWU_INT2_IRQHandler      ; Start logic wake-up interrupt 2
-                DCD     SLWU_INT3_IRQHandler      ; Start logic wake-up interrupt 3
-                DCD     SLWU_INT4_IRQHandler      ; Start logic wake-up interrupt 4
-                DCD     SLWU_INT5_IRQHandler      ; Start logic wake-up interrupt 5
-                DCD     SLWU_INT6_IRQHandler      ; Start logic wake-up interrupt 6
-                DCD     SLWU_INT7_IRQHandler      ; Start logic wake-up interrupt 7
-                DCD     SLWU_INT8_IRQHandler      ; Start logic wake-up interrupt 8
-                DCD     SLWU_INT9_IRQHandler      ; Start logic wake-up interrupt 9
-                DCD     SLWU_INT10_IRQHandler     ; Start logic wake-up interrupt 10
-                DCD     SLWU_INT11_IRQHandler     ; Start logic wake-up interrupt 11
-                DCD     SLWU_INT12_IRQHandler     ; Start logic wake-up interrupt 12
-                DCD     C_CAN_IRQHandler          ; C_CAN
-                DCD     SSP1_IRQHandler           ; SSP1
-                DCD     I2C_IRQHandler            ; I2C
-                DCD     TIMER16_0_IRQHandler      ; 16-bit Timer0
-                DCD     TIMER16_1_IRQHandler      ; 16-bit Timer1
-                DCD     TIMER32_0_IRQHandler      ; 32-bit Timer0
-                DCD     TIMER32_1_IRQHandler      ; 32-bit Timer1
-                DCD     SSP0_IRQHandler           ; SSP0
-                DCD     UART_IRQHandler           ; UART
-                DCD     Reserved_IRQHandler       ; Reserved
-                DCD     Reserved_IRQHandler       ; Reserved
-                DCD     ADC_IRQHandler            ; A/D Converter
-                DCD     WDT_IRQHandler            ; Watchdog timer
-                DCD     BOD_IRQHandler            ; Brown Out Detect
-                DCD     Reserved_IRQHandler       ; Reserved
-                DCD     PIO_3_IRQHandler	  ; GPIO interrupt status of port 3
-                DCD     PIO_2_IRQHandler          ; GPIO interrupt status of port 2
-                DCD     PIO_1_IRQHandler          ; GPIO interrupt status of port 1
-                DCD     PIO_0_IRQHandler          ; GPIO interrupt status of port 0
-	
-	;; 48 vector entries. We pad to 128 to fill the 0x0 - 0x1FF REMAP address space
-
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-        	DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-                IF      :LNOT::DEF:NO_CRP
-                AREA    |.ARM.__at_0x02FC|, CODE, READONLY
-CRP_Key         DCD     0xFFFFFFFF
-                ENDIF
-
-                AREA    |.text|, CODE, READONLY
-
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-; Dummy Exception Handlers (infinite loops which can be modified)
-
-; now, under COMMON NMI.c and NMI.h, a real NMI handler is created if NMI is enabled 
-; for particular peripheral.
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-Reserved_IRQHandler PROC
-                EXPORT  Reserved_IRQHandler       [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-; for LPC1114
-                EXPORT  NMI_Handler               [WEAK]
-                EXPORT  SLWU_INT0_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT1_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT2_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT3_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT4_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT5_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT6_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT7_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT8_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT9_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT10_IRQHandler     [WEAK]
-                EXPORT  SLWU_INT11_IRQHandler     [WEAK]
-                EXPORT  SLWU_INT12_IRQHandler     [WEAK]
-                EXPORT  C_CAN_IRQHandler          [WEAK]
-                EXPORT  SSP1_IRQHandler           [WEAK]
-                EXPORT  I2C_IRQHandler            [WEAK]
-                EXPORT  TIMER16_0_IRQHandler      [WEAK]
-                EXPORT  TIMER16_1_IRQHandler      [WEAK]
-                EXPORT  TIMER32_0_IRQHandler      [WEAK]
-                EXPORT  TIMER32_1_IRQHandler      [WEAK]
-                EXPORT  SSP0_IRQHandler           [WEAK]
-                EXPORT  UART_IRQHandler           [WEAK]
-                EXPORT  ADC_IRQHandler            [WEAK]
-                EXPORT  WDT_IRQHandler            [WEAK]
-                EXPORT  BOD_IRQHandler            [WEAK]
-                EXPORT  PIO_3_IRQHandler          [WEAK]
-                EXPORT  PIO_2_IRQHandler          [WEAK]
-                EXPORT  PIO_1_IRQHandler          [WEAK]
-                EXPORT  PIO_0_IRQHandler          [WEAK]
-
-NMI_Handler
-
-SLWU_INT0_IRQHandler
-SLWU_INT1_IRQHandler
-SLWU_INT2_IRQHandler
-SLWU_INT3_IRQHandler
-SLWU_INT4_IRQHandler
-SLWU_INT5_IRQHandler
-SLWU_INT6_IRQHandler
-SLWU_INT7_IRQHandler
-SLWU_INT8_IRQHandler
-SLWU_INT9_IRQHandler
-SLWU_INT10_IRQHandler
-SLWU_INT11_IRQHandler
-SLWU_INT12_IRQHandler
-C_CAN_IRQHandler
-SSP1_IRQHandler
-I2C_IRQHandler
-TIMER16_0_IRQHandler
-TIMER16_1_IRQHandler
-TIMER32_0_IRQHandler
-TIMER32_1_IRQHandler
-SSP0_IRQHandler
-UART_IRQHandler
-ADC_IRQHandler
-WDT_IRQHandler
-BOD_IRQHandler
-PIO_3_IRQHandler
-PIO_2_IRQHandler
-PIO_1_IRQHandler
-PIO_0_IRQHandler
-
-                B       .
-
-                ENDP
-
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_ARM_MICRO/sys.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library - stackheap
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * Setup a fixed single stack/heap memory model, 
- *  between the top of the RW/ZI region and the stackpointer
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-#include <rt_misc.h>
-#include <stdint.h>
-
-extern char Image$$RW_IRAM1$$ZI$$Limit[];
-
-extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
-    uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
-    uint32_t sp_limit = __current_sp();
-
-    zi_limit = (zi_limit + 7) & ~0x7;    // ensure zi_limit is 8-byte aligned
-
-    struct __initial_stackheap r;
-    r.heap_base = zi_limit;
-    r.heap_limit = sp_limit;
-    return r;
-}
-
-#ifdef __cplusplus
-}
-#endif 
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_ARM_STD/TARGET_LPC11CXX/LPC11C24.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-
-LR_IROM1 0x00000000 0x8000  {    ; load region size_region (32k)
-  ER_IROM1 0x00000000 0x8000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  ; 8_byte_aligned(48 vect * 4 bytes) =  8_byte_aligned(0xC0) = 0xC0
-  ; 8KB - 0xC0 = 0x1F40
-  RW_IRAM1 0x100000C0 0x1F40  {
-   .ANY (+RW +ZI)
-  }
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_ARM_STD/TARGET_LPC11CXX/startup_LPC11xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,292 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_LPC11xx.s
-; * @purpose: CMSIS Cortex-M0 Core Device Startup File 
-; *           for the NXP LPC11xx Device Series 
-; * @version: V1.0
-; * @date:    25. Nov. 2008
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; * Copyright (C) 2008 ARM Limited. All rights reserved.
-; * ARM Limited (ARM) is supplying this software for use with Cortex-M0 
-; * processor based microcontrollers.  This file can be freely distributed 
-; * within development tools that are supporting such ARM based processors. 
-; *
-; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
-; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
-; *
-; *****************************************************************************/
-
-__initial_sp        EQU     0x10002000  ; Top of RAM from LPC1114
-
-                PRESERVE8
-                THUMB
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-
-__Vectors       DCD     __initial_sp              ; Top of Stack
-                DCD     Reset_Handler             ; Reset Handler
-                DCD     NMI_Handler               ; NMI Handler
-                DCD     HardFault_Handler         ; Hard Fault Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     SVC_Handler               ; SVCall Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     PendSV_Handler            ; PendSV Handler
-                DCD     SysTick_Handler           ; SysTick Handler
-
-                DCD     SLWU_INT0_IRQHandler      ; Start logic wake-up interrupt 0
-                DCD     SLWU_INT1_IRQHandler      ; Start logic wake-up interrupt 1
-                DCD     SLWU_INT2_IRQHandler      ; Start logic wake-up interrupt 2
-                DCD     SLWU_INT3_IRQHandler      ; Start logic wake-up interrupt 3
-                DCD     SLWU_INT4_IRQHandler      ; Start logic wake-up interrupt 4
-                DCD     SLWU_INT5_IRQHandler      ; Start logic wake-up interrupt 5
-                DCD     SLWU_INT6_IRQHandler      ; Start logic wake-up interrupt 6
-                DCD     SLWU_INT7_IRQHandler      ; Start logic wake-up interrupt 7
-                DCD     SLWU_INT8_IRQHandler      ; Start logic wake-up interrupt 8
-                DCD     SLWU_INT9_IRQHandler      ; Start logic wake-up interrupt 9
-                DCD     SLWU_INT10_IRQHandler     ; Start logic wake-up interrupt 10
-                DCD     SLWU_INT11_IRQHandler     ; Start logic wake-up interrupt 11
-                DCD     SLWU_INT12_IRQHandler     ; Start logic wake-up interrupt 12
-                DCD     C_CAN_IRQHandler          ; C_CAN
-                DCD     SSP1_IRQHandler           ; SSP1
-                DCD     I2C_IRQHandler            ; I2C
-                DCD     TIMER16_0_IRQHandler      ; 16-bit Timer0
-                DCD     TIMER16_1_IRQHandler      ; 16-bit Timer1
-                DCD     TIMER32_0_IRQHandler      ; 32-bit Timer0
-                DCD     TIMER32_1_IRQHandler      ; 32-bit Timer1
-                DCD     SSP0_IRQHandler           ; SSP0
-                DCD     UART_IRQHandler           ; UART
-                DCD     Reserved_IRQHandler       ; Reserved
-                DCD     Reserved_IRQHandler       ; Reserved
-                DCD     ADC_IRQHandler            ; A/D Converter
-                DCD     WDT_IRQHandler            ; Watchdog timer
-                DCD     BOD_IRQHandler            ; Brown Out Detect
-                DCD     Reserved_IRQHandler       ; Reserved
-                DCD     PIO_3_IRQHandler          ; GPIO interrupt status of port 3
-                DCD     PIO_2_IRQHandler          ; GPIO interrupt status of port 2
-                DCD     PIO_1_IRQHandler          ; GPIO interrupt status of port 1
-                DCD     PIO_0_IRQHandler          ; GPIO interrupt status of port 0
-
-	;; 48 vector entries. We pad to 128 to fill the 0x0 - 0x1FF REMAP address space
-
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-                IF      :LNOT::DEF:NO_CRP
-                AREA    |.ARM.__at_0x02FC|, CODE, READONLY
-CRP_Key         DCD     0xFFFFFFFF
-                ENDIF
-
-                AREA    |.text|, CODE, READONLY
-
-
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-; Dummy Exception Handlers (infinite loops which can be modified)                
-
-; now, under COMMON NMI.c and NMI.h, a real NMI handler is created if NMI is enabled 
-; for particular peripheral.
-;NMI_Handler     PROC
-;                EXPORT  NMI_Handler               [WEAK]
-;                B       .
-;                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-Reserved_IRQHandler PROC
-                EXPORT  Reserved_IRQHandler       [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-; for LPC1114
-                EXPORT  NMI_Handler               [WEAK]
-                EXPORT  SLWU_INT0_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT1_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT2_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT3_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT4_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT5_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT6_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT7_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT8_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT9_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT10_IRQHandler     [WEAK]
-                EXPORT  SLWU_INT11_IRQHandler     [WEAK]
-                EXPORT  SLWU_INT12_IRQHandler     [WEAK]
-                EXPORT  C_CAN_IRQHandler          [WEAK]
-                EXPORT  SSP1_IRQHandler           [WEAK]
-                EXPORT  I2C_IRQHandler            [WEAK]
-                EXPORT  TIMER16_0_IRQHandler      [WEAK]
-                EXPORT  TIMER16_1_IRQHandler      [WEAK]
-                EXPORT  TIMER32_0_IRQHandler      [WEAK]
-                EXPORT  TIMER32_1_IRQHandler      [WEAK]
-                EXPORT  SSP0_IRQHandler           [WEAK]
-                EXPORT  UART_IRQHandler           [WEAK]
-                EXPORT  ADC_IRQHandler            [WEAK]
-                EXPORT  WDT_IRQHandler            [WEAK]
-                EXPORT  BOD_IRQHandler            [WEAK]
-                EXPORT  PIO_3_IRQHandler          [WEAK]
-                EXPORT  PIO_2_IRQHandler          [WEAK]
-                EXPORT  PIO_1_IRQHandler          [WEAK]
-                EXPORT  PIO_0_IRQHandler          [WEAK]
-
-NMI_Handler
-
-SLWU_INT0_IRQHandler
-SLWU_INT1_IRQHandler
-SLWU_INT2_IRQHandler
-SLWU_INT3_IRQHandler
-SLWU_INT4_IRQHandler
-SLWU_INT5_IRQHandler
-SLWU_INT6_IRQHandler
-SLWU_INT7_IRQHandler
-SLWU_INT8_IRQHandler
-SLWU_INT9_IRQHandler
-SLWU_INT10_IRQHandler
-SLWU_INT11_IRQHandler
-SLWU_INT12_IRQHandler
-C_CAN_IRQHandler
-SSP1_IRQHandler
-I2C_IRQHandler
-TIMER16_0_IRQHandler
-TIMER16_1_IRQHandler
-TIMER32_0_IRQHandler
-TIMER32_1_IRQHandler
-SSP0_IRQHandler
-UART_IRQHandler
-ADC_IRQHandler
-WDT_IRQHandler
-BOD_IRQHandler
-PIO_3_IRQHandler
-PIO_2_IRQHandler
-PIO_1_IRQHandler
-PIO_0_IRQHandler
-
-                B       .
-
-                ENDP
-
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_ARM_STD/TARGET_LPC11XX/LPC1114.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-
-LR_IROM1 0x00000000 0x8000  {    ; load region size_region (32k)
-  ER_IROM1 0x00000000 0x8000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  ; 8_byte_aligned(48 vect * 4 bytes) =  8_byte_aligned(0xC0) = 0xC0
-  ; 8KB - 0xC0 = 0xF40
-  RW_IRAM1 0x100000C0 0xF40  {
-   .ANY (+RW +ZI)
-  }
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_ARM_STD/TARGET_LPC11XX/startup_LPC11xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,292 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_LPC11xx.s
-; * @purpose: CMSIS Cortex-M0 Core Device Startup File 
-; *           for the NXP LPC11xx Device Series 
-; * @version: V1.0
-; * @date:    25. Nov. 2008
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; * Copyright (C) 2008 ARM Limited. All rights reserved.
-; * ARM Limited (ARM) is supplying this software for use with Cortex-M0 
-; * processor based microcontrollers.  This file can be freely distributed 
-; * within development tools that are supporting such ARM based processors. 
-; *
-; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
-; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
-; *
-; *****************************************************************************/
-
-__initial_sp        EQU     0x10001000  ; Top of RAM from LPC1114
-
-                PRESERVE8
-                THUMB
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-
-__Vectors       DCD     __initial_sp              ; Top of Stack
-                DCD     Reset_Handler             ; Reset Handler
-                DCD     NMI_Handler               ; NMI Handler
-                DCD     HardFault_Handler         ; Hard Fault Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     SVC_Handler               ; SVCall Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     PendSV_Handler            ; PendSV Handler
-                DCD     SysTick_Handler           ; SysTick Handler
-
-                DCD     SLWU_INT0_IRQHandler      ; Start logic wake-up interrupt 0
-                DCD     SLWU_INT1_IRQHandler      ; Start logic wake-up interrupt 1
-                DCD     SLWU_INT2_IRQHandler      ; Start logic wake-up interrupt 2
-                DCD     SLWU_INT3_IRQHandler      ; Start logic wake-up interrupt 3
-                DCD     SLWU_INT4_IRQHandler      ; Start logic wake-up interrupt 4
-                DCD     SLWU_INT5_IRQHandler      ; Start logic wake-up interrupt 5
-                DCD     SLWU_INT6_IRQHandler      ; Start logic wake-up interrupt 6
-                DCD     SLWU_INT7_IRQHandler      ; Start logic wake-up interrupt 7
-                DCD     SLWU_INT8_IRQHandler      ; Start logic wake-up interrupt 8
-                DCD     SLWU_INT9_IRQHandler      ; Start logic wake-up interrupt 9
-                DCD     SLWU_INT10_IRQHandler     ; Start logic wake-up interrupt 10
-                DCD     SLWU_INT11_IRQHandler     ; Start logic wake-up interrupt 11
-                DCD     SLWU_INT12_IRQHandler     ; Start logic wake-up interrupt 12
-                DCD     C_CAN_IRQHandler          ; C_CAN
-                DCD     SSP1_IRQHandler           ; SSP1
-                DCD     I2C_IRQHandler            ; I2C
-                DCD     TIMER16_0_IRQHandler      ; 16-bit Timer0
-                DCD     TIMER16_1_IRQHandler      ; 16-bit Timer1
-                DCD     TIMER32_0_IRQHandler      ; 32-bit Timer0
-                DCD     TIMER32_1_IRQHandler      ; 32-bit Timer1
-                DCD     SSP0_IRQHandler           ; SSP0
-                DCD     UART_IRQHandler           ; UART
-                DCD     Reserved_IRQHandler       ; Reserved
-                DCD     Reserved_IRQHandler       ; Reserved
-                DCD     ADC_IRQHandler            ; A/D Converter
-                DCD     WDT_IRQHandler            ; Watchdog timer
-                DCD     BOD_IRQHandler            ; Brown Out Detect
-                DCD     Reserved_IRQHandler       ; Reserved
-                DCD     PIO_3_IRQHandler          ; GPIO interrupt status of port 3
-                DCD     PIO_2_IRQHandler          ; GPIO interrupt status of port 2
-                DCD     PIO_1_IRQHandler          ; GPIO interrupt status of port 1
-                DCD     PIO_0_IRQHandler          ; GPIO interrupt status of port 0
-
-	;; 48 vector entries. We pad to 128 to fill the 0x0 - 0x1FF REMAP address space
-
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-                DCD     0xFFFFFFFF                ; Datafill
-
-                IF      :LNOT::DEF:NO_CRP
-                AREA    |.ARM.__at_0x02FC|, CODE, READONLY
-CRP_Key         DCD     0xFFFFFFFF
-                ENDIF
-
-                AREA    |.text|, CODE, READONLY
-
-
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-; Dummy Exception Handlers (infinite loops which can be modified)                
-
-; now, under COMMON NMI.c and NMI.h, a real NMI handler is created if NMI is enabled 
-; for particular peripheral.
-;NMI_Handler     PROC
-;                EXPORT  NMI_Handler               [WEAK]
-;                B       .
-;                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-Reserved_IRQHandler PROC
-                EXPORT  Reserved_IRQHandler       [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-; for LPC1114
-                EXPORT  NMI_Handler               [WEAK]
-                EXPORT  SLWU_INT0_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT1_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT2_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT3_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT4_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT5_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT6_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT7_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT8_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT9_IRQHandler      [WEAK]
-                EXPORT  SLWU_INT10_IRQHandler     [WEAK]
-                EXPORT  SLWU_INT11_IRQHandler     [WEAK]
-                EXPORT  SLWU_INT12_IRQHandler     [WEAK]
-                EXPORT  C_CAN_IRQHandler          [WEAK]
-                EXPORT  SSP1_IRQHandler           [WEAK]
-                EXPORT  I2C_IRQHandler            [WEAK]
-                EXPORT  TIMER16_0_IRQHandler      [WEAK]
-                EXPORT  TIMER16_1_IRQHandler      [WEAK]
-                EXPORT  TIMER32_0_IRQHandler      [WEAK]
-                EXPORT  TIMER32_1_IRQHandler      [WEAK]
-                EXPORT  SSP0_IRQHandler           [WEAK]
-                EXPORT  UART_IRQHandler           [WEAK]
-                EXPORT  ADC_IRQHandler            [WEAK]
-                EXPORT  WDT_IRQHandler            [WEAK]
-                EXPORT  BOD_IRQHandler            [WEAK]
-                EXPORT  PIO_3_IRQHandler          [WEAK]
-                EXPORT  PIO_2_IRQHandler          [WEAK]
-                EXPORT  PIO_1_IRQHandler          [WEAK]
-                EXPORT  PIO_0_IRQHandler          [WEAK]
-
-NMI_Handler
-
-SLWU_INT0_IRQHandler
-SLWU_INT1_IRQHandler
-SLWU_INT2_IRQHandler
-SLWU_INT3_IRQHandler
-SLWU_INT4_IRQHandler
-SLWU_INT5_IRQHandler
-SLWU_INT6_IRQHandler
-SLWU_INT7_IRQHandler
-SLWU_INT8_IRQHandler
-SLWU_INT9_IRQHandler
-SLWU_INT10_IRQHandler
-SLWU_INT11_IRQHandler
-SLWU_INT12_IRQHandler
-C_CAN_IRQHandler
-SSP1_IRQHandler
-I2C_IRQHandler
-TIMER16_0_IRQHandler
-TIMER16_1_IRQHandler
-TIMER32_0_IRQHandler
-TIMER32_1_IRQHandler
-SSP0_IRQHandler
-UART_IRQHandler
-ADC_IRQHandler
-WDT_IRQHandler
-BOD_IRQHandler
-PIO_3_IRQHandler
-PIO_2_IRQHandler
-PIO_1_IRQHandler
-PIO_0_IRQHandler
-
-                B       .
-
-                ENDP
-
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_ARM_STD/sys.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library - stackheap
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * Setup a fixed single stack/heap memory model, 
- *  between the top of the RW/ZI region and the stackpointer
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-#include <rt_misc.h>
-#include <stdint.h>
-
-extern char Image$$RW_IRAM1$$ZI$$Limit[];
-
-extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
-    uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
-    uint32_t sp_limit = __current_sp();
-
-    zi_limit = (zi_limit + 7) & ~0x7;    // ensure zi_limit is 8-byte aligned
-
-    struct __initial_stackheap r;
-    r.heap_base = zi_limit;
-    r.heap_limit = sp_limit;
-    return r;
-}
-
-#ifdef __cplusplus
-}
-#endif 
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11CXX/LPC11C24.ld	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/* Linker script for mbed LPC1114 */
-
-/* Linker script to configure memory regions. */
-MEMORY
-{
-  FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 32K
-  RAM (rwx) :  ORIGIN = 0x100000C0, LENGTH = 0x1F40
-}
-
-/* Linker script to place sections and symbol values. Should be used together
- * with other linker script that defines memory regions FLASH and RAM.
- * It references following symbols, which must be defined in code:
- *   Reset_Handler : Entry of reset handler
- * 
- * It defines following symbols, which code can use without definition:
- *   __exidx_start
- *   __exidx_end
- *   __etext
- *   __data_start__
- *   __preinit_array_start
- *   __preinit_array_end
- *   __init_array_start
- *   __init_array_end
- *   __fini_array_start
- *   __fini_array_end
- *   __data_end__
- *   __bss_start__
- *   __bss_end__
- *   __end__
- *   end
- *   __HeapLimit
- *   __StackLimit
- *   __StackTop
- *   __stack
- */
-ENTRY(Reset_Handler)
-
-SECTIONS
-{
-    .text :
-    {
-        KEEP(*(.isr_vector))
-		*(.text.Reset_Handler)
-        *(.text.SystemInit)
-		. = 0x200;
-        *(.text*)
-
-        KEEP(*(.init))
-        KEEP(*(.fini))
-
-        /* .ctors */
-        *crtbegin.o(.ctors)
-        *crtbegin?.o(.ctors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
-        *(SORT(.ctors.*))
-        *(.ctors)
-
-        /* .dtors */
-        *crtbegin.o(.dtors)
-        *crtbegin?.o(.dtors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
-        *(SORT(.dtors.*))
-        *(.dtors)
-
-        *(.rodata*)
-
-        KEEP(*(.eh_frame*))
-    } > FLASH
-
-    .ARM.extab : 
-    {
-        *(.ARM.extab* .gnu.linkonce.armextab.*)
-    } > FLASH
-
-    __exidx_start = .;
-    .ARM.exidx :
-    {
-        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-    } > FLASH
-    __exidx_end = .;
-
-    __etext = .;
-        
-    .data : AT (__etext)
-    {
-        __data_start__ = .;
-        *(vtable)
-        *(.data*)
-
-        . = ALIGN(4);
-        /* preinit data */
-        PROVIDE (__preinit_array_start = .);
-        KEEP(*(.preinit_array))
-        PROVIDE (__preinit_array_end = .);
-
-        . = ALIGN(4);
-        /* init data */
-        PROVIDE (__init_array_start = .);
-        KEEP(*(SORT(.init_array.*)))
-        KEEP(*(.init_array))
-        PROVIDE (__init_array_end = .);
-
-
-        . = ALIGN(4);
-        /* finit data */
-        PROVIDE (__fini_array_start = .);
-        KEEP(*(SORT(.fini_array.*)))
-        KEEP(*(.fini_array))
-        PROVIDE (__fini_array_end = .);
-
-        . = ALIGN(4);
-        /* All data end */
-        __data_end__ = .;
-
-    } > RAM
-
-    .bss :
-    {
-        __bss_start__ = .;
-        *(.bss*)
-        *(COMMON)
-        __bss_end__ = .;
-    } > RAM
-    
-    .heap :
-    {
-        __end__ = .;
-        end = __end__;
-        *(.heap*)
-        __HeapLimit = .;
-    } > RAM
-
-    /* .stack_dummy section doesn't contains any symbols. It is only
-     * used for linker to calculate size of stack sections, and assign
-     * values to stack symbols later */
-    .stack_dummy :
-    {
-        *(.stack)
-    } > RAM
-
-    /* Set stack top to end of RAM, and stack limit move down by
-     * size of stack_dummy section */
-    __StackTop = ORIGIN(RAM) + LENGTH(RAM);
-    __StackLimit = __StackTop - SIZEOF(.stack_dummy);
-    PROVIDE(__stack = __StackTop);
-    
-    /* Check if data + heap + stack exceeds RAM limit */
-    ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11XX/LPC1114.ld	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/* Linker script for mbed LPC1114 */
-
-/* Linker script to configure memory regions. */
-MEMORY
-{
-  FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 32K
-  RAM (rwx) :  ORIGIN = 0x100000C0, LENGTH = 0x0F40
-}
-
-/* Linker script to place sections and symbol values. Should be used together
- * with other linker script that defines memory regions FLASH and RAM.
- * It references following symbols, which must be defined in code:
- *   Reset_Handler : Entry of reset handler
- * 
- * It defines following symbols, which code can use without definition:
- *   __exidx_start
- *   __exidx_end
- *   __etext
- *   __data_start__
- *   __preinit_array_start
- *   __preinit_array_end
- *   __init_array_start
- *   __init_array_end
- *   __fini_array_start
- *   __fini_array_end
- *   __data_end__
- *   __bss_start__
- *   __bss_end__
- *   __end__
- *   end
- *   __HeapLimit
- *   __StackLimit
- *   __StackTop
- *   __stack
- */
-ENTRY(Reset_Handler)
-
-SECTIONS
-{
-    .text :
-    {
-        KEEP(*(.isr_vector))
-		*(.text.Reset_Handler)
-        *(.text.SystemInit)
-		. = 0x200;
-        *(.text*)
-
-        KEEP(*(.init))
-        KEEP(*(.fini))
-
-        /* .ctors */
-        *crtbegin.o(.ctors)
-        *crtbegin?.o(.ctors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
-        *(SORT(.ctors.*))
-        *(.ctors)
-
-        /* .dtors */
-        *crtbegin.o(.dtors)
-        *crtbegin?.o(.dtors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
-        *(SORT(.dtors.*))
-        *(.dtors)
-
-        *(.rodata*)
-
-        KEEP(*(.eh_frame*))
-    } > FLASH
-
-    .ARM.extab : 
-    {
-        *(.ARM.extab* .gnu.linkonce.armextab.*)
-    } > FLASH
-
-    __exidx_start = .;
-    .ARM.exidx :
-    {
-        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-    } > FLASH
-    __exidx_end = .;
-
-    __etext = .;
-        
-    .data : AT (__etext)
-    {
-        __data_start__ = .;
-        *(vtable)
-        *(.data*)
-
-        . = ALIGN(4);
-        /* preinit data */
-        PROVIDE (__preinit_array_start = .);
-        KEEP(*(.preinit_array))
-        PROVIDE (__preinit_array_end = .);
-
-        . = ALIGN(4);
-        /* init data */
-        PROVIDE (__init_array_start = .);
-        KEEP(*(SORT(.init_array.*)))
-        KEEP(*(.init_array))
-        PROVIDE (__init_array_end = .);
-
-
-        . = ALIGN(4);
-        /* finit data */
-        PROVIDE (__fini_array_start = .);
-        KEEP(*(SORT(.fini_array.*)))
-        KEEP(*(.fini_array))
-        PROVIDE (__fini_array_end = .);
-
-        . = ALIGN(4);
-        /* All data end */
-        __data_end__ = .;
-
-    } > RAM
-
-    .bss :
-    {
-        __bss_start__ = .;
-        *(.bss*)
-        *(COMMON)
-        __bss_end__ = .;
-    } > RAM
-    
-    .heap :
-    {
-        __end__ = .;
-        end = __end__;
-        *(.heap*)
-        __HeapLimit = .;
-    } > RAM
-
-    /* .stack_dummy section doesn't contains any symbols. It is only
-     * used for linker to calculate size of stack sections, and assign
-     * values to stack symbols later */
-    .stack_dummy :
-    {
-        *(.stack)
-    } > RAM
-
-    /* Set stack top to end of RAM, and stack limit move down by
-     * size of stack_dummy section */
-    __StackTop = ORIGIN(RAM) + LENGTH(RAM);
-    __StackLimit = __StackTop - SIZEOF(.stack_dummy);
-    PROVIDE(__stack = __StackTop);
-    
-    /* Check if data + heap + stack exceeds RAM limit */
-    ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_GCC_ARM/startup_LPC11xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,213 +0,0 @@
-/* File: startup_ARMCM0.S
- * Purpose: startup file for Cortex-M0 devices. Should use with 
- *   GCC for ARM Embedded Processors
- * Version: V1.2
- * Date: 15 Nov 2011
- * 
- * Copyright (c) 2011, 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 the ARM Limited 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 ARM LIMITED 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.
- */
-    .syntax unified
-    .arch armv6-m
-
-/* Memory Model
-   The HEAP starts at the end of the DATA section and grows upward.
-   
-   The STACK starts at the end of the RAM and grows downward.
-   
-   The HEAP and stack STACK are only checked at compile time:
-   (DATA_SIZE + HEAP_SIZE + STACK_SIZE) < RAM_SIZE
-   
-   This is just a check for the bare minimum for the Heap+Stack area before
-   aborting compilation, it is not the run time limit:
-   Heap_Size + Stack_Size = 0x80 + 0x80 = 0x100
- */
-    .section .stack
-    .align 3
-#ifdef __STACK_SIZE
-    .equ    Stack_Size, __STACK_SIZE
-#else
-    .equ    Stack_Size, 0x80
-#endif
-    .globl    __StackTop
-    .globl    __StackLimit
-__StackLimit:
-    .space    Stack_Size
-    .size __StackLimit, . - __StackLimit
-__StackTop:
-    .size __StackTop, . - __StackTop
-
-    .section .heap
-    .align 3
-#ifdef __HEAP_SIZE
-    .equ    Heap_Size, __HEAP_SIZE
-#else
-    .equ    Heap_Size, 0x80
-#endif
-    .globl    __HeapBase
-    .globl    __HeapLimit
-__HeapBase:
-    .space    Heap_Size
-    .size __HeapBase, . - __HeapBase
-__HeapLimit:
-    .size __HeapLimit, . - __HeapLimit
-    
-    .section .isr_vector
-    .align 2
-    .globl __isr_vector
-__isr_vector:
-    .long    __StackTop            /* Top of Stack */
-    .long    Reset_Handler         /* Reset Handler */
-    .long    NMI_Handler           /* NMI Handler */
-    .long    HardFault_Handler     /* Hard Fault Handler */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    SVC_Handler           /* SVCall Handler */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    PendSV_Handler        /* PendSV Handler */
-    .long    SysTick_Handler       /* SysTick Handler */
-
-/* LPC11xx interrupts */
-    .long   WAKEUP_IRQHandler         /* 16  0 Wake-up on  pin  PIO0_0             */
-    .long   WAKEUP_IRQHandler         /* 17  1 Wake-up on  pin  PIO0_1             */
-    .long   WAKEUP_IRQHandler         /* 18  2 Wake-up on  pin  PIO0_2             */
-    .long   WAKEUP_IRQHandler         /* 19  3 Wake-up on  pin  PIO0_3             */
-    .long   WAKEUP_IRQHandler         /* 20  4 Wake-up on  pin  PIO0_4             */
-    .long   WAKEUP_IRQHandler         /* 21  5 Wake-up on  pin  PIO0_5             */
-    .long   WAKEUP_IRQHandler         /* 22  6 Wake-up on  pin  PIO0_6             */
-    .long   WAKEUP_IRQHandler         /* 23  7 Wake-up on  pin  PIO0_7             */
-    .long   WAKEUP_IRQHandler         /* 24  8 Wake-up on  pin  PIO0_8             */
-    .long   WAKEUP_IRQHandler         /* 25  9 Wake-up on  pin  PIO0_9             */
-    .long   WAKEUP_IRQHandler         /* 26 10 Wake-up on  pin  PIO0_10            */
-    .long   WAKEUP_IRQHandler         /* 27 11 Wake-up on  pin  PIO0_11            */
-    .long   WAKEUP_IRQHandler         /* 28 12 Wake-up on  pin  PIO1_0             */
-    .long   Default_Handler           /* 29 13                                     */
-    .long   SSP1_IRQHandler           /* 30 14 SSP1                                */
-    .long   I2C_IRQHandler            /* 31 15 I2C0 SI (state change)              */
-    .long   TIMER16_0_IRQHandler      /* 32 16 CT16B0 16 bit timer 0               */
-    .long   TIMER16_1_IRQHandler      /* 33 17 CT16B1 16 bit timer 1               */
-    .long   TIMER32_0_IRQHandler      /* 34 18 CT32B0 32 bit timer 0               */
-    .long   TIMER32_1_IRQHandler      /* 35 19 CT32B1 32 bit timer 1               */
-    .long   SSP0_IRQHandler           /* 36 20 SSP                                 */
-    .long   UART_IRQHandler           /* 37 21 UART                                */
-    .long   Default_Handler           /* 38 22                                     */
-    .long   Default_Handler           /* 39 23                                     */
-    .long   ADC_IRQHandler            /* 40 24 ADC end of conversion               */
-    .long   WDT_IRQHandler            /* 41 25 Watchdog interrupt (WDINT)          */
-    .long   BOD_IRQHandler            /* 42 26 BOD Brown-out detect                */
-    .long   Default_Handler           /* 43 27                                     */
-    .long   PIOINT3_IRQHandler        /* 44 28 PIO_3  GPIO interrupt status of port 3 */
-    .long   PIOINT2_IRQHandler        /* 45 29 PIO_2  GPIO interrupt status of port 2 */
-    .long   PIOINT1_IRQHandler        /* 46 30 PIO_1  GPIO interrupt status of port 1 */
-    .long   PIOINT0_IRQHandler        /* 47 31 PIO_0  GPIO interrupt status of port 0 */
-    
-    .size    __isr_vector, . - __isr_vector
-
-    .section .text.Reset_Handler
-    .thumb
-    .thumb_func
-    .align 2
-    .globl    Reset_Handler
-    .type    Reset_Handler, %function
-Reset_Handler:
-/*     Loop to copy data from read only memory to RAM. The ranges
- *      of copy from/to are specified by following symbols evaluated in 
- *      linker script.
- *      __etext: End of code section, i.e., begin of data sections to copy from.
- *      __data_start__/__data_end__: RAM address range that data should be
- *      copied to. Both must be aligned to 4 bytes boundary.  */
-
-    ldr    r1, =__etext
-    ldr    r2, =__data_start__
-    ldr    r3, =__data_end__
-
-    subs    r3, r2
-    ble    .flash_to_ram_loop_end
-
-    movs    r4, 0
-.flash_to_ram_loop:
-    ldr    r0, [r1,r4]
-    str    r0, [r2,r4]
-    adds    r4, 4
-    cmp    r4, r3
-    blt    .flash_to_ram_loop
-.flash_to_ram_loop_end:
-
-    ldr    r0, =SystemInit
-    blx    r0
-    ldr    r0, =_start
-    bx    r0
-    .pool
-    .size Reset_Handler, . - Reset_Handler
-    
-    .text
-/*    Macro to define default handlers. Default handler
- *    will be weak symbol and just dead loops. They can be
- *    overwritten by other handlers */
-    .macro    def_default_handler    handler_name
-    .align 1
-    .thumb_func
-    .weak    \handler_name
-    .type    \handler_name, %function
-\handler_name :
-    b    .
-    .size    \handler_name, . - \handler_name
-    .endm
-    
-    def_default_handler    NMI_Handler
-    def_default_handler    HardFault_Handler
-    def_default_handler    SVC_Handler
-    def_default_handler    PendSV_Handler
-    def_default_handler    SysTick_Handler
-    def_default_handler    Default_Handler
-    
-    def_default_handler    WAKEUP_IRQHandler
-    def_default_handler    SSP1_IRQHandler
-    def_default_handler    I2C_IRQHandler
-    def_default_handler    TIMER16_0_IRQHandler
-    def_default_handler    TIMER16_1_IRQHandler
-    def_default_handler    TIMER32_0_IRQHandler
-    def_default_handler    TIMER32_1_IRQHandler
-    def_default_handler    SSP0_IRQHandler
-    def_default_handler    UART_IRQHandler
-    def_default_handler    ADC_IRQHandler
-    def_default_handler    WDT_IRQHandler
-    def_default_handler    BOD_IRQHandler
-    def_default_handler    PIOINT3_IRQHandler
-    def_default_handler    PIOINT2_IRQHandler
-    def_default_handler    PIOINT1_IRQHandler
-    def_default_handler    PIOINT0_IRQHandler
-
-    .weak    DEF_IRQHandler
-    .set    DEF_IRQHandler, Default_Handler
-
-    .end
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_GCC_CR/startup_LPC11xx.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-extern "C" {
-
-#include "LPC11Uxx.h"
-
-#define WEAK          __attribute__ ((weak))
-#define ALIAS(f)      __attribute__ ((weak, alias (#f)))
-#define AFTER_VECTORS __attribute__ ((section(".after_vectors")))
-
-     void ResetISR            (void);
-WEAK void NMI_Handler         (void);
-WEAK void HardFault_Handler   (void);
-WEAK void SVCall_Handler      (void);
-WEAK void PendSV_Handler      (void);
-WEAK void SysTick_Handler     (void);
-WEAK void IntDefaultHandler   (void);
-     void FLEX_INT0_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void FLEX_INT1_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void FLEX_INT2_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void FLEX_INT3_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void FLEX_INT4_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void FLEX_INT5_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void FLEX_INT6_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void FLEX_INT7_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void GINT0_IRQHandler    (void) ALIAS(IntDefaultHandler);
-     void GINT1_IRQHandler    (void) ALIAS(IntDefaultHandler);
-     void SSP1_IRQHandler     (void) ALIAS(IntDefaultHandler);
-     void I2C_IRQHandler      (void) ALIAS(IntDefaultHandler);
-     void TIMER16_0_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void TIMER16_1_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void TIMER32_0_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void TIMER32_1_IRQHandler(void) ALIAS(IntDefaultHandler);
-     void SSP0_IRQHandler     (void) ALIAS(IntDefaultHandler);
-     void UART_IRQHandler     (void) ALIAS(IntDefaultHandler);
-     void USB_IRQHandler      (void) ALIAS(IntDefaultHandler);
-     void USB_FIQHandler      (void) ALIAS(IntDefaultHandler);
-     void ADC_IRQHandler      (void) ALIAS(IntDefaultHandler);
-     void WDT_IRQHandler      (void) ALIAS(IntDefaultHandler);
-     void BOD_IRQHandler      (void) ALIAS(IntDefaultHandler);
-     void FMC_IRQHandler      (void) ALIAS(IntDefaultHandler);
-     void USBWakeup_IRQHandler(void) ALIAS(IntDefaultHandler);
-
-extern void __libc_init_array(void);
-extern int main(void);
-extern void _vStackTop(void);
-
-extern void (* const g_pfnVectors[])(void);
-__attribute__ ((section(".isr_vector")))
-void (* const g_pfnVectors[])(void) = {
-    &_vStackTop,
-    ResetISR,
-    NMI_Handler,
-    HardFault_Handler,
-    0,
-    0,
-    0,
-    0,
-    0,
-    0,
-    0,
-    SVCall_Handler,
-    0,
-    0,
-    PendSV_Handler,
-    SysTick_Handler,
-    FLEX_INT0_IRQHandler,
-    FLEX_INT1_IRQHandler,
-    FLEX_INT2_IRQHandler,
-    FLEX_INT3_IRQHandler,
-    FLEX_INT4_IRQHandler,
-    FLEX_INT5_IRQHandler,
-    FLEX_INT6_IRQHandler,
-    FLEX_INT7_IRQHandler,
-    GINT0_IRQHandler,
-    GINT1_IRQHandler,
-    0,
-    0,
-    0,
-    0,
-    SSP1_IRQHandler,
-    I2C_IRQHandler,
-    TIMER16_0_IRQHandler,
-    TIMER16_1_IRQHandler,
-    TIMER32_0_IRQHandler,
-    TIMER32_1_IRQHandler,
-    SSP0_IRQHandler,
-    UART_IRQHandler,
-    USB_IRQHandler,
-    USB_FIQHandler,
-    ADC_IRQHandler,
-    WDT_IRQHandler,
-    BOD_IRQHandler,
-    FMC_IRQHandler,
-    0,
-    0,
-    USBWakeup_IRQHandler,
-    0,
-};
-
-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++;
-}
-
-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;
-}
-
-extern unsigned int __data_section_table;
-extern unsigned int __data_section_table_end;
-extern unsigned int __bss_section_table_end;
-
-AFTER_VECTORS void ResetISR(void) {
-    unsigned int LoadAddr, ExeAddr, SectionLen;
-    unsigned int *SectionTableAddr;
-    
-    // Data Init
-    SectionTableAddr = &__data_section_table;
-    while (SectionTableAddr < &__data_section_table_end) {
-        LoadAddr = *SectionTableAddr++;
-        ExeAddr = *SectionTableAddr++;
-        SectionLen = *SectionTableAddr++;
-        data_init(LoadAddr, ExeAddr, SectionLen);
-    }
-    
-    // BSS Init
-    while (SectionTableAddr < &__bss_section_table_end) {
-        ExeAddr = *SectionTableAddr++;
-        SectionLen = *SectionTableAddr++;
-        bss_init(ExeAddr, SectionLen);
-    }
-    
-    SystemInit();
-    __libc_init_array();
-    main();
-    while (1) {;}
-}
-
-AFTER_VECTORS void NMI_Handler      (void) {while(1){}}
-AFTER_VECTORS void HardFault_Handler(void) {while(1){}}
-AFTER_VECTORS void SVCall_Handler   (void) {while(1){}}
-AFTER_VECTORS void PendSV_Handler   (void) {while(1){}}
-AFTER_VECTORS void SysTick_Handler  (void) {while(1){}}
-AFTER_VECTORS void IntDefaultHandler(void) {while(1){}}
-
-#include <stdlib.h>
-
-void *operator new  (size_t size) {return malloc(size);}
-void *operator new[](size_t size) {return malloc(size);}
-
-void operator delete  (void *p) {free(p);}
-void operator delete[](void *p) {free(p);}
-
-int __aeabi_atexit(void *object, void (*destructor)(void *), void *dso_handle) {
-    return 0;
-}
-
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_GCC_CS/startup_LPC11xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-    .equ    Stack_Size, 0x80
-    .section ".stack", "w"
-    .align  3
-    .globl  __cs3_stack_mem
-    .globl  __cs3_stack_size
-__cs3_stack_mem:
-    .if     Stack_Size
-    .space  Stack_Size
-    .endif
-    .size   __cs3_stack_mem,  . - __cs3_stack_mem
-    .set    __cs3_stack_size, . - __cs3_stack_mem
-
-    .equ    Heap_Size,  0x80
-    .section ".heap", "w"
-    .align  3
-    .globl  __cs3_heap_start
-    .globl  __cs3_heap_end
-__cs3_heap_start:
-    .if     Heap_Size
-    .space  Heap_Size
-    .endif
-__cs3_heap_end:
-
-    .section ".cs3.interrupt_vector"
-    .globl  __cs3_interrupt_vector_cortex_m
-    .type   __cs3_interrupt_vector_cortex_m, %object
-
-__cs3_interrupt_vector_cortex_m:
-    .long   __cs3_stack
-    .long   __cs3_reset
-    .long   NMI_Handler
-    .long   HardFault_Handler
-    .long   0
-    .long   0
-    .long   0
-    .long   0
-    .long   0
-    .long   0
-    .long   0
-    .long   SVC_Handler
-    .long   0
-    .long   0
-    .long   PendSV_Handler
-    .long   SysTick_Handler
-
-    .long   DEF_IRQHandler
-
-    .size   __cs3_interrupt_vector_cortex_m, . - __cs3_interrupt_vector_cortex_m
-
-    .thumb
-
-    .section .cs3.reset,"x",%progbits
-    .thumb_func
-    .globl  __cs3_reset_cortex_m
-    .type   __cs3_reset_cortex_m, %function
-__cs3_reset_cortex_m:
-    .fnstart
-    LDR     R0, =SystemInit
-    BLX     R0
-    LDR     R0,=__cs3_start_c
-    BX      R0
-    .pool
-    .cantunwind
-    .fnend
-    .size   __cs3_reset_cortex_m,.-__cs3_reset_cortex_m
-
-    .section ".text"
-
-    .weak   NMI_Handler
-    .type   NMI_Handler, %function
-NMI_Handler:
-    B       .
-    .size   NMI_Handler, . - NMI_Handler
-
-    .weak   HardFault_Handler
-    .type   HardFault_Handler, %function
-HardFault_Handler:
-    B       .
-    .size   HardFault_Handler, . - HardFault_Handler
-
-    .weak   SVC_Handler
-    .type   SVC_Handler, %function
-SVC_Handler:
-    B       .
-    .size   SVC_Handler, . - SVC_Handler
-
-    .weak   PendSV_Handler
-    .type   PendSV_Handler, %function
-PendSV_Handler:
-    B       .
-    .size   PendSV_Handler, . - PendSV_Handler
-
-    .weak   SysTick_Handler
-    .type   SysTick_Handler, %function
-SysTick_Handler:
-    B       .
-    .size   SysTick_Handler, . - SysTick_Handler
-
-    .globl  Default_Handler
-    .type   Default_Handler, %function
-Default_Handler:
-    B       .
-    .size   Default_Handler, . - Default_Handler
-
-    .macro  IRQ handler
-    .weak   \handler
-    .set    \handler, Default_Handler
-    .endm
-
-    IRQ     DEF_IRQHandler
-
-    .end
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_GCC_CS/sys.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-#include "cmsis.h"
-#include <sys/types.h>
-#include <errno.h>
-
-extern "C" {
-
-struct SCS3Regions {
-    unsigned long   Dummy;
-    unsigned long*  InitRam;
-    unsigned long*  StartRam;
-    unsigned long   InitSizeRam;
-    unsigned long   ZeroSizeRam;
-};
-
-extern unsigned long __cs3_regions;
-extern unsigned long __cs3_heap_start;
-
-int  main(void);
-void __libc_init_array(void);
-void exit(int ErrorCode);
-
-static void *heap_pointer = NULL;
-
-void __cs3_start_c(void) {
-    static SCS3Regions* pCS3Regions = (SCS3Regions*)&__cs3_regions;
-    unsigned long* pulDest;
-    unsigned long* pulSrc;
-    unsigned long  ByteCount;
-    unsigned long  i;
-    
-    pulSrc = pCS3Regions->InitRam;
-    pulDest = pCS3Regions->StartRam;
-    ByteCount = pCS3Regions->InitSizeRam;
-    if (pulSrc != pulDest) {
-        for(i = 0 ; i < ByteCount ; i += sizeof(unsigned long)) {
-            *(pulDest++) = *(pulSrc++);
-        }
-    } else {
-        pulDest = (unsigned long*)(void*)((char*)pulDest + ByteCount);
-    }
-    
-    ByteCount = pCS3Regions->ZeroSizeRam;
-    for(i = 0 ; i < ByteCount ; i += sizeof(unsigned long)) {
-        *(pulDest++) = 0;
-    }
-    
-    heap_pointer = &__cs3_heap_start;
-     __libc_init_array();
-    exit(main());
-}
-
-int _kill(int pid, int sig) {
-    errno = EINVAL;
-    return -1;
-}
-
-void _exit(int status) {
-    exit(status);
-}
-
-int _getpid(void) {
-    return 1;
-}
-
-void *_sbrk(unsigned int incr) {
-    void *mem;
-    
-    unsigned int next = ((((unsigned int)heap_pointer + incr) + 7) & ~7);
-    if (next > __get_MSP()) {
-        mem = NULL;
-    } else {
-        mem = (void *)heap_pointer;
-    }
-    heap_pointer = (void *)next;
-    
-    return mem;
-}
-
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/bitfields.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1768 +0,0 @@
-#ifndef MBED_BITFIELDS_H
-#define MBED_BITFIELDS_H
-
-//! Massage  x for use in bitfield  name.
-#define BFN_PREP(x, name)    ( ((x)<<name##_SHIFT) & name##_MASK )
-
-//! Get the value of bitfield  name from  y. Equivalent to (var=) y.name
-#define BFN_GET(y, name)     ( ((y) & name##_MASK)>>name##_SHIFT )
-
-//! Set bitfield  name from  y to  x: y.name= x.
-#define BFN_SET(y, x, name)  (y = ((y)&~name##_MASK) | BFN_PREP(x,name) )
-
-
-/* SYSMEMREMAP, address 0x4004 8000 */
-#define SYSMEMREMAP_MAP_MASK           0x0003             // System memory remap
-#define SYSMEMREMAP_MAP_SHIFT          0                 
-
-/* PRESETCTRL, address 0x4004 8004 */
-#define PRESETCTRL_SSP0_RST_N          (1 << 0)           // SPI0 reset control
-#define PRESETCTRL_I2C_RST_N           (1 << 1)           // I2C reset control
-#define PRESETCTRL_SSP1_RST_N          (1 << 2)           // SPI1 reset control
-#define PRESETCTRL_CAN_RST_N           (1 << 3)           // C_CAN reset control. See Section 3.1 for part specific details.
-
-/* SYSPLLCTRL, address 0x4004 8008 */
-#define SYSPLLCTRL_MSEL_MASK           0x001F             // Feedback divider value. The division value M is the programmed MSEL value + 1. 00000: Division ratio M = 1 to 11111: Division ratio M = 32.
-#define SYSPLLCTRL_MSEL_SHIFT          0                 
-#define SYSPLLCTRL_PSEL_MASK           0x0060             // Post divider ratio P. The division ratio is 2  P.
-#define SYSPLLCTRL_PSEL_SHIFT          5                 
-
-/* SYSPLLSTAT, address 0x4004 800C */
-#define SYSPLLSTAT_LOCK                (1 << 0)           // PLL lock status
-
-/* SYSOSCCTRL, address 0x4004 8020 */
-#define SYSOSCCTRL_BYPASS              (1 << 0)           // Bypass system oscillator
-#define SYSOSCCTRL_FREQRANGE           (1 << 1)           // Determines frequency range for Low-power oscillator.
-
-/* WDTOSCCTRL, address 0x4004 8024 */
-#define WDTOSCCTRL_DIVSEL_MASK         0x001F             // Select divider for Fclkana. wdt_osc_clk = Fclkana/ (2  (1 + DIVSEL)) 00000: 2  (1 + DIVSEL) = 2 00001: 2  (1 + DIVSEL) = 4 to 11111: 2  (1 + DIVSEL) = 64
-#define WDTOSCCTRL_DIVSEL_SHIFT        0                 
-#define WDTOSCCTRL_FREQSEL_MASK        0x01E0             // Select watchdog oscillator analog output frequency (Fclkana).
-#define WDTOSCCTRL_FREQSEL_SHIFT       5                 
-
-/* IRCCTRL, address 0x4004 8028 */
-#define IRCCTRL_TRIM_MASK              0x00FF             // Trim value 
-#define IRCCTRL_TRIM_SHIFT             0                 
-
-/* SYSRSTSTAT, address 0x4004 8030 */
-#define SYSRSTSTAT_POR                 (1 << 0)           // POR reset status
-#define SYSRSTSTAT_EXTRST              (1 << 1)           // Status of the external RESET pin.
-#define SYSRSTSTAT_WDT                 (1 << 2)           // Status of the Watchdog reset
-#define SYSRSTSTAT_BOD                 (1 << 3)           // Status of the Brown-out detect reset
-#define SYSRSTSTAT_SYSRST              (1 << 4)           // Status of the software system reset
-
-/* SYSPLLCLKSEL, address 0x4004 8040 */
-#define SYSPLLCLKSEL_SEL_MASK          0x0003             // System PLL clock source
-#define SYSPLLCLKSEL_SEL_SHIFT         0                 
-
-/* SYSPLLCLKUEN, address 0x4004 8044 */
-#define SYSPLLCLKUEN_ENA               (1 << 0)           // Enable system PLL clock source update
-
-/* MAINCLKSEL, address 0x4004 8070 */
-#define MAINCLKSEL_SEL_MASK            0x0003             // Clock source for main clock
-#define MAINCLKSEL_SEL_SHIFT           0                 
-
-/* MAINCLKUEN, address 0x4004 8074 */
-#define MAINCLKUEN_ENA                 (1 << 0)           // Enable main clock source update                                   0
-
-/* SYSAHBCLKDIV, address 0x4004 8078 */
-#define SYSAHBCLKDIV_DIV_MASK          0x00FF             // System AHB clock divider values 0: System clock disabled. 1: Divide by 1. to 255: Divide by 255.
-#define SYSAHBCLKDIV_DIV_SHIFT         0                 
-
-/* SYSAHBCLKCTRL, address 0x4004 8080 */
-#define SYSAHBCLKCTRL_SYS              (1 << 0)           // Enables clock for AHB to APB bridge, to the AHB matrix, to the Cortex-M0 FCLK and HCLK, to the SysCon, and to the PMU. This bit is read only.
-#define SYSAHBCLKCTRL_ROM              (1 << 1)           // Enables clock for ROM.
-#define SYSAHBCLKCTRL_RAM              (1 << 2)           // Enables clock for RAM.
-#define SYSAHBCLKCTRL_FLASHREG         (1 << 3)           // Enables clock for flash register interface.
-#define SYSAHBCLKCTRL_FLASHARRAY       (1 << 4)           // Enables clock for flash array access.
-#define SYSAHBCLKCTRL_I2C              (1 << 5)           // Enables clock for I2C.
-#define SYSAHBCLKCTRL_GPIO             (1 << 6)           // Enables clock for GPIO.
-#define SYSAHBCLKCTRL_CT16B0           (1 << 7)           // Enables clock for 16-bit counter/timer 0.
-#define SYSAHBCLKCTRL_CT16B1           (1 << 8)           // Enables clock for 16-bit counter/timer 1.
-#define SYSAHBCLKCTRL_CT32B0           (1 << 9)           // Enables clock for 32-bit counter/timer 0.
-#define SYSAHBCLKCTRL_CT32B1           (1 << 10)          // Enables clock for 32-bit counter/timer 1.
-#define SYSAHBCLKCTRL_SSP0             (1 << 11)          // Enables clock for SPI0.
-#define SYSAHBCLKCTRL_UART             (1 << 12)          // Enables clock for UART. See Section 3.1 for part specific details.
-#define SYSAHBCLKCTRL_ADC              (1 << 13)          // Enables clock for ADC.
-#define SYSAHBCLKCTRL_WDT              (1 << 15)          // Enables clock for WDT.
-#define SYSAHBCLKCTRL_IOCON            (1 << 16)          // Enables clock for I/O configuration block.
-#define SYSAHBCLKCTRL_CAN              (1 << 17)          // Enables clock for C_CAN. See Section 3.1 for part specific details.
-#define SYSAHBCLKCTRL_SSP1             (1 << 18)          // Enables clock for SPI1.
-
-/* SSP0CLKDIV, address 0x4004 8094 */
-#define SSP0CLKDIV_DIV_MASK            0x00FF             // SPI0_PCLK clock divider values 0: Disable SPI0_PCLK. 1: Divide by 1. to 255: Divide by 255.
-#define SSP0CLKDIV_DIV_SHIFT           0                 
-
-/* UARTCLKDIV, address 0x4004 8098 */
-#define UARTCLKDIV_DIV_MASK            0x00FF             // UART_PCLK clock divider values 0: Disable UART_PCLK. 1: Divide by 1. to 255: Divide by 255.
-#define UARTCLKDIV_DIV_SHIFT           0                 
-
-/* SSP1CLKDIV, address 0x4004 809C */
-#define SSP1CLKDIV_DIV_MASK            0x00FF             // SPI1_PCLK clock divider values 0: Disable SPI1_PCLK. 1: Divide by 1. to 255: Divide by 255.
-#define SSP1CLKDIV_DIV_SHIFT           0                 
-
-/* WDTCLKSEL, address 0x4004 80D0 */
-#define WDTCLKSEL_SEL_MASK             0x0003             // WDT clock source
-#define WDTCLKSEL_SEL_SHIFT            0                 
-
-/* WDTCLKUEN, address 0x4004 80D4 */
-#define WDTCLKUEN_ENA                  (1 << 0)           // Enable WDT clock source update
-
-/* WDTCLKDIV, address 0x4004 80D8 */
-#define WDTCLKDIV_DIV_MASK             0x00FF             // WDT clock divider values 0: Disable WDCLK. 1: Divide by 1. to 255: Divide by 255.
-#define WDTCLKDIV_DIV_SHIFT            0                 
-
-/* CLKOUTCLKSEL, address 0x4004 80E0 */
-#define CLKOUTCLKSEL_SEL_MASK          0x0003             // CLKOUT clock source
-#define CLKOUTCLKSEL_SEL_SHIFT         0                 
-
-/* CLKOUTUEN, address 0x4004 80E4 */
-#define CLKOUTUEN_ENA                  (1 << 0)           // Enable CLKOUT clock source update                              0
-
-/* CLKOUTCLKDIV, address 0x4004 80E8 */
-#define CLKOUTCLKDIV_DIV_MASK          0x00FF             // Clock output divider values 0: Disable CLKOUT. 1: Divide by 1. to 255: Divide by 255.
-#define CLKOUTCLKDIV_DIV_SHIFT         0                 
-
-/* PIOPORCAP0, address 0x4004 8100 */
-#define PIOPORCAP0_CAPPIO0_N_MASK      0x0FFF             // Raw reset status input PIO0_n: PIO0_11 to PIO0_0
-#define PIOPORCAP0_CAPPIO0_N_SHIFT     0                 
-#define PIOPORCAP0_CAPPIO1_N_MASK      0xFFF000           // Raw reset status input PIO1_n: PIO1_11 to PIO1_0
-#define PIOPORCAP0_CAPPIO1_N_SHIFT     12                
-#define PIOPORCAP0_CAPPIO2_N_MASK      0xFF000000         // Raw reset status input PIO2_n: PIO2_7 to PIO2_0
-#define PIOPORCAP0_CAPPIO2_N_SHIFT     24                
-
-/* PIOPORCAP1, address 0x4004 8104 */
-#define PIOPORCAP1_CAPPIO2_8           (1 << 0)           // Raw reset status input PIO2_8
-#define PIOPORCAP1_CAPPIO2_9           (1 << 1)           // Raw reset status input PIO2_9
-#define PIOPORCAP1_CAPPIO2_10          (1 << 2)           // Raw reset status input PIO2_10
-#define PIOPORCAP1_CAPPIO2_11          (1 << 3)           // Raw reset status input PIO2_11
-#define PIOPORCAP1_CAPPIO3_0           (1 << 4)           // Raw reset status input PIO3_0
-#define PIOPORCAP1_CAPPIO3_1           (1 << 5)           // Raw reset status input PIO3_1
-#define PIOPORCAP1_CAPPIO3_2           (1 << 6)           // Raw reset status input PIO3_2
-#define PIOPORCAP1_CAPPIO3_3           (1 << 7)           // Raw reset status input PIO3_3
-#define PIOPORCAP1_CAPPIO3_4           (1 << 8)           // Raw reset status input PIO3_4
-#define PIOPORCAP1_CAPPIO3_5           (1 << 9)           // Raw reset status input PIO3_5
-
-/* BODCTRL, address 0x4004 8150 */
-#define BODCTRL_BODRSTLEV_MASK         0x0003             // BOD reset level
-#define BODCTRL_BODRSTLEV_SHIFT        0                 
-#define BODCTRL_BODINTVAL_MASK         0x000C             // BOD interrupt level
-#define BODCTRL_BODINTVAL_SHIFT        2                 
-#define BODCTRL_BODRSTENA              (1 << 4)           // BOD reset enable
-
-/* SYSTCKCAL, address 0x4004 8154 */
-#define SYSTCKCAL_CAL_MASK             0x3FFFFFF          // System tick timer calibration value
-#define SYSTCKCAL_CAL_SHIFT            0                 
-
-/* NMISRC, address 0x4004 8174 */
-#define NMISRC_IRQNO_MASK              0x001F             // The IRQ number of the interrupt that acts as the Non-Maskable Interrupt 0 (NMI) if bit 31 in this register is 1. See Table 54 for the list of interrupt sources and their IRQ numbers.
-#define NMISRC_IRQNO_SHIFT             0                 
-#define NMISRC_NMIEN                   (1 << 31)          // Write a 1 to this bit to enable the Non-Maskable Interrupt (NMI) source selected by bits 4:0.
-
-/* STARTAPRP0, address 0x4004 8200 */
-#define STARTAPRP0_APRPIO0_N_MASK      0x0FFF             // Edge select for start logic input PIO0_n: PIO0_11 to PIO0_0 0 = Falling edge 1 = Rising edge
-#define STARTAPRP0_APRPIO0_N_SHIFT     0                 
-#define STARTAPRP0_APRPIO1_0           (1 << 12)          // Edge select for start logic input PIO1_0 0 = Falling edge 1 = Rising edge Reserved. Do not write a 1 to reserved bits in this register.
-
-/* STARTERP0, address 0x4004 8204 */
-#define STARTERP0_ERPIO0_N_MASK        0x0FFF             // Enable start signal for start logic input PIO0_n: PIO0_11 to PIO0_0 0 = Disabled 1 = Enabled
-#define STARTERP0_ERPIO0_N_SHIFT       0                 
-#define STARTERP0_ERPIO1_0             (1 << 12)          // Enable start signal for start logic input PIO1_0 0 = Disabled 1 = Enabled Reserved. Do not write a 1 to reserved bits in this register.
-
-/* STARTRSRP0CLR, address 0x4004 8208 */
-#define STARTRSRP0CLR_RSRPIO0_N_MASK   0x0FFF             // Start signal reset for start logic input PIO0_n:PIO0_11 to PIO0_0 0 = Do nothing. 1 = Writing 1 resets the start signal.
-#define STARTRSRP0CLR_RSRPIO0_N_SHIFT  0                 
-#define STARTRSRP0CLR_RSRPIO1_0        (1 << 12)          // Start signal reset for start logic input PIO1_0 0 = Do nothing. 1 = Writing 1 resets the start signal.
-
-/* STARTSRP0, address 0x4004 820C */
-#define STARTSRP0_SRPIO0_N_MASK        0x0FFF             // Start signal status for start logic input PIO0_n: PIO0_11 to PIO0_0 0 = No start signal received. 1 = Start signal pending.
-#define STARTSRP0_SRPIO0_N_SHIFT       0                 
-#define STARTSRP0_SRPIO1_0             (1 << 12)          // Start signal status for start logic input PIO1_0 0 = No start signal received. 1 = Start signal pending.
-
-/* PDSLEEPCFG, address 0x4004 8230 */
-#define PDSLEEPCFG_BOD_PD              (1 << 3)           // BOD power-down control in Deep-sleep mode, see Table 40.
-#define PDSLEEPCFG_WDTOSC_PD           (1 << 6)           // Watchdog oscillator power control in Deep-sleep mode, see Table 40.
-
-/* PDAWAKECFG, address 0x4004 8234 */
-#define PDAWAKECFG_IRCOUT_PD           (1 << 0)           // IRC oscillator output wake-up configuration
-#define PDAWAKECFG_IRC_PD              (1 << 1)           // IRC oscillator power-down wake-up configuration
-#define PDAWAKECFG_FLASH_PD            (1 << 2)           // Flash wake-up configuration
-#define PDAWAKECFG_BOD_PD              (1 << 3)           // BOD wake-up configuration
-#define PDAWAKECFG_ADC_PD              (1 << 4)           // ADC wake-up configuration
-#define PDAWAKECFG_SYSOSC_PD           (1 << 5)           // System oscillator wake-up configuration
-#define PDAWAKECFG_WDTOSC_PD           (1 << 6)           // Watchdog oscillator wake-up configuration
-#define PDAWAKECFG_SYSPLL_PD           (1 << 7)           // System PLL wake-up configuration
-
-/* PDRUNCFG, address 0x4004 8238 */
-#define PDRUNCFG_IRCOUT_PD             (1 << 0)           // IRC oscillator output power-down
-#define PDRUNCFG_IRC_PD                (1 << 1)           // IRC oscillator power-down
-#define PDRUNCFG_FLASH_PD              (1 << 2)           // Flash power-down
-#define PDRUNCFG_BOD_PD                (1 << 3)           // BOD power-down
-#define PDRUNCFG_ADC_PD                (1 << 4)           // ADC power-down
-#define PDRUNCFG_SYSOSC_PD             (1 << 5)           // System oscillator power-down
-#define PDRUNCFG_WDTOSC_PD             (1 << 6)           // Watchdog oscillator power-down
-#define PDRUNCFG_SYSPLL_PD             (1 << 7)           // System PLL power-down
-
-/* DEVICE_ID, address 0x4004 83F4 */
-#define DEVICE_ID_DEVICEID_MASK        0xFFFFFFFF         // Part ID numbers for LPC111x/LPC11Cxx parts
-#define DEVICE_ID_DEVICEID_SHIFT       0                 
-
-/* FLASHCFG, address 0x4003 C010 */
-#define FLASHCFG_FLASHTIM_MASK         0x0003             // Flash memory access time. FLASHTIM +1 is equal to the number of system clocks used for flash access.
-#define FLASHCFG_FLASHTIM_SHIFT        0                 
-
-/* PCON, address 0x4003 8000 */
-#define PCON_DPDEN                     (1 << 1)           // Deep power-down mode enable
-#define PCON_SLEEPFLAG                 (1 << 8)           // Sleep mode flag
-#define PCON_DPDFLAG                   (1 << 11)          // Deep power-down flag
-
-/* GPREG0 - GPREG3, address 0x4003 8004 to 0x4003 8010 */
-#define GPREGn_GPDATA_MASK             0xFFFFFFFF         // Data retained during Deep power-down mode.
-#define GPREGn_GPDATA_SHIFT            0                 
-
-/* GPREG4, address 0x4003 8014 */
-#define GPREG4_WAKEUPHYS               (1 << 10)          // WAKEUP pin hysteresis enable
-#define GPREG4_GPDATA_MASK             0xFFFFF800         // Data retained during Deep power-down mode.
-#define GPREG4_GPDATA_SHIFT            11                
-
-/* IOCON_PIO2_6, address 0x4004 4000 */
-#define IOCON_PIO2_6_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_6_FUNC_SHIFT        0                 
-#define IOCON_PIO2_6_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_6_MODE_SHIFT        3                 
-#define IOCON_PIO2_6_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_6_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO2_0, address 0x4004 4008 */
-#define IOCON_PIO2_0_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_0_FUNC_SHIFT        0                 
-#define IOCON_PIO2_0_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_0_MODE_SHIFT        3                 
-#define IOCON_PIO2_0_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_0_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_RESET_PIO0_0, address 0x4004 400C */
-#define IOCON_RESET_PIO0_0_FUNC_MASK   0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_RESET_PIO0_0_FUNC_SHIFT  0                 
-#define IOCON_RESET_PIO0_0_MODE_MASK   0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_RESET_PIO0_0_MODE_SHIFT  3                 
-#define IOCON_RESET_PIO0_0_HYS         (1 << 5)           // Hysteresis.
-#define IOCON_RESET_PIO0_0_OD          (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO0_1, address 0x4004 4010 */
-#define IOCON_PIO0_1_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO0_1_FUNC_SHIFT        0                 
-#define IOCON_PIO0_1_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO0_1_MODE_SHIFT        3                 
-#define IOCON_PIO0_1_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO0_1_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO1_8, address 0x4004 4014 */
-#define IOCON_PIO1_8_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO1_8_FUNC_SHIFT        0                 
-#define IOCON_PIO1_8_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO1_8_MODE_SHIFT        3                 
-#define IOCON_PIO1_8_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO1_8_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO0_2, address 0x4004 401C */
-#define IOCON_PIO0_2_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO0_2_FUNC_SHIFT        0                 
-#define IOCON_PIO0_2_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO0_2_MODE_SHIFT        3                 
-#define IOCON_PIO0_2_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO0_2_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO2_7, address 0x4004 4020 */
-#define IOCON_PIO2_7_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_7_FUNC_SHIFT        0                 
-#define IOCON_PIO2_7_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_7_MODE_SHIFT        3                 
-#define IOCON_PIO2_7_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_7_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO2_8, address 0x4004 4024 */
-#define IOCON_PIO2_8_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_8_FUNC_SHIFT        0                 
-#define IOCON_PIO2_8_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_8_MODE_SHIFT        3                 
-#define IOCON_PIO2_8_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_8_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO2_1, address 0x4004 4028 */
-#define IOCON_PIO2_1_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_1_FUNC_SHIFT        0                 
-#define IOCON_PIO2_1_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_1_MODE_SHIFT        3                 
-#define IOCON_PIO2_1_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_1_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO0_3, address 0x4004 402C */
-#define IOCON_PIO0_3_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO0_3_FUNC_SHIFT        0                 
-#define IOCON_PIO0_3_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO0_3_MODE_SHIFT        3                 
-#define IOCON_PIO0_3_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO0_3_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO0_4, address 0x4004 4030 */
-#define IOCON_PIO0_4_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO0_4_FUNC_SHIFT        0                 
-#define IOCON_PIO0_4_I2CMODE_MASK      0x0300             // Selects I2C mode. Select Standard mode (I2CMODE = 00, 00 default) or Standard I/O functionality (I2CMODE = 01) if the pin function is GPIO (FUNC = 000).
-#define IOCON_PIO0_4_I2CMODE_SHIFT     8                 
-
-/* IOCON_PIO0_5, address 0x4004 4034 */
-#define IOCON_PIO0_5_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO0_5_FUNC_SHIFT        0                 
-#define IOCON_PIO0_5_I2CMODE_MASK      0x0300             // Selects I2C mode. Select Standard mode (I2CMODE = 00, default) or Standard I/O functionality (I2CMODE = 01) if the pin function is GPIO (FUNC = 000).
-#define IOCON_PIO0_5_I2CMODE_SHIFT     8                 
-
-/* IOCON_PIO1_9, address 0x4004 4038 */
-#define IOCON_PIO1_9_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO1_9_FUNC_SHIFT        0                 
-#define IOCON_PIO1_9_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO1_9_MODE_SHIFT        3                 
-#define IOCON_PIO1_9_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO1_9_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO3_4, address 0x4004 403C */
-#define IOCON_PIO3_4_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO3_4_FUNC_SHIFT        0                 
-#define IOCON_PIO3_4_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO3_4_MODE_SHIFT        3                 
-#define IOCON_PIO3_4_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO3_4_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO2_4, address 0x4004 4040 */
-#define IOCON_PIO2_4_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_4_FUNC_SHIFT        0                 
-#define IOCON_PIO2_4_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_4_MODE_SHIFT        3                 
-#define IOCON_PIO2_4_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_4_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO2_5, address 0x4004 4044 */
-#define IOCON_PIO2_5_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_5_FUNC_SHIFT        0                 
-#define IOCON_PIO2_5_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_5_MODE_SHIFT        3                 
-#define IOCON_PIO2_5_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_5_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO3_5, address 0x4004 4048 */
-#define IOCON_PIO3_5_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO3_5_FUNC_SHIFT        0                 
-#define IOCON_PIO3_5_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO3_5_MODE_SHIFT        3                 
-#define IOCON_PIO3_5_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO3_5_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO0_6, address 0x4004 404C */
-#define IOCON_PIO0_6_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO0_6_FUNC_SHIFT        0                 
-#define IOCON_PIO0_6_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO0_6_MODE_SHIFT        3                 
-#define IOCON_PIO0_6_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO0_6_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO0_7, address 0x4004 4050 */
-#define IOCON_PIO0_7_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO0_7_FUNC_SHIFT        0                 
-#define IOCON_PIO0_7_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO0_7_MODE_SHIFT        3                 
-#define IOCON_PIO0_7_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO0_7_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO2_9, address 0x4004 4054 */
-#define IOCON_PIO2_9_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_9_FUNC_SHIFT        0                 
-#define IOCON_PIO2_9_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_9_MODE_SHIFT        3                 
-#define IOCON_PIO2_9_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_9_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO2_10, address 0x4004 4058 */
-#define IOCON_PIO2_10_FUNC_MASK        0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_10_FUNC_SHIFT       0                 
-#define IOCON_PIO2_10_MODE_MASK        0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_10_MODE_SHIFT       3                 
-#define IOCON_PIO2_10_HYS              (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_10_OD               (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO2_2, address 0x4004 405C */
-#define IOCON_PIO2_2_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_2_FUNC_SHIFT        0                 
-#define IOCON_PIO2_2_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_2_MODE_SHIFT        3                 
-#define IOCON_PIO2_2_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_2_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO0_8, address 0x4004 4060 */
-#define IOCON_PIO0_8_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO0_8_FUNC_SHIFT        0                 
-#define IOCON_PIO0_8_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO0_8_MODE_SHIFT        3                 
-#define IOCON_PIO0_8_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO0_8_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO0_9, address 0x4004 4064 */
-#define IOCON_PIO0_9_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO0_9_FUNC_SHIFT        0                 
-#define IOCON_PIO0_9_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO0_9_MODE_SHIFT        3                 
-#define IOCON_PIO0_9_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO0_9_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_SWCLK_PIO0_10, address 0x4004 4068 */
-#define IOCON_SWCLK_PIO0_10_FUNC_MASK  0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_SWCLK_PIO0_10_FUNC_SHIFT 0                 
-#define IOCON_SWCLK_PIO0_10_MODE_MASK  0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_SWCLK_PIO0_10_MODE_SHIFT 3                 
-#define IOCON_SWCLK_PIO0_10_HYS        (1 << 5)           // Hysteresis.
-#define IOCON_SWCLK_PIO0_10_OD         (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO1_10, address 0x4004 406C */
-#define IOCON_PIO1_10_FUNC_MASK        0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO1_10_FUNC_SHIFT       0                 
-#define IOCON_PIO1_10_MODE_MASK        0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO1_10_MODE_SHIFT       3                 
-#define IOCON_PIO1_10_HYS              (1 << 5)           // Hysteresis.
-#define IOCON_PIO1_10_ADMODE           (1 << 7)           // Selects Analog/Digital mode
-#define IOCON_PIO1_10_OD               (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO2_11, address 0x4004 4070 */
-#define IOCON_PIO2_11_FUNC_MASK        0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_11_FUNC_SHIFT       0                 
-#define IOCON_PIO2_11_MODE_MASK        0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_11_MODE_SHIFT       3                 
-#define IOCON_PIO2_11_HYS              (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_11_OD               (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_R_PIO0_11, address 0x4004 4074 */
-#define IOCON_R_PIO0_11_FUNC_MASK      0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_R_PIO0_11_FUNC_SHIFT     0                 
-#define IOCON_R_PIO0_11_MODE_MASK      0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_R_PIO0_11_MODE_SHIFT     3                 
-#define IOCON_R_PIO0_11_HYS            (1 << 5)           // Hysteresis.
-#define IOCON_R_PIO0_11_ADMODE         (1 << 7)           // Selects Analog/Digital mode
-#define IOCON_R_PIO0_11_OD             (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_R_PIO1_0, address 0x4004 4078 */
-#define IOCON_R_PIO1_0_FUNC_MASK       0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_R_PIO1_0_FUNC_SHIFT      0                 
-#define IOCON_R_PIO1_0_MODE_MASK       0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_R_PIO1_0_MODE_SHIFT      3                 
-#define IOCON_R_PIO1_0_HYS             (1 << 5)           // Hysteresis.
-#define IOCON_R_PIO1_0_ADMODE          (1 << 7)           // Selects Analog/Digital mode
-#define IOCON_R_PIO1_0_OD              (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_R_PIO1_1, address 0x4004 407C */
-#define IOCON_R_PIO1_1_FUNC_MASK       0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_R_PIO1_1_FUNC_SHIFT      0                 
-#define IOCON_R_PIO1_1_MODE_MASK       0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_R_PIO1_1_MODE_SHIFT      3                 
-#define IOCON_R_PIO1_1_HYS             (1 << 5)           // Hysteresis.
-#define IOCON_R_PIO1_1_ADMODE          (1 << 7)           // Selects Analog/Digital mode
-#define IOCON_R_PIO1_1_OD              (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_R_PIO1_2, address 0x4004 4080 */
-#define IOCON_R_PIO1_2_FUNC_MASK       0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_R_PIO1_2_FUNC_SHIFT      0                 
-#define IOCON_R_PIO1_2_MODE_MASK       0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_R_PIO1_2_MODE_SHIFT      3                 
-#define IOCON_R_PIO1_2_HYS             (1 << 5)           // Hysteresis.
-#define IOCON_R_PIO1_2_ADMODE          (1 << 7)           // Selects Analog/Digital mode
-#define IOCON_R_PIO1_2_OD              (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO3_0, address 0x4004 4084 */
-#define IOCON_PIO3_0_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO3_0_FUNC_SHIFT        0                 
-#define IOCON_PIO3_0_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO3_0_MODE_SHIFT        3                 
-#define IOCON_PIO3_0_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO3_0_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO3_1, address 0x4004 4088 */
-#define IOCON_PIO3_1_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO3_1_FUNC_SHIFT        0                 
-#define IOCON_PIO3_1_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO3_1_MODE_SHIFT        3                 
-#define IOCON_PIO3_1_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO3_1_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO2_3, address 0x4004 408C */
-#define IOCON_PIO2_3_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_3_FUNC_SHIFT        0                 
-#define IOCON_PIO2_3_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_3_MODE_SHIFT        3                 
-#define IOCON_PIO2_3_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_3_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_SWDIO_PIO1_3, address 0x4004 4090 */
-#define IOCON_SWDIO_PIO1_3_FUNC_MASK   0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_SWDIO_PIO1_3_FUNC_SHIFT  0                 
-#define IOCON_SWDIO_PIO1_3_MODE_MASK   0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_SWDIO_PIO1_3_MODE_SHIFT  3                 
-#define IOCON_SWDIO_PIO1_3_HYS         (1 << 5)           // Hysteresis.
-#define IOCON_SWDIO_PIO1_3_ADMODE      (1 << 7)           // Selects Analog/Digital mode
-#define IOCON_SWDIO_PIO1_3_OD          (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO1_4, address 0x4004 4094 */
-#define IOCON_PIO1_4_FUNC_MASK         0x0007             // Selects pin function. This pin functions as WAKEUP pin if the 000 LPC111x/LPC11Cxx is in Deep power-down mode regardless of the value of FUNC. All other values are reserved.
-#define IOCON_PIO1_4_FUNC_SHIFT        0                 
-#define IOCON_PIO1_4_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO1_4_MODE_SHIFT        3                 
-#define IOCON_PIO1_4_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO1_4_ADMODE            (1 << 7)           // Selects Analog/Digital mode
-#define IOCON_PIO1_4_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO1_11, address 0x4004 4098 */
-#define IOCON_PIO1_11_FUNC_MASK        0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO1_11_FUNC_SHIFT       0                 
-#define IOCON_PIO1_11_MODE_MASK        0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO1_11_MODE_SHIFT       3                 
-#define IOCON_PIO1_11_HYS              (1 << 5)           // Hysteresis.
-#define IOCON_PIO1_11_ADMODE           (1 << 7)           // Selects Analog/Digital mode
-#define IOCON_PIO1_11_OD               (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO3_2, address 0x4004 409C */
-#define IOCON_PIO3_2_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO3_2_FUNC_SHIFT        0                 
-#define IOCON_PIO3_2_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO3_2_MODE_SHIFT        3                 
-#define IOCON_PIO3_2_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO3_2_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO1_5, address 0x4004 40A0 */
-#define IOCON_PIO1_5_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO1_5_FUNC_SHIFT        0                 
-#define IOCON_PIO1_5_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO1_5_MODE_SHIFT        3                 
-#define IOCON_PIO1_5_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO1_5_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO1_6, address 0x4004 40A4 */
-#define IOCON_PIO1_6_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO1_6_FUNC_SHIFT        0                 
-#define IOCON_PIO1_6_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO1_6_MODE_SHIFT        3                 
-#define IOCON_PIO1_6_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO1_6_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO1_7, address 0x4004 40A8 */
-#define IOCON_PIO1_7_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO1_7_FUNC_SHIFT        0                 
-#define IOCON_PIO1_7_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO1_7_MODE_SHIFT        3                 
-#define IOCON_PIO1_7_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO1_7_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_PIO3_3, address 0x4004 40AC */
-#define IOCON_PIO3_3_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO3_3_FUNC_SHIFT        0                 
-#define IOCON_PIO3_3_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO3_3_MODE_SHIFT        3                 
-#define IOCON_PIO3_3_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO3_3_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
-
-/* IOCON_SCK_LOC, address 0x4004 40B0 */
-#define IOCON_SCK_LOC_SCKLOC_MASK      0x0003             // Selects pin location for SCK0 function.
-#define IOCON_SCK_LOC_SCKLOC_SHIFT     0                 
-
-/* IOCON_DSR_LOC, address 0x4004 40B4 */
-#define IOCON_DSR_LOC_DSRLOC_MASK      0x0003             // elects pin location for DSR function.
-#define IOCON_DSR_LOC_DSRLOC_SHIFT     0                 
-
-/* IOCON_DCD_LOC, address 0x4004 40B8 */
-#define IOCON_DCD_LOC_DCDLOC_MASK      0x0003             // Selects pin location for DCD function.
-#define IOCON_DCD_LOC_DCDLOC_SHIFT     0                 
-
-/* IOCON_RI_LOC, address 0x4004 40BC */
-#define IOCON_RI_LOC_RILOC_MASK        0x0003             // Selects pin location for RI function.
-#define IOCON_RI_LOC_RILOC_SHIFT       0                 
-
-/* IOCON_PIO2_6, address 0x4004 4000 */
-#define IOCON_PIO2_6_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_6_FUNC_SHIFT        0                 
-#define IOCON_PIO2_6_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_6_MODE_SHIFT        3                 
-#define IOCON_PIO2_6_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_6_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO2_0, address 0x4004 4008 */
-#define IOCON_PIO2_0_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_0_FUNC_SHIFT        0                 
-#define IOCON_PIO2_0_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_0_MODE_SHIFT        3                 
-#define IOCON_PIO2_0_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_0_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_RESET_PIO0_0, address 0x4004 400C */
-#define IOCON_RESET_PIO0_0_FUNC_MASK   0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_RESET_PIO0_0_FUNC_SHIFT  0                 
-#define IOCON_RESET_PIO0_0_MODE_MASK   0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_RESET_PIO0_0_MODE_SHIFT  3                 
-#define IOCON_RESET_PIO0_0_HYS         (1 << 5)           // Hysteresis.
-#define IOCON_RESET_PIO0_0_OD          (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO0_1, address 0x4004 4010 */
-#define IOCON_PIO0_1_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO0_1_FUNC_SHIFT        0                 
-#define IOCON_PIO0_1_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO0_1_MODE_SHIFT        3                 
-#define IOCON_PIO0_1_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO0_1_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO1_8, address 0x4004 4014 */
-#define IOCON_PIO1_8_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO1_8_FUNC_SHIFT        0                 
-#define IOCON_PIO1_8_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO1_8_MODE_SHIFT        3                 
-#define IOCON_PIO1_8_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO1_8_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO0_2, address 0x4004 401C */
-#define IOCON_PIO0_2_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO0_2_FUNC_SHIFT        0                 
-#define IOCON_PIO0_2_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO0_2_MODE_SHIFT        3                 
-#define IOCON_PIO0_2_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO0_2_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO2_7, address 0x4004 4020 */
-#define IOCON_PIO2_7_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_7_FUNC_SHIFT        0                 
-#define IOCON_PIO2_7_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_7_MODE_SHIFT        3                 
-#define IOCON_PIO2_7_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_7_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO2_8, address 0x4004 4024 */
-#define IOCON_PIO2_8_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_8_FUNC_SHIFT        0                 
-#define IOCON_PIO2_8_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_8_MODE_SHIFT        3                 
-#define IOCON_PIO2_8_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_8_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO2_1, address 0x4004 4028 */
-#define IOCON_PIO2_1_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_1_FUNC_SHIFT        0                 
-#define IOCON_PIO2_1_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_1_MODE_SHIFT        3                 
-#define IOCON_PIO2_1_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_1_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO0_3, address 0x4004 402C */
-#define IOCON_PIO0_3_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO0_3_FUNC_SHIFT        0                 
-#define IOCON_PIO0_3_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO0_3_MODE_SHIFT        3                 
-#define IOCON_PIO0_3_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO0_3_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO0_4, address 0x4004 4030 */
-#define IOCON_PIO0_4_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO0_4_FUNC_SHIFT        0                 
-#define IOCON_PIO0_4_I2CMODE_MASK      0x0300             // Selects I2C mode. Select Standard mode (I2CMODE = 00, 00 default) or Standard I/O functionality (I2CMODE = 01) if the pin function is GPIO (FUNC = 000).
-#define IOCON_PIO0_4_I2CMODE_SHIFT     8                 
-
-/* IOCON_PIO0_5, address 0x4004 4034 */
-#define IOCON_PIO0_5_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO0_5_FUNC_SHIFT        0                 
-#define IOCON_PIO0_5_I2CMODE_MASK      0x0300             // Selects I2C mode. Select Standard mode (I2CMODE = 00, default) or Standard I/O functionality (I2CMODE = 01) if the pin function is GPIO (FUNC = 000).
-#define IOCON_PIO0_5_I2CMODE_SHIFT     8                 
-
-/* IOCON_PIO1_9, address 0x4004 4038 */
-#define IOCON_PIO1_9_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO1_9_FUNC_SHIFT        0                 
-#define IOCON_PIO1_9_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO1_9_MODE_SHIFT        3                 
-#define IOCON_PIO1_9_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO1_9_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO3_4, address 0x4004 403C */
-#define IOCON_PIO3_4_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO3_4_FUNC_SHIFT        0                 
-#define IOCON_PIO3_4_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO3_4_MODE_SHIFT        3                 
-#define IOCON_PIO3_4_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO3_4_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO2_4, address 0x4004 4040 */
-#define IOCON_PIO2_4_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_4_FUNC_SHIFT        0                 
-#define IOCON_PIO2_4_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_4_MODE_SHIFT        3                 
-#define IOCON_PIO2_4_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_4_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO2_5, address 0x4004 4044 */
-#define IOCON_PIO2_5_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_5_FUNC_SHIFT        0                 
-#define IOCON_PIO2_5_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_5_MODE_SHIFT        3                 
-#define IOCON_PIO2_5_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_5_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO3_5, address 0x4004 4048 */
-#define IOCON_PIO3_5_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO3_5_FUNC_SHIFT        0                 
-#define IOCON_PIO3_5_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO3_5_MODE_SHIFT        3                 
-#define IOCON_PIO3_5_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO3_5_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO0_6, address 0x4004 404C */
-#define IOCON_PIO0_6_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO0_6_FUNC_SHIFT        0                 
-#define IOCON_PIO0_6_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO0_6_MODE_SHIFT        3                 
-#define IOCON_PIO0_6_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO0_6_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO0_7, address 0x4004 4050 */
-#define IOCON_PIO0_7_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO0_7_FUNC_SHIFT        0                 
-#define IOCON_PIO0_7_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO0_7_MODE_SHIFT        3                 
-#define IOCON_PIO0_7_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO0_7_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO2_9, address 0x4004 4054 */
-#define IOCON_PIO2_9_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_9_FUNC_SHIFT        0                 
-#define IOCON_PIO2_9_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_9_MODE_SHIFT        3                 
-#define IOCON_PIO2_9_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_9_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO2_10, address 0x4004 4058 */
-#define IOCON_PIO2_10_FUNC_MASK        0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_10_FUNC_SHIFT       0                 
-#define IOCON_PIO2_10_MODE_MASK        0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_10_MODE_SHIFT       3                 
-#define IOCON_PIO2_10_HYS              (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_10_OD               (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO2_2, address 0x4004 405C */
-#define IOCON_PIO2_2_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_2_FUNC_SHIFT        0                 
-#define IOCON_PIO2_2_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_2_MODE_SHIFT        3                 
-#define IOCON_PIO2_2_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_2_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO0_8, address 0x4004 4060 */
-#define IOCON_PIO0_8_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO0_8_FUNC_SHIFT        0                 
-#define IOCON_PIO0_8_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO0_8_MODE_SHIFT        3                 
-#define IOCON_PIO0_8_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO0_8_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO0_9, address 0x4004 4064 */
-#define IOCON_PIO0_9_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO0_9_FUNC_SHIFT        0                 
-#define IOCON_PIO0_9_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO0_9_MODE_SHIFT        3                 
-#define IOCON_PIO0_9_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO0_9_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_SWCLK_PIO0_10, address 0x4004 4068 */
-#define IOCON_SWCLK_PIO0_10_FUNC_MASK  0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_SWCLK_PIO0_10_FUNC_SHIFT 0                 
-#define IOCON_SWCLK_PIO0_10_MODE_MASK  0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_SWCLK_PIO0_10_MODE_SHIFT 3                 
-#define IOCON_SWCLK_PIO0_10_HYS        (1 << 5)           // Hysteresis.
-#define IOCON_SWCLK_PIO0_10_OD         (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO1_10, address 0x4004 406C */
-#define IOCON_PIO1_10_FUNC_MASK        0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO1_10_FUNC_SHIFT       0                 
-#define IOCON_PIO1_10_MODE_MASK        0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO1_10_MODE_SHIFT       3                 
-#define IOCON_PIO1_10_HYS              (1 << 5)           // Hysteresis.
-#define IOCON_PIO1_10_ADMODE           (1 << 7)           // Selects Analog/Digital mode
-#define IOCON_PIO1_10_OD               (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO2_11, address 0x4004 4070 */
-#define IOCON_PIO2_11_FUNC_MASK        0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_11_FUNC_SHIFT       0                 
-#define IOCON_PIO2_11_MODE_MASK        0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_11_MODE_SHIFT       3                 
-#define IOCON_PIO2_11_HYS              (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_11_OD               (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_R_PIO0_11, address 0x4004 4074 */
-#define IOCON_R_PIO0_11_FUNC_MASK      0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_R_PIO0_11_FUNC_SHIFT     0                 
-#define IOCON_R_PIO0_11_MODE_MASK      0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_R_PIO0_11_MODE_SHIFT     3                 
-#define IOCON_R_PIO0_11_HYS            (1 << 5)           // Hysteresis.
-#define IOCON_R_PIO0_11_ADMODE         (1 << 7)           // Selects Analog/Digital mode
-#define IOCON_R_PIO0_11_OD             (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_R_PIO1_0, address 0x4004 4078 */
-#define IOCON_R_PIO1_0_FUNC_MASK       0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_R_PIO1_0_FUNC_SHIFT      0                 
-#define IOCON_R_PIO1_0_MODE_MASK       0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_R_PIO1_0_MODE_SHIFT      3                 
-#define IOCON_R_PIO1_0_HYS             (1 << 5)           // Hysteresis.
-#define IOCON_R_PIO1_0_ADMODE          (1 << 7)           // Selects Analog/Digital mode
-#define IOCON_R_PIO1_0_OD              (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_R_PIO1_1, address 0x4004 407C */
-#define IOCON_R_PIO1_1_FUNC_MASK       0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_R_PIO1_1_FUNC_SHIFT      0                 
-#define IOCON_R_PIO1_1_MODE_MASK       0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_R_PIO1_1_MODE_SHIFT      3                 
-#define IOCON_R_PIO1_1_HYS             (1 << 5)           // Hysteresis.
-#define IOCON_R_PIO1_1_ADMODE          (1 << 7)           // Selects Analog/Digital mode
-#define IOCON_R_PIO1_1_OD              (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_R_PIO1_2, address 0x4004 4080 */
-#define IOCON_R_PIO1_2_FUNC_MASK       0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_R_PIO1_2_FUNC_SHIFT      0                 
-#define IOCON_R_PIO1_2_MODE_MASK       0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_R_PIO1_2_MODE_SHIFT      3                 
-#define IOCON_R_PIO1_2_HYS             (1 << 5)           // Hysteresis.
-#define IOCON_R_PIO1_2_ADMODE          (1 << 7)           // Selects Analog/Digital mode
-#define IOCON_R_PIO1_2_OD              (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO3_0, address 0x4004 4084 */
-#define IOCON_PIO3_0_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO3_0_FUNC_SHIFT        0                 
-#define IOCON_PIO3_0_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO3_0_MODE_SHIFT        3                 
-#define IOCON_PIO3_0_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO3_0_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO3_1, address 0x4004 4088 */
-#define IOCON_PIO3_1_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO3_1_FUNC_SHIFT        0                 
-#define IOCON_PIO3_1_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO3_1_MODE_SHIFT        3                 
-#define IOCON_PIO3_1_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO3_1_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO2_3, address 0x4004 408C */
-#define IOCON_PIO2_3_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO2_3_FUNC_SHIFT        0                 
-#define IOCON_PIO2_3_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO2_3_MODE_SHIFT        3                 
-#define IOCON_PIO2_3_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO2_3_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_SWDIO_PIO1_3, address 0x4004 4090 */
-#define IOCON_SWDIO_PIO1_3_FUNC_MASK   0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_SWDIO_PIO1_3_FUNC_SHIFT  0                 
-#define IOCON_SWDIO_PIO1_3_MODE_MASK   0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_SWDIO_PIO1_3_MODE_SHIFT  3                 
-#define IOCON_SWDIO_PIO1_3_HYS         (1 << 5)           // Hysteresis.
-#define IOCON_SWDIO_PIO1_3_ADMODE      (1 << 7)           // Selects Analog/Digital mode
-#define IOCON_SWDIO_PIO1_3_OD          (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO1_4, address 0x4004 4094 */
-#define IOCON_PIO1_4_FUNC_MASK         0x0007             // Selects pin function. This pin functions as WAKEUP pin if the 000 LPC111x/LPC11Cxx is in Deep power-down mode regardless of the value of FUNC. All other values are reserved.
-#define IOCON_PIO1_4_FUNC_SHIFT        0                 
-#define IOCON_PIO1_4_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO1_4_MODE_SHIFT        3                 
-#define IOCON_PIO1_4_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO1_4_ADMODE            (1 << 7)           // Selects Analog/Digital mode
-#define IOCON_PIO1_4_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO1_11, address 0x4004 4098 */
-#define IOCON_PIO1_11_FUNC_MASK        0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO1_11_FUNC_SHIFT       0                 
-#define IOCON_PIO1_11_MODE_MASK        0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO1_11_MODE_SHIFT       3                 
-#define IOCON_PIO1_11_HYS              (1 << 5)           // Hysteresis.
-#define IOCON_PIO1_11_ADMODE           (1 << 7)           // Selects Analog/Digital mode
-#define IOCON_PIO1_11_OD               (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO3_2, address 0x4004 409C */
-#define IOCON_PIO3_2_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO3_2_FUNC_SHIFT        0                 
-#define IOCON_PIO3_2_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO3_2_MODE_SHIFT        3                 
-#define IOCON_PIO3_2_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO3_2_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO1_5, address 0x4004 40A0 */
-#define IOCON_PIO1_5_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO1_5_FUNC_SHIFT        0                 
-#define IOCON_PIO1_5_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO1_5_MODE_SHIFT        3                 
-#define IOCON_PIO1_5_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO1_5_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO1_6, address 0x4004 40A4 */
-#define IOCON_PIO1_6_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO1_6_FUNC_SHIFT        0                 
-#define IOCON_PIO1_6_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO1_6_MODE_SHIFT        3                 
-#define IOCON_PIO1_6_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO1_6_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO1_7, address 0x4004 40A8 */
-#define IOCON_PIO1_7_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO1_7_FUNC_SHIFT        0                 
-#define IOCON_PIO1_7_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO1_7_MODE_SHIFT        3                 
-#define IOCON_PIO1_7_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO1_7_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_PIO3_3, address 0x4004 40AC */
-#define IOCON_PIO3_3_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
-#define IOCON_PIO3_3_FUNC_SHIFT        0                 
-#define IOCON_PIO3_3_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
-#define IOCON_PIO3_3_MODE_SHIFT        3                 
-#define IOCON_PIO3_3_HYS               (1 << 5)           // Hysteresis.
-#define IOCON_PIO3_3_OD                (1 << 10)          // Selects pseudo open-drain mode.
-
-/* IOCON_SCK0_LOC, address 0x4004 40B0 */
-#define IOCON_SCK0_LOC_SCKLOC_MASK     0x0003             // Selects pin location for SCK0 function.
-#define IOCON_SCK0_LOC_SCKLOC_SHIFT    0                 
-
-/* IOCON_DSR_LOC, address 0x4004 40B4 */
-#define IOCON_DSR_LOC_DSRLOC_MASK      0x0003             // elects pin location for DSR function.
-#define IOCON_DSR_LOC_DSRLOC_SHIFT     0                 
-
-/* IOCON_DCD_LOC, address 0x4004 40B8 */
-#define IOCON_DCD_LOC_DCDLOC_MASK      0x0003             // Selects pin location for DCD function.
-#define IOCON_DCD_LOC_DCDLOC_SHIFT     0                 
-
-/* IOCON_RI_LOC, address 0x4004 40BC */
-#define IOCON_RI_LOC_RILOC_MASK        0x0003             // Selects pin location for RI function.
-#define IOCON_RI_LOC_RILOC_SHIFT       0                 
-
-/* IOCON_SSEL1_LOC, address 0x4004 4018 */
-#define IOCON_SSEL1_LOC_SSEL1LOC_MASK  0x0003             // Selects pin location for SSEL1 function.
-#define IOCON_SSEL1_LOC_SSEL1LOC_SHIFT 0                 
-
-/* IOCON_CT16B0_CAP0_LOC, address 0x4004 40C0 */
-#define IOCON_CT16B0_CAP0_LOC_CT16B0_CAP0LOC_MASK 0x0003             // Selects pin location for CT16B0_CAP0 function.
-#define IOCON_CT16B0_CAP0_LOC_CT16B0_CAP0LOC_SHIFT 0                 
-
-/* IOCON_SCK1_LOC, address 0x4004 40C4 */
-#define IOCON_SCK1_LOC_SCK1LOC_MASK    0x0003             // Selects pin location for SCK1 function.
-#define IOCON_SCK1_LOC_SCK1LOC_SHIFT   0                 
-
-/* IOCON_MISO1_LOC, address 0x4004 40C8 */
-#define IOCON_MISO1_LOC_MISO1LOC_MASK  0x0003             // Selects pin location for the MISO1 function.
-#define IOCON_MISO1_LOC_MISO1LOC_SHIFT 0                 
-
-/* IOCON_MOSI1_LOC, address 0x4004 40CC */
-#define IOCON_MOSI1_LOC_MOSI1LOC_MASK  0x0003             // Selects pin location for the MOSI1 function.
-#define IOCON_MOSI1_LOC_MOSI1LOC_SHIFT 0                 
-
-/* IOCON_CT32B0_CAP0_LOC, address 0x4004 40D0 */
-#define IOCON_CT32B0_CAP0_LOC_CT32B0_CAP0LOC_MASK 0x0003             // Selects pin location for the CT32B0_CAP0 function.
-#define IOCON_CT32B0_CAP0_LOC_CT32B0_CAP0LOC_SHIFT 0                 
-
-/* IOCON_RXD_LOC, address 0x4004 40D4 */
-#define IOCON_RXD_LOC_RXDLOC_MASK      0x0003             // Selects pin location for the RXD function.
-#define IOCON_RXD_LOC_RXDLOC_SHIFT     0                 
-
-/* GPIO0DIR, address 0x5000 8000 to GPIO3DIR, address 0x5003 8000 */
-#define GPIO0DIR_IO_MASK               0x0FFF             // Selects pin x as input or output (x = 0 to 11). 0 = Pin PIOn_x is configured as input. 1 = Pin PIOn_x is configured as output.
-#define GPIO0DIR_IO_SHIFT              0                 
-
-/* GPIO0IS, address 0x5000 8004 to GPIO3IS, address 0x5003 8004 */
-#define GPIO0IS_ISENSE_MASK            0x0FFF             // Selects interrupt on pin x as level or edge sensitive (x = 0 to 0x00 11). 0 = Interrupt on pin PIOn_x is configured as edge sensitive. 1 = Interrupt on pin PIOn_x is configured as level sensitive.
-#define GPIO0IS_ISENSE_SHIFT           0                 
-
-/* GPIO0IBE, address 0x5000 8008 to GPIO3IBE, address 0x5003 8008 */
-#define GPIO0IBE_IBE_MASK              0x0FFF             // Selects interrupt on pin x to be triggered on both edges (x = 0 0x00 to 11). 0 = Interrupt on pin PIOn_x is controlled through register GPIOnIEV. 1 = Both edges on pin PIOn_x trigger an interrupt.
-#define GPIO0IBE_IBE_SHIFT             0                 
-
-/* GPIO0IEV, address 0x5000 800C to GPIO3IEV, address 0x5003 800C */
-#define GPIO0IEV_IEV_MASK              0x0FFF             // Selects interrupt on pin x to be triggered rising or falling edges (x = 0 to 11). 0 = Depending on setting in register GPIOnIS (see Table 175), falling edges or LOW level on pin PIOn_x trigger an interrupt. 1 = Depending on setting in register GPIOnIS (see Table 175), rising edges or HIGH level on pin PIOn_x trigger an interrupt.
-#define GPIO0IEV_IEV_SHIFT             0                 
-
-/* GPIO0IE, address 0x5000 8010 to GPIO3IE, address 0x5003 8010 */
-#define GPIO0IE_MASK_MASK              0x0FFF             // Selects interrupt on pin x to be masked (x = 0 to 11). 0 = Interrupt on pin PIOn_x is masked. 1 = Interrupt on pin PIOn_x is not masked.
-#define GPIO0IE_MASK_SHIFT             0                 
-
-/* GPIO0RIS, address 0x5000 8014 to GPIO3RIS, address 0x5003 8014 */
-#define GPIO0RIS_RAWST_MASK            0x0FFF             // Raw interrupt status (x = 0 to 11). 0 = No interrupt on pin PIOn_x. 1 = Interrupt requirements met on PIOn_x.
-#define GPIO0RIS_RAWST_SHIFT           0                 
-
-/* GPIO0MIS, address 0x5000 8018 to GPIO3MIS, address 0x5003 8018 */
-#define GPIO0MIS_MASK_MASK             0x0FFF             // Selects interrupt on pin x to be masked (x = 0 to 11). 0 = No interrupt or interrupt masked on pin PIOn_x. 1 = Interrupt on PIOn_x.
-#define GPIO0MIS_MASK_SHIFT            0                 
-
-/* GPIO0IC, address 0x5000 801C to GPIO3IC, address 0x5003 801C */
-#define GPIO0IC_CLR_MASK               0x0FFF             // Selects interrupt on pin x to be cleared (x = 0 to 11). Clears 0x00 the interrupt edge detection logic. This register is write-only. Remark: The synchronizer between the GPIO and the NVIC blocks causes a delay of 2 clocks. It is recommended to add two NOPs after the clear of the interrupt edge detection logic before the exit of the interrupt service routine. 0 = No effect. 1 = Clears edge detection logic for pin PIOn_x.
-#define GPIO0IC_CLR_SHIFT              0                 
-
-/* U0IIR - address 0x4004 8008, Read Only */
-#define U0IIR_INTSTATUS                (1 << 0)           // Interrupt status. Note that U0IIR[0] is active low. The pending interrupt can be determined by evaluating U0IIR[3:1].
-#define U0IIR_INTID_MASK               0x000E             // Interrupt identification. U0IER[3:1] identifies an interrupt 0 corresponding to the UART Rx FIFO. All other combinations of U0IER[3:1] not listed below are reserved (100,101,111).
-#define U0IIR_INTID_SHIFT              1                 
-#define U0IIR_FIFOENABLE_MASK          0x00C0             // These bits are equivalent to U0FCR[0].
-#define U0IIR_FIFOENABLE_SHIFT         6                 
-#define U0IIR_ABEOINT                  (1 << 8)           // End of auto-baud interrupt. True if auto-baud has finished successfully and interrupt is enabled.
-#define U0IIR_ABTOINT                  (1 << 9)           // Auto-baud time-out interrupt. True if auto-baud has timed out and interrupt is enabled. Reserved, user software should not write ones to reserved bits. The value read from a reserved bit is not defined.
-
-/* U0FCR - address 0x4000 8008, Write Only */
-#define U0FCR_FIFOEN                   (1 << 0)           // FIFO Enable
-#define U0FCR_RXFIFORES                (1 << 1)           // RX FIFO Reset
-#define U0FCR_TXFIFORES                (1 << 2)           // TX FIFO Reset
-#define U0FCR_RXTL_MASK                0x00C0             // RX Trigger Level. These two bits determine how many     0 receiver UART FIFO characters must be written before an interrupt is activated.
-#define U0FCR_RXTL_SHIFT               6                 
-
-/* U0LCR - address 0x4000 800C */
-#define U0LCR_WLS_MASK                 0x0003             // Word Length Select
-#define U0LCR_WLS_SHIFT                0                 
-#define U0LCR_SBS                      (1 << 2)           // Stop Bit Select
-#define U0LCR_PE                       (1 << 3)           // Parity Enable
-#define U0LCR_PS_MASK                  0x0030             // Parity Select 0x0         Odd parity. Number of 1s in the transmitted character and the attached parity bit will be odd. 0x1         Even Parity. Number of 1s in the transmitted character and the attached parity bit will be even. 0x2         Forced 1 stick parity. 0x3         Forced 0 stick parity.
-#define U0LCR_PS_SHIFT                 4                 
-#define U0LCR_BC                       (1 << 6)           // Break Control
-#define U0LCR_DLAB                     (1 << 7)           // Divisor Latch Access Bit
-
-/* U0MCR - address 0x4000 8010 */
-#define U0MCR_DTRC                     (1 << 0)           // DTR Control. Source for modem output pin, DTR. This bit reads as 0 when modem loopback mode is active.
-#define U0MCR_RTSC                     (1 << 1)           // RTS Control. Source for modem output pin RTS. This bit reads as 0 0 when modem loopback mode is active.
-#define U0MCR_LMS                      (1 << 4)           // Loopback Mode Select. The modem loopback mode provides a 0 mechanism to perform diagnostic loopback testing. Serial data from the transmitter is connected internally to serial input of the receiver. Input pin, RXD, has no effect on loopback and output pin, TXD is held in marking state. The four modem inputs (CTS, DSR, RI and DCD) are disconnected externally. Externally, the modem outputs (RTS, DTR) are set inactive. Internally, the four modem outputs are connected to the four modem inputs. As a result of these connections, the upper four bits of the U0MSR will be driven by the lower four bits of the U0MCR rather than the four modem inputs in normal mode. This permits modem status interrupts to be generated in loopback mode by writing the lower four bits of U0MCR.
-#define U0MCR_RTSEN                    (1 << 6)           // RTS flow control
-#define U0MCR_CTSEN                    (1 << 7)           // CTS flow control
-
-/* U0LSR - address 0x4000 8014, Read Only */
-#define U0LSR_RDR                      (1 << 0)           // Receiver Data Ready. U0LSR[0] is set when the U0RBR holds 0 an unread character and is cleared when the UART RBR FIFO is empty.
-#define U0LSR_OE                       (1 << 1)           // Overrun Error. The overrun error condition is set as soon as it 0 occurs. A U0LSR read clears U0LSR[1]. U0LSR[1] is set when UART RSR has a new character assembled and the UART RBR FIFO is full. In this case, the UART RBR FIFO will not be overwritten and the character in the UART RSR will be lost.
-#define U0LSR_PE                       (1 << 2)           // Parity Error. When the parity bit of a received character is in the wrong state, a parity error occurs. A U0LSR read clears U0LSR[2]. Time of parity error detection is dependent on U0FCR[0]. Note: A parity error is associated with the character at the top of the UART RBR FIFO.
-#define U0LSR_FE                       (1 << 3)           // Framing Error. When the stop bit of a received character is a 0 logic 0, a framing error occurs. A U0LSR read clears U0LSR[3]. The time of the framing error detection is dependent on U0FCR0. Upon detection of a framing error, the RX will attempt to re-synchronize to the data and assume that the bad stop bit is actually an early start bit. However, it cannot be assumed that the next received byte will be correct even if there is no Framing Error. Note: A framing error is associated with the character at the top of the UART RBR FIFO.
-#define U0LSR_BI                       (1 << 4)           // Break Interrupt. When RXD1 is held in the spacing state (all zeros) for one full character transmission (start, data, parity, stop), a break interrupt occurs. Once the break condition has been detected, the receiver goes idle until RXD1 goes to marking state (all ones). A U0LSR read clears this status bit. The time of break detection is dependent on U0FCR[0]. Note: The break interrupt is associated with the character at the top of the UART RBR FIFO.
-#define U0LSR_THRE                     (1 << 5)           // Transmitter Holding Register Empty. THRE is set immediately 1 upon detection of an empty UART THR and is cleared on a U0THR write.
-#define U0LSR_TEMT                     (1 << 6)           // Transmitter Empty. TEMT is set when both U0THR and            1 U0TSR are empty; TEMT is cleared when either the U0TSR or the U0THR contain valid data. This bit is updated as soon as 50 % of the first stop bit has been transmitted or a byte has been written into the THR.
-#define U0LSR_RXFE                     (1 << 7)           // Error in RX FIFO. U0LSR[7] is set when a character with a RX 0 error such as framing error, parity error or break interrupt, is loaded into the U0RBR. This bit is cleared when the U0LSR register is read and there are no subsequent errors in the UART FIFO.
-
-/* U0MSR - address 0x4000 8018 */
-#define U0MSR_DCTS                     (1 << 0)           // Delta CTS. Set upon state change of input CTS. Cleared on a U0MSR read. 0         No change detected on modem input CTS. 1         State change detected on modem input CTS.
-#define U0MSR_DDSR                     (1 << 1)           // Delta DSR. Set upon state change of input DSR. Cleared on a U0MSR read. 0         No change detected on modem input DSR. 1         State change detected on modem input DSR.
-#define U0MSR_TERI                     (1 << 2)           // Trailing Edge RI. Set upon low to high transition of input RI. Cleared 0 on a U0MSR read. 0         No change detected on modem input, RI. 1         Low-to-high transition detected on RI.
-#define U0MSR_DDCD                     (1 << 3)           // Delta DCD. Set upon state change of input DCD. Cleared on a U0MSR read. 0         No change detected on modem input DCD. 1         State change detected on modem input DCD.
-#define U0MSR_CTS                      (1 << 4)           // Clear To Send State. Complement of input signal CTS. This bit is connected to U0MCR[1] in modem loopback mode.
-#define U0MSR_DSR                      (1 << 5)           // Data Set Ready State. Complement of input signal DSR. This bit is connected to U0MCR[0] in modem loopback mode.
-#define U0MSR_RI                       (1 << 6)           // Ring Indicator State. Complement of input RI. This bit is connected to U0MCR[2] in modem loopback mode.
-#define U0MSR_DCD                      (1 << 7)           // Data Carrier Detect State. Complement of input DCD. This bit is connected to U0MCR[3] in modem loopback mode.
-
-/* U0SCR - address 0x4000 801C */
-#define U0SCR_PAD_MASK                 0x00FF             // A readable, writable byte.
-#define U0SCR_PAD_SHIFT                0                 
-
-/* U0ACR - address 0x4000 8020 */
-#define U0ACR_START                    (1 << 0)           // Start bit. This bit is automatically cleared after auto-baud completion.
-#define U0ACR_MODE                     (1 << 1)           // Auto-baud mode select
-#define U0ACR_AUTORESTART              (1 << 2)           // Restart enable
-#define U0ACR_ABEOINTCLR               (1 << 8)           // End of auto-baud interrupt clear (write only accessible)
-#define U0ACR_ABTOINTCLR               (1 << 9)           // Auto-baud time-out interrupt clear (write only accessible)
-
-/* U0TER - address 0x4000 8030 */
-#define U0TER_TXEN                     (1 << 7)           // When this bit is 1, as it is after a Reset, data written to the THR 1 is output on the TXD pin as soon as any preceding data has been sent. If this bit cleared to 0 while a character is being sent, the transmission of that character is completed, but no further characters are sent until this bit is set again. In other words, a 0 in this bit blocks the transfer of characters from the THR or TX FIFO into the transmit shift register. Software can clear this bit when it detects that the a hardware-handshaking TX-permit signal (CTS) has gone false, or with software handshaking, when it receives an XOFF character (DC3). Software can set this bit again when it detects that the TX-permit signal has gone true, or when it receives an XON (DC1) character. Reserved
-
-/* U0RS485CTRL - address 0x4000 804C */
-#define U0RS485CTRL_NMMEN              (1 << 0)           // NMM enable.
-#define U0RS485CTRL_RXDIS              (1 << 1)           // Receiver enable.
-#define U0RS485CTRL_AADEN              (1 << 2)           // AAD enable.
-#define U0RS485CTRL_SEL                (1 << 3)           // Select direction control pin
-#define U0RS485CTRL_DCTRL              (1 << 4)           // Auto direction control enable.
-#define U0RS485CTRL_OINV               (1 << 5)           // Polarity control. This bit reverses the polarity of the direction control signal on the RTS (or DTR) pin.
-
-/* U0RS485ADRMATCH - address 0x4000 8050 */
-#define U0RS485ADRMATCH_ADRMATCH_MASK  0x00FF             // Contains the address match value.                                        0
-#define U0RS485ADRMATCH_ADRMATCH_SHIFT 0                 
-
-/* U0RS485DLY - address 0x4000 8054 */
-#define U0RS485DLY_DLY_MASK            0x00FF             // Contains the direction control (RTS or DTR) delay value. This register works in conjunction with an 8-bit counter.
-#define U0RS485DLY_DLY_SHIFT           0                 
-
-/* SSP0CR0 - address 0x4004 0000, SSP1CR0 - address 0x4005 8000 */
-#define SSP0CR0_DSS_MASK               0x000F             // Data Size Select. This field controls the number of bits transferred in each frame. Values 0000-0010 are not supported and should not be used.
-#define SSP0CR0_DSS_SHIFT              0                 
-#define SSP0CR0_FRF_MASK               0x0030             // Frame Format.
-#define SSP0CR0_FRF_SHIFT              4                 
-#define SSP0CR0_CPOL                   (1 << 6)           // Clock Out Polarity. This bit is only used in SPI mode.
-#define SSP0CR0_CPHA                   (1 << 7)           // Clock Out Phase. This bit is only used in SPI mode.
-#define SSP0CR0_SCR_MASK               0xFF00             // Serial Clock Rate. The number of prescaler output clocks per 0x00 bit on the bus, minus one. Given that CPSDVSR is the prescale divider, and the APB clock PCLK clocks the prescaler, the bit frequency is PCLK / (CPSDVSR  [SCR+1]). Reserved
-#define SSP0CR0_SCR_SHIFT              8                 
-
-/* SSP0CR1 - address 0x4004 0004, SSP1CR1 - address 0x4005 8004 */
-#define SSP0CR1_LBM                    (1 << 0)           // Loop Back Mode.
-#define SSP0CR1_SSE                    (1 << 1)           // SPI Enable.
-#define SSP0CR1_MS                     (1 << 2)           // Master/Slave Mode.This bit can only be written when the SSE bit is 0.
-#define SSP0CR1_SOD                    (1 << 3)           // Slave Output Disable. This bit is relevant only in slave        0 mode (MS = 1). If it is 1, this blocks this SPI controller from driving the transmit data line (MISO).
-
-/* SSP0DR - address 0x4004 0008, SSP1DR - address 0x4005 8008 */
-#define SSP0DR_DATA_MASK               0xFFFF             // Write: software can write data to be sent in a future frame to this 0x0000 register whenever the TNF bit in the Status register is 1, indicating that the Tx FIFO is not full. If the Tx FIFO was previously empty and the SPI controller is not busy on the bus, transmission of the data will begin immediately. Otherwise the data written to this register will be sent as soon as all previous data has been sent (and received). If the data length is less than 16 bit, software must right-justify the data written to this register. Read: software can read data from this register whenever the RNE bit in the Status register is 1, indicating that the Rx FIFO is not empty. When software reads this register, the SPI controller returns data from the least recent frame in the Rx FIFO. If the data length is less than 16 bit, the data is right-justified in this field with higher order bits filled with 0s. Reserved.
-#define SSP0DR_DATA_SHIFT              0                 
-
-/* SSP0SR - address 0x4004 000C, SSP1SR - address 0x4005 800C */
-#define SSP0SR_TFE                     (1 << 0)           // Transmit FIFO Empty. This bit is 1 is the Transmit FIFO is empty, 0 if not.
-#define SSP0SR_TNF                     (1 << 1)           // Transmit FIFO Not Full. This bit is 0 if the Tx FIFO is full, 1 if not. 1
-#define SSP0SR_RNE                     (1 << 2)           // Receive FIFO Not Empty. This bit is 0 if the Receive FIFO is empty, 1 if not.
-#define SSP0SR_RFF                     (1 << 3)           // Receive FIFO Full. This bit is 1 if the Receive FIFO is full, 0 if not.
-#define SSP0SR_BSY                     (1 << 4)           // Busy. This bit is 0 if the SPI controller is idle, 1 if it is currently sending/receiving a frame and/or the Tx FIFO is not empty.
-
-/* SSP0CPSR - address 0x4004 0010, SSP1CPSR - address 0x4005 8010 */
-#define SSP0CPSR_CPSDVSR_MASK          0x00FF             // This even value between 2 and 254, by which SPI_PCLK is divided to yield the prescaler output clock. Bit 0 always reads as 0.
-#define SSP0CPSR_CPSDVSR_SHIFT         0                 
-
-/* SSP0IMSC - address 0x4004 0014, SSP1IMSC - address 0x4005 8014 */
-#define SSP0IMSC_RORIM                 (1 << 0)           // Software should set this bit to enable interrupt when a Receive        0 Overrun occurs, that is, when the Rx FIFO is full and another frame is completely received. The ARM spec implies that the preceding frame data is overwritten by the new frame data when this occurs.
-#define SSP0IMSC_RTIM                  (1 << 1)           // Software should set this bit to enable interrupt when a Receive Time-out condition occurs. A Receive Time-out occurs when the Rx FIFO is not empty, and no has not been read for a time-out period. The time-out period is the same for master and slave modes and is determined by the SSP bit rate: 32 bits at PCLK / (CPSDVSR [SCR+1]).
-#define SSP0IMSC_RXIM                  (1 << 2)           // Software should set this bit to enable interrupt when the Rx FIFO is at 0 least half full.
-#define SSP0IMSC_TXIM                  (1 << 3)           // Software should set this bit to enable interrupt when the Tx FIFO is at 0 least half empty.
-
-/* SSP0RIS - address 0x4004 0018, SSP1RIS - address 0x4005 8018 */
-#define SSP0RIS_RORRIS                 (1 << 0)           // This bit is 1 if another frame was completely received while the 0 RxFIFO was full. The ARM spec implies that the preceding frame data is overwritten by the new frame data when this occurs.
-#define SSP0RIS_RTRIS                  (1 << 1)           // This bit is 1 if the Rx FIFO is not empty, and has not been read 0 for a time-out period. The time-out period is the same for master and slave modes and is determined by the SSP bit rate: 32 bits at PCLK / (CPSDVSR  [SCR+1]).
-#define SSP0RIS_RXRIS                  (1 << 2)           // This bit is 1 if the Rx FIFO is at least half full.
-#define SSP0RIS_TXRIS                  (1 << 3)           // This bit is 1 if the Tx FIFO is at least half empty.
-
-/* SSP0MIS - address 0x4004 001C, SSP1MIS - address 0x4005 801C */
-#define SSP0MIS_RORMIS                 (1 << 0)           // This bit is 1 if another frame was completely received while the 0 RxFIFO was full, and this interrupt is enabled.
-#define SSP0MIS_RTMIS                  (1 << 1)           // This bit is 1 if the Rx FIFO is not empty, has not been read for a time-out period, and this interrupt is enabled. The time-out period is the same for master and slave modes and is determined by the SSP bit rate: 32 bits at PCLK / (CPSDVSR [SCR+1]).
-#define SSP0MIS_RXMIS                  (1 << 2)           // This bit is 1 if the Rx FIFO is at least half full, and this interrupt 0 is enabled.
-#define SSP0MIS_TXMIS                  (1 << 3)           // This bit is 1 if the Tx FIFO is at least half empty, and this interrupt is enabled.
-
-/* SSP0ICR - address 0x4004 0020, SSP1ICR - address 0x4005 8020 */
-#define SSP0ICR_RORIC                  (1 << 0)           // Writing a 1 to this bit clears the "frame was received when RxFIFO was full" interrupt.
-#define SSP0ICR_RTIC                   (1 << 1)           // Writing a 1 to this bit clears the Rx FIFO was not empty and has not been read for a timeout period interrupt. The timeout period is the same for master and slave modes and is determined by the SSP bit rate: 32 bits at PCLK / (CPSDVSR [SCR+1]).
-
-/* I2C0CONSET - address 0x4000 0000 */
-#define I2C0CONSET_AA                  (1 << 2)           // Assert acknowledge flag.
-#define I2C0CONSET_SI                  (1 << 3)           // I2C interrupt flag.
-#define I2C0CONSET_STO                 (1 << 4)           // STOP flag.
-#define I2C0CONSET_STA                 (1 << 5)           // START flag.
-#define I2C0CONSET_I2EN                (1 << 6)           // I2C    interface enable. Reserved. The value read from a reserved bit is not defined.
-
-/* I2C0STAT - 0x4000 0004 */
-#define I2C0STAT_STATUS_MASK           0x00F8             // These bits give the actual status information about the                      I2 C interface. Reserved. The value read from a reserved bit is not defined.
-#define I2C0STAT_STATUS_SHIFT          3                 
-
-/* I2C0DAT - 0x4000 0008 */
-#define I2C0DAT_DATA_MASK              0x00FF             // This register holds data values that have been received or are to 0 be transmitted. Reserved. The value read from a reserved bit is not defined.
-#define I2C0DAT_DATA_SHIFT             0                 
-
-/* I2C0ADR0 - 0x4000 000C */
-#define I2C0ADR0_GC                    (1 << 0)           // General Call enable bit.
-#define I2C0ADR0_ADDRESS_MASK          0x00FE             // The I2C device address for slave mode. Reserved. The value read from a reserved bit is not defined.
-#define I2C0ADR0_ADDRESS_SHIFT         1                 
-
-/* I2C0SCLH - address 0x4000 0010 */
-#define I2C0SCLH_SCLH_MASK             0xFFFF             // Count for SCL HIGH time period selection.
-#define I2C0SCLH_SCLH_SHIFT            0                 
-
-/* I2C0SCLL - 0x4000 0014 */
-#define I2C0SCLL_SCLL_MASK             0xFFFF             // Count for SCL low time period selection.
-#define I2C0SCLL_SCLL_SHIFT            0                 
-
-/* I2C0CONCLR - 0x4000 0018 */
-#define I2C0CONCLR_AAC                 (1 << 2)           // Assert acknowledge Clear bit.
-#define I2C0CONCLR_SIC                 (1 << 3)           // I2C interrupt Clear bit.
-#define I2C0CONCLR_STAC                (1 << 5)           // START flag Clear bit.
-#define I2C0CONCLR_I2ENC               (1 << 6)           // I2C    interface Disable bit. Reserved. The value read from a reserved bit is not defined.
-
-/* I2C0MMCTRL - 0x4000 001C */
-#define I2C0MMCTRL_MM_ENA              (1 << 0)           // Monitor mode enable.
-#define I2C0MMCTRL_ENA_SCL             (1 << 1)           // SCL output enable.
-
-/* I2C0DATA_BUFFER - 0x4000 002C */
-#define I2C0DATA_BUFFER_DATA_MASK      0x00FF             // This register holds contents of the 8 MSBs of the DAT shift register. Reserved. The value read from a reserved bit is not defined.
-#define I2C0DATA_BUFFER_DATA_SHIFT     0                 
-
-/* CANCNTL, address 0x4005 0000 */
-#define CANCNTL_INIT                   (1 << 0)           // Initialization
-#define CANCNTL_IE                     (1 << 1)           // Module interrupt enable
-#define CANCNTL_SIE                    (1 << 2)           // Status change interrupt enable
-#define CANCNTL_EIE                    (1 << 3)           // Error interrupt enable
-#define CANCNTL_DAR                    (1 << 5)           // Disable automatic retransmission
-#define CANCNTL_CCE                    (1 << 6)           // Configuration change enable
-#define CANCNTL_TEST                   (1 << 7)           // Test mode enable
-
-/* CANSTAT, address 0x4005 0004 */
-#define CANSTAT_LEC_MASK               0x0007             // Last error code Type of the last error to occur on the CAN bus.The LEC field holds a code which indicates the type of the last error to occur on the CAN bus. This field will be cleared to `0' when a message has been transferred (reception or transmission) without error. The unused code `111' may be written by the CPU to check for updates.
-#define CANSTAT_LEC_SHIFT              0                 
-#define CANSTAT_TXOK                   (1 << 3)           // Transmitted a message successfully This bit must be reset by the CPU. It is never reset by the CAN controller.
-#define CANSTAT_RXOK                   (1 << 4)           // Received a message successfully This bit must be reset by the CPU. It is never reset by the CAN controller.
-#define CANSTAT_EPASS                  (1 << 5)           // Error passive
-#define CANSTAT_EWARN                  (1 << 6)           // Warning status
-#define CANSTAT_BOFF                   (1 << 7)           // Busoff status
-
-/* CANEC, address 0x4005 0008 */
-#define CANEC_TEC_MASK                 0x00FF             // Transmit error counter Current value of the transmit error counter (maximum value 255)
-#define CANEC_TEC_SHIFT                0                 
-#define CANEC_REC_MASK                 0x7F00             // Receive error counter Current value of the receive error counter (maximum value 127).
-#define CANEC_REC_SHIFT                8                 
-#define CANEC_RP                       (1 << 15)          // Receive error passive
-
-/* CANBT, address 0x4005 000C */
-#define CANBT_BRP_MASK                 0x003F             // Baud rate prescaler The value by which the oscillator frequency is divided for generating the bit time quanta. The bit time is built up from a multiple of this quanta. Valid values for the Baud Rate Prescaler are 0 to 63.[1]
-#define CANBT_BRP_SHIFT                0                 
-#define CANBT_SJW_MASK                 0x00C0             // (Re)synchronization jump width Valid programmed values are 0 to 3.[1]
-#define CANBT_SJW_SHIFT                6                 
-#define CANBT_TSEG1_MASK               0x0F00             // Time segment before the sample point Valid values are 1 to                  15.[1]
-#define CANBT_TSEG1_SHIFT              8                 
-#define CANBT_TSEG2_MASK               0x7000             // Time segment after the sample point Valid values are 0 to                  7.[1]
-#define CANBT_TSEG2_SHIFT              12                
-
-/* CANINT, address 0x4005 0010 */
-#define CANINT_INTID_MASK              0xFFFF             // 0x0000 = No interrupt is pending.                0 0x0001 - 0x0020 = Number of message object which caused the interrupt. 0x0021 - 0x7FFF = Unused 0x8000 = Status interrupt 0x8001 - 0xFFFF = Unused
-#define CANINT_INTID_SHIFT             0                 
-
-/* CANTEST, address 0x4005 0014 */
-#define CANTEST_BASIC                  (1 << 2)           // Basic mode
-#define CANTEST_SILENT                 (1 << 3)           // Silent mode
-#define CANTEST_LBACK                  (1 << 4)           // Loop back mode
-#define CANTEST_TX_MASK                0x0060             // Control of CAN_TXD pins
-#define CANTEST_TX_SHIFT               5                 
-#define CANTEST_RX                     (1 << 7)           // Monitors the actual value of the CAN_RXD pin.
-
-/* CANBRPE, address 0x4005 0018 */
-#define CANBRPE_BRPE_MASK              0x000F             // Baud rate prescaler extension By programming BRPE the Baud Rate Prescaler can be extended to values up to 1023. Hardware interprets the value as the value of BRPE (MSBs) and BRP (LSBs) plus one. Allowed values are 0 to 15.
-#define CANBRPE_BRPE_SHIFT             0                 
-
-/* CANIF1_CMDREQ, address 0x4005 0020 and CANIF2_CMDREQ, address 0x4005 0080 */
-#define CANIFn_CMDREQ_MN_MASK          0x003F             // Message number 0x01 - 0x20 = Valid message numbers. The message object in the message RAM is selected for data transfer. 0x00 = Not a valid message number. This value is interpreted as 0x20.[1] 0x21 - 0x3F = Not a valid message number. This value is interpreted as 0x01 - 0x1F.[1]
-#define CANIFn_CMDREQ_MN_SHIFT         0                 
-#define CANIFn_CMDREQ_BUSY             (1 << 15)          // BUSY flag
-
-/* CANIF1_CMDMSK, address 0x4005 0024 and CANIF2_CMDMSK, address 0x4005 0084 */
-#define CANIFn_CMDMSK_DATA_B           (1 << 0)           // Access data bytes 4-7
-#define CANIFn_CMDMSK_DATA_A           (1 << 1)           // Access data bytes 0-3
-#define CANIFn_CMDMSK_TXRQST           (1 << 2)           // Access transmission request bit (Write direction)
-#define CANIFn_CMDMSK_NEWDAT           (1 << 2)           // Access new data bit (Read direction)
-#define CANIFn_CMDMSK_CLRINTPND        (1 << 3)           // This bit is ignored in the write direction.
-#define CANIFn_CMDMSK_CTRL             (1 << 4)           // Access control bits
-#define CANIFn_CMDMSK_ARB              (1 << 5)           // Access arbitration bits
-#define CANIFn_CMDMSK_MASK             (1 << 6)           // Access mask bits
-#define CANIFn_CMDMSK_WR               (1 << 7)           // Write transfer Transfer data from the selected message buffer registers to the message object addressed by the command request register CANIFn_CMDREQ.
-#define CANIFn_CMDMSK_RD               (0 << 7)           // Read transfer Read data from the selected message buffer registers to the message object addressed by the command request register CANIFn_CMDREQ.
-
-/* CANIF1_MSK1, address 0x4005 0028 and CANIF2_MASK1, address 0x4005 0088 */
-#define CANIFn_MSK1_MSK_MASK           0xFFFF             // Identifier mask
-#define CANIFn_MSK1_MSK_SHIFT          0                 
-
-/* CANIF1_MSK2, address 0x4005 002C and CANIF2_MASK2, address 0x4005 008C */
-#define CANIFn_MSK2_MSK_MASK           0x1FFF             // Identifier mask
-#define CANIFn_MSK2_MSK_SHIFT          0                 
-#define CANIFn_MSK2_MDIR               (1 << 14)          // Mask message direction
-#define CANIFn_MSK2_MXTD               (1 << 15)          // Mask extend identifier
-
-/* CANIF1_ARB1, address 0x4005 0030 and CANIF2_ARB1, address 0x4005 0090 */
-#define CANIFn_ARB1_ID_MASK            0xFFFF             // Message identifier 29-bit identifier (extended frame) 11-bit identifier (standard frame)
-#define CANIFn_ARB1_ID_SHIFT           0                 
-
-/* CANIF1_ARB2, address 0x4005 0034 and CANIF2_ARB2, address 0x4005 0094 */
-#define CANIFn_ARB2_ID_MASK            0x1FFF             // Message identifier 29-bit identifier (extended frame) 11-bit identifier (standard frame)
-#define CANIFn_ARB2_ID_SHIFT           0                 
-#define CANIFn_ARB2_DIR                (1 << 13)          // Message direction
-#define CANIFn_ARB2_XTD                (1 << 14)          // Extend identifier
-#define CANIFn_ARB2_MSGVAL             (1 << 15)          // Message valid Remark: The CPU must reset the MSGVAL bit of all unused Messages Objects during the initialization before it resets bit INIT in the CAN Control Register. This bit must also be reset before the identifier ID28:0, the control bits XTD, DIR, or the Data Length Code DLC3:0 are modified, or if the Messages Object is no longer required.
-
-/* CANIF1_MCTRL, address 0x4005 0038 and CANIF2_MCTRL, address 0x4005 0098 */
-#define CANIFn_MCTRL_DLC_MASK          0x000F             // Data length code Remark: The Data Length Code of a Message Object must be defined the same as in all the corresponding objects with the same identifier at other nodes. When the Message Handler stores a data frame, it will write the DLC to the value given by the received message. 0000 - 1000 = Data frame has 0 - 8 data bytes. 1001 - 1111 = Data frame has 8 data bytes.
-#define CANIFn_MCTRL_DLC_SHIFT         0                 
-#define CANIFn_MCTRL_EOB               (1 << 7)           // End of buffer
-#define CANIFn_MCTRL_TXRQST            (1 << 8)           // Transmit request
-#define CANIFn_MCTRL_RMTEN             (1 << 9)           // Remote enable
-#define CANIFn_MCTRL_RXIE              (1 << 10)          // Receive interrupt enable
-#define CANIFn_MCTRL_TXIE              (1 << 11)          // Transmit interrupt enable
-#define CANIFn_MCTRL_UMASK             (1 << 12)          // Use acceptance mask Remark: If UMASK is set to 1, the message object's mask bits have to be programmed during initialization of the message object before MAGVAL is set to 1.
-#define CANIFn_MCTRL_INTPND            (1 << 13)          // Interrupt pending
-#define CANIFn_MCTRL_MSGLST            (1 << 14)          // Message lost (only valid for message objects in the direction receive).
-#define CANIFn_MCTRL_NEWDAT            (1 << 15)          // New data
-
-/* CANIF1_DA1, address 0x4005 003C and CANIF2_DA1, address 0x4005 009C */
-#define CANIFn_DA1_DATA0_MASK          0x00FF             // Data byte 0
-#define CANIFn_DA1_DATA0_SHIFT         0                 
-#define CANIFn_DA1_DATA1_MASK          0xFF00             // Data byte 1
-#define CANIFn_DA1_DATA1_SHIFT         8                 
-
-/* CANIF1_DA2, address 0x4005 0040 and CANIF2_DA2, address 0x4005 00A0 */
-#define CANIFn_DA2_DATA2_MASK          0x00FF             // Data byte 2
-#define CANIFn_DA2_DATA2_SHIFT         0                 
-#define CANIFn_DA2_DATA3_MASK          0xFF00             // Data byte 3
-#define CANIFn_DA2_DATA3_SHIFT         8                 
-
-/* CANIF1_DB1, address 0x4005 0044 and CANIF2_DB1, address 0x4005 00A4 */
-#define CANIFn_DB1_DATA4_MASK          0x00FF             // Data byte 4
-#define CANIFn_DB1_DATA4_SHIFT         0                 
-#define CANIFn_DB1_DATA5_MASK          0xFF00             // Data byte 5
-#define CANIFn_DB1_DATA5_SHIFT         8                 
-
-/* CANIF1_DB2, address 0x4005 0048 and CANIF2_DB2, address 0x4005 00A8 */
-#define CANIFn_DB2_DATA6_MASK          0x00FF             // Data byte 6
-#define CANIFn_DB2_DATA6_SHIFT         0                 
-#define CANIFn_DB2_DATA7_MASK          0xFF00             // Data byte 7
-#define CANIFn_DB2_DATA7_SHIFT         8                 
-
-/* CANTXREQ1, address 0x4005 0100 */
-#define CANTXREQ1_TXRQST_MASK          0xFFFF             // Transmission request bit of message objects 16 to 1. 0 = This message object is not waiting for transmission. 1 = The transmission of this message object is requested and not yet done. Reserved
-#define CANTXREQ1_TXRQST_SHIFT         0                 
-
-/* CANTXREQ2, address 0x4005 0104 */
-#define CANTXREQ2_TXRQST_MASK          0xFFFF             // Transmission request bit of message objects 32 to 17. 0 = This message object is not waiting for transmission. 1 = The transmission of this message object is requested and not yet done. Reserved
-#define CANTXREQ2_TXRQST_SHIFT         0                 
-
-/* CANND1, address 0x4005 0120 */
-#define CANND1_NEWDAT_MASK             0xFFFF             // New data bits of message objects 16 to 1. 0 = No new data has been written into the data portion of this Message Object by the Message Handler since last time this flag was cleared by the CPU. 1 = The Message Handler or the CPU has written new data into the data portion of this Message Object.
-#define CANND1_NEWDAT_SHIFT            0                 
-
-/* CANND2, address 0x4005 0124 */
-#define CANND2_NEWDAT_MASK             0xFFFF             // New data bits of message objects 32 to 17. 0 = No new data has been written into the data portion of this Message Object by the Message Handler since last time this flag was cleared by the CPU. 1 = The Message Handler or the CPU has written new data into the data portion of this Message Object.
-#define CANND2_NEWDAT_SHIFT            0                 
-
-/* CANIR1, address 0x4005 0140 */
-#define CANIR1_INTPND_INTERRUPT_MASK   0xFFFF             // pending bits of message objects 16 to 1. essage object is ignored by the message essage object is the source of an interrupt. Reserved
-#define CANIR1_INTPND_INTERRUPT_SHIFT  0                 
-
-/* CANIR2, addresses 0x4005 0144 */
-#define CANIR2_INTPND_MASK             0xFFFF             // Interrupt pending bits of message objects 32 to 17. 0 = This message object is ignored by the message handler. 1 = This message object is the source of an interrupt. Reserved
-#define CANIR2_INTPND_SHIFT            0                 
-
-/* CANMSGV1, addresses 0x4005 0160 */
-#define CANMSGV1_MSGVAL_MASK           0xFFFF             // Message valid bits of message objects 16 to 1. 0 = This message object is ignored by the message handler. 1 = This message object is configured and should be considered by the message handler. Reserved
-#define CANMSGV1_MSGVAL_SHIFT          0                 
-
-/* CANMSGV2, address 0x4005 0164 */
-#define CANMSGV2_MSGVAL_MASK           0xFFFF             // Message valid bits of message objects 32 to 17. 0 = This message object is ignored by the message handler. 1 = This message object is configured and should be considered by the message handler. Reserved
-#define CANMSGV2_MSGVAL_SHIFT          0                 
-
-/* CANCLKDIV, address 0x4005 0180 */
-#define CANCLKDIV_CLKDIVVAL_MASK       0x000F             // Clock divider value. CAN_CLK = PCLK/(CLKDIVVAL +1) 0000: CAN_CLK = PCLK divided by 1. 0001: CAN_CLK = PCLK divided by 2. 0010: CAN_CLK = PCLK divided by 3 0011: CAN_CLK = PCLK divided by 4. ... 1111: CAN_CLK = PCLK divided by 16.
-#define CANCLKDIV_CLKDIVVAL_SHIFT      0                 
-
-/* TMR16B0IR - address 0x4000 C000 and TMR16B1IR - address 0x4001 0000 */
-#define TMR16B0IR_MR0                  (1 << 0)           // Interrupt flag for match channel 0.
-#define TMR16B0IR_MR1                  (1 << 1)           // Interrupt flag for match channel 1.
-#define TMR16B0IR_MR2                  (1 << 2)           // Interrupt flag for match channel 2.
-#define TMR16B0IR_MR3                  (1 << 3)           // Interrupt flag for match channel 3.
-#define TMR16B0IR_CR0                  (1 << 4)           // Interrupt flag for capture channel 0 event.
-
-/* TMR16B0TCR - address 0x4000 C004 and TMR16B1TCR - address 0x4001 0004 */
-#define TMR16B0TCR_CEN                 (1 << 0)           // Counter Enable. When one, the Timer Counter and Prescale Counter are enabled for counting. When zero, the counters are disabled.
-#define TMR16B0TCR_CRST                (1 << 1)           // Counter Reset. When one, the Timer Counter and the Prescale Counter are synchronously reset on the next positive edge of PCLK. The counters remain reset until TCR[1] is returned to zero.
-
-/* TMR16B0TC, address 0x4000 C008 and TMR16B1TC 0x4001 0008 */
-#define TMR16B0TC_TC_MASK              0xFFFF             // Timer counter value.
-#define TMR16B0TC_TC_SHIFT             0                 
-
-/* TMR16B0PR, address 0x4000 C00C and TMR16B1PR 0x4001 000C */
-#define TMR16B0PR_PR_MASK              0xFFFF             // Prescale max value.
-#define TMR16B0PR_PR_SHIFT             0                 
-
-/* TMR16B0PC, address 0x4001 C010 and TMR16B1PC 0x4000 0010 */
-#define TMR16B0PC_PC_MASK              0xFFFF             // Prescale counter value.
-#define TMR16B0PC_PC_SHIFT             0                 
-
-/* TMR16B0MCR - address 0x4000 C014 and TMR16B1MCR - address 0x4001 0014 */
-#define TMR16B0MCR_MR0I                (1 << 0)           // Interrupt on MR0: an interrupt is generated when MR0 matches the value in the TC.
-#define TMR16B0MCR_MR0R                (1 << 1)           // Reset on MR0: the TC will be reset if MR0 matches it.
-#define TMR16B0MCR_MR0S                (1 << 2)           // Stop on MR0: the TC and PC will be stopped and TCR[0] will be set to 0 if MR0 matches 0 the TC.
-#define TMR16B0MCR_MR1I                (1 << 3)           // Interrupt on MR1: an interrupt is generated when MR1 matches the value in the TC.
-#define TMR16B0MCR_MR1R                (1 << 4)           // Reset on MR1: the TC will be reset if MR1 matches it.
-#define TMR16B0MCR_MR1S                (1 << 5)           // Stop on MR1: the TC and PC will be stopped and TCR[0] will be set to 0 if MR1 matches 0 the TC.
-#define TMR16B0MCR_MR2I                (1 << 6)           // Interrupt on MR2: an interrupt is generated when MR2 matches the value in the TC.
-#define TMR16B0MCR_MR2R                (1 << 7)           // Reset on MR2: the TC will be reset if MR2 matches it.
-#define TMR16B0MCR_MR2S                (1 << 8)           // Stop on MR2: the TC and PC will be stopped and TCR[0] will be set to 0 if MR2 matches 0 the TC.
-#define TMR16B0MCR_MR3I                (1 << 9)           // Interrupt on MR3: an interrupt is generated when MR3 matches the value in the TC.
-#define TMR16B0MCR_MR3R                (1 << 10)          // Reset on MR3: the TC will be reset if MR3 matches it.
-#define TMR16B0MCR_MR3S                (1 << 11)          // Stop on MR3: the TC and PC will be stopped and TCR[0] will be set to 0 if MR3 matches 0 the TC.
-
-/* TMR16B0MR0 to 3, addresses 0x4000 C018 to 24 and TMR16B1MR0 to 3, addresses 0x4001 0018 to 24 */
-#define TMR16B0MR0_to_3_MATCH_MASK     0xFFFF             // Timer counter match value.
-#define TMR16B0MR0_to_3_MATCH_SHIFT    0                 
-
-/* TMR16B0CCR - address 0x4000 C028 and TMR16B1CCR - address 0x4001 0028 */
-#define TMR16B0CCR_CAP0RE              (1 << 0)           // Capture on CT16Bn_CAP0 rising edge: a sequence of 0 then 1 on CT16Bn_CAP0 will cause CR0 to be loaded with the contents of TC.
-#define TMR16B0CCR_CAP0FE              (1 << 1)           // Capture on CT16Bn_CAP0 falling edge: a sequence of 1 then 0 on CT16Bn_CAP0 will 0 cause CR0 to be loaded with the contents of TC.
-#define TMR16B0CCR_CAP0I               (1 << 2)           // Interrupt on CT16Bn_CAP0 event: a CR0 load due to a CT16Bn_CAP0 event will generate an interrupt.
-
-/* TMR16B0CR0, address 0x4000 C02C and TMR16B1CR0, address 0x4001 002C */
-#define TMR16B0CR0_CAP_MASK            0xFFFF             // Timer counter capture value.
-#define TMR16B0CR0_CAP_SHIFT           0                 
-
-/* TMR16B0EMR - address 0x4000 C03C and TMR16B1EMR - address 0x4001 003C */
-#define TMR16B0EMR_EM0                 (1 << 0)           // External Match 0. This bit reflects the state of output CT16B0_MAT0/CT16B1_MAT0,       0 whether or not this output is connected to its pin. When a match occurs between the TC and MR0, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[5:4] control the functionality of this output. This bit is driven to the CT16B0_MAT0/CT16B1_MAT0 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
-#define TMR16B0EMR_EM1                 (1 << 1)           // External Match 1. This bit reflects the state of output CT16B0_MAT1/CT16B1_MAT1,       0 whether or not this output is connected to its pin. When a match occurs between the TC and MR1, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[7:6] control the functionality of this output. This bit is driven to the CT16B0_MAT1/CT16B1_MAT1 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
-#define TMR16B0EMR_EM2                 (1 << 2)           // External Match 2. This bit reflects the state of output match channel 2, whether or not     0 this output is connected to its pin. When a match occurs between the TC and MR2, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[9:8] control the functionality of this output. Note that on counter/timer 0 this match channel is not pinned out. This bit is driven to the CT16B1_MAT2 pin if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
-#define TMR16B0EMR_EM3                 (1 << 3)           // External Match 3. This bit reflects the state of output of match channel 3. When a match 0 occurs between the TC and MR3, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[11:10] control the functionality of this output. There is no output pin available for this channel on either of the 16-bit timers.
-#define TMR16B0EMR_EMC0_MASK           0x0030             // External Match Control 0. Determines the functionality of External Match 0.
-#define TMR16B0EMR_EMC0_SHIFT          4                 
-#define TMR16B0EMR_EMC1_MASK           0x00C0             // External Match Control 1. Determines the functionality of External Match 1.
-#define TMR16B0EMR_EMC1_SHIFT          6                 
-#define TMR16B0EMR_EMC2_MASK           0x0300             // External Match Control 2. Determines the functionality of External Match 2.
-#define TMR16B0EMR_EMC2_SHIFT          8                 
-#define TMR16B0EMR_EMC3_MASK           0x0C00             // External Match Control 3. Determines the functionality of External Match 3.
-#define TMR16B0EMR_EMC3_SHIFT          10                
-
-/* TMR16B0CTCR - address 0x4000 C070 and TMR16B1CTCR - address 0x4001 0070 */
-#define TMR16B0CTCR_CTM_MASK           0x0003             // Counter/Timer Mode. This field selects which rising PCLK    00 edges can increment Timer's Prescale Counter (PC), or clear PC and increment Timer Counter (TC).
-#define TMR16B0CTCR_CTM_SHIFT          0                 
-
-/* TMR16B0PWMC - address 0x4000 C074 and TMR16B1PWMC- address 0x4001 0074 */
-#define TMR16B0PWMC_PWMEN0             (1 << 0)           // PWM channel0 enable
-#define TMR16B0PWMC_PWMEN1             (1 << 1)           // PWM channel1 enable
-#define TMR16B0PWMC_PWMEN2             (1 << 2)           // PWM channel2 enable
-#define TMR16B0PWMC_PWMEN3             (1 << 3)           // PWM channel3 enable Note: It is recommended to use match channel 3 to set the PWM cycle because it is not pinned out.
-
-/* TMR16B0IR - address 0x4000 C000 and TMR16B1IR - address 0x4001 0000 */
-#define TMR16B0IR_MR0INT               (1 << 0)           // Interrupt flag for match channel 0.
-#define TMR16B0IR_MR1INT               (1 << 1)           // Interrupt flag for match channel 1.
-#define TMR16B0IR_MR2INT               (1 << 2)           // Interrupt flag for match channel 2.
-#define TMR16B0IR_MR3INT               (1 << 3)           // Interrupt flag for match channel 3.
-#define TMR16B0IR_CR0INT               (1 << 4)           // Interrupt flag for capture channel 0 event.
-#define TMR16B0IR_CR1INT               (1 << 5)           // Interrupt flag for capture channel 1 event.
-
-/* TMR16B0TCR - address 0x4000 C004 and TMR16B1TCR - address 0x4001 0004 */
-#define TMR16B0TCR_CEN                 (1 << 0)           // Counter Enable. When one, the Timer Counter and Prescale Counter are enabled for counting. When zero, the counters are disabled.
-#define TMR16B0TCR_CRST                (1 << 1)           // Counter Reset. When one, the Timer Counter and the Prescale Counter are synchronously reset on the next positive edge of PCLK. The counters remain reset until TCR[1] is returned to zero.
-
-/* TMR16B0TC, address 0x4000 C008 and TMR16B1TC 0x4001 0008 */
-#define TMR16B0TC_TC_MASK              0xFFFF             // Timer counter value.
-#define TMR16B0TC_TC_SHIFT             0                 
-
-/* TMR16B0PR, address 0x4000 C00C and TMR16B1PR 0x4001 000C */
-#define TMR16B0PR_PR_MASK              0xFFFF             // Prescale max value.
-#define TMR16B0PR_PR_SHIFT             0                 
-
-/* TMR16B0PC, address 0x4001 C010 and TMR16B1PC 0x4000 0010 */
-#define TMR16B0PC_PC_MASK              0xFFFF             // Prescale counter value.
-#define TMR16B0PC_PC_SHIFT             0                 
-
-/* TMR16B0MCR - address 0x4000 C014 and TMR16B1MCR - address 0x4001 0014 */
-#define TMR16B0MCR_MR0I                (1 << 0)           // Interrupt on MR0: an interrupt is generated when MR0 matches the value in the TC.
-#define TMR16B0MCR_MR0R                (1 << 1)           // Reset on MR0: the TC will be reset if MR0 matches it.
-#define TMR16B0MCR_MR0S                (1 << 2)           // Stop on MR0: the TC and PC will be stopped and TCR[0] will be set to 0 if MR0 matches 0 the TC.
-#define TMR16B0MCR_MR1I                (1 << 3)           // Interrupt on MR1: an interrupt is generated when MR1 matches the value in the TC.
-#define TMR16B0MCR_MR1R                (1 << 4)           // Reset on MR1: the TC will be reset if MR1 matches it.
-#define TMR16B0MCR_MR1S                (1 << 5)           // Stop on MR1: the TC and PC will be stopped and TCR[0] will be set to 0 if MR1 matches 0 the TC.
-#define TMR16B0MCR_MR2I                (1 << 6)           // Interrupt on MR2: an interrupt is generated when MR2 matches the value in the TC.
-#define TMR16B0MCR_MR2R                (1 << 7)           // Reset on MR2: the TC will be reset if MR2 matches it.
-#define TMR16B0MCR_MR2S                (1 << 8)           // Stop on MR2: the TC and PC will be stopped and TCR[0] will be set to 0 if MR2 matches 0 the TC.
-#define TMR16B0MCR_MR3I                (1 << 9)           // Interrupt on MR3: an interrupt is generated when MR3 matches the value in the TC.
-#define TMR16B0MCR_MR3R                (1 << 10)          // Reset on MR3: the TC will be reset if MR3 matches it.
-#define TMR16B0MCR_MR3S                (1 << 11)          // Stop on MR3: the TC and PC will be stopped and TCR[0] will be set to 0 if MR3 matches 0 the TC.
-
-/* TMR16B0MR0 to 3, addresses 0x4000 C018 to 24 and TMR16B1MR0 to 3, addresses 0x4001 0018 to 24 */
-#define TMR16B0MR0_to_3_MATCH_MASK     0xFFFF             // Timer counter match value.
-#define TMR16B0MR0_to_3_MATCH_SHIFT    0                 
-
-/* TMR16B0CCR - address 0x4000 C028 and TMR16B1CCR - address 0x4001 0028 */
-#define TMR16B0CCR_CAP0RE              (1 << 0)           // Capture on CT16Bn_CAP0 rising edge: a sequence of 0 then 1 on CT16Bn_CAP0 will cause CR0 to be loaded with the contents of TC.
-#define TMR16B0CCR_CAP0FE              (1 << 1)           // Capture on CT16Bn_CAP0 falling edge: a sequence of 1 then 0 on CT16Bn_CAP0 will 0 cause CR0 to be loaded with the contents of TC.
-#define TMR16B0CCR_CAP0I               (1 << 2)           // Interrupt on CT16Bn_CAP0 event: a CR0 load due to a CT16Bn_CAP0 event will generate an interrupt.
-#define TMR16B0CCR_CAP1RE              (1 << 3)           // Capture on CT16Bn_CAP1 rising edge: a sequence of 0 then 1 on CT16Bn_CAP1 will cause CR1 to be loaded with the contents of TC.
-#define TMR16B0CCR_CAP1FE              (1 << 4)           // Capture on CT16Bn_CAP1 falling edge: a sequence of 1 then 0 on CT16Bn_CAP1 will 0 cause CR1 to be loaded with the contents of TC.
-#define TMR16B0CCR_CAP1I               (1 << 5)           // Interrupt on CT16Bn_CAP1 event: a CR1 load due to a CT16Bn_CAP1 event will generate an interrupt.
-
-/* TMR16B0EMR - address 0x4000 C03C and TMR16B1EMR - address 0x4001 003C */
-#define TMR16B0EMR_EM0                 (1 << 0)           // External Match 0. This bit reflects the state of output CT16B0_MAT0/CT16B1_MAT0,       0 whether or not this output is connected to its pin. When a match occurs between the TC and MR0, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[5:4] control the functionality of this output. This bit is driven to the CT16B0_MAT0/CT16B1_MAT0 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
-#define TMR16B0EMR_EM1                 (1 << 1)           // External Match 1. This bit reflects the state of output CT16B0_MAT1/CT16B1_MAT1,       0 whether or not this output is connected to its pin. When a match occurs between the TC and MR1, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[7:6] control the functionality of this output. This bit is driven to the CT16B0_MAT1/CT16B1_MAT1 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
-#define TMR16B0EMR_EM2                 (1 << 2)           // External Match 2. This bit reflects the state of output match channel 2, whether or not     0 this output is connected to its pin. When a match occurs between the TC and MR2, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[9:8] control the functionality of this output. Note that on counter/timer 0 this match channel is not pinned out. This bit is driven to the CT16B1_MAT2 pin if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
-#define TMR16B0EMR_EM3                 (1 << 3)           // External Match 3. This bit reflects the state of output of match channel 3. When a match 0 occurs between the TC and MR3, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[11:10] control the functionality of this output. There is no output pin available for this channel on either of the 16-bit timers.
-#define TMR16B0EMR_EMC0_MASK           0x0030             // External Match Control 0. Determines the functionality of External Match 0.
-#define TMR16B0EMR_EMC0_SHIFT          4                 
-#define TMR16B0EMR_EMC1_MASK           0x00C0             // External Match Control 1. Determines the functionality of External Match 1.
-#define TMR16B0EMR_EMC1_SHIFT          6                 
-#define TMR16B0EMR_EMC2_MASK           0x0300             // External Match Control 2. Determines the functionality of External Match 2.
-#define TMR16B0EMR_EMC2_SHIFT          8                 
-#define TMR16B0EMR_EMC3_MASK           0x0C00             // External Match Control 3. Determines the functionality of External Match 3.
-#define TMR16B0EMR_EMC3_SHIFT          10                
-
-/* TMR16B0CTCR - address 0x4000 C070 and TMR16B1CTCR - address 0x4001 0070 */
-#define TMR16B0CTCR_CTM_MASK           0x0003             // Counter/Timer Mode. This field selects which rising PCLK    00 edges can increment Timer's Prescale Counter (PC), or clear PC and increment Timer Counter (TC).
-#define TMR16B0CTCR_CTM_SHIFT          0                 
-#define TMR16B0CTCR_SELCC_MASK         0x00E0             // When bit 4 is one, these bits select which capture input edge 0 will cause the timer and prescaler to be cleared. These bits have no effect when bit 4 is zero.
-#define TMR16B0CTCR_SELCC_SHIFT        5                 
-
-/* TMR16B0PWMC - address 0x4000 C074 and TMR16B1PWMC- address 0x4001 0074 */
-#define TMR16B0PWMC_PWMEN0             (1 << 0)           // PWM channel0 enable
-#define TMR16B0PWMC_PWMEN1             (1 << 1)           // PWM channel1 enable
-#define TMR16B0PWMC_PWMEN2             (1 << 2)           // PWM channel2 enable
-#define TMR16B0PWMC_PWMEN3             (1 << 3)           // PWM channel3 enable Note: It is recommended to use match channel 3 to set the PWM cycle because it is not pinned out.
-
-/* TMR32B0IR - address 0x4001 4000 and TMR32B1IR - address 0x4001 8000 */
-#define TMR32B0IR_MR0_INTERRUPT        (1 << 0)           // Interrupt flag for match channel 0.
-#define TMR32B0IR_MR1_INTERRUPT        (1 << 1)           // Interrupt flag for match channel 1.
-#define TMR32B0IR_MR2_INTERRUPT        (1 << 2)           // Interrupt flag for match channel 2.
-#define TMR32B0IR_MR3_INTERRUPT        (1 << 3)           // Interrupt flag for match channel 3.
-#define TMR32B0IR_CR0_INTERRUPT        (1 << 4)           // Interrupt flag for capture channel 0 event.
-
-/* TMR32B0TCR - address 0x4001 4004 and TMR32B1TCR - address 0x4001 8004 */
-#define TMR32B0TCR_CEN                 (1 << 0)           // When one, the Timer Counter and Prescale Counter are 0 enabled for counting. When zero, the counters are disabled.
-#define TMR32B0TCR_CRST                (1 << 1)           // When one, the Timer Counter and the Prescale Counter 0 are synchronously reset on the next positive edge of PCLK. The counters remain reset until TCR[1] is returned to zero.
-
-/* TMR32B0TC, address 0x4001 4008 and TMR32B1TC 0x4001 8008 */
-#define TMR32B0TC_TC_MASK              0xFFFFFFFF         // Timer counter value.
-#define TMR32B0TC_TC_SHIFT             0                 
-
-/* TMR32B0PR, address 0x4001 400C and TMR32B1PR 0x4001 800C */
-#define TMR32B0PR_PR_MASK              0xFFFFFFFF         // Prescale value.
-#define TMR32B0PR_PR_SHIFT             0                 
-
-/* TMR32B0PC, address 0x4001 4010 and TMR32B1PC 0x4001 8010 */
-#define TMR32B0PC_PC_MASK              0xFFFFFFFF         // Prescale counter value.
-#define TMR32B0PC_PC_SHIFT             0                 
-
-/* TMR32B0MCR - address 0x4001 4014 and TMR32B1MCR - address 0x4001 8014 */
-#define TMR32B0MCR_MR0I                (1 << 0)           // Interrupt on MR0: an interrupt is generated when MR0 matches the value in the TC.
-#define TMR32B0MCR_MR0R                (1 << 1)           // Reset on MR0: the TC will be reset if MR0 matches it.
-#define TMR32B0MCR_MR0S                (1 << 2)           // Stop on MR0: the TC and PC will be stopped and TCR[0] will be set to 0 if MR0 matches 0 the TC.
-#define TMR32B0MCR_MR1I                (1 << 3)           // Interrupt on MR1: an interrupt is generated when MR1 matches the value in the TC.
-#define TMR32B0MCR_MR1R                (1 << 4)           // Reset on MR1: the TC will be reset if MR1 matches it.
-#define TMR32B0MCR_MR1S                (1 << 5)           // Stop on MR1: the TC and PC will be stopped and TCR[0] will be set to 0 if MR1 matches 0 the TC.
-#define TMR32B0MCR_MR2I                (1 << 6)           // Interrupt on MR2: an interrupt is generated when MR2 matches the value in the TC.
-#define TMR32B0MCR_MR2R                (1 << 7)           // Reset on MR2: the TC will be reset if MR2 matches it.
-#define TMR32B0MCR_MR2S                (1 << 8)           // Stop on MR2: the TC and PC will be stopped and TCR[0] will be set to 0 if MR2 matches 0 the TC.
-#define TMR32B0MCR_MR3I                (1 << 9)           // Interrupt on MR3: an interrupt is generated when MR3 matches the value in the TC.
-#define TMR32B0MCR_MR3R                (1 << 10)          // Reset on MR3: the TC will be reset if MR3 matches it.
-#define TMR32B0MCR_MR3S                (1 << 11)          // Stop on MR3: the TC and PC will be stopped and TCR[0] will be set to 0 if MR3 matches 0 the TC.
-
-/* TMR32B0MR0 to 3, addresses 0x4001 4018 to 24 and TMR32B1MR0 to 3, addresses 0x4001 8018 to 24 */
-#define TMR32B0MRn_MATCH_MASK          0xFFFFFFFF         // Timer counter match value.
-#define TMR32B0MRn_MATCH_SHIFT         0                 
-
-/* TMR32B0CCR - address 0x4001 4028 and TMR32B1CCR - address 0x4001 8028 */
-#define TMR32B0CCR_CAP0RE              (1 << 0)           // Capture on CT32Bn_CAP0 rising edge: a sequence of 0 then 1 on CT32Bn_CAP0 will cause CR0 to be loaded with the contents of TC.
-#define TMR32B0CCR_CAP0FE              (1 << 1)           // Capture on CT32Bn_CAP0 falling edge: a sequence of 1 then 0 on CT32Bn_CAP0 will 0 cause CR0 to be loaded with the contents of TC.
-#define TMR32B0CCR_CAP0I               (1 << 2)           // Interrupt on CT32Bn_CAP0 event: a CR0 load due to a CT32Bn_CAP0 event will generate an interrupt.
-
-/* TMR32B0CR0, addresses 0x4001 402C and TMR32B1CR0, addresses 0x4001 802C */
-#define TMR32B0CR0_CAP_MASK            0xFFFFFFFF         // Timer counter capture value.
-#define TMR32B0CR0_CAP_SHIFT           0                 
-
-/* TMR32B0EMR - address 0x4001 403C and TMR32B1EMR - address0x4001 803C */
-#define TMR32B0EMR_EM0                 (1 << 0)           // External Match 0. This bit reflects the state of output CT32Bn_MAT0, whether or not this 0 output is connected to its pin. When a match occurs between the TC and MR0, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[5:4] control the functionality of this output. This bit is driven to the CT32B0_MAT0/CT16B1_MAT0 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
-#define TMR32B0EMR_EM1                 (1 << 1)           // External Match 1. This bit reflects the state of output CT32Bn_MAT1, whether or not this 0 output is connected to its pin. When a match occurs between the TC and MR1, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[7:6] control the functionality of this output. This bit is driven to the CT32B0_MAT1/CT16B1_MAT1 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
-#define TMR32B0EMR_EM2                 (1 << 2)           // External Match 2. This bit reflects the state of output CT32Bn_MAT2, whether or not this 0 output is connected to its pin. When a match occurs between the TC and MR2, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[9:8] control the functionality of this output. This bit is driven to the CT32B0_MAT2/CT16B1_MAT2 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
-#define TMR32B0EMR_EM3                 (1 << 3)           // External Match 3. This bit reflects the state of output CT32Bn_MAT3, whether or not this output is connected to its pin. When a match occurs between the TC and MR3, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[11:10] control the functionality of this output. This bit is driven to the CT32B0_MAT3/CT16B1_MAT3 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
-#define TMR32B0EMR_EMC0_MASK           0x0030             // External Match Control 0. Determines the functionality of External Match 0.
-#define TMR32B0EMR_EMC0_SHIFT          4                 
-#define TMR32B0EMR_EMC1_MASK           0x00C0             // External Match Control 1. Determines the functionality of External Match 1.
-#define TMR32B0EMR_EMC1_SHIFT          6                 
-#define TMR32B0EMR_EMC2_MASK           0x0300             // External Match Control 2. Determines the functionality of External Match 2.
-#define TMR32B0EMR_EMC2_SHIFT          8                 
-#define TMR32B0EMR_EMC3_MASK           0x0C00             // External Match Control 3. Determines the functionality of External Match 3.
-#define TMR32B0EMR_EMC3_SHIFT          10                
-
-/* TMR32B0CTCR - address 0x4001 4070 and TMR32B1TCR - address 0x4001 8070 */
-#define TMR32B0CTCR_CTM_MASK           0x0003             // Counter/Timer Mode. This field selects which rising PCLK edges can increment Timer's Prescale Counter (PC), or clear PC and increment Timer Counter (TC). Timer Mode: every rising PCLK edge
-#define TMR32B0CTCR_CTM_SHIFT          0                 
-#define TMR32B0CTCR_CIS_MASK           0x000C             // Count Input Select. When bits 1:0 in this register are not 00, these bits select which CAP pin is sampled for clocking:
-#define TMR32B0CTCR_CIS_SHIFT          2                 
-
-/* TMR32B0PWMC - 0x4001 4074 and TMR32B1PWMC - 0x4001 8074 */
-#define TMR32B0PWMC_PWMEN0             (1 << 0)           // PWM channel 0 enable
-#define TMR32B0PWMC_PWMEN1             (1 << 1)           // PWM channel 1 enable
-#define TMR32B0PWMC_PWMEN2             (1 << 2)           // PWM channel 2 enable
-#define TMR32B0PWMC_PWMEN3             (1 << 3)           // PWM channel 3 enable Note: It is recommended to use match channel 3 to set the PWM cycle.
-
-/* TMR32B0IR - address 0x4001 4000 and TMR32B1IR - address 0x4001 8000 */
-#define TMR32B0IR_MR0INT               (1 << 0)           // Interrupt flag for match channel 0.
-#define TMR32B0IR_MR1INT               (1 << 1)           // Interrupt flag for match channel 1.
-#define TMR32B0IR_MR2INT               (1 << 2)           // Interrupt flag for match channel 2.
-#define TMR32B0IR_MR3INT               (1 << 3)           // Interrupt flag for match channel 3.
-#define TMR32B0IR_CR0INT               (1 << 4)           // Interrupt flag for capture channel 0 event.
-#define TMR32B0IR_CR1INT               (1 << 5)           // Interrupt flag for capture channel 1 event.
-
-/* TMR32B0TCR - address 0x4001 4004 and TMR32B1TCR - address 0x4001 8004 */
-#define TMR32B0TCR_CEN                 (1 << 0)           // When one, the Timer Counter and Prescale Counter are 0 enabled for counting. When zero, the counters are disabled.
-#define TMR32B0TCR_CRST                (1 << 1)           // When one, the Timer Counter and the Prescale Counter 0 are synchronously reset on the next positive edge of PCLK. The counters remain reset until TCR[1] is returned to zero.
-
-/* TMR32B0TC, address 0x4001 4008 and TMR32B1TC 0x4001 8008 */
-#define TMR32B0TC_TC_MASK              0xFFFFFFFF         // Timer counter value.
-#define TMR32B0TC_TC_SHIFT             0                 
-
-/* TMR32B0PR, address 0x4001 400C and TMR32B1PR 0x4001 800C */
-#define TMR32B0PR_PR_MASK              0xFFFFFFFF         // Prescale value.
-#define TMR32B0PR_PR_SHIFT             0                 
-
-/* TMR32B0PC, address 0x4001 4010 and TMR32B1PC 0x4001 8010 */
-#define TMR32B0PC_PC_MASK              0xFFFFFFFF         // Prescale counter value.
-#define TMR32B0PC_PC_SHIFT             0                 
-
-/* TMR32B0MCR - address 0x4001 4014 and TMR32B1MCR - address 0x4001 8014 */
-#define TMR32B0MCR_MR0I                (1 << 0)           // Interrupt on MR0: an interrupt is generated when MR0 matches the value in the TC.
-#define TMR32B0MCR_MR0R                (1 << 1)           // Reset on MR0: the TC will be reset if MR0 matches it.
-#define TMR32B0MCR_MR0S                (1 << 2)           // Stop on MR0: the TC and PC will be stopped and TCR[0] will be set to 0 if MR0 matches 0 the TC.
-#define TMR32B0MCR_MR1I                (1 << 3)           // Interrupt on MR1: an interrupt is generated when MR1 matches the value in the TC.
-#define TMR32B0MCR_MR1R                (1 << 4)           // Reset on MR1: the TC will be reset if MR1 matches it.
-#define TMR32B0MCR_MR1S                (1 << 5)           // Stop on MR1: the TC and PC will be stopped and TCR[0] will be set to 0 if MR1 matches 0 the TC.
-#define TMR32B0MCR_MR2I                (1 << 6)           // Interrupt on MR2: an interrupt is generated when MR2 matches the value in the TC.
-#define TMR32B0MCR_MR2R                (1 << 7)           // Reset on MR2: the TC will be reset if MR2 matches it.
-#define TMR32B0MCR_MR2S                (1 << 8)           // Stop on MR2: the TC and PC will be stopped and TCR[0] will be set to 0 if MR2 matches 0 the TC.
-#define TMR32B0MCR_MR3I                (1 << 9)           // Interrupt on MR3: an interrupt is generated when MR3 matches the value in the TC.
-#define TMR32B0MCR_MR3R                (1 << 10)          // Reset on MR3: the TC will be reset if MR3 matches it.
-#define TMR32B0MCR_MR3S                (1 << 11)          // Stop on MR3: the TC and PC will be stopped and TCR[0] will be set to 0 if MR3 matches 0 the TC.
-
-/* TMR32B0MR0 to 3, addresses 0x4001 4018 to 24 and TMR32B1MR0 to 3, addresses 0x4001 8018 to 24 */
-#define TMR32B0MRn_MATCH_MASK          0xFFFFFFFF         // Timer counter match value.
-#define TMR32B0MRn_MATCH_SHIFT         0                 
-
-/* TMR32B0CCR - address 0x4001 4028 and TMR32B1CCR - address 0x4001 8028 */
-#define TMR32B0CCR_CAP0RE              (1 << 0)           // Capture on CT32Bn_CAP0 rising edge: a sequence of 0 then 1 on CT32Bn_CAP0 will cause CR0 to be loaded with the contents of TC.
-#define TMR32B0CCR_CAP0FE              (1 << 1)           // Capture on CT32Bn_CAP0 falling edge: a sequence of 1 then 0 on CT32Bn_CAP0 will 0 cause CR0 to be loaded with the contents of TC.
-#define TMR32B0CCR_CAP0I               (1 << 2)           // Interrupt on CT32Bn_CAP0 event: a CR0 load due to a CT32Bn_CAP0 event will generate an interrupt.
-#define TMR32B0CCR_CAP1RE              (1 << 3)           // Capture on CT32Bn_CAP1 rising edge: a sequence of 0 then 1 on CT32Bn_CAP1 will cause CR1 to be loaded with the contents of TC.
-#define TMR32B0CCR_CAP1FE              (1 << 4)           // Capture on CT32Bn_CAP1 falling edge: a sequence of 1 then 0 on CT32Bn_CAP1 will 0 cause CR1 to be loaded with the contents of TC.
-#define TMR32B0CCR_CAP1I               (1 << 5)           // Interrupt on CT32Bn_CAP1 event: a CR1 load due to a CT32Bn_CAP1 event will generate an interrupt.
-
-/* TMR32B0EMR - address 0x4001 403C and TMR32B1EMR - address0x4001 803C */
-#define TMR32B0EMR_EM0                 (1 << 0)           // External Match 0. This bit reflects the state of output CT32Bn_MAT0, whether or not this 0 output is connected to its pin. When a match occurs between the TC and MR0, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[5:4] control the functionality of this output. This bit is driven to the CT32B0_MAT0/CT16B1_MAT0 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
-#define TMR32B0EMR_EM1                 (1 << 1)           // External Match 1. This bit reflects the state of output CT32Bn_MAT1, whether or not this 0 output is connected to its pin. When a match occurs between the TC and MR1, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[7:6] control the functionality of this output. This bit is driven to the CT32B0_MAT1/CT16B1_MAT1 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
-#define TMR32B0EMR_EM2                 (1 << 2)           // External Match 2. This bit reflects the state of output CT32Bn_MAT2, whether or not this 0 output is connected to its pin. When a match occurs between the TC and MR2, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[9:8] control the functionality of this output. This bit is driven to the CT32B0_MAT2/CT16B1_MAT2 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
-#define TMR32B0EMR_EM3                 (1 << 3)           // External Match 3. This bit reflects the state of output CT32Bn_MAT3, whether or not this output is connected to its pin. When a match occurs between the TC and MR3, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[11:10] control the functionality of this output. This bit is driven to the CT32B0_MAT3/CT16B1_MAT3 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
-#define TMR32B0EMR_EMC0_MASK           0x0030             // External Match Control 0. Determines the functionality of External Match 0.
-#define TMR32B0EMR_EMC0_SHIFT          4                 
-#define TMR32B0EMR_EMC1_MASK           0x00C0             // External Match Control 1. Determines the functionality of External Match 1.
-#define TMR32B0EMR_EMC1_SHIFT          6                 
-#define TMR32B0EMR_EMC2_MASK           0x0300             // External Match Control 2. Determines the functionality of External Match 2.
-#define TMR32B0EMR_EMC2_SHIFT          8                 
-#define TMR32B0EMR_EMC3_MASK           0x0C00             // External Match Control 3. Determines the functionality of External Match 3.
-#define TMR32B0EMR_EMC3_SHIFT          10                
-
-/* TMR32B0CTCR - address 0x4001 4070 and TMR32B1TCR - address 0x4001 8070 */
-#define TMR32B0CTCR_CTM_MASK           0x0003             // Counter/Timer Mode. This field selects which rising PCLK edges can increment Timer's Prescale Counter (PC), or clear PC and increment Timer Counter (TC). Timer Mode: every rising PCLK edge
-#define TMR32B0CTCR_CTM_SHIFT          0                 
-#define TMR32B0CTCR_CIS_MASK           0x000C             // Count Input Select. When bits 1:0 in this register are not 00, these bits select which CAP pin is sampled for clocking:
-#define TMR32B0CTCR_CIS_SHIFT          2                 
-#define TMR32B0CTCR_ENCC               (1 << 4)           // Setting this bit to one enables clearing of the timer and the prescaler when the capture-edge event specified in bits 7:5 occurs.
-#define TMR32B0CTCR_SELCC_MASK         0x00E0             // When bit 4 is one, these bits select which capture input edge 0 will cause the timer and prescaler to be cleared. These bits have no effect when bit 4 is zero.
-#define TMR32B0CTCR_SELCC_SHIFT        5                 
-
-/* TMR32B0PWMC - 0x4001 4074 and TMR32B1PWMC - 0x4001 8074 */
-#define TMR32B0PWMC_PWMEN0             (1 << 0)           // PWM channel 0 enable
-#define TMR32B0PWMC_PWMEN1             (1 << 1)           // PWM channel 1 enable
-#define TMR32B0PWMC_PWMEN2             (1 << 2)           // PWM channel 2 enable
-#define TMR32B0PWMC_PWMEN3             (1 << 3)           // PWM channel 3 enable Note: It is recommended to use match channel 3 to set the PWM cycle.
-
-/* WDMOD - 0x4000 4000 */
-#define WDMOD_WDEN                     (1 << 0)           // Watchdog enable bit. This bit is Set Only. Remark: Setting this bit to one also locks the watchdog clock source. Once the watchdog timer is enabled, the watchdog timer clock source cannot be changed. If the watchdog timer is needed in Deep-sleep mode, the watchdog clock source must be changed to the watchdog oscillator before setting this bit to one.
-#define WDMOD_WDRESET                  (1 << 1)           // Watchdog reset enable bit. This bit is Set Only.
-#define WDMOD_WDTOF                    (1 << 2)           // Watchdog time-out flag. Set when the watchdog timer times out, by a feed error, or by events associated with WDPROTECT, cleared by software. Causes a chip reset if WDRESET = 1.
-#define WDMOD_WDINT                    (1 << 3)           // Watchdog interrupt flag. Set when the timer reaches the value in WDWARNINT. Cleared by software.
-#define WDMOD_WDPROTECT                (1 << 4)           // Watchdog update mode. This bit is Set Only.
-
-/* WDTC - 0x4000 4004 */
-#define WDTC_COUNT_MASK                0xFFFFFF           // Watchdog time-out interval.
-#define WDTC_COUNT_SHIFT               0                 
-
-/* WDFEED - 0x4000 4008 */
-#define WDFEED_FEED_MASK               0x00FF             // Feed value should be 0xAA followed by 0x55.
-#define WDFEED_FEED_SHIFT              0                 
-
-/* WDTV - 0x4000 400C */
-#define WDTV_COUNT_MASK                0xFFFFFF           // Counter timer value.
-#define WDTV_COUNT_SHIFT               0                 
-
-/* WDWARNINT - 0x4000 4014 */
-#define WDWARNINT_WARNINT_MASK         0x03FF             // Watchdog warning interrupt compare value.
-#define WDWARNINT_WARNINT_SHIFT        0                 
-
-/* WDWINDOW - 0x4000 4018 */
-#define WDWINDOW_WINDOW_MASK           0xFFFFFF           // Watchdog window value.
-#define WDWINDOW_WINDOW_SHIFT          0                 
-
-/* WDMOD - address 0x4000 4000 */
-#define WDMOD_WDEN                     (1 << 0)           // WDEN Watchdog enable bit (Set Only). When 1, the watchdog timer is running. Remark: Setting this bit to one also locks the watchdog clock source. Once the watchdog timer is enabled, the watchdog timer clock source cannot be changed. If the watchdog timer is needed in Deep-sleep mode, the watchdog clock source must be changed to the watchdog oscillator before setting this bit to one. The clock source lock feature is not available on all parts, see Section 23.1).
-#define WDMOD_WDRESET_WDRESET          (1 << 1)           // Watchdog reset enable bit (Set Only). When 1, og time-out will cause a chip reset.
-#define WDMOD_WDTOF                    (1 << 2)           // WDTOF Watchdog time-out flag. Set when the watchdog
-#define WDMOD_WDINT                    (1 << 3)           // WDINT Watchdog interrupt flag (Read Only, not clearable by software).
-
-/* WDTC - address 0x4000 4004 */
-#define WDTC_COUNT_MASK                0xFFFFFF           // Watchdog time-out interval.
-#define WDTC_COUNT_SHIFT               0                 
-
-/* WDFEED - address 0x4000 4008 */
-#define WDFEED_FEED_MASK               0x00FF             // Feed value should be 0xAA followed by 0x55.
-#define WDFEED_FEED_SHIFT              0                 
-
-/* WDTV - address 0x4000 000C */
-#define WDTV_COUNT_MASK                0xFFFFFF           // Counter timer value.
-#define WDTV_COUNT_SHIFT               0                 
-
-/* SYST_CSR - 0xE000 E010 */
-#define SYST_CSR_ENABLE                (1 << 0)           // System Tick counter enable. When 1, the counter is enabled. When 0, the counter is disabled.
-#define SYST_CSR_TICKINT               (1 << 1)           // System Tick interrupt enable. When 1, the System Tick interrupt 0 is enabled. When 0, the System Tick interrupt is disabled. When enabled, the interrupt is generated when the System Tick counter counts down to 0.
-#define SYST_CSR_CLKSOURCE             (1 << 2)           // System Tick clock source selection. When 1, the system clock (CPU) clock is selected. When 0, the system clock/2 is selected as the reference clock.
-#define SYST_CSR_COUNTFLAG             (1 << 16)          // Returns 1 if the SysTick timer counted to 0 since the last read of this register. Reserved, user software should not write ones to reserved bits. The value read from a reserved bit is not defined.
-
-/* SYST_RVR - 0xE000 E014 */
-#define SYST_RVR_RELOAD_MASK           0xFFFFFF           // This is the value that is loaded into the System Tick counter when it 0 counts down to 0.
-#define SYST_RVR_RELOAD_SHIFT          0                 
-
-/* SYST_CVR - 0xE000 E018 */
-#define SYST_CVR_CURRENT_MASK          0xFFFFFF           // Reading this register returns the current value of the System Tick counter. Writing any value clears the System Tick counter and the COUNTFLAG bit in STCTRL.
-#define SYST_CVR_CURRENT_SHIFT         0                 
-
-/* SYST_CALIB - 0xE000 E01C */
-#define SYST_CALIB_TENMS_MASK          0xFFFFFF           // See Table 461.
-#define SYST_CALIB_TENMS_SHIFT         0                 
-#define SYST_CALIB_SKEW                (1 << 30)          // See Table 461.
-#define SYST_CALIB_NOREF               (1 << 31)          // See Table 461.
-
-/* AD0CR - address 0x4001 C000 */
-#define AD0CR_SEL_MASK                 0x00FF             // Selects which of the AD7:0 pins is (are) to be sampled and converted. Bit 0 selects Pin           0x00 AD0, bit 1 selects pin AD1,..., and bit 7 selects pin AD7. In software-controlled mode (BURST = 0), only one channel can be selected, i.e. only one of these bits should be 1. In hardware scan mode (BURST = 1), any numbers of channels can be selected, i.e any or all bits can be set to 1. If all bits are set to 0, channel 0 is selected automatically (SEL = 0x01).
-#define AD0CR_SEL_SHIFT                0                 
-#define AD0CR_CLKDIV_MASK              0xFF00             // The APB clock (PCLK) is divided by CLKDIV +1 to produce the clock for the ADC, which 0 should be less than or equal to 4.5 MHz. Typically, software should program the smallest value in this field that yields a clock of 4.5 MHz or slightly less, but in certain cases (such as a high-impedance analog source) a slower clock may be desirable.
-#define AD0CR_CLKDIV_SHIFT             8                 
-#define AD0CR_BURST                    (1 << 16)          // Burst mode Remark: If BURST is set to 1, the ADGINTEN bit in the AD0INTEN register (Table 365) must be set to 0.
-#define AD0CR_CLKS_MASK                0xE0000            // This field selects the number of clocks used for each conversion in Burst mode, and the number of bits of accuracy of the result in the LS bits of ADDR, between 11 clocks (10 bits) and 4 clocks (3 bits).
-#define AD0CR_CLKS_SHIFT               17                
-#define AD0CR_START_MASK               0x7000000          // When the BURST bit is 0, these bits control whether and when an A/D conversion is started:
-#define AD0CR_START_SHIFT              24                
-#define AD0CR_EDGE                     (1 << 27)          // This bit is significant only when the START field contains 010-111. In these cases:
-
-/* AD0GDR - address 0x4001 C004 */
-#define AD0GDR_V_VREF_MASK             0xFFC0             // When DONE is 1, this field contains a binary fraction representing X the voltage on the ADn pin selected by the SEL field, divided by the voltage on the VDD pin. Zero in the field indicates that the voltage on the ADn pin was less than, equal to, or close to that on VSS, while 0x3FF indicates that the voltage on ADn was close to, equal to, or greater than that on VREF.
-#define AD0GDR_V_VREF_SHIFT            6                 
-#define AD0GDR_CHN_MASK                0x7000000          // These bits contain the channel from which the result bits V_VREF X were converted.
-#define AD0GDR_CHN_SHIFT               24                
-#define AD0GDR_OVERRUN                 (1 << 30)          // This bit is 1 in burst mode if the results of one or more conversions 0 was (were) lost and overwritten before the conversion that produced the result in the V_VREF bits.
-#define AD0GDR_DONE                    (1 << 31)          // This bit is set to 1 when an A/D conversion completes. It is cleared 0 when this register is read and when the ADCR is written. If the ADCR is written while a conversion is still in progress, this bit is set and a new conversion is started.
-
-/* AD0INTEN - address 0x4001 C00C */
-#define AD0INTEN_ADINTEN_MASK          0x00FF             // These bits allow control over which A/D channels generate             0x00 interrupts for conversion completion. When bit 0 is one, completion of a conversion on A/D channel 0 will generate an interrupt, when bit 1 is one, completion of a conversion on A/D channel 1 will generate an interrupt, etc.
-#define AD0INTEN_ADINTEN_SHIFT         0                 
-#define AD0INTEN_ADGINTEN              (1 << 8)           // When 1, enables the global DONE flag in ADDR to generate an interrupt. When 0, only the individual A/D channels enabled by ADINTEN 7:0 will generate interrupts. Remark: This bit must be set to 0 in burst mode (BURST = 1 in the AD0CR register). Reserved. Unused, always 0.
-
-/* AD0DR0 to AD0DR7 - addresses 0x4001 C010 to 0x4001 C02C */
-#define AD0DRn_V_VREF_MASK             0xFFC0             // When DONE is 1, this field contains a binary fraction representing the NA voltage on the ADn pin, divided by the voltage on the VREF pin. Zero in the field indicates that the voltage on the ADn pin was less than, equal to, or close to that on VREF, while 0x3FF indicates that the voltage on AD input was close to, equal to, or greater than that on VREF. Reserved.
-#define AD0DRn_V_VREF_SHIFT            6                 
-#define AD0DRn_OVERRUN                 (1 << 30)          // This bit is 1 in burst mode if the results of one or more conversions was (were) lost and overwritten before the conversion that produced the result in the V_VREF bits.This bit is cleared by reading this register.
-#define AD0DRn_DONE                    (1 << 31)          // This bit is set to 1 when an A/D conversion completes. It is cleared when this register is read.
-
-/* AD0STAT - address 0x4001 C030 */
-#define AD0STAT_DONE_MASK              0x00FF             // These bits mirror the DONE status flags that appear in the result register for each A/D channel n.
-#define AD0STAT_DONE_SHIFT             0                 
-#define AD0STAT_OVERRUN_MASK           0xFF00             // These bits mirror the OVERRRUN status flags that appear in the result register for each A/D channel n. Reading ADSTAT allows checking the status of all A/D channels simultaneously.
-#define AD0STAT_OVERRUN_SHIFT          8                 
-#define AD0STAT_ADINT                  (1 << 16)          // This bit is the A/D interrupt flag. It is one when any of the individual A/D channel Done flags is asserted and enabled to contribute to the A/D interrupt via the ADINTEN register. Reserved. Unused, always 0.
-
-/* FLASHCFG, address 0x4003 C010 */
-#define FLASHCFG_FLASHTIM_MASK         0x0003             // Flash memory access time. FLASHTIM +1 is equal to the number of system clocks used for flash access.
-#define FLASHCFG_FLASHTIM_SHIFT        0                 
-
-/* FMSSTART - 0x4003 C020 */
-#define FMSSTART_START_MASK            0x1FFFF            // Signature generation start address (corresponds to AHB byte address bits[20:4]).
-#define FMSSTART_START_SHIFT           0                 
-
-/* FMSSTOP - 0x4003 C024 */
-#define FMSSTOP_STOP_MASK              0x1FFFF            // BIST stop address divided by 16 (corresponds to AHB byte address [20:4]).
-#define FMSSTOP_STOP_SHIFT             0                 
-#define FMSSTOP_SIG_START              (1 << 17)          // Start control bit for signature generation.
-
-/* FMSTAT - 0x4003 CFE0 */
-#define FMSTAT_SIG_DONE                (1 << 2)           // When 1, a previously started signature generation has           0 completed. See FMSTATCLR register description for clearing this flag.
-
-/* FMSTATCLR - 0x0x4003 CFE8 */
-#define FMSTATCLR_SIG_DONE_CLR         (1 << 2)           // Writing a 1 to this bits clears the signature generation completion flag (SIG_DONE) in the FMSTAT register.
-
-
-#endif
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/cmsis.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-/* mbed Microcontroller Library - CMSIS
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * A generic CMSIS include header, pulling in LPC11U24 specifics
- */
-
-#ifndef MBED_CMSIS_H
-#define MBED_CMSIS_H
-
-#include "LPC11xx.h"
-#include "cmsis_nvic.h"
-#include "bitfields.h"
-
-#endif
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/cmsis_nvic.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic for LPC11U24
- * Copyright (c) 2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */ 
-
-#include "cmsis_nvic.h"
-
-/* In the M0, there is no VTOR. In the LPC range such as the LPC11U,
- * whilst the vector table may only be something like 48 entries (192 bytes, 0xC0), 
- * the SYSMEMREMAP register actually remaps the memory from 0x10000000-0x100001FF 
- * to adress 0x0-0x1FF. In this case, RAM can be addressed at both 0x10000000 and 0x0
- * 
- * If we just copy the vectors to RAM and switch the SYSMEMMAP, any accesses to FLASH
- * above the vector table before 0x200 will actually go to RAM. So we need to provide 
- * a solution where the compiler gets the right results based on the memory map
- *
- * Option 1 - We allocate and copy 0x200 of RAM rather than just the table
- *  - const data and instructions before 0x200 will be copied to and fetched/exec from RAM
- *  - RAM overhead: 0x200 - 0xC0 = 320 bytes, FLASH overhead: 0
- * 
- * Option 2 - We pad the flash to 0x200 to ensure the compiler doesn't allocate anything there  
- *  - No flash accesses will go to ram, as there will be nothing there
- *  - RAM only needs to be allocated for the vectors, as all other ram addresses are normal
- *  - RAM overhead: 0, FLASH overhead: 320 bytes
- *
- * Option 2 is the one to go for, as RAM is the most valuable resource
- */
-
-#define NVIC_RAM_VECTOR_ADDRESS (0x10000000)  // Vectors positioned at start of RAM
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
-    int i;
-    // Space for dynamic vectors, initialised to allocate in R/W
-    static volatile uint32_t* vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
-
-    // Copy and switch to dynamic vectors if first time called
-    if((LPC_SYSCON->SYSMEMREMAP & 0x3) != 0x1) {     
-      uint32_t *old_vectors = (uint32_t *)0;         // FLASH vectors are at 0x0
-      for(i = 0; i < NVIC_NUM_VECTORS; i++) {    
-            vectors[i] = old_vectors[i];
-        }
-        LPC_SYSCON->SYSMEMREMAP = 0x1; // Remaps 0x0-0x1FF FLASH block to RAM block
-    }
-
-    // Set the vector 
-    vectors[IRQn + 16] = vector; 
-}
-
-uint32_t NVIC_GetVector(IRQn_Type IRQn) {
-    // We can always read vectors at 0x0, as the addresses are remapped
-    uint32_t *vectors = (uint32_t*)0; 
-
-    // Return the vector
-    return vectors[IRQn + 16];
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/cmsis_nvic.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */ 
-
-#ifndef MBED_CMSIS_NVIC_H
-#define MBED_CMSIS_NVIC_H
-
-#include "cmsis.h"
-
-#define NVIC_NUM_VECTORS      (16 + 32)   // CORE + MCU Peripherals
-#define NVIC_USER_IRQ_OFFSET  16
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
-uint32_t NVIC_GetVector(IRQn_Type IRQn);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/system_LPC11xx.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/**************************************************************************//**
- * @file     system_LPC11xx.h
- * @brief    CMSIS Cortex-M0 Device Peripheral Access Layer Header File
- *           for the NXP LPC11xx/LPC11Cxx Device Series
- * @version  V1.10
- * @date     24. November 2010
- *
- * @note
- * Copyright (C) 2009-2010 ARM Limited. All rights reserved.
- *
- * @par
- * ARM Limited (ARM) is supplying this software for use with Cortex-M 
- * processor based microcontrollers.  This file can be freely distributed 
- * within development tools that are supporting such ARM based processors. 
- *
- * @par
- * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- *
- ******************************************************************************/
-
-
-#ifndef __SYSTEM_LPC11xx_H
-#define __SYSTEM_LPC11xx_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-extern uint32_t SystemCoreClock;     /*!< System Clock Frequency (Core Clock)  */
-
-
-/**
- * Initialize the system
- *
- * @param  none
- * @return none
- *
- * @brief  Setup the microcontroller system.
- *         Initialize the System and update the SystemCoreClock variable.
- */
-extern void SystemInit (void);
-
-/**
- * Update SystemCoreClock variable
- *
- * @param  none
- * @return none
- *
- * @brief  Updates the SystemCoreClock with current core Clock 
- *         retrieved from cpu registers.
- */
-extern void SystemCoreClockUpdate (void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __SYSTEM_LPC11xx_H */
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC13XX/LPC13Uxx.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,776 +0,0 @@
-
-/****************************************************************************************************//**
- * @file     LPC13Uxx.h
- *
- * 
- *
- * @brief    CMSIS Cortex-M3 Core Peripheral Access Layer Header File for
- *           default LPC13Uxx Device Series
- *
- * @version  V0.1
- * @date     18. Jan 2012
- *
- * @note     Generated with SFDGen V2.6 Build 4f  on Tuesday, 17.01.2012 13:39:52
- *
- *           from CMSIS SVD File 'LPC13uxx_svd_v0.1.xml' Version 0.1,
- *           created on Thurs, 01.19.2012 15:13:15, last modified on Thurs, 01.19.2012 15:53:09
- *
- *******************************************************************************************************/
-
-/** @addtogroup NXP
-  * @{
-  */
-
-/** @addtogroup LPC13Uxx
-  * @{
-  */
-
-#ifndef __LPC13UXX_H__
-#define __LPC13UXX_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-
-#if defined ( __CC_ARM   )
-  #pragma anon_unions
-#endif
-
- /* Interrupt Number Definition */
-
-typedef enum {
-// -------------------------  Cortex-M3 Processor Exceptions Numbers  -----------------------------
-  Reset_IRQn                        = -15,  /*!<   1  Reset Vector, invoked on Power up and warm reset */
-  NonMaskableInt_IRQn               = -14,  /*!<   2  Non maskable Interrupt, cannot be stopped or preempted */
-  HardFault_IRQn                    = -13,  /*!<   3  Hard Fault, all classes of Fault */
-  MemoryManagement_IRQn             = -12,  /*!<   4  Memory Management, MPU mismatch, including Access Violation and No Match */
-  BusFault_IRQn                     = -11,  /*!<   5  Bus Fault, Pre-Fetch-, Memory Access Fault, other address/memory related Fault */
-  UsageFault_IRQn                   = -10,  /*!<   6  Usage Fault, i.e. Undef Instruction, Illegal State Transition */
-  SVCall_IRQn                       = -5,   /*!<  11  System Service Call via SVC instruction */
-  DebugMonitor_IRQn                 = -4,   /*!<  12  Debug Monitor                    */
-  PendSV_IRQn                       = -2,   /*!<  14  Pendable request for system service */
-  SysTick_IRQn                      = -1,   /*!<  15  System Tick Timer                */
-// ----------------------------  LPC13Uxx Specific Interrupt Numbers  --------------------------------
-  PIN_INT0_IRQn                     = 0,    /*!<   0  PIN_INT0                         */
-  PIN_INT1_IRQn                     = 1,    /*!<   1  PIN_INT1                         */
-  PIN_INT2_IRQn                     = 2,    /*!<   2  PIN_INT2                         */
-  PIN_INT3_IRQn                     = 3,    /*!<   3  PIN_INT3                         */
-  PIN_INT4_IRQn                     = 4,    /*!<   4  PIN_INT4                         */
-  PIN_INT5_IRQn                     = 5,    /*!<   5  PIN_INT5                         */
-  PIN_INT6_IRQn                     = 6,    /*!<   6  PIN_INT6                         */
-  PIN_INT7_IRQn                     = 7,    /*!<   7  PIN_INT7                         */
-  GINT0_IRQn                        = 8,    /*!<   8  GINT0                            */
-  GINT1_IRQn                        = 9,    /*!<   9  GINT1                            */
-  Reserved0_IRQn                    = 10,   /*!<  10  Reserved Interrupt               */
-  Reserved1_IRQn                    = 11,   /*!<  11  Reserved Interrupt               */
-  RIT_IRQn                          = 12,   /*!<  12  Repetitive Interrupt Timer       */
-  Reserved2_IRQn                    = 13,   /*!<  13  Reserved Interrupt               */
-  SSP1_IRQn                         = 14,   /*!<  14  SSP1                             */
-  I2C_IRQn                          = 15,   /*!<  15  I2C                              */
-  CT16B0_IRQn                       = 16,   /*!<  16  CT16B0                           */
-  CT16B1_IRQn                       = 17,   /*!<  17  CT16B1                           */
-  CT32B0_IRQn                       = 18,   /*!<  18  CT32B0                           */
-  CT32B1_IRQn                       = 19,   /*!<  19  CT32B1                           */
-  SSP0_IRQn                         = 20,   /*!<  20  SSP0                             */
-  USART_IRQn                        = 21,   /*!<  21  USART                            */
-  USB_IRQ_IRQn                      = 22,   /*!<  22  USB_IRQ                          */
-  USB_FIQ_IRQn                      = 23,   /*!<  23  USB_FIQ                          */
-  ADC_IRQn                          = 24,   /*!<  24  ADC                              */
-  WDT_IRQn                          = 25,   /*!<  25  WDT                              */
-  BOD_IRQn                          = 26,   /*!<  26  BOD                              */
-  FMC_IRQn                          = 27,   /*!<  27  FMC                              */
-  Reserved3_IRQn                    = 28,   /*!<  28  Reserved Interrupt               */
-  Reserved4_IRQn                    = 29,   /*!<  29  Reserved Interrupt               */
-  USBWAKEUP_IRQn                    = 30,   /*!<  30  USBWAKEUP                        */
-  Reserved5_IRQn                    = 31,   /*!<  31  Reserved Interrupt               */
-} IRQn_Type;
-
-
-/** @addtogroup Configuration_of_CMSIS
-  * @{
-  */
-
-/* Processor and Core Peripheral Section */ /* Configuration of the Cortex-M3 Processor and Core Peripherals */
-
-#define __CM3_REV              0x0000       /*!< 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 */
-/** @} */ /* End of group Configuration_of_CMSIS */
-
-#include <core_cm3.h>                       /*!< Cortex-M3 processor and core peripherals */
-#include "system_LPC13Uxx.h"                /*!< LPC13Uxx System                          */
-
-/** @addtogroup Device_Peripheral_Registers
-  * @{
-  */
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                          I2C                                         -----
-// ------------------------------------------------------------------------------------------------
-
-
-
-typedef struct {                            /*!< (@ 0x40000000) I2C Structure          */
-  __IO uint32_t CONSET;                     /*!< (@ 0x40000000) I2C Control Set Register. When a one is written to a bit of this register, the corresponding bit in the I2C control register is set. Writing a zero has no effect on the corresponding bit in the I2C control register. */
-  __I  uint32_t STAT;                       /*!< (@ 0x40000004) I2C Status Register. During I2C operation, this register provides detailed status codes that allow software to determine the next action needed. */
-  __IO uint32_t DAT;                        /*!< (@ 0x40000008) I2C Data Register. During master or slave transmit mode, data to be transmitted is written to this register. During master or slave receive mode, data that has been received may be read from this register. */
-  __IO uint32_t ADR0;                       /*!< (@ 0x4000000C) I2C Slave Address Register 0. Contains the 7-bit slave address for operation of the I2C interface in slave mode, and is not used in master mode. The least significant bit determines whether a slave responds to the General Call address. */
-  __IO uint32_t SCLH;                       /*!< (@ 0x40000010) SCH Duty Cycle Register High Half Word. Determines the high time of the I2C clock. */
-  __IO uint32_t SCLL;                       /*!< (@ 0x40000014) SCL Duty Cycle Register Low Half Word. Determines the low time of the I2C clock. I2nSCLL and I2nSCLH together determine the clock frequency generated by an I2C master and certain times used in slave mode. */
-  __O  uint32_t CONCLR;                     /*!< (@ 0x40000018) I2C Control Clear Register. When a one is written to a bit of this register, the corresponding bit in the I2C control register is cleared. Writing a zero has no effect on the corresponding bit in the I2C control register. */
-  __IO uint32_t MMCTRL;                     /*!< (@ 0x4000001C) Monitor mode control register. */
-  union{
-  __IO uint32_t ADR[3];                     /*!< (@ 0x40000020) I2C Slave Address Register. Contains the 7-bit slave address for operation of the I2C interface in slave mode, and is not used in master mode. The least significant bit determines whether a slave responds to the General Call address. */
-  struct{
-  __IO uint32_t ADR1;
-  __IO uint32_t ADR2;
-  __IO uint32_t ADR3;
-  };
-  };
-  __I  uint32_t DATA_BUFFER;                /*!< (@ 0x4000002C) Data buffer register. The contents of the 8 MSBs of the I2DAT shift register will be transferred to the DATA_BUFFER automatically after every nine bits (8 bits of data plus ACK or NACK) has been received on the bus. */
-  union{
-  __IO uint32_t MASK[4];                    /*!< (@ 0x40000030) I2C Slave address mask register. This mask register is associated with I2ADR0 to determine an address match. The mask register has no effect when comparing to the General Call address (0000000). */
-  struct{
-  __IO uint32_t MASK0;
-  __IO uint32_t MASK1;
-  __IO uint32_t MASK2;
-  __IO uint32_t MASK3;
-  };
-  };
-} LPC_I2C_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                         WWDT                                         -----
-// ------------------------------------------------------------------------------------------------
-
-
-typedef struct {                            /*!< (@ 0x40004000) WWDT Structure         */
-  __IO uint32_t MOD;                        /*!< (@ 0x40004000) Watchdog mode register. This register contains the basic mode and status of the Watchdog Timer. */
-  __IO uint32_t TC;                         /*!< (@ 0x40004004) Watchdog timer constant register. This 24-bit register determines the time-out value. */
-  __O  uint32_t FEED;                       /*!< (@ 0x40004008) 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;                         /*!< (@ 0x4000400C) Watchdog timer value register. This 24-bit register reads out the current value of the Watchdog timer. */
-  __IO uint32_t CLKSEL;                     /*!< (@ 0x40004010) Watchdog clock select register. */
-  __IO uint32_t WARNINT;                    /*!< (@ 0x40004014) Watchdog Warning Interrupt compare value. */
-  __IO uint32_t WINDOW;                     /*!< (@ 0x40004018) Watchdog Window compare value. */
-} LPC_WWDT_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                         USART                                        -----
-// ------------------------------------------------------------------------------------------------
-
-
-typedef struct {                            /*!< (@ 0x40008000) USART Structure        */
-  
-  union {
-    __IO uint32_t DLL;                      /*!< (@ 0x40008000) Divisor Latch LSB. Least significant byte of the baud rate divisor value. The full divisor is used to generate a baud rate from the fractional rate divider. (DLAB=1) */
-    __O  uint32_t THR;                      /*!< (@ 0x40008000) Transmit Holding Register. The next character to be transmitted is written here. (DLAB=0) */
-    __I  uint32_t RBR;                      /*!< (@ 0x40008000) Receiver Buffer Register. Contains the next received character to be read. (DLAB=0) */
-  };
-  
-  union {
-    __IO uint32_t IER;                      /*!< (@ 0x40008004) Interrupt Enable Register. Contains individual interrupt enable bits for the 7 potential USART interrupts. (DLAB=0) */
-    __IO uint32_t DLM;                      /*!< (@ 0x40008004) Divisor Latch MSB. Most significant byte of the baud rate divisor value. The full divisor is used to generate a baud rate from the fractional rate divider. (DLAB=1) */
-  };
-  
-  union {
-    __O  uint32_t FCR;                      /*!< (@ 0x40008008) FIFO Control Register. Controls USART FIFO usage and modes. */
-    __I  uint32_t IIR;                      /*!< (@ 0x40008008) Interrupt ID Register. Identifies which interrupt(s) are pending. */
-  };
-  __IO uint32_t LCR;                        /*!< (@ 0x4000800C) Line Control Register. Contains controls for frame formatting and break generation. */
-  __IO uint32_t MCR;                        /*!< (@ 0x40008010) Modem Control Register. */
-  __I  uint32_t LSR;                        /*!< (@ 0x40008014) Line Status Register. Contains flags for transmit and receive status, including line errors. */
-  __I  uint32_t MSR;                        /*!< (@ 0x40008018) Modem Status Register. */
-  __IO uint32_t SCR;                        /*!< (@ 0x4000801C) Scratch Pad Register. Eight-bit temporary storage for software. */
-  __IO uint32_t ACR;                        /*!< (@ 0x40008020) Auto-baud Control Register. Contains controls for the auto-baud feature. */
-  __IO uint32_t ICR;                        /*!< (@ 0x40008024) IrDA Control Register. Enables and configures the IrDA (remote control) mode. */
-  __IO uint32_t FDR;                        /*!< (@ 0x40008028) Fractional Divider Register. Generates a clock input for the baud rate divider. */
-  __IO uint32_t OSR;                        /*!< (@ 0x4000802C) Oversampling Register. Controls the degree of oversampling during each bit time. */
-  __IO uint32_t TER;                        /*!< (@ 0x40008030) Transmit Enable Register. Turns off USART transmitter for use with software flow control. */
-  __I  uint32_t RESERVED0[3];
-  __IO uint32_t HDEN;                       /*!< (@ 0x40008040) Half duplex enable register. */
-  __I  uint32_t RESERVED1;
-  __IO uint32_t SCICTRL;                    /*!< (@ 0x40008048) Smart Card Interface Control register. Enables and configures the Smart Card Interface feature. */
-  __IO uint32_t RS485CTRL;                  /*!< (@ 0x4000804C) RS-485/EIA-485 Control. Contains controls to configure various aspects of RS-485/EIA-485 modes. */
-  __IO uint32_t RS485ADRMATCH;              /*!< (@ 0x40008050) RS-485/EIA-485 address match. Contains the address match value for RS-485/EIA-485 mode. */
-  __IO uint32_t RS485DLY;                   /*!< (@ 0x40008054) RS-485/EIA-485 direction control delay. */
-  __IO uint32_t SYNCCTRL;                   /*!< (@ 0x40008058) Synchronous mode control register. */
-} LPC_USART_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                        CT16B0                                        -----
-// ------------------------------------------------------------------------------------------------
-
-typedef struct {                            /*!< (@ 0x4000C000) LPC_CTxxBx_Type Structure       */
-  __IO uint32_t IR;                         /*!< (@ 0x4000C000) Interrupt Register. The IR can be written to clear interrupts. The IR can be read to identify which of eight possible interrupt sources are pending. */
-  __IO uint32_t TCR;                        /*!< (@ 0x4000C004) Timer Control Register. The TCR is used to control the Timer Counter functions. The Timer Counter can be disabled or reset through the TCR. */
-  __IO uint32_t TC;                         /*!< (@ 0x4000C008) Timer Counter. The 16-bit TC is incremented every PR+1 cycles of PCLK. The TC is controlled through the TCR. */
-  __IO uint32_t PR;                         /*!< (@ 0x4000C00C) Prescale Register. When the Prescale Counter (below) is equal to this value, the next clock increments the TC and clears the PC. */
-  __IO uint32_t PC;                         /*!< (@ 0x4000C010) Prescale Counter. The 16-bit PC is a counter which is incremented to the value stored in PR. When the value in PR is reached, the TC is incremented and the PC is cleared. The PC is observable and controllable through the bus interface. */
-  __IO uint32_t MCR;                        /*!< (@ 0x4000C014) Match Control Register. The MCR is used to control if an interrupt is generated and if the TC is reset when a Match occurs. */
-  union {
-  __IO uint32_t MR[4];                      /*!< (@ 0x4000C018) Match Register. MR can be enabled through the MCR to reset the TC, stop both the TC and PC, and/or generate an interrupt every time MR matches the TC. */
-  struct{
-  __IO uint32_t MR0;                        /*!< (@ 0x4000C018) Match Register. MR0 */
-  __IO uint32_t MR1;                        /*!< (@ 0x4000C01C) Match Register. MR1 */
-  __IO uint32_t MR2;                        /*!< (@ 0x4000C020) Match Register. MR2 */
-  __IO uint32_t MR3;                        /*!< (@ 0x4000C024) Match Register. MR3 */
-  };
-  };
-  __IO uint32_t CCR;                        /*!< (@ 0x4000C028) Capture Control Register. The CCR controls which edges of the capture inputs are used to load the Capture Registers and whether or not an interrupt is generated when a capture takes place. */
-  union{
-  __I  uint32_t CR[4];                      /*!< (@ 0x4000C02C) Capture Register. CR is loaded with the value of TC when there is an event on the CT16B0_CAP input. */
-    struct{
-  __I  uint32_t CR0;                        /*!< (@ 0x4000C02C) Capture Register. CR 0 */
-  __I  uint32_t CR1;                        /*!< (@ 0x4000C030) Capture Register. CR 1 */
-  __I  uint32_t CR2;                        /*!< (@ 0x4000C034) Capture Register. CR 2 */
-  __I  uint32_t CR3;                        /*!< (@ 0x4000C038) Capture Register. CR 3 */
-  };
-  };
-  __IO uint32_t EMR;                        /*!< (@ 0x4000C03C) External Match Register. The EMR controls the match function and the external match pins  */
-  __I  uint32_t RESERVED0[12];
-  __IO uint32_t CTCR;                       /*!< (@ 0x4000C070) Count Control Register. The CTCR selects between Timer and Counter mode, and in Counter mode selects the signal and edge(s) for counting. */
-  __IO uint32_t PWMC;                       /*!< (@ 0x4000C074) PWM Control Register. The PWMCON enables PWM mode for the external match pins CT16B0_MAT[1:0] and CT16B1_MAT[1:0]. */
-} LPC_CTxxBx_Type;
-
-typedef struct {                            /*!< (@ 0x4000C000) CT16B0 Structure       */
-  __IO uint32_t IR;                         /*!< (@ 0x4000C000) Interrupt Register. The IR can be written to clear interrupts. The IR can be read to identify which of eight possible interrupt sources are pending. */
-  __IO uint32_t TCR;                        /*!< (@ 0x4000C004) Timer Control Register. The TCR is used to control the Timer Counter functions. The Timer Counter can be disabled or reset through the TCR. */
-  __IO uint32_t TC;                         /*!< (@ 0x4000C008) Timer Counter. The 16-bit TC is incremented every PR+1 cycles of PCLK. The TC is controlled through the TCR. */
-  __IO uint32_t PR;                         /*!< (@ 0x4000C00C) Prescale Register. When the Prescale Counter (below) is equal to this value, the next clock increments the TC and clears the PC. */
-  __IO uint32_t PC;                         /*!< (@ 0x4000C010) Prescale Counter. The 16-bit PC is a counter which is incremented to the value stored in PR. When the value in PR is reached, the TC is incremented and the PC is cleared. The PC is observable and controllable through the bus interface. */
-  __IO uint32_t MCR;                        /*!< (@ 0x4000C014) Match Control Register. The MCR is used to control if an interrupt is generated and if the TC is reset when a Match occurs. */
-  union {
-  __IO uint32_t MR[4];                      /*!< (@ 0x4000C018) Match Register. MR can be enabled through the MCR to reset the TC, stop both the TC and PC, and/or generate an interrupt every time MR matches the TC. */
-  struct{
-  __IO uint32_t MR0;                        /*!< (@ 0x4000C018) Match Register. MR0 */
-  __IO uint32_t MR1;                        /*!< (@ 0x4000C01C) Match Register. MR1 */
-  __IO uint32_t MR2;                        /*!< (@ 0x4000C020) Match Register. MR2 */
-  __IO uint32_t MR3;                        /*!< (@ 0x4000C024) Match Register. MR3 */
-  };
-  };
-  __IO uint32_t CCR;                        /*!< (@ 0x4000C028) Capture Control Register. The CCR controls which edges of the capture inputs are used to load the Capture Registers and whether or not an interrupt is generated when a capture takes place. */
-  union{
-  __I  uint32_t CR[4];                      /*!< (@ 0x4000C02C) Capture Register. CR is loaded with the value of TC when there is an event on the CT16B0_CAP input. */
-    struct{
-  __I  uint32_t CR0;			            /*!< (@ 0x4000C02C) Capture Register. CR 0 */
-  __I  uint32_t CR1;			            /*!< (@ 0x4000C030) Capture Register. CR 1 */
-  __I  uint32_t CR2;			            /*!< (@ 0x4000C034) Capture Register. CR 2 */
-  __I  uint32_t CR3;			            /*!< (@ 0x4000C038) Capture Register. CR 3 */
-  };
-  };
-  __IO uint32_t EMR;                        /*!< (@ 0x4000C03C) External Match Register. The EMR controls the match function and the external match pins  */
-  __I  uint32_t RESERVED0[12];
-  __IO uint32_t CTCR;                       /*!< (@ 0x4000C070) Count Control Register. The CTCR selects between Timer and Counter mode, and in Counter mode selects the signal and edge(s) for counting. */
-  __IO uint32_t PWMC;                       /*!< (@ 0x4000C074) PWM Control Register. The PWMCON enables PWM mode for the external match pins CT16B0_MAT[1:0] and CT16B1_MAT[1:0]. */
-} LPC_CT16B0_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                        CT16B1                                        -----
-// ------------------------------------------------------------------------------------------------
-
-typedef struct {                            /*!< (@ 0x40010000) CT16B1 Structure       */
-  __IO uint32_t IR;                         /*!< (@ 0x40010000) Interrupt Register. The IR can be written to clear interrupts. The IR can be read to identify which of eight possible interrupt sources are pending. */
-  __IO uint32_t TCR;                        /*!< (@ 0x40010004) Timer Control Register. The TCR is used to control the Timer Counter functions. The Timer Counter can be disabled or reset through the TCR. */
-  __IO uint32_t TC;                         /*!< (@ 0x40010008) Timer Counter. The 16-bit TC is incremented every PR+1 cycles of PCLK. The TC is controlled through the TCR. */
-  __IO uint32_t PR;                         /*!< (@ 0x4001000C) Prescale Register. When the Prescale Counter (below) is equal to this value, the next clock increments the TC and clears the PC. */
-  __IO uint32_t PC;                         /*!< (@ 0x40010010) Prescale Counter. The 16-bit PC is a counter which is incremented to the value stored in PR. When the value in PR is reached, the TC is incremented and the PC is cleared. The PC is observable and controllable through the bus interface. */
-  __IO uint32_t MCR;                        /*!< (@ 0x40010014) Match Control Register. The MCR is used to control if an interrupt is generated and if the TC is reset when a Match occurs. */
-  union {
-  __IO uint32_t MR[4];                      /*!< (@ 0x40010018) Match Register. MR can be enabled through the MCR to reset the TC, stop both the TC and PC, and/or generate an interrupt every time MR matches the TC. */
-  struct{
-  __IO uint32_t MR0;                        /*!< (@ 0x40010018) Match Register. MR0 */
-  __IO uint32_t MR1;                        /*!< (@ 0x4001001C) Match Register. MR1 */
-  __IO uint32_t MR2;                        /*!< (@ 0x40010020) Match Register. MR2 */
-  __IO uint32_t MR3;                        /*!< (@ 0x40010024) Match Register. MR3 */
-  };
-  };
-  __IO uint32_t CCR;                        /*!< (@ 0x40010028) Capture Control Register. The CCR controls which edges of the capture inputs are used to load the Capture Registers and whether or not an interrupt is generated when a capture takes place. */
-  union{
-  __I  uint32_t CR[4];                      /*!< (@ 0x4001002C) Capture Register. CR is loaded with the value of TC when there is an event on the CT16B0_CAP input. */
-    struct{
-  __I  uint32_t CR0;			            /*!< (@ 0x4001002C) Capture Register. CR 0 */
-  __I  uint32_t CR1;			            /*!< (@ 0x40010030) Capture Register. CR 1 */
-  __I  uint32_t CR2;			            /*!< (@ 0x40010034) Capture Register. CR 2 */
-  __I  uint32_t CR3;			            /*!< (@ 0x40010038) Capture Register. CR 3 */
-  };
-  };
-  __IO uint32_t EMR;                        /*!< (@ 0x4001003C) External Match Register. The EMR controls the match function and the external match pins  */
-  __I  uint32_t RESERVED0[12];
-  __IO uint32_t CTCR;                       /*!< (@ 0x40010070) Count Control Register. The CTCR selects between Timer and Counter mode, and in Counter mode selects the signal and edge(s) for counting. */
-  __IO uint32_t PWMC;                       /*!< (@ 0x40010074) PWM Control Register. The PWMCON enables PWM mode for the external match pins CT16B0_MAT[1:0] and CT16B1_MAT[1:0]. */
-} LPC_CT16B1_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                        CT32B0                                        -----
-// ------------------------------------------------------------------------------------------------
-typedef struct {                            /*!< (@ 0x40014000) CT32B0 Structure       */
-  __IO uint32_t IR;                         /*!< (@ 0x40014000) Interrupt Register. The IR can be written to clear interrupts. The IR can be read to identify which of eight possible interrupt sources are pending. */
-  __IO uint32_t TCR;                        /*!< (@ 0x40014004) Timer Control Register. The TCR is used to control the Timer Counter functions. The Timer Counter can be disabled or reset through the TCR. */
-  __IO uint32_t TC;                         /*!< (@ 0x40014008) Timer Counter. The 32-bit TC is incremented every PR+1 cycles of PCLK. The TC is controlled through the TCR. */
-  __IO uint32_t PR;                         /*!< (@ 0x4001400C) Prescale Register. When the Prescale Counter (below) is equal to this value, the next clock increments the TC and clears the PC. */
-  __IO uint32_t PC;                         /*!< (@ 0x40014010) Prescale Counter. The 32-bit PC is a counter which is incremented to the value stored in PR. When the value in PR is reached, the TC is incremented and the PC is cleared. The PC is observable and controllable through the bus interface. */
-  __IO uint32_t MCR;                        /*!< (@ 0x40014014) Match Control Register. The MCR is used to control if an interrupt is generated and if the TC is reset when a Match occurs. */
-  union {
-  __IO uint32_t MR[4];                      /*!< (@ 0x40014018) Match Register. MR can be enabled through the MCR to reset the TC, stop both the TC and PC, and/or generate an interrupt every time MR matches the TC. */
-  struct{
-  __IO uint32_t MR0;                        /*!< (@ 0x40014018) Match Register. MR0 */
-  __IO uint32_t MR1;                        /*!< (@ 0x4001401C) Match Register. MR1 */
-  __IO uint32_t MR2;                        /*!< (@ 0x40014020) Match Register. MR2 */
-  __IO uint32_t MR3;                        /*!< (@ 0x40014024) Match Register. MR3 */
-  };
-  };
-  __IO uint32_t CCR;                        /*!< (@ 0x40014028) Capture Control Register. The CCR controls which edges of the capture inputs are used to load the Capture Registers and whether or not an interrupt is generated when a capture takes place. */
-  union{
-  __I  uint32_t CR[4];                      /*!< (@ 0x4001402C) Capture Register. CR is loaded with the value of TC when there is an event on the CT32B_CAP0 input. */
-    struct{
-  __I  uint32_t CR0;			            /*!< (@ 0x4001402C) Capture Register. CR 0 */
-  __I  uint32_t CR1;			            /*!< (@ 0x40014030) Capture Register. CR 1 */
-  __I  uint32_t CR2;			            /*!< (@ 0x40014034) Capture Register. CR 2 */
-  __I  uint32_t CR3;			            /*!< (@ 0x40014038) Capture Register. CR 3 */
-  };
-  };
-  __IO uint32_t EMR;                        /*!< (@ 0x4001403C) External Match Register. The EMR controls the match function and the external match pins CT32Bn_MAT[3:0]. */
-  __I  uint32_t RESERVED0[12];
-  __IO uint32_t CTCR;                       /*!< (@ 0x40014070) Count Control Register. The CTCR selects between Timer and Counter mode, and in Counter mode selects the signal and edge(s) for counting. */
-  __IO uint32_t PWMC;                       /*!< (@ 0x40014074) PWM Control Register. The PWMCON enables PWM mode for the external match pins CT32Bn_MAT[3:0]. */
-} LPC_CT32B0_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                        CT32B1                                        -----
-// ------------------------------------------------------------------------------------------------
-typedef struct {                            /*!< (@ 0x40018000) CT32B1 Structure       */
-  __IO uint32_t IR;                         /*!< (@ 0x40018000) Interrupt Register. The IR can be written to clear interrupts. The IR can be read to identify which of eight possible interrupt sources are pending. */
-  __IO uint32_t TCR;                        /*!< (@ 0x40018004) Timer Control Register. The TCR is used to control the Timer Counter functions. The Timer Counter can be disabled or reset through the TCR. */
-  __IO uint32_t TC;                         /*!< (@ 0x40018008) Timer Counter. The 32-bit TC is incremented every PR+1 cycles of PCLK. The TC is controlled through the TCR. */
-  __IO uint32_t PR;                         /*!< (@ 0x4001800C) Prescale Register. When the Prescale Counter (below) is equal to this value, the next clock increments the TC and clears the PC. */
-  __IO uint32_t PC;                         /*!< (@ 0x40018010) Prescale Counter. The 32-bit PC is a counter which is incremented to the value stored in PR. When the value in PR is reached, the TC is incremented and the PC is cleared. The PC is observable and controllable through the bus interface. */
-  __IO uint32_t MCR;                        /*!< (@ 0x40018014) Match Control Register. The MCR is used to control if an interrupt is generated and if the TC is reset when a Match occurs. */
-  union {
-  __IO uint32_t MR[4];                      /*!< (@ 0x40018018) Match Register. MR can be enabled through the MCR to reset the TC, stop both the TC and PC, and/or generate an interrupt every time MR matches the TC. */
-  struct{
-  __IO uint32_t MR0;                        /*!< (@ 0x40018018) Match Register. MR0 */
-  __IO uint32_t MR1;                        /*!< (@ 0x4001801C) Match Register. MR1 */
-  __IO uint32_t MR2;                        /*!< (@ 0x40018020) Match Register. MR2 */
-  __IO uint32_t MR3;                        /*!< (@ 0x40018024) Match Register. MR3 */
-  };
-  };
-  __IO uint32_t CCR;                        /*!< (@ 0x40018028) Capture Control Register. The CCR controls which edges of the capture inputs are used to load the Capture Registers and whether or not an interrupt is generated when a capture takes place. */
-  union{
-  __I  uint32_t CR[4];                      /*!< (@ 0x4001802C) Capture Register. CR is loaded with the value of TC when there is an event on the CT32B_CAP0 input. */
-    struct{
-  __I  uint32_t CR0;			            /*!< (@ 0x4001802C) Capture Register. CR 0 */
-  __I  uint32_t CR1;			            /*!< (@ 0x40018030) Capture Register. CR 1 */
-  __I  uint32_t CR2;			            /*!< (@ 0x40018034) Capture Register. CR 2 */
-  __I  uint32_t CR3;			            /*!< (@ 0x40018038) Capture Register. CR 3 */
-  };
-  };
-  __IO uint32_t EMR;                        /*!< (@ 0x4001803C) External Match Register. The EMR controls the match function and the external match pins CT32Bn_MAT[3:0]. */
-  __I  uint32_t RESERVED0[12];
-  __IO uint32_t CTCR;                       /*!< (@ 0x40018070) Count Control Register. The CTCR selects between Timer and Counter mode, and in Counter mode selects the signal and edge(s) for counting. */
-  __IO uint32_t PWMC;                       /*!< (@ 0x40018074) PWM Control Register. The PWMCON enables PWM mode for the external match pins CT32Bn_MAT[3:0]. */
-} LPC_CT32B1_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                          ADC                                         -----
-// ------------------------------------------------------------------------------------------------
-typedef struct {                            /*!< (@ 0x4001C000) ADC Structure          */
-  __IO uint32_t CR;                         /*!< (@ 0x4001C000) A/D Control Register. The CR register must be written to select the operating mode before A/D conversion can occur. */
-  __IO uint32_t GDR;                        /*!< (@ 0x4001C004) A/D Global Data Register. Contains the result of the most recent A/D conversion. */
-  __I  uint32_t RESERVED0[1];
-  __IO uint32_t INTEN;                      /*!< (@ 0x4001C00C) A/D Interrupt Enable Register. This register contains enable bits that allow the DONE flag of each A/D channel to be included or excluded from contributing to the generation of an A/D interrupt. */
-  union{
-  __I  uint32_t DR[8];                      /*!< (@ 0x4001C010) A/D Channel Data Register*/
-    struct{
-  __I  uint32_t DR0;                      	/*!< (@ 0x4001C010) A/D Channel Data Register 0*/
-  __I  uint32_t DR1;                      	/*!< (@ 0x4001C014) A/D Channel Data Register 1*/
-  __I  uint32_t DR2;                      	/*!< (@ 0x4001C018) A/D Channel Data Register 2*/
-  __I  uint32_t DR3;                      	/*!< (@ 0x4001C01C) A/D Channel Data Register 3*/
-  __I  uint32_t DR4;                      	/*!< (@ 0x4001C020) A/D Channel Data Register 4*/
-  __I  uint32_t DR5;                      	/*!< (@ 0x4001C024) A/D Channel Data Register 5*/
-  __I  uint32_t DR6;                      	/*!< (@ 0x4001C028) A/D Channel Data Register 6*/
-  __I  uint32_t DR7;                      	/*!< (@ 0x4001C02C) A/D Channel Data Register 7*/
-  };
-  };
-  __I  uint32_t STAT;                       /*!< (@ 0x4001C030) A/D Status Register. This register contains DONE and OVERRUN flags for all of the A/D channels, as well as the A/D interrupt flag. */
-} LPC_ADC_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                          PMU                                         -----
-// ------------------------------------------------------------------------------------------------
-
-typedef struct {                            /*!< (@ 0x40038000) PMU Structure          */
-  __IO uint32_t PCON;                       /*!< (@ 0x40038000) Power control register */
-  union{
-  __IO uint32_t GPREG[4];                   /*!< (@ 0x40038004) General purpose register 0 */
-  struct{
-  __IO uint32_t GPREG0;                   	/*!< (@ 0x40038004) General purpose register 0 */
-  __IO uint32_t GPREG1;                   	/*!< (@ 0x40038008) General purpose register 1 */
-  __IO uint32_t GPREG2;                   	/*!< (@ 0x4003800C) General purpose register 2 */
-  __IO uint32_t GPREG3;                   	/*!< (@ 0x40038010) General purpose register 3 */
-  };
-  };
-  __IO uint32_t GPREG4;                     /*!< (@ 0x40038014) General purpose register 4 */
-} LPC_PMU_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                       FLASHCTRL                                      -----
-// ------------------------------------------------------------------------------------------------
-
-typedef struct {                            /*!< (@ 0x4003C000) FLASHCTRL Structure    */
-  __I  uint32_t RESERVED0[4];
-  __IO uint32_t FLASHCFG;                   /*!< (@ 0x4003C010) Flash memory access time configuration register */
-  __I  uint32_t RESERVED1[3];
-  __IO uint32_t FMSSTART;                   /*!< (@ 0x4003C020) Signature start address register */
-  __IO uint32_t FMSSTOP;                    /*!< (@ 0x4003C024) Signature stop-address register */
-  __I  uint32_t RESERVED2[1];
-  __I  uint32_t FMSW0;                      /*!< (@ 0x4003C02C) Word 0 [31:0]          */
-  __I  uint32_t FMSW1;                      /*!< (@ 0x4003C030) Word 1 [63:32]         */
-  __I  uint32_t FMSW2;                      /*!< (@ 0x4003C034) Word 2 [95:64]         */
-  __I  uint32_t FMSW3;                      /*!< (@ 0x4003C038) Word 3 [127:96]        */
-  __I  uint32_t RESERVED3[1001];
-  __I  uint32_t FMSTAT;                     /*!< (@ 0x4003CFE0) Signature generation status register */
-  __I  uint32_t RESERVED4[1];
-  __O  uint32_t FMSTATCLR;                  /*!< (@ 0x4003CFE8) Signature generation status clear register */
-} LPC_FLASHCTRL_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                         SSP                                          -----
-// ------------------------------------------------------------------------------------------------
-typedef struct {                            /*!< (@ 0x40040000) SSP0 Structure         */
-  __IO uint32_t CR0;                        /*!< (@ 0x40040000) Control Register 0. Selects the serial clock rate, bus type, and data size. */
-  __IO uint32_t CR1;                        /*!< (@ 0x40040004) Control Register 1. Selects master/slave and other modes. */
-  __IO uint32_t DR;                         /*!< (@ 0x40040008) Data Register. Writes fill the transmit FIFO, and reads empty the receive FIFO. */
-  __I  uint32_t SR;                         /*!< (@ 0x4004000C) Status Register        */
-  __IO uint32_t CPSR;                       /*!< (@ 0x40040010) Clock Prescale Register */
-  __IO uint32_t IMSC;                       /*!< (@ 0x40040014) Interrupt Mask Set and Clear Register */
-  __I  uint32_t RIS;                        /*!< (@ 0x40040018) Raw Interrupt Status Register */
-  __I  uint32_t MIS;                        /*!< (@ 0x4004001C) Masked Interrupt Status Register */
-  __O  uint32_t ICR;                        /*!< (@ 0x40040020) SSPICR Interrupt Clear Register */
-} LPC_SSPx_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                         IOCON                                        -----
-// ------------------------------------------------------------------------------------------------
-typedef struct {                            /*!< (@ 0x40044000) IOCON Structure        */
-  __IO uint32_t RESET_PIO0_0;               /*!< (@ 0x40044000) I/O configuration for pin RESET/PIO0_0 */
-  __IO uint32_t PIO0_1;                     /*!< (@ 0x40044004) I/O configuration for pin PIO0_1/CLKOUT/CT32B0_MAT2/USB_FTOGGLE */
-  __IO uint32_t PIO0_2;                     /*!< (@ 0x40044008) I/O configuration for pin PIO0_2/SSEL0/CT16B0_CAP0 */
-  __IO uint32_t PIO0_3;                     /*!< (@ 0x4004400C) I/O configuration for pin PIO0_3/USB_VBUS */
-  __IO uint32_t PIO0_4;                     /*!< (@ 0x40044010) I/O configuration for pin PIO0_4/SCL */
-  __IO uint32_t PIO0_5;                     /*!< (@ 0x40044014) I/O configuration for pin PIO0_5/SDA */
-  __IO uint32_t PIO0_6;                     /*!< (@ 0x40044018) I/O configuration for pin PIO0_6/USB_CONNECT/SCK0 */
-  __IO uint32_t PIO0_7;                     /*!< (@ 0x4004401C) I/O configuration for pin PIO0_7/CTS */
-  __IO uint32_t PIO0_8;                     /*!< (@ 0x40044020) I/O configuration for pin PIO0_8/MISO0/CT16B0_MAT0/SWO */
-  __IO uint32_t PIO0_9;                     /*!< (@ 0x40044024) I/O configuration for pin PIO0_9/MOSI0/CT16B0_MAT1/TRACECLK */
-  __IO uint32_t SWCLK_PIO0_10;              /*!< (@ 0x40044028) I/O configuration for pin SWCLK/PIO0_10/ SCK0/CT16B0_MAT2 */
-  __IO uint32_t TDI_PIO0_11;                /*!< (@ 0x4004402C) I/O configuration for pin TDI/PIO0_11/AD0/CT32B0_MAT3 */
-  __IO uint32_t TMS_PIO0_12;                /*!< (@ 0x40044030) I/O configuration for pin TMS/PIO0_12/AD1/CT32B1_CAP0 */
-  __IO uint32_t TDO_PIO0_13;                /*!< (@ 0x40044034) I/O configuration for pin TDO/PIO0_13/AD2/CT32B1_MAT0 */
-  __IO uint32_t TRST_PIO0_14;               /*!< (@ 0x40044038) I/O configuration for pin TRST/PIO0_14/AD3/CT32B1_MAT1 */
-  __IO uint32_t SWDIO_PIO0_15;              /*!< (@ 0x4004403C) I/O configuration for pin SWDIO/PIO0_15/AD4/CT32B1_MAT2 */
-  __IO uint32_t PIO0_16;                    /*!< (@ 0x40044040) I/O configuration for pin PIO0_16/AD5/CT32B1_MAT3/ WAKEUP */
-  __IO uint32_t PIO0_17;                    /*!< (@ 0x40044044) I/O configuration for pin PIO0_17/RTS/CT32B0_CAP0/SCLK */
-  __IO uint32_t PIO0_18;                    /*!< (@ 0x40044048) I/O configuration for pin PIO0_18/RXD/CT32B0_MAT0 */
-  __IO uint32_t PIO0_19;                    /*!< (@ 0x4004404C) I/O configuration for pin PIO0_19/TXD/CT32B0_MAT1 */
-  __IO uint32_t PIO0_20;                    /*!< (@ 0x40044050) I/O configuration for pin PIO0_20/CT16B1_CAP0 */
-  __IO uint32_t PIO0_21;                    /*!< (@ 0x40044054) I/O configuration for pin PIO0_21/CT16B1_MAT0/MOSI1 */
-  __IO uint32_t PIO0_22;                    /*!< (@ 0x40044058) I/O configuration for pin PIO0_22/AD6/CT16B1_MAT1/MISO1 */
-  __IO uint32_t PIO0_23;                    /*!< (@ 0x4004405C) I/O configuration for pin PIO0_23/AD7 */
-  __IO uint32_t PIO1_0;                     /*!< (@ 0x40044060) I/O configuration for pin PIO1_0/CT32B1_MAT0 */
-  __IO uint32_t PIO1_1;                     /*!< (@ 0x40044064) I/O configuration for pin PIO1_1/CT32B1_MAT1 */
-  __IO uint32_t PIO1_2;                     /*!< (@ 0x40044068) I/O configuration for pin PIO1_2/CT32B1_MAT2 */
-  __IO uint32_t PIO1_3;                     /*!< (@ 0x4004406C) I/O configuration for pin PIO1_3/CT32B1_MAT3 */
-  __IO uint32_t PIO1_4;                     /*!< (@ 0x40044070) I/O configuration for pin PIO1_4/CT32B1_CAP0 */
-  __IO uint32_t PIO1_5;                     /*!< (@ 0x40044074) I/O configuration for pin PIO1_5/CT32B1_CAP1 */
-  __IO uint32_t PIO1_6;                     /*!< (@ 0x40044078) I/O configuration for pin PIO1_6 */
-  __IO uint32_t PIO1_7;                     /*!< (@ 0x4004407C) I/O configuration for pin PIO1_7 */
-  __IO uint32_t PIO1_8;                     /*!< (@ 0x40044080) I/O configuration for pin PIO1_8 */
-  __IO uint32_t PIO1_9;                     /*!< (@ 0x40044084) I/O configuration for pin PIO1_9 */
-  __IO uint32_t PIO1_10;                    /*!< (@ 0x40044088) I/O configuration for pin PIO1_10 */
-  __IO uint32_t PIO1_11;                    /*!< (@ 0x4004408C) I/O configuration for pin PIO1_11 */
-  __IO uint32_t PIO1_12;                    /*!< (@ 0x40044090) I/O configuration for pin PIO1_12 */
-  __IO uint32_t PIO1_13;                    /*!< (@ 0x40044094) I/O configuration for PIO1_13/DTR/CT16B0_MAT0/TXD */
-  __IO uint32_t PIO1_14;                    /*!< (@ 0x40044098) I/O configuration for PIO1_14/DSR/CT16B0_MAT1/RXD */
-  __IO uint32_t PIO1_15;                    /*!< (@ 0x4004409C) I/O configuration for pin PIO1_15/DCD/ CT16B0_MAT2/SCK1 */
-  __IO uint32_t PIO1_16;                    /*!< (@ 0x400440A0) I/O configuration for pin PIO1_16/RI/CT16B0_CAP0 */
-  __IO uint32_t PIO1_17;                    /*!< (@ 0x400440A4) I/O configuration for PIO1_17/CT16B0_CAP1/RXD */
-  __IO uint32_t PIO1_18;                    /*!< (@ 0x400440A8) I/O configuration for PIO1_18/CT16B1_CAP1/TXD */
-  __IO uint32_t PIO1_19;                    /*!< (@ 0x400440AC) I/O configuration for pin PIO1_19/DTR/SSEL1 */
-  __IO uint32_t PIO1_20;                    /*!< (@ 0x400440B0) I/O configuration for pin PIO1_20/DSR/SCK1 */
-  __IO uint32_t PIO1_21;                    /*!< (@ 0x400440B4) I/O configuration for pin PIO1_21/DCD/MISO1 */
-  __IO uint32_t PIO1_22;                    /*!< (@ 0x400440B8) I/O configuration for pin PIO1_22/RI/MOSI1 */
-  __IO uint32_t PIO1_23;                    /*!< (@ 0x400440BC) I/O configuration for pin PIO1_23/CT16B1_MAT1/SSEL1 */
-  __IO uint32_t PIO1_24;                    /*!< (@ 0x400440C0) I/O configuration for pin PIO1_24/ CT32B0_MAT0 */
-  __IO uint32_t PIO1_25;                    /*!< (@ 0x400440C4) I/O configuration for pin PIO1_25/CT32B0_MAT1 */
-  __IO uint32_t PIO1_26;                    /*!< (@ 0x400440C8) I/O configuration for pin PIO1_26/CT32B0_MAT2/ RXD */
-  __IO uint32_t PIO1_27;                    /*!< (@ 0x400440CC) I/O configuration for pin PIO1_27/CT32B0_MAT3/ TXD */
-  __IO uint32_t PIO1_28;                    /*!< (@ 0x400440D0) I/O configuration for pin PIO1_28/CT32B0_CAP0/ SCLK */
-  __IO uint32_t PIO1_29;                    /*!< (@ 0x400440D4) I/O configuration for pin PIO1_29/SCK0/ CT32B0_CAP1 */
-  __IO uint32_t PIO1_30;                    /*!< (@ 0x400440D8) I/O configuration for pin PIO1_30 */
-  __IO uint32_t PIO1_31;                    /*!< (@ 0x400440DC) I/O configuration for pin PIO1_31 */
-} LPC_IOCON_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                        SYSCON                                        -----
-// ------------------------------------------------------------------------------------------------
-
-typedef struct {                            /*!< (@ 0x40048000) SYSCON Structure       */
-  __IO uint32_t SYSMEMREMAP;                /*!< (@ 0x40048000) System memory remap    */
-  __IO uint32_t PRESETCTRL;                 /*!< (@ 0x40048004) Peripheral reset control */
-  __IO uint32_t SYSPLLCTRL;                 /*!< (@ 0x40048008) System PLL control     */
-  __I  uint32_t SYSPLLSTAT;                 /*!< (@ 0x4004800C) System PLL status      */
-  __IO uint32_t USBPLLCTRL;                 /*!< (@ 0x40048010) USB PLL control        */
-  __I  uint32_t USBPLLSTAT;                 /*!< (@ 0x40048014) USB PLL status         */
-  __I  uint32_t RESERVED0[2];
-  __IO uint32_t SYSOSCCTRL;                 /*!< (@ 0x40048020) System oscillator control */
-  __IO uint32_t WDTOSCCTRL;                 /*!< (@ 0x40048024) Watchdog oscillator control */
-  __I  uint32_t RESERVED1[2];
-  __IO uint32_t SYSRSTSTAT;                 /*!< (@ 0x40048030) System reset status register */
-  __I  uint32_t RESERVED2[3];
-  __IO uint32_t SYSPLLCLKSEL;               /*!< (@ 0x40048040) System PLL clock source select */
-  __I  uint32_t RESERVED3;
-  __IO uint32_t USBPLLCLKSEL;               /*!< (@ 0x40048048) USB PLL clock source select */
-  __I  uint32_t RESERVED4[9];
-  __IO uint32_t MAINCLKSEL;                 /*!< (@ 0x40048070) Main clock source select */
-  __I  uint32_t RESERVED5;
-  __IO uint32_t SYSAHBCLKDIV;               /*!< (@ 0x40048078) System clock divider   */
-  __I  uint32_t RESERVED6;
-  __IO uint32_t SYSAHBCLKCTRL;              /*!< (@ 0x40048080) System clock control   */
-  __I  uint32_t RESERVED7[4];
-  __IO uint32_t SSP0CLKDIV;                 /*!< (@ 0x40048094) SSP0 clock divider     */
-  __IO uint32_t UARTCLKDIV;                 /*!< (@ 0x40048098) UART clock divider     */
-  __IO uint32_t SSP1CLKDIV;                 /*!< (@ 0x4004809C) SSP1 clock divider     */
-  __I  uint32_t RESERVED8[3];
-  __IO uint32_t TRACECLKDIV;                /*!< (@ 0x400480AC) ARM trace clock divider */
-  __IO uint32_t SYSTICKCLKDIV;              /*!< (@ 0x400480B0) SYSTICK clock divder   */
-  __I  uint32_t RESERVED9[3];
-  __IO uint32_t USBCLKSEL;                  /*!< (@ 0x400480C0) USB clock source select */
-  __I  uint32_t RESERVED10;
-  __IO uint32_t USBCLKDIV;                  /*!< (@ 0x400480C8) USB clock source divider */
-  __I  uint32_t RESERVED11[5];
-  __IO uint32_t CLKOUTSEL;                  /*!< (@ 0x400480E0) CLKOUT clock source select */
-  __I  uint32_t RESERVED12;
-  __IO uint32_t CLKOUTDIV;                  /*!< (@ 0x400480E8) CLKOUT clock divider   */
-  __I  uint32_t RESERVED13[5];
-  __I  uint32_t PIOPORCAP0;                 /*!< (@ 0x40048100) POR captured PIO status 0 */
-  __I  uint32_t PIOPORCAP1;                 /*!< (@ 0x40048104) POR captured PIO status 1 */
-  __I  uint32_t RESERVED14[18];
-  __IO uint32_t BODCTRL;                    /*!< (@ 0x40048150) Brown-Out Detect       */
-  __IO uint32_t SYSTCKCAL;                  /*!< (@ 0x40048154) System tick counter calibration */
-  __I  uint32_t RESERVED15[6];
-  __IO uint32_t IRQLATENCY;                 /*!< (@ 0x40048170) IQR delay. Allows trade-off between interrupt latency and determinism. */
-  __IO uint32_t NMISRC;                     /*!< (@ 0x40048174) NMI Source Control     */
-  __IO uint32_t PINSEL[8];                  /*!< (@ 0x40048178) GPIO Pin Interrupt Select register */
-  __IO uint32_t USBCLKCTRL;                 /*!< (@ 0x40048198) USB clock control      */
-  __I  uint32_t USBCLKST;                   /*!< (@ 0x4004819C) USB clock status       */
-  __I  uint32_t RESERVED16[25];
-  __IO uint32_t STARTERP0;                  /*!< (@ 0x40048204) Start logic 0 interrupt wake-up enable register 0 */
-  __I  uint32_t RESERVED17[3];
-  __IO uint32_t STARTERP1;                  /*!< (@ 0x40048214) Start logic 1 interrupt wake-up enable register 1 */
-  __I  uint32_t RESERVED18[6];
-  __IO uint32_t PDSLEEPCFG;                 /*!< (@ 0x40048230) Power-down states in deep-sleep mode */
-  __IO uint32_t PDAWAKECFG;                 /*!< (@ 0x40048234) Power-down states for wake-up from deep-sleep */
-  __IO uint32_t PDRUNCFG;                   /*!< (@ 0x40048238) Power configuration register */
-  __I  uint32_t RESERVED19[111];
-  __I  uint32_t DEVICE_ID;                  /*!< (@ 0x400483F8) Device ID              */
-} LPC_SYSCON_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                     GPIO_PIN_INT                                     -----
-// ------------------------------------------------------------------------------------------------
-typedef struct {                            /*!< (@ 0x4004C000) GPIO_PIN_INT Structure */
-  __IO uint32_t ISEL;                       /*!< (@ 0x4004C000) Pin Interrupt Mode register */
-  __IO uint32_t IENR;                       /*!< (@ 0x4004C004) Pin Interrupt Enable (Rising) register */
-  __O  uint32_t SIENR;                      /*!< (@ 0x4004C008) Set Pin Interrupt Enable (Rising) register */
-  __O  uint32_t CIENR;                      /*!< (@ 0x4004C00C) Clear Pin Interrupt Enable (Rising) register */
-  __IO uint32_t IENF;                       /*!< (@ 0x4004C010) Pin Interrupt Enable Falling Edge / Active Level register */
-  __O  uint32_t SIENF;                      /*!< (@ 0x4004C014) Set Pin Interrupt Enable Falling Edge / Active Level register */
-  __O  uint32_t CIENF;                      /*!< (@ 0x4004C018) Clear Pin Interrupt Enable Falling Edge / Active Level address */
-  __IO uint32_t RISE;                       /*!< (@ 0x4004C01C) Pin Interrupt Rising Edge register */
-  __IO uint32_t FALL;                       /*!< (@ 0x4004C020) Pin Interrupt Falling Edge register */
-  __IO uint32_t IST;                        /*!< (@ 0x4004C024) Pin Interrupt Status register */
-} LPC_GPIO_PIN_INT_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                    GPIO_GROUP_INT0                                   -----
-// ------------------------------------------------------------------------------------------------
-typedef struct {                            /*!< (@ 0x4005C000) GPIO_GROUP_INT0 Structure */
-  __IO uint32_t CTRL;                       /*!< (@ 0x4005C000) GPIO grouped interrupt control register */
-  __I  uint32_t RESERVED0[7];
-  __IO uint32_t PORT_POL[2];                /*!< (@ 0x4005C020) GPIO grouped interrupt port 0 polarity register */
-  __I  uint32_t RESERVED1[6];
-  __IO uint32_t PORT_ENA[2];                /*!< (@ 0x4005C040) GPIO grouped interrupt port 0/1 enable register */
-} LPC_GPIO_GROUP_INT0_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                    GPIO_GROUP_INT1                                   -----
-// ------------------------------------------------------------------------------------------------
-
-typedef struct {                            /*!< (@ 0x40060000) GPIO_GROUP_INT1 Structure */
-  __IO uint32_t CTRL;                       /*!< (@ 0x40060000) GPIO grouped interrupt control register */
-  __I  uint32_t RESERVED0[7];
-  __IO uint32_t PORT_POL[2];                /*!< (@ 0x40060020) GPIO grouped interrupt port 0 polarity register */
-  __I  uint32_t RESERVED1[6];
-  __IO uint32_t PORT_ENA[2];                /*!< (@ 0x40060040) GPIO grouped interrupt port 0/1 enable register */
-} LPC_GPIO_GROUP_INT1_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                          Repetitive Interrupt Timer (RIT)                            -----
-// ------------------------------------------------------------------------------------------------
-
-typedef struct {                            /*!< (@ 0x40064000) RITIMER Structure */
-  __IO uint32_t COMPVAL;                    /*!< (@ 0x40064000) RITIMER compare register */
-  __IO uint32_t MASK;                       /*!< (@ 0x40064004) RITIMER mask register */
-  __IO uint32_t CTRL;                       /*!< (@ 0x40064008) RITIMER control register */
-  __IO uint32_t COUNTER;                    /*!< (@ 0x4006400C) RITIMER counter register */
-  __IO uint32_t COMPVAL_H;                  /*!< (@ 0x40064010) RITIMER compare upper register */
-  __IO uint32_t MASK_H;                     /*!< (@ 0x40064014) RITIMER mask upper register */
-  __I  uint32_t RESERVED0[1];
-  __IO uint32_t COUNTER_H;                  /*!< (@ 0x4006401C) RITIMER counter upper register */
-} LPC_RITIMER_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                          USB                                         -----
-// ------------------------------------------------------------------------------------------------
-typedef struct {                            /*!< (@ 0x40020000) USB Structure          */
-  __IO uint32_t DEVCMDSTAT;                 /*!< (@ 0x40020000) USB Device Command/Status register */
-  __IO uint32_t INFO;                       /*!< (@ 0x40020004) USB Info register      */
-  __IO uint32_t EPLISTSTART;                /*!< (@ 0x40020008) USB EP Command/Status List start address */
-  __IO uint32_t DATABUFSTART;               /*!< (@ 0x4002000C) USB Data buffer start address */
-  __IO uint32_t LPM;                        /*!< (@ 0x40020010) Link Power Management register */
-  __IO uint32_t EPSKIP;                     /*!< (@ 0x40020014) USB Endpoint skip      */
-  __IO uint32_t EPINUSE;                    /*!< (@ 0x40020018) USB Endpoint Buffer in use */
-  __IO uint32_t EPBUFCFG;                   /*!< (@ 0x4002001C) USB Endpoint Buffer Configuration register */
-  __IO uint32_t INTSTAT;                    /*!< (@ 0x40020020) USB interrupt status register */
-  __IO uint32_t INTEN;                      /*!< (@ 0x40020024) USB interrupt enable register */
-  __IO uint32_t INTSETSTAT;                 /*!< (@ 0x40020028) USB set interrupt status register */
-  __IO uint32_t INTROUTING;                 /*!< (@ 0x4002002C) USB interrupt routing register */
-  __I  uint32_t RESERVED0[1];
-  __I  uint32_t EPTOGGLE;                   /*!< (@ 0x40020034) USB Endpoint toggle register */
-} LPC_USB_Type;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                       GPIO_PORT                                      -----
-// ------------------------------------------------------------------------------------------------
-
-typedef struct {                            /*!< (@ 0x50000000) GPIO_PORT Structure    */
-  union {
-    struct {
-      __IO uint8_t B0[32];                  /*!< (@ 0x50000000) Byte pin registers port 0; pins PIO0_0 to PIO0_31 */
-      __IO uint8_t B1[32];                  /*!< (@ 0x50000020) Byte pin registers port 1 */
-    };
-    __IO uint8_t B[64];                     /*!< (@ 0x50000000) Byte pin registers port 0/1 */
-  };
-  __I  uint32_t RESERVED0[1008];
-  union {
-    struct {
-      __IO uint32_t W0[32];                 /*!< (@ 0x50001000) Word pin registers port 0 */
-      __IO uint32_t W1[32];                 /*!< (@ 0x50001080) Word pin registers port 1 */
-    };
-    __IO uint32_t W[64];                    /*!< (@ 0x50001000) Word pin registers port 0/1 */
-  };
-  __I  uint32_t RESERVED1[960];
-  __IO uint32_t DIR[2];                     /*!< (@ 0x50002000) Direction registers port 0/1 */
-  __I  uint32_t RESERVED2[30];
-  __IO uint32_t MASK[2];                    /*!< (@ 0x50002080) Mask register port 0/1 */
-  __I  uint32_t RESERVED3[30];
-  __IO uint32_t PIN[2];                     /*!< (@ 0x50002100) Portpin register port 0 */
-  __I  uint32_t RESERVED4[30];
-  __IO uint32_t MPIN[2];                    /*!< (@ 0x50002180) Masked port register port 0/1 */
-  __I  uint32_t RESERVED5[30];
-  __IO uint32_t SET[2];                     /*!< (@ 0x50002200) Write: Set register for port 0/1 Read: output bits for port 0/1 */
-  __I  uint32_t RESERVED6[30];
-  __O  uint32_t CLR[2];                     /*!< (@ 0x50002280) Clear port 0/1         */
-  __I  uint32_t RESERVED7[30];
-  __O  uint32_t NOT[2];                     /*!< (@ 0x50002300) Toggle port 0/1        */
-} LPC_GPIO_Type;
-
-
-#if defined ( __CC_ARM   )
-  #pragma no_anon_unions
-#endif
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                 Peripheral memory map                                -----
-// ------------------------------------------------------------------------------------------------
-
-#define LPC_I2C_BASE              (0x40000000)
-#define LPC_WWDT_BASE             (0x40004000)
-#define LPC_USART_BASE            (0x40008000)
-#define LPC_CT16B0_BASE           (0x4000C000)
-#define LPC_CT16B1_BASE           (0x40010000)
-#define LPC_CT32B0_BASE           (0x40014000)
-#define LPC_CT32B1_BASE           (0x40018000)
-#define LPC_ADC_BASE              (0x4001C000)
-#define LPC_PMU_BASE              (0x40038000)
-#define LPC_FLASHCTRL_BASE        (0x4003C000)
-#define LPC_SSP0_BASE             (0x40040000)
-#define LPC_IOCON_BASE            (0x40044000)
-#define LPC_SYSCON_BASE           (0x40048000)
-#define LPC_GPIO_PIN_INT_BASE     (0x4004C000)
-#define LPC_SSP1_BASE             (0x40058000)
-#define LPC_GPIO_GROUP_INT0_BASE  (0x4005C000)
-#define LPC_GPIO_GROUP_INT1_BASE  (0x40060000)
-#define LPC_RITIMER_BASE          (0x40064000)
-#define LPC_USB_BASE              (0x40080000)
-#define LPC_GPIO_BASE             (0x50000000)
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                Peripheral declaration                                -----
-// ------------------------------------------------------------------------------------------------
-
-#define LPC_I2C                   ((LPC_I2C_Type            *) LPC_I2C_BASE)
-#define LPC_WWDT                  ((LPC_WWDT_Type           *) LPC_WWDT_BASE)
-#define LPC_USART                 ((LPC_USART_Type          *) LPC_USART_BASE)
-#define LPC_CT16B0                ((LPC_CTxxBx_Type         *) LPC_CT16B0_BASE)
-#define LPC_CT16B1                ((LPC_CTxxBx_Type         *) LPC_CT16B1_BASE)
-#define LPC_CT32B0                ((LPC_CTxxBx_Type         *) LPC_CT32B0_BASE)
-#define LPC_CT32B1                ((LPC_CTxxBx_Type         *) LPC_CT32B1_BASE)
-#define LPC_ADC                   ((LPC_ADC_Type            *) LPC_ADC_BASE)
-#define LPC_PMU                   ((LPC_PMU_Type            *) LPC_PMU_BASE)
-#define LPC_FLASHCTRL             ((LPC_FLASHCTRL_Type      *) LPC_FLASHCTRL_BASE)
-#define LPC_SSP0                  ((LPC_SSPx_Type           *) LPC_SSP0_BASE)
-#define LPC_SSP1                  ((LPC_SSPx_Type           *) LPC_SSP1_BASE)
-#define LPC_IOCON                 ((LPC_IOCON_Type          *) LPC_IOCON_BASE)
-#define LPC_SYSCON                ((LPC_SYSCON_Type         *) LPC_SYSCON_BASE)
-#define LPC_GPIO_PIN_INT          ((LPC_GPIO_PIN_INT_Type   *) LPC_GPIO_PIN_INT_BASE)
-#define LPC_GPIO_GROUP_INT0       ((LPC_GPIO_GROUP_INT0_Type*) LPC_GPIO_GROUP_INT0_BASE)
-#define LPC_GPIO_GROUP_INT1       ((LPC_GPIO_GROUP_INT1_Type*) LPC_GPIO_GROUP_INT1_BASE)
-#define LPC_RITIMER               ((LPC_RITIMER_Type        *) LPC_RITIMER_BASE)
-#define LPC_USB                   ((LPC_USB_Type            *) LPC_USB_BASE)
-#define LPC_GPIO                  ((LPC_GPIO_Type           *) LPC_GPIO_BASE)
-
-
-/** @} */ /* End of group Device_Peripheral_Registers */
-/** @} */ /* End of group (null) */
-/** @} */ /* End of group h1usf */
-
-#ifdef __cplusplus
-}
-#endif 
-
-
-#endif  // __LPC13UXX_H__
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC13XX/TOOLCHAIN_ARM_MICRO/LPC1347.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-
-LR_IROM1 0x00000000 0x10000  {    ; load region size_region
-  ER_IROM1 0x00000000 0x10000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  ; 8_byte_aligned(48 vect * 4 bytes) =  8_byte_aligned(0xC0) = 0xC0
-  ; 8KB - 0xC0 = 0x1F40
-  RW_IRAM1 0x100000C0 0x1F40  {
-   .ANY (+RW +ZI)
-  }
-  RW_IRAM2 0x20000000 0x800  {  ; RW data
-   .ANY (AHBSRAM0)
-  }
-  RW_IRAM3 0x20004000 0x800  {  ; RW data, USB RAM
-   .ANY (AHBSRAM1)
-  }
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC13XX/TOOLCHAIN_ARM_MICRO/startup_LPC13xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,231 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_LPC13xx.s
-; * @purpose: CMSIS Cortex-M3 Core Device Startup File 
-; *           for the NXP LPC13xx Device Series 
-; * @version: V1.02, modified for mbed
-; * @date:    27. July 2009, modified 3rd Aug 2009
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; * Copyright (C) 2009 ARM Limited. All rights reserved.
-; * ARM Limited (ARM) is supplying this software for use with Cortex-M3 
-; * processor based microcontrollers.  This file can be freely distributed 
-; * within development tools that are supporting such ARM based processors. 
-; *
-; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
-; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
-; *
-; *****************************************************************************/
-Stack_Size      EQU     0x00000400
-
-                AREA    STACK, NOINIT, READWRITE, ALIGN=3
-                EXPORT  __initial_sp
-
-Stack_Mem       SPACE   Stack_Size
-__initial_sp    EQU     0x10002000  ; Top of RAM from LPC1347
-
-
-Heap_Size       EQU     0x00000000
-
-                AREA    HEAP, NOINIT, READWRITE, ALIGN=3
-                EXPORT  __heap_base
-                EXPORT  __heap_limit
-
-__heap_base
-Heap_Mem        SPACE   Heap_Size
-__heap_limit
-
-                PRESERVE8
-                THUMB
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-
-__Vectors       DCD     __initial_sp              ; Top of Stack
-                DCD     Reset_Handler             ; Reset Handler
-                DCD     NMI_Handler               ; NMI Handler
-                DCD     HardFault_Handler         ; Hard Fault Handler
-                DCD     MemManage_Handler         ; MPU Fault Handler
-                DCD     BusFault_Handler          ; Bus Fault Handler
-                DCD     UsageFault_Handler        ; Usage Fault Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     SVC_Handler               ; SVCall Handler
-                DCD     DebugMon_Handler          ; Debug Monitor Handler
-                DCD     0                         ; Reserved
-                DCD     PendSV_Handler            ; PendSV Handler
-                DCD     SysTick_Handler           ; SysTick Handler
-
-                ; External Interrupts
-
-                DCD    PIN_INT0_Handler      ; All GPIO pin can be routed to PIN_INTx
-                DCD    PIN_INT1_Handler
-                DCD    PIN_INT2_Handler
-                DCD    PIN_INT3_Handler
-                DCD    PIN_INT4_Handler
-                DCD    PIN_INT5_Handler
-                DCD    PIN_INT6_Handler
-                DCD    PIN_INT7_Handler
-                DCD    GINT0_Handler
-                DCD    GINT1_Handler         ; PIO0 (0:7) 
-                DCD    0
-                DCD    0
-                DCD    OSTIMER_Handler
-                DCD    0
-                DCD    SSP1_Handler          ; SSP1 
-                DCD    I2C_Handler           ; I2C 
-                DCD    CT16B0_Handler        ; 16-bit Timer0 
-                DCD    CT16B1_Handler        ; 16-bit Timer1 
-                DCD    CT32B0_Handler        ; 32-bit Timer0 
-                DCD    CT32B1_Handler        ; 32-bit Timer1 
-                DCD    SSP0_Handler          ; SSP0 
-                DCD    USART_Handler         ; USART 
-                DCD    USB_Handler           ; USB IRQ 
-                DCD    USB_FIQHandler        ; USB FIQ 
-                DCD    ADC_Handler           ; A/D Converter 
-                DCD    WDT_Handler           ; Watchdog timer 
-                DCD    BOD_Handler           ; Brown Out Detect 
-                DCD    FMC_Handler           ; IP2111 Flash Memory Controller 
-                DCD    OSCFAIL_Handler       ; OSC FAIL 
-                DCD    PVTCIRCUIT_Handler    ; PVT CIRCUIT 
-                DCD    USBWakeup_Handler     ; USB wake up 
-                DCD    0
-
-                IF      :LNOT::DEF:NO_CRP
-                AREA    |.ARM.__at_0x02FC|, CODE, READONLY
-CRP_Key         DCD     0xFFFFFFFF
-                ENDIF
-
-
-                AREA    |.text|, CODE, READONLY
-
-
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-
-; Dummy Exception Handlers (infinite loops which can be modified)                
-
-NMI_Handler     PROC
-                EXPORT  NMI_Handler               [WEAK]
-                B       .
-                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-MemManage_Handler\
-                PROC
-                EXPORT  MemManage_Handler         [WEAK]
-                B       .
-                ENDP
-BusFault_Handler\
-                PROC
-                EXPORT  BusFault_Handler          [WEAK]
-                B       .
-                ENDP
-UsageFault_Handler\
-                PROC
-                EXPORT  UsageFault_Handler        [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-DebugMon_Handler\
-                PROC
-                EXPORT  DebugMon_Handler          [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-
-                EXPORT  PIN_INT0_Handler          [WEAK]
-                EXPORT  PIN_INT1_Handler          [WEAK]
-                EXPORT  PIN_INT2_Handler          [WEAK]
-                EXPORT  PIN_INT3_Handler          [WEAK]
-                EXPORT  PIN_INT4_Handler          [WEAK]
-                EXPORT  PIN_INT5_Handler          [WEAK]
-                EXPORT  PIN_INT6_Handler          [WEAK]
-                EXPORT  PIN_INT7_Handler          [WEAK]
-                EXPORT  GINT0_Handler             [WEAK]
-                EXPORT  GINT1_Handler             [WEAK]
-                EXPORT  OSTIMER_Handler           [WEAK]
-                EXPORT  SSP1_Handler              [WEAK]
-                EXPORT  I2C_Handler               [WEAK]
-                EXPORT  CT16B0_Handler            [WEAK]
-                EXPORT  CT16B1_Handler            [WEAK]
-                EXPORT  CT32B0_Handler            [WEAK]
-                EXPORT  CT32B1_Handler            [WEAK]
-                EXPORT  SSP0_Handler              [WEAK]
-                EXPORT  USART_Handler             [WEAK]
-                EXPORT  USB_Handler               [WEAK]
-                EXPORT  USB_FIQHandler            [WEAK]
-                EXPORT  ADC_Handler               [WEAK]
-                EXPORT  WDT_Handler               [WEAK]
-                EXPORT  BOD_Handler               [WEAK]
-                EXPORT  FMC_Handler               [WEAK]
-                EXPORT  OSCFAIL_Handler           [WEAK]
-                EXPORT  PVTCIRCUIT_Handler        [WEAK]
-                EXPORT  USBWakeup_Handler         [WEAK]
-  
-PIN_INT0_Handler
-PIN_INT1_Handler
-PIN_INT2_Handler
-PIN_INT3_Handler
-PIN_INT4_Handler
-PIN_INT5_Handler
-PIN_INT6_Handler
-PIN_INT7_Handler
-GINT0_Handler
-GINT1_Handler
-OSTIMER_Handler
-SSP1_Handler
-I2C_Handler
-CT16B0_Handler
-CT16B1_Handler
-CT32B0_Handler
-CT32B1_Handler
-SSP0_Handler
-USART_Handler
-USB_Handler
-USB_FIQHandler
-ADC_Handler
-WDT_Handler
-BOD_Handler
-FMC_Handler
-OSCFAIL_Handler
-PVTCIRCUIT_Handler
-USBWakeup_Handler
-
-                B       .
-
-                ENDP
-                
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC13XX/TOOLCHAIN_ARM_MICRO/sys.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library - stackheap
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * Setup a fixed single stack/heap memory model, 
- *  between the top of the RW/ZI region and the stackpointer
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-#include <rt_misc.h>
-#include <stdint.h>
-
-extern char Image$$RW_IRAM1$$ZI$$Limit[];
-
-extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
-    uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
-    uint32_t sp_limit = __current_sp();
-
-    zi_limit = (zi_limit + 7) & ~0x7;    // ensure zi_limit is 8-byte aligned
-
-    struct __initial_stackheap r;
-    r.heap_base = zi_limit;
-    r.heap_limit = sp_limit;
-    return r;
-}
-
-#ifdef __cplusplus
-}
-#endif 
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC13XX/TOOLCHAIN_ARM_STD/LPC1347.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-
-LR_IROM1 0x00000000 0x10000  {    ; load region size_region
-  ER_IROM1 0x00000000 0x10000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  ; 8_byte_aligned(48 vect * 4 bytes) =  8_byte_aligned(0xC0) = 0xC0
-  ; 8KB - 0xC0 = 0x1F40
-  RW_IRAM1 0x100000C0 0x1F40  {
-   .ANY (+RW +ZI)
-  }
-  RW_IRAM2 0x20000000 0x800  {  ; RW data
-   .ANY (AHBSRAM0)
-  }
-  RW_IRAM3 0x20004000 0x800  {  ; RW data, USB RAM
-   .ANY (AHBSRAM1)
-  }
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC13XX/TOOLCHAIN_ARM_STD/startup_LPC13xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,215 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_LPC13xx.s
-; * @purpose: CMSIS Cortex-M3 Core Device Startup File 
-; *           for the NXP LPC13xx Device Series 
-; * @version: V1.02, modified for mbed
-; * @date:    27. July 2009, modified 3rd Aug 2009
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; * Copyright (C) 2009 ARM Limited. All rights reserved.
-; * ARM Limited (ARM) is supplying this software for use with Cortex-M3 
-; * processor based microcontrollers.  This file can be freely distributed 
-; * within development tools that are supporting such ARM based processors. 
-; *
-; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
-; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
-; *
-; *****************************************************************************/
-
-__initial_sp        EQU     0x10002000  ; Top of RAM from LPC1347
-
-                PRESERVE8
-                THUMB
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-
-__Vectors       DCD     __initial_sp              ; Top of Stack
-                DCD     Reset_Handler             ; Reset Handler
-                DCD     NMI_Handler               ; NMI Handler
-                DCD     HardFault_Handler         ; Hard Fault Handler
-                DCD     MemManage_Handler         ; MPU Fault Handler
-                DCD     BusFault_Handler          ; Bus Fault Handler
-                DCD     UsageFault_Handler        ; Usage Fault Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     SVC_Handler               ; SVCall Handler
-                DCD     DebugMon_Handler          ; Debug Monitor Handler
-                DCD     0                         ; Reserved
-                DCD     PendSV_Handler            ; PendSV Handler
-                DCD     SysTick_Handler           ; SysTick Handler
-
-                ; External Interrupts
-
-                DCD    PIN_INT0_Handler      ; All GPIO pin can be routed to PIN_INTx
-                DCD    PIN_INT1_Handler
-                DCD    PIN_INT2_Handler
-                DCD    PIN_INT3_Handler
-                DCD    PIN_INT4_Handler
-                DCD    PIN_INT5_Handler
-                DCD    PIN_INT6_Handler
-                DCD    PIN_INT7_Handler
-                DCD    GINT0_Handler
-                DCD    GINT1_Handler         ; PIO0 (0:7) 
-                DCD    0
-                DCD    0
-                DCD    OSTIMER_Handler
-                DCD    0
-                DCD    SSP1_Handler          ; SSP1 
-                DCD    I2C_Handler           ; I2C 
-                DCD    CT16B0_Handler        ; 16-bit Timer0 
-                DCD    CT16B1_Handler        ; 16-bit Timer1 
-                DCD    CT32B0_Handler        ; 32-bit Timer0 
-                DCD    CT32B1_Handler        ; 32-bit Timer1 
-                DCD    SSP0_Handler          ; SSP0 
-                DCD    USART_Handler         ; USART 
-                DCD    USB_Handler           ; USB IRQ 
-                DCD    USB_FIQHandler        ; USB FIQ 
-                DCD    ADC_Handler           ; A/D Converter 
-                DCD    WDT_Handler           ; Watchdog timer 
-                DCD    BOD_Handler           ; Brown Out Detect 
-                DCD    FMC_Handler           ; IP2111 Flash Memory Controller 
-                DCD    OSCFAIL_Handler       ; OSC FAIL 
-                DCD    PVTCIRCUIT_Handler    ; PVT CIRCUIT 
-                DCD    USBWakeup_Handler     ; USB wake up 
-                DCD    0
-
-                IF      :LNOT::DEF:NO_CRP
-                AREA    |.ARM.__at_0x02FC|, CODE, READONLY
-CRP_Key         DCD     0xFFFFFFFF
-                ENDIF
-
-
-                AREA    |.text|, CODE, READONLY
-
-
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-
-; Dummy Exception Handlers (infinite loops which can be modified)                
-
-NMI_Handler     PROC
-                EXPORT  NMI_Handler               [WEAK]
-                B       .
-                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-MemManage_Handler\
-                PROC
-                EXPORT  MemManage_Handler         [WEAK]
-                B       .
-                ENDP
-BusFault_Handler\
-                PROC
-                EXPORT  BusFault_Handler          [WEAK]
-                B       .
-                ENDP
-UsageFault_Handler\
-                PROC
-                EXPORT  UsageFault_Handler        [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-DebugMon_Handler\
-                PROC
-                EXPORT  DebugMon_Handler          [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-
-                EXPORT  PIN_INT0_Handler          [WEAK]
-                EXPORT  PIN_INT1_Handler          [WEAK]
-                EXPORT  PIN_INT2_Handler          [WEAK]
-                EXPORT  PIN_INT3_Handler          [WEAK]
-                EXPORT  PIN_INT4_Handler          [WEAK]
-                EXPORT  PIN_INT5_Handler          [WEAK]
-                EXPORT  PIN_INT6_Handler          [WEAK]
-                EXPORT  PIN_INT7_Handler          [WEAK]
-                EXPORT  GINT0_Handler             [WEAK]
-                EXPORT  GINT1_Handler             [WEAK]
-                EXPORT  OSTIMER_Handler           [WEAK]
-                EXPORT  SSP1_Handler              [WEAK]
-                EXPORT  I2C_Handler               [WEAK]
-                EXPORT  CT16B0_Handler            [WEAK]
-                EXPORT  CT16B1_Handler            [WEAK]
-                EXPORT  CT32B0_Handler            [WEAK]
-                EXPORT  CT32B1_Handler            [WEAK]
-                EXPORT  SSP0_Handler              [WEAK]
-                EXPORT  USART_Handler             [WEAK]
-                EXPORT  USB_Handler               [WEAK]
-                EXPORT  USB_FIQHandler            [WEAK]
-                EXPORT  ADC_Handler               [WEAK]
-                EXPORT  WDT_Handler               [WEAK]
-                EXPORT  BOD_Handler               [WEAK]
-                EXPORT  FMC_Handler               [WEAK]
-                EXPORT  OSCFAIL_Handler           [WEAK]
-                EXPORT  PVTCIRCUIT_Handler        [WEAK]
-                EXPORT  USBWakeup_Handler         [WEAK]
-  
-PIN_INT0_Handler
-PIN_INT1_Handler
-PIN_INT2_Handler
-PIN_INT3_Handler
-PIN_INT4_Handler
-PIN_INT5_Handler
-PIN_INT6_Handler
-PIN_INT7_Handler
-GINT0_Handler
-GINT1_Handler
-OSTIMER_Handler
-SSP1_Handler
-I2C_Handler
-CT16B0_Handler
-CT16B1_Handler
-CT32B0_Handler
-CT32B1_Handler
-SSP0_Handler
-USART_Handler
-USB_Handler
-USB_FIQHandler
-ADC_Handler
-WDT_Handler
-BOD_Handler
-FMC_Handler
-OSCFAIL_Handler
-PVTCIRCUIT_Handler
-USBWakeup_Handler
-
-                B       .
-
-                ENDP
-                
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC13XX/TOOLCHAIN_ARM_STD/sys.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library - stackheap
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * Setup a fixed single stack/heap memory model, 
- *  between the top of the RW/ZI region and the stackpointer
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-#include <rt_misc.h>
-#include <stdint.h>
-
-extern char Image$$RW_IRAM1$$ZI$$Limit[];
-
-extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
-    uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
-    uint32_t sp_limit = __current_sp();
-
-    zi_limit = (zi_limit + 7) & ~0x7;    // ensure zi_limit is 8-byte aligned
-
-    struct __initial_stackheap r;
-    r.heap_base = zi_limit;
-    r.heap_limit = sp_limit;
-    return r;
-}
-
-#ifdef __cplusplus
-}
-#endif 
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC13XX/TOOLCHAIN_GCC_ARM/LPC1347.ld	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/* Linker script for mbed LPC1347 */
-
-/* Linker script to configure memory regions. */
-MEMORY
-{
-  FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 64K
-  RAM (rwx) : ORIGIN = 0x100000C0, LENGTH = 0x1F40
-
-  RAM1(rwx) : ORIGIN = 0x20000000, LENGTH = 2K
-  USB_RAM(rwx) : ORIGIN = 0x20004000, LENGTH = 2K
-}
-
-/* Linker script to place sections and symbol values. Should be used together
- * with other linker script that defines memory regions FLASH and RAM.
- * It references following symbols, which must be defined in code:
- *   Reset_Handler : Entry of reset handler
- * 
- * It defines following symbols, which code can use without definition:
- *   __exidx_start
- *   __exidx_end
- *   __etext
- *   __data_start__
- *   __preinit_array_start
- *   __preinit_array_end
- *   __init_array_start
- *   __init_array_end
- *   __fini_array_start
- *   __fini_array_end
- *   __data_end__
- *   __bss_start__
- *   __bss_end__
- *   __end__
- *   end
- *   __HeapLimit
- *   __StackLimit
- *   __StackTop
- *   __stack
- */
-ENTRY(Reset_Handler)
-
-SECTIONS
-{
-    .text :
-    {
-        KEEP(*(.isr_vector))
-        *(.text*)
-
-        KEEP(*(.init))
-        KEEP(*(.fini))
-
-        /* .ctors */
-        *crtbegin.o(.ctors)
-        *crtbegin?.o(.ctors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
-        *(SORT(.ctors.*))
-        *(.ctors)
-
-        /* .dtors */
-        *crtbegin.o(.dtors)
-        *crtbegin?.o(.dtors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
-        *(SORT(.dtors.*))
-        *(.dtors)
-
-        *(.rodata*)
-
-        KEEP(*(.eh_frame*))
-    } > FLASH
-
-    .ARM.extab : 
-    {
-        *(.ARM.extab* .gnu.linkonce.armextab.*)
-    } > FLASH
-
-    __exidx_start = .;
-    .ARM.exidx :
-    {
-        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-    } > FLASH
-    __exidx_end = .;
-
-    __etext = .;
-        
-    .data : AT (__etext)
-    {
-        __data_start__ = .;
-        *(vtable)
-        *(.data*)
-
-        . = ALIGN(4);
-        /* preinit data */
-        PROVIDE (__preinit_array_start = .);
-        KEEP(*(.preinit_array))
-        PROVIDE (__preinit_array_end = .);
-
-        . = ALIGN(4);
-        /* init data */
-        PROVIDE (__init_array_start = .);
-        KEEP(*(SORT(.init_array.*)))
-        KEEP(*(.init_array))
-        PROVIDE (__init_array_end = .);
-
-
-        . = ALIGN(4);
-        /* finit data */
-        PROVIDE (__fini_array_start = .);
-        KEEP(*(SORT(.fini_array.*)))
-        KEEP(*(.fini_array))
-        PROVIDE (__fini_array_end = .);
-
-        . = ALIGN(4);
-        /* All data end */
-        __data_end__ = .;
-
-    } > RAM
-
-    .bss :
-    {
-        __bss_start__ = .;
-        *(.bss*)
-        *(COMMON)
-        __bss_end__ = .;
-    } > RAM
-    
-    .heap :
-    {
-        __end__ = .;
-        end = __end__;
-        *(.heap*)
-        __HeapLimit = .;
-    } > RAM
-
-    /* .stack_dummy section doesn't contains any symbols. It is only
-     * used for linker to calculate size of stack sections, and assign
-     * values to stack symbols later */
-    .stack_dummy :
-    {
-        *(.stack)
-    } > RAM
-
-    /* Set stack top to end of RAM, and stack limit move down by
-     * size of stack_dummy section */
-    __StackTop = ORIGIN(RAM) + LENGTH(RAM);
-    __StackLimit = __StackTop - SIZEOF(.stack_dummy);
-    PROVIDE(__stack = __StackTop);
-    
-    /* Check if data + heap + stack exceeds RAM limit */
-    ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC13XX/TOOLCHAIN_GCC_ARM/startup_LPC13xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,209 +0,0 @@
-/* File: startup_ARMCM3.s
- * Purpose: startup file for Cortex-M3/M4 devices. Should use with 
- *   GNU Tools for ARM Embedded Processors
- * Version: V1.1
- * Date: 17 June 2011
- * 
- * Copyright (C) 2011 ARM Limited. All rights reserved.
- * ARM Limited (ARM) is supplying this software for use with Cortex-M3/M4 
- * processor based microcontrollers.  This file can be freely distributed 
- * within development tools that are supporting such ARM based processors. 
- *
- * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- */
-    .syntax unified
-    .arch armv7-m
-
-/* Memory Model
-   The HEAP starts at the end of the DATA section and grows upward.
-   
-   The STACK starts at the end of the RAM and grows downward.
-   
-   The HEAP and stack STACK are only checked at compile time:
-   (DATA_SIZE + HEAP_SIZE + STACK_SIZE) < RAM_SIZE
-   
-   This is just a check for the bare minimum for the Heap+Stack area before
-   aborting compilation, it is not the run time limit:
-   Heap_Size + Stack_Size = 0x80 + 0x80 = 0x100
- */
-    .section .stack
-    .align 3
-#ifdef __STACK_SIZE
-    .equ    Stack_Size, __STACK_SIZE
-#else
-    .equ    Stack_Size, 0xc00
-#endif
-    .globl    __StackTop
-    .globl    __StackLimit
-__StackLimit:
-    .space    Stack_Size
-    .size __StackLimit, . - __StackLimit
-__StackTop:
-    .size __StackTop, . - __StackTop
-
-    .section .heap
-    .align 3
-#ifdef __HEAP_SIZE
-    .equ    Heap_Size, __HEAP_SIZE
-#else
-    .equ    Heap_Size, 0x800
-#endif
-    .globl    __HeapBase
-    .globl    __HeapLimit
-__HeapBase:
-    .space    Heap_Size
-    .size __HeapBase, . - __HeapBase
-__HeapLimit:
-    .size __HeapLimit, . - __HeapLimit
-    
-    .section .isr_vector
-    .align 2
-    .globl __isr_vector
-__isr_vector:
-    .long    __StackTop            /* Top of Stack */
-    .long    Reset_Handler         /* Reset Handler */
-    .long    NMI_Handler           /* NMI Handler */
-    .long    HardFault_Handler     /* Hard Fault Handler */
-    .long    MemManage_Handler     /* MPU Fault Handler */
-    .long    BusFault_Handler      /* Bus Fault Handler */
-    .long    UsageFault_Handler    /* Usage Fault Handler */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    SVC_Handler           /* SVCall Handler */
-    .long    DebugMon_Handler      /* Debug Monitor Handler */
-    .long    0                     /* Reserved */
-    .long    PendSV_Handler        /* PendSV Handler */
-    .long    SysTick_Handler       /* SysTick Handler */
-
-
-    .long    PIN_INT0_Handler      /* All GPIO pin can be routed to PIN_INTx */
-    .long    PIN_INT1_Handler
-    .long    PIN_INT2_Handler
-    .long    PIN_INT3_Handler
-    .long    PIN_INT4_Handler
-    .long    PIN_INT5_Handler
-    .long    PIN_INT6_Handler
-    .long    PIN_INT7_Handler
-    .long    GINT0_Handler
-    .long    GINT1_Handler         /* PIO0 (0:7) */
-    .long    0
-    .long    0
-    .long    OSTIMER_Handler
-    .long    0
-    .long    SSP1_Handler          /* SSP1 */
-    .long    I2C_Handler           /* I2C */
-    .long    CT16B0_Handler        /* 16-bit Timer0 */
-    .long    CT16B1_Handler        /* 16-bit Timer1 */
-    .long    CT32B0_Handler        /* 32-bit Timer0 */
-    .long    CT32B1_Handler        /* 32-bit Timer1 */
-    .long    SSP0_Handler          /* SSP0 */
-    .long    USART_Handler         /* USART */
-    .long    USB_Handler           /* USB IRQ */
-    .long    USB_FIQHandler        /* USB FIQ */
-    .long    ADC_Handler           /* A/D Converter */
-    .long    WDT_Handler           /* Watchdog timer */
-    .long    BOD_Handler           /* Brown Out Detect */
-    .long    FMC_Handler           /* IP2111 Flash Memory Controller */
-    .long    OSCFAIL_Handler       /* OSC FAIL */
-    .long    PVTCIRCUIT_Handler    /* PVT CIRCUIT */
-    .long    USBWakeup_Handler     /* USB wake up */
-    .long    0
-
-    .size    __isr_vector, . - __isr_vector
-
-    .text
-    .thumb
-    .thumb_func
-    .align 2
-    .globl    Reset_Handler
-    .type    Reset_Handler, %function
-Reset_Handler:
-/*     Loop to copy data from read only memory to RAM. The ranges
- *      of copy from/to are specified by following symbols evaluated in 
- *      linker script.
- *      _etext: End of code section, i.e., begin of data sections to copy from.
- *      __data_start__/__data_end__: RAM address range that data should be
- *      copied to. Both must be aligned to 4 bytes boundary.  */
-
-    ldr    r1, =__etext
-    ldr    r2, =__data_start__
-    ldr    r3, =__data_end__
-
-.flash_to_ram_loop:
-    cmp     r2, r3
-    ittt    lt
-    ldrlt   r0, [r1], #4
-    strlt   r0, [r2], #4
-    blt    .flash_to_ram_loop
-
-    ldr    r0, =SystemInit
-    blx    r0
-    ldr    r0, =_start
-    bx    r0
-    .pool
-    .size Reset_Handler, . - Reset_Handler
-    
-/*    Macro to define default handlers. Default handler
- *    will be weak symbol and just dead loops. They can be
- *    overwritten by other handlers */
-    .macro    def_default_handler    handler_name
-    .align 1
-    .thumb_func
-    .weak    \handler_name
-    .type    \handler_name, %function
-\handler_name :
-    b    .
-    .size    \handler_name, . - \handler_name
-    .endm
-    
-    def_default_handler    NMI_Handler
-    def_default_handler    HardFault_Handler
-    def_default_handler    MemManage_Handler
-    def_default_handler    BusFault_Handler
-    def_default_handler    UsageFault_Handler
-    def_default_handler    SVC_Handler
-    def_default_handler    DebugMon_Handler
-    def_default_handler    PendSV_Handler
-    def_default_handler    SysTick_Handler
-    def_default_handler    Default_Handler
-
-    def_default_handler    PIN_INT0_Handler
-    def_default_handler    PIN_INT1_Handler
-    def_default_handler    PIN_INT2_Handler
-    def_default_handler    PIN_INT3_Handler
-    def_default_handler    PIN_INT4_Handler
-    def_default_handler    PIN_INT5_Handler
-    def_default_handler    PIN_INT6_Handler
-    def_default_handler    PIN_INT7_Handler
-    def_default_handler    GINT0_Handler
-    def_default_handler    GINT1_Handler
-    def_default_handler    OSTIMER_Handler
-    def_default_handler    SSP1_Handler
-    def_default_handler    I2C_Handler
-    def_default_handler    CT16B0_Handler
-    def_default_handler    CT16B1_Handler
-    def_default_handler    CT32B0_Handler
-    def_default_handler    CT32B1_Handler
-    def_default_handler    SSP0_Handler
-    def_default_handler    USART_Handler
-    def_default_handler    USB_Handler
-    def_default_handler    USB_FIQHandler
-    def_default_handler    ADC_Handler
-    def_default_handler    WDT_Handler
-    def_default_handler    BOD_Handler
-    def_default_handler    FMC_Handler
-    def_default_handler    OSCFAIL_Handler
-    def_default_handler    PVTCIRCUIT_Handler
-    def_default_handler    USBWakeup_Handler
-
-    .weak    DEF_IRQHandler
-    .set    DEF_IRQHandler, Default_Handler
-
-    .end
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC13XX/cmsis.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-/* mbed Microcontroller Library - CMSIS
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * A generic CMSIS include header, pulling in LPC13XX specifics
- */
-
-#ifndef MBED_CMSIS_H
-#define MBED_CMSIS_H
-
-#include "LPC13Uxx.h"
-#include "cmsis_nvic.h"
-
-#endif
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC13XX/cmsis_nvic.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic for LCP1768
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */ 
-#include "cmsis_nvic.h"
-
-#define NVIC_RAM_VECTOR_ADDRESS   (0x10000000)  // Location of vectors in RAM
-#define NVIC_FLASH_VECTOR_ADDRESS (0x0)       // Initial vector position in flash
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
-    uint32_t *vectors = (uint32_t*)SCB->VTOR;
-    uint32_t i;
-
-    // Copy and switch to dynamic vectors if the first time called
-    if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
-        uint32_t *old_vectors = vectors;
-        vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
-        for (i=0; i<NVIC_NUM_VECTORS; i++) {
-            vectors[i] = old_vectors[i];
-        }
-        SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
-    }
-    vectors[IRQn + 16] = vector;
-}
-
-uint32_t NVIC_GetVector(IRQn_Type IRQn) {
-    uint32_t *vectors = (uint32_t*)SCB->VTOR;
-    return vectors[IRQn + 16];
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC13XX/cmsis_nvic.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */ 
-
-#ifndef MBED_CMSIS_NVIC_H
-#define MBED_CMSIS_NVIC_H
-
-#include "cmsis.h"
-
-#define NVIC_NUM_VECTORS      (16 + 32)   // CORE + MCU Peripherals
-#define NVIC_USER_IRQ_OFFSET  16
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
-uint32_t NVIC_GetVector(IRQn_Type IRQn);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC13XX/system_LPC13Uxx.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,437 +0,0 @@
-/******************************************************************************
- * @file     system_LPC13Uxx.c
- * @purpose  CMSIS Cortex-M3 Device Peripheral Access Layer Source File
- *           for the NXP LPC13xx Device Series
- * @version  V1.10
- * @date     24. November 2010
- *
- * @note
- * Copyright (C) 2009-2010 ARM Limited. All rights reserved.
- *
- * @par
- * ARM Limited (ARM) is supplying this software for use with Cortex-M 
- * processor based microcontrollers.  This file can be freely distributed 
- * within development tools that are supporting such ARM based processors. 
- *
- * @par
- * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- *
- ******************************************************************************/
-
-
-#include <stdint.h>
-#include "LPC13Uxx.h"
-
-/*
-//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-*/
-
-/*--------------------- Clock Configuration ----------------------------------
-//
-// <e> Clock Configuration
-//   <h> System Oscillator Control Register (SYSOSCCTRL)
-//     <o1.0>      BYPASS: System Oscillator Bypass Enable
-//                     <i> If enabled then PLL input (sys_osc_clk) is fed
-//                     <i> directly from XTALIN and XTALOUT pins.
-//     <o1.9>      FREQRANGE: System Oscillator Frequency Range
-//                     <i> Determines frequency range for Low-power oscillator.
-//                   <0=> 1 - 20 MHz
-//                   <1=> 15 - 25 MHz
-//   </h>
-//
-//   <h> Watchdog Oscillator Control Register (WDTOSCCTRL)
-//     <o2.0..4>   DIVSEL: Select Divider for Fclkana
-//                     <i> wdt_osc_clk = Fclkana/ (2 * (1 + DIVSEL))
-//                   <0-31>
-//     <o2.5..8>   FREQSEL: Select Watchdog Oscillator Analog Output Frequency (Fclkana)
-//                   <0=> Undefined
-//                   <1=> 0.5 MHz
-//                   <2=> 0.8 MHz
-//                   <3=> 1.1 MHz
-//                   <4=> 1.4 MHz
-//                   <5=> 1.6 MHz
-//                   <6=> 1.8 MHz
-//                   <7=> 2.0 MHz
-//                   <8=> 2.2 MHz
-//                   <9=> 2.4 MHz
-//                   <10=> 2.6 MHz
-//                   <11=> 2.7 MHz
-//                   <12=> 2.9 MHz
-//                   <13=> 3.1 MHz
-//                   <14=> 3.2 MHz
-//                   <15=> 3.4 MHz
-//   </h>
-//
-//   <h> System PLL Control Register (SYSPLLCTRL)
-//                   <i> F_clkout = M * F_clkin = F_CCO / (2 * P)
-//                   <i> F_clkin must be in the range of  10 MHz to  25 MHz
-//                   <i> F_CCO   must be in the range of 156 MHz to 320 MHz
-//     <o3.0..4>   MSEL: Feedback Divider Selection
-//                     <i> M = MSEL + 1
-//                   <0-31>
-//     <o3.5..6>   PSEL: Post Divider Selection
-//                   <0=> P = 1
-//                   <1=> P = 2
-//                   <2=> P = 4
-//                   <3=> P = 8
-//   </h>
-//
-//   <h> System PLL Clock Source Select Register (SYSPLLCLKSEL)
-//     <o4.0..1>   SEL: System PLL Clock Source
-//                   <0=> IRC Oscillator
-//                   <1=> System Oscillator
-//                   <2=> Reserved
-//                   <3=> Reserved
-//   </h>
-//
-//   <h> Main Clock Source Select Register (MAINCLKSEL)
-//     <o5.0..1>   SEL: Clock Source for Main Clock
-//                   <0=> IRC Oscillator
-//                   <1=> Input Clock to System PLL
-//                   <2=> WDT Oscillator
-//                   <3=> System PLL Clock Out
-//   </h>
-//
-//   <h> System AHB Clock Divider Register (SYSAHBCLKDIV)
-//     <o6.0..7>   DIV: System AHB Clock Divider
-//                     <i> Divides main clock to provide system clock to core, memories, and peripherals.
-//                     <i> 0 = is disabled
-//                   <0-255>
-//   </h>
-//
-//   <h> USB PLL Control Register (USBPLLCTRL)
-//                   <i> F_clkout = M * F_clkin = F_CCO / (2 * P)
-//                   <i> F_clkin must be in the range of  10 MHz to  25 MHz
-//                   <i> F_CCO   must be in the range of 156 MHz to 320 MHz
-//     <o7.0..4>   MSEL: Feedback Divider Selection
-//                     <i> M = MSEL + 1
-//                   <0-31>
-//     <o7.5..6>   PSEL: Post Divider Selection
-//                   <0=> P = 1
-//                   <1=> P = 2
-//                   <2=> P = 4
-//                   <3=> P = 8
-//   </h>
-//
-//   <h> USB PLL Clock Source Select Register (USBPLLCLKSEL)
-//     <o8.0..1>   SEL: USB PLL Clock Source
-//                     <i> USB PLL clock source must be switched to System Oscillator for correct USB operation
-//                   <0=> IRC Oscillator
-//                   <1=> System Oscillator
-//                   <2=> Reserved
-//                   <3=> Reserved
-//   </h>
-//
-//   <h> USB Clock Source Select Register (USBCLKSEL)
-//     <o9.0..1>   SEL: System PLL Clock Source
-//                   <0=> USB PLL out
-//                   <1=> Main clock
-//                   <2=> Reserved
-//                   <3=> Reserved
-//   </h>
-//
-//   <h> USB Clock Divider Register (USBCLKDIV)
-//     <o10.0..7>  DIV: USB Clock Divider
-//                     <i> Divides USB clock to 48 MHz.
-//                     <i> 0 = is disabled
-//                   <0-255>
-//   </h>
-// </e>
-*/
-#define CLOCK_SETUP           1
-#define SYSOSCCTRL_Val        0x00000000              // Reset: 0x000
-#define WDTOSCCTRL_Val        0x00000000              // Reset: 0x000
-#define SYSPLLCTRL_Val        0x00000025              // Reset: 0x000
-#define SYSPLLCLKSEL_Val      0x00000001              // Reset: 0x000
-#define MAINCLKSEL_Val        0x00000003              // Reset: 0x000
-#define SYSAHBCLKDIV_Val      0x00000001              // Reset: 0x001
-#define USBPLLCTRL_Val        0x00000023              // Reset: 0x000
-#define USBPLLCLKSEL_Val      0x00000001              // Reset: 0x000
-#define USBCLKSEL_Val         0x00000000              // Reset: 0x000
-#define USBCLKDIV_Val         0x00000001              // Reset: 0x001
-
-/*
-//-------- <<< end of configuration section >>> ------------------------------
-*/
-
-/*----------------------------------------------------------------------------
-  Check the register settings
- *----------------------------------------------------------------------------*/
-#define CHECK_RANGE(val, min, max)                ((val < min) || (val > max))
-#define CHECK_RSVD(val, mask)                     (val & mask)
-
-/* Clock Configuration -------------------------------------------------------*/
-#if (CHECK_RSVD((SYSOSCCTRL_Val),  ~0x00000003))
-   #error "SYSOSCCTRL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((WDTOSCCTRL_Val),  ~0x000001FF))
-   #error "WDTOSCCTRL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RANGE((SYSPLLCLKSEL_Val), 0, 2))
-   #error "SYSPLLCLKSEL: Value out of range!"
-#endif
-
-#if (CHECK_RSVD((SYSPLLCTRL_Val),  ~0x000001FF))
-   #error "SYSPLLCTRL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((MAINCLKSEL_Val),  ~0x00000003))
-   #error "MAINCLKSEL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RANGE((SYSAHBCLKDIV_Val), 0, 255))
-   #error "SYSAHBCLKDIV: Value out of range!"
-#endif
-
-#if (CHECK_RANGE((USBPLLCLKSEL_Val), 0, 1))
-   #error "USBPLLCLKSEL: Value out of range!"
-#endif
-
-#if (CHECK_RSVD((USBPLLCTRL_Val),  ~0x000001FF))
-   #error "USBPLLCTRL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RANGE((USBCLKSEL_Val), 0, 1))
-   #error "USBCLKSEL: Value out of range!"
-#endif
-
-#if (CHECK_RANGE((USBCLKDIV_Val), 0, 255))
-   #error "USBCLKDIV: Value out of range!"
-#endif
-
-
-/*----------------------------------------------------------------------------
-  DEFINES
- *----------------------------------------------------------------------------*/
-    
-/*----------------------------------------------------------------------------
-  Define clocks
- *----------------------------------------------------------------------------*/
-#define __XTAL            (12000000UL)    /* Oscillator frequency             */
-#define __SYS_OSC_CLK     (    __XTAL)    /* Main oscillator frequency        */
-#define __IRC_OSC_CLK     (12000000UL)    /* Internal RC oscillator frequency */
-
-
-#define __FREQSEL   ((WDTOSCCTRL_Val >> 5) & 0x0F)
-#define __DIVSEL   (((WDTOSCCTRL_Val & 0x1F) << 1) + 2)
-
-#if (CLOCK_SETUP)                         /* Clock Setup              */
-  #if  (__FREQSEL ==  0)
-    #define __WDT_OSC_CLK        ( 0)                  /* undefined */
-  #elif (__FREQSEL ==  1)
-    #define __WDT_OSC_CLK        ( 500000 / __DIVSEL)
-  #elif (__FREQSEL ==  2)
-    #define __WDT_OSC_CLK        ( 800000 / __DIVSEL)
-  #elif (__FREQSEL ==  3)
-    #define __WDT_OSC_CLK        (1100000 / __DIVSEL)
-  #elif (__FREQSEL ==  4)
-    #define __WDT_OSC_CLK        (1400000 / __DIVSEL)
-  #elif (__FREQSEL ==  5)
-    #define __WDT_OSC_CLK        (1600000 / __DIVSEL)
-  #elif (__FREQSEL ==  6)
-    #define __WDT_OSC_CLK        (1800000 / __DIVSEL)
-  #elif (__FREQSEL ==  7)
-    #define __WDT_OSC_CLK        (2000000 / __DIVSEL)
-  #elif (__FREQSEL ==  8)
-    #define __WDT_OSC_CLK        (2200000 / __DIVSEL)
-  #elif (__FREQSEL ==  9)
-    #define __WDT_OSC_CLK        (2400000 / __DIVSEL)
-  #elif (__FREQSEL == 10)
-    #define __WDT_OSC_CLK        (2600000 / __DIVSEL)
-  #elif (__FREQSEL == 11)
-    #define __WDT_OSC_CLK        (2700000 / __DIVSEL)
-  #elif (__FREQSEL == 12)
-    #define __WDT_OSC_CLK        (2900000 / __DIVSEL)
-  #elif (__FREQSEL == 13)
-    #define __WDT_OSC_CLK        (3100000 / __DIVSEL)
-  #elif (__FREQSEL == 14)
-    #define __WDT_OSC_CLK        (3200000 / __DIVSEL)
-  #else
-    #define __WDT_OSC_CLK        (3400000 / __DIVSEL)
-  #endif
-
-  /* sys_pllclkin calculation */
-  #if   ((SYSPLLCLKSEL_Val & 0x03) == 0)
-    #define __SYS_PLLCLKIN           (__IRC_OSC_CLK)
-  #elif ((SYSPLLCLKSEL_Val & 0x03) == 1)
-    #define __SYS_PLLCLKIN           (__SYS_OSC_CLK)
-  #else
-    #define __SYS_PLLCLKIN           (0)
-  #endif
-
-  #define  __SYS_PLLCLKOUT         (__SYS_PLLCLKIN * ((SYSPLLCTRL_Val & 0x01F) + 1))
-
-  /* main clock calculation */
-  #if   ((MAINCLKSEL_Val & 0x03) == 0)
-    #define __MAIN_CLOCK             (__IRC_OSC_CLK)
-  #elif ((MAINCLKSEL_Val & 0x03) == 1)
-    #define __MAIN_CLOCK             (__SYS_PLLCLKIN)
-  #elif ((MAINCLKSEL_Val & 0x03) == 2)
-    #if (__FREQSEL ==  0)
-      #error "MAINCLKSEL: WDT Oscillator selected but FREQSEL is undefined!"
-    #else
-      #define __MAIN_CLOCK           (__WDT_OSC_CLK)
-    #endif
-  #elif ((MAINCLKSEL_Val & 0x03) == 3)
-    #define __MAIN_CLOCK             (__SYS_PLLCLKOUT)
-  #else
-    #define __MAIN_CLOCK             (0)
-  #endif
-
-  #define __SYSTEM_CLOCK             (__MAIN_CLOCK / SYSAHBCLKDIV_Val)         
-
-#else
-  #define __SYSTEM_CLOCK             (__IRC_OSC_CLK)
-#endif  // CLOCK_SETUP 
-
-
-/*----------------------------------------------------------------------------
-  Clock Variable definitions
- *----------------------------------------------------------------------------*/
-uint32_t SystemCoreClock = __SYSTEM_CLOCK;/*!< System Clock Frequency (Core Clock)*/
-
-
-/*----------------------------------------------------------------------------
-  Clock functions
- *----------------------------------------------------------------------------*/
-void SystemCoreClockUpdate (void)            /* Get Core Clock Frequency      */
-{
-  uint32_t wdt_osc = 0;
-
-  /* Determine clock frequency according to clock register values             */
-  switch ((LPC_SYSCON->WDTOSCCTRL >> 5) & 0x0F) {
-    case 0:  wdt_osc =       0; break;
-    case 1:  wdt_osc =  500000; break;
-    case 2:  wdt_osc =  800000; break;
-    case 3:  wdt_osc = 1100000; break;
-    case 4:  wdt_osc = 1400000; break;
-    case 5:  wdt_osc = 1600000; break;
-    case 6:  wdt_osc = 1800000; break;
-    case 7:  wdt_osc = 2000000; break;
-    case 8:  wdt_osc = 2200000; break;
-    case 9:  wdt_osc = 2400000; break;
-    case 10: wdt_osc = 2600000; break;
-    case 11: wdt_osc = 2700000; break;
-    case 12: wdt_osc = 2900000; break;
-    case 13: wdt_osc = 3100000; break;
-    case 14: wdt_osc = 3200000; break;
-    case 15: wdt_osc = 3400000; break;
-  }
-  wdt_osc /= ((LPC_SYSCON->WDTOSCCTRL & 0x1F) << 1) + 2;
- 
-  switch (LPC_SYSCON->MAINCLKSEL & 0x03) {
-    case 0:                             /* Internal RC oscillator             */
-      SystemCoreClock = __IRC_OSC_CLK;
-      break;
-    case 1:                             /* Input Clock to System PLL          */
-      switch (LPC_SYSCON->SYSPLLCLKSEL & 0x03) {
-          case 0:                       /* Internal RC oscillator             */
-            SystemCoreClock = __IRC_OSC_CLK;
-            break;
-          case 1:                       /* System oscillator                  */
-            SystemCoreClock = __SYS_OSC_CLK;
-            break;
-          case 2:                       /* Reserved                           */
-          case 3:                       /* Reserved                           */
-            SystemCoreClock = 0;
-            break;
-      }
-      break;
-    case 2:                             /* WDT Oscillator                     */
-      SystemCoreClock = wdt_osc;
-      break;
-    case 3:                             /* System PLL Clock Out               */
-      switch (LPC_SYSCON->SYSPLLCLKSEL & 0x03) {
-          case 0:                       /* Internal RC oscillator             */
-            if (LPC_SYSCON->SYSPLLCTRL & 0x180) {
-              SystemCoreClock = __IRC_OSC_CLK;
-            } else {
-              SystemCoreClock = __IRC_OSC_CLK * ((LPC_SYSCON->SYSPLLCTRL & 0x01F) + 1);
-            }
-            break;
-          case 1:                       /* System oscillator                  */
-            if (LPC_SYSCON->SYSPLLCTRL & 0x180) {
-              SystemCoreClock = __SYS_OSC_CLK;
-            } else {
-              SystemCoreClock = __SYS_OSC_CLK * ((LPC_SYSCON->SYSPLLCTRL & 0x01F) + 1);
-            }
-            break;
-          case 2:                       /* Reserved                           */
-          case 3:                       /* Reserved                           */
-            SystemCoreClock = 0;
-            break;
-      }
-      break;
-  }
-
-  SystemCoreClock /= LPC_SYSCON->SYSAHBCLKDIV;  
-
-}
-
-/**
- * Initialize the system
- *
- * @param  none
- * @return none
- *
- * @brief  Setup the microcontroller system.
- *         Initialize the System.
- */
-void SystemInit (void) {
-  volatile uint32_t i;
-
-#if (CLOCK_SETUP)                                 /* Clock Setup              */
-
-#if ((SYSPLLCLKSEL_Val & 0x03) == 1)
-  LPC_SYSCON->PDRUNCFG     &= ~(1 << 5);          /* Power-up System Osc      */
-  LPC_SYSCON->SYSOSCCTRL    = SYSOSCCTRL_Val;
-  for (i = 0; i < 200; i++) __NOP();
-#endif
-
-  LPC_SYSCON->SYSPLLCLKSEL  = SYSPLLCLKSEL_Val;   /* Select PLL Input         */
-#if ((MAINCLKSEL_Val & 0x03) == 3)                /* Main Clock is PLL Out    */
-  LPC_SYSCON->SYSPLLCTRL    = SYSPLLCTRL_Val;
-  LPC_SYSCON->PDRUNCFG     &= ~(1 << 7);          /* Power-up SYSPLL          */
-  while (!(LPC_SYSCON->SYSPLLSTAT & 0x01));	      /* Wait Until PLL Locked    */
-#endif
-
-#if (((MAINCLKSEL_Val & 0x03) == 2) )
-  LPC_SYSCON->WDTOSCCTRL    = WDTOSCCTRL_Val;
-  LPC_SYSCON->PDRUNCFG     &= ~(1 << 6);          /* Power-up WDT Clock       */
-  for (i = 0; i < 200; i++) __NOP();
-#endif
-
-  LPC_SYSCON->MAINCLKSEL    = MAINCLKSEL_Val;     /* Select PLL Clock Output  */
-
-  LPC_SYSCON->SYSAHBCLKDIV  = SYSAHBCLKDIV_Val;
-
-#if ((USBCLKDIV_Val & 0x1FF) != 0)                /* USB clock is used        */
-  LPC_SYSCON->PDRUNCFG     &= ~(1 << 10);         /* Power-up USB PHY         */
-
-  /* Regardless USB PLL is used as USB clock or not, USB PLL needs to be configured. */
-  LPC_SYSCON->PDRUNCFG     &= ~(1 <<  8);         /* Power-up USB PLL         */
-  LPC_SYSCON->USBPLLCLKSEL  = USBPLLCLKSEL_Val;   /* Select PLL Input         */
-  LPC_SYSCON->USBPLLCTRL    = USBPLLCTRL_Val;
-  while (!(LPC_SYSCON->USBPLLSTAT   & 0x01));     /* Wait Until PLL Locked    */
-
-  LPC_SYSCON->USBCLKSEL     = USBCLKSEL_Val;      /* Select USB Clock         */
-  LPC_SYSCON->USBCLKDIV     = USBCLKDIV_Val;      /* Set USB clock divider    */
-
-#else                                             /* USB clock is not used    */                        
-  LPC_SYSCON->PDRUNCFG     |=  (1 << 10);         /* Power-down USB PHY       */
-  LPC_SYSCON->PDRUNCFG     |=  (1 <<  8);         /* Power-down USB PLL       */
-#endif
-
-#endif
-
-  /* System clock to the IOCON needs to be enabled or
-  most of the I/O related peripherals won't work. */
-  LPC_SYSCON->SYSAHBCLKCTRL |= (1<<16);
-
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC13XX/system_LPC13Uxx.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/**************************************************************************//**
- * @file     system_LPC13Uxx.h
- * @brief    CMSIS Cortex-M3 Device Peripheral Access Layer Header File
- *           for the NXP LPC13Uxx Device Series
- * @version  V1.10
- * @date     24. November 2010
- *
- * @note
- * Copyright (C) 2009-2010 ARM Limited. All rights reserved.
- *
- * @par
- * ARM Limited (ARM) is supplying this software for use with Cortex-M 
- * processor based microcontrollers.  This file can be freely distributed 
- * within development tools that are supporting such ARM based processors. 
- *
- * @par
- * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- *
- ******************************************************************************/
-
-
-#ifndef __SYSTEM_LPC13Uxx_H
-#define __SYSTEM_LPC13Uxx_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-extern uint32_t SystemCoreClock;     /*!< System Clock Frequency (Core Clock)  */
-
-
-/**
- * Initialize the system
- *
- * @param  none
- * @return none
- *
- * @brief  Setup the microcontroller system.
- *         Initialize the System and update the SystemCoreClock variable.
- */
-extern void SystemInit (void);
-
-/**
- * Update SystemCoreClock variable
- *
- * @param  none
- * @return none
- *
- * @brief  Updates the SystemCoreClock with current core Clock 
- *         retrieved from cpu registers.
- */
-extern void SystemCoreClockUpdate (void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __SYSTEM_LPC13Uxx_H */
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC176X/LPC17xx.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1035 +0,0 @@
-/**************************************************************************//**
- * @file     LPC17xx.h
- * @brief    CMSIS Cortex-M3 Core Peripheral Access Layer Header File for 
- *           NXP LPC17xx Device Series
- * @version: V1.09
- * @date:    17. March 2010
-
- *
- * @note
- * Copyright (C) 2009 ARM Limited. All rights reserved.
- *
- * @par
- * ARM Limited (ARM) is supplying this software for use with Cortex-M 
- * processor based microcontrollers.  This file can be freely distributed 
- * within development tools that are supporting such ARM based processors. 
- *
- * @par
- * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- *
- ******************************************************************************/
-
-
-#ifndef __LPC17xx_H__
-#define __LPC17xx_H__
-
-/*
- * ==========================================================================
- * ---------- Interrupt Number Definition -----------------------------------
- * ==========================================================================
- */
-
-typedef enum IRQn
-{
-/******  Cortex-M3 Processor Exceptions Numbers ***************************************************/
-  NonMaskableInt_IRQn           = -14,      /*!< 2 Non Maskable Interrupt                         */
-  MemoryManagement_IRQn         = -12,      /*!< 4 Cortex-M3 Memory Management Interrupt          */
-  BusFault_IRQn                 = -11,      /*!< 5 Cortex-M3 Bus Fault Interrupt                  */
-  UsageFault_IRQn               = -10,      /*!< 6 Cortex-M3 Usage Fault Interrupt                */
-  SVCall_IRQn                   = -5,       /*!< 11 Cortex-M3 SV Call Interrupt                   */
-  DebugMonitor_IRQn             = -4,       /*!< 12 Cortex-M3 Debug Monitor Interrupt             */
-  PendSV_IRQn                   = -2,       /*!< 14 Cortex-M3 Pend SV Interrupt                   */
-  SysTick_IRQn                  = -1,       /*!< 15 Cortex-M3 System Tick Interrupt               */
-
-/******  LPC17xx Specific Interrupt Numbers *******************************************************/
-  WDT_IRQn                      = 0,        /*!< Watchdog Timer Interrupt                         */
-  TIMER0_IRQn                   = 1,        /*!< Timer0 Interrupt                                 */
-  TIMER1_IRQn                   = 2,        /*!< Timer1 Interrupt                                 */
-  TIMER2_IRQn                   = 3,        /*!< Timer2 Interrupt                                 */
-  TIMER3_IRQn                   = 4,        /*!< Timer3 Interrupt                                 */
-  UART0_IRQn                    = 5,        /*!< UART0 Interrupt                                  */
-  UART1_IRQn                    = 6,        /*!< UART1 Interrupt                                  */
-  UART2_IRQn                    = 7,        /*!< UART2 Interrupt                                  */
-  UART3_IRQn                    = 8,        /*!< UART3 Interrupt                                  */
-  PWM1_IRQn                     = 9,        /*!< PWM1 Interrupt                                   */
-  I2C0_IRQn                     = 10,       /*!< I2C0 Interrupt                                   */
-  I2C1_IRQn                     = 11,       /*!< I2C1 Interrupt                                   */
-  I2C2_IRQn                     = 12,       /*!< I2C2 Interrupt                                   */
-  SPI_IRQn                      = 13,       /*!< SPI Interrupt                                    */
-  SSP0_IRQn                     = 14,       /*!< SSP0 Interrupt                                   */
-  SSP1_IRQn                     = 15,       /*!< SSP1 Interrupt                                   */
-  PLL0_IRQn                     = 16,       /*!< PLL0 Lock (Main PLL) Interrupt                   */
-  RTC_IRQn                      = 17,       /*!< Real Time Clock Interrupt                        */
-  EINT0_IRQn                    = 18,       /*!< External Interrupt 0 Interrupt                   */
-  EINT1_IRQn                    = 19,       /*!< External Interrupt 1 Interrupt                   */
-  EINT2_IRQn                    = 20,       /*!< External Interrupt 2 Interrupt                   */
-  EINT3_IRQn                    = 21,       /*!< External Interrupt 3 Interrupt                   */
-  ADC_IRQn                      = 22,       /*!< A/D Converter Interrupt                          */
-  BOD_IRQn                      = 23,       /*!< Brown-Out Detect Interrupt                       */
-  USB_IRQn                      = 24,       /*!< USB Interrupt                                    */
-  CAN_IRQn                      = 25,       /*!< CAN Interrupt                                    */
-  DMA_IRQn                      = 26,       /*!< General Purpose DMA Interrupt                    */
-  I2S_IRQn                      = 27,       /*!< I2S Interrupt                                    */
-  ENET_IRQn                     = 28,       /*!< Ethernet Interrupt                               */
-  RIT_IRQn                      = 29,       /*!< Repetitive Interrupt Timer Interrupt             */
-  MCPWM_IRQn                    = 30,       /*!< Motor Control PWM Interrupt                      */
-  QEI_IRQn                      = 31,       /*!< Quadrature Encoder Interface Interrupt           */
-  PLL1_IRQn                     = 32,       /*!< PLL1 Lock (USB PLL) Interrupt                    */
-  USBActivity_IRQn              = 33,       /* USB Activity interrupt                             */
-  CANActivity_IRQn              = 34,       /* CAN Activity interrupt                             */
-} IRQn_Type;
-
-
-/*
- * ==========================================================================
- * ----------- Processor and Core Peripheral Section ------------------------
- * ==========================================================================
- */
-
-/* Configuration of the Cortex-M3 Processor and Core Peripherals */
-#define __MPU_PRESENT             1         /*!< MPU present or not                               */
-#define __NVIC_PRIO_BITS          5         /*!< Number of Bits used for Priority Levels          */
-#define __Vendor_SysTickConfig    0         /*!< Set to 1 if different SysTick Config is used     */
-
-
-#include "core_cm3.h"                       /* Cortex-M3 processor and core peripherals           */
-#include "system_LPC17xx.h"                 /* System Header                                      */
-
-
-/******************************************************************************/
-/*                Device Specific Peripheral registers structures             */
-/******************************************************************************/
-
-#if defined ( __CC_ARM   )
-#pragma anon_unions
-#endif
-
-/*------------- System Control (SC) ------------------------------------------*/
-typedef struct
-{
-  __IO uint32_t FLASHCFG;               /* Flash Accelerator Module           */
-       uint32_t RESERVED0[31];
-  __IO uint32_t PLL0CON;                /* Clocking and Power Control         */
-  __IO uint32_t PLL0CFG;
-  __I  uint32_t PLL0STAT;
-  __O  uint32_t PLL0FEED;
-       uint32_t RESERVED1[4];
-  __IO uint32_t PLL1CON;
-  __IO uint32_t PLL1CFG;
-  __I  uint32_t PLL1STAT;
-  __O  uint32_t PLL1FEED;
-       uint32_t RESERVED2[4];
-  __IO uint32_t PCON;
-  __IO uint32_t PCONP;
-       uint32_t RESERVED3[15];
-  __IO uint32_t CCLKCFG;
-  __IO uint32_t USBCLKCFG;
-  __IO uint32_t CLKSRCSEL;
-  __IO uint32_t	CANSLEEPCLR;
-  __IO uint32_t	CANWAKEFLAGS;
-       uint32_t RESERVED4[10];
-  __IO uint32_t EXTINT;                 /* External Interrupts                */
-       uint32_t RESERVED5;
-  __IO uint32_t EXTMODE;
-  __IO uint32_t EXTPOLAR;
-       uint32_t RESERVED6[12];
-  __IO uint32_t RSID;                   /* Reset                              */
-       uint32_t RESERVED7[7];
-  __IO uint32_t SCS;                    /* Syscon Miscellaneous Registers     */
-  __IO uint32_t IRCTRIM;                /* Clock Dividers                     */
-  __IO uint32_t PCLKSEL0;
-  __IO uint32_t PCLKSEL1;
-       uint32_t RESERVED8[4];
-  __IO uint32_t USBIntSt;               /* USB Device/OTG Interrupt Register  */
-  __IO uint32_t DMAREQSEL;
-  __IO uint32_t CLKOUTCFG;              /* Clock Output Configuration         */
- } LPC_SC_TypeDef;
-
-/*------------- Pin Connect Block (PINCON) -----------------------------------*/
-typedef struct
-{
-  __IO uint32_t PINSEL0;
-  __IO uint32_t PINSEL1;
-  __IO uint32_t PINSEL2;
-  __IO uint32_t PINSEL3;
-  __IO uint32_t PINSEL4;
-  __IO uint32_t PINSEL5;
-  __IO uint32_t PINSEL6;
-  __IO uint32_t PINSEL7;
-  __IO uint32_t PINSEL8;
-  __IO uint32_t PINSEL9;
-  __IO uint32_t PINSEL10;
-       uint32_t RESERVED0[5];
-  __IO uint32_t PINMODE0;
-  __IO uint32_t PINMODE1;
-  __IO uint32_t PINMODE2;
-  __IO uint32_t PINMODE3;
-  __IO uint32_t PINMODE4;
-  __IO uint32_t PINMODE5;
-  __IO uint32_t PINMODE6;
-  __IO uint32_t PINMODE7;
-  __IO uint32_t PINMODE8;
-  __IO uint32_t PINMODE9;
-  __IO uint32_t PINMODE_OD0;
-  __IO uint32_t PINMODE_OD1;
-  __IO uint32_t PINMODE_OD2;
-  __IO uint32_t PINMODE_OD3;
-  __IO uint32_t PINMODE_OD4;
-  __IO uint32_t I2CPADCFG;
-} LPC_PINCON_TypeDef;
-
-/*------------- General Purpose Input/Output (GPIO) --------------------------*/
-typedef struct
-{
-  union {
-    __IO uint32_t FIODIR;
-    struct {
-      __IO uint16_t FIODIRL;
-      __IO uint16_t FIODIRH;
-    };
-    struct {
-      __IO uint8_t  FIODIR0;
-      __IO uint8_t  FIODIR1;
-      __IO uint8_t  FIODIR2;
-      __IO uint8_t  FIODIR3;
-    };
-  };
-  uint32_t RESERVED0[3];
-  union {
-    __IO uint32_t FIOMASK;
-    struct {
-      __IO uint16_t FIOMASKL;
-      __IO uint16_t FIOMASKH;
-    };
-    struct {
-      __IO uint8_t  FIOMASK0;
-      __IO uint8_t  FIOMASK1;
-      __IO uint8_t  FIOMASK2;
-      __IO uint8_t  FIOMASK3;
-    };
-  };
-  union {
-    __IO uint32_t FIOPIN;
-    struct {
-      __IO uint16_t FIOPINL;
-      __IO uint16_t FIOPINH;
-    };
-    struct {
-      __IO uint8_t  FIOPIN0;
-      __IO uint8_t  FIOPIN1;
-      __IO uint8_t  FIOPIN2;
-      __IO uint8_t  FIOPIN3;
-    };
-  };
-  union {
-    __IO uint32_t FIOSET;
-    struct {
-      __IO uint16_t FIOSETL;
-      __IO uint16_t FIOSETH;
-    };
-    struct {
-      __IO uint8_t  FIOSET0;
-      __IO uint8_t  FIOSET1;
-      __IO uint8_t  FIOSET2;
-      __IO uint8_t  FIOSET3;
-    };
-  };
-  union {
-    __O  uint32_t FIOCLR;
-    struct {
-      __O  uint16_t FIOCLRL;
-      __O  uint16_t FIOCLRH;
-    };
-    struct {
-      __O  uint8_t  FIOCLR0;
-      __O  uint8_t  FIOCLR1;
-      __O  uint8_t  FIOCLR2;
-      __O  uint8_t  FIOCLR3;
-    };
-  };
-} LPC_GPIO_TypeDef;
-
-typedef struct
-{
-  __I  uint32_t IntStatus;
-  __I  uint32_t IO0IntStatR;
-  __I  uint32_t IO0IntStatF;
-  __O  uint32_t IO0IntClr;
-  __IO uint32_t IO0IntEnR;
-  __IO uint32_t IO0IntEnF;
-       uint32_t RESERVED0[3];
-  __I  uint32_t IO2IntStatR;
-  __I  uint32_t IO2IntStatF;
-  __O  uint32_t IO2IntClr;
-  __IO uint32_t IO2IntEnR;
-  __IO uint32_t IO2IntEnF;
-} LPC_GPIOINT_TypeDef;
-
-/*------------- Timer (TIM) --------------------------------------------------*/
-typedef struct
-{
-  __IO uint32_t IR;
-  __IO uint32_t TCR;
-  __IO uint32_t TC;
-  __IO uint32_t PR;
-  __IO uint32_t PC;
-  __IO uint32_t MCR;
-  __IO uint32_t MR0;
-  __IO uint32_t MR1;
-  __IO uint32_t MR2;
-  __IO uint32_t MR3;
-  __IO uint32_t CCR;
-  __I  uint32_t CR0;
-  __I  uint32_t CR1;
-       uint32_t RESERVED0[2];
-  __IO uint32_t EMR;
-       uint32_t RESERVED1[12];
-  __IO uint32_t CTCR;
-} LPC_TIM_TypeDef;
-
-/*------------- Pulse-Width Modulation (PWM) ---------------------------------*/
-typedef struct
-{
-  __IO uint32_t IR;
-  __IO uint32_t TCR;
-  __IO uint32_t TC;
-  __IO uint32_t PR;
-  __IO uint32_t PC;
-  __IO uint32_t MCR;
-  __IO uint32_t MR0;
-  __IO uint32_t MR1;
-  __IO uint32_t MR2;
-  __IO uint32_t MR3;
-  __IO uint32_t CCR;
-  __I  uint32_t CR0;
-  __I  uint32_t CR1;
-  __I  uint32_t CR2;
-  __I  uint32_t CR3;
-       uint32_t RESERVED0;
-  __IO uint32_t MR4;
-  __IO uint32_t MR5;
-  __IO uint32_t MR6;
-  __IO uint32_t PCR;
-  __IO uint32_t LER;
-       uint32_t RESERVED1[7];
-  __IO uint32_t CTCR;
-} LPC_PWM_TypeDef;
-
-/*------------- Universal Asynchronous Receiver Transmitter (UART) -----------*/
-typedef struct
-{
-  union {
-  __I  uint8_t  RBR;
-  __O  uint8_t  THR;
-  __IO uint8_t  DLL;
-       uint32_t RESERVED0;
-  };
-  union {
-  __IO uint8_t  DLM;
-  __IO uint32_t IER;
-  };
-  union {
-  __I  uint32_t IIR;
-  __O  uint8_t  FCR;
-  };
-  __IO uint8_t  LCR;
-       uint8_t  RESERVED1[7];
-  __I  uint8_t  LSR;
-       uint8_t  RESERVED2[7];
-  __IO uint8_t  SCR;
-       uint8_t  RESERVED3[3];
-  __IO uint32_t ACR;
-  __IO uint8_t  ICR;
-       uint8_t  RESERVED4[3];
-  __IO uint8_t  FDR;
-       uint8_t  RESERVED5[7];
-  __IO uint8_t  TER;
-       uint8_t  RESERVED6[39];
-  __IO uint32_t FIFOLVL;
-} LPC_UART_TypeDef;
-
-typedef struct
-{
-  union {
-  __I  uint8_t  RBR;
-  __O  uint8_t  THR;
-  __IO uint8_t  DLL;
-       uint32_t RESERVED0;
-  };
-  union {
-  __IO uint8_t  DLM;
-  __IO uint32_t IER;
-  };
-  union {
-  __I  uint32_t IIR;
-  __O  uint8_t  FCR;
-  };
-  __IO uint8_t  LCR;
-       uint8_t  RESERVED1[7];
-  __I  uint8_t  LSR;
-       uint8_t  RESERVED2[7];
-  __IO uint8_t  SCR;
-       uint8_t  RESERVED3[3];
-  __IO uint32_t ACR;
-  __IO uint8_t  ICR;
-       uint8_t  RESERVED4[3];
-  __IO uint8_t  FDR;
-       uint8_t  RESERVED5[7];
-  __IO uint8_t  TER;
-       uint8_t  RESERVED6[39];
-  __IO uint32_t FIFOLVL;
-} LPC_UART0_TypeDef;
-
-typedef struct
-{
-  union {
-  __I  uint8_t  RBR;
-  __O  uint8_t  THR;
-  __IO uint8_t  DLL;
-       uint32_t RESERVED0;
-  };
-  union {
-  __IO uint8_t  DLM;
-  __IO uint32_t IER;
-  };
-  union {
-  __I  uint32_t IIR;
-  __O  uint8_t  FCR;
-  };
-  __IO uint8_t  LCR;
-       uint8_t  RESERVED1[3];
-  __IO uint8_t  MCR;
-       uint8_t  RESERVED2[3];
-  __I  uint8_t  LSR;
-       uint8_t  RESERVED3[3];
-  __I  uint8_t  MSR;
-       uint8_t  RESERVED4[3];
-  __IO uint8_t  SCR;
-       uint8_t  RESERVED5[3];
-  __IO uint32_t ACR;
-       uint32_t RESERVED6;
-  __IO uint32_t FDR;
-       uint32_t RESERVED7;
-  __IO uint8_t  TER;
-       uint8_t  RESERVED8[27];
-  __IO uint8_t  RS485CTRL;
-       uint8_t  RESERVED9[3];
-  __IO uint8_t  ADRMATCH;
-       uint8_t  RESERVED10[3];
-  __IO uint8_t  RS485DLY;
-       uint8_t  RESERVED11[3];
-  __IO uint32_t FIFOLVL;
-} LPC_UART1_TypeDef;
-
-/*------------- Serial Peripheral Interface (SPI) ----------------------------*/
-typedef struct
-{
-  __IO uint32_t SPCR;
-  __I  uint32_t SPSR;
-  __IO uint32_t SPDR;
-  __IO uint32_t SPCCR;
-       uint32_t RESERVED0[3];
-  __IO uint32_t SPINT;
-} LPC_SPI_TypeDef;
-
-/*------------- Synchronous Serial Communication (SSP) -----------------------*/
-typedef struct
-{
-  __IO uint32_t CR0;
-  __IO uint32_t CR1;
-  __IO uint32_t DR;
-  __I  uint32_t SR;
-  __IO uint32_t CPSR;
-  __IO uint32_t IMSC;
-  __IO uint32_t RIS;
-  __IO uint32_t MIS;
-  __IO uint32_t ICR;
-  __IO uint32_t DMACR;
-} LPC_SSP_TypeDef;
-
-/*------------- Inter-Integrated Circuit (I2C) -------------------------------*/
-typedef struct
-{
-  __IO uint32_t I2CONSET;
-  __I  uint32_t I2STAT;
-  __IO uint32_t I2DAT;
-  __IO uint32_t I2ADR0;
-  __IO uint32_t I2SCLH;
-  __IO uint32_t I2SCLL;
-  __O  uint32_t I2CONCLR;
-  __IO uint32_t MMCTRL;
-  __IO uint32_t I2ADR1;
-  __IO uint32_t I2ADR2;
-  __IO uint32_t I2ADR3;
-  __I  uint32_t I2DATA_BUFFER;
-  __IO uint32_t I2MASK0;
-  __IO uint32_t I2MASK1;
-  __IO uint32_t I2MASK2;
-  __IO uint32_t I2MASK3;
-} LPC_I2C_TypeDef;
-
-/*------------- Inter IC Sound (I2S) -----------------------------------------*/
-typedef struct
-{
-  __IO uint32_t I2SDAO;
-  __IO uint32_t I2SDAI;
-  __O  uint32_t I2STXFIFO;
-  __I  uint32_t I2SRXFIFO;
-  __I  uint32_t I2SSTATE;
-  __IO uint32_t I2SDMA1;
-  __IO uint32_t I2SDMA2;
-  __IO uint32_t I2SIRQ;
-  __IO uint32_t I2STXRATE;
-  __IO uint32_t I2SRXRATE;
-  __IO uint32_t I2STXBITRATE;
-  __IO uint32_t I2SRXBITRATE;
-  __IO uint32_t I2STXMODE;
-  __IO uint32_t I2SRXMODE;
-} LPC_I2S_TypeDef;
-
-/*------------- Repetitive Interrupt Timer (RIT) -----------------------------*/
-typedef struct
-{
-  __IO uint32_t RICOMPVAL;
-  __IO uint32_t RIMASK;
-  __IO uint8_t  RICTRL;
-       uint8_t  RESERVED0[3];
-  __IO uint32_t RICOUNTER;
-} LPC_RIT_TypeDef;
-
-/*------------- Real-Time Clock (RTC) ----------------------------------------*/
-typedef struct
-{
-  __IO uint8_t  ILR;
-       uint8_t  RESERVED0[7];
-  __IO uint8_t  CCR;
-       uint8_t  RESERVED1[3];
-  __IO uint8_t  CIIR;
-       uint8_t  RESERVED2[3];
-  __IO uint8_t  AMR;
-       uint8_t  RESERVED3[3];
-  __I  uint32_t CTIME0;
-  __I  uint32_t CTIME1;
-  __I  uint32_t CTIME2;
-  __IO uint8_t  SEC;
-       uint8_t  RESERVED4[3];
-  __IO uint8_t  MIN;
-       uint8_t  RESERVED5[3];
-  __IO uint8_t  HOUR;
-       uint8_t  RESERVED6[3];
-  __IO uint8_t  DOM;
-       uint8_t  RESERVED7[3];
-  __IO uint8_t  DOW;
-       uint8_t  RESERVED8[3];
-  __IO uint16_t DOY;
-       uint16_t RESERVED9;
-  __IO uint8_t  MONTH;
-       uint8_t  RESERVED10[3];
-  __IO uint16_t YEAR;
-       uint16_t RESERVED11;
-  __IO uint32_t CALIBRATION;
-  __IO uint32_t GPREG0;
-  __IO uint32_t GPREG1;
-  __IO uint32_t GPREG2;
-  __IO uint32_t GPREG3;
-  __IO uint32_t GPREG4;
-  __IO uint8_t  RTC_AUXEN;
-       uint8_t  RESERVED12[3];
-  __IO uint8_t  RTC_AUX;
-       uint8_t  RESERVED13[3];
-  __IO uint8_t  ALSEC;
-       uint8_t  RESERVED14[3];
-  __IO uint8_t  ALMIN;
-       uint8_t  RESERVED15[3];
-  __IO uint8_t  ALHOUR;
-       uint8_t  RESERVED16[3];
-  __IO uint8_t  ALDOM;
-       uint8_t  RESERVED17[3];
-  __IO uint8_t  ALDOW;
-       uint8_t  RESERVED18[3];
-  __IO uint16_t ALDOY;
-       uint16_t RESERVED19;
-  __IO uint8_t  ALMON;
-       uint8_t  RESERVED20[3];
-  __IO uint16_t ALYEAR;
-       uint16_t RESERVED21;
-} LPC_RTC_TypeDef;
-
-/*------------- Watchdog Timer (WDT) -----------------------------------------*/
-typedef struct
-{
-  __IO uint8_t  WDMOD;
-       uint8_t  RESERVED0[3];
-  __IO uint32_t WDTC;
-  __O  uint8_t  WDFEED;
-       uint8_t  RESERVED1[3];
-  __I  uint32_t WDTV;
-  __IO uint32_t WDCLKSEL;
-} LPC_WDT_TypeDef;
-
-/*------------- Analog-to-Digital Converter (ADC) ----------------------------*/
-typedef struct
-{
-  __IO uint32_t ADCR;
-  __IO uint32_t ADGDR;
-       uint32_t RESERVED0;
-  __IO uint32_t ADINTEN;
-  __I  uint32_t ADDR0;
-  __I  uint32_t ADDR1;
-  __I  uint32_t ADDR2;
-  __I  uint32_t ADDR3;
-  __I  uint32_t ADDR4;
-  __I  uint32_t ADDR5;
-  __I  uint32_t ADDR6;
-  __I  uint32_t ADDR7;
-  __I  uint32_t ADSTAT;
-  __IO uint32_t ADTRM;
-} LPC_ADC_TypeDef;
-
-/*------------- Digital-to-Analog Converter (DAC) ----------------------------*/
-typedef struct
-{
-  __IO uint32_t DACR;
-  __IO uint32_t DACCTRL;
-  __IO uint16_t DACCNTVAL;
-} LPC_DAC_TypeDef;
-
-/*------------- Motor Control Pulse-Width Modulation (MCPWM) -----------------*/
-typedef struct
-{
-  __I  uint32_t MCCON;
-  __O  uint32_t MCCON_SET;
-  __O  uint32_t MCCON_CLR;
-  __I  uint32_t MCCAPCON;
-  __O  uint32_t MCCAPCON_SET;
-  __O  uint32_t MCCAPCON_CLR;
-  __IO uint32_t MCTIM0;
-  __IO uint32_t MCTIM1;
-  __IO uint32_t MCTIM2;
-  __IO uint32_t MCPER0;
-  __IO uint32_t MCPER1;
-  __IO uint32_t MCPER2;
-  __IO uint32_t MCPW0;
-  __IO uint32_t MCPW1;
-  __IO uint32_t MCPW2;
-  __IO uint32_t MCDEADTIME;
-  __IO uint32_t MCCCP;
-  __IO uint32_t MCCR0;
-  __IO uint32_t MCCR1;
-  __IO uint32_t MCCR2;
-  __I  uint32_t MCINTEN;
-  __O  uint32_t MCINTEN_SET;
-  __O  uint32_t MCINTEN_CLR;
-  __I  uint32_t MCCNTCON;
-  __O  uint32_t MCCNTCON_SET;
-  __O  uint32_t MCCNTCON_CLR;
-  __I  uint32_t MCINTFLAG;
-  __O  uint32_t MCINTFLAG_SET;
-  __O  uint32_t MCINTFLAG_CLR;
-  __O  uint32_t MCCAP_CLR;
-} LPC_MCPWM_TypeDef;
-
-/*------------- Quadrature Encoder Interface (QEI) ---------------------------*/
-typedef struct
-{
-  __O  uint32_t QEICON;
-  __I  uint32_t QEISTAT;
-  __IO uint32_t QEICONF;
-  __I  uint32_t QEIPOS;
-  __IO uint32_t QEIMAXPOS;
-  __IO uint32_t CMPOS0;
-  __IO uint32_t CMPOS1;
-  __IO uint32_t CMPOS2;
-  __I  uint32_t INXCNT;
-  __IO uint32_t INXCMP;
-  __IO uint32_t QEILOAD;
-  __I  uint32_t QEITIME;
-  __I  uint32_t QEIVEL;
-  __I  uint32_t QEICAP;
-  __IO uint32_t VELCOMP;
-  __IO uint32_t FILTER;
-       uint32_t RESERVED0[998];
-  __O  uint32_t QEIIEC;
-  __O  uint32_t QEIIES;
-  __I  uint32_t QEIINTSTAT;
-  __I  uint32_t QEIIE;
-  __O  uint32_t QEICLR;
-  __O  uint32_t QEISET;
-} LPC_QEI_TypeDef;
-
-/*------------- Controller Area Network (CAN) --------------------------------*/
-typedef struct
-{
-  __IO uint32_t mask[512];              /* ID Masks                           */
-} LPC_CANAF_RAM_TypeDef;
-
-typedef struct                          /* Acceptance Filter Registers        */
-{
-  __IO uint32_t AFMR;
-  __IO uint32_t SFF_sa;
-  __IO uint32_t SFF_GRP_sa;
-  __IO uint32_t EFF_sa;
-  __IO uint32_t EFF_GRP_sa;
-  __IO uint32_t ENDofTable;
-  __I  uint32_t LUTerrAd;
-  __I  uint32_t LUTerr;
-  __IO uint32_t FCANIE;
-  __IO uint32_t FCANIC0;
-  __IO uint32_t FCANIC1;
-} LPC_CANAF_TypeDef;
-
-typedef struct                          /* Central Registers                  */
-{
-  __I  uint32_t CANTxSR;
-  __I  uint32_t CANRxSR;
-  __I  uint32_t CANMSR;
-} LPC_CANCR_TypeDef;
-
-typedef struct                          /* Controller Registers               */
-{
-  __IO uint32_t MOD;
-  __O  uint32_t CMR;
-  __IO uint32_t GSR;
-  __I  uint32_t ICR;
-  __IO uint32_t IER;
-  __IO uint32_t BTR;
-  __IO uint32_t EWL;
-  __I  uint32_t SR;
-  __IO uint32_t RFS;
-  __IO uint32_t RID;
-  __IO uint32_t RDA;
-  __IO uint32_t RDB;
-  __IO uint32_t TFI1;
-  __IO uint32_t TID1;
-  __IO uint32_t TDA1;
-  __IO uint32_t TDB1;
-  __IO uint32_t TFI2;
-  __IO uint32_t TID2;
-  __IO uint32_t TDA2;
-  __IO uint32_t TDB2;
-  __IO uint32_t TFI3;
-  __IO uint32_t TID3;
-  __IO uint32_t TDA3;
-  __IO uint32_t TDB3;
-} LPC_CAN_TypeDef;
-
-/*------------- General Purpose Direct Memory Access (GPDMA) -----------------*/
-typedef struct                          /* Common Registers                   */
-{
-  __I  uint32_t DMACIntStat;
-  __I  uint32_t DMACIntTCStat;
-  __O  uint32_t DMACIntTCClear;
-  __I  uint32_t DMACIntErrStat;
-  __O  uint32_t DMACIntErrClr;
-  __I  uint32_t DMACRawIntTCStat;
-  __I  uint32_t DMACRawIntErrStat;
-  __I  uint32_t DMACEnbldChns;
-  __IO uint32_t DMACSoftBReq;
-  __IO uint32_t DMACSoftSReq;
-  __IO uint32_t DMACSoftLBReq;
-  __IO uint32_t DMACSoftLSReq;
-  __IO uint32_t DMACConfig;
-  __IO uint32_t DMACSync;
-} LPC_GPDMA_TypeDef;
-
-typedef struct                          /* Channel Registers                  */
-{
-  __IO uint32_t DMACCSrcAddr;
-  __IO uint32_t DMACCDestAddr;
-  __IO uint32_t DMACCLLI;
-  __IO uint32_t DMACCControl;
-  __IO uint32_t DMACCConfig;
-} LPC_GPDMACH_TypeDef;
-
-/*------------- Universal Serial Bus (USB) -----------------------------------*/
-typedef struct
-{
-  __I  uint32_t HcRevision;             /* USB Host Registers                 */
-  __IO uint32_t HcControl;
-  __IO uint32_t HcCommandStatus;
-  __IO uint32_t HcInterruptStatus;
-  __IO uint32_t HcInterruptEnable;
-  __IO uint32_t HcInterruptDisable;
-  __IO uint32_t HcHCCA;
-  __I  uint32_t HcPeriodCurrentED;
-  __IO uint32_t HcControlHeadED;
-  __IO uint32_t HcControlCurrentED;
-  __IO uint32_t HcBulkHeadED;
-  __IO uint32_t HcBulkCurrentED;
-  __I  uint32_t HcDoneHead;
-  __IO uint32_t HcFmInterval;
-  __I  uint32_t HcFmRemaining;
-  __I  uint32_t HcFmNumber;
-  __IO uint32_t HcPeriodicStart;
-  __IO uint32_t HcLSTreshold;
-  __IO uint32_t HcRhDescriptorA;
-  __IO uint32_t HcRhDescriptorB;
-  __IO uint32_t HcRhStatus;
-  __IO uint32_t HcRhPortStatus1;
-  __IO uint32_t HcRhPortStatus2;
-       uint32_t RESERVED0[40];
-  __I  uint32_t Module_ID;
-
-  __I  uint32_t OTGIntSt;               /* USB On-The-Go Registers            */
-  __IO uint32_t OTGIntEn;
-  __O  uint32_t OTGIntSet;
-  __O  uint32_t OTGIntClr;
-  __IO uint32_t OTGStCtrl;
-  __IO uint32_t OTGTmr;
-       uint32_t RESERVED1[58];
-
-  __I  uint32_t USBDevIntSt;            /* USB Device Interrupt Registers     */
-  __IO uint32_t USBDevIntEn;
-  __O  uint32_t USBDevIntClr;
-  __O  uint32_t USBDevIntSet;
-
-  __O  uint32_t USBCmdCode;             /* USB Device SIE Command Registers   */
-  __I  uint32_t USBCmdData;
-
-  __I  uint32_t USBRxData;              /* USB Device Transfer Registers      */
-  __O  uint32_t USBTxData;
-  __I  uint32_t USBRxPLen;
-  __O  uint32_t USBTxPLen;
-  __IO uint32_t USBCtrl;
-  __O  uint32_t USBDevIntPri;
-
-  __I  uint32_t USBEpIntSt;             /* USB Device Endpoint Interrupt Regs */
-  __IO uint32_t USBEpIntEn;
-  __O  uint32_t USBEpIntClr;
-  __O  uint32_t USBEpIntSet;
-  __O  uint32_t USBEpIntPri;
-
-  __IO uint32_t USBReEp;                /* USB Device Endpoint Realization Reg*/
-  __O  uint32_t USBEpInd;
-  __IO uint32_t USBMaxPSize;
-
-  __I  uint32_t USBDMARSt;              /* USB Device DMA Registers           */
-  __O  uint32_t USBDMARClr;
-  __O  uint32_t USBDMARSet;
-       uint32_t RESERVED2[9];
-  __IO uint32_t USBUDCAH;
-  __I  uint32_t USBEpDMASt;
-  __O  uint32_t USBEpDMAEn;
-  __O  uint32_t USBEpDMADis;
-  __I  uint32_t USBDMAIntSt;
-  __IO uint32_t USBDMAIntEn;
-       uint32_t RESERVED3[2];
-  __I  uint32_t USBEoTIntSt;
-  __O  uint32_t USBEoTIntClr;
-  __O  uint32_t USBEoTIntSet;
-  __I  uint32_t USBNDDRIntSt;
-  __O  uint32_t USBNDDRIntClr;
-  __O  uint32_t USBNDDRIntSet;
-  __I  uint32_t USBSysErrIntSt;
-  __O  uint32_t USBSysErrIntClr;
-  __O  uint32_t USBSysErrIntSet;
-       uint32_t RESERVED4[15];
-
-  union {
-  __I  uint32_t I2C_RX;                 /* USB OTG I2C Registers              */
-  __O  uint32_t I2C_TX;
-  };
-  __I  uint32_t I2C_STS;
-  __IO uint32_t I2C_CTL;
-  __IO uint32_t I2C_CLKHI;
-  __O  uint32_t I2C_CLKLO;
-       uint32_t RESERVED5[824];
-
-  union {
-  __IO uint32_t USBClkCtrl;             /* USB Clock Control Registers        */
-  __IO uint32_t OTGClkCtrl;
-  };
-  union {
-  __I  uint32_t USBClkSt;
-  __I  uint32_t OTGClkSt;
-  };
-} LPC_USB_TypeDef;
-
-/*------------- Ethernet Media Access Controller (EMAC) ----------------------*/
-typedef struct
-{
-  __IO uint32_t MAC1;                   /* MAC Registers                      */
-  __IO uint32_t MAC2;
-  __IO uint32_t IPGT;
-  __IO uint32_t IPGR;
-  __IO uint32_t CLRT;
-  __IO uint32_t MAXF;
-  __IO uint32_t SUPP;
-  __IO uint32_t TEST;
-  __IO uint32_t MCFG;
-  __IO uint32_t MCMD;
-  __IO uint32_t MADR;
-  __O  uint32_t MWTD;
-  __I  uint32_t MRDD;
-  __I  uint32_t MIND;
-       uint32_t RESERVED0[2];
-  __IO uint32_t SA0;
-  __IO uint32_t SA1;
-  __IO uint32_t SA2;
-       uint32_t RESERVED1[45];
-  __IO uint32_t Command;                /* Control Registers                  */
-  __I  uint32_t Status;
-  __IO uint32_t RxDescriptor;
-  __IO uint32_t RxStatus;
-  __IO uint32_t RxDescriptorNumber;
-  __I  uint32_t RxProduceIndex;
-  __IO uint32_t RxConsumeIndex;
-  __IO uint32_t TxDescriptor;
-  __IO uint32_t TxStatus;
-  __IO uint32_t TxDescriptorNumber;
-  __IO uint32_t TxProduceIndex;
-  __I  uint32_t TxConsumeIndex;
-       uint32_t RESERVED2[10];
-  __I  uint32_t TSV0;
-  __I  uint32_t TSV1;
-  __I  uint32_t RSV;
-       uint32_t RESERVED3[3];
-  __IO uint32_t FlowControlCounter;
-  __I  uint32_t FlowControlStatus;
-       uint32_t RESERVED4[34];
-  __IO uint32_t RxFilterCtrl;           /* Rx Filter Registers                */
-  __IO uint32_t RxFilterWoLStatus;
-  __IO uint32_t RxFilterWoLClear;
-       uint32_t RESERVED5;
-  __IO uint32_t HashFilterL;
-  __IO uint32_t HashFilterH;
-       uint32_t RESERVED6[882];
-  __I  uint32_t IntStatus;              /* Module Control Registers           */
-  __IO uint32_t IntEnable;
-  __O  uint32_t IntClear;
-  __O  uint32_t IntSet;
-       uint32_t RESERVED7;
-  __IO uint32_t PowerDown;
-       uint32_t RESERVED8;
-  __IO uint32_t Module_ID;
-} LPC_EMAC_TypeDef;
-
-#if defined ( __CC_ARM   )
-#pragma no_anon_unions
-#endif
-
-
-/******************************************************************************/
-/*                         Peripheral memory map                              */
-/******************************************************************************/
-/* Base addresses                                                             */
-#define LPC_FLASH_BASE        (0x00000000UL)
-#define LPC_RAM_BASE          (0x10000000UL)
-#define LPC_GPIO_BASE         (0x2009C000UL)
-#define LPC_APB0_BASE         (0x40000000UL)
-#define LPC_APB1_BASE         (0x40080000UL)
-#define LPC_AHB_BASE          (0x50000000UL)
-#define LPC_CM3_BASE          (0xE0000000UL)
-
-/* APB0 peripherals                                                           */
-#define LPC_WDT_BASE          (LPC_APB0_BASE + 0x00000)
-#define LPC_TIM0_BASE         (LPC_APB0_BASE + 0x04000)
-#define LPC_TIM1_BASE         (LPC_APB0_BASE + 0x08000)
-#define LPC_UART0_BASE        (LPC_APB0_BASE + 0x0C000)
-#define LPC_UART1_BASE        (LPC_APB0_BASE + 0x10000)
-#define LPC_PWM1_BASE         (LPC_APB0_BASE + 0x18000)
-#define LPC_I2C0_BASE         (LPC_APB0_BASE + 0x1C000)
-#define LPC_SPI_BASE          (LPC_APB0_BASE + 0x20000)
-#define LPC_RTC_BASE          (LPC_APB0_BASE + 0x24000)
-#define LPC_GPIOINT_BASE      (LPC_APB0_BASE + 0x28080)
-#define LPC_PINCON_BASE       (LPC_APB0_BASE + 0x2C000)
-#define LPC_SSP1_BASE         (LPC_APB0_BASE + 0x30000)
-#define LPC_ADC_BASE          (LPC_APB0_BASE + 0x34000)
-#define LPC_CANAF_RAM_BASE    (LPC_APB0_BASE + 0x38000)
-#define LPC_CANAF_BASE        (LPC_APB0_BASE + 0x3C000)
-#define LPC_CANCR_BASE        (LPC_APB0_BASE + 0x40000)
-#define LPC_CAN1_BASE         (LPC_APB0_BASE + 0x44000)
-#define LPC_CAN2_BASE         (LPC_APB0_BASE + 0x48000)
-#define LPC_I2C1_BASE         (LPC_APB0_BASE + 0x5C000)
-
-/* APB1 peripherals                                                           */
-#define LPC_SSP0_BASE         (LPC_APB1_BASE + 0x08000)
-#define LPC_DAC_BASE          (LPC_APB1_BASE + 0x0C000)
-#define LPC_TIM2_BASE         (LPC_APB1_BASE + 0x10000)
-#define LPC_TIM3_BASE         (LPC_APB1_BASE + 0x14000)
-#define LPC_UART2_BASE        (LPC_APB1_BASE + 0x18000)
-#define LPC_UART3_BASE        (LPC_APB1_BASE + 0x1C000)
-#define LPC_I2C2_BASE         (LPC_APB1_BASE + 0x20000)
-#define LPC_I2S_BASE          (LPC_APB1_BASE + 0x28000)
-#define LPC_RIT_BASE          (LPC_APB1_BASE + 0x30000)
-#define LPC_MCPWM_BASE        (LPC_APB1_BASE + 0x38000)
-#define LPC_QEI_BASE          (LPC_APB1_BASE + 0x3C000)
-#define LPC_SC_BASE           (LPC_APB1_BASE + 0x7C000)
-
-/* AHB peripherals                                                            */
-#define LPC_EMAC_BASE         (LPC_AHB_BASE  + 0x00000)
-#define LPC_GPDMA_BASE        (LPC_AHB_BASE  + 0x04000)
-#define LPC_GPDMACH0_BASE     (LPC_AHB_BASE  + 0x04100)
-#define LPC_GPDMACH1_BASE     (LPC_AHB_BASE  + 0x04120)
-#define LPC_GPDMACH2_BASE     (LPC_AHB_BASE  + 0x04140)
-#define LPC_GPDMACH3_BASE     (LPC_AHB_BASE  + 0x04160)
-#define LPC_GPDMACH4_BASE     (LPC_AHB_BASE  + 0x04180)
-#define LPC_GPDMACH5_BASE     (LPC_AHB_BASE  + 0x041A0)
-#define LPC_GPDMACH6_BASE     (LPC_AHB_BASE  + 0x041C0)
-#define LPC_GPDMACH7_BASE     (LPC_AHB_BASE  + 0x041E0)
-#define LPC_USB_BASE          (LPC_AHB_BASE  + 0x0C000)
-
-/* GPIOs                                                                      */
-#define LPC_GPIO0_BASE        (LPC_GPIO_BASE + 0x00000)
-#define LPC_GPIO1_BASE        (LPC_GPIO_BASE + 0x00020)
-#define LPC_GPIO2_BASE        (LPC_GPIO_BASE + 0x00040)
-#define LPC_GPIO3_BASE        (LPC_GPIO_BASE + 0x00060)
-#define LPC_GPIO4_BASE        (LPC_GPIO_BASE + 0x00080)
-
-
-/******************************************************************************/
-/*                         Peripheral declaration                             */
-/******************************************************************************/
-#define LPC_SC                ((LPC_SC_TypeDef        *) LPC_SC_BASE       )
-#define LPC_GPIO0             ((LPC_GPIO_TypeDef      *) LPC_GPIO0_BASE    )
-#define LPC_GPIO1             ((LPC_GPIO_TypeDef      *) LPC_GPIO1_BASE    )
-#define LPC_GPIO2             ((LPC_GPIO_TypeDef      *) LPC_GPIO2_BASE    )
-#define LPC_GPIO3             ((LPC_GPIO_TypeDef      *) LPC_GPIO3_BASE    )
-#define LPC_GPIO4             ((LPC_GPIO_TypeDef      *) LPC_GPIO4_BASE    )
-#define LPC_WDT               ((LPC_WDT_TypeDef       *) LPC_WDT_BASE      )
-#define LPC_TIM0              ((LPC_TIM_TypeDef       *) LPC_TIM0_BASE     )
-#define LPC_TIM1              ((LPC_TIM_TypeDef       *) LPC_TIM1_BASE     )
-#define LPC_TIM2              ((LPC_TIM_TypeDef       *) LPC_TIM2_BASE     )
-#define LPC_TIM3              ((LPC_TIM_TypeDef       *) LPC_TIM3_BASE     )
-#define LPC_RIT               ((LPC_RIT_TypeDef       *) LPC_RIT_BASE      )
-#define LPC_UART0             ((LPC_UART0_TypeDef     *) LPC_UART0_BASE    )
-#define LPC_UART1             ((LPC_UART1_TypeDef     *) LPC_UART1_BASE    )
-#define LPC_UART2             ((LPC_UART_TypeDef      *) LPC_UART2_BASE    )
-#define LPC_UART3             ((LPC_UART_TypeDef      *) LPC_UART3_BASE    )
-#define LPC_PWM1              ((LPC_PWM_TypeDef       *) LPC_PWM1_BASE     )
-#define LPC_I2C0              ((LPC_I2C_TypeDef       *) LPC_I2C0_BASE     )
-#define LPC_I2C1              ((LPC_I2C_TypeDef       *) LPC_I2C1_BASE     )
-#define LPC_I2C2              ((LPC_I2C_TypeDef       *) LPC_I2C2_BASE     )
-#define LPC_I2S               ((LPC_I2S_TypeDef       *) LPC_I2S_BASE      )
-#define LPC_SPI               ((LPC_SPI_TypeDef       *) LPC_SPI_BASE      )
-#define LPC_RTC               ((LPC_RTC_TypeDef       *) LPC_RTC_BASE      )
-#define LPC_GPIOINT           ((LPC_GPIOINT_TypeDef   *) LPC_GPIOINT_BASE  )
-#define LPC_PINCON            ((LPC_PINCON_TypeDef    *) LPC_PINCON_BASE   )
-#define LPC_SSP0              ((LPC_SSP_TypeDef       *) LPC_SSP0_BASE     )
-#define LPC_SSP1              ((LPC_SSP_TypeDef       *) LPC_SSP1_BASE     )
-#define LPC_ADC               ((LPC_ADC_TypeDef       *) LPC_ADC_BASE      )
-#define LPC_DAC               ((LPC_DAC_TypeDef       *) LPC_DAC_BASE      )
-#define LPC_CANAF_RAM         ((LPC_CANAF_RAM_TypeDef *) LPC_CANAF_RAM_BASE)
-#define LPC_CANAF             ((LPC_CANAF_TypeDef     *) LPC_CANAF_BASE    )
-#define LPC_CANCR             ((LPC_CANCR_TypeDef     *) LPC_CANCR_BASE    )
-#define LPC_CAN1              ((LPC_CAN_TypeDef       *) LPC_CAN1_BASE     )
-#define LPC_CAN2              ((LPC_CAN_TypeDef       *) LPC_CAN2_BASE     )
-#define LPC_MCPWM             ((LPC_MCPWM_TypeDef     *) LPC_MCPWM_BASE    )
-#define LPC_QEI               ((LPC_QEI_TypeDef       *) LPC_QEI_BASE      )
-#define LPC_EMAC              ((LPC_EMAC_TypeDef      *) LPC_EMAC_BASE     )
-#define LPC_GPDMA             ((LPC_GPDMA_TypeDef     *) LPC_GPDMA_BASE    )
-#define LPC_GPDMACH0          ((LPC_GPDMACH_TypeDef   *) LPC_GPDMACH0_BASE )
-#define LPC_GPDMACH1          ((LPC_GPDMACH_TypeDef   *) LPC_GPDMACH1_BASE )
-#define LPC_GPDMACH2          ((LPC_GPDMACH_TypeDef   *) LPC_GPDMACH2_BASE )
-#define LPC_GPDMACH3          ((LPC_GPDMACH_TypeDef   *) LPC_GPDMACH3_BASE )
-#define LPC_GPDMACH4          ((LPC_GPDMACH_TypeDef   *) LPC_GPDMACH4_BASE )
-#define LPC_GPDMACH5          ((LPC_GPDMACH_TypeDef   *) LPC_GPDMACH5_BASE )
-#define LPC_GPDMACH6          ((LPC_GPDMACH_TypeDef   *) LPC_GPDMACH6_BASE )
-#define LPC_GPDMACH7          ((LPC_GPDMACH_TypeDef   *) LPC_GPDMACH7_BASE )
-#define LPC_USB               ((LPC_USB_TypeDef       *) LPC_USB_BASE      )
-
-#endif  // __LPC17xx_H__
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_ARM_MICRO/LPC1768.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-
-LR_IROM1 0x00000000 0x80000  {    ; load region size_region
-  ER_IROM1 0x00000000 0x80000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  ; 8_byte_aligned(49 vect * 4 bytes) =  8_byte_aligned(0xC4) = 0xC8
-  ; 32KB - 0xC8 = 0x7F38
-  RW_IRAM1 0x100000C8 0x7F38  {
-   .ANY (+RW +ZI)
-  }
-  RW_IRAM2 0x2007C000 0x4000  {  ; RW data, USB RAM
-   .ANY (AHBSRAM0)
-  }
-  RW_IRAM3 0x20080000 0x4000  {  ; RW data, ETH RAM
-   .ANY (AHBSRAM1)
-  }
-  RW_IRAM4 0x40038000 0x0800  {  ; RW data, CAN RAM
-   .ANY (CANRAM)
-  }
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_ARM_MICRO/startup_LPC17xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,243 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_LPC17xx.s
-; * @purpose: CMSIS Cortex-M3 Core Device Startup File 
-; *           for the NXP LPC17xx Device Series 
-; * @version: V1.02, modified for mbed
-; * @date:    27. July 2009, modified 3rd Aug 2009
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; * Copyright (C) 2009 ARM Limited. All rights reserved.
-; * ARM Limited (ARM) is supplying this software for use with Cortex-M3 
-; * processor based microcontrollers.  This file can be freely distributed 
-; * within development tools that are supporting such ARM based processors. 
-; *
-; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
-; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
-; *
-; *****************************************************************************/
-
-Stack_Size      EQU     0x00000400
-
-                AREA    STACK, NOINIT, READWRITE, ALIGN=3
-                EXPORT  __initial_sp
-
-Stack_Mem       SPACE   Stack_Size
-__initial_sp        EQU     0x10008000  ; Top of RAM from LPC1768
-
-
-Heap_Size       EQU     0x00000000
-
-                AREA    HEAP, NOINIT, READWRITE, ALIGN=3
-                EXPORT  __heap_base
-                EXPORT  __heap_limit
-
-__heap_base
-Heap_Mem        SPACE   Heap_Size
-__heap_limit
-
-                PRESERVE8
-                THUMB
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-
-__Vectors       DCD     __initial_sp              ; Top of Stack
-                DCD     Reset_Handler             ; Reset Handler
-                DCD     NMI_Handler               ; NMI Handler
-                DCD     HardFault_Handler         ; Hard Fault Handler
-                DCD     MemManage_Handler         ; MPU Fault Handler
-                DCD     BusFault_Handler          ; Bus Fault Handler
-                DCD     UsageFault_Handler        ; Usage Fault Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     SVC_Handler               ; SVCall Handler
-                DCD     DebugMon_Handler          ; Debug Monitor Handler
-                DCD     0                         ; Reserved
-                DCD     PendSV_Handler            ; PendSV Handler
-                DCD     SysTick_Handler           ; SysTick Handler
-
-                ; External Interrupts
-                DCD     WDT_IRQHandler            ; 16: Watchdog Timer
-                DCD     TIMER0_IRQHandler         ; 17: Timer0
-                DCD     TIMER1_IRQHandler         ; 18: Timer1
-                DCD     TIMER2_IRQHandler         ; 19: Timer2
-                DCD     TIMER3_IRQHandler         ; 20: Timer3
-                DCD     UART0_IRQHandler          ; 21: UART0
-                DCD     UART1_IRQHandler          ; 22: UART1
-                DCD     UART2_IRQHandler          ; 23: UART2
-                DCD     UART3_IRQHandler          ; 24: UART3
-                DCD     PWM1_IRQHandler           ; 25: PWM1
-                DCD     I2C0_IRQHandler           ; 26: I2C0
-                DCD     I2C1_IRQHandler           ; 27: I2C1
-                DCD     I2C2_IRQHandler           ; 28: I2C2
-                DCD     SPI_IRQHandler            ; 29: SPI
-                DCD     SSP0_IRQHandler           ; 30: SSP0
-                DCD     SSP1_IRQHandler           ; 31: SSP1
-                DCD     PLL0_IRQHandler           ; 32: PLL0 Lock (Main PLL)
-                DCD     RTC_IRQHandler            ; 33: Real Time Clock
-                DCD     EINT0_IRQHandler          ; 34: External Interrupt 0
-                DCD     EINT1_IRQHandler          ; 35: External Interrupt 1
-                DCD     EINT2_IRQHandler          ; 36: External Interrupt 2
-                DCD     EINT3_IRQHandler          ; 37: External Interrupt 3
-                DCD     ADC_IRQHandler            ; 38: A/D Converter
-                DCD     BOD_IRQHandler            ; 39: Brown-Out Detect
-                DCD     USB_IRQHandler            ; 40: USB
-                DCD     CAN_IRQHandler            ; 41: CAN
-                DCD     DMA_IRQHandler            ; 42: General Purpose DMA
-                DCD     I2S_IRQHandler            ; 43: I2S
-                DCD     ENET_IRQHandler           ; 44: Ethernet
-                DCD     RIT_IRQHandler            ; 45: Repetitive Interrupt Timer
-                DCD     MCPWM_IRQHandler          ; 46: Motor Control PWM
-                DCD     QEI_IRQHandler            ; 47: Quadrature Encoder Interface
-                DCD     PLL1_IRQHandler           ; 48: PLL1 Lock (USB PLL)
-
-
-                IF      :LNOT::DEF:NO_CRP
-                AREA    |.ARM.__at_0x02FC|, CODE, READONLY
-CRP_Key         DCD     0xFFFFFFFF
-                ENDIF
-
-
-                AREA    |.text|, CODE, READONLY
-
-
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-
-; Dummy Exception Handlers (infinite loops which can be modified)                
-
-NMI_Handler     PROC
-                EXPORT  NMI_Handler               [WEAK]
-                B       .
-                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-MemManage_Handler\
-                PROC
-                EXPORT  MemManage_Handler         [WEAK]
-                B       .
-                ENDP
-BusFault_Handler\
-                PROC
-                EXPORT  BusFault_Handler          [WEAK]
-                B       .
-                ENDP
-UsageFault_Handler\
-                PROC
-                EXPORT  UsageFault_Handler        [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-DebugMon_Handler\
-                PROC
-                EXPORT  DebugMon_Handler          [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-
-                EXPORT  WDT_IRQHandler            [WEAK]
-                EXPORT  TIMER0_IRQHandler         [WEAK]
-                EXPORT  TIMER1_IRQHandler         [WEAK]
-                EXPORT  TIMER2_IRQHandler         [WEAK]
-                EXPORT  TIMER3_IRQHandler         [WEAK]
-                EXPORT  UART0_IRQHandler          [WEAK]
-                EXPORT  UART1_IRQHandler          [WEAK]
-                EXPORT  UART2_IRQHandler          [WEAK]
-                EXPORT  UART3_IRQHandler          [WEAK]
-                EXPORT  PWM1_IRQHandler           [WEAK]
-                EXPORT  I2C0_IRQHandler           [WEAK]
-                EXPORT  I2C1_IRQHandler           [WEAK]
-                EXPORT  I2C2_IRQHandler           [WEAK]
-                EXPORT  SPI_IRQHandler            [WEAK]
-                EXPORT  SSP0_IRQHandler           [WEAK]
-                EXPORT  SSP1_IRQHandler           [WEAK]
-                EXPORT  PLL0_IRQHandler           [WEAK]
-                EXPORT  RTC_IRQHandler            [WEAK]
-                EXPORT  EINT0_IRQHandler          [WEAK]
-                EXPORT  EINT1_IRQHandler          [WEAK]
-                EXPORT  EINT2_IRQHandler          [WEAK]
-                EXPORT  EINT3_IRQHandler          [WEAK]
-                EXPORT  ADC_IRQHandler            [WEAK]
-                EXPORT  BOD_IRQHandler            [WEAK]
-                EXPORT  USB_IRQHandler            [WEAK]
-                EXPORT  CAN_IRQHandler            [WEAK]
-                EXPORT  DMA_IRQHandler            [WEAK]
-                EXPORT  I2S_IRQHandler            [WEAK]
-                EXPORT  ENET_IRQHandler           [WEAK]
-                EXPORT  RIT_IRQHandler            [WEAK]
-                EXPORT  MCPWM_IRQHandler          [WEAK]
-                EXPORT  QEI_IRQHandler            [WEAK]
-                EXPORT  PLL1_IRQHandler           [WEAK]
-
-WDT_IRQHandler           
-TIMER0_IRQHandler         
-TIMER1_IRQHandler         
-TIMER2_IRQHandler         
-TIMER3_IRQHandler         
-UART0_IRQHandler          
-UART1_IRQHandler          
-UART2_IRQHandler          
-UART3_IRQHandler          
-PWM1_IRQHandler           
-I2C0_IRQHandler           
-I2C1_IRQHandler           
-I2C2_IRQHandler           
-SPI_IRQHandler            
-SSP0_IRQHandler           
-SSP1_IRQHandler           
-PLL0_IRQHandler           
-RTC_IRQHandler            
-EINT0_IRQHandler          
-EINT1_IRQHandler          
-EINT2_IRQHandler          
-EINT3_IRQHandler          
-ADC_IRQHandler            
-BOD_IRQHandler            
-USB_IRQHandler            
-CAN_IRQHandler            
-DMA_IRQHandler          
-I2S_IRQHandler            
-ENET_IRQHandler       
-RIT_IRQHandler          
-MCPWM_IRQHandler             
-QEI_IRQHandler            
-PLL1_IRQHandler           
-
-                B       .
-
-                ENDP
-                
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_ARM_MICRO/sys.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library - stackheap
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * Setup a fixed single stack/heap memory model, 
- *  between the top of the RW/ZI region and the stackpointer
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-#include <rt_misc.h>
-#include <stdint.h>
-
-extern char Image$$RW_IRAM1$$ZI$$Limit[];
-
-extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
-    uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
-    uint32_t sp_limit = __current_sp();
-
-    zi_limit = (zi_limit + 7) & ~0x7;    // ensure zi_limit is 8-byte aligned
-
-    struct __initial_stackheap r;
-    r.heap_base = zi_limit;
-    r.heap_limit = sp_limit;
-    return r;
-}
-
-#ifdef __cplusplus
-}
-#endif 
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_ARM_STD/LPC1768.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-
-LR_IROM1 0x00000000 0x80000  {    ; load region size_region
-  ER_IROM1 0x00000000 0x80000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  ; 8_byte_aligned(49 vect * 4 bytes) =  8_byte_aligned(0xC4) = 0xC8
-  ; 32KB - 0xC8 = 0x7F38
-  RW_IRAM1 0x100000C8 0x7F38  {
-   .ANY (+RW +ZI)
-  }
-  RW_IRAM2 0x2007C000 0x4000  {  ; RW data, ETH RAM
-   .ANY (AHBSRAM0)
-  }
-  RW_IRAM3 0x20080000 0x4000  {  ; RW data, ETH RAM
-   .ANY (AHBSRAM1)
-  }
-  RW_IRAM4 0x40038000 0x0800  {  ; RW data, CAN RAM
-   .ANY (CANRAM)
-  }
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_ARM_STD/startup_LPC17xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,226 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_LPC17xx.s
-; * @purpose: CMSIS Cortex-M3 Core Device Startup File 
-; *           for the NXP LPC17xx Device Series 
-; * @version: V1.02, modified for mbed
-; * @date:    27. July 2009, modified 3rd Aug 2009
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; * Copyright (C) 2009 ARM Limited. All rights reserved.
-; * ARM Limited (ARM) is supplying this software for use with Cortex-M3 
-; * processor based microcontrollers.  This file can be freely distributed 
-; * within development tools that are supporting such ARM based processors. 
-; *
-; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
-; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
-; *
-; *****************************************************************************/
-
-__initial_sp        EQU     0x10008000  ; Top of RAM from LPC1768
-
-                PRESERVE8
-                THUMB
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-
-__Vectors       DCD     __initial_sp              ; Top of Stack
-                DCD     Reset_Handler             ; Reset Handler
-                DCD     NMI_Handler               ; NMI Handler
-                DCD     HardFault_Handler         ; Hard Fault Handler
-                DCD     MemManage_Handler         ; MPU Fault Handler
-                DCD     BusFault_Handler          ; Bus Fault Handler
-                DCD     UsageFault_Handler        ; Usage Fault Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     SVC_Handler               ; SVCall Handler
-                DCD     DebugMon_Handler          ; Debug Monitor Handler
-                DCD     0                         ; Reserved
-                DCD     PendSV_Handler            ; PendSV Handler
-                DCD     SysTick_Handler           ; SysTick Handler
-
-                ; External Interrupts
-                DCD     WDT_IRQHandler            ; 16: Watchdog Timer
-                DCD     TIMER0_IRQHandler         ; 17: Timer0
-                DCD     TIMER1_IRQHandler         ; 18: Timer1
-                DCD     TIMER2_IRQHandler         ; 19: Timer2
-                DCD     TIMER3_IRQHandler         ; 20: Timer3
-                DCD     UART0_IRQHandler          ; 21: UART0
-                DCD     UART1_IRQHandler          ; 22: UART1
-                DCD     UART2_IRQHandler          ; 23: UART2
-                DCD     UART3_IRQHandler          ; 24: UART3
-                DCD     PWM1_IRQHandler           ; 25: PWM1
-                DCD     I2C0_IRQHandler           ; 26: I2C0
-                DCD     I2C1_IRQHandler           ; 27: I2C1
-                DCD     I2C2_IRQHandler           ; 28: I2C2
-                DCD     SPI_IRQHandler            ; 29: SPI
-                DCD     SSP0_IRQHandler           ; 30: SSP0
-                DCD     SSP1_IRQHandler           ; 31: SSP1
-                DCD     PLL0_IRQHandler           ; 32: PLL0 Lock (Main PLL)
-                DCD     RTC_IRQHandler            ; 33: Real Time Clock
-                DCD     EINT0_IRQHandler          ; 34: External Interrupt 0
-                DCD     EINT1_IRQHandler          ; 35: External Interrupt 1
-                DCD     EINT2_IRQHandler          ; 36: External Interrupt 2
-                DCD     EINT3_IRQHandler          ; 37: External Interrupt 3
-                DCD     ADC_IRQHandler            ; 38: A/D Converter
-                DCD     BOD_IRQHandler            ; 39: Brown-Out Detect
-                DCD     USB_IRQHandler            ; 40: USB
-                DCD     CAN_IRQHandler            ; 41: CAN
-                DCD     DMA_IRQHandler            ; 42: General Purpose DMA
-                DCD     I2S_IRQHandler            ; 43: I2S
-                DCD     ENET_IRQHandler           ; 44: Ethernet
-                DCD     RIT_IRQHandler            ; 45: Repetitive Interrupt Timer
-                DCD     MCPWM_IRQHandler          ; 46: Motor Control PWM
-                DCD     QEI_IRQHandler            ; 47: Quadrature Encoder Interface
-                DCD     PLL1_IRQHandler           ; 48: PLL1 Lock (USB PLL)
-
-
-                IF      :LNOT::DEF:NO_CRP
-                AREA    |.ARM.__at_0x02FC|, CODE, READONLY
-CRP_Key         DCD     0xFFFFFFFF
-                ENDIF
-
-
-                AREA    |.text|, CODE, READONLY
-
-
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-
-; Dummy Exception Handlers (infinite loops which can be modified)                
-
-NMI_Handler     PROC
-                EXPORT  NMI_Handler               [WEAK]
-                B       .
-                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-MemManage_Handler\
-                PROC
-                EXPORT  MemManage_Handler         [WEAK]
-                B       .
-                ENDP
-BusFault_Handler\
-                PROC
-                EXPORT  BusFault_Handler          [WEAK]
-                B       .
-                ENDP
-UsageFault_Handler\
-                PROC
-                EXPORT  UsageFault_Handler        [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-DebugMon_Handler\
-                PROC
-                EXPORT  DebugMon_Handler          [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-
-                EXPORT  WDT_IRQHandler            [WEAK]
-                EXPORT  TIMER0_IRQHandler         [WEAK]
-                EXPORT  TIMER1_IRQHandler         [WEAK]
-                EXPORT  TIMER2_IRQHandler         [WEAK]
-                EXPORT  TIMER3_IRQHandler         [WEAK]
-                EXPORT  UART0_IRQHandler          [WEAK]
-                EXPORT  UART1_IRQHandler          [WEAK]
-                EXPORT  UART2_IRQHandler          [WEAK]
-                EXPORT  UART3_IRQHandler          [WEAK]
-                EXPORT  PWM1_IRQHandler           [WEAK]
-                EXPORT  I2C0_IRQHandler           [WEAK]
-                EXPORT  I2C1_IRQHandler           [WEAK]
-                EXPORT  I2C2_IRQHandler           [WEAK]
-                EXPORT  SPI_IRQHandler            [WEAK]
-                EXPORT  SSP0_IRQHandler           [WEAK]
-                EXPORT  SSP1_IRQHandler           [WEAK]
-                EXPORT  PLL0_IRQHandler           [WEAK]
-                EXPORT  RTC_IRQHandler            [WEAK]
-                EXPORT  EINT0_IRQHandler          [WEAK]
-                EXPORT  EINT1_IRQHandler          [WEAK]
-                EXPORT  EINT2_IRQHandler          [WEAK]
-                EXPORT  EINT3_IRQHandler          [WEAK]
-                EXPORT  ADC_IRQHandler            [WEAK]
-                EXPORT  BOD_IRQHandler            [WEAK]
-                EXPORT  USB_IRQHandler            [WEAK]
-                EXPORT  CAN_IRQHandler            [WEAK]
-                EXPORT  DMA_IRQHandler            [WEAK]
-                EXPORT  I2S_IRQHandler            [WEAK]
-                EXPORT  ENET_IRQHandler           [WEAK]
-                EXPORT  RIT_IRQHandler            [WEAK]
-                EXPORT  MCPWM_IRQHandler          [WEAK]
-                EXPORT  QEI_IRQHandler            [WEAK]
-                EXPORT  PLL1_IRQHandler           [WEAK]
-
-WDT_IRQHandler           
-TIMER0_IRQHandler         
-TIMER1_IRQHandler         
-TIMER2_IRQHandler         
-TIMER3_IRQHandler         
-UART0_IRQHandler          
-UART1_IRQHandler          
-UART2_IRQHandler          
-UART3_IRQHandler          
-PWM1_IRQHandler           
-I2C0_IRQHandler           
-I2C1_IRQHandler           
-I2C2_IRQHandler           
-SPI_IRQHandler            
-SSP0_IRQHandler           
-SSP1_IRQHandler           
-PLL0_IRQHandler           
-RTC_IRQHandler            
-EINT0_IRQHandler          
-EINT1_IRQHandler          
-EINT2_IRQHandler          
-EINT3_IRQHandler          
-ADC_IRQHandler            
-BOD_IRQHandler            
-USB_IRQHandler            
-CAN_IRQHandler            
-DMA_IRQHandler          
-I2S_IRQHandler            
-ENET_IRQHandler       
-RIT_IRQHandler          
-MCPWM_IRQHandler             
-QEI_IRQHandler            
-PLL1_IRQHandler           
-
-                B       .
-
-                ENDP
-                
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_ARM_STD/sys.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library - stackheap
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * Setup a fixed single stack/heap memory model, 
- *  between the top of the RW/ZI region and the stackpointer
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-#include <rt_misc.h>
-#include <stdint.h>
-
-extern char Image$$RW_IRAM1$$ZI$$Limit[];
-
-extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
-    uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
-    uint32_t sp_limit = __current_sp();
-
-    zi_limit = (zi_limit + 7) & ~0x7;    // ensure zi_limit is 8-byte aligned
-
-    struct __initial_stackheap r;
-    r.heap_base = zi_limit;
-    r.heap_limit = sp_limit;
-    return r;
-}
-
-#ifdef __cplusplus
-}
-#endif 
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_ARM/LPC1768.ld	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-/* Linker script for mbed LPC1768 */
-
-/* Linker script to configure memory regions. */
-MEMORY
-{
-  FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K
-  RAM (rwx) : ORIGIN = 0x100000C8, LENGTH = (32K - 0xC8)
-
-  USB_RAM(rwx) : ORIGIN = 0x2007C000, LENGTH = 16K
-  ETH_RAM(rwx) : ORIGIN = 0x20080000, LENGTH = 16K
-}
-
-/* Linker script to place sections and symbol values. Should be used together
- * with other linker script that defines memory regions FLASH and RAM.
- * It references following symbols, which must be defined in code:
- *   Reset_Handler : Entry of reset handler
- * 
- * It defines following symbols, which code can use without definition:
- *   __exidx_start
- *   __exidx_end
- *   __etext
- *   __data_start__
- *   __preinit_array_start
- *   __preinit_array_end
- *   __init_array_start
- *   __init_array_end
- *   __fini_array_start
- *   __fini_array_end
- *   __data_end__
- *   __bss_start__
- *   __bss_end__
- *   __end__
- *   end
- *   __HeapLimit
- *   __StackLimit
- *   __StackTop
- *   __stack
- */
-ENTRY(Reset_Handler)
-
-SECTIONS
-{
-    .text :
-    {
-        KEEP(*(.isr_vector))
-        *(.text*)
-
-        KEEP(*(.init))
-        KEEP(*(.fini))
-
-        /* .ctors */
-        *crtbegin.o(.ctors)
-        *crtbegin?.o(.ctors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
-        *(SORT(.ctors.*))
-        *(.ctors)
-
-        /* .dtors */
-        *crtbegin.o(.dtors)
-        *crtbegin?.o(.dtors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
-        *(SORT(.dtors.*))
-        *(.dtors)
-
-        *(.rodata*)
-
-        KEEP(*(.eh_frame*))
-    } > FLASH
-
-    .ARM.extab : 
-    {
-        *(.ARM.extab* .gnu.linkonce.armextab.*)
-    } > FLASH
-
-    __exidx_start = .;
-    .ARM.exidx :
-    {
-        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-    } > FLASH
-    __exidx_end = .;
-
-    __etext = .;
-        
-    .data : AT (__etext)
-    {
-        __data_start__ = .;
-        Image$$RW_IRAM1$$Base = .;
-        *(vtable)
-        *(.data*)
-
-        . = ALIGN(4);
-        /* preinit data */
-        PROVIDE (__preinit_array_start = .);
-        KEEP(*(.preinit_array))
-        PROVIDE (__preinit_array_end = .);
-
-        . = ALIGN(4);
-        /* init data */
-        PROVIDE (__init_array_start = .);
-        KEEP(*(SORT(.init_array.*)))
-        KEEP(*(.init_array))
-        PROVIDE (__init_array_end = .);
-
-
-        . = ALIGN(4);
-        /* finit data */
-        PROVIDE (__fini_array_start = .);
-        KEEP(*(SORT(.fini_array.*)))
-        KEEP(*(.fini_array))
-        PROVIDE (__fini_array_end = .);
-
-        . = ALIGN(4);
-        /* All data end */
-        __data_end__ = .;
-
-    } > RAM
-
-    
-    .bss :
-    {
-        __bss_start__ = .;
-        *(.bss*)
-        *(COMMON)
-        __bss_end__ = .;
-        Image$$RW_IRAM1$$ZI$$Limit = . ;
-    } > RAM
-
-    
-    .heap :
-    {
-        __end__ = .;
-        end = __end__;
-        *(.heap*)
-        __HeapLimit = .;
-    } > RAM
-
-    /* .stack_dummy section doesn't contains any symbols. It is only
-     * used for linker to calculate size of stack sections, and assign
-     * values to stack symbols later */
-    .stack_dummy :
-    {
-        *(.stack)
-    } > RAM
-
-    /* Set stack top to end of RAM, and stack limit move down by
-     * size of stack_dummy section */
-    __StackTop = ORIGIN(RAM) + LENGTH(RAM);
-    __StackLimit = __StackTop - SIZEOF(.stack_dummy);
-    PROVIDE(__stack = __StackTop);
-    
-    /* Check if data + heap + stack exceeds RAM limit */
-    ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
-
-
-    /* Code can explicitly ask for data to be 
-       placed in these higher RAM banks where
-       they will be left uninitialized. 
-    */
-    .AHBSRAM0 (NOLOAD):
-    {
-        Image$$RW_IRAM2$$Base = . ;
-        *(AHBSRAM0)
-        Image$$RW_IRAM2$$ZI$$Limit = .;
-    } > USB_RAM
-
-    .AHBSRAM1 (NOLOAD):
-    {
-        Image$$RW_IRAM3$$Base = . ;
-        *(AHBSRAM1)
-        Image$$RW_IRAM3$$ZI$$Limit = .;
-    } > ETH_RAM
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_ARM/startup_LPC17xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,219 +0,0 @@
-/* File: startup_ARMCM3.s
- * Purpose: startup file for Cortex-M3/M4 devices. Should use with 
- *   GNU Tools for ARM Embedded Processors
- * Version: V1.1
- * Date: 17 June 2011
- * 
- * Copyright (C) 2011 ARM Limited. All rights reserved.
- * ARM Limited (ARM) is supplying this software for use with Cortex-M3/M4 
- * processor based microcontrollers.  This file can be freely distributed 
- * within development tools that are supporting such ARM based processors. 
- *
- * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- */
-    .syntax unified
-    .arch armv7-m
-
-/* Memory Model
-   The HEAP starts at the end of the DATA section and grows upward.
-   
-   The STACK starts at the end of the RAM and grows downward.
-   
-   The HEAP and stack STACK are only checked at compile time:
-   (DATA_SIZE + HEAP_SIZE + STACK_SIZE) < RAM_SIZE
-   
-   This is just a check for the bare minimum for the Heap+Stack area before
-   aborting compilation, it is not the run time limit:
-   Heap_Size + Stack_Size = 0x80 + 0x80 = 0x100
- */
-    .section .stack
-    .align 3
-#ifdef __STACK_SIZE
-    .equ    Stack_Size, __STACK_SIZE
-#else
-    .equ    Stack_Size, 0xc00
-#endif
-    .globl    __StackTop
-    .globl    __StackLimit
-__StackLimit:
-    .space    Stack_Size
-    .size __StackLimit, . - __StackLimit
-__StackTop:
-    .size __StackTop, . - __StackTop
-
-    .section .heap
-    .align 3
-#ifdef __HEAP_SIZE
-    .equ    Heap_Size, __HEAP_SIZE
-#else
-    .equ    Heap_Size, 0x800
-#endif
-    .globl    __HeapBase
-    .globl    __HeapLimit
-__HeapBase:
-    .space    Heap_Size
-    .size __HeapBase, . - __HeapBase
-__HeapLimit:
-    .size __HeapLimit, . - __HeapLimit
-    
-    .section .isr_vector
-    .align 2
-    .globl __isr_vector
-__isr_vector:
-    .long    __StackTop            /* Top of Stack */
-    .long    Reset_Handler         /* Reset Handler */
-    .long    NMI_Handler           /* NMI Handler */
-    .long    HardFault_Handler     /* Hard Fault Handler */
-    .long    MemManage_Handler     /* MPU Fault Handler */
-    .long    BusFault_Handler      /* Bus Fault Handler */
-    .long    UsageFault_Handler    /* Usage Fault Handler */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    SVC_Handler           /* SVCall Handler */
-    .long    DebugMon_Handler      /* Debug Monitor Handler */
-    .long    0                     /* Reserved */
-    .long    PendSV_Handler        /* PendSV Handler */
-    .long    SysTick_Handler       /* SysTick Handler */
-
-    /* External interrupts */
-    .long   WDT_IRQHandler              /* 16: Watchdog Timer               */
-    .long   TIMER0_IRQHandler           /* 17: Timer0                       */
-    .long   TIMER1_IRQHandler           /* 18: Timer1                       */
-    .long   TIMER2_IRQHandler           /* 19: Timer2                       */
-    .long   TIMER3_IRQHandler           /* 20: Timer3                       */
-    .long   UART0_IRQHandler            /* 21: UART0                        */
-    .long   UART1_IRQHandler            /* 22: UART1                        */
-    .long   UART2_IRQHandler            /* 23: UART2                        */
-    .long   UART3_IRQHandler            /* 24: UART3                        */
-    .long   PWM1_IRQHandler             /* 25: PWM1                         */
-    .long   I2C0_IRQHandler             /* 26: I2C0                         */
-    .long   I2C1_IRQHandler             /* 27: I2C1                         */
-    .long   I2C2_IRQHandler             /* 28: I2C2                         */
-    .long   SPI_IRQHandler              /* 29: SPI                          */
-    .long   SSP0_IRQHandler             /* 30: SSP0                         */
-    .long   SSP1_IRQHandler             /* 31: SSP1                         */
-    .long   PLL0_IRQHandler             /* 32: PLL0 Lock (Main PLL)         */
-    .long   RTC_IRQHandler              /* 33: Real Time Clock              */
-    .long   EINT0_IRQHandler            /* 34: External Interrupt 0         */
-    .long   EINT1_IRQHandler            /* 35: External Interrupt 1         */
-    .long   EINT2_IRQHandler            /* 36: External Interrupt 2         */
-    .long   EINT3_IRQHandler            /* 37: External Interrupt 3         */
-    .long   ADC_IRQHandler              /* 38: A/D Converter                */
-    .long   BOD_IRQHandler              /* 39: Brown-Out Detect             */
-    .long   USB_IRQHandler              /* 40: USB                          */
-    .long   CAN_IRQHandler              /* 41: CAN                          */
-    .long   DMA_IRQHandler              /* 42: General Purpose DMA          */
-    .long   I2S_IRQHandler              /* 43: I2S                          */
-    .long   ENET_IRQHandler             /* 44: Ethernet                     */
-    .long   RIT_IRQHandler              /* 45: Repetitive Interrupt Timer   */
-    .long   MCPWM_IRQHandler            /* 46: Motor Control PWM            */
-    .long   QEI_IRQHandler              /* 47: Quadrature Encoder Interface */
-    .long   PLL1_IRQHandler             /* 48: PLL1 Lock (USB PLL)          */
-    .long   USBActivity_IRQHandler      /* 49: USB Activity                 */
-    .long   CANActivity_IRQHandler      /* 50: CAN Activity                 */
-
-    .size    __isr_vector, . - __isr_vector
-
-    .text
-    .thumb
-    .thumb_func
-    .align 2
-    .globl    Reset_Handler
-    .type    Reset_Handler, %function
-Reset_Handler:
-/*     Loop to copy data from read only memory to RAM. The ranges
- *      of copy from/to are specified by following symbols evaluated in 
- *      linker script.
- *      _etext: End of code section, i.e., begin of data sections to copy from.
- *      __data_start__/__data_end__: RAM address range that data should be
- *      copied to. Both must be aligned to 4 bytes boundary.  */
-
-    ldr    r1, =__etext
-    ldr    r2, =__data_start__
-    ldr    r3, =__data_end__
-
-.flash_to_ram_loop:
-    cmp     r2, r3
-    ittt    lt
-    ldrlt   r0, [r1], #4
-    strlt   r0, [r2], #4
-    blt    .flash_to_ram_loop
-
-    ldr    r0, =SystemInit
-    blx    r0
-    ldr    r0, =_start
-    bx    r0
-    .pool
-    .size Reset_Handler, . - Reset_Handler
-    
-/*    Macro to define default handlers. Default handler
- *    will be weak symbol and just dead loops. They can be
- *    overwritten by other handlers */
-    .macro    def_default_handler    handler_name
-    .align 1
-    .thumb_func
-    .weak    \handler_name
-    .type    \handler_name, %function
-\handler_name :
-    b    .
-    .size    \handler_name, . - \handler_name
-    .endm
-    
-    def_default_handler    NMI_Handler
-    def_default_handler    HardFault_Handler
-    def_default_handler    MemManage_Handler
-    def_default_handler    BusFault_Handler
-    def_default_handler    UsageFault_Handler
-    def_default_handler    SVC_Handler
-    def_default_handler    DebugMon_Handler
-    def_default_handler    PendSV_Handler
-    def_default_handler    SysTick_Handler
-    def_default_handler    Default_Handler
-    
-    def_default_handler     WDT_IRQHandler
-    def_default_handler     TIMER0_IRQHandler
-    def_default_handler     TIMER1_IRQHandler
-    def_default_handler     TIMER2_IRQHandler
-    def_default_handler     TIMER3_IRQHandler
-    def_default_handler     UART0_IRQHandler
-    def_default_handler     UART1_IRQHandler
-    def_default_handler     UART2_IRQHandler
-    def_default_handler     UART3_IRQHandler
-    def_default_handler     PWM1_IRQHandler
-    def_default_handler     I2C0_IRQHandler
-    def_default_handler     I2C1_IRQHandler
-    def_default_handler     I2C2_IRQHandler
-    def_default_handler     SPI_IRQHandler
-    def_default_handler     SSP0_IRQHandler
-    def_default_handler     SSP1_IRQHandler
-    def_default_handler     PLL0_IRQHandler
-    def_default_handler     RTC_IRQHandler
-    def_default_handler     EINT0_IRQHandler
-    def_default_handler     EINT1_IRQHandler
-    def_default_handler     EINT2_IRQHandler
-    def_default_handler     EINT3_IRQHandler
-    def_default_handler     ADC_IRQHandler
-    def_default_handler     BOD_IRQHandler
-    def_default_handler     USB_IRQHandler
-    def_default_handler     CAN_IRQHandler
-    def_default_handler     DMA_IRQHandler
-    def_default_handler     I2S_IRQHandler
-    def_default_handler     ENET_IRQHandler
-    def_default_handler     RIT_IRQHandler
-    def_default_handler     MCPWM_IRQHandler
-    def_default_handler     QEI_IRQHandler
-    def_default_handler     PLL1_IRQHandler
-    def_default_handler     USBActivity_IRQHandler
-    def_default_handler     CANActivity_IRQHandler
-
-    .weak    DEF_IRQHandler
-    .set    DEF_IRQHandler, Default_Handler
-
-    .end
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_CR/LPC1768.ld	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-/* mbed - LPC1768 linker script
- * Based linker script generated by Code Red Technologies Red Suite 4.1
- */
-GROUP(libgcc.a libc.a libstdc++.a libm.a libcr_newlib_nohost.a crti.o crtn.o crtbegin.o crtend.o)
-
-MEMORY
-{
-  /* Define each memory region */
-  MFlash512 (rx) : ORIGIN = 0x0, LENGTH = 0x80000 /* 512k */
-  RamLoc32 (rwx) : ORIGIN = 0x100000C8, LENGTH = 0x7F38 /* 32k */
-  RamAHB32 (rwx) : ORIGIN = 0x2007c000, LENGTH = 0x8000 /* 32k */
-
-}
-  /* Define a symbol for the top of each memory region */
-  __top_MFlash512 = 0x0 + 0x80000;
-  __top_RamLoc32 = 0x10000000 + 0x8000;
-  __top_RamAHB32 = 0x2007c000 + 0x8000;
-
-ENTRY(ResetISR)
-
-SECTIONS
-{
-
-    /* MAIN TEXT SECTION */ 
-    .text : ALIGN(4)
-    {
-        FILL(0xff)
-        KEEP(*(.isr_vector))
-        
-        /* Global Section Table */
-        . = ALIGN(4) ;
-        __section_table_start = .;
-        __data_section_table = .;
-        LONG(LOADADDR(.data));
-        LONG(    ADDR(.data)) ;
-        LONG(  SIZEOF(.data));
-        LONG(LOADADDR(.data_RAM2));
-        LONG(    ADDR(.data_RAM2)) ;
-        LONG(  SIZEOF(.data_RAM2));
-        __data_section_table_end = .;
-        __bss_section_table = .;
-        LONG(    ADDR(.bss));
-        LONG(  SIZEOF(.bss));
-        LONG(    ADDR(.bss_RAM2));
-        LONG(  SIZEOF(.bss_RAM2));
-        __bss_section_table_end = .;
-        __section_table_end = . ;
-        /* End of Global Section Table */
-        
-
-        *(.after_vectors*)
-        
-        *(.text*)
-        *(.rodata .rodata.*)
-        . = ALIGN(4);
-        
-        /* C++ constructors etc */
-        . = ALIGN(4);
-        KEEP(*(.init))
-        
-        . = ALIGN(4);
-        __preinit_array_start = .;
-        KEEP (*(.preinit_array))
-        __preinit_array_end = .;
-        
-        . = ALIGN(4);
-        __init_array_start = .;
-        KEEP (*(SORT(.init_array.*)))
-        KEEP (*(.init_array))
-        __init_array_end = .;
-        
-        KEEP(*(.fini));
-        
-        . = ALIGN(0x4);
-        KEEP (*crtbegin.o(.ctors))
-        KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
-        KEEP (*(SORT(.ctors.*)))
-        KEEP (*crtend.o(.ctors))
-        
-        . = ALIGN(0x4);
-        KEEP (*crtbegin.o(.dtors))
-        KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
-        KEEP (*(SORT(.dtors.*)))
-        KEEP (*crtend.o(.dtors))
-        /* End C++ */
-    } > MFlash512
-
-    /*
-     * for exception handling/unwind - some Newlib functions (in common
-     * with C++ and STDC++) use this.
-     */
-    .ARM.extab : ALIGN(4)
-    {
-        *(.ARM.extab* .gnu.linkonce.armextab.*)
-    } > MFlash512
-    __exidx_start = .;
-    
-    .ARM.exidx : ALIGN(4)
-    {
-        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-    } > MFlash512
-    __exidx_end = .;
-    
-    _etext = .;
-        
-    
-    .data_RAM2 : ALIGN(4)
-    {
-       FILL(0xff)
-        *(.data.$RAM2*)
-        *(.data.$RamAHB32*)
-       . = ALIGN(4) ;
-    } > RamAHB32 AT>MFlash512
-    
-    /* MAIN DATA SECTION */
-
-    .uninit_RESERVED : ALIGN(4)
-    {
-        KEEP(*(.bss.$RESERVED*))
-    } > RamLoc32
-
-    .data : ALIGN(4)
-    {
-        FILL(0xff)
-        _data = .;
-        *(vtable)
-        *(.data*)
-        . = ALIGN(4) ;
-        _edata = .;
-    } > RamLoc32 AT>MFlash512
-
-    
-    .bss_RAM2 : ALIGN(4)
-    {
-        *(.bss.$RAM2*)
-        *(.bss.$RamAHB32*)
-       . = ALIGN(4) ;
-    } > RamAHB32
-
-    /* MAIN BSS SECTION */
-    .bss : ALIGN(4)
-    {
-        _bss = .;
-        *(.bss*)
-        *(COMMON)
-        . = ALIGN(4) ;
-        _ebss = .;
-        PROVIDE(end = .);
-    } > RamLoc32
-    
-    PROVIDE(_pvHeapStart = .);
-    PROVIDE(_vStackTop = __top_RamLoc32 - 0);
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_CR/startup_LPC17xx.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-extern "C" {
-
-#include "LPC17xx.h"
-
-#define WEAK          __attribute__ ((weak))
-#define ALIAS(f)      __attribute__ ((weak, alias (#f)))
-#define AFTER_VECTORS __attribute__ ((section(".after_vectors")))
-
-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;
-
-extern void __libc_init_array(void);
-extern int main(void);
-extern void _vStackTop(void);
-extern void (* const g_pfnVectors[])(void);
-
-     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 SVCall_Handler    (void);
-WEAK void DebugMon_Handler  (void);
-WEAK void PendSV_Handler    (void);
-WEAK void SysTick_Handler   (void);
-WEAK void IntDefaultHandler (void);
-
-void WDT_IRQHandler        (void) ALIAS(IntDefaultHandler);
-void TIMER0_IRQHandler     (void) ALIAS(IntDefaultHandler);
-void TIMER1_IRQHandler     (void) ALIAS(IntDefaultHandler);
-void TIMER2_IRQHandler     (void) ALIAS(IntDefaultHandler);
-void TIMER3_IRQHandler     (void) ALIAS(IntDefaultHandler);
-void UART0_IRQHandler      (void) ALIAS(IntDefaultHandler);
-void UART1_IRQHandler      (void) ALIAS(IntDefaultHandler);
-void UART2_IRQHandler      (void) ALIAS(IntDefaultHandler);
-void UART3_IRQHandler      (void) ALIAS(IntDefaultHandler);
-void PWM1_IRQHandler       (void) ALIAS(IntDefaultHandler);
-void I2C0_IRQHandler       (void) ALIAS(IntDefaultHandler);
-void I2C1_IRQHandler       (void) ALIAS(IntDefaultHandler);
-void I2C2_IRQHandler       (void) ALIAS(IntDefaultHandler);
-void SPI_IRQHandler        (void) ALIAS(IntDefaultHandler);
-void SSP0_IRQHandler       (void) ALIAS(IntDefaultHandler);
-void SSP1_IRQHandler       (void) ALIAS(IntDefaultHandler);
-void PLL0_IRQHandler       (void) ALIAS(IntDefaultHandler);
-void RTC_IRQHandler        (void) ALIAS(IntDefaultHandler);
-void EINT0_IRQHandler      (void) ALIAS(IntDefaultHandler);
-void EINT1_IRQHandler      (void) ALIAS(IntDefaultHandler);
-void EINT2_IRQHandler      (void) ALIAS(IntDefaultHandler);
-void EINT3_IRQHandler      (void) ALIAS(IntDefaultHandler);
-void ADC_IRQHandler        (void) ALIAS(IntDefaultHandler);
-void BOD_IRQHandler        (void) ALIAS(IntDefaultHandler);
-void USB_IRQHandler        (void) ALIAS(IntDefaultHandler);
-void CAN_IRQHandler        (void) ALIAS(IntDefaultHandler);
-void DMA_IRQHandler        (void) ALIAS(IntDefaultHandler);
-void I2S_IRQHandler        (void) ALIAS(IntDefaultHandler);
-void ENET_IRQHandler       (void) ALIAS(IntDefaultHandler);
-void RIT_IRQHandler        (void) ALIAS(IntDefaultHandler);
-void MCPWM_IRQHandler      (void) ALIAS(IntDefaultHandler);
-void QEI_IRQHandler        (void) ALIAS(IntDefaultHandler);
-void PLL1_IRQHandler       (void) ALIAS(IntDefaultHandler);
-void USBActivity_IRQHandler(void) ALIAS(IntDefaultHandler);
-void CANActivity_IRQHandler(void) ALIAS(IntDefaultHandler);
-
-__attribute__ ((section(".isr_vector")))
-void (* const g_pfnVectors[])(void) = {
-    &_vStackTop, ResetISR, NMI_Handler,
-    HardFault_Handler,
-    MemManage_Handler,
-    BusFault_Handler,
-    UsageFault_Handler,
-    0,
-    0,
-    0,
-    0,
-    SVCall_Handler,
-    DebugMon_Handler,
-    0,
-    PendSV_Handler,
-    SysTick_Handler,
-    WDT_IRQHandler,
-    TIMER0_IRQHandler,
-    TIMER1_IRQHandler,
-    TIMER2_IRQHandler,
-    TIMER3_IRQHandler,
-    UART0_IRQHandler,
-    UART1_IRQHandler,
-    UART2_IRQHandler,
-    UART3_IRQHandler,
-    PWM1_IRQHandler,
-    I2C0_IRQHandler,
-    I2C1_IRQHandler,
-    I2C2_IRQHandler,
-    SPI_IRQHandler,
-    SSP0_IRQHandler,
-    SSP1_IRQHandler,
-    PLL0_IRQHandler,
-    RTC_IRQHandler,
-    EINT0_IRQHandler,
-    EINT1_IRQHandler,
-    EINT2_IRQHandler,
-    EINT3_IRQHandler,
-    ADC_IRQHandler,
-    BOD_IRQHandler,
-    USB_IRQHandler,
-    CAN_IRQHandler,
-    DMA_IRQHandler,
-    I2S_IRQHandler,
-    ENET_IRQHandler,
-    RIT_IRQHandler,
-    MCPWM_IRQHandler,
-    QEI_IRQHandler,
-    PLL1_IRQHandler,
-    USBActivity_IRQHandler,
-    CANActivity_IRQHandler,
-};
-
-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++;
-}
-
-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;
-}
-
-AFTER_VECTORS void ResetISR(void) {
-    unsigned int LoadAddr, ExeAddr, SectionLen;
-    unsigned int *SectionTableAddr;
-    
-    SectionTableAddr = &__data_section_table;
-    
-    while (SectionTableAddr < &__data_section_table_end) {
-        LoadAddr = *SectionTableAddr++;
-        ExeAddr = *SectionTableAddr++;
-        SectionLen = *SectionTableAddr++;
-        data_init(LoadAddr, ExeAddr, SectionLen);
-    }
-    while (SectionTableAddr < &__bss_section_table_end) {
-        ExeAddr = *SectionTableAddr++;
-        SectionLen = *SectionTableAddr++;
-        bss_init(ExeAddr, SectionLen);
-    }
-    
-    SystemInit();
-    __libc_init_array();
-    main();
-    while (1) {;}
-}
-
-AFTER_VECTORS void NMI_Handler       (void) {}
-AFTER_VECTORS void HardFault_Handler (void) {}
-AFTER_VECTORS void MemManage_Handler (void) {}
-AFTER_VECTORS void BusFault_Handler  (void) {}
-AFTER_VECTORS void UsageFault_Handler(void) {}
-AFTER_VECTORS void SVCall_Handler    (void) {}
-AFTER_VECTORS void DebugMon_Handler  (void) {}
-AFTER_VECTORS void PendSV_Handler    (void) {}
-AFTER_VECTORS void SysTick_Handler   (void) {}
-AFTER_VECTORS void IntDefaultHandler (void) {}
-
-int __aeabi_atexit(void *object, void (*destructor)(void *), void *dso_handle) {return 0;}
-}
-
-#include <stdlib.h>
-
-void *operator new(size_t size)  {return malloc(size);}
-void *operator new[](size_t size){return malloc(size);}
-
-void operator delete(void *p)   {free(p);}
-void operator delete[](void *p) {free(p);}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_CS/LPC1768.ld	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,212 +0,0 @@
-/* Linker script for mbed LPC1768
- *
- * Version:CodeSourcery Sourcery G++ Lite 2007q3-53
- * BugURL:https://support.codesourcery.com/GNUToolchain/
- *
- *  Copyright 2007 CodeSourcery.
- *
- * The authors hereby grant permission to use, copy, modify, distribute,
- * and license this software and its documentation for any purpose, provided
- * that existing copyright notices are retained in all copies and that this
- * notice is included verbatim in any distributions. No written agreement,
- * license, or royalty fee is required for any of the authorized uses.
- * Modifications to this software may be copyrighted by their authors
- * and need not follow the licensing terms described here, provided that
- * the new terms are clearly indicated on the first page of each file where
- * they apply. */
-OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
-ENTRY(__cs3_reset_cortex_m)
-SEARCH_DIR(.)
-
-/*
-ram ORIGIN: 8_byte_aligned(49 vect * 4 bytes) =  8_byte_aligned(0xC4) = 0xC8
-ram LENGTH: 32KB - 0xC8 = 0x7F38
-*/
-MEMORY
-{
-  rom (rx)  : ORIGIN = 0x00000000, LENGTH = 512K
-  
-  ram (rwx) : ORIGIN = 0x100000C8, LENGTH = 0x7F38
-  
-  ram1(rwx) : ORIGIN = 0x2007C000, LENGTH = 16K
-  ram2(rwx) : ORIGIN = 0x20080000, LENGTH = 16K
-}
-
-/* These force the linker to search for particular symbols from
- * the start of the link process and thus ensure the user's
- * overrides are picked up
- */
-EXTERN(__cs3_reset_cortex_m)
-EXTERN(__cs3_interrupt_vector_cortex_m)
-EXTERN(__cs3_start_c main __cs3_stack __cs3_stack_size __cs3_heap_end)
-
-PROVIDE(__cs3_stack = __cs3_region_start_ram + __cs3_region_size_ram);
-PROVIDE(__cs3_stack_size = __cs3_region_start_ram + __cs3_region_size_ram - _end);
-PROVIDE(__cs3_heap_start = _end);
-PROVIDE(__cs3_heap_end = __cs3_region_start_ram + __cs3_region_size_ram);
-
-SECTIONS
-{
-  .text :
-  {
-    CREATE_OBJECT_SYMBOLS
-    __cs3_region_start_rom = .;
-    *(.cs3.region-head.rom)
-    __cs3_interrupt_vector = __cs3_interrupt_vector_cortex_m;
-    *(.cs3.interrupt_vector)
-    /* Make sure we pulled in an interrupt vector.  */
-    ASSERT (. != __cs3_interrupt_vector_cortex_m, "No interrupt vector");
-    *(.rom)
-    *(.rom.b)
-
-    __cs3_reset = __cs3_reset_cortex_m;
-    *(.cs3.reset)
-    /* Make sure we pulled in some reset code.  */
-    ASSERT (. != __cs3_reset, "No reset code");
-
-    *(.text .text.* .gnu.linkonce.t.*)
-    *(.plt)
-    *(.gnu.warning)
-    *(.glue_7t) *(.glue_7) *(.vfp11_veneer)
-
-    *(.rodata .rodata.* .gnu.linkonce.r.*)
-
-    *(.ARM.extab* .gnu.linkonce.armextab.*)
-    *(.gcc_except_table)
-    *(.eh_frame_hdr)
-    *(.eh_frame)
-
-    . = ALIGN(4);
-    KEEP(*(.init))
-
-    . = ALIGN(4);
-    __preinit_array_start = .;
-    KEEP (*(.preinit_array))
-    __preinit_array_end = .;
-
-    . = ALIGN(4);
-    __init_array_start = .;
-    KEEP (*(SORT(.init_array.*)))
-    KEEP (*(.init_array))
-    __init_array_end = .;
-
-    . = ALIGN(0x4);
-    KEEP (*crtbegin.o(.ctors))
-    KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
-    KEEP (*(SORT(.ctors.*)))
-    KEEP (*crtend.o(.ctors))
-
-    . = ALIGN(4);
-    KEEP(*(.fini))
-
-    . = ALIGN(4);
-    __fini_array_start = .;
-    KEEP (*(.fini_array))
-    KEEP (*(SORT(.fini_array.*)))
-    __fini_array_end = .;
-
-    KEEP (*crtbegin.o(.dtors))
-    KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
-    KEEP (*(SORT(.dtors.*)))
-    KEEP (*crtend.o(.dtors))
-
-    . = ALIGN(4);
-    __cs3_regions = .;
-    LONG (0)
-    LONG (__cs3_region_init_ram)
-    LONG (__cs3_region_start_ram)
-    LONG (__cs3_region_init_size_ram)
-    LONG (__cs3_region_zero_size_ram)
-  }
-
-  /* .ARM.exidx is sorted, so has to go in its own output section.  */
-  __exidx_start = .;
-  .ARM.exidx :
-  {
-    *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-  } >rom
-  __exidx_end = .;
-  .text.align :
-  {
-    . = ALIGN(8);
-    _etext = .;
-  } >rom
-  __cs3_region_size_rom = LENGTH(rom);
-  __cs3_region_num = 1;
-  
-  .data :
-  {
-    __cs3_region_start_ram = .;
-    *(.cs3.region-head.ram)
-    KEEP(*(.jcr))
-    *(.got.plt) *(.got)
-    *(.shdata)
-    *(.data .data.* .gnu.linkonce.d.*)
-    *(.ram)
-    . = ALIGN (8);
-    _edata = .;
-  } >ram AT>rom
-  .bss :
-  {
-    *(.shbss)
-    *(.bss .bss.* .gnu.linkonce.b.*)
-    *(COMMON)
-    *(.ram.b)
-    . = ALIGN (8);
-    _end = .;
-    __end = .;
-  } >ram AT>rom
-  /* This used for USB RAM section */
-	.usb_ram (NOLOAD):
-	{
-		*.o (USB_RAM)
-	} > ram2
-  .heap (NOLOAD) :
-  {
-    *(.heap)
-  } >ram
-  .stack (__cs3_stack - __cs3_stack_size) (NOLOAD):
-  {
-    *(.stack)
-    _estack = .;
-    PROVIDE(estack = .);
-  } >ram
-
-  __cs3_region_init_ram = LOADADDR (.data);
-  __cs3_region_init_size_ram = _edata - __cs3_region_start_ram;
-  __cs3_region_zero_size_ram = _end - _edata;
-  __cs3_region_size_ram = LENGTH(ram);
-  __cs3_region_num = 1;
-
-  .stab 0 (NOLOAD) : { *(.stab) }
-  .stabstr 0 (NOLOAD) : { *(.stabstr) }
-  /* DWARF debug sections.
-   * Symbols in the DWARF debugging sections are relative to the beginning
-   * of the section so we begin them at 0.  */
-  /* DWARF 1 */
-  .debug          0 : { *(.debug) }
-  .line           0 : { *(.line) }
-  /* GNU DWARF 1 extensions */
-  .debug_srcinfo  0 : { *(.debug_srcinfo) }
-  .debug_sfnames  0 : { *(.debug_sfnames) }
-  /* DWARF 1.1 and DWARF 2 */
-  .debug_aranges  0 : { *(.debug_aranges) }
-  .debug_pubnames 0 : { *(.debug_pubnames) }
-  /* DWARF 2 */
-  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
-  .debug_abbrev   0 : { *(.debug_abbrev) }
-  .debug_line     0 : { *(.debug_line) }
-  .debug_frame    0 : { *(.debug_frame) }
-  .debug_str      0 : { *(.debug_str) }
-  .debug_loc      0 : { *(.debug_loc) }
-  .debug_macinfo  0 : { *(.debug_macinfo) }
-  /* SGI/MIPS DWARF 2 extensions */
-  .debug_weaknames 0 : { *(.debug_weaknames) }
-  .debug_funcnames 0 : { *(.debug_funcnames) }
-  .debug_typenames 0 : { *(.debug_typenames) }
-  .debug_varnames  0 : { *(.debug_varnames) }
-
-  .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
-  .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }
-  /DISCARD/ : { *(.note.GNU-stack) }
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_CS/startup_LPC17xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-    .equ    Stack_Size, 0x1024
-    .section ".stack", "w"
-    .align  3
-    .globl  __cs3_stack_mem
-    .globl  __cs3_stack_size
-__cs3_stack_mem:
-    .if     Stack_Size
-    .space  Stack_Size
-    .endif
-    .size   __cs3_stack_mem,  . - __cs3_stack_mem
-    .set    __cs3_stack_size, . - __cs3_stack_mem
-
-    .equ    Heap_Size,  0x8000
-    .section ".heap", "w"
-    .align  3
-    .globl  __cs3_heap_start
-    .globl  __cs3_heap_end
-__cs3_heap_start:
-    .if     Heap_Size
-    .space  Heap_Size
-    .endif
-__cs3_heap_end:
-
-
-    .section ".cs3.interrupt_vector"
-    .globl  __cs3_interrupt_vector_cortex_m
-    .type   __cs3_interrupt_vector_cortex_m, %object
-
-__cs3_interrupt_vector_cortex_m:
-    .long   __cs3_stack
-    .long   __cs3_reset
-    .long   NMI_Handler
-    .long   HardFault_Handler
-    .long   MemManage_Handler
-    .long   BusFault_Handler
-    .long   UsageFault_Handler
-    .long   0
-    .long   0
-    .long   0
-    .long   0
-    .long   SVC_Handler
-    .long   DebugMon_Handler
-    .long   0
-    .long   PendSV_Handler
-    .long   SysTick_Handler
-
-    .long   WDT_IRQHandler
-    .long   TIMER0_IRQHandler
-    .long   TIMER1_IRQHandler
-    .long   TIMER2_IRQHandler
-    .long   TIMER3_IRQHandler
-    .long   UART0_IRQHandler
-    .long   UART1_IRQHandler
-    .long   UART2_IRQHandler
-    .long   UART3_IRQHandler
-    .long   PWM1_IRQHandler
-    .long   I2C0_IRQHandler
-    .long   I2C1_IRQHandler
-    .long   I2C2_IRQHandler
-    .long   SPI_IRQHandler
-    .long   SSP0_IRQHandler
-    .long   SSP1_IRQHandler
-    .long   PLL0_IRQHandler
-    .long   RTC_IRQHandler
-    .long   EINT0_IRQHandler
-    .long   EINT1_IRQHandler
-    .long   EINT2_IRQHandler
-    .long   EINT3_IRQHandler
-    .long   ADC_IRQHandler
-    .long   BOD_IRQHandler
-    .long   USB_IRQHandler
-    .long   CAN_IRQHandler
-    .long   DMA_IRQHandler
-    .long   I2S_IRQHandler
-    .long   ENET_IRQHandler
-    .long   RIT_IRQHandler
-    .long   MCPWM_IRQHandler
-    .long   QEI_IRQHandler
-    .long   PLL1_IRQHandler
-    .long	USBActivity_IRQHandler
-    .long 	CANActivity_IRQHandler
-
-    .size   __cs3_interrupt_vector_cortex_m, . - __cs3_interrupt_vector_cortex_m
-
-    .thumb
-
-    .section .cs3.reset,"x",%progbits
-    .thumb_func
-    .globl  __cs3_reset_cortex_m
-    .type   __cs3_reset_cortex_m, %function
-__cs3_reset_cortex_m:
-    .fnstart
-    LDR     R0, =SystemInit
-    BLX     R0
-    LDR     R0, =__cs3_start_c
-    BX      R0
-    .pool
-    .cantunwind
-    .fnend
-    .size   __cs3_reset_cortex_m,.-__cs3_reset_cortex_m
-
-    .section ".text"
-
-    .weak   NMI_Handler
-    .type   NMI_Handler, %function
-NMI_Handler:
-    B       .
-    .size   NMI_Handler, . - NMI_Handler
-
-    .weak   HardFault_Handler
-    .type   HardFault_Handler, %function
-HardFault_Handler:
-    B       .
-    .size   HardFault_Handler, . - HardFault_Handler
-
-    .weak   MemManage_Handler
-    .type   MemManage_Handler, %function
-MemManage_Handler:
-    B       .
-    .size   MemManage_Handler, . - MemManage_Handler
-
-    .weak   BusFault_Handler
-    .type   BusFault_Handler, %function
-BusFault_Handler:
-    B       .
-    .size   BusFault_Handler, . - BusFault_Handler
-
-    .weak   UsageFault_Handler
-    .type   UsageFault_Handler, %function
-UsageFault_Handler:
-    B       .
-    .size   UsageFault_Handler, . - UsageFault_Handler
-
-    .weak   SVC_Handler
-    .type   SVC_Handler, %function
-SVC_Handler:
-    B       .
-    .size   SVC_Handler, . - SVC_Handler
-
-    .weak   DebugMon_Handler
-    .type   DebugMon_Handler, %function
-DebugMon_Handler:
-    B       .
-    .size   DebugMon_Handler, . - DebugMon_Handler
-
-    .weak   PendSV_Handler
-    .type   PendSV_Handler, %function
-PendSV_Handler:
-    B       .
-    .size   PendSV_Handler, . - PendSV_Handler
-
-    .weak   SysTick_Handler
-    .type   SysTick_Handler, %function
-SysTick_Handler:
-    B       .
-    .size   SysTick_Handler, . - SysTick_Handler
-
-    .globl  Default_Handler
-    .type   Default_Handler, %function
-Default_Handler:
-    B       .
-    .size   Default_Handler, . - Default_Handler
-
-    .macro  IRQ handler
-    .weak   \handler
-    .set    \handler, Default_Handler
-    .endm
-
-    IRQ     WDT_IRQHandler
-    IRQ     TIMER0_IRQHandler
-    IRQ     TIMER1_IRQHandler
-    IRQ     TIMER2_IRQHandler
-    IRQ     TIMER3_IRQHandler
-    IRQ     UART0_IRQHandler
-    IRQ     UART1_IRQHandler
-    IRQ     UART2_IRQHandler
-    IRQ     UART3_IRQHandler
-    IRQ     PWM1_IRQHandler
-    IRQ     I2C0_IRQHandler
-    IRQ     I2C1_IRQHandler
-    IRQ     I2C2_IRQHandler
-    IRQ     SPI_IRQHandler
-    IRQ     SSP0_IRQHandler
-    IRQ     SSP1_IRQHandler
-    IRQ     PLL0_IRQHandler
-    IRQ     RTC_IRQHandler
-    IRQ     EINT0_IRQHandler
-    IRQ     EINT1_IRQHandler
-    IRQ     EINT2_IRQHandler
-    IRQ     EINT3_IRQHandler
-    IRQ     ADC_IRQHandler
-    IRQ     BOD_IRQHandler
-    IRQ     USB_IRQHandler
-    IRQ     CAN_IRQHandler
-    IRQ     DMA_IRQHandler
-    IRQ     I2S_IRQHandler
-    IRQ     ENET_IRQHandler
-    IRQ     RIT_IRQHandler
-    IRQ     MCPWM_IRQHandler
-    IRQ     QEI_IRQHandler
-    IRQ     PLL1_IRQHandler
-    IRQ		USBActivity_IRQHandler
-    IRQ		CANActivity_IRQHandler
-    .end
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_CS/sys.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-#include "cmsis.h"
-#include <sys/types.h>
-#include <errno.h>
-
-extern "C" {
-
-struct SCS3Regions {
-    unsigned long   Dummy;
-    unsigned long*  InitRam;
-    unsigned long*  StartRam;
-    unsigned long   InitSizeRam;
-    unsigned long   ZeroSizeRam;
-};
-
-extern unsigned long __cs3_regions;
-extern unsigned long __cs3_heap_start;
-
-int  main(void);
-void __libc_init_array(void);
-void exit(int ErrorCode);
-
-static void *heap_pointer = NULL;
-
-void __cs3_start_c(void) {
-    static SCS3Regions* pCS3Regions = (SCS3Regions*)&__cs3_regions;
-    unsigned long* pulDest;
-    unsigned long* pulSrc;
-    unsigned long  ByteCount;
-    unsigned long  i;
-    
-    pulSrc = pCS3Regions->InitRam;
-    pulDest = pCS3Regions->StartRam;
-    ByteCount = pCS3Regions->InitSizeRam;
-    if (pulSrc != pulDest) {
-        for(i = 0 ; i < ByteCount ; i += sizeof(unsigned long)) {
-            *(pulDest++) = *(pulSrc++);
-        }
-    } else {
-        pulDest = (unsigned long*)(void*)((char*)pulDest + ByteCount);
-    }
-    
-    ByteCount = pCS3Regions->ZeroSizeRam;
-    for(i = 0 ; i < ByteCount ; i += sizeof(unsigned long)) {
-        *(pulDest++) = 0;
-    }
-    
-    heap_pointer = &__cs3_heap_start;
-     __libc_init_array();
-    
-    exit(main());
-}
-
-int _kill(int pid, int sig) {
-    errno = EINVAL;
-    return -1;
-}
-
-void _exit(int status) {
-    exit(status);
-}
-
-int _getpid(void) {
-	return 1;
-}
-
-void *_sbrk(unsigned int incr) {
-    void *mem;
-    
-    unsigned int next = ((((unsigned int)heap_pointer + incr) + 7) & ~7);
-    if (next > __get_MSP()) {
-        mem = NULL;
-    } else {
-        mem = (void *)heap_pointer;
-    }
-    heap_pointer = (void *)next;
-    
-    return mem;
-}
-
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_IAR/LPC17xx.icf	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/* [ROM] */
-define symbol __intvec_start__     = 0x00000000;
-define symbol __region_ROM_start__ = 0x00000000;
-define symbol __CRP_start__        = 0x000002FC;
-define symbol __CRP_end__          = 0x000002FF;
-define symbol __region_ROM_end__   = 0x0007FFFF;
-
-/* [RAM] Vector table dynamic copy: 8_byte_aligned(49 vect * 4 bytes) =  8_byte_aligned(0xC4) = 0xC8*/
-define symbol __NVIC_start__       = 0x10000000;
-define symbol __NVIC_end__         = 0x100000C7;
-define symbol __region_RAM_start__ = 0x100000C8;
-define symbol __region_RAM_end__   = 0x1000FFDF;
-define symbol _AHB_RAM_start__     = 0x2007C000;
-define symbol _AHB_RAM_end__       = 0x20083FFF;
-
-/* Memory regions */
-define memory mem with size = 4G;
-
-define region ROM_region     = mem:[from __region_ROM_start__   to __region_ROM_end__] - mem:[from  __CRP_start__ to __CRP_end__];
-define region CRP_region     = mem:[from  __CRP_start__ to __CRP_end__];
-
-define region RAM_region     = mem:[from __region_RAM_start__   to __region_RAM_end__];
-define region AHB_RAM_region = mem:[from _AHB_RAM_start__ to _AHB_RAM_end__];
-
-/* Stack and Heap */
-define symbol __size_cstack__   = 0x800;
-define symbol __size_heap__     = 0x800;
-define block CSTACK    with alignment = 8, size = __size_cstack__   { };
-define block HEAP      with alignment = 8, size = __size_heap__     { };
-define block STACKHEAP with fixed order { block HEAP, block CSTACK };
-
-initialize by copy with packing = zeros { readwrite };
-do not initialize  { section .noinit };
-
-place at address mem:__intvec_start__ { section .intvec };
-place at address mem:0x2FC { section CRPKEY };
-place in ROM_region     { readonly };
-place in RAM_region     { readwrite, block STACKHEAP };
-place in AHB_RAM_region { section USB_RAM };
-place in CRP_region     { section .crp };
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_IAR/startup_LPC17xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,375 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_LPC17xx.s
-; * @purpose: CMSIS Cortex-M3 Core Device Startup File
-; *           for the NXP LPC17xx Device Series
-; * @version: V1.03
-; * @date:    09. February 2010
-; *----------------------------------------------------------------------------
-; *
-; * Copyright (C) 2010 ARM Limited. All rights reserved.
-; *
-; * ARM Limited (ARM) is supplying this software for use with Cortex-Mx
-; * processor based microcontrollers.  This file can be freely distributed
-; * within development tools that are supporting such ARM based processors.
-; *
-; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
-; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
-; *
-; ******************************************************************************/
-
-
-;
-; The modules in this file are included in the libraries, and may be replaced
-; by any user-defined modules that define the PUBLIC symbol _program_start or
-; a user defined start symbol.
-; To override the cstartup defined in the library, simply add your modified
-; version to the workbench project.
-;
-; The vector table is normally located at address 0.
-; When debugging in RAM, it can be located in RAM, aligned to at least 2^6.
-; The name "__vector_table" has special meaning for C-SPY:
-; it is where the SP start value is found, and the NVIC vector
-; table register (VTOR) is initialized to this address if != 0.
-;
-; Cortex-M version
-;
-
-        MODULE  ?cstartup
-
-        ;; Forward declaration of sections.
-        SECTION CSTACK:DATA:NOROOT(3)
-
-        SECTION .intvec:CODE:NOROOT(2)
-
-        EXTERN  __iar_program_start
-        EXTERN  SystemInit
-        PUBLIC  __vector_table
-        PUBLIC  __vector_table_0x1c
-        PUBLIC  __Vectors
-        PUBLIC  __Vectors_End
-        PUBLIC  __Vectors_Size
-
-        DATA
-
-__vector_table
-        DCD     sfe(CSTACK)
-        DCD     Reset_Handler
-
-        DCD     NMI_Handler
-        DCD     HardFault_Handler
-        DCD     MemManage_Handler
-        DCD     BusFault_Handler
-        DCD     UsageFault_Handler
-__vector_table_0x1c
-        DCD     0
-        DCD     0
-        DCD     0
-        DCD     0
-        DCD     SVC_Handler
-        DCD     DebugMon_Handler
-        DCD     0
-        DCD     PendSV_Handler
-        DCD     SysTick_Handler
-
-        ; External Interrupts
-        DCD     WDT_IRQHandler            ; 16: Watchdog Timer
-        DCD     TIMER0_IRQHandler         ; 17: Timer0
-        DCD     TIMER1_IRQHandler         ; 18: Timer1
-        DCD     TIMER2_IRQHandler         ; 19: Timer2
-        DCD     TIMER3_IRQHandler         ; 20: Timer3
-        DCD     UART0_IRQHandler          ; 21: UART0
-        DCD     UART1_IRQHandler          ; 22: UART1
-        DCD     UART2_IRQHandler          ; 23: UART2
-        DCD     UART3_IRQHandler          ; 24: UART3
-        DCD     PWM1_IRQHandler           ; 25: PWM1
-        DCD     I2C0_IRQHandler           ; 26: I2C0
-        DCD     I2C1_IRQHandler           ; 27: I2C1
-        DCD     I2C2_IRQHandler           ; 28: I2C2
-        DCD     SPI_IRQHandler            ; 29: SPI
-        DCD     SSP0_IRQHandler           ; 30: SSP0
-        DCD     SSP1_IRQHandler           ; 31: SSP1
-        DCD     PLL0_IRQHandler           ; 32: PLL0 Lock (Main PLL)
-        DCD     RTC_IRQHandler            ; 33: Real Time Clock
-        DCD     EINT0_IRQHandler          ; 34: External Interrupt 0
-        DCD     EINT1_IRQHandler          ; 35: External Interrupt 1
-        DCD     EINT2_IRQHandler          ; 36: External Interrupt 2
-        DCD     EINT3_IRQHandler          ; 37: External Interrupt 3
-        DCD     ADC_IRQHandler            ; 38: A/D Converter
-        DCD     BOD_IRQHandler            ; 39: Brown-Out Detect
-        DCD     USB_IRQHandler            ; 40: USB
-        DCD     CAN_IRQHandler            ; 41: CAN
-        DCD     DMA_IRQHandler            ; 42: General Purpose DMA
-        DCD     I2S_IRQHandler            ; 43: I2S
-        DCD     ENET_IRQHandler           ; 44: Ethernet
-        DCD     RIT_IRQHandler            ; 45: Repetitive Interrupt Timer
-        DCD     MCPWM_IRQHandler          ; 46: Motor Control PWM
-        DCD     QEI_IRQHandler            ; 47: Quadrature Encoder Interface
-        DCD     PLL1_IRQHandler           ; 48: PLL1 Lock (USB PLL)
-        DCD			USBActivity_IRQHandler	  ; 49: USB Activity Interrupt
-        DCD			CANActivity_IRQHandler	  ; 50: CAN Activity Interrupt
-__Vectors_End
-
-__Vectors       EQU   __vector_table
-__Vectors_Size 	EQU 	__Vectors_End - __Vectors
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
-;; Default interrupt handlers.
-;;
-        THUMB
-
-        PUBWEAK Reset_Handler
-        SECTION .text:CODE:REORDER(2)
-Reset_Handler
-        LDR     R0, =SystemInit
-        BLX     R0
-        LDR     R0, =__iar_program_start
-        BX      R0
-
-        PUBWEAK NMI_Handler
-        SECTION .text:CODE:REORDER(1)
-NMI_Handler
-        B NMI_Handler
-
-        PUBWEAK HardFault_Handler
-        SECTION .text:CODE:REORDER(1)
-HardFault_Handler
-        B HardFault_Handler
-
-        PUBWEAK MemManage_Handler
-        SECTION .text:CODE:REORDER(1)
-MemManage_Handler
-        B MemManage_Handler
-
-        PUBWEAK BusFault_Handler
-        SECTION .text:CODE:REORDER(1)
-BusFault_Handler
-        B BusFault_Handler
-
-        PUBWEAK UsageFault_Handler
-        SECTION .text:CODE:REORDER(1)
-UsageFault_Handler
-        B UsageFault_Handler
-
-        PUBWEAK SVC_Handler
-        SECTION .text:CODE:REORDER(1)
-SVC_Handler
-        B SVC_Handler
-
-        PUBWEAK DebugMon_Handler
-        SECTION .text:CODE:REORDER(1)
-DebugMon_Handler
-        B DebugMon_Handler
-
-        PUBWEAK PendSV_Handler
-        SECTION .text:CODE:REORDER(1)
-PendSV_Handler
-        B PendSV_Handler
-
-        PUBWEAK SysTick_Handler
-        SECTION .text:CODE:REORDER(1)
-SysTick_Handler
-        B SysTick_Handler
-
-        PUBWEAK WDT_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-WDT_IRQHandler
-        B WDT_IRQHandler
-
-        PUBWEAK TIMER0_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-TIMER0_IRQHandler
-        B TIMER0_IRQHandler
-
-        PUBWEAK TIMER1_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-TIMER1_IRQHandler
-        B TIMER1_IRQHandler
-
-        PUBWEAK TIMER2_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-TIMER2_IRQHandler
-        B TIMER2_IRQHandler
-
-        PUBWEAK TIMER3_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-TIMER3_IRQHandler
-        B TIMER3_IRQHandler
-
-        PUBWEAK UART0_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-UART0_IRQHandler
-        B UART0_IRQHandler
-
-        PUBWEAK UART1_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-UART1_IRQHandler
-        B UART1_IRQHandler
-
-        PUBWEAK UART2_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-UART2_IRQHandler
-        B UART2_IRQHandler
-
-        PUBWEAK UART3_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-UART3_IRQHandler
-        B UART3_IRQHandler
-
-        PUBWEAK PWM1_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-PWM1_IRQHandler
-        B PWM1_IRQHandler
-
-        PUBWEAK I2C0_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-I2C0_IRQHandler
-        B I2C0_IRQHandler
-
-        PUBWEAK I2C1_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-I2C1_IRQHandler
-        B I2C1_IRQHandler
-
-        PUBWEAK I2C2_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-I2C2_IRQHandler
-        B I2C2_IRQHandler
-
-        PUBWEAK SPI_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-SPI_IRQHandler
-        B SPI_IRQHandler
-
-        PUBWEAK SSP0_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-SSP0_IRQHandler
-        B SSP0_IRQHandler
-
-        PUBWEAK SSP1_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-SSP1_IRQHandler
-        B SSP1_IRQHandler
-
-        PUBWEAK PLL0_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-PLL0_IRQHandler
-        B PLL0_IRQHandler
-
-        PUBWEAK RTC_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-RTC_IRQHandler
-        B RTC_IRQHandler
-
-        PUBWEAK EINT0_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-EINT0_IRQHandler
-        B EINT0_IRQHandler
-
-        PUBWEAK EINT1_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-EINT1_IRQHandler
-        B EINT1_IRQHandler
-
-        PUBWEAK EINT2_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-EINT2_IRQHandler
-        B EINT2_IRQHandler
-
-        PUBWEAK EINT3_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-EINT3_IRQHandler
-        B EINT3_IRQHandler
-
-        PUBWEAK ADC_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-ADC_IRQHandler
-        B ADC_IRQHandler
-
-        PUBWEAK BOD_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-BOD_IRQHandler
-        B BOD_IRQHandler
-
-        PUBWEAK USB_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-USB_IRQHandler
-        B USB_IRQHandler
-
-        PUBWEAK CAN_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-CAN_IRQHandler
-        B CAN_IRQHandler
-
-        PUBWEAK DMA_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-DMA_IRQHandler
-        B DMA_IRQHandler
-
-        PUBWEAK I2S_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-I2S_IRQHandler
-        B I2S_IRQHandler
-
-        PUBWEAK ENET_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-ENET_IRQHandler
-        B ENET_IRQHandler
-
-        PUBWEAK RIT_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-RIT_IRQHandler
-        B RIT_IRQHandler
-
-        PUBWEAK MCPWM_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-MCPWM_IRQHandler
-        B MCPWM_IRQHandler
-
-        PUBWEAK QEI_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-QEI_IRQHandler
-        B QEI_IRQHandler
-
-        PUBWEAK PLL1_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-PLL1_IRQHandler
-        B PLL1_IRQHandler
-
-        PUBWEAK USBActivity_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-USBActivity_IRQHandler
-        B USBActivity_IRQHandler
-
-        PUBWEAK CANActivity_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-CANActivity_IRQHandler
-        B CANActivity_IRQHandler
-
-#ifndef SRAM
-        SECTION .crp:CODE:ROOT(2)
-        DATA
-/* Code Read Protection
-CRP1    0x12345678 - Write to RAM command can not access RAM below 0x10000200.
-                   - Read Memory command: disabled.
-                   - Copy RAM to Flash command: cannot write to Sector 0.
-                   - "Go" command: disabled.
-                   - Erase sector(s) command: can erase any individual sector except 
-                   	 sector 0 only, or can erase all sectors at once.
-                   - Compare command: disabled
-CRP2    0x87654321 - Write to RAM command: disabled.
-                   - Copy RAM to Flash: disabled.
-                   - Erase command: only allows erase of all sectors.
-CRP3    0x43218765 - Access to chip via the SWD pins is disabled. ISP entry
-                     by pulling PIO0_1 LOW is disabled if a valid user code is
-                     present in flash sector 0.
-Caution: If CRP3 is selected, no future factory testing can be
-performed on the device.
-*/
-	DCD	0xFFFFFFFF
-#endif
-        END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC176X/cmsis.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-/* mbed Microcontroller Library - CMSIS
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * A generic CMSIS include header, pulling in LPC1768 specifics
- */
-
-#ifndef MBED_CMSIS_H
-#define MBED_CMSIS_H
-
-#include "LPC17xx.h"
-#include "cmsis_nvic.h"
-
-#endif
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC176X/cmsis_nvic.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic for LCP1768
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */ 
-#include "cmsis_nvic.h"
-
-#define NVIC_RAM_VECTOR_ADDRESS   (0x10000000)  // Location of vectors in RAM
-#define NVIC_FLASH_VECTOR_ADDRESS (0x0)       // Initial vector position in flash
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
-    uint32_t *vectors = (uint32_t*)SCB->VTOR;
-    uint32_t i;
-
-    // Copy and switch to dynamic vectors if the first time called
-    if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
-        uint32_t *old_vectors = vectors;
-        vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
-        for (i=0; i<NVIC_NUM_VECTORS; i++) {
-            vectors[i] = old_vectors[i];
-        }
-        SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
-    }
-    vectors[IRQn + NVIC_USER_IRQ_OFFSET] = vector;
-}
-
-uint32_t NVIC_GetVector(IRQn_Type IRQn) {
-    uint32_t *vectors = (uint32_t*)SCB->VTOR;
-    return vectors[IRQn + NVIC_USER_IRQ_OFFSET];
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC176X/cmsis_nvic.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */ 
-
-#ifndef MBED_CMSIS_NVIC_H
-#define MBED_CMSIS_NVIC_H
-
-#include "cmsis.h"
-
-#define NVIC_NUM_VECTORS      (16 + 33)
-#define NVIC_USER_IRQ_OFFSET  16
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
-uint32_t NVIC_GetVector(IRQn_Type IRQn);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC176X/system_LPC17xx.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,584 +0,0 @@
-/**************************************************************************//**
- * @file     system_LPC17xx.c
- * @brief    CMSIS Cortex-M3 Device System Source File for
- *           NXP LPC17xx Device Series
- * @version  V1.11
- * @date     21. June 2011
- *
- * @note
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- *
- * @par
- * ARM Limited (ARM) is supplying this software for use with Cortex-M
- * processor based microcontrollers.  This file can be freely distributed
- * within development tools that are supporting such ARM based processors.
- *
- * @par
- * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- *
- ******************************************************************************/
-
-
-#include <stdint.h>
-#include "LPC17xx.h"
-
-
-/** @addtogroup LPC17xx_System
- * @{
- */
-
-/*
-//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-*/
-
-/*--------------------- Clock Configuration ----------------------------------
-//
-// <e> Clock Configuration
-//   <h> System Controls and Status Register (SCS)
-//     <o1.4>    OSCRANGE: Main Oscillator Range Select
-//                     <0=>  1 MHz to 20 MHz
-//                     <1=> 15 MHz to 25 MHz
-//     <e1.5>       OSCEN: Main Oscillator Enable
-//     </e>
-//   </h>
-//
-//   <h> Clock Source Select Register (CLKSRCSEL)
-//     <o2.0..1>   CLKSRC: PLL Clock Source Selection
-//                     <0=> Internal RC oscillator
-//                     <1=> Main oscillator
-//                     <2=> RTC oscillator
-//   </h>
-//
-//   <e3> PLL0 Configuration (Main PLL)
-//     <h> PLL0 Configuration Register (PLL0CFG)
-//                     <i> F_cco0 = (2 * M * F_in) / N
-//                     <i> F_in must be in the range of 32 kHz to 50 MHz
-//                     <i> F_cco0 must be in the range of 275 MHz to 550 MHz
-//       <o4.0..14>  MSEL: PLL Multiplier Selection
-//                     <6-32768><#-1>
-//                     <i> M Value
-//       <o4.16..23> NSEL: PLL Divider Selection
-//                     <1-256><#-1>
-//                     <i> N Value
-//     </h>
-//   </e>
-//
-//   <e5> PLL1 Configuration (USB PLL)
-//     <h> PLL1 Configuration Register (PLL1CFG)
-//                     <i> F_usb = M * F_osc or F_usb = F_cco1 / (2 * P)
-//                     <i> F_cco1 = F_osc * M * 2 * P
-//                     <i> F_cco1 must be in the range of 156 MHz to 320 MHz
-//       <o6.0..4>   MSEL: PLL Multiplier Selection
-//                     <1-32><#-1>
-//                     <i> M Value (for USB maximum value is 4)
-//       <o6.5..6>   PSEL: PLL Divider Selection
-//                     <0=> 1
-//                     <1=> 2
-//                     <2=> 4
-//                     <3=> 8
-//                     <i> P Value
-//     </h>
-//   </e>
-//
-//   <h> CPU Clock Configuration Register (CCLKCFG)
-//     <o7.0..7>  CCLKSEL: Divide Value for CPU Clock from PLL0
-//                     <1-256><#-1>
-//   </h>
-//
-//   <h> USB Clock Configuration Register (USBCLKCFG)
-//     <o8.0..3>   USBSEL: Divide Value for USB Clock from PLL0
-//                     <0-15>
-//                     <i> Divide is USBSEL + 1
-//   </h>
-//
-//   <h> Peripheral Clock Selection Register 0 (PCLKSEL0)
-//     <o9.0..1>    PCLK_WDT: Peripheral Clock Selection for WDT
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o9.2..3>    PCLK_TIMER0: Peripheral Clock Selection for TIMER0
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o9.4..5>    PCLK_TIMER1: Peripheral Clock Selection for TIMER1
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o9.6..7>    PCLK_UART0: Peripheral Clock Selection for UART0
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o9.8..9>    PCLK_UART1: Peripheral Clock Selection for UART1
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o9.12..13>  PCLK_PWM1: Peripheral Clock Selection for PWM1
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o9.14..15>  PCLK_I2C0: Peripheral Clock Selection for I2C0
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o9.16..17>  PCLK_SPI: Peripheral Clock Selection for SPI
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o9.20..21>  PCLK_SSP1: Peripheral Clock Selection for SSP1
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o9.22..23>  PCLK_DAC: Peripheral Clock Selection for DAC
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o9.24..25>  PCLK_ADC: Peripheral Clock Selection for ADC
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o9.26..27>  PCLK_CAN1: Peripheral Clock Selection for CAN1
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 6
-//     <o9.28..29>  PCLK_CAN2: Peripheral Clock Selection for CAN2
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 6
-//     <o9.30..31>  PCLK_ACF: Peripheral Clock Selection for ACF
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 6
-//   </h>
-//
-//   <h> Peripheral Clock Selection Register 1 (PCLKSEL1)
-//     <o10.0..1>   PCLK_QEI: Peripheral Clock Selection for the Quadrature Encoder Interface
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o10.2..3>   PCLK_GPIO: Peripheral Clock Selection for GPIOs
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o10.4..5>   PCLK_PCB: Peripheral Clock Selection for the Pin Connect Block
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o10.6..7>   PCLK_I2C1: Peripheral Clock Selection for I2C1
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o10.10..11> PCLK_SSP0: Peripheral Clock Selection for SSP0
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o10.12..13> PCLK_TIMER2: Peripheral Clock Selection for TIMER2
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o10.14..15> PCLK_TIMER3: Peripheral Clock Selection for TIMER3
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o10.16..17> PCLK_UART2: Peripheral Clock Selection for UART2
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o10.18..19> PCLK_UART3: Peripheral Clock Selection for UART3
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o10.20..21> PCLK_I2C2: Peripheral Clock Selection for I2C2
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o10.22..23> PCLK_I2S: Peripheral Clock Selection for I2S
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o10.26..27> PCLK_RIT: Peripheral Clock Selection for the Repetitive Interrupt Timer
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o10.28..29> PCLK_SYSCON: Peripheral Clock Selection for the System Control Block
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//     <o10.30..31> PCLK_MC: Peripheral Clock Selection for the Motor Control PWM
-//                     <0=> Pclk = Cclk / 4
-//                     <1=> Pclk = Cclk
-//                     <2=> Pclk = Cclk / 2
-//                     <3=> Pclk = Hclk / 8
-//   </h>
-//
-//   <h> Power Control for Peripherals Register (PCONP)
-//     <o11.1>      PCTIM0: Timer/Counter 0 power/clock enable
-//     <o11.2>      PCTIM1: Timer/Counter 1 power/clock enable
-//     <o11.3>      PCUART0: UART 0 power/clock enable
-//     <o11.4>      PCUART1: UART 1 power/clock enable
-//     <o11.6>      PCPWM1: PWM 1 power/clock enable
-//     <o11.7>      PCI2C0: I2C interface 0 power/clock enable
-//     <o11.8>      PCSPI: SPI interface power/clock enable
-//     <o11.9>      PCRTC: RTC power/clock enable
-//     <o11.10>     PCSSP1: SSP interface 1 power/clock enable
-//     <o11.12>     PCAD: A/D converter power/clock enable
-//     <o11.13>     PCCAN1: CAN controller 1 power/clock enable
-//     <o11.14>     PCCAN2: CAN controller 2 power/clock enable
-//     <o11.15>     PCGPIO: GPIOs power/clock enable
-//     <o11.16>     PCRIT: Repetitive interrupt timer power/clock enable
-//     <o11.17>     PCMC: Motor control PWM power/clock enable
-//     <o11.18>     PCQEI: Quadrature encoder interface power/clock enable
-//     <o11.19>     PCI2C1: I2C interface 1 power/clock enable
-//     <o11.21>     PCSSP0: SSP interface 0 power/clock enable
-//     <o11.22>     PCTIM2: Timer 2 power/clock enable
-//     <o11.23>     PCTIM3: Timer 3 power/clock enable
-//     <o11.24>     PCUART2: UART 2 power/clock enable
-//     <o11.25>     PCUART3: UART 3 power/clock enable
-//     <o11.26>     PCI2C2: I2C interface 2 power/clock enable
-//     <o11.27>     PCI2S: I2S interface power/clock enable
-//     <o11.29>     PCGPDMA: GP DMA function power/clock enable
-//     <o11.30>     PCENET: Ethernet block power/clock enable
-//     <o11.31>     PCUSB: USB interface power/clock enable
-//   </h>
-//
-//   <h> Clock Output Configuration Register (CLKOUTCFG)
-//     <o12.0..3>   CLKOUTSEL: Selects clock source for CLKOUT
-//                     <0=> CPU clock
-//                     <1=> Main oscillator
-//                     <2=> Internal RC oscillator
-//                     <3=> USB clock
-//                     <4=> RTC oscillator
-//     <o12.4..7>   CLKOUTDIV: Selects clock divider for CLKOUT
-//                     <1-16><#-1>
-//     <o12.8>      CLKOUT_EN: CLKOUT enable control
-//   </h>
-//
-// </e>
-*/
-
-
-
-/** @addtogroup LPC17xx_System_Defines  LPC17xx System Defines
-  @{
- */
-
-#define CLOCK_SETUP           1
-#define SCS_Val               0x00000020
-#define CLKSRCSEL_Val         0x00000001
-#define PLL0_SETUP            1
-
-#ifdef MCB1700
-#    define PLL0CFG_Val           0x00050063
-#    define PLL1_SETUP            1
-#    define PLL1CFG_Val           0x00000023
-#    define CCLKCFG_Val           0x00000003
-#    define USBCLKCFG_Val         0x00000000
-#else
-#    define PLL0CFG_Val           0x0000000B
-#    define PLL1_SETUP            0
-#    define PLL1CFG_Val           0x00000000
-#    define CCLKCFG_Val           0x00000002
-#    define USBCLKCFG_Val         0x00000005
-#endif
-
-#define PCLKSEL0_Val          0x00000000
-#define PCLKSEL1_Val          0x00000000
-#define PCONP_Val             0x042887DE
-#define CLKOUTCFG_Val         0x00000000
-
-
-/*--------------------- Flash Accelerator Configuration ----------------------
-//
-// <e> Flash Accelerator Configuration
-//   <o1.12..15> FLASHTIM: Flash Access Time
-//               <0=> 1 CPU clock (for CPU clock up to 20 MHz)
-//               <1=> 2 CPU clocks (for CPU clock up to 40 MHz)
-//               <2=> 3 CPU clocks (for CPU clock up to 60 MHz)
-//               <3=> 4 CPU clocks (for CPU clock up to 80 MHz)
-//               <4=> 5 CPU clocks (for CPU clock up to 100 MHz)
-//               <5=> 6 CPU clocks (for any CPU clock)
-// </e>
-*/
-#define FLASH_SETUP           1
-#define FLASHCFG_Val          0x0000303A
-
-/*
-//-------- <<< end of configuration section >>> ------------------------------
-*/
-
-/*----------------------------------------------------------------------------
-  Check the register settings
- *----------------------------------------------------------------------------*/
-#define CHECK_RANGE(val, min, max)                ((val < min) || (val > max))
-#define CHECK_RSVD(val, mask)                     (val & mask)
-
-/* Clock Configuration -------------------------------------------------------*/
-#if (CHECK_RSVD((SCS_Val),       ~0x00000030))
-   #error "SCS: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RANGE((CLKSRCSEL_Val), 0, 2))
-   #error "CLKSRCSEL: Value out of range!"
-#endif
-
-#if (CHECK_RSVD((PLL0CFG_Val),   ~0x00FF7FFF))
-   #error "PLL0CFG: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((PLL1CFG_Val),   ~0x0000007F))
-   #error "PLL1CFG: Invalid values of reserved bits!"
-#endif
-
-#if (PLL0_SETUP)            /* if PLL0 is used */
-  #if (CCLKCFG_Val < 2)     /* CCLKSEL must be greater then 1 */
-    #error "CCLKCFG: CCLKSEL must be greater then 1 if PLL0 is used!"
-  #endif
-#endif
-
-#if (CHECK_RANGE((CCLKCFG_Val), 2, 255))
-   #error "CCLKCFG: Value out of range!"
-#endif
-
-#if (CHECK_RSVD((USBCLKCFG_Val), ~0x0000000F))
-   #error "USBCLKCFG: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((PCLKSEL0_Val),   0x000C0C00))
-   #error "PCLKSEL0: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((PCLKSEL1_Val),   0x03000300))
-   #error "PCLKSEL1: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((PCONP_Val),      0x10100821))
-   #error "PCONP: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((CLKOUTCFG_Val), ~0x000001FF))
-   #error "CLKOUTCFG: Invalid values of reserved bits!"
-#endif
-
-/* Flash Accelerator Configuration -------------------------------------------*/
-#if (CHECK_RSVD((FLASHCFG_Val), ~0x0000F07F))
-   #error "FLASHCFG: Invalid values of reserved bits!"
-#endif
-
-
-/*----------------------------------------------------------------------------
-  DEFINES
- *----------------------------------------------------------------------------*/
-
-/*----------------------------------------------------------------------------
-  Define clocks
- *----------------------------------------------------------------------------*/
-#define XTAL        (12000000UL)        /* Oscillator frequency               */
-#define OSC_CLK     (      XTAL)        /* Main oscillator frequency          */
-#define RTC_CLK     (   32000UL)        /* RTC oscillator frequency           */
-#define IRC_OSC     ( 4000000UL)        /* Internal RC oscillator frequency   */
-
-
-/* F_cco0 = (2 * M * F_in) / N  */
-#define __M               (((PLL0CFG_Val      ) & 0x7FFF) + 1)
-#define __N               (((PLL0CFG_Val >> 16) & 0x00FF) + 1)
-#define __FCCO(__F_IN)    ((2ULL * __M * __F_IN) / __N)
-#define __CCLK_DIV        (((CCLKCFG_Val      ) & 0x00FF) + 1)
-
-/* Determine core clock frequency according to settings */
- #if (PLL0_SETUP)
-    #if   ((CLKSRCSEL_Val & 0x03) == 1)
-        #define __CORE_CLK (__FCCO(OSC_CLK) / __CCLK_DIV)
-    #elif ((CLKSRCSEL_Val & 0x03) == 2)
-        #define __CORE_CLK (__FCCO(RTC_CLK) / __CCLK_DIV)
-    #else
-        #define __CORE_CLK (__FCCO(IRC_OSC) / __CCLK_DIV)
-    #endif
- #else
-    #if   ((CLKSRCSEL_Val & 0x03) == 1)
-        #define __CORE_CLK (OSC_CLK         / __CCLK_DIV)
-    #elif ((CLKSRCSEL_Val & 0x03) == 2)
-        #define __CORE_CLK (RTC_CLK         / __CCLK_DIV)
-    #else
-        #define __CORE_CLK (IRC_OSC         / __CCLK_DIV)
-    #endif
- #endif
-
-/**
- * @}
- */
-
-
-/** @addtogroup LPC17xx_System_Public_Variables  LPC17xx System Public Variables
-  @{
- */
-/*----------------------------------------------------------------------------
-  Clock Variable definitions
- *----------------------------------------------------------------------------*/
-uint32_t SystemCoreClock = __CORE_CLK;/*!< System Clock Frequency (Core Clock)*/
-
-/**
- * @}
- */
-
-
-/** @addtogroup LPC17xx_System_Public_Functions  LPC17xx System Public Functions
-  @{
- */
-
-/**
- * Update SystemCoreClock variable
- *
- * @param  none
- * @return none
- *
- * @brief  Updates the SystemCoreClock with current core Clock
- *         retrieved from cpu registers.
- */void SystemCoreClockUpdate (void)            /* Get Core Clock Frequency      */
-{
-  /* Determine clock frequency according to clock register values             */
-  if (((LPC_SC->PLL0STAT >> 24) & 3) == 3) { /* If PLL0 enabled and connected */
-    switch (LPC_SC->CLKSRCSEL & 0x03) {
-      case 0:                                /* Int. RC oscillator => PLL0    */
-      case 3:                                /* Reserved, default to Int. RC  */
-        SystemCoreClock = (IRC_OSC *
-                          ((2ULL * ((LPC_SC->PLL0STAT & 0x7FFF) + 1)))  /
-                          (((LPC_SC->PLL0STAT >> 16) & 0xFF) + 1)       /
-                          ((LPC_SC->CCLKCFG & 0xFF)+ 1));
-        break;
-      case 1:                                /* Main oscillator => PLL0       */
-        SystemCoreClock = (OSC_CLK *
-                          ((2ULL * ((LPC_SC->PLL0STAT & 0x7FFF) + 1)))  /
-                          (((LPC_SC->PLL0STAT >> 16) & 0xFF) + 1)       /
-                          ((LPC_SC->CCLKCFG & 0xFF)+ 1));
-        break;
-      case 2:                                /* RTC oscillator => PLL0        */
-        SystemCoreClock = (RTC_CLK *
-                          ((2ULL * ((LPC_SC->PLL0STAT & 0x7FFF) + 1)))  /
-                          (((LPC_SC->PLL0STAT >> 16) & 0xFF) + 1)       /
-                          ((LPC_SC->CCLKCFG & 0xFF)+ 1));
-        break;
-    }
-  } else {
-    switch (LPC_SC->CLKSRCSEL & 0x03) {
-      case 0:                                /* Int. RC oscillator => PLL0    */
-      case 3:                                /* Reserved, default to Int. RC  */
-        SystemCoreClock = IRC_OSC / ((LPC_SC->CCLKCFG & 0xFF)+ 1);
-        break;
-      case 1:                                /* Main oscillator => PLL0       */
-        SystemCoreClock = OSC_CLK / ((LPC_SC->CCLKCFG & 0xFF)+ 1);
-        break;
-      case 2:                                /* RTC oscillator => PLL0        */
-        SystemCoreClock = RTC_CLK / ((LPC_SC->CCLKCFG & 0xFF)+ 1);
-        break;
-    }
-  }
-
-}
-
-/**
- * Initialize the system
- *
- * @param  none
- * @return none
- *
- * @brief  Setup the microcontroller system.
- *         Initialize the System.
- */
-void SystemInit (void)
-{
-#if (CLOCK_SETUP)                       /* Clock Setup                        */
-  LPC_SC->SCS       = SCS_Val;
-  if (LPC_SC->SCS & (1 << 5)) {             /* If Main Oscillator is enabled  */
-    while ((LPC_SC->SCS & (1<<6)) == 0);/* Wait for Oscillator to be ready    */
-  }
-
-  LPC_SC->CCLKCFG   = CCLKCFG_Val;      /* Setup Clock Divider                */
-  /* Periphral clock must be selected before PLL0 enabling and connecting
-   * - according errata.lpc1768-16.March.2010 -
-   */
-  LPC_SC->PCLKSEL0  = PCLKSEL0_Val;     /* Peripheral Clock Selection         */
-  LPC_SC->PCLKSEL1  = PCLKSEL1_Val;
-
-#if (PLL0_SETUP)
-  LPC_SC->CLKSRCSEL = CLKSRCSEL_Val;    /* Select Clock Source for PLL0       */
-
-  LPC_SC->PLL0CFG   = PLL0CFG_Val;      /* configure PLL0                     */
-  LPC_SC->PLL0FEED  = 0xAA;
-  LPC_SC->PLL0FEED  = 0x55;
-
-  LPC_SC->PLL0CON   = 0x01;             /* PLL0 Enable                        */
-  LPC_SC->PLL0FEED  = 0xAA;
-  LPC_SC->PLL0FEED  = 0x55;
-  while (!(LPC_SC->PLL0STAT & (1<<26)));/* Wait for PLOCK0                    */
-
-  LPC_SC->PLL0CON   = 0x03;             /* PLL0 Enable & Connect              */
-  LPC_SC->PLL0FEED  = 0xAA;
-  LPC_SC->PLL0FEED  = 0x55;
-  while (!(LPC_SC->PLL0STAT & ((1<<25) | (1<<24))));/* Wait for PLLC0_STAT & PLLE0_STAT */
-#endif
-
-#if (PLL1_SETUP)
-  LPC_SC->PLL1CFG   = PLL1CFG_Val;
-  LPC_SC->PLL1FEED  = 0xAA;
-  LPC_SC->PLL1FEED  = 0x55;
-
-  LPC_SC->PLL1CON   = 0x01;             /* PLL1 Enable                        */
-  LPC_SC->PLL1FEED  = 0xAA;
-  LPC_SC->PLL1FEED  = 0x55;
-  while (!(LPC_SC->PLL1STAT & (1<<10)));/* Wait for PLOCK1                    */
-
-  LPC_SC->PLL1CON   = 0x03;             /* PLL1 Enable & Connect              */
-  LPC_SC->PLL1FEED  = 0xAA;
-  LPC_SC->PLL1FEED  = 0x55;
-  while (!(LPC_SC->PLL1STAT & ((1<< 9) | (1<< 8))));/* Wait for PLLC1_STAT & PLLE1_STAT */
-#else
-  LPC_SC->USBCLKCFG = USBCLKCFG_Val;    /* Setup USB Clock Divider            */
-#endif
-
-  LPC_SC->PCONP     = PCONP_Val;        /* Power Control for Peripherals      */
-
-  LPC_SC->CLKOUTCFG = CLKOUTCFG_Val;    /* Clock Output Configuration         */
-#endif
-
-#if (FLASH_SETUP == 1)                  /* Flash Accelerator Setup            */
-  LPC_SC->FLASHCFG  = (LPC_SC->FLASHCFG & ~0x0000F000) | FLASHCFG_Val;
-#endif
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC176X/system_LPC17xx.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/******************************************************************************
- * @file:    system_LPC17xx.h
- * @purpose: CMSIS Cortex-M3 Device Peripheral Access Layer Header File
- *           for the NXP LPC17xx Device Series 
- * @version: V1.02
- * @date:    27. July 2009
- *----------------------------------------------------------------------------
- *
- * Copyright (C) 2009 ARM Limited. All rights reserved.
- *
- * ARM Limited (ARM) is supplying this software for use with Cortex-M3 
- * processor based microcontrollers.  This file can be freely distributed 
- * within development tools that are supporting such ARM based processors. 
- *
- * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- *
- ******************************************************************************/
-
-
-#ifndef __SYSTEM_LPC17xx_H
-#define __SYSTEM_LPC17xx_H
-
-#ifdef __cplusplus
- extern "C" {
-#endif 
-
-extern uint32_t SystemCoreClock;     /*!< System Clock Frequency (Core Clock)  */
-
-
-/**
- * Initialize the system
- *
- * @param  none
- * @return none
- *
- * @brief  Setup the microcontroller system.
- *         Initialize the System and update the SystemCoreClock variable.
- */
-extern void SystemInit (void);
-
-/**
- * Update SystemCoreClock variable
- *
- * @param  none
- * @return none
- *
- * @brief  Updates the SystemCoreClock with current core Clock 
- *         retrieved from cpu registers.
- */
-extern void SystemCoreClockUpdate (void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __SYSTEM_LPC17xx_H */
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/LPC23xx.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,864 +0,0 @@
-/* mbed Microcontroller Library - LPC23xx CMSIS-like structs
- * Copyright (C) 2009 ARM Limited. All rights reserved.
- * 
- * An LPC23xx header file, based on the CMSIS LPC17xx.h and old LPC23xx.h
- */
-
-#ifndef __LPC23xx_H
-#define __LPC23xx_H
-
-#ifdef __cplusplus
- extern "C" {
-#endif 
-
-/*
- * ==========================================================================
- * ---------- Interrupt Number Definition -----------------------------------
- * ==========================================================================
- */
-
-typedef enum IRQn
-{
-/******  LPC23xx Specific Interrupt Numbers *******************************************************/
-  WDT_IRQn                      = 0,        /*!< Watchdog Timer Interrupt                         */
-
-  TIMER0_IRQn                   = 4,        /*!< Timer0 Interrupt                                 */
-  TIMER1_IRQn                   = 5,        /*!< Timer1 Interrupt                                 */
-  UART0_IRQn                    = 6,        /*!< UART0 Interrupt                                  */
-  UART1_IRQn                    = 7,        /*!< UART1 Interrupt                                  */
-  PWM1_IRQn                     = 8,        /*!< PWM1 Interrupt                                   */
-  I2C0_IRQn                     = 9,        /*!< I2C0 Interrupt                                   */
-  SPI_IRQn                      = 10,       /*!< SPI Interrupt                                    */
-  SSP0_IRQn                     = 10,       /*!< SSP0 Interrupt                                   */
-  SSP1_IRQn                     = 11,       /*!< SSP1 Interrupt                                   */
-  PLL0_IRQn                     = 12,       /*!< PLL0 Lock (Main PLL) Interrupt                   */
-  RTC_IRQn                      = 13,       /*!< Real Time Clock Interrupt                        */
-  EINT0_IRQn                    = 14,       /*!< External Interrupt 0 Interrupt                   */
-  EINT1_IRQn                    = 15,       /*!< External Interrupt 1 Interrupt                   */
-  EINT2_IRQn                    = 16,       /*!< External Interrupt 2 Interrupt                   */
-  EINT3_IRQn                    = 17,       /*!< External Interrupt 3 Interrupt                   */
-  ADC_IRQn                      = 18,       /*!< A/D Converter Interrupt                          */
-  I2C1_IRQn                     = 19,       /*!< I2C1 Interrupt                                   */
-  BOD_IRQn                      = 20,       /*!< Brown-Out Detect Interrupt                       */
-  ENET_IRQn                     = 21,       /*!< Ethernet Interrupt                               */
-  USB_IRQn                      = 22,       /*!< USB Interrupt                                    */
-  CAN_IRQn                      = 23,       /*!< CAN Interrupt                                    */
-  MIC_IRQn                      = 24,       /*!< Multimedia Interface Controler                   */
-  DMA_IRQn                      = 25,       /*!< General Purpose DMA Interrupt                    */
-  TIMER2_IRQn                   = 26,       /*!< Timer2 Interrupt                                 */
-  TIMER3_IRQn                   = 27,       /*!< Timer3 Interrupt                                 */
-  UART2_IRQn                    = 28,       /*!< UART2 Interrupt                                  */
-  UART3_IRQn                    = 29,       /*!< UART3 Interrupt                                  */
-  I2C2_IRQn                     = 30,       /*!< I2C2 Interrupt                                   */
-  I2S_IRQn                      = 31,       /*!< I2S Interrupt                                    */
-} IRQn_Type;
-
-/*
- * ==========================================================================
- * ----------- Processor and Core Peripheral Section ------------------------
- * ==========================================================================
- */
-
-/* Configuration of the ARM7 Processor and Core Peripherals */
-#define __MPU_PRESENT             0         /*!< MPU present or not                               */
-#define __NVIC_PRIO_BITS          4         /*!< Number of Bits used for Priority Levels          */
-#define __Vendor_SysTickConfig    0         /*!< Set to 1 if different SysTick Config is used     */
-
-
-#include <core_arm7.h>
-#include "system_LPC23xx.h"                 /* System Header                                      */
-
-
-/******************************************************************************/
-/*                Device Specific Peripheral registers structures             */
-/******************************************************************************/
-#if defined ( __CC_ARM   )
-  #pragma anon_unions
-#endif
-
-/*------------- Vector Interupt Controler (VIC) ------------------------------*/
-typedef struct
-{
-  __I  uint32_t IRQStatus;
-  __I  uint32_t FIQStatus;
-  __I  uint32_t RawIntr;
-  __IO uint32_t IntSelect;
-  __IO uint32_t IntEnable;
-  __O  uint32_t IntEnClr;
-  __IO uint32_t SoftInt;
-  __O  uint32_t SoftIntClr;
-  __IO uint32_t Protection;
-  __IO uint32_t SWPriorityMask;
-  __IO uint32_t RESERVED0[54];
-  __IO uint32_t VectAddr[32];
-  __IO uint32_t RESERVED1[32];
-  __IO uint32_t VectPriority[32];
-  __IO uint32_t RESERVED2[800];
-  __IO uint32_t Address;
-} LPC_VIC_TypeDef;
-
-/*------------- System Control (SC) ------------------------------------------*/
-typedef struct
-{
-  __IO uint32_t MAMCR;
-  __IO uint32_t MAMTIM;
-       uint32_t RESERVED0[14];
-  __IO uint32_t MEMMAP;
-       uint32_t RESERVED1[15];
-  __IO uint32_t PLL0CON;                /* Clocking and Power Control         */
-  __IO uint32_t PLL0CFG;
-  __I  uint32_t PLL0STAT;
-  __O  uint32_t PLL0FEED;
-       uint32_t RESERVED2[12];
-  __IO uint32_t PCON;
-  __IO uint32_t PCONP;
-       uint32_t RESERVED3[15];
-  __IO uint32_t CCLKCFG;
-  __IO uint32_t USBCLKCFG;
-  __IO uint32_t CLKSRCSEL;
-       uint32_t RESERVED4[12];
-  __IO uint32_t EXTINT;                 /* External Interrupts                */
-  __IO uint32_t INTWAKE;
-  __IO uint32_t EXTMODE;
-  __IO uint32_t EXTPOLAR;
-       uint32_t RESERVED6[12];
-  __IO uint32_t RSID;                   /* Reset                              */
-  __IO uint32_t CSPR;
-  __IO uint32_t AHBCFG1;
-  __IO uint32_t AHBCFG2;
-       uint32_t RESERVED7[4];
-  __IO uint32_t SCS;                    /* Syscon Miscellaneous Registers     */
-  __IO uint32_t IRCTRIM;                /* Clock Dividers                     */
-  __IO uint32_t PCLKSEL0;
-  __IO uint32_t PCLKSEL1;
-       uint32_t RESERVED8[4];
-  __IO uint32_t USBIntSt;               /* USB Device/OTG Interrupt Register  */
-       uint32_t RESERVED9;
-//  __IO uint32_t CLKOUTCFG;              /* Clock Output Configuration         */
- } LPC_SC_TypeDef;
-
-/*------------- Pin Connect Block (PINCON) -----------------------------------*/
-typedef struct
-{
-  __IO uint32_t PINSEL0;
-  __IO uint32_t PINSEL1;
-  __IO uint32_t PINSEL2;
-  __IO uint32_t PINSEL3;
-  __IO uint32_t PINSEL4;
-  __IO uint32_t PINSEL5;
-  __IO uint32_t PINSEL6;
-  __IO uint32_t PINSEL7;
-  __IO uint32_t PINSEL8;
-  __IO uint32_t PINSEL9;
-  __IO uint32_t PINSEL10;
-       uint32_t RESERVED0[5];
-  __IO uint32_t PINMODE0;
-  __IO uint32_t PINMODE1;
-  __IO uint32_t PINMODE2;
-  __IO uint32_t PINMODE3;
-  __IO uint32_t PINMODE4;
-  __IO uint32_t PINMODE5;
-  __IO uint32_t PINMODE6;
-  __IO uint32_t PINMODE7;
-  __IO uint32_t PINMODE8;
-  __IO uint32_t PINMODE9;
-  __IO uint32_t PINMODE_OD0;
-  __IO uint32_t PINMODE_OD1;
-  __IO uint32_t PINMODE_OD2;
-  __IO uint32_t PINMODE_OD3;
-  __IO uint32_t PINMODE_OD4;
-} LPC_PINCON_TypeDef;
-
-/*------------- General Purpose Input/Output (GPIO) --------------------------*/
-typedef struct
-{
-  __IO uint32_t FIODIR;
-       uint32_t RESERVED0[3];
-  __IO uint32_t FIOMASK;
-  __IO uint32_t FIOPIN;
-  __IO uint32_t FIOSET;
-  __O  uint32_t FIOCLR;
-} LPC_GPIO_TypeDef;
-
-typedef struct
-{
-  __I  uint32_t IntStatus;
-  __I  uint32_t IO0IntStatR;
-  __I  uint32_t IO0IntStatF;
-  __O  uint32_t IO0IntClr;
-  __IO uint32_t IO0IntEnR;
-  __IO uint32_t IO0IntEnF;
-       uint32_t RESERVED0[3];
-  __I  uint32_t IO2IntStatR;
-  __I  uint32_t IO2IntStatF;
-  __O  uint32_t IO2IntClr;
-  __IO uint32_t IO2IntEnR;
-  __IO uint32_t IO2IntEnF;
-} LPC_GPIOINT_TypeDef;
-
-/*------------- Timer (TIM) --------------------------------------------------*/
-typedef struct
-{
-  __IO uint32_t IR;
-  __IO uint32_t TCR;
-  __IO uint32_t TC;
-  __IO uint32_t PR;
-  __IO uint32_t PC;
-  __IO uint32_t MCR;
-  __IO uint32_t MR0;
-  __IO uint32_t MR1;
-  __IO uint32_t MR2;
-  __IO uint32_t MR3;
-  __IO uint32_t CCR;
-  __I  uint32_t CR0;
-  __I  uint32_t CR1;
-       uint32_t RESERVED0[2];
-  __IO uint32_t EMR;
-       uint32_t RESERVED1[12];
-  __IO uint32_t CTCR;
-} LPC_TIM_TypeDef;
-
-/*------------- Pulse-Width Modulation (PWM) ---------------------------------*/
-typedef struct
-{
-  __IO uint32_t IR;
-  __IO uint32_t TCR;
-  __IO uint32_t TC;
-  __IO uint32_t PR;
-  __IO uint32_t PC;
-  __IO uint32_t MCR;
-  __IO uint32_t MR0;
-  __IO uint32_t MR1;
-  __IO uint32_t MR2;
-  __IO uint32_t MR3;
-  __IO uint32_t CCR;
-  __I  uint32_t CR0;
-  __I  uint32_t CR1;
-  __I  uint32_t CR2;
-  __I  uint32_t CR3;
-       uint32_t RESERVED0;
-  __IO uint32_t MR4;
-  __IO uint32_t MR5;
-  __IO uint32_t MR6;
-  __IO uint32_t PCR;
-  __IO uint32_t LER;
-       uint32_t RESERVED1[7];
-  __IO uint32_t CTCR;
-} LPC_PWM_TypeDef;
-
-/*------------- Universal Asynchronous Receiver Transmitter (UART) -----------*/
-typedef struct
-{
-  union {
-  __I  uint8_t  RBR;
-  __O  uint8_t  THR;
-  __IO uint8_t  DLL;
-       uint32_t RESERVED0;
-  };
-  union {
-  __IO uint8_t  DLM;
-  __IO uint32_t IER;
-  };
-  union {
-  __I  uint32_t IIR;
-  __O  uint8_t  FCR;
-  };
-  __IO uint8_t  LCR;
-       uint8_t  RESERVED1[7];
-  __IO uint8_t  LSR;
-       uint8_t  RESERVED2[7];
-  __IO uint8_t  SCR;
-       uint8_t  RESERVED3[3];
-  __IO uint32_t ACR;
-  __IO uint8_t  ICR;
-       uint8_t  RESERVED4[3];
-  __IO uint8_t  FDR;
-       uint8_t  RESERVED5[7];
-  __IO uint8_t  TER;
-       uint8_t  RESERVED6[27];
-  __IO uint8_t  RS485CTRL;
-       uint8_t  RESERVED7[3];
-  __IO uint8_t  ADRMATCH;
-} LPC_UART_TypeDef;
-
-typedef struct
-{
-  union {
-  __I  uint8_t  RBR;
-  __O  uint8_t  THR;
-  __IO uint8_t  DLL;
-       uint32_t RESERVED0;
-  };
-  union {
-  __IO uint8_t  DLM;
-  __IO uint32_t IER;
-  };
-  union {
-  __I  uint32_t IIR;
-  __O  uint8_t  FCR;
-  };
-  __IO uint8_t  LCR;
-       uint8_t  RESERVED1[3];
-  __IO uint8_t  MCR;
-       uint8_t  RESERVED2[3];
-  __IO uint8_t  LSR;
-       uint8_t  RESERVED3[3];
-  __IO uint8_t  MSR;
-       uint8_t  RESERVED4[3];
-  __IO uint8_t  SCR;
-       uint8_t  RESERVED5[3];
-  __IO uint32_t ACR;
-       uint32_t RESERVED6;
-  __IO uint32_t FDR;
-       uint32_t RESERVED7;
-  __IO uint8_t  TER;
-       uint8_t  RESERVED8[27];
-  __IO uint8_t  RS485CTRL;
-       uint8_t  RESERVED9[3];
-  __IO uint8_t  ADRMATCH;
-       uint8_t  RESERVED10[3];
-  __IO uint8_t  RS485DLY;
-} LPC_UART1_TypeDef;
-
-/*------------- Serial Peripheral Interface (SPI) ----------------------------*/
-typedef struct
-{
-  __IO uint32_t SPCR;
-  __I  uint32_t SPSR;
-  __IO uint32_t SPDR;
-  __IO uint32_t SPCCR;
-       uint32_t RESERVED0[3];
-  __IO uint32_t SPINT;
-} LPC_SPI_TypeDef;
-
-/*------------- Synchronous Serial Communication (SSP) -----------------------*/
-typedef struct
-{
-  __IO uint32_t CR0;
-  __IO uint32_t CR1;
-  __IO uint32_t DR;
-  __I  uint32_t SR;
-  __IO uint32_t CPSR;
-  __IO uint32_t IMSC;
-  __IO uint32_t RIS;
-  __IO uint32_t MIS;
-  __IO uint32_t ICR;
-  __IO uint32_t DMACR;
-} LPC_SSP_TypeDef;
-
-/*------------- Inter-Integrated Circuit (I2C) -------------------------------*/
-typedef struct
-{
-  __IO uint32_t I2CONSET;
-  __I  uint32_t I2STAT;
-  __IO uint32_t I2DAT;
-  __IO uint32_t I2ADR0;
-  __IO uint32_t I2SCLH;
-  __IO uint32_t I2SCLL;
-  __O  uint32_t I2CONCLR;
-  __IO uint32_t MMCTRL;
-  __IO uint32_t I2ADR1;
-  __IO uint32_t I2ADR2;
-  __IO uint32_t I2ADR3;
-  __I  uint32_t I2DATA_BUFFER;
-  __IO uint32_t I2MASK0;
-  __IO uint32_t I2MASK1;
-  __IO uint32_t I2MASK2;
-  __IO uint32_t I2MASK3;
-} LPC_I2C_TypeDef;
-
-/*------------- Inter IC Sound (I2S) -----------------------------------------*/
-typedef struct
-{
-  __IO uint32_t I2SDAO;
-  __I  uint32_t I2SDAI;
-  __O  uint32_t I2STXFIFO;
-  __I  uint32_t I2SRXFIFO;
-  __I  uint32_t I2SSTATE;
-  __IO uint32_t I2SDMA1;
-  __IO uint32_t I2SDMA2;
-  __IO uint32_t I2SIRQ;
-  __IO uint32_t I2STXRATE;
-  __IO uint32_t I2SRXRATE;
-  __IO uint32_t I2STXBITRATE;
-  __IO uint32_t I2SRXBITRATE;
-  __IO uint32_t I2STXMODE;
-  __IO uint32_t I2SRXMODE;
-} LPC_I2S_TypeDef;
-
-/*------------- Real-Time Clock (RTC) ----------------------------------------*/
-typedef struct
-{
-  __IO uint8_t  ILR;
-       uint8_t  RESERVED0[3];
-  __IO uint8_t  CTC;
-       uint8_t  RESERVED1[3];
-  __IO uint8_t  CCR;
-       uint8_t  RESERVED2[3];
-  __IO uint8_t  CIIR;
-       uint8_t  RESERVED3[3];
-  __IO uint8_t  AMR;
-       uint8_t  RESERVED4[3];
-  __I  uint32_t CTIME0;
-  __I  uint32_t CTIME1;
-  __I  uint32_t CTIME2;
-  __IO uint8_t  SEC;
-       uint8_t  RESERVED5[3];
-  __IO uint8_t  MIN;
-       uint8_t  RESERVED6[3];
-  __IO uint8_t  HOUR;
-       uint8_t  RESERVED7[3];
-  __IO uint8_t  DOM;
-       uint8_t  RESERVED8[3];
-  __IO uint8_t  DOW;
-       uint8_t  RESERVED9[3];
-  __IO uint16_t DOY;
-       uint16_t RESERVED10;
-  __IO uint8_t  MONTH;
-       uint8_t  RESERVED11[3];
-  __IO uint16_t YEAR;
-       uint16_t RESERVED12;
-  __IO uint32_t CALIBRATION;
-  __IO uint32_t GPREG0;
-  __IO uint32_t GPREG1;
-  __IO uint32_t GPREG2;
-  __IO uint32_t GPREG3;
-  __IO uint32_t GPREG4;
-  __IO uint8_t  WAKEUPDIS;
-       uint8_t  RESERVED13[3];
-  __IO uint8_t  PWRCTRL;
-       uint8_t  RESERVED14[3];
-  __IO uint8_t  ALSEC;
-       uint8_t  RESERVED15[3];
-  __IO uint8_t  ALMIN;
-       uint8_t  RESERVED16[3];
-  __IO uint8_t  ALHOUR;
-       uint8_t  RESERVED17[3];
-  __IO uint8_t  ALDOM;
-       uint8_t  RESERVED18[3];
-  __IO uint8_t  ALDOW;
-       uint8_t  RESERVED19[3];
-  __IO uint16_t ALDOY;
-       uint16_t RESERVED20;
-  __IO uint8_t  ALMON;
-       uint8_t  RESERVED21[3];
-  __IO uint16_t ALYEAR;
-       uint16_t RESERVED22;
-} LPC_RTC_TypeDef;
-
-/*------------- Watchdog Timer (WDT) -----------------------------------------*/
-typedef struct
-{
-  __IO uint8_t  WDMOD;
-       uint8_t  RESERVED0[3];
-  __IO uint32_t WDTC;
-  __O  uint8_t  WDFEED;
-       uint8_t  RESERVED1[3];
-  __I  uint32_t WDTV;
-  __IO uint32_t WDCLKSEL;
-} LPC_WDT_TypeDef;
-
-/*------------- Analog-to-Digital Converter (ADC) ----------------------------*/
-typedef struct
-{
-  __IO uint32_t ADCR;
-  __IO uint32_t ADGDR;
-       uint32_t RESERVED0;
-  __IO uint32_t ADINTEN;
-  __I  uint32_t ADDR0;
-  __I  uint32_t ADDR1;
-  __I  uint32_t ADDR2;
-  __I  uint32_t ADDR3;
-  __I  uint32_t ADDR4;
-  __I  uint32_t ADDR5;
-  __I  uint32_t ADDR6;
-  __I  uint32_t ADDR7;
-  __I  uint32_t ADSTAT;
-  __IO uint32_t ADTRM;
-} LPC_ADC_TypeDef;
-
-/*------------- Digital-to-Analog Converter (DAC) ----------------------------*/
-typedef struct
-{
-  __IO uint32_t DACR;
-  __IO uint32_t DACCTRL;
-  __IO uint16_t DACCNTVAL;
-} LPC_DAC_TypeDef;
-
-/*------------- Multimedia Card Interface (MCI) ------------------------------*/
-typedef struct
-{
-  __IO uint32_t MCIPower;               /* Power control                      */
-  __IO uint32_t MCIClock;               /* Clock control                      */
-  __IO uint32_t MCIArgument;
-  __IO uint32_t MMCCommand;
-  __I  uint32_t MCIRespCmd;
-  __I  uint32_t MCIResponse0;
-  __I  uint32_t MCIResponse1;
-  __I  uint32_t MCIResponse2;
-  __I  uint32_t MCIResponse3;
-  __IO uint32_t MCIDataTimer;
-  __IO uint32_t MCIDataLength;
-  __IO uint32_t MCIDataCtrl;
-  __I  uint32_t MCIDataCnt;
-} LPC_MCI_TypeDef;
-
-/*------------- Controller Area Network (CAN) --------------------------------*/
-typedef struct
-{
-  __IO uint32_t mask[512];              /* ID Masks                           */
-} LPC_CANAF_RAM_TypeDef;
-
-typedef struct                          /* Acceptance Filter Registers        */
-{
-  __IO uint32_t AFMR;
-  __IO uint32_t SFF_sa;
-  __IO uint32_t SFF_GRP_sa;
-  __IO uint32_t EFF_sa;
-  __IO uint32_t EFF_GRP_sa;
-  __IO uint32_t ENDofTable;
-  __I  uint32_t LUTerrAd;
-  __I  uint32_t LUTerr;
-} LPC_CANAF_TypeDef;
-
-typedef struct                          /* Central Registers                  */
-{
-  __I  uint32_t CANTxSR;
-  __I  uint32_t CANRxSR;
-  __I  uint32_t CANMSR;
-} LPC_CANCR_TypeDef;
-
-typedef struct                          /* Controller Registers               */
-{
-  __IO uint32_t MOD;
-  __O  uint32_t CMR;
-  __IO uint32_t GSR;
-  __I  uint32_t ICR;
-  __IO uint32_t IER;
-  __IO uint32_t BTR;
-  __IO uint32_t EWL;
-  __I  uint32_t SR;
-  __IO uint32_t RFS;
-  __IO uint32_t RID;
-  __IO uint32_t RDA;
-  __IO uint32_t RDB;
-  __IO uint32_t TFI1;
-  __IO uint32_t TID1;
-  __IO uint32_t TDA1;
-  __IO uint32_t TDB1;
-  __IO uint32_t TFI2;
-  __IO uint32_t TID2;
-  __IO uint32_t TDA2;
-  __IO uint32_t TDB2;
-  __IO uint32_t TFI3;
-  __IO uint32_t TID3;
-  __IO uint32_t TDA3;
-  __IO uint32_t TDB3;
-} LPC_CAN_TypeDef;
-
-/*------------- General Purpose Direct Memory Access (GPDMA) -----------------*/
-typedef struct                          /* Common Registers                   */
-{
-  __I  uint32_t DMACIntStat;
-  __I  uint32_t DMACIntTCStat;
-  __O  uint32_t DMACIntTCClear;
-  __I  uint32_t DMACIntErrStat;
-  __O  uint32_t DMACIntErrClr;
-  __I  uint32_t DMACRawIntTCStat;
-  __I  uint32_t DMACRawIntErrStat;
-  __I  uint32_t DMACEnbldChns;
-  __IO uint32_t DMACSoftBReq;
-  __IO uint32_t DMACSoftSReq;
-  __IO uint32_t DMACSoftLBReq;
-  __IO uint32_t DMACSoftLSReq;
-  __IO uint32_t DMACConfig;
-  __IO uint32_t DMACSync;
-} LPC_GPDMA_TypeDef;
-
-typedef struct                          /* Channel Registers                  */
-{
-  __IO uint32_t DMACCSrcAddr;
-  __IO uint32_t DMACCDestAddr;
-  __IO uint32_t DMACCLLI;
-  __IO uint32_t DMACCControl;
-  __IO uint32_t DMACCConfig;
-} LPC_GPDMACH_TypeDef;
-
-/*------------- Universal Serial Bus (USB) -----------------------------------*/
-typedef struct
-{
-  __I  uint32_t HcRevision;             /* USB Host Registers                 */
-  __IO uint32_t HcControl;
-  __IO uint32_t HcCommandStatus;
-  __IO uint32_t HcInterruptStatus;
-  __IO uint32_t HcInterruptEnable;
-  __IO uint32_t HcInterruptDisable;
-  __IO uint32_t HcHCCA;
-  __I  uint32_t HcPeriodCurrentED;
-  __IO uint32_t HcControlHeadED;
-  __IO uint32_t HcControlCurrentED;
-  __IO uint32_t HcBulkHeadED;
-  __IO uint32_t HcBulkCurrentED;
-  __I  uint32_t HcDoneHead;
-  __IO uint32_t HcFmInterval;
-  __I  uint32_t HcFmRemaining;
-  __I  uint32_t HcFmNumber;
-  __IO uint32_t HcPeriodicStart;
-  __IO uint32_t HcLSTreshold;
-  __IO uint32_t HcRhDescriptorA;
-  __IO uint32_t HcRhDescriptorB;
-  __IO uint32_t HcRhStatus;
-  __IO uint32_t HcRhPortStatus1;
-  __IO uint32_t HcRhPortStatus2;
-       uint32_t RESERVED0[40];
-  __I  uint32_t Module_ID;
-
-  __I  uint32_t OTGIntSt;               /* USB On-The-Go Registers            */
-  __IO uint32_t OTGIntEn;
-  __O  uint32_t OTGIntSet;
-  __O  uint32_t OTGIntClr;
-  __IO uint32_t OTGStCtrl;
-  __IO uint32_t OTGTmr;
-       uint32_t RESERVED1[58];
-
-  __I  uint32_t USBDevIntSt;            /* USB Device Interrupt Registers     */
-  __IO uint32_t USBDevIntEn;
-  __O  uint32_t USBDevIntClr;
-  __O  uint32_t USBDevIntSet;
-
-  __O  uint32_t USBCmdCode;             /* USB Device SIE Command Registers   */
-  __I  uint32_t USBCmdData;
-
-  __I  uint32_t USBRxData;              /* USB Device Transfer Registers      */
-  __O  uint32_t USBTxData;
-  __I  uint32_t USBRxPLen;
-  __O  uint32_t USBTxPLen;
-  __IO uint32_t USBCtrl;
-  __O  uint32_t USBDevIntPri;
-
-  __I  uint32_t USBEpIntSt;             /* USB Device Endpoint Interrupt Regs */
-  __IO uint32_t USBEpIntEn;
-  __O  uint32_t USBEpIntClr;
-  __O  uint32_t USBEpIntSet;
-  __O  uint32_t USBEpIntPri;
-
-  __IO uint32_t USBReEp;                /* USB Device Endpoint Realization Reg*/
-  __O  uint32_t USBEpInd;
-  __IO uint32_t USBMaxPSize;
-
-  __I  uint32_t USBDMARSt;              /* USB Device DMA Registers           */
-  __O  uint32_t USBDMARClr;
-  __O  uint32_t USBDMARSet;
-       uint32_t RESERVED2[9];
-  __IO uint32_t USBUDCAH;
-  __I  uint32_t USBEpDMASt;
-  __O  uint32_t USBEpDMAEn;
-  __O  uint32_t USBEpDMADis;
-  __I  uint32_t USBDMAIntSt;
-  __IO uint32_t USBDMAIntEn;
-       uint32_t RESERVED3[2];
-  __I  uint32_t USBEoTIntSt;
-  __O  uint32_t USBEoTIntClr;
-  __O  uint32_t USBEoTIntSet;
-  __I  uint32_t USBNDDRIntSt;
-  __O  uint32_t USBNDDRIntClr;
-  __O  uint32_t USBNDDRIntSet;
-  __I  uint32_t USBSysErrIntSt;
-  __O  uint32_t USBSysErrIntClr;
-  __O  uint32_t USBSysErrIntSet;
-       uint32_t RESERVED4[15];
-
-  __I  uint32_t I2C_RX;                 /* USB OTG I2C Registers              */
-  __O  uint32_t I2C_WO;
-  __I  uint32_t I2C_STS;
-  __IO uint32_t I2C_CTL;
-  __IO uint32_t I2C_CLKHI;
-  __O  uint32_t I2C_CLKLO;
-       uint32_t RESERVED5[823];
-
-  union {
-  __IO uint32_t USBClkCtrl;             /* USB Clock Control Registers        */
-  __IO uint32_t OTGClkCtrl;
-  };
-  union {
-  __I  uint32_t USBClkSt;
-  __I  uint32_t OTGClkSt;
-  };
-} LPC_USB_TypeDef;
-
-/*------------- Ethernet Media Access Controller (EMAC) ----------------------*/
-typedef struct
-{
-  __IO uint32_t MAC1;                   /* MAC Registers                      */
-  __IO uint32_t MAC2;
-  __IO uint32_t IPGT;
-  __IO uint32_t IPGR;
-  __IO uint32_t CLRT;
-  __IO uint32_t MAXF;
-  __IO uint32_t SUPP;
-  __IO uint32_t TEST;
-  __IO uint32_t MCFG;
-  __IO uint32_t MCMD;
-  __IO uint32_t MADR;
-  __O  uint32_t MWTD;
-  __I  uint32_t MRDD;
-  __I  uint32_t MIND;
-       uint32_t RESERVED0[2];
-  __IO uint32_t SA0;
-  __IO uint32_t SA1;
-  __IO uint32_t SA2;
-       uint32_t RESERVED1[45];
-  __IO uint32_t Command;                /* Control Registers                  */
-  __I  uint32_t Status;
-  __IO uint32_t RxDescriptor;
-  __IO uint32_t RxStatus;
-  __IO uint32_t RxDescriptorNumber;
-  __I  uint32_t RxProduceIndex;
-  __IO uint32_t RxConsumeIndex;
-  __IO uint32_t TxDescriptor;
-  __IO uint32_t TxStatus;
-  __IO uint32_t TxDescriptorNumber;
-  __IO uint32_t TxProduceIndex;
-  __I  uint32_t TxConsumeIndex;
-       uint32_t RESERVED2[10];
-  __I  uint32_t TSV0;
-  __I  uint32_t TSV1;
-  __I  uint32_t RSV;
-       uint32_t RESERVED3[3];
-  __IO uint32_t FlowControlCounter;
-  __I  uint32_t FlowControlStatus;
-       uint32_t RESERVED4[34];
-  __IO uint32_t RxFilterCtrl;           /* Rx Filter Registers                */
-  __IO uint32_t RxFilterWoLStatus;
-  __IO uint32_t RxFilterWoLClear;
-       uint32_t RESERVED5;
-  __IO uint32_t HashFilterL;
-  __IO uint32_t HashFilterH;
-       uint32_t RESERVED6[882];
-  __I  uint32_t IntStatus;              /* Module Control Registers           */
-  __IO uint32_t IntEnable;
-  __O  uint32_t IntClear;
-  __O  uint32_t IntSet;
-       uint32_t RESERVED7;
-  __IO uint32_t PowerDown;
-       uint32_t RESERVED8;
-  __IO uint32_t Module_ID;
-} LPC_EMAC_TypeDef;
-
-#if defined ( __CC_ARM   )
-  #pragma no_anon_unions
-#endif
-
-/******************************************************************************/
-/*                         Peripheral memory map                              */
-/******************************************************************************/
-/* Base addresses                                                             */
-
-/* AHB Peripheral # 0 */
-
-/*
-#define FLASH_BASE            (0x00000000UL)
-#define RAM_BASE              (0x10000000UL)
-#define GPIO_BASE             (0x2009C000UL)
-#define APB0_BASE             (0x40000000UL)
-#define APB1_BASE             (0x40080000UL)
-#define AHB_BASE              (0x50000000UL)
-#define CM3_BASE              (0xE0000000UL)
-*/
-
-// TODO - #define VIC_BASE_ADDR	0xFFFFF000
-
-#define LPC_WDT_BASE              (0xE0000000)
-#define LPC_TIM0_BASE             (0xE0004000)
-#define LPC_TIM1_BASE             (0xE0008000)
-#define LPC_UART0_BASE            (0xE000C000)
-#define LPC_UART1_BASE            (0xE0010000)
-#define LPC_PWM1_BASE             (0xE0018000)
-#define LPC_I2C0_BASE             (0xE001C000)
-#define LPC_SPI_BASE              (0xE0020000)
-#define LPC_RTC_BASE              (0xE0024000)
-#define LPC_GPIOINT_BASE          (0xE0028080)
-#define LPC_PINCON_BASE           (0xE002C000)
-#define LPC_SSP1_BASE             (0xE0030000)
-#define LPC_ADC_BASE              (0xE0034000)
-#define LPC_CANAF_RAM_BASE        (0xE0038000)
-#define LPC_CANAF_BASE            (0xE003C000)
-#define LPC_CANCR_BASE            (0xE0040000)
-#define LPC_CAN1_BASE             (0xE0044000)
-#define LPC_CAN2_BASE             (0xE0048000)
-#define LPC_I2C1_BASE             (0xE005C000)
-#define LPC_SSP0_BASE             (0xE0068000)
-#define LPC_DAC_BASE              (0xE006C000)
-#define LPC_TIM2_BASE             (0xE0070000)
-#define LPC_TIM3_BASE             (0xE0074000)
-#define LPC_UART2_BASE            (0xE0078000)
-#define LPC_UART3_BASE            (0xE007C000)
-#define LPC_I2C2_BASE             (0xE0080000)
-#define LPC_I2S_BASE              (0xE0088000)
-#define LPC_MCI_BASE              (0xE008C000)
-#define LPC_SC_BASE               (0xE01FC000)
-#define LPC_EMAC_BASE             (0xFFE00000)
-#define LPC_GPDMA_BASE            (0xFFE04000)
-#define LPC_GPDMACH0_BASE         (0xFFE04100)
-#define LPC_GPDMACH1_BASE         (0xFFE04120)
-#define LPC_USB_BASE              (0xFFE0C000)
-#define LPC_VIC_BASE              (0xFFFFF000)
-
-/* GPIOs                                                                      */
-#define LPC_GPIO0_BASE            (0x3FFFC000)
-#define LPC_GPIO1_BASE            (0x3FFFC020)
-#define LPC_GPIO2_BASE            (0x3FFFC040)
-#define LPC_GPIO3_BASE            (0x3FFFC060)
-#define LPC_GPIO4_BASE            (0x3FFFC080)
-
-
-/******************************************************************************/
-/*                         Peripheral declaration                             */
-/******************************************************************************/
-#define LPC_SC                    ((       LPC_SC_TypeDef *)        LPC_SC_BASE)
-#define LPC_GPIO0                 ((     LPC_GPIO_TypeDef *)     LPC_GPIO0_BASE)
-#define LPC_GPIO1                 ((     LPC_GPIO_TypeDef *)     LPC_GPIO1_BASE)
-#define LPC_GPIO2                 ((     LPC_GPIO_TypeDef *)     LPC_GPIO2_BASE)
-#define LPC_GPIO3                 ((     LPC_GPIO_TypeDef *)     LPC_GPIO3_BASE)
-#define LPC_GPIO4                 ((     LPC_GPIO_TypeDef *)     LPC_GPIO4_BASE)
-#define LPC_WDT                   ((      LPC_WDT_TypeDef *)       LPC_WDT_BASE)
-#define LPC_TIM0                  ((      LPC_TIM_TypeDef *)      LPC_TIM0_BASE)
-#define LPC_TIM1                  ((      LPC_TIM_TypeDef *)      LPC_TIM1_BASE)
-#define LPC_TIM2                  ((      LPC_TIM_TypeDef *)      LPC_TIM2_BASE)
-#define LPC_TIM3                  ((      LPC_TIM_TypeDef *)      LPC_TIM3_BASE)
-#define LPC_UART0                 ((     LPC_UART_TypeDef *)     LPC_UART0_BASE)
-#define LPC_UART1                 ((    LPC_UART1_TypeDef *)     LPC_UART1_BASE)
-#define LPC_UART2                 ((     LPC_UART_TypeDef *)     LPC_UART2_BASE)
-#define LPC_UART3                 ((     LPC_UART_TypeDef *)     LPC_UART3_BASE)
-#define LPC_PWM1                  ((      LPC_PWM_TypeDef *)      LPC_PWM1_BASE)
-#define LPC_I2C0                  ((      LPC_I2C_TypeDef *)      LPC_I2C0_BASE)
-#define LPC_I2C1                  ((      LPC_I2C_TypeDef *)      LPC_I2C1_BASE)
-#define LPC_I2C2                  ((      LPC_I2C_TypeDef *)      LPC_I2C2_BASE)
-#define LPC_I2S                   ((      LPC_I2S_TypeDef *)       LPC_I2S_BASE)
-#define LPC_SPI                   ((      LPC_SPI_TypeDef *)       LPC_SPI_BASE)
-#define LPC_RTC                   ((      LPC_RTC_TypeDef *)       LPC_RTC_BASE)
-#define LPC_GPIOINT               ((  LPC_GPIOINT_TypeDef *)   LPC_GPIOINT_BASE)
-#define LPC_PINCON                ((   LPC_PINCON_TypeDef *)    LPC_PINCON_BASE)
-#define LPC_SSP0                  ((      LPC_SSP_TypeDef *)      LPC_SSP0_BASE)
-#define LPC_SSP1                  ((      LPC_SSP_TypeDef *)      LPC_SSP1_BASE)
-#define LPC_ADC                   ((      LPC_ADC_TypeDef *)       LPC_ADC_BASE)
-#define LPC_DAC                   ((      LPC_DAC_TypeDef *)       LPC_DAC_BASE)
-#define LPC_CANAF_RAM             ((LPC_CANAF_RAM_TypeDef *) LPC_CANAF_RAM_BASE)
-#define LPC_CANAF                 ((    LPC_CANAF_TypeDef *)     LPC_CANAF_BASE)
-#define LPC_CANCR                 ((    LPC_CANCR_TypeDef *)     LPC_CANCR_BASE)
-#define LPC_CAN1                  ((      LPC_CAN_TypeDef *)      LPC_CAN1_BASE)
-#define LPC_CAN2                  ((      LPC_CAN_TypeDef *)      LPC_CAN2_BASE)
-#define LPC_MCI                   ((      LPC_MCI_TypeDef *)       LPC_MCI_BASE)
-#define LPC_EMAC                  ((     LPC_EMAC_TypeDef *)      LPC_EMAC_BASE)
-#define LPC_GPDMA                 ((    LPC_GPDMA_TypeDef *)     LPC_GPDMA_BASE)
-#define LPC_GPDMACH0              ((  LPC_GPDMACH_TypeDef *)  LPC_GPDMACH0_BASE)
-#define LPC_GPDMACH1              ((  LPC_GPDMACH_TypeDef *)  LPC_GPDMACH1_BASE)
-#define LPC_USB                   ((      LPC_USB_TypeDef *)       LPC_USB_BASE)
-#define LPC_VIC                   ((      LPC_VIC_TypeDef *)       LPC_VIC_BASE)
-
-#ifdef __cplusplus
- }
-#endif 
-
-#endif  // __LPC23xx_H
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_ARM_MICRO/LPC2368.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-
-LR_IROM1 0x00000000 0x80000  {    ; load region size_region
-  ER_IROM1 0x00000000 0x80000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  RW_IRAM1 0x40000120 0x7EE0  {  ; RW data, inc space for realmonitor
-   .ANY (+RW +ZI)
-  }
-  RW_IRAM2 0x7FD00000 0x2000  {  ; RW data, USB RAM
-   .ANY (AHBSRAM0)
-  }
-  RW_IRAM3 0x7FE00000 0x4000  {  ; RW data, ETH RAM
-   .ANY (AHBSRAM1)
-  }
-  RW_IRAM4 0xE0038000 0x0800  {  ; RW data, CAN RAM
-   .ANY (CANRAM)
-  }
-  RW_IRAM5 0xE0084000 0x0800  {  ; RW data, RTC RAM
-   .ANY (RTCRAM)
-  }
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_ARM_MICRO/sys.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library - stackheap
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * Setup a fixed single stack/heap memory model, 
- *  between the top of the RW/ZI region and the stackpointer
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-#include <rt_misc.h>
-#include <stdint.h>
-
-extern char Image$$RW_IRAM1$$ZI$$Limit[];
-
-extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
-    uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
-    uint32_t sp_limit = __current_sp();
-
-    zi_limit = (zi_limit + 7) & ~0x7;    // ensure zi_limit is 8-byte aligned
-
-    struct __initial_stackheap r;
-    r.heap_base = zi_limit;
-    r.heap_limit = sp_limit;
-    return r;
-}
-
-#ifdef __cplusplus
-}
-#endif 
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_ARM_MICRO/vector_functions.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,248 +0,0 @@
-;/* mbed Microcontroller Library - InterruptIn
-; * Copyright (c) 2006-2009 ARM Limited. All rights reserved.
-; */
- 
-#line 1 "vector_functions.s"
-;
-;
-;
-
-#line 1 "vector_defns.h"
-
-
-
- 
-
-
-
- 
-
-#line 21 "vector_defns.h"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#line 47 "vector_defns.h"
-
-
-#line 58 "vector_defns.h"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#line 6 "vector_functions.s"
-
-
-        AREA    VECFUNCS, CODE, READONLY
-        ARM
-        PRESERVE8
-
-
-
-
-
-        EXPORT __mbed_fiq [WEAK]
-        EXPORT __mbed_undef [WEAK]
-        EXPORT __mbed_prefetch_abort [WEAK]
-        EXPORT __mbed_data_abort [WEAK]
-        EXPORT __mbed_irq [WEAK]
-        EXPORT __mbed_swi [WEAK]
-        EXPORT __mbed_dcc_irq [WEAK]
-        EXPORT __mbed_reset [WEAK]
-        IMPORT __mbed_init_realmonitor
-
-;
-;
-__mbed_fiq
-        B       __mbed_fiq
-
-;
-;
-__mbed_undef
-        LDR     PC, =0x7fffffa0
-
-;
-;
-__mbed_prefetch_abort
-        LDR     PC, =0x7fffffb0
-
-;
-;
-__mbed_data_abort
-        LDR     PC, =0x7fffffc0
-
-;
-;
-;
-;
-;
-;
-;
-;
-;
-__mbed_irq
-        ;
-        MSR     CPSR_c, #0x1F:OR:0x80:OR:0x40
-                
-        ;
-        STMDB   sp!, {r0-r3,r12,lr}    
-
-        ;
-        MOV	r0, #0xFFFFFF00
-        LDR	r0, [r0]	
-
-        ;
-        MOV     lr, pc       
-        BX      r0           
-			    				
-        ;
-        MOV	r0, #0xFFFFFF00
-        STR	r0, [r0]			;
-				
-        ;
-        LDMFD   sp!,{r0-r3,r12,lr}
-
-        ;
-        MSR     CPSR_c, #0x12:OR:0x80:OR:0x40
-
-        ;
-        SUBS    pc, lr, #4 
-
-;
-;
-;
-;
-__mbed_swi
-        ;
-        ;
-        STMFD   sp!, {a4, r4, ip, lr}
-
-        ;
-        LDR     r4, =0x40000040
-
-        ;
-        ;
-        LDR     a4, =0x00940000
-        LDR	PC, =0x7ffff820				
-
-;
-;
-;
-;
-__mbed_dcc_irq
-
-        ;
-			
-        ;
-        LDMFD    sp!,{r0-r3,r12,lr}
-
-        ;
-        MSR     CPSR_c, #0x12:OR:0x80:OR:0x40
-
-        ;
-				
-        ;
-        SUB     lr, lr, #4              ;
-        STMFD   sp!, {ip,lr}            ;
-			
-        ;
-        LDR     LR, =0xfffff000
-        STR     LR, [LR, #0xf00]
-			
-        ;
-        ;
-        ;
-        ;
-        LDR     PC, =0x7fffffe0			 
-
-;
-; __mbed_reset is called after reset
-; we setup the stacks and realmonitor, then call Reset_Handler like on M3
-
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                MOV     LR, PC       
-                BX      R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-__mbed_reset
-
-        ;
-
-        LDR     R0, =(0x40000000 + 0x8000)
-
-        ;
-        MSR     CPSR_c, #0x1B:OR:0x80:OR:0x40
-        MOV     SP, R0
-        SUB     R0, R0, #0x00000040
-
-        ;
-        MSR     CPSR_c, #0x17:OR:0x80:OR:0x40
-        MOV     SP, R0
-        SUB     R0, R0, #0x00000040
-
-        ;
-        MSR     CPSR_c, #0x11:OR:0x80:OR:0x40
-        MOV     SP, R0
-        SUB     R0, R0, #0x00000000
-
-        ;
-        MSR     CPSR_c, #0x12:OR:0x80:OR:0x40
-        MOV     SP, R0
-        SUB     R0, R0, #0x00000040
-
-        ;
-        MSR     CPSR_c, #0x13:OR:0x80:OR:0x40
-        MOV     SP, R0
-        SUB     R0, R0, #0x00000040
-
-        ;
-        MSR     CPSR_c, #0x10
-        MOV     SP, R0
-
-        ;
-        LDR     R0, =__mbed_init_realmonitor
-        MOV     LR, PC       
-        BX      R0           
-        
-        ;
-        LDR     R0, =Reset_Handler
-        BX      R0
-
-        
-        END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_ARM_MICRO/vector_table.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-;/* mbed Microcontroller Library - InterruptIn
-; * Copyright (c) 2006-2009 ARM Limited. All rights reserved.
-; */
- 
-#line 1 "vector_table.s"
-;
-
-
- 
-
-#line 1 "vector_defns.h"
-
-
-
- 
-
-
-
- 
-
-#line 21 "vector_defns.h"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#line 47 "vector_defns.h"
-
-
-#line 58 "vector_defns.h"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#line 7 "vector_table.s"
-        
-;
-
-
-        AREA    RESET, CODE, READONLY
-        ARM
-;        ENTRY
-        PRESERVE8
-
-
-
-
-
-;        EXPORT __main
-        IMPORT __mbed_reset
-        IMPORT __mbed_undef
-        IMPORT __mbed_swi
-        IMPORT __mbed_prefetch_abort
-        IMPORT __mbed_data_abort
-        IMPORT __mbed_irq
-        IMPORT __mbed_fiq
-
-;
-
- 
-;__main
-        LDR     PC, =__mbed_reset
-        LDR     PC, =__mbed_undef
-        LDR     PC, =__mbed_swi
-        LDR     PC, =__mbed_prefetch_abort
-        LDR     PC, =__mbed_data_abort
-        NOP     ;
-        LDR     PC, =__mbed_irq
-        LDR     PC, =__mbed_fiq
-        
-
-        END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_ARM_STD/LPC2368.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-
-LR_IROM1 0x00000000 0x80000  {    ; load region size_region
-  ER_IROM1 0x00000000 0x80000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  RW_IRAM1 0x40000120 0x7EE0  {  ; RW data, inc space for realmonitor
-   .ANY (+RW +ZI)
-  }
-  RW_IRAM2 0x7FD00000 0x2000  {  ; RW data, USB RAM
-   .ANY (AHBSRAM0)
-  }
-  RW_IRAM3 0x7FE00000 0x4000  {  ; RW data, ETH RAM
-   .ANY (AHBSRAM1)
-  }
-  RW_IRAM4 0xE0038000 0x0800  {  ; RW data, CAN RAM
-   .ANY (CANRAM)
-  }
-  RW_IRAM5 0xE0084000 0x0800  {  ; RW data, RTC RAM
-   .ANY (RTCRAM)
-  }
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_ARM_STD/sys.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library - stackheap
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * Setup a fixed single stack/heap memory model, 
- *  between the top of the RW/ZI region and the stackpointer
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-#include <rt_misc.h>
-#include <stdint.h>
-
-extern char Image$$RW_IRAM1$$ZI$$Limit[];
-
-extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
-    uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
-    uint32_t sp_limit = __current_sp();
-
-    zi_limit = (zi_limit + 7) & ~0x7;    // ensure zi_limit is 8-byte aligned
-
-    struct __initial_stackheap r;
-    r.heap_base = zi_limit;
-    r.heap_limit = sp_limit;
-    return r;
-}
-
-#ifdef __cplusplus
-}
-#endif 
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_ARM_STD/vector_functions.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,248 +0,0 @@
-;/* mbed Microcontroller Library - InterruptIn
-; * Copyright (c) 2006-2009 ARM Limited. All rights reserved.
-; */
- 
-#line 1 "vector_functions.s"
-;
-;
-;
-
-#line 1 "vector_defns.h"
-
-
-
- 
-
-
-
- 
-
-#line 21 "vector_defns.h"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#line 47 "vector_defns.h"
-
-
-#line 58 "vector_defns.h"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#line 6 "vector_functions.s"
-
-
-        AREA    VECFUNCS, CODE, READONLY
-        ARM
-        PRESERVE8
-
-
-
-
-
-        EXPORT __mbed_fiq [WEAK]
-        EXPORT __mbed_undef [WEAK]
-        EXPORT __mbed_prefetch_abort [WEAK]
-        EXPORT __mbed_data_abort [WEAK]
-        EXPORT __mbed_irq [WEAK]
-        EXPORT __mbed_swi [WEAK]
-        EXPORT __mbed_dcc_irq [WEAK]
-        EXPORT __mbed_reset [WEAK]
-        IMPORT __mbed_init_realmonitor
-
-;
-;
-__mbed_fiq
-        B       __mbed_fiq
-
-;
-;
-__mbed_undef
-        LDR     PC, =0x7fffffa0
-
-;
-;
-__mbed_prefetch_abort
-        LDR     PC, =0x7fffffb0
-
-;
-;
-__mbed_data_abort
-        LDR     PC, =0x7fffffc0
-
-;
-;
-;
-;
-;
-;
-;
-;
-;
-__mbed_irq
-        ;
-        MSR     CPSR_c, #0x1F:OR:0x80:OR:0x40
-                
-        ;
-        STMDB   sp!, {r0-r3,r12,lr}    
-
-        ;
-        MOV	r0, #0xFFFFFF00
-        LDR	r0, [r0]	
-
-        ;
-        MOV     lr, pc       
-        BX      r0           
-			    				
-        ;
-        MOV	r0, #0xFFFFFF00
-        STR	r0, [r0]			;
-				
-        ;
-        LDMFD   sp!,{r0-r3,r12,lr}
-
-        ;
-        MSR     CPSR_c, #0x12:OR:0x80:OR:0x40
-
-        ;
-        SUBS    pc, lr, #4 
-
-;
-;
-;
-;
-__mbed_swi
-        ;
-        ;
-        STMFD   sp!, {a4, r4, ip, lr}
-
-        ;
-        LDR     r4, =0x40000040
-
-        ;
-        ;
-        LDR     a4, =0x00940000
-        LDR	PC, =0x7ffff820				
-
-;
-;
-;
-;
-__mbed_dcc_irq
-
-        ;
-			
-        ;
-        LDMFD    sp!,{r0-r3,r12,lr}
-
-        ;
-        MSR     CPSR_c, #0x12:OR:0x80:OR:0x40
-
-        ;
-				
-        ;
-        SUB     lr, lr, #4              ;
-        STMFD   sp!, {ip,lr}            ;
-			
-        ;
-        LDR     LR, =0xfffff000
-        STR     LR, [LR, #0xf00]
-			
-        ;
-        ;
-        ;
-        ;
-        LDR     PC, =0x7fffffe0			 
-
-;
-; __mbed_reset is called after reset
-; we setup the stacks and realmonitor, then call Reset_Handler like on M3
-
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                MOV     LR, PC       
-                BX      R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-__mbed_reset
-
-        ;
-
-        LDR     R0, =(0x40000000 + 0x8000)
-
-        ;
-        MSR     CPSR_c, #0x1B:OR:0x80:OR:0x40
-        MOV     SP, R0
-        SUB     R0, R0, #0x00000040
-
-        ;
-        MSR     CPSR_c, #0x17:OR:0x80:OR:0x40
-        MOV     SP, R0
-        SUB     R0, R0, #0x00000040
-
-        ;
-        MSR     CPSR_c, #0x11:OR:0x80:OR:0x40
-        MOV     SP, R0
-        SUB     R0, R0, #0x00000000
-
-        ;
-        MSR     CPSR_c, #0x12:OR:0x80:OR:0x40
-        MOV     SP, R0
-        SUB     R0, R0, #0x00000040
-
-        ;
-        MSR     CPSR_c, #0x13:OR:0x80:OR:0x40
-        MOV     SP, R0
-        SUB     R0, R0, #0x00000040
-
-        ;
-        MSR     CPSR_c, #0x10
-        MOV     SP, R0
-
-        ;
-        LDR     R0, =__mbed_init_realmonitor
-        MOV     LR, PC       
-        BX      R0           
-        
-        ;
-        LDR     R0, =Reset_Handler
-        BX      R0
-
-        
-        END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_ARM_STD/vector_table.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-;/* mbed Microcontroller Library - InterruptIn
-; * Copyright (c) 2006-2009 ARM Limited. All rights reserved.
-; */
- 
-#line 1 "vector_table.s"
-;
-
-
- 
-
-#line 1 "vector_defns.h"
-
-
-
- 
-
-
-
- 
-
-#line 21 "vector_defns.h"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#line 47 "vector_defns.h"
-
-
-#line 58 "vector_defns.h"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#line 7 "vector_table.s"
-        
-;
-
-
-        AREA    RESET, CODE, READONLY
-        ARM
-;        ENTRY
-        PRESERVE8
-
-
-
-
-
-;        EXPORT __main
-        IMPORT __mbed_reset
-        IMPORT __mbed_undef
-        IMPORT __mbed_swi
-        IMPORT __mbed_prefetch_abort
-        IMPORT __mbed_data_abort
-        IMPORT __mbed_irq
-        IMPORT __mbed_fiq
-
-;
-
- 
-;__main
-        LDR     PC, =__mbed_reset
-        LDR     PC, =__mbed_undef
-        LDR     PC, =__mbed_swi
-        LDR     PC, =__mbed_prefetch_abort
-        LDR     PC, =__mbed_data_abort
-        NOP     ;
-        LDR     PC, =__mbed_irq
-        LDR     PC, =__mbed_fiq
-        
-
-        END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_ARM/LPC2368.ld	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
-OUTPUT_ARCH(arm)
-ENTRY(vectors)
-
-/* Memory Definitions: */
-MEMORY
-{
-    Flash  (rx)  : ORIGIN = 0x00000000, LENGTH = 512k
-    Ram    (rwx) : ORIGIN = 0x40000000, LENGTH = 32k
-    UsbRam (rw)  : ORIGIN = 0x7FD00000, LENGTH = 8k
-    EthRam (rw)  : ORIGIN = 0x7FE00000, LENGTH = 16k
-    CanRam (rw)  : ORIGIN = 0xE0038000, LENGTH = 2k
-    BatRam (rw)  : ORIGIN = 0xE0084000, LENGTH = 2k
-}
-
-/* Stack sizes: */
-UND_Stack_Size = 16;
-SVC_Stack_Size = 512;
-ABT_Stack_Size = 16;
-FIQ_Stack_Size = 16;
-IRQ_Stack_Size = 256;
-Stack_Size_Total = UND_Stack_Size + SVC_Stack_Size + ABT_Stack_Size + FIQ_Stack_Size + IRQ_Stack_Size;
-
-/* Stack tops for each mode: */
-__und_stack_top__ = __stacks_top__;
-__abt_stack_top__ = __und_stack_top__ - UND_Stack_Size ;
-__fiq_stack_top__ = __abt_stack_top__ - ABT_Stack_Size ;
-__irq_stack_top__ = __fiq_stack_top__ - FIQ_Stack_Size ;
-__svc_stack_top__ = __irq_stack_top__ - IRQ_Stack_Size ;
-
-/* C-accessible symbols for memory address ranges: */
-__FLASH_segment_start__ = ORIGIN( Flash );
-__FLASH_segment_end__   = ORIGIN( Flash ) + LENGTH( Flash );
-__SRAM_segment_start__  = ORIGIN( Ram );
-__SRAM_segment_end__    = ORIGIN( Ram ) + LENGTH( Ram );
-
-/* Stacks (full descending) at top of RAM, grows downward:
- *
- * __stack_min__ is used by the malloc implementation to ensure heap never collides
- * with stack (assuming stack never grows beyond Stack_Size_Total in length) */
-__stacks_top__ = __SRAM_segment_end__;
-__stacks_min__ = __SRAM_segment_end__ - Stack_Size_Total;
-
-SECTIONS
-{
-    /* first section is .text which is used for code */
-    __text_start__ = . ;
-    .text : {
-        __privileged_code_start__ = . ;
-        KEEP( *( .vectors ) )
-        *( .privileged_code )
-    
-        __privileged_code_end__ = .;
-
-        *( .text .text.* .gnu.linkonce.t.* )
-        *( .plt )
-        *( .gnu.warning )
-        *( .glue_7t ) *( .glue_7 ) *( .vfp11_veneer )
-        
-        *( .rodata .rodata.* .gnu.linkonce.r.* )
-        
-        *(.ARM.extab* .gnu.linkonce.armextab.*)
-        *(.gcc_except_table)
-        *(.eh_frame_hdr)
-        *(.eh_frame)
-        
-        . = ALIGN( 4 ) ;
-        KEEP( *( .init ) )
-        . = ALIGN( 4 ) ;
-        __preinit_array_start = . ;
-        KEEP( *( .preinit_array ) )
-        __preinit_array_end = . ;
-        . = ALIGN( 4 ) ;
-        __init_array_start = . ;
-        KEEP( *( SORT( .init_array.* ) ) )
-        KEEP( *( .init_array ) )
-        __init_array_end = . ;
-        
-        . = ALIGN( 4 ) ;
-        KEEP( *crtbegin.o( .ctors ) )
-        KEEP( *( EXCLUDE_FILE( *crtend.o ) .ctors ) )
-        KEEP( *( SORT( .ctors.* ) ) )
-        KEEP( *crtend.o( .ctors ) )
-        
-        . = ALIGN( 4 ) ;
-        KEEP( *( .fini ) )
-        . = ALIGN( 4 ) ;
-        __fini_array_start = . ;
-        KEEP( *( .fini_array ) )
-        KEEP( *( SORT( .fini_array.* ) ) )
-        __fini_array_end = . ;
-        
-        KEEP( *crtbegin.o( .dtors ) )
-        KEEP( *( EXCLUDE_FILE( *crtend.o ) .dtors ) )
-        KEEP( *( SORT( .dtors.* ) ) )
-        KEEP( *crtend.o( .dtors ) )
-    
-    } >Flash
-    
-    __exidx_start = . ;
-    .ARM.exidx : {
-        *( .ARM.exidx* .gnu.linkonce.armexidx.* )
-    } >Flash
-    __exidx_end = . ;
-    
-    .text.align : { . = ALIGN( 8 ) ; } >Flash /* Alignment schenanigans */
-    __text_end__ = . ;
-    
-    /* .bss section -- used for uninitialized data */
-    /* Located at the start of RAM */
-    .bss (NOLOAD) : {
-        __bss_start__ = . ;
-        *crt0.o( .ram_vectors )
-        
-        __user_bss_start__ = . ;
-        *( .user_bss )
-        __user_bss_end__ = . ;
-        
-        *( .shbss )
-        *( .bss .bss.* .gnu.linkonce.b.* )
-        *( COMMON )
-        *( .ram.b )
-        . = ALIGN( 8 ) ;
-        
-        __bss_end__ = . ;
-    } >Ram AT>Flash
-
-    /* .data section -- used for initialized data */
-    .data : {
-        __data_start__ = . ;
-        KEEP( *( .jcr ) )
-        *( .got.plt ) *( .got )
-        *( .shdata )
-        *( .data .data.* .gnu.linkonce.d.* )
-        *( .ram )
-        . = ALIGN( 8 ) ;
-        __data_end__ = . ;
-    } >Ram AT>Flash
-
-    __data_init_start__ = LOADADDR( .data ) ;
-
-    /* Heap starts here and grows up in memory */
-    . = ALIGN( 8 ) ;
-    __heap_start__ = . ;
-    end = . ;
-    __end__ = . ;
-
-    .stab    0 (NOLOAD) : { *(.stab) }
-    .stabstr 0 (NOLOAD) : { *(.stabstr) }
-    /* DWARF debug sections. */
-    /* Symbols in the DWARF debugging sections are relative to the  */
-    /* beginning of the section so we begin them at 0.              */
-    /* DWARF 1 */
-    .debug           0 : { *(.debug) }
-    .line            0 : { *(.line) }
-    /* GNU DWARF 1 extensions */
-    .debug_srcinfo   0 : { *(.debug_srcinfo) }
-    .debug_sfnames   0 : { *(.debug_sfnames) }
-    /* DWARF 1.1 and DWARF 2 */
-    .debug_aranges   0 : { *(.debug_aranges) }
-    .debug_pubnames  0 : { *(.debug_pubnames) }
-    /* DWARF 2 */
-    .debug_info      0 : { *(.debug_info .gnu.linkonce.wi.*) }
-    .debug_abbrev    0 : { *(.debug_abbrev) }
-    .debug_line      0 : { *(.debug_line) }
-    .debug_frame     0 : { *(.debug_frame) }
-    .debug_str       0 : { *(.debug_str) }
-    .debug_loc       0 : { *(.debug_loc) }
-    .debug_macinfo   0 : { *(.debug_macinfo) }
-    /* SGI/MIPS DWARF 2 extensions */
-    .debug_weaknames 0 : { *(.debug_weaknames) }
-    .debug_funcnames 0 : { *(.debug_funcnames) }
-    .debug_typenames 0 : { *(.debug_typenames) }
-    .debug_varnames  0 : { *(.debug_varnames) }
-    /* DWARF 3 */
-    .debug_pubtypes  0 : { *(.debug_pubtypes) }
-    .debug_ranges    0 : { *(.debug_ranges) }
-    
-    .note.gnu.arm.ident 0 : { KEEP( *( .note.gnu.arm.ident ) ) }
-    .ARM.attributes     0 : {
-        KEEP( *( .ARM.attributes ) )
-        KEEP( *( .gnu.attributes ) )
-    }
-    /DISCARD/             : { *( .note.GNU-stack ) }
-    
-    /* C data can be defined as being in special purpose RAMs using
-     * __attribute__ ((section ("ethram"))) for example. */
-    .usbram (NOLOAD):
-    {
-        *( .usbram )
-        *( .usbram.* )
-    } > UsbRam
-    .ethram (NOLOAD):
-    {
-        *( .ethram )
-        *( .ethram.* )
-    } > EthRam
-    .canram (NOLOAD):
-    {
-        *( .canram )
-        *( .canram.* )
-    } > CanRam
-    .batram (NOLOAD):
-    {
-        *( .batram )
-        *( .batram.* )
-    } > BatRam
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_ARM/vector_functions.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/* .include "vector_defns.h" */
-
-
-
-.section .privileged_code, "ax"
-.arm
-
-
-.weak __mbed_fiq
-.weak __mbed_undef
-.weak __mbed_prefetch_abort
-.weak __mbed_data_abort
-.weak __mbed_irq
-.weak __mbed_swi
-.weak __mbed_dcc_irq
-.weak __mbed_reset
-.global __mbed_init_realmonitor
-/*  .global __mbed_init */
-
-
-
-
-__mbed_fiq:
-        B __mbed_fiq
-__mbed_undef:
-        LDR PC, =0x7fffffa0
-__mbed_prefetch_abort:
-        LDR PC, =0x7fffffb0
-__mbed_data_abort:
-        LDR PC, =0x7fffffc0
-__mbed_irq:
-        MSR CPSR_c, #0x1F|0x80|0x40
-        
-        STMDB sp!, {r0-r3,r12,lr}
-        
-        MOV r0, #0xFFFFFF00
-        LDR r0, [r0]
-        
-        MOV lr, pc
-        BX r0
-        
-        MOV r0, #0xFFFFFF00
-        STR r0, [r0] 
-        
-        LDMFD sp!,{r0-r3,r12,lr}
-        
-        MSR CPSR_c, #0x12|0x80|0x40
-        
-        SUBS pc, lr, #4
-__mbed_swi:
-        STMFD sp!, {a4, r4, ip, lr}
-        
-        LDR r4, =0x40000040
-        
-        LDR a4, =0x00940000
-        LDR PC, =0x7ffff820
-__mbed_dcc_irq:
-        LDMFD sp!,{r0-r3,r12,lr}
-        
-        MSR CPSR_c, #0x12|0x80|0x40
-        
-        SUB lr, lr, #4 
-        STMFD sp!, {ip,lr} 
-        
-        LDR LR, =0xfffff000
-        STR LR, [LR, #0xf00]
-        
-        LDR PC, =0x7fffffe0
-/*
- __mbed_reset is called after reset
- we setup the stacks and realmonitor, then call Reset_Handler like on M3
-*/
-
-.section .text, "ax"
-.arm
-.global Reset_handler
-Reset_Handler:   
-        .extern __libc_init_array
-        .extern  SystemInit
-        .extern  __wrap_main
-        LDR     R0, =SystemInit
-        MOV     LR, PC       
-        BX      R0
-
-        LDR     R0, =__libc_init_array
-        MOV     LR, PC       
-        BX      R0
-
-        LDR     R0, =__wrap_main
-        BX      R0
-
-__mbed_reset:
-        LDR R0, =( __SRAM_segment_end__ )
-        
-        MSR CPSR_c, #0x1B|0x80|0x40
-        MOV SP, R0
-        SUB R0, R0, #0x00000040
-        
-        MSR CPSR_c, #0x17|0x80|0x40
-        MOV SP, R0
-        SUB R0, R0, #0x00000040
-        
-        MSR CPSR_c, #0x11|0x80|0x40
-        MOV SP, R0
-        SUB R0, R0, #0x00000000
-        
-        MSR CPSR_c, #0x12|0x80|0x40
-        MOV SP, R0
-        SUB R0, R0, #0x00000040
-        
-        MSR CPSR_c, #0x13|0x80|0x40
-        MOV SP, R0
-        SUB R0, R0, #0x00000040
-        
-        MSR CPSR_c, #0x10
-        MOV SP, R0
-        
-/*  Relocate .data section (Copy from ROM to RAM) */
-        LDR     R1, =__text_end__        /* _etext */ 
-        LDR     R2, =__data_start__      /* _data  */
-        LDR     R3, =__data_end__        /* _edata */ 
-        CMP     R2, R3
-        BEQ     DataIsEmpty
-LoopRel:        CMP     R2, R3 
-        LDRLO   R0, [R1], #4 
-        STRLO   R0, [R2], #4 
-        BLO     LoopRel 
-DataIsEmpty:
-
-/*   Clear .bss section (Zero init) */
-        MOV     R0, #0 
-        LDR     R1, =__bss_start__ 
-        LDR     R2, =__bss_end__ 
-        CMP     R1,R2
-        BEQ     BSSIsEmpty
-LoopZI:         CMP     R1, R2 
-        STRLO   R0, [R1], #4 
-        BLO     LoopZI 
-BSSIsEmpty:
-
-
-/* Init realmonitor */
-        LDR R0, =__mbed_init_realmonitor
-        MOV LR, PC
-        BX R0
-        
-/* Go to Reset_Handler */ 
-        LDR     R0, =Reset_Handler
-        BX R0
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_ARM/vector_table.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-# 1 "vector_table.s"
-# 1 "<built-in>"
-# 1 "<command line>"
-# 1 "vector_table.s"
-;
-
-
-
-
-# 1 "vector_defns.h" 1
-# 7 "vector_table.s" 2
-
-;
-
-
-
-
-
-
-
-        .section .vectors, "ax"
-        .arm
-
-
-        .global __main
-        .global __mbed_reset
-        .global __mbed_undef
-        .global __mbed_swi
-        .global __mbed_prefetch_abort
-        .global __mbed_data_abort
-        .global __mbed_irq
-        .global __mbed_fiq
-
-;
-
-
-_start:
-        LDR PC, =__mbed_reset
-        LDR PC, =__mbed_undef
-        LDR PC, =__mbed_swi
-        LDR PC, =__mbed_prefetch_abort
-        LDR PC, =__mbed_data_abort
-        NOP ;
-        LDR PC, =__mbed_irq
-        LDR PC, =__mbed_fiq
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_CR/LPC2368.ld	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,210 +0,0 @@
-OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
-OUTPUT_ARCH(arm)
-ENTRY(vectors)
-
-GROUP( libgcc.a libc.a libm.a libcr_newlib_nohost.a  crti.o crtn.o crtbegin.o crtend.o )
-
-/* Memory Definitions: */
-MEMORY
-{
-    Flash  (rx)  : ORIGIN = 0x00000000, LENGTH = 512k
-    Ram    (rwx) : ORIGIN = 0x40000000, LENGTH = 32k
-    UsbRam (rw)  : ORIGIN = 0x7FD00000, LENGTH = 8k
-    EthRam (rw)  : ORIGIN = 0x7FE00000, LENGTH = 16k
-    CanRam (rw)  : ORIGIN = 0xE0038000, LENGTH = 2k
-    BatRam (rw)  : ORIGIN = 0xE0084000, LENGTH = 2k
-}
-
-/* Stack sizes: */
-UND_Stack_Size = 16;
-SVC_Stack_Size = 512;
-ABT_Stack_Size = 16;
-FIQ_Stack_Size = 16;
-IRQ_Stack_Size = 256;
-Stack_Size_Total = UND_Stack_Size + SVC_Stack_Size + ABT_Stack_Size + FIQ_Stack_Size + IRQ_Stack_Size;
-
-/* Stack tops for each mode: */
-__und_stack_top__ = __stacks_top__;
-__abt_stack_top__ = __und_stack_top__ - UND_Stack_Size ;
-__fiq_stack_top__ = __abt_stack_top__ - ABT_Stack_Size ;
-__irq_stack_top__ = __fiq_stack_top__ - FIQ_Stack_Size ;
-__svc_stack_top__ = __irq_stack_top__ - IRQ_Stack_Size ;
-
-/* C-accessible symbols for memory address ranges: */
-__FLASH_segment_start__ = ORIGIN( Flash );
-__FLASH_segment_end__   = ORIGIN( Flash ) + LENGTH( Flash );
-__SRAM_segment_start__  = ORIGIN( Ram );
-__SRAM_segment_end__    = ORIGIN( Ram ) + LENGTH( Ram );
-
-/* Stacks (full descending) at top of RAM, grows downward:
- *
- * __stack_min__ is used by the malloc implementation to ensure heap never collides
- * with stack (assuming stack never grows beyond Stack_Size_Total in length) */
-__stacks_top__ = __SRAM_segment_end__;
-__stacks_min__ = __SRAM_segment_end__ - Stack_Size_Total;
-
-SECTIONS
-{
-    /* first section is .text which is used for code */
-    __text_start__ = . ;
-    .text : {
-        __privileged_code_start__ = . ;
-        KEEP( *( .vectors ) )
-        *( .privileged_code )
-    
-        __privileged_code_end__ = .;
-
-        *( .text .text.* .gnu.linkonce.t.* )
-        *( .plt )
-        *( .gnu.warning )
-        *( .glue_7t ) *( .glue_7 ) *( .vfp11_veneer )
-        
-        *( .rodata .rodata.* .gnu.linkonce.r.* )
-        
-        *(.ARM.extab* .gnu.linkonce.armextab.*)
-        *(.gcc_except_table)
-        *(.eh_frame_hdr)
-        *(.eh_frame)
-        
-        . = ALIGN( 4 ) ;
-        KEEP( *( .init ) )
-        . = ALIGN( 4 ) ;
-        __preinit_array_start = . ;
-        KEEP( *( .preinit_array ) )
-        __preinit_array_end = . ;
-        . = ALIGN( 4 ) ;
-        __init_array_start = . ;
-        KEEP( *( SORT( .init_array.* ) ) )
-        KEEP( *( .init_array ) )
-        __init_array_end = . ;
-        
-        . = ALIGN( 4 ) ;
-        KEEP( *crtbegin.o( .ctors ) )
-        KEEP( *( EXCLUDE_FILE( *crtend.o ) .ctors ) )
-        KEEP( *( SORT( .ctors.* ) ) )
-        KEEP( *crtend.o( .ctors ) )
-        
-        . = ALIGN( 4 ) ;
-        KEEP( *( .fini ) )
-        . = ALIGN( 4 ) ;
-        __fini_array_start = . ;
-        KEEP( *( .fini_array ) )
-        KEEP( *( SORT( .fini_array.* ) ) )
-        __fini_array_end = . ;
-        
-        KEEP( *crtbegin.o( .dtors ) )
-        KEEP( *( EXCLUDE_FILE( *crtend.o ) .dtors ) )
-        KEEP( *( SORT( .dtors.* ) ) )
-        KEEP( *crtend.o( .dtors ) )
-    
-    } >Flash
-    
-    __exidx_start = . ;
-    .ARM.exidx : {
-        *( .ARM.exidx* .gnu.linkonce.armexidx.* )
-    } >Flash
-    __exidx_end = . ;
-    
-    .text.align : { . = ALIGN( 8 ) ; } >Flash /* Alignment schenanigans */
-    __text_end__ = . ;
-    
-    /* .bss section -- used for uninitialized data */
-    /* Located at the start of RAM */
-    .bss (NOLOAD) : {
-        __bss_start__ = . ;
-        *crt0.o( .ram_vectors )
-        
-        __user_bss_start__ = . ;
-        *( .user_bss )
-        __user_bss_end__ = . ;
-        
-        *( .shbss )
-        *( .bss .bss.* .gnu.linkonce.b.* )
-        *( COMMON )
-        *( .ram.b )
-        . = ALIGN( 8 ) ;
-        
-        __bss_end__ = . ;
-    } >Ram AT>Flash
-
-    /* .data section -- used for initialized data */
-    .data : {
-        __data_start__ = . ;
-        KEEP( *( .jcr ) )
-        *( .got.plt ) *( .got )
-        *( .shdata )
-        *( .data .data.* .gnu.linkonce.d.* )
-        *( .ram )
-        . = ALIGN( 8 ) ;
-        __data_end__ = . ;
-    } >Ram AT>Flash
-
-    __data_init_start__ = LOADADDR( .data ) ;
-
-    /* Heap starts here and grows up in memory */
-    . = ALIGN( 8 ) ;
-    __heap_start__ = . ;
-    _pvHeapStart = . ;
-    end = . ;
-
-    .stab    0 (NOLOAD) : { *(.stab) }
-    .stabstr 0 (NOLOAD) : { *(.stabstr) }
-    /* DWARF debug sections. */
-    /* Symbols in the DWARF debugging sections are relative to the  */
-    /* beginning of the section so we begin them at 0.              */
-    /* DWARF 1 */
-    .debug           0 : { *(.debug) }
-    .line            0 : { *(.line) }
-    /* GNU DWARF 1 extensions */
-    .debug_srcinfo   0 : { *(.debug_srcinfo) }
-    .debug_sfnames   0 : { *(.debug_sfnames) }
-    /* DWARF 1.1 and DWARF 2 */
-    .debug_aranges   0 : { *(.debug_aranges) }
-    .debug_pubnames  0 : { *(.debug_pubnames) }
-    /* DWARF 2 */
-    .debug_info      0 : { *(.debug_info .gnu.linkonce.wi.*) }
-    .debug_abbrev    0 : { *(.debug_abbrev) }
-    .debug_line      0 : { *(.debug_line) }
-    .debug_frame     0 : { *(.debug_frame) }
-    .debug_str       0 : { *(.debug_str) }
-    .debug_loc       0 : { *(.debug_loc) }
-    .debug_macinfo   0 : { *(.debug_macinfo) }
-    /* SGI/MIPS DWARF 2 extensions */
-    .debug_weaknames 0 : { *(.debug_weaknames) }
-    .debug_funcnames 0 : { *(.debug_funcnames) }
-    .debug_typenames 0 : { *(.debug_typenames) }
-    .debug_varnames  0 : { *(.debug_varnames) }
-    /* DWARF 3 */
-    .debug_pubtypes  0 : { *(.debug_pubtypes) }
-    .debug_ranges    0 : { *(.debug_ranges) }
-    
-    .note.gnu.arm.ident 0 : { KEEP( *( .note.gnu.arm.ident ) ) }
-    .ARM.attributes     0 : {
-        KEEP( *( .ARM.attributes ) )
-        KEEP( *( .gnu.attributes ) )
-    }
-    /DISCARD/             : { *( .note.GNU-stack ) }
-    
-    /* C data can be defined as being in special purpose RAMs using
-     * __attribute__ ((section ("ethram"))) for example. */
-    .usbram (NOLOAD):
-    {
-        *( .usbram )
-        *( .usbram.* )
-    } > UsbRam
-    .ethram (NOLOAD):
-    {
-        *( .ethram )
-        *( .ethram.* )
-    } > EthRam
-    .canram (NOLOAD):
-    {
-        *( .canram )
-        *( .canram.* )
-    } > CanRam
-    .batram (NOLOAD):
-    {
-        *( .batram )
-        *( .batram.* )
-    } > BatRam
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_CR/vector_functions.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/* .include "vector_defns.h" */
-
-
-
-.section .privileged_code, "ax"
-.arm
-
-
-.weak __mbed_fiq
-.weak __mbed_undef
-.weak __mbed_prefetch_abort
-.weak __mbed_data_abort
-.weak __mbed_irq
-.weak __mbed_swi
-.weak __mbed_dcc_irq
-.weak __mbed_reset
-.global __mbed_init_realmonitor
-/*  .global __mbed_init */
-
-
-
-
-__mbed_fiq:
-        B __mbed_fiq
-__mbed_undef:
-        LDR PC, =0x7fffffa0
-__mbed_prefetch_abort:
-        LDR PC, =0x7fffffb0
-__mbed_data_abort:
-        LDR PC, =0x7fffffc0
-__mbed_irq:
-        MSR CPSR_c, #0x1F|0x80|0x40
-        
-        STMDB sp!, {r0-r3,r12,lr}
-        
-        MOV r0, #0xFFFFFF00
-        LDR r0, [r0]
-        
-        MOV lr, pc
-        BX r0
-        
-        MOV r0, #0xFFFFFF00
-        STR r0, [r0] 
-        
-        LDMFD sp!,{r0-r3,r12,lr}
-        
-        MSR CPSR_c, #0x12|0x80|0x40
-        
-        SUBS pc, lr, #4
-__mbed_swi:
-        STMFD sp!, {a4, r4, ip, lr}
-        
-        LDR r4, =0x40000040
-        
-        LDR a4, =0x00940000
-        LDR PC, =0x7ffff820
-__mbed_dcc_irq:
-        LDMFD sp!,{r0-r3,r12,lr}
-        
-        MSR CPSR_c, #0x12|0x80|0x40
-        
-        SUB lr, lr, #4 
-        STMFD sp!, {ip,lr} 
-        
-        LDR LR, =0xfffff000
-        STR LR, [LR, #0xf00]
-        
-        LDR PC, =0x7fffffe0
-/*
- __mbed_reset is called after reset
- we setup the stacks and realmonitor, then call Reset_Handler like on M3
-*/
-
-.section .text, "ax"
-.arm
-.global Reset_handler
-Reset_Handler:   
-        .extern __libc_init_array
-        .extern  SystemInit
-        .extern  __wrap_main
-        LDR     R0, =SystemInit
-        MOV     LR, PC       
-        BX      R0
-
-        LDR     R0, =__libc_init_array
-        MOV     LR, PC       
-        BX      R0
-
-        LDR     R0, =__wrap_main
-        BX      R0
-
-__mbed_reset:
-        LDR R0, =( __SRAM_segment_end__ )
-        
-        MSR CPSR_c, #0x1B|0x80|0x40
-        MOV SP, R0
-        SUB R0, R0, #0x00000040
-        
-        MSR CPSR_c, #0x17|0x80|0x40
-        MOV SP, R0
-        SUB R0, R0, #0x00000040
-        
-        MSR CPSR_c, #0x11|0x80|0x40
-        MOV SP, R0
-        SUB R0, R0, #0x00000000
-        
-        MSR CPSR_c, #0x12|0x80|0x40
-        MOV SP, R0
-        SUB R0, R0, #0x00000040
-        
-        MSR CPSR_c, #0x13|0x80|0x40
-        MOV SP, R0
-        SUB R0, R0, #0x00000040
-        
-        MSR CPSR_c, #0x10
-        MOV SP, R0
-        
-/*  Relocate .data section (Copy from ROM to RAM) */
-        LDR     R1, =__text_end__        /* _etext */ 
-        LDR     R2, =__data_start__      /* _data  */
-        LDR     R3, =__data_end__        /* _edata */ 
-        CMP     R2, R3
-        BEQ     DataIsEmpty
-LoopRel:        CMP     R2, R3 
-        LDRLO   R0, [R1], #4 
-        STRLO   R0, [R2], #4 
-        BLO     LoopRel 
-DataIsEmpty:
-
-/*   Clear .bss section (Zero init) */
-        MOV     R0, #0 
-        LDR     R1, =__bss_start__ 
-        LDR     R2, =__bss_end__ 
-        CMP     R1,R2
-        BEQ     BSSIsEmpty
-LoopZI:         CMP     R1, R2 
-        STRLO   R0, [R1], #4 
-        BLO     LoopZI 
-BSSIsEmpty:
-
-
-/* Init realmonitor */
-        LDR R0, =__mbed_init_realmonitor
-        MOV LR, PC
-        BX R0
-        
-/* Go to Reset_Handler */ 
-        LDR     R0, =Reset_Handler
-        BX R0
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_CR/vector_table.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-# 1 "vector_table.s"
-# 1 "<built-in>"
-# 1 "<command line>"
-# 1 "vector_table.s"
-;
-
-
-
-
-# 1 "vector_defns.h" 1
-# 7 "vector_table.s" 2
-
-;
-
-
-
-
-
-
-
-        .section .vectors, "ax"
-        .arm
-
-
-        .global __main
-        .global __mbed_reset
-        .global __mbed_undef
-        .global __mbed_swi
-        .global __mbed_prefetch_abort
-        .global __mbed_data_abort
-        .global __mbed_irq
-        .global __mbed_fiq
-
-;
-
-
-_start:
-        LDR PC, =__mbed_reset
-        LDR PC, =__mbed_undef
-        LDR PC, =__mbed_swi
-        LDR PC, =__mbed_prefetch_abort
-        LDR PC, =__mbed_data_abort
-        NOP ;
-        LDR PC, =__mbed_irq
-        LDR PC, =__mbed_fiq
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_CS/LPC2368.ld	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +0,0 @@
-OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
-OUTPUT_ARCH(arm)
-ENTRY(vectors)
-GROUP(-lsupc++ -lm -lc -lcs3unhosted -lcs3 -lgcc)
-
-/* Memory Definitions: */
-MEMORY
-{
-    Flash  (rx)  : ORIGIN = 0x00000000, LENGTH = 512k
-    Ram    (rwx) : ORIGIN = 0x40000000, LENGTH = 32k
-    UsbRam (rw)  : ORIGIN = 0x7FD00000, LENGTH = 8k
-    EthRam (rw)  : ORIGIN = 0x7FE00000, LENGTH = 16k
-    CanRam (rw)  : ORIGIN = 0xE0038000, LENGTH = 2k
-    BatRam (rw)  : ORIGIN = 0xE0084000, LENGTH = 2k
-}
-
-/* Stack sizes: */
-UND_Stack_Size = 16;
-SVC_Stack_Size = 512;
-ABT_Stack_Size = 16;
-FIQ_Stack_Size = 16;
-IRQ_Stack_Size = 256;
-Stack_Size_Total = UND_Stack_Size + SVC_Stack_Size + ABT_Stack_Size + FIQ_Stack_Size + IRQ_Stack_Size;
-
-/* Stack tops for each mode: */
-__und_stack_top__ = __stacks_top__;
-__abt_stack_top__ = __und_stack_top__ - UND_Stack_Size ;
-__fiq_stack_top__ = __abt_stack_top__ - ABT_Stack_Size ;
-__irq_stack_top__ = __fiq_stack_top__ - FIQ_Stack_Size ;
-__svc_stack_top__ = __irq_stack_top__ - IRQ_Stack_Size ;
-
-/* C-accessible symbols for memory address ranges: */
-__FLASH_segment_start__ = ORIGIN( Flash );
-__FLASH_segment_end__   = ORIGIN( Flash ) + LENGTH( Flash );
-__SRAM_segment_start__  = ORIGIN( Ram );
-__SRAM_segment_end__    = ORIGIN( Ram ) + LENGTH( Ram );
-
-/* Stacks (full descending) at top of RAM, grows downward:
- *
- * __stack_min__ is used by the malloc implementation to ensure heap never collides
- * with stack (assuming stack never grows beyond Stack_Size_Total in length) */
-__stacks_top__ = __SRAM_segment_end__;
-__stacks_min__ = __SRAM_segment_end__ - Stack_Size_Total;
-
-SECTIONS
-{
-    /* first section is .text which is used for code */
-    __text_start__ = . ;
-    .text : {
-        __privileged_code_start__ = . ;
-        KEEP( *( .vectors ) )
-        *( .privileged_code )
-    
-        __privileged_code_end__ = .;
-
-        *( .text .text.* .gnu.linkonce.t.* )
-        *( .plt )
-        *( .gnu.warning )
-        *( .glue_7t ) *( .glue_7 ) *( .vfp11_veneer )
-        
-        *( .rodata .rodata.* .gnu.linkonce.r.* )
-        
-        *(.ARM.extab* .gnu.linkonce.armextab.*)
-        *(.gcc_except_table)
-        *(.eh_frame_hdr)
-        *(.eh_frame)
-        
-        . = ALIGN( 4 ) ;
-        KEEP( *( .init ) )
-        . = ALIGN( 4 ) ;
-        __preinit_array_start = . ;
-        KEEP( *( .preinit_array ) )
-        __preinit_array_end = . ;
-        . = ALIGN( 4 ) ;
-        __init_array_start = . ;
-        KEEP( *( SORT( .init_array.* ) ) )
-        KEEP( *( .init_array ) )
-        __init_array_end = . ;
-        
-        . = ALIGN( 4 ) ;
-        KEEP( *crtbegin.o( .ctors ) )
-        KEEP( *( EXCLUDE_FILE( *crtend.o ) .ctors ) )
-        KEEP( *( SORT( .ctors.* ) ) )
-        KEEP( *crtend.o( .ctors ) )
-        
-        . = ALIGN( 4 ) ;
-        KEEP( *( .fini ) )
-        . = ALIGN( 4 ) ;
-        __fini_array_start = . ;
-        KEEP( *( .fini_array ) )
-        KEEP( *( SORT( .fini_array.* ) ) )
-        __fini_array_end = . ;
-        
-        KEEP( *crtbegin.o( .dtors ) )
-        KEEP( *( EXCLUDE_FILE( *crtend.o ) .dtors ) )
-        KEEP( *( SORT( .dtors.* ) ) )
-        KEEP( *crtend.o( .dtors ) )
-    
-    } >Flash
-    
-    __exidx_start = . ;
-    .ARM.exidx : {
-        *( .ARM.exidx* .gnu.linkonce.armexidx.* )
-    } >Flash
-    __exidx_end = . ;
-    
-    .text.align : { . = ALIGN( 8 ) ; } >Flash /* Alignment schenanigans */
-    __text_end__ = . ;
-    
-    /* .bss section -- used for uninitialized data */
-    /* Located at the start of RAM */
-    .bss (NOLOAD) : {
-        __bss_start__ = . ;
-        *crt0.o( .ram_vectors )
-        
-        __user_bss_start__ = . ;
-        *( .user_bss )
-        __user_bss_end__ = . ;
-        
-        *( .shbss )
-        *( .bss .bss.* .gnu.linkonce.b.* )
-        *( COMMON )
-        *( .ram.b )
-        . = ALIGN( 8 ) ;
-        
-        __bss_end__ = . ;
-    } >Ram AT>Flash
-
-    /* .data section -- used for initialized data */
-    .data : {
-        __data_start__ = . ;
-        KEEP( *( .jcr ) )
-        *( .got.plt ) *( .got )
-        *( .shdata )
-        *( .data .data.* .gnu.linkonce.d.* )
-        *( .ram )
-        . = ALIGN( 8 ) ;
-        __data_end__ = . ;
-    } >Ram AT>Flash
-
-    __data_init_start__ = LOADADDR( .data ) ;
-
-    /* Heap starts here and grows up in memory */
-    . = ALIGN( 8 ) ;
-    __heap_start__ = . ;
-
-    .stab    0 (NOLOAD) : { *(.stab) }
-    .stabstr 0 (NOLOAD) : { *(.stabstr) }
-    /* DWARF debug sections. */
-    /* Symbols in the DWARF debugging sections are relative to the  */
-    /* beginning of the section so we begin them at 0.              */
-    /* DWARF 1 */
-    .debug           0 : { *(.debug) }
-    .line            0 : { *(.line) }
-    /* GNU DWARF 1 extensions */
-    .debug_srcinfo   0 : { *(.debug_srcinfo) }
-    .debug_sfnames   0 : { *(.debug_sfnames) }
-    /* DWARF 1.1 and DWARF 2 */
-    .debug_aranges   0 : { *(.debug_aranges) }
-    .debug_pubnames  0 : { *(.debug_pubnames) }
-    /* DWARF 2 */
-    .debug_info      0 : { *(.debug_info .gnu.linkonce.wi.*) }
-    .debug_abbrev    0 : { *(.debug_abbrev) }
-    .debug_line      0 : { *(.debug_line) }
-    .debug_frame     0 : { *(.debug_frame) }
-    .debug_str       0 : { *(.debug_str) }
-    .debug_loc       0 : { *(.debug_loc) }
-    .debug_macinfo   0 : { *(.debug_macinfo) }
-    /* SGI/MIPS DWARF 2 extensions */
-    .debug_weaknames 0 : { *(.debug_weaknames) }
-    .debug_funcnames 0 : { *(.debug_funcnames) }
-    .debug_typenames 0 : { *(.debug_typenames) }
-    .debug_varnames  0 : { *(.debug_varnames) }
-    /* DWARF 3 */
-    .debug_pubtypes  0 : { *(.debug_pubtypes) }
-    .debug_ranges    0 : { *(.debug_ranges) }
-    
-    .note.gnu.arm.ident 0 : { KEEP( *( .note.gnu.arm.ident ) ) }
-    .ARM.attributes     0 : {
-        KEEP( *( .ARM.attributes ) )
-        KEEP( *( .gnu.attributes ) )
-    }
-    /DISCARD/             : { *( .note.GNU-stack ) }
-    
-    /* C data can be defined as being in special purpose RAMs using
-     * __attribute__ ((section ("ethram"))) for example. */
-    .usbram (NOLOAD):
-    {
-        *( .usbram )
-        *( .usbram.* )
-    } > UsbRam
-    .ethram (NOLOAD):
-    {
-        *( .ethram )
-        *( .ethram.* )
-    } > EthRam
-    .canram (NOLOAD):
-    {
-        *( .canram )
-        *( .canram.* )
-    } > CanRam
-    .batram (NOLOAD):
-    {
-        *( .batram )
-        *( .batram.* )
-    } > BatRam
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_CS/vector_functions.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-# 1 "vector_functions.s"
-# 1 "<built-in>"
-# 1 "<command line>"
-# 1 "vector_functions.s"
-;
-;
-;
-
-# 1 "vector_defns.h" 1
-# 6 "vector_functions.s" 2
-
-
-
-
-
-
-        .section VECFUNCS, "ax"
-        .arm
-
-
-        .weak __mbed_fiq
-        .weak __mbed_undef
-        .weak __mbed_prefetch_abort
-        .weak __mbed_data_abort
-        .weak __mbed_irq
-        .weak __mbed_swi
-        .weak __mbed_dcc_irq
-        .weak __mbed_reset
-        .global __mbed_init_realmonitor
-        .global __mbed_init
-
-;
-;
-__mbed_fiq:
-        B __mbed_fiq
-
-;
-;
-__mbed_undef:
-        LDR PC, =0x7fffffa0
-
-;
-;
-__mbed_prefetch_abort:
-        LDR PC, =0x7fffffb0
-
-;
-;
-__mbed_data_abort:
-        LDR PC, =0x7fffffc0
-
-;
-;
-;
-;
-;
-;
-;
-;
-;
-__mbed_irq:
-        ;
-        MSR CPSR_c, #0x1F|0x80|0x40
-
-        ;
-        STMDB sp!, {r0-r3,r12,lr}
-
-        ;
-        MOV r0, #0xFFFFFF00
-        LDR r0, [r0]
-
-        ;
-        MOV lr, pc
-        BX r0
-
-        ;
-        MOV r0, #0xFFFFFF00
-        STR r0, [r0] ;
-
-        ;
-        LDMFD sp!,{r0-r3,r12,lr}
-
-        ;
-        MSR CPSR_c, #0x12|0x80|0x40
-
-        ;
-        SUBS pc, lr, #4
-
-;
-;
-;
-;
-__mbed_swi:
-        ;
-        ;
-        STMFD sp!, {a4, r4, ip, lr}
-
-        ;
-        LDR r4, =0x40000040
-
-        ;
-        ;
-        LDR a4, =0x00940000
-        LDR PC, =0x7ffff820
-
-;
-;
-;
-;
-__mbed_dcc_irq:
-
-        ;
-
-        ;
-        LDMFD sp!,{r0-r3,r12,lr}
-
-        ;
-        MSR CPSR_c, #0x12|0x80|0x40
-
-        ;
-
-        ;
-        SUB lr, lr, #4 ;
-        STMFD sp!, {ip,lr} ;
-
-        ;
-        LDR LR, =0xfffff000
-        STR LR, [LR, #0xf00]
-
-        ;
-        ;
-        ;
-        ;
-        LDR PC, =0x7fffffe0
-
-;
-;
-__mbed_reset:
-
-        ;
-
-        LDR R0, =(0x40000000 + 0x8000)
-
-        ;
-        MSR CPSR_c, #0x1B|0x80|0x40
-        MOV SP, R0
-        SUB R0, R0, #0x00000040
-
-        ;
-        MSR CPSR_c, #0x17|0x80|0x40
-        MOV SP, R0
-        SUB R0, R0, #0x00000040
-
-        ;
-        MSR CPSR_c, #0x11|0x80|0x40
-        MOV SP, R0
-        SUB R0, R0, #0x00000000
-
-        ;
-        MSR CPSR_c, #0x12|0x80|0x40
-        MOV SP, R0
-        SUB R0, R0, #0x00000040
-
-        ;
-        MSR CPSR_c, #0x13|0x80|0x40
-        MOV SP, R0
-        SUB R0, R0, #0x00000040
-
-        ;
-        MSR CPSR_c, #0x10
-        MOV SP, R0
-
-        ;
-        LDR R0, =__mbed_init_realmonitor
-        MOV LR, PC
-        BX R0
-
-        ;
-        LDR R0, =__mbed_init
-        BX R0
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/TOOLCHAIN_GCC_CS/vector_table.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-# 1 "vector_table.s"
-# 1 "<built-in>"
-# 1 "<command line>"
-# 1 "vector_table.s"
-;
-
-
-
-
-# 1 "vector_defns.h" 1
-# 7 "vector_table.s" 2
-
-;
-
-
-
-
-
-
-
-        .section VECTOR_TABLE, "ax"
-        .arm
-
-
-        .global __main
-        .global __mbed_reset
-        .global __mbed_undef
-        .global __mbed_swi
-        .global __mbed_prefetch_abort
-        .global __mbed_data_abort
-        .global __mbed_irq
-        .global __mbed_fiq
-
-;
-
-
-__main:
-        LDR PC, =__mbed_reset
-        LDR PC, =__mbed_undef
-        LDR PC, =__mbed_swi
-        LDR PC, =__mbed_prefetch_abort
-        LDR PC, =__mbed_data_abort
-        NOP ;
-        LDR PC, =__mbed_irq
-        LDR PC, =__mbed_fiq
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/cmsis.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-/* mbed Microcontroller Library - CMSIS
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * A generic CMSIS include header, pulling in LPC2368 specifics
- */
-
-#ifndef MBED_CMSIS_H
-#define MBED_CMSIS_H
-
-#include "LPC23xx.h"
-#include "cmsis_nvic.h"
-
-#endif
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/cmsis_nvic.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic for LPC2368
- * Copyright (c) 2009 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */ 
-
-#include "cmsis_nvic.h"
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
-    LPC_VIC->VectAddr[(int)IRQn] = vector;
-}
-
-uint32_t NVIC_GetVector(IRQn_Type IRQn) {
-    return LPC_VIC->VectAddr[(int)IRQn];
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/cmsis_nvic.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */ 
-
-#ifndef MBED_CMSIS_NVIC_H
-#define MBED_CMSIS_NVIC_H
-
-#define NVIC_NUM_VECTORS      32
-#define NVIC_USER_IRQ_OFFSET  0
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
-uint32_t NVIC_GetVector(IRQn_Type IRQn);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/core_arm7.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (C) 2008-2009 ARM Limited. All rights reserved.
- *
- * ARM7 version of CMSIS-like functionality - not advised for use outside mbed!
- * based on core_cm3.h, V1.20
- */
-
-#include <stdint.h>
-
-
-/* define compiler specific symbols */
-#if defined   ( __CC_ARM   )
-  #define __ASM            __asm           /*!< asm keyword for armcc           */
-  #define __INLINE         __inline        /*!< inline keyword for armcc        */
-
-#elif defined ( __ICCARM__ )
-  #define __ASM           __asm            /*!< asm keyword for iarcc           */
-  #define __INLINE        inline           /*!< inline keyword for iarcc. Only avaiable in High optimization mode! */
-
-#elif defined (  __GNUC__  )
-  #define __ASM             __asm          /*!< asm keyword for gcc            */
-  #define __INLINE          inline         /*!< inline keyword for gcc         */
-
-#elif defined   (  __TASKING__  )
-  #define __ASM            __asm           /*!< asm keyword for TASKING Compiler          */
-  #define __INLINE         inline          /*!< inline keyword for TASKING Compiler       */
-
-#endif
-
-#if defined ( __CC_ARM   )
-/**
- * @brief  Return the Main Stack Pointer (return current ARM7 stack)
- *
- * @param  none
- * @return uint32_t Main Stack Pointer
- *
- * Return the current value of the MSP (main stack pointer)
- * Cortex processor register
- */
-uint32_t __get_MSP(void)
-{
-    return __current_sp();
-}
-#endif
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/core_arm7.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,276 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (C) 2008-2009 ARM Limited. All rights reserved.
- *
- * ARM7 version of CMSIS-like functionality - not advised for use outside mbed!
- * based on core_cm3.h, V1.20
- */
-
-#ifndef __ARM7_CORE_H__
-#define __ARM7_CORE_H__
-
-#include "vector_defns.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-#define __CM3_CMSIS_VERSION_MAIN  (0x01)                                                       /*!< [31:16] CMSIS HAL main version */
-#define __CM3_CMSIS_VERSION_SUB   (0x20)                                                       /*!< [15:0]  CMSIS HAL sub version  */
-#define __CM3_CMSIS_VERSION       ((__CM3_CMSIS_VERSION_MAIN << 16) | __CM3_CMSIS_VERSION_SUB) /*!< CMSIS HAL version number       */
-
-#define __CORTEX_M                (0x03)                                                       /*!< Cortex core                    */
-
-/**
- *  Lint configuration \n
- *  ----------------------- \n
- *
- *  The following Lint messages will be suppressed and not shown: \n
- *  \n
- *    --- Error 10: --- \n
- *    register uint32_t __regBasePri         __asm("basepri"); \n
- *    Error 10: Expecting ';' \n
- *     \n
- *    --- Error 530: --- \n
- *    return(__regBasePri); \n
- *    Warning 530: Symbol '__regBasePri' (line 264) not initialized \n
- *     \n
- *    --- Error 550: --- \n
- *      __regBasePri = (basePri & 0x1ff); \n
- *    } \n
- *    Warning 550: Symbol '__regBasePri' (line 271) not accessed \n
- *     \n
- *    --- Error 754: --- \n
- *    uint32_t RESERVED0[24]; \n
- *    Info 754: local structure member '<some, not used in the HAL>' (line 109, file ./cm3_core.h) not referenced \n
- *     \n
- *    --- Error 750: --- \n
- *    #define __CM3_CORE_H__ \n
- *    Info 750: local macro '__CM3_CORE_H__' (line 43, file./cm3_core.h) not referenced \n
- *     \n
- *    --- Error 528: --- \n
- *    static __INLINE void NVIC_DisableIRQ(uint32_t IRQn) \n
- *    Warning 528: Symbol 'NVIC_DisableIRQ(unsigned int)' (line 419, file ./cm3_core.h) not referenced \n
- *     \n
- *    --- Error 751: --- \n
- *    } InterruptType_Type; \n
- *    Info 751: local typedef 'InterruptType_Type' (line 170, file ./cm3_core.h) not referenced \n
- * \n
- * \n
- *    Note:  To re-enable a Message, insert a space before 'lint' * \n
- *
- */
-
-/*lint -save */
-/*lint -e10  */
-/*lint -e530 */
-/*lint -e550 */
-/*lint -e754 */
-/*lint -e750 */
-/*lint -e528 */
-/*lint -e751 */
-
-#include <stdint.h>                           /* Include standard types */
-
-#if defined ( __CC_ARM   )
-/**
- * @brief  Return the Main Stack Pointer (current ARM7 stack)
- *
- * @param  none
- * @return uint32_t Main Stack Pointer
- *
- * Return the current value of the MSP (main stack pointer)
- * Cortex processor register
- */
-extern uint32_t __get_MSP(void);
-#endif
-
-
-#if defined (__ICCARM__)
-  #include <intrinsics.h>                     /* IAR Intrinsics   */
-#endif
-
-
-#ifndef __NVIC_PRIO_BITS
-  #define __NVIC_PRIO_BITS    4               /*!< standard definition for NVIC Priority Bits */
-#endif
-
-typedef struct
-{
-  uint32_t IRQStatus;
-  uint32_t FIQStatus;
-  uint32_t RawIntr;
-  uint32_t IntSelect;
-  uint32_t IntEnable;
-  uint32_t IntEnClr;
-  uint32_t SoftInt;
-  uint32_t SoftIntClr;
-  uint32_t Protection;
-  uint32_t SWPriorityMask;
-  uint32_t RESERVED0[54];
-  uint32_t VectAddr[32];
-  uint32_t RESERVED1[32];
-  uint32_t VectPriority[32];
-  uint32_t RESERVED2[800];
-  uint32_t Address;
-} NVIC_TypeDef;
-
-#define NVIC_BASE              (0xFFFFF000)
-#define NVIC                   ((      NVIC_TypeDef *)       NVIC_BASE)
-
-
-
-/**
- * IO definitions
- *
- * define access restrictions to peripheral registers
- */
-
-#ifdef __cplusplus
-#define     __I     volatile                  /*!< defines 'read only' permissions      */
-#else
-#define     __I     volatile const            /*!< defines 'read only' permissions      */
-#endif
-#define     __O     volatile                  /*!< defines 'write only' permissions     */
-#define     __IO    volatile                  /*!< defines 'read / write' permissions   */
-
-
-
-
-
-#if defined ( __CC_ARM   )
-  #define __ASM            __asm                                      /*!< asm keyword for ARM Compiler          */
-  #define __INLINE         __inline                                   /*!< inline keyword for ARM Compiler       */
-
-#elif defined ( __ICCARM__ )
-  #define __ASM           __asm                                       /*!< asm keyword for IAR Compiler           */
-  #define __INLINE        inline                                      /*!< inline keyword for IAR Compiler. Only avaiable in High optimization mode! */
-
-#elif defined   (  __GNUC__  )
-  #define __ASM            __asm                                      /*!< asm keyword for GNU Compiler          */
-  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
-
-#elif defined   (  __TASKING__  )
-  #define __ASM            __asm                                      /*!< asm keyword for TASKING Compiler          */
-  #define __INLINE         inline                                     /*!< inline keyword for TASKING Compiler       */
-
-#endif
-
-
-/* ###################  Compiler specific Intrinsics  ########################### */
-
-#if defined ( __CC_ARM   ) /*------------------RealView Compiler -----------------*/
-/* ARM armcc specific functions */
-
-#define __enable_fault_irq                __enable_fiq
-#define __disable_fault_irq               __disable_fiq
-
-#define __NOP                             __nop
-//#define __WFI                             __wfi
-//#define __WFE                             __wfe
-//#define __SEV                             __sev
-//#define __ISB()                           __isb(0)
-//#define __DSB()                           __dsb(0)
-//#define __DMB()                           __dmb(0)
-//#define __REV                             __rev
-//#define __RBIT                            __rbit
-#define __LDREXB(ptr)                     ((unsigned char ) __ldrex(ptr))
-#define __LDREXH(ptr)                     ((unsigned short) __ldrex(ptr))
-#define __LDREXW(ptr)                     ((unsigned int  ) __ldrex(ptr))
-#define __STREXB(value, ptr)              __strex(value, ptr)
-#define __STREXH(value, ptr)              __strex(value, ptr)
-#define __STREXW(value, ptr)              __strex(value, ptr)
-
-#define __disable_irq()         unsigned tmp_IntEnable = LPC_VIC->IntEnable; \
-                                LPC_VIC->IntEnClr = 0xffffffff
-
-#define __enable_irq()          LPC_VIC->IntEnable = tmp_IntEnable
-
-#elif (defined (__ICCARM__)) /*------------------ ICC Compiler -------------------*/
-
-#define __enable_irq                              __enable_interrupt        /*!< global Interrupt enable */
-#define __disable_irq                             __disable_interrupt       /*!< global Interrupt disable */
-#define __NOP                                     __no_operation()          /*!< no operation intrinsic in IAR Compiler */ 
-
-#elif (defined (__GNUC__)) /*------------------ GNU Compiler ---------------------*/
-
-static __INLINE void __enable_irq() {
-    unsigned long temp;
-    __asm__ __volatile__("mrs %0, cpsr\n"
-                         "bic %0, %0, #0x80\n"
-                         "msr cpsr_c, %0"
-                         : "=r" (temp)
-                         :
-                         : "memory");
-}
-
-static __INLINE void __disable_irq() {
-    unsigned long old,temp;
-    __asm__ __volatile__("mrs %0, cpsr\n"
-                         "orr %1, %0, #0xc0\n"
-                         "msr cpsr_c, %1"
-                         : "=r" (old), "=r" (temp)
-                         :
-                         : "memory");
-    // return (old & 0x80) == 0;
-}
-
-static __INLINE void __NOP()                      { __ASM volatile ("nop"); }
-
-#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
-
-
-/**
- * @brief  Enable Interrupt in NVIC Interrupt Controller
- *
- * @param  IRQn_Type IRQn specifies the interrupt number
- * @return none 
- *
- * Enable a device specific interupt in the NVIC interrupt controller.
- * The interrupt number cannot be a negative value.
- */
-static __INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
-{
- NVIC->IntEnable = 1 << (uint32_t)IRQn;
-}
-
-
-/**
- * @brief  Disable the interrupt line for external interrupt specified
- * 
- * @param  IRQn_Type IRQn is the positive number of the external interrupt
- * @return none
- * 
- * Disable a device specific interupt in the NVIC interrupt controller.
- * The interrupt number cannot be a negative value.
- */
-static __INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
-{
- NVIC->IntEnClr = 1 << (uint32_t)IRQn;
-}
-
-static __INLINE uint32_t __get_IPSR(void)
-{
- unsigned i;
-
- for(i = 0; i < 32; i ++)
-   if(NVIC->Address == NVIC->VectAddr[i])
-     return i;
- return 1; // 1 is an invalid entry in the interrupt table on LPC2368
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __ARM7_CORE_H__ */
-
-/*lint -restore */
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/system_LPC23xx.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (C) 2008-2009 ARM Limited. All rights reserved.
- *
- * ARM7 version of CMSIS-like functionality - not advised for use outside mbed!
- */
-
-#include <stdint.h>
-#include "LPC23xx.h"
-
-#define CLOCK_SETUP           1
-#define SCS_Val               0x00000020
-#define CLKSRCSEL_Val         0x00000001
-
-#define PLL0_SETUP            1
-#define PLL0CFG_Val           0x00000013
-#define CCLKCFG_Val           0x00000007
-#define USBCLKCFG_Val         0x00000009
-#define PCLKSEL0_Val          0x00000000
-#define PCLKSEL1_Val          0x00000000
-#define PCONP_Val             0x042887DE
-#define CLKOUTCFG_Val         0x00000000
-#define MAMCR_Val             0x00000001  // there is a bug in the MAM so it should never be fully enabled (only disabled or partially enabled)
-#define MAMTIM_Val            0x00000004
-
-/*----------------------------------------------------------------------------
-  DEFINES
- *----------------------------------------------------------------------------*/
-    
-#define XTAL        (12000000UL)        /* Oscillator frequency               */
-#define OSC_CLK     (      XTAL)        /* Main oscillator frequency          */
-#define RTC_CLK     (   32000UL)        /* RTC oscillator frequency           */
-#define IRC_OSC     ( 4000000UL)        /* Internal RC oscillator frequency   */
-
-/* F_cco0 = (2 * M * F_in) / N  */
-#define __M               (((PLL0CFG_Val      ) & 0x7FFF) + 1)
-#define __N               (((PLL0CFG_Val >> 16) & 0x00FF) + 1)
-#define __FCCO(__F_IN)    ((2 * __M * __F_IN) / __N) 
-#define __CCLK_DIV        (((CCLKCFG_Val      ) & 0x00FF) + 1)
-
-/* Determine core clock frequency according to settings */
- #if (PLL0_SETUP)
-    #if   ((CLKSRCSEL_Val & 0x03) == 1)
-        #define __CORE_CLK (__FCCO(OSC_CLK) / __CCLK_DIV)
-    #elif ((CLKSRCSEL_Val & 0x03) == 2)
-        #define __CORE_CLK (__FCCO(RTC_CLK) / __CCLK_DIV)
-    #else 
-        #define __CORE_CLK (__FCCO(IRC_OSC) / __CCLK_DIV)
-    #endif
- #endif
-
-
-/*----------------------------------------------------------------------------
-  Clock Variable definitions
- *----------------------------------------------------------------------------*/
-uint32_t SystemCoreClock = __CORE_CLK;/*!< System Clock Frequency (Core Clock)*/
-
-/*----------------------------------------------------------------------------
-  Clock functions
- *----------------------------------------------------------------------------*/
-void SystemCoreClockUpdate (void)            /* Get Core Clock Frequency      */
-{
-  /* Determine clock frequency according to clock register values             */
-  if (((LPC_SC->PLL0STAT >> 24) & 3) == 3) { /* If PLL0 enabled and connected */
-    switch (LPC_SC->CLKSRCSEL & 0x03) {
-      case 0:                                /* Int. RC oscillator => PLL0    */
-      case 3:                                /* Reserved, default to Int. RC  */
-        SystemCoreClock = (IRC_OSC * 
-                          (((2 * ((LPC_SC->PLL0STAT & 0x7FFF) + 1))) /
-                          (((LPC_SC->PLL0STAT >> 16) & 0xFF) + 1))   /
-                          ((LPC_SC->CCLKCFG & 0xFF)+ 1));
-        break;
-      case 1:                                /* Main oscillator => PLL0       */
-        SystemCoreClock = (OSC_CLK * 
-                          (((2 * ((LPC_SC->PLL0STAT & 0x7FFF) + 1))) /
-                          (((LPC_SC->PLL0STAT >> 16) & 0xFF) + 1))   /
-                          ((LPC_SC->CCLKCFG & 0xFF)+ 1));
-        break;
-      case 2:                                /* RTC oscillator => PLL0        */
-        SystemCoreClock = (RTC_CLK * 
-                          (((2 * ((LPC_SC->PLL0STAT & 0x7FFF) + 1))) /
-                          (((LPC_SC->PLL0STAT >> 16) & 0xFF) + 1))   /
-                          ((LPC_SC->CCLKCFG & 0xFF)+ 1));
-        break;
-    }
-  } else {
-    switch (LPC_SC->CLKSRCSEL & 0x03) {
-      case 0:                                /* Int. RC oscillator => PLL0    */
-      case 3:                                /* Reserved, default to Int. RC  */
-        SystemCoreClock = IRC_OSC / ((LPC_SC->CCLKCFG & 0xFF)+ 1);
-        break;
-      case 1:                                /* Main oscillator => PLL0       */
-        SystemCoreClock = OSC_CLK / ((LPC_SC->CCLKCFG & 0xFF)+ 1);
-        break;
-      case 2:                                /* RTC oscillator => PLL0        */
-        SystemCoreClock = RTC_CLK / ((LPC_SC->CCLKCFG & 0xFF)+ 1);
-        break;
-    }
-  }
-}
-
-/**
- * Initialize the system
- *
- * @param  none
- * @return none
- *
- * @brief  Setup the microcontroller system.
- *         Initialize the System and update the SystemFrequency variable.
- */
-void SystemInit (void)
-{
-#if (CLOCK_SETUP)                       /* Clock Setup                        */
-  LPC_SC->SCS       = SCS_Val;
-  if (SCS_Val & (1 << 5)) {             /* If Main Oscillator is enabled      */
-    while ((LPC_SC->SCS & (1 << 6)) == 0);  /* Wait for Oscillator to be ready    */
-  }
-
-  LPC_SC->CCLKCFG   = CCLKCFG_Val;          /* Setup Clock Divider                */
-
-#if (PLL0_SETUP)
-  LPC_SC->CLKSRCSEL = CLKSRCSEL_Val;        /* Select Clock Source for PLL0       */
-  LPC_SC->PLL0CFG   = PLL0CFG_Val;
-  LPC_SC->PLL0CON   = 0x01;                 /* PLL0 Enable                        */
-  LPC_SC->PLL0FEED  = 0xAA;
-  LPC_SC->PLL0FEED  = 0x55;
-  while (!(LPC_SC->PLL0STAT & (1 << 26)));  /* Wait for PLOCK0                    */
-
-  LPC_SC->PLL0CON   = 0x03;                 /* PLL0 Enable & Connect              */
-  LPC_SC->PLL0FEED  = 0xAA;
-  LPC_SC->PLL0FEED  = 0x55;
-#endif
-
-  LPC_SC->USBCLKCFG = USBCLKCFG_Val;        /* Setup USB Clock Divider            */
-#endif
-
-  LPC_SC->PCLKSEL0  = PCLKSEL0_Val;         /* Peripheral Clock Selection         */
-  LPC_SC->PCLKSEL1  = PCLKSEL1_Val;
-
-  LPC_SC->PCONP     = PCONP_Val;            /* Power Control for Peripherals      */
-    
-  // Setup MAM
-  LPC_SC->MAMTIM      = MAMTIM_Val;
-  LPC_SC->MAMCR       = MAMCR_Val;
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/system_LPC23xx.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (C) 2008-2009 ARM Limited. All rights reserved.
- *
- * ARM7 version of CMSIS-like functionality - not advised for use outside mbed!
- * based on cmsis system_LPC17xx.h 
- */
-
-#ifndef __SYSTEM_LPC23xx_H
-#define __SYSTEM_LPC23xx_H
-
-#ifdef __cplusplus
- extern "C" {
-#endif 
-
-extern uint32_t SystemCoreClock;     /*!< System Clock Frequency (Core Clock)  */
-
-/**
- * Initialize the system
- *
- * @param  none
- * @return none
- *
- * @brief  Setup the microcontroller system.
- *         Initialize the System and update the SystemCoreClock variable.
- */
-extern void SystemInit (void);
-
-/**
- * Update SystemCoreClock variable
- *
- * @param  none
- * @return none
- *
- * @brief  Updates the SystemCoreClock with current core Clock 
- *         retrieved from cpu registers.
- */
-extern void SystemCoreClockUpdate (void);
-
-
-#ifdef __cplusplus
-}
-#endif 
-
-#endif
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/vector_defns.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/* mbed Microcontroller Library - Vectors 
- * Copyright (c) 2006-2009 ARM Limited. All rights reserved. 
- */
-
-#ifndef MBED_VECTOR_DEFNS_H
-#define MBED_VECTOR_DEFNS_H
- 
-// Assember Macros 
-#ifdef __ARMCC_VERSION
-#define EXPORT(x) EXPORT x
-#define WEAK_EXPORT(x) EXPORT x [WEAK]
-#define IMPORT(x) IMPORT x
-#define LABEL(x) x
-#else        
-#define EXPORT(x) .global x
-#define WEAK_EXPORT(x) .weak x
-#define IMPORT(x) .global x
-#define LABEL(x) x:        
-#endif
-
-// RealMonitor
-// Requires RAM (0x40000040-0x4000011F) to be allocated by the linker
-
-// RealMonitor entry points
-#define rm_init_entry 0x7fffff91
-#define rm_undef_handler 0x7fffffa0
-#define rm_prefetchabort_handler 0x7fffffb0
-#define rm_dataabort_handler 0x7fffffc0
-#define rm_irqhandler2 0x7fffffe0
-//#define rm_RunningToStopped 0x7ffff808 // ARM - MBED64
-#define rm_RunningToStopped 0x7ffff820 // ARM - PHAT40
-
-// Unofficial RealMonitor entry points and variables
-#define RM_MSG_SWI 0x00940000 
-#define StateP 0x40000040 
-
-// VIC register addresses
-#define VIC_Base 0xfffff000
-#define VICAddress_Offset 0xf00
-#define VICVectAddr0_Offset 0x100
-#define VICVectAddr2_Offset 0x108
-#define VICVectAddr3_Offset 0x10c
-#define VICVectAddr31_Offset 0x17c
-#define VICIntEnClr_Offset 0x014
-#define VICIntEnClr    (*(volatile unsigned long *)(VIC_Base + 0x014))
-#define VICVectAddr2   (*(volatile unsigned long *)(VIC_Base + 0x108))
-#define VICVectAddr3   (*(volatile unsigned long *)(VIC_Base + 0x10C))
-
-// ARM Mode bits and Interrupt flags in PSRs
-#define Mode_USR 0x10
-#define Mode_FIQ 0x11
-#define Mode_IRQ 0x12
-#define Mode_SVC 0x13
-#define Mode_ABT 0x17
-#define Mode_UND 0x1B
-#define Mode_SYS 0x1F
-#define I_Bit 0x80    // when I bit is set, IRQ is disabled
-#define F_Bit 0x40    // when F bit is set, FIQ is disabled
-
-// MCU RAM
-#define LPC2368_RAM_ADDRESS 0x40000000	// RAM Base
-#define LPC2368_RAM_SIZE 0x8000		// 32KB 
-
-// ISR Stack Allocation
-#define UND_stack_size  0x00000040
-#define SVC_stack_size  0x00000040
-#define ABT_stack_size  0x00000040
-#define FIQ_stack_size  0x00000000
-#define IRQ_stack_size  0x00000040
-
-#define ISR_stack_size  (UND_stack_size + SVC_stack_size + ABT_stack_size + FIQ_stack_size + IRQ_stack_size)
-
-// Full Descending Stack, so top-most stack points to just above the top of RAM
-#define LPC2368_STACK_TOP (LPC2368_RAM_ADDRESS + LPC2368_RAM_SIZE)
-#define USR_STACK_TOP	  (LPC2368_STACK_TOP - ISR_stack_size)
-
-#endif
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC23XX/vector_realmonitor.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-/* mbed Microcontroller Library - RealMonitor
- * Copyright (c) 2006-2009 ARM Limited. All rights reserved. 
- */
-#include "vector_defns.h"
-
-extern void __mbed_dcc_irq(void);
-
-/* Function: __mbed_init_realmonitor
- * Setup the RealMonitor DCC Interrupt Handlers
- */
-void __mbed_init_realmonitor(void) __attribute__((weak));
-void __mbed_init_realmonitor() {
-    // Disable all interrupts
-    VICIntEnClr = 0xffffffff;
-  
-    // Set DCC interrupt vector addresses
-    VICVectAddr2 = (unsigned)&__mbed_dcc_irq;
-    VICVectAddr3 = (unsigned)&__mbed_dcc_irq;  
-
-    // Initialise RealMonitor
-    ((void (*)(void))rm_init_entry)();
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC408X/LPC407x_8x_177x_8x.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1523 +0,0 @@
-/****************************************************************************************************//**
-* $Id$		LPC407x_8x_177x_8x.h			2012-04-25
-*//**
- * @file     LPC407x_8x_177x_8x.h
- *
- * @brief    CMSIS Cortex-M4 Cortex-M3 Peripheral Access Layer Header File for
- *           NXP LPC407x_8x_177x_8x.
- * @version  V0.7
- * @date     20. June 2012
- * @author	NXP MCU SW Application Team
-* 
-* Copyright(C) 2012, 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.
-* Permission to use, copy, modify, and distribute this software and its
-* documentation is hereby granted, under NXP Semiconductors'
-* relevant copyright in the software, without fee, provided 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 __LPC407x_8x_177x_8x_H__
-#define __LPC407x_8x_177x_8x_H__
-
-#if defined(__CORTEX_M4) && !defined(CORE_M4)
-  #define CORE_M4
-#endif
-
-// ##################
-// Code Red - excluded extern "C" as unrequired
-// ##################
-#if 0
-#ifdef __cplusplus
-extern "C" {
-#endif
-#endif
-
-
-/* -------------------------  Interrupt Number Definition  ------------------------ */
-
-typedef enum IRQn
-{
-/******  Cortex-M4 Processor Exceptions Numbers ***************************************************/
-  Reset_IRQn                    = -15,              /*!<   1  Reset Vector, invoked on Power up and warm reset                 */
-  NonMaskableInt_IRQn           = -14,      /*!< 2 Non Maskable Interrupt                         */
-  HardFault_IRQn                = -13,              /*!<   3  Hard Fault, all classes of Fault                                 */
-  MemoryManagement_IRQn         = -12,      /*!< 4 Cortex-M3 Memory Management Interrupt          */
-  BusFault_IRQn                 = -11,      /*!< 5 Cortex-M3 Bus Fault Interrupt                  */
-  UsageFault_IRQn               = -10,      /*!< 6 Cortex-M3 Usage Fault Interrupt                */
-  SVCall_IRQn                   = -5,       /*!< 11 Cortex-M3 SV Call Interrupt                   */
-  DebugMonitor_IRQn             = -4,       /*!< 12 Cortex-M3 Debug Monitor Interrupt             */
-  PendSV_IRQn                   = -2,       /*!< 14 Cortex-M3 Pend SV Interrupt                   */
-  SysTick_IRQn                  = -1,       /*!< 15 Cortex-M3 System Tick Interrupt               */
-
-/******  LPC407x_8x_177x_8x Specific Interrupt Numbers *******************************************************/
-  WDT_IRQn                      = 0,        /*!< Watchdog Timer Interrupt                         */
-  TIMER0_IRQn                   = 1,        /*!< Timer0 Interrupt                                 */
-  TIMER1_IRQn                   = 2,        /*!< Timer1 Interrupt                                 */
-  TIMER2_IRQn                   = 3,        /*!< Timer2 Interrupt                                 */
-  TIMER3_IRQn                   = 4,        /*!< Timer3 Interrupt                                 */
-  UART0_IRQn                    = 5,        /*!< UART0 Interrupt                                  */
-  UART1_IRQn                    = 6,        /*!< UART1 Interrupt                                  */
-  UART2_IRQn                    = 7,        /*!< UART2 Interrupt                                  */
-  UART3_IRQn                    = 8,        /*!< UART3 Interrupt                                  */
-  PWM1_IRQn                     = 9,        /*!< PWM1 Interrupt                                   */
-  I2C0_IRQn                     = 10,       /*!< I2C0 Interrupt                                   */
-  I2C1_IRQn                     = 11,       /*!< I2C1 Interrupt                                   */
-  I2C2_IRQn                     = 12,       /*!< I2C2 Interrupt                                   */
-  Reserved0_IRQn                = 13,       /*!< Reserved                                         */
-  SSP0_IRQn                     = 14,       /*!< SSP0 Interrupt                                   */
-  SSP1_IRQn                     = 15,       /*!< SSP1 Interrupt                                   */
-  PLL0_IRQn                     = 16,       /*!< PLL0 Lock (Main PLL) Interrupt                   */
-  RTC_IRQn                      = 17,       /*!< Real Time Clock Interrupt                        */
-  EINT0_IRQn                    = 18,       /*!< External Interrupt 0 Interrupt                   */
-  EINT1_IRQn                    = 19,       /*!< External Interrupt 1 Interrupt                   */
-  EINT2_IRQn                    = 20,       /*!< External Interrupt 2 Interrupt                   */
-  EINT3_IRQn                    = 21,       /*!< External Interrupt 3 Interrupt                   */
-  ADC_IRQn                      = 22,       /*!< A/D Converter Interrupt                          */
-  BOD_IRQn                      = 23,       /*!< Brown-Out Detect Interrupt                       */
-  USB_IRQn                      = 24,       /*!< USB Interrupt                                    */
-  CAN_IRQn                      = 25,       /*!< CAN Interrupt                                    */
-  DMA_IRQn                      = 26,       /*!< General Purpose DMA Interrupt                    */
-  I2S_IRQn                      = 27,       /*!< I2S Interrupt                                    */
-  ENET_IRQn                     = 28,       /*!< Ethernet Interrupt                               */
-  MCI_IRQn                      = 29,       /*!< SD/MMC card I/F Interrupt                        */
-  MCPWM_IRQn                    = 30,       /*!< Motor Control PWM Interrupt                      */
-  QEI_IRQn                      = 31,       /*!< Quadrature Encoder Interface Interrupt           */
-  PLL1_IRQn                     = 32,       /*!< PLL1 Lock (USB PLL) Interrupt                    */
-  USBActivity_IRQn              = 33,       /*!< USB Activity interrupt                           */
-  CANActivity_IRQn              = 34,       /*!< CAN Activity interrupt                           */
-  UART4_IRQn                    = 35,       /*!< UART4 Interrupt                                  */
-  SSP2_IRQn                     = 36,       /*!< SSP2 Interrupt                                   */
-  LCD_IRQn                      = 37,       /*!< LCD Interrupt                                    */
-  GPIO_IRQn                     = 38,       /*!< GPIO Interrupt                                   */
-  PWM0_IRQn                     =  39,              /*!<  39  PWM0                                                             */
-  EEPROM_IRQn                   =  40,              /*!<  40  EEPROM                                                           */
-  CMP0_IRQn                     =  41,              /*!<  41  CMP0                                                             */
-  CMP1_IRQn                     =  42               /*!<  42  CMP1                                                             */
-} IRQn_Type;
-
-/* ================================================================================ */
-/* ================      Processor and Core Peripheral Section     ================ */
-/* ================================================================================ */
-#ifdef CORE_M4
-/* ----------------Configuration of the cm4 Processor and Core Peripherals---------------- */
-#define __CM4_REV                 0x0000            /*!< Cortex-M4 Core Revision                                               */
-#define __MPU_PRESENT                  1            /*!< MPU present or not                                                    */
-#define __NVIC_PRIO_BITS               5            /*!< Number of Bits used for Priority Levels                               */
-#define __Vendor_SysTickConfig         0            /*!< Set to 1 if different SysTick Config is used                          */
-#define __FPU_PRESENT                  1            /*!< FPU present or not                                                    */
-
-
-#include "core_cm4.h"                               /*!< Cortex-M4 processor and core peripherals                              */
-#else
-/* Configuration of the Cortex-M3 Processor and Core Peripherals */
-#define __MPU_PRESENT             1         /*!< MPU present or not                               */
-#define __NVIC_PRIO_BITS          5         /*!< Number of Bits used for Priority Levels          */
-#define __Vendor_SysTickConfig    0         /*!< Set to 1 if different SysTick Config is used     */
-
-
-#include "core_cm3.h"                       /* Cortex-M3 processor and core peripherals           */
-
-#endif
-
-#include "system_LPC407x_8x_177x_8x.h"                      /*!< LPC408x_7x System                                                     */
-
-
-
-
-
-
-/* ================================================================================ */
-/* ================       Device Specific Peripheral Section       ================ */
-/* ================================================================================ */
-
-#if defined ( __CC_ARM   )
-#pragma anon_unions
-#endif
-
-/*------------- General Purpose Direct Memory Access (GPDMA) -----------------*/
-typedef struct                          /* Common Registers                   */
-{
-  __I  uint32_t IntStat;
-  __I  uint32_t IntTCStat;
-  __O  uint32_t IntTCClear;
-  __I  uint32_t IntErrStat;
-  __O  uint32_t IntErrClr;
-  __I  uint32_t RawIntTCStat;
-  __I  uint32_t RawIntErrStat;
-  __I  uint32_t EnbldChns;
-  __IO uint32_t SoftBReq;
-  __IO uint32_t SoftSReq;
-  __IO uint32_t SoftLBReq;
-  __IO uint32_t SoftLSReq;
-  __IO uint32_t Config;
-  __IO uint32_t Sync;
-} LPC_GPDMA_TypeDef;
-
-typedef struct                          /* Channel Registers                  */
-{
-  __IO uint32_t CSrcAddr;
-  __IO uint32_t CDestAddr;
-  __IO uint32_t CLLI;
-  __IO uint32_t CControl;
-  __IO uint32_t CConfig;
-} LPC_GPDMACH_TypeDef;
-
-/*------------- System Control (SC) ------------------------------------------*/
-typedef struct
-{
-  __IO uint32_t FLASHCFG;                   /*!< Offset: 0x000 (R/W)  Flash Accelerator Configuration Register */
-       uint32_t RESERVED0[31];
-  __IO uint32_t PLL0CON;                    /*!< Offset: 0x080 (R/W)  PLL0 Control Register */
-  __IO uint32_t PLL0CFG;                    /*!< Offset: 0x084 (R/W)  PLL0 Configuration Register */
-  __I  uint32_t PLL0STAT;                   /*!< Offset: 0x088 (R/ )  PLL0 Status Register */
-  __O  uint32_t PLL0FEED;                   /*!< Offset: 0x08C ( /W)  PLL0 Feed Register */
-       uint32_t RESERVED1[4];
-  __IO uint32_t PLL1CON;                    /*!< Offset: 0x0A0 (R/W)  PLL1 Control Register */
-  __IO uint32_t PLL1CFG;                    /*!< Offset: 0x0A4 (R/W)  PLL1 Configuration Register */
-  __I  uint32_t PLL1STAT;                   /*!< Offset: 0x0A8 (R/ )  PLL1 Status Register */
-  __O  uint32_t PLL1FEED;                   /*!< Offset: 0x0AC ( /W)  PLL1 Feed Register */
-       uint32_t RESERVED2[4];
-  __IO uint32_t PCON;                       /*!< Offset: 0x0C0 (R/W)  Power Control Register */
-  __IO uint32_t PCONP;                      /*!< Offset: 0x0C4 (R/W)  Power Control for Peripherals Register */
-  __IO uint32_t PCONP1;                      /*!< Offset: 0x0C8 (R/W)  Power Control for Peripherals Register */
-       uint32_t RESERVED3[13];
-  __IO uint32_t EMCCLKSEL;                  /*!< Offset: 0x100 (R/W)  External Memory Controller Clock Selection Register */
-  __IO uint32_t CCLKSEL;                    /*!< Offset: 0x104 (R/W)  CPU Clock Selection Register */
-  __IO uint32_t USBCLKSEL;                  /*!< Offset: 0x108 (R/W)  USB Clock Selection Register */
-  __IO uint32_t CLKSRCSEL;                  /*!< Offset: 0x10C (R/W)  Clock Source Select Register */
-  __IO uint32_t	CANSLEEPCLR;                /*!< Offset: 0x110 (R/W)  CAN Sleep Clear Register */
-  __IO uint32_t	CANWAKEFLAGS;               /*!< Offset: 0x114 (R/W)  CAN Wake-up Flags Register */
-       uint32_t RESERVED4[10];
-  __IO uint32_t EXTINT;                     /*!< Offset: 0x140 (R/W)  External Interrupt Flag Register */
-       uint32_t RESERVED5[1];
-  __IO uint32_t EXTMODE;                    /*!< Offset: 0x148 (R/W)  External Interrupt Mode Register */
-  __IO uint32_t EXTPOLAR;                   /*!< Offset: 0x14C (R/W)  External Interrupt Polarity Register */
-       uint32_t RESERVED6[12];
-  __IO uint32_t RSID;                       /*!< Offset: 0x180 (R/W)  Reset Source Identification Register */
-       uint32_t RESERVED7[7];
-  __IO uint32_t SCS;                        /*!< Offset: 0x1A0 (R/W)  System Controls and Status Register */
-  __IO uint32_t IRCTRIM;                    /*!< Offset: 0x1A4 (R/W) Clock Dividers                     */
-  __IO uint32_t PCLKSEL;                    /*!< Offset: 0x1A8 (R/W)  Peripheral Clock Selection Register */
-       uint32_t RESERVED8;					
-  __IO uint32_t PBOOST;						/*!< Offset: 0x1B0 (R/W)  Power Boost control register */	   
-  __IO uint32_t SPIFICLKSEL;					
-  __IO uint32_t LCD_CFG;                    /*!< Offset: 0x1B8 (R/W)  LCD Configuration and clocking control Register */
-       uint32_t RESERVED10[1];
-  __IO uint32_t USBIntSt;                   /*!< Offset: 0x1C0 (R/W)  USB Interrupt Status Register */
-  __IO uint32_t DMAREQSEL;                  /*!< Offset: 0x1C4 (R/W)  DMA Request Select Register */
-  __IO uint32_t CLKOUTCFG;                  /*!< Offset: 0x1C8 (R/W)  Clock Output Configuration Register */
-  __IO uint32_t RSTCON0;                    /*!< Offset: 0x1CC (R/W)  RESET Control0 Register */
-  __IO uint32_t RSTCON1;                    /*!< Offset: 0x1D0 (R/W)  RESET Control1 Register */
-       uint32_t RESERVED11[2];
-  __IO uint32_t EMCDLYCTL;                  /*!< Offset: 0x1DC (R/W) SDRAM programmable delays          */
-  __IO uint32_t EMCCAL;                     /*!< Offset: 0x1E0 (R/W) Calibration of programmable delays */
- } LPC_SC_TypeDef;
-/*------------- Ethernet Media Access Controller (EMAC) ----------------------*/
-typedef struct
-{
-  __IO uint32_t MAC1;                   /* MAC Registers                      */
-  __IO uint32_t MAC2;
-  __IO uint32_t IPGT;
-  __IO uint32_t IPGR;
-  __IO uint32_t CLRT;
-  __IO uint32_t MAXF;
-  __IO uint32_t SUPP;
-  __IO uint32_t TEST;
-  __IO uint32_t MCFG;
-  __IO uint32_t MCMD;
-  __IO uint32_t MADR;
-  __O  uint32_t MWTD;
-  __I  uint32_t MRDD;
-  __I  uint32_t MIND;
-       uint32_t RESERVED0[2];
-  __IO uint32_t SA0;
-  __IO uint32_t SA1;
-  __IO uint32_t SA2;
-       uint32_t RESERVED1[45];
-  __IO uint32_t Command;                /* Control Registers                  */
-  __I  uint32_t Status;
-  __IO uint32_t RxDescriptor;
-  __IO uint32_t RxStatus;
-  __IO uint32_t RxDescriptorNumber;
-  __I  uint32_t RxProduceIndex;
-  __IO uint32_t RxConsumeIndex;
-  __IO uint32_t TxDescriptor;
-  __IO uint32_t TxStatus;
-  __IO uint32_t TxDescriptorNumber;
-  __IO uint32_t TxProduceIndex;
-  __I  uint32_t TxConsumeIndex;
-       uint32_t RESERVED2[10];
-  __I  uint32_t TSV0;
-  __I  uint32_t TSV1;
-  __I  uint32_t RSV;
-       uint32_t RESERVED3[3];
-  __IO uint32_t FlowControlCounter;
-  __I  uint32_t FlowControlStatus;
-       uint32_t RESERVED4[34];
-  __IO uint32_t RxFilterCtrl;           /* Rx Filter Registers                */
-  __I  uint32_t RxFilterWoLStatus;
-  __O  uint32_t RxFilterWoLClear;
-       uint32_t RESERVED5;
-  __IO uint32_t HashFilterL;
-  __IO uint32_t HashFilterH;
-       uint32_t RESERVED6[882];
-  __I  uint32_t IntStatus;              /* Module Control Registers           */
-  __IO uint32_t IntEnable;
-  __O  uint32_t IntClear;
-  __O  uint32_t IntSet;
-       uint32_t RESERVED7;
-  __IO uint32_t PowerDown;
-       uint32_t RESERVED8;
-  __IO uint32_t Module_ID;
-} LPC_EMAC_TypeDef;
-
-/*------------- LCD controller (LCD) -----------------------------------------*/
-typedef struct
-{
-  __IO uint32_t TIMH;                   /* LCD Registers                      */
-  __IO uint32_t TIMV;
-  __IO uint32_t POL;
-  __IO uint32_t LE;
-  __IO uint32_t UPBASE;
-  __IO uint32_t LPBASE;
-  __IO uint32_t CTRL;
-  __IO uint32_t INTMSK;
-  __I  uint32_t INTRAW;
-  __I  uint32_t INTSTAT;
-  __O  uint32_t INTCLR;
-  __I  uint32_t UPCURR;
-  __I  uint32_t LPCURR;
-       uint32_t RESERVED0[115];
-  __IO uint32_t PAL[128];
-       uint32_t RESERVED1[256];
-  __IO uint32_t CRSR_IMG[256];
-  __IO uint32_t CRSR_CTRL;
-  __IO uint32_t CRSR_CFG;
-  __IO uint32_t CRSR_PAL0;
-  __IO uint32_t CRSR_PAL1;
-  __IO uint32_t CRSR_XY;
-  __IO uint32_t CRSR_CLIP;
-       uint32_t RESERVED2[2];
-  __IO uint32_t CRSR_INTMSK;
-  __O  uint32_t CRSR_INTCLR;
-  __I  uint32_t CRSR_INTRAW;
-  __I  uint32_t CRSR_INTSTAT;
-} LPC_LCD_TypeDef;
-
-/*------------- Universal Serial Bus (USB) -----------------------------------*/
-typedef struct
-{
-  __I  uint32_t Revision;             /* USB Host Registers                 */
-  __IO uint32_t Control;
-  __IO uint32_t CommandStatus;
-  __IO uint32_t InterruptStatus;
-  __IO uint32_t InterruptEnable;
-  __IO uint32_t InterruptDisable;
-  __IO uint32_t HCCA;
-  __I  uint32_t PeriodCurrentED;
-  __IO uint32_t ControlHeadED;
-  __IO uint32_t ControlCurrentED;
-  __IO uint32_t BulkHeadED;
-  __IO uint32_t BulkCurrentED;
-  __I  uint32_t DoneHead;
-  __IO uint32_t FmInterval;
-  __I  uint32_t FmRemaining;
-  __I  uint32_t FmNumber;
-  __IO uint32_t PeriodicStart;
-  __IO uint32_t LSTreshold;
-  __IO uint32_t RhDescriptorA;
-  __IO uint32_t RhDescriptorB;
-  __IO uint32_t RhStatus;
-  __IO uint32_t RhPortStatus1;
-  __IO uint32_t RhPortStatus2;
-       uint32_t RESERVED0[40];
-  __I  uint32_t Module_ID;
-
-  __I  uint32_t IntSt;               /* USB On-The-Go Registers            */
-  __IO uint32_t IntEn;
-  __O  uint32_t IntSet;
-  __O  uint32_t IntClr;
-  __IO uint32_t StCtrl;
-  __IO uint32_t Tmr;
-       uint32_t RESERVED1[58];
-
-  __I  uint32_t DevIntSt;            /* USB Device Interrupt Registers     */
-  __IO uint32_t DevIntEn;
-  __O  uint32_t DevIntClr;
-  __O  uint32_t DevIntSet;
-
-  __O  uint32_t CmdCode;             /* USB Device SIE Command Registers   */
-  __I  uint32_t CmdData;
-
-  __I  uint32_t RxData;              /* USB Device Transfer Registers      */
-  __O  uint32_t TxData;
-  __I  uint32_t RxPLen;
-  __O  uint32_t TxPLen;
-  __IO uint32_t Ctrl;
-  __O  uint32_t DevIntPri;
-
-  __I  uint32_t EpIntSt;             /* USB Device Endpoint Interrupt Regs */
-  __IO uint32_t EpIntEn;
-  __O  uint32_t EpIntClr;
-  __O  uint32_t EpIntSet;
-  __O  uint32_t EpIntPri;
-
-  __IO uint32_t ReEp;                /* USB Device Endpoint Realization Reg*/
-  __O  uint32_t EpInd;
-  __IO uint32_t MaxPSize;
-
-  __I  uint32_t DMARSt;              /* USB Device DMA Registers           */
-  __O  uint32_t DMARClr;
-  __O  uint32_t DMARSet;
-       uint32_t RESERVED2[9];
-  __IO uint32_t UDCAH;
-  __I  uint32_t EpDMASt;
-  __O  uint32_t EpDMAEn;
-  __O  uint32_t EpDMADis;
-  __I  uint32_t DMAIntSt;
-  __IO uint32_t DMAIntEn;
-       uint32_t RESERVED3[2];
-  __I  uint32_t EoTIntSt;
-  __O  uint32_t EoTIntClr;
-  __O  uint32_t EoTIntSet;
-  __I  uint32_t NDDRIntSt;
-  __O  uint32_t NDDRIntClr;
-  __O  uint32_t NDDRIntSet;
-  __I  uint32_t SysErrIntSt;
-  __O  uint32_t SysErrIntClr;
-  __O  uint32_t SysErrIntSet;
-       uint32_t RESERVED4[15];
-
-  union {
-  __I  uint32_t I2C_RX;                 /* USB OTG I2C Registers              */
-  __O  uint32_t I2C_TX;
-  };
-  __IO  uint32_t I2C_STS;
-  __IO uint32_t I2C_CTL;
-  __IO uint32_t I2C_CLKHI;
-  __O  uint32_t I2C_CLKLO;
-       uint32_t RESERVED5[824];
-
-  union {
-  __IO uint32_t USBClkCtrl;             /* USB Clock Control Registers        */
-  __IO uint32_t OTGClkCtrl;
-  };
-  union {
-  __I  uint32_t USBClkSt;
-  __I  uint32_t OTGClkSt;
-  };
-} LPC_USB_TypeDef;
-
-/*------------- CRC Engine (CRC) -----------------------------------------*/
-typedef struct
-{
-  __IO uint32_t MODE;
-  __IO uint32_t SEED;
-  union {
-  __I  uint32_t SUM;
-  struct {
-  __O  uint32_t DATA;
-  } WR_DATA_DWORD;
-  
-  struct {
-  __O  uint16_t DATA;
-       uint16_t RESERVED;
-  }WR_DATA_WORD;
-  
-  struct {
-  __O  uint8_t  DATA;
-       uint8_t  RESERVED[3];
-  	}WR_DATA_BYTE;
-  };
-} LPC_CRC_TypeDef;
-/*------------- General Purpose Input/Output (GPIO) --------------------------*/
-typedef struct
-{
-  __IO uint32_t DIR;
-       uint32_t RESERVED0[3];
-  __IO uint32_t MASK;
-  __IO uint32_t PIN;
-  __IO uint32_t SET;
-  __O  uint32_t CLR;
-} LPC_GPIO_TypeDef;
-
-typedef struct
-{
-  __I  uint32_t IntStatus;
-  __I  uint32_t IO0IntStatR;
-  __I  uint32_t IO0IntStatF;
-  __O  uint32_t IO0IntClr;
-  __IO uint32_t IO0IntEnR;
-  __IO uint32_t IO0IntEnF;
-       uint32_t RESERVED0[3];
-  __I  uint32_t IO2IntStatR;
-  __I  uint32_t IO2IntStatF;
-  __O  uint32_t IO2IntClr;
-  __IO uint32_t IO2IntEnR;
-  __IO uint32_t IO2IntEnF;
-} LPC_GPIOINT_TypeDef;
-
-/*------------- External Memory Controller (EMC) -----------------------------*/
-typedef struct
-{
-  __IO uint32_t Control;
-  __I  uint32_t Status;
-  __IO uint32_t Config;
-       uint32_t RESERVED0[5];
-  __IO uint32_t DynamicControl;
-  __IO uint32_t DynamicRefresh;
-  __IO uint32_t DynamicReadConfig;
-       uint32_t RESERVED1[1];
-  __IO uint32_t DynamicRP;
-  __IO uint32_t DynamicRAS;
-  __IO uint32_t DynamicSREX;
-  __IO uint32_t DynamicAPR;
-  __IO uint32_t DynamicDAL;
-  __IO uint32_t DynamicWR;
-  __IO uint32_t DynamicRC;
-  __IO uint32_t DynamicRFC;
-  __IO uint32_t DynamicXSR;
-  __IO uint32_t DynamicRRD;
-  __IO uint32_t DynamicMRD;
-       uint32_t RESERVED2[9];
-  __IO uint32_t StaticExtendedWait;
-       uint32_t RESERVED3[31];
-  __IO uint32_t DynamicConfig0;
-  __IO uint32_t DynamicRasCas0;
-       uint32_t RESERVED4[6];
-  __IO uint32_t DynamicConfig1;
-  __IO uint32_t DynamicRasCas1;
-       uint32_t RESERVED5[6];
-  __IO uint32_t DynamicConfig2;
-  __IO uint32_t DynamicRasCas2;
-       uint32_t RESERVED6[6];
-  __IO uint32_t DynamicConfig3;
-  __IO uint32_t DynamicRasCas3;
-       uint32_t RESERVED7[38];
-  __IO uint32_t StaticConfig0;
-  __IO uint32_t StaticWaitWen0;
-  __IO uint32_t StaticWaitOen0;
-  __IO uint32_t StaticWaitRd0;
-  __IO uint32_t StaticWaitPage0;
-  __IO uint32_t StaticWaitWr0;
-  __IO uint32_t StaticWaitTurn0;
-       uint32_t RESERVED8[1];
-  __IO uint32_t StaticConfig1;
-  __IO uint32_t StaticWaitWen1;
-  __IO uint32_t StaticWaitOen1;
-  __IO uint32_t StaticWaitRd1;
-  __IO uint32_t StaticWaitPage1;
-  __IO uint32_t StaticWaitWr1;
-  __IO uint32_t StaticWaitTurn1;
-       uint32_t RESERVED9[1];
-  __IO uint32_t StaticConfig2;
-  __IO uint32_t StaticWaitWen2;
-  __IO uint32_t StaticWaitOen2;
-  __IO uint32_t StaticWaitRd2;
-  __IO uint32_t StaticWaitPage2;
-  __IO uint32_t StaticWaitWr2;
-  __IO uint32_t StaticWaitTurn2;
-       uint32_t RESERVED10[1];
-  __IO uint32_t StaticConfig3;
-  __IO uint32_t StaticWaitWen3;
-  __IO uint32_t StaticWaitOen3;
-  __IO uint32_t StaticWaitRd3;
-  __IO uint32_t StaticWaitPage3;
-  __IO uint32_t StaticWaitWr3;
-  __IO uint32_t StaticWaitTurn3;
-} LPC_EMC_TypeDef;
-
-/*------------- Watchdog Timer (WDT) -----------------------------------------*/
-typedef struct
-{
-  __IO uint8_t  MOD;
-       uint8_t  RESERVED0[3];
-  __IO uint32_t TC;
-  __O  uint8_t  FEED;
-       uint8_t  RESERVED1[3];
-  __I  uint32_t TV;
-       uint32_t RESERVED2;
-  __IO uint32_t WARNINT;
-  __IO uint32_t WINDOW;
-} LPC_WDT_TypeDef;
-
-/*------------- Timer (TIM) --------------------------------------------------*/
-typedef struct
-{
-  __IO uint32_t IR;                     /*!< Offset: 0x000 Interrupt Register (R/W) */
-  __IO uint32_t TCR;                    /*!< Offset: 0x004 Timer Control Register (R/W) */
-  __IO uint32_t TC;                     /*!< Offset: 0x008 Timer Counter Register (R/W) */
-  __IO uint32_t PR;                     /*!< Offset: 0x00C Prescale Register (R/W) */
-  __IO uint32_t PC;                     /*!< Offset: 0x010 Prescale Counter Register (R/W) */
-  __IO uint32_t MCR;                    /*!< Offset: 0x014 Match Control Register (R/W) */
-  __IO uint32_t MR0;                    /*!< Offset: 0x018 Match Register 0 (R/W) */
-  __IO uint32_t MR1;                    /*!< Offset: 0x01C Match Register 1 (R/W) */
-  __IO uint32_t MR2;                    /*!< Offset: 0x020 Match Register 2 (R/W) */
-  __IO uint32_t MR3;                    /*!< Offset: 0x024 Match Register 3 (R/W) */
-  __IO uint32_t CCR;                    /*!< Offset: 0x028 Capture Control Register (R/W) */
-  __I  uint32_t CR0;                    /*!< Offset: 0x02C Capture Register 0 (R/ ) */
-  __I  uint32_t CR1;					/*!< Offset: 0x030 Capture Register 1 (R/ ) */
-       uint32_t RESERVED0[2];
-  __IO uint32_t EMR;                    /*!< Offset: 0x03C External Match Register (R/W) */
-       uint32_t RESERVED1[12];
-  __IO uint32_t CTCR;                   /*!< Offset: 0x070 Count Control Register (R/W) */
-} LPC_TIM_TypeDef;
-
-
-/*------------- Pulse-Width Modulation (PWM) ---------------------------------*/
-typedef struct
-{
-  __IO uint32_t IR;                     /*!< Offset: 0x000 Interrupt Register (R/W) */
-  __IO uint32_t TCR;                    /*!< Offset: 0x004 Timer Control Register (R/W) */
-  __IO uint32_t TC;                     /*!< Offset: 0x008 Timer Counter Register (R/W) */
-  __IO uint32_t PR;                     /*!< Offset: 0x00C Prescale Register (R/W) */
-  __IO uint32_t PC;                     /*!< Offset: 0x010 Prescale Counter Register (R/W) */
-  __IO uint32_t MCR;                    /*!< Offset: 0x014 Match Control Register (R/W) */
-  __IO uint32_t MR0;                    /*!< Offset: 0x018 Match Register 0 (R/W) */
-  __IO uint32_t MR1;                    /*!< Offset: 0x01C Match Register 1 (R/W) */
-  __IO uint32_t MR2;                    /*!< Offset: 0x020 Match Register 2 (R/W) */
-  __IO uint32_t MR3;                    /*!< Offset: 0x024 Match Register 3 (R/W) */
-  __IO uint32_t CCR;                    /*!< Offset: 0x028 Capture Control Register (R/W) */
-  __I  uint32_t CR0;                    /*!< Offset: 0x02C Capture Register 0 (R/ ) */
-  __I  uint32_t CR1;					/*!< Offset: 0x030 Capture Register 1 (R/ ) */
-  __I  uint32_t CR2;					/*!< Offset: 0x034 Capture Register 2 (R/ ) */
-  __I  uint32_t CR3;					/*!< Offset: 0x038 Capture Register 3 (R/ ) */
-       uint32_t RESERVED0;
-  __IO uint32_t MR4;					/*!< Offset: 0x040 Match Register 4 (R/W) */
-  __IO uint32_t MR5;					/*!< Offset: 0x044 Match Register 5 (R/W) */
-  __IO uint32_t MR6;					/*!< Offset: 0x048 Match Register 6 (R/W) */
-  __IO uint32_t PCR;					/*!< Offset: 0x04C PWM Control Register (R/W) */
-  __IO uint32_t LER;					/*!< Offset: 0x050 Load Enable Register (R/W) */
-       uint32_t RESERVED1[7];
-  __IO uint32_t CTCR;					/*!< Offset: 0x070 Counter Control Register (R/W) */
-} LPC_PWM_TypeDef;
-
-/*------------- Universal Asynchronous Receiver Transmitter (UARTx) -----------*/
-/* There are three types of UARTs on the chip:
-(1) UART0,UART2, and UART3 are the standard UART.
-(2) UART1 is the standard with modem capability.
-(3) USART(UART4) is the sync/async UART with smart card capability.
-More details can be found on the Users Manual. */
-
-#if 0
-typedef struct
-{
-  union {
-  __I  uint8_t  RBR;
-  __O  uint8_t  THR;
-  __IO uint8_t  DLL;
-       uint32_t RESERVED0;
-  };
-  union {
-  __IO uint8_t  DLM;
-  __IO uint32_t IER;
-  };
-  union {
-  __I  uint32_t IIR;
-  __O  uint8_t  FCR;
-  };
-  __IO uint8_t  LCR;
-       uint8_t  RESERVED1[7];
-  __I  uint8_t  LSR;
-       uint8_t  RESERVED2[7];
-  __IO uint8_t  SCR;
-       uint8_t  RESERVED3[3];
-  __IO uint32_t ACR;
-  __IO uint8_t  ICR;
-       uint8_t  RESERVED4[3];
-  __IO uint8_t  FDR;
-       uint8_t  RESERVED5[7];
-  __IO uint8_t  TER;
-       uint8_t  RESERVED6[39];
-  __I  uint8_t  FIFOLVL;
-} LPC_UART_TypeDef;
-#else
-typedef struct
-{
-	union
-	{
-		__I  uint8_t  RBR;
-		__O  uint8_t  THR;
-		__IO uint8_t  DLL;
-		uint32_t RESERVED0;
-	};
-	union
-	{
-		__IO uint8_t  DLM;
-		__IO uint32_t IER;
-	};
-	union
-	{
-		__I  uint32_t IIR;
-		__O  uint8_t  FCR;
-	};
-	__IO uint8_t  LCR;
-	uint8_t  RESERVED1[7];//Reserved
-	__I  uint8_t  LSR;
-	uint8_t  RESERVED2[7];//Reserved
-	__IO uint8_t  SCR;
-	uint8_t  RESERVED3[3];//Reserved
-	__IO uint32_t ACR;
-	__IO uint8_t  ICR;
-	uint8_t  RESERVED4[3];//Reserved
-	__IO uint8_t  FDR;
-	uint8_t  RESERVED5[7];//Reserved
-	__IO uint8_t  TER;
-	uint8_t  RESERVED8[27];//Reserved
-	__IO uint8_t  RS485CTRL;
-	uint8_t  RESERVED9[3];//Reserved
-	__IO uint8_t  ADRMATCH;
-	uint8_t  RESERVED10[3];//Reserved
-	__IO uint8_t  RS485DLY;
-	uint8_t  RESERVED11[3];//Reserved
-	__I  uint8_t  FIFOLVL;
-}LPC_UART_TypeDef;
-#endif
-
-
-typedef struct
-{
-  union {
-  __I  uint8_t  RBR;
-  __O  uint8_t  THR;
-  __IO uint8_t  DLL;
-       uint32_t RESERVED0;
-  };
-  union {
-  __IO uint8_t  DLM;
-  __IO uint32_t IER;
-  };
-  union {
-  __I  uint32_t IIR;
-  __O  uint8_t  FCR;
-  };
-  __IO uint8_t  LCR;
-       uint8_t  RESERVED1[3];
-  __IO uint8_t  MCR;
-       uint8_t  RESERVED2[3];
-  __I  uint8_t  LSR;
-       uint8_t  RESERVED3[3];
-  __I  uint8_t  MSR;
-       uint8_t  RESERVED4[3];
-  __IO uint8_t  SCR;
-       uint8_t  RESERVED5[3];
-  __IO uint32_t ACR;
-       uint32_t RESERVED6;
-  __IO uint32_t FDR;
-       uint32_t RESERVED7;
-  __IO uint8_t  TER;
-       uint8_t  RESERVED8[27];
-  __IO uint8_t  RS485CTRL;
-       uint8_t  RESERVED9[3];
-  __IO uint8_t  ADRMATCH;
-       uint8_t  RESERVED10[3];
-  __IO uint8_t  RS485DLY;
-       uint8_t  RESERVED11[3];
-  __I  uint8_t  FIFOLVL;
-} LPC_UART1_TypeDef;
-
-typedef struct
-{
-  union {
-  __I  uint32_t  RBR;                   /*!< Offset: 0x000 Receiver Buffer  Register (R/ ) */
-  __O  uint32_t  THR;                   /*!< Offset: 0x000 Transmit Holding Register ( /W) */
-  __IO uint32_t  DLL;                   /*!< Offset: 0x000 Divisor Latch LSB (R/W) */
-  };
-  union {
-  __IO uint32_t  DLM;                   /*!< Offset: 0x004 Divisor Latch MSB (R/W) */
-  __IO uint32_t  IER;                   /*!< Offset: 0x000 Interrupt Enable Register (R/W) */
-  };
-  union {
-  __I  uint32_t  IIR;                   /*!< Offset: 0x008 Interrupt ID Register (R/ ) */
-  __O  uint32_t  FCR;                   /*!< Offset: 0x008 FIFO Control Register ( /W) */
-  };
-  __IO uint32_t  LCR;                   /*!< Offset: 0x00C Line Control Register (R/W) */
-  __IO uint32_t  MCR;                   /*!< Offset: 0x010 Modem control Register (R/W) */
-  __I  uint32_t  LSR;                   /*!< Offset: 0x014 Line Status Register (R/ ) */
-  __I  uint32_t  MSR;                   /*!< Offset: 0x018 Modem status Register (R/ ) */
-  __IO uint32_t  SCR;                   /*!< Offset: 0x01C Scratch Pad Register (R/W) */
-  __IO uint32_t  ACR;                   /*!< Offset: 0x020 Auto-baud Control Register (R/W) */
-  __IO uint32_t  ICR;                   /*!< Offset: 0x024 irDA Control Register (R/W) */
-  __IO uint32_t  FDR;                   /*!< Offset: 0x028 Fractional Divider Register (R/W) */
-  __IO uint32_t  OSR;                   /*!< Offset: 0x02C Over sampling Register (R/W) */
-  __O  uint32_t  POP;                   /*!< Offset: 0x030 NHP Pop Register (W) */
-  __IO uint32_t  MODE;                  /*!< Offset: 0x034 NHP Mode selection Register (W) */
-       uint32_t  RESERVED0[2];
-  __IO uint32_t  HDEN;                  /*!< Offset: 0x040 Half duplex Enable Register (R/W) */
-       uint32_t  RESERVED1;
-  __IO uint32_t  SCI_CTRL;				/*!< Offset: 0x048 Smart card Interface Control Register (R/W) */
-  __IO uint32_t  RS485CTRL;             /*!< Offset: 0x04C RS-485/EIA-485 Control Register (R/W) */
-  __IO uint32_t  ADRMATCH;              /*!< Offset: 0x050 RS-485/EIA-485 address match Register (R/W) */
-  __IO uint32_t  RS485DLY;              /*!< Offset: 0x054 RS-485/EIA-485 direction control delay Register (R/W) */
-  __IO uint32_t  SYNCCTRL;              /*!< Offset: 0x058 Synchronous Mode Control Register (R/W ) */
-  __IO uint32_t  TER;                   /*!< Offset: 0x05C Transmit Enable Register (R/W) */
-       uint32_t  RESERVED2[989];
-  __I  uint32_t  CFG;                   /*!< Offset: 0xFD4 Configuration Register (R) */
-  __O  uint32_t  INTCE;                 /*!< Offset: 0xFD8 Interrupt Clear Enable Register (W) */
-  __O  uint32_t  INTSE;                 /*!< Offset: 0xFDC Interrupt Set Enable Register (W) */
-  __I  uint32_t  INTS;                  /*!< Offset: 0xFE0 Interrupt Status Register (R) */
-  __I  uint32_t  INTE;                  /*!< Offset: 0xFE4 Interrupt Enable Register (R) */
-  __O  uint32_t  INTCS;                 /*!< Offset: 0xFE8 Interrupt Clear Status Register (W) */
-  __O  uint32_t  INTSS;                 /*!< Offset: 0xFEC Interrupt Set Status Register (W) */
-       uint32_t  RESERVED3[3];
-  __I  uint32_t  MID;                   /*!< Offset: 0xFFC Module Identification Register (R) */
-} LPC_UART4_TypeDef;
-/*------------- Inter-Integrated Circuit (I2C) -------------------------------*/
-typedef struct
-{
-  __IO uint32_t CONSET;                 /*!< Offset: 0x000 I2C Control Set Register (R/W) */
-  __I  uint32_t STAT;                   /*!< Offset: 0x004 I2C Status Register (R/ ) */
-  __IO uint32_t DAT;                    /*!< Offset: 0x008 I2C Data Register (R/W) */
-  __IO uint32_t ADR0;                   /*!< Offset: 0x00C I2C Slave Address Register 0 (R/W) */
-  __IO uint32_t SCLH;                   /*!< Offset: 0x010 SCH Duty Cycle Register High Half Word (R/W) */
-  __IO uint32_t SCLL;                   /*!< Offset: 0x014 SCL Duty Cycle Register Low Half Word (R/W) */
-  __O  uint32_t CONCLR;                 /*!< Offset: 0x018 I2C Control Clear Register ( /W) */
-  __IO uint32_t MMCTRL;                 /*!< Offset: 0x01C Monitor mode control register (R/W) */
-  __IO uint32_t ADR1;                   /*!< Offset: 0x020 I2C Slave Address Register 1 (R/W) */
-  __IO uint32_t ADR2;                   /*!< Offset: 0x024 I2C Slave Address Register 2 (R/W) */
-  __IO uint32_t ADR3;                   /*!< Offset: 0x028 I2C Slave Address Register 3 (R/W) */
-  __I  uint32_t DATA_BUFFER;            /*!< Offset: 0x02C Data buffer register ( /W) */
-  __IO uint32_t MASK0;                  /*!< Offset: 0x030 I2C Slave address mask register 0 (R/W) */
-  __IO uint32_t MASK1;                  /*!< Offset: 0x034 I2C Slave address mask register 1 (R/W) */
-  __IO uint32_t MASK2;                  /*!< Offset: 0x038 I2C Slave address mask register 2 (R/W) */
-  __IO uint32_t MASK3;                  /*!< Offset: 0x03C I2C Slave address mask register 3 (R/W) */
-} LPC_I2C_TypeDef;
-
-/*------------- Real-Time Clock (RTC) ----------------------------------------*/
-typedef struct
-{
-  __IO uint8_t  ILR;
-       uint8_t  RESERVED0[7];
-  __IO uint8_t  CCR;
-       uint8_t  RESERVED1[3];
-  __IO uint8_t  CIIR;
-       uint8_t  RESERVED2[3];
-  __IO uint8_t  AMR;
-       uint8_t  RESERVED3[3];
-  __I  uint32_t CTIME0;
-  __I  uint32_t CTIME1;
-  __I  uint32_t CTIME2;
-  __IO uint8_t  SEC;
-       uint8_t  RESERVED4[3];
-  __IO uint8_t  MIN;
-       uint8_t  RESERVED5[3];
-  __IO uint8_t  HOUR;
-       uint8_t  RESERVED6[3];
-  __IO uint8_t  DOM;
-       uint8_t  RESERVED7[3];
-  __IO uint8_t  DOW;
-       uint8_t  RESERVED8[3];
-  __IO uint16_t DOY;
-       uint16_t RESERVED9;
-  __IO uint8_t  MONTH;
-       uint8_t  RESERVED10[3];
-  __IO uint16_t YEAR;
-       uint16_t RESERVED11;
-  __IO uint32_t CALIBRATION;
-  __IO uint32_t GPREG0;
-  __IO uint32_t GPREG1;
-  __IO uint32_t GPREG2;
-  __IO uint32_t GPREG3;
-  __IO uint32_t GPREG4;
-  __IO uint8_t  RTC_AUXEN;
-       uint8_t  RESERVED12[3];
-  __IO uint8_t  RTC_AUX;
-       uint8_t  RESERVED13[3];
-  __IO uint8_t  ALSEC;
-       uint8_t  RESERVED14[3];
-  __IO uint8_t  ALMIN;
-       uint8_t  RESERVED15[3];
-  __IO uint8_t  ALHOUR;
-       uint8_t  RESERVED16[3];
-  __IO uint8_t  ALDOM;
-       uint8_t  RESERVED17[3];
-  __IO uint8_t  ALDOW;
-       uint8_t  RESERVED18[3];
-  __IO uint16_t ALDOY;
-       uint16_t RESERVED19;
-  __IO uint8_t  ALMON;
-       uint8_t  RESERVED20[3];
-  __IO uint16_t ALYEAR;
-       uint16_t RESERVED21;
-  __IO uint32_t ERSTATUS;
-  __IO uint32_t ERCONTROL;
-  __IO uint32_t ERCOUNTERS;
-       uint32_t RESERVED22;
-  __IO uint32_t ERFIRSTSTAMP0;
-  __IO uint32_t ERFIRSTSTAMP1;
-  __IO uint32_t ERFIRSTSTAMP2;
-       uint32_t RESERVED23;
-  __IO uint32_t ERLASTSTAMP0;
-  __IO uint32_t ERLASTSTAMP1;
-  __IO uint32_t ERLASTSTAMP2;
-} LPC_RTC_TypeDef;
-
-
-
-/*------------- Pin Connect Block (PINCON) -----------------------------------*/
-typedef struct
-{
-  __IO uint32_t P0_0;				/* 0x000 */
-  __IO uint32_t P0_1;
-  __IO uint32_t P0_2;
-  __IO uint32_t P0_3;
-  __IO uint32_t P0_4;
-  __IO uint32_t P0_5;
-  __IO uint32_t P0_6;
-  __IO uint32_t P0_7;
-
-  __IO uint32_t P0_8;				/* 0x020 */
-  __IO uint32_t P0_9;
-  __IO uint32_t P0_10;
-  __IO uint32_t P0_11;
-  __IO uint32_t P0_12;
-  __IO uint32_t P0_13;
-  __IO uint32_t P0_14;
-  __IO uint32_t P0_15;
-
-  __IO uint32_t P0_16;				/* 0x040 */
-  __IO uint32_t P0_17;
-  __IO uint32_t P0_18;
-  __IO uint32_t P0_19;
-  __IO uint32_t P0_20;
-  __IO uint32_t P0_21;
-  __IO uint32_t P0_22;
-  __IO uint32_t P0_23;
-
-  __IO uint32_t P0_24;				/* 0x060 */
-  __IO uint32_t P0_25;
-  __IO uint32_t P0_26;
-  __IO uint32_t P0_27;
-  __IO uint32_t P0_28;
-  __IO uint32_t P0_29;
-  __IO uint32_t P0_30;
-  __IO uint32_t P0_31;
-
-  __IO uint32_t P1_0;				/* 0x080 */
-  __IO uint32_t P1_1;
-  __IO uint32_t P1_2;
-  __IO uint32_t P1_3;
-  __IO uint32_t P1_4;
-  __IO uint32_t P1_5;
-  __IO uint32_t P1_6;
-  __IO uint32_t P1_7;
-
-  __IO uint32_t P1_8;				/* 0x0A0 */
-  __IO uint32_t P1_9;
-  __IO uint32_t P1_10;
-  __IO uint32_t P1_11;
-  __IO uint32_t P1_12;
-  __IO uint32_t P1_13;
-  __IO uint32_t P1_14;
-  __IO uint32_t P1_15;
-
-  __IO uint32_t P1_16;				/* 0x0C0 */
-  __IO uint32_t P1_17;
-  __IO uint32_t P1_18;
-  __IO uint32_t P1_19;
-  __IO uint32_t P1_20;
-  __IO uint32_t P1_21;
-  __IO uint32_t P1_22;
-  __IO uint32_t P1_23;
-
-  __IO uint32_t P1_24;				/* 0x0E0 */
-  __IO uint32_t P1_25;
-  __IO uint32_t P1_26;
-  __IO uint32_t P1_27;
-  __IO uint32_t P1_28;
-  __IO uint32_t P1_29;
-  __IO uint32_t P1_30;
-  __IO uint32_t P1_31;
-
-  __IO uint32_t P2_0;				/* 0x100 */
-  __IO uint32_t P2_1;
-  __IO uint32_t P2_2;
-  __IO uint32_t P2_3;
-  __IO uint32_t P2_4;
-  __IO uint32_t P2_5;
-  __IO uint32_t P2_6;
-  __IO uint32_t P2_7;
-
-  __IO uint32_t P2_8;				/* 0x120 */
-  __IO uint32_t P2_9;
-  __IO uint32_t P2_10;
-  __IO uint32_t P2_11;
-  __IO uint32_t P2_12;
-  __IO uint32_t P2_13;
-  __IO uint32_t P2_14;
-  __IO uint32_t P2_15;
-
-  __IO uint32_t P2_16;				/* 0x140 */
-  __IO uint32_t P2_17;
-  __IO uint32_t P2_18;
-  __IO uint32_t P2_19;
-  __IO uint32_t P2_20;
-  __IO uint32_t P2_21;
-  __IO uint32_t P2_22;
-  __IO uint32_t P2_23;
-
-  __IO uint32_t P2_24;				/* 0x160 */
-  __IO uint32_t P2_25;
-  __IO uint32_t P2_26;
-  __IO uint32_t P2_27;
-  __IO uint32_t P2_28;
-  __IO uint32_t P2_29;
-  __IO uint32_t P2_30;
-  __IO uint32_t P2_31;
-
-  __IO uint32_t P3_0;				/* 0x180 */
-  __IO uint32_t P3_1;
-  __IO uint32_t P3_2;
-  __IO uint32_t P3_3;
-  __IO uint32_t P3_4;
-  __IO uint32_t P3_5;
-  __IO uint32_t P3_6;
-  __IO uint32_t P3_7;
-
-  __IO uint32_t P3_8;				/* 0x1A0 */
-  __IO uint32_t P3_9;
-  __IO uint32_t P3_10;
-  __IO uint32_t P3_11;
-  __IO uint32_t P3_12;
-  __IO uint32_t P3_13;
-  __IO uint32_t P3_14;
-  __IO uint32_t P3_15;
-
-  __IO uint32_t P3_16;				/* 0x1C0 */
-  __IO uint32_t P3_17;
-  __IO uint32_t P3_18;
-  __IO uint32_t P3_19;
-  __IO uint32_t P3_20;
-  __IO uint32_t P3_21;
-  __IO uint32_t P3_22;
-  __IO uint32_t P3_23;
-
-  __IO uint32_t P3_24;				/* 0x1E0 */
-  __IO uint32_t P3_25;
-  __IO uint32_t P3_26;
-  __IO uint32_t P3_27;
-  __IO uint32_t P3_28;
-  __IO uint32_t P3_29;
-  __IO uint32_t P3_30;
-  __IO uint32_t P3_31;
-
-  __IO uint32_t P4_0;				/* 0x200 */
-  __IO uint32_t P4_1;
-  __IO uint32_t P4_2;
-  __IO uint32_t P4_3;
-  __IO uint32_t P4_4;
-  __IO uint32_t P4_5;
-  __IO uint32_t P4_6;
-  __IO uint32_t P4_7;
-
-  __IO uint32_t P4_8;				/* 0x220 */
-  __IO uint32_t P4_9;
-  __IO uint32_t P4_10;
-  __IO uint32_t P4_11;
-  __IO uint32_t P4_12;
-  __IO uint32_t P4_13;
-  __IO uint32_t P4_14;
-  __IO uint32_t P4_15;
-
-  __IO uint32_t P4_16;				/* 0x240 */
-  __IO uint32_t P4_17;
-  __IO uint32_t P4_18;
-  __IO uint32_t P4_19;
-  __IO uint32_t P4_20;
-  __IO uint32_t P4_21;
-  __IO uint32_t P4_22;
-  __IO uint32_t P4_23;
-
-  __IO uint32_t P4_24;				/* 0x260 */
-  __IO uint32_t P4_25;
-  __IO uint32_t P4_26;
-  __IO uint32_t P4_27;
-  __IO uint32_t P4_28;
-  __IO uint32_t P4_29;
-  __IO uint32_t P4_30;
-  __IO uint32_t P4_31;
-
-  __IO uint32_t P5_0;				/* 0x280 */
-  __IO uint32_t P5_1;
-  __IO uint32_t P5_2;
-  __IO uint32_t P5_3;
-  __IO uint32_t P5_4;				/* 0x290 */
-} LPC_IOCON_TypeDef;
-
-
-
-
-
-
-/*------------- Synchronous Serial Communication (SSP) -----------------------*/
-typedef struct
-{
-  __IO uint32_t CR0;                    /*!< Offset: 0x000 Control Register 0 (R/W) */
-  __IO uint32_t CR1;                    /*!< Offset: 0x004 Control Register 1 (R/W) */
-  __IO uint32_t DR;                     /*!< Offset: 0x008 Data Register (R/W) */
-  __I  uint32_t SR;                     /*!< Offset: 0x00C Status Registe (R/ ) */
-  __IO uint32_t CPSR;                   /*!< Offset: 0x010 Clock Prescale Register (R/W) */
-  __IO uint32_t IMSC;                   /*!< Offset: 0x014 Interrupt Mask Set and Clear Register (R/W) */
-  __IO uint32_t RIS;                    /*!< Offset: 0x018 Raw Interrupt Status Register (R/W) */
-  __IO uint32_t MIS;                    /*!< Offset: 0x01C Masked Interrupt Status Register (R/W) */
-  __IO uint32_t ICR;                    /*!< Offset: 0x020 SSPICR Interrupt Clear Register (R/W) */
-  __IO uint32_t DMACR;
-} LPC_SSP_TypeDef;
-
-/*------------- Analog-to-Digital Converter (ADC) ----------------------------*/
-typedef struct
-{
-  __IO uint32_t CR;                     /*!< Offset: 0x000       A/D Control Register (R/W) */
-  __IO uint32_t GDR;                    /*!< Offset: 0x004       A/D Global Data Register (R/W) */
-       uint32_t RESERVED0;
-  __IO uint32_t INTEN;                  /*!< Offset: 0x00C       A/D Interrupt Enable Register (R/W) */
-  __IO uint32_t DR[8];                  /*!< Offset: 0x010-0x02C A/D Channel 0..7 Data Register (R/W) */
-  __I  uint32_t STAT;                   /*!< Offset: 0x030       A/D Status Register (R/ ) */
-  __IO uint32_t ADTRM;
-} LPC_ADC_TypeDef;
-
-/*------------- Controller Area Network (CAN) --------------------------------*/
-typedef struct
-{
-  __IO uint32_t mask[512];              /* ID Masks                           */
-} LPC_CANAF_RAM_TypeDef;
-
-typedef struct                          /* Acceptance Filter Registers        */
-{
-	///Offset: 0x00000000 - Acceptance Filter Register
-	__IO uint32_t AFMR;
-
-	///Offset: 0x00000004 - Standard Frame Individual Start Address Register
-	__IO uint32_t SFF_sa;
-
-	///Offset: 0x00000008 - Standard Frame Group Start Address Register
-	__IO uint32_t SFF_GRP_sa;
-
-	///Offset: 0x0000000C - Extended Frame Start Address Register
-	__IO uint32_t EFF_sa;
-
-	///Offset: 0x00000010 - Extended Frame Group Start Address Register
-	__IO uint32_t EFF_GRP_sa;
-
-	///Offset: 0x00000014 - End of AF Tables register
-	__IO uint32_t ENDofTable;
-
-	///Offset: 0x00000018 - LUT Error Address register
-	__I  uint32_t LUTerrAd;
-
-	///Offset: 0x0000001C - LUT Error Register
-	__I  uint32_t LUTerr;
-
-	///Offset: 0x00000020 - CAN Central Transmit Status Register
-	__IO uint32_t FCANIE;
-
-	///Offset: 0x00000024 - FullCAN Interrupt and Capture registers 0
-	__IO uint32_t FCANIC0;
-
-	///Offset: 0x00000028 - FullCAN Interrupt and Capture registers 1
-	__IO uint32_t FCANIC1;
-} LPC_CANAF_TypeDef;
-
-typedef struct                          /* Central Registers                  */
-{
-  __I  uint32_t TxSR;
-  __I  uint32_t RxSR;
-  __I  uint32_t MSR;
-} LPC_CANCR_TypeDef;
-
-typedef struct                          /* Controller Registers               */
-{
-	///Offset: 0x00000000 - Controls the operating mode of the CAN Controller
-	__IO uint32_t MOD;
-
-	///Offset: 0x00000004 - Command bits that affect the state
-	__O  uint32_t CMR;
-
-	///Offset: 0x00000008 - Global Controller Status and Error Counters
-	__IO uint32_t GSR;
-
-	///Offset: 0x0000000C - Interrupt status, Arbitration Lost Capture, Error Code Capture
-	__I  uint32_t ICR;
-
-	///Offset: 0x00000010 - Interrupt Enable Register
-	__IO uint32_t IER;
-
-	///Offset: 0x00000014 - Bus Timing Register
-	__IO uint32_t BTR;
-
-	///Offset: 0x00000018 - Error Warning Limit
-	__IO uint32_t EWL;
-
-	///Offset: 0x0000001C - Status Register
-	__I  uint32_t SR;
-
-	///Offset: 0x00000020 - Receive frame status
-	__IO uint32_t RFS;
-
-	///Offset: 0x00000024 - Received Identifier
-	__IO uint32_t RID;
-
-	///Offset: 0x00000028 - Received data bytes 1-4
-	__IO uint32_t RDA;
-
-	///Offset: 0x0000002C - Received data bytes 5-8
-	__IO uint32_t RDB;
-
-	///Offset: 0x00000030 - Transmit frame info (Tx Buffer 1)
-	__IO uint32_t TFI1;
-
-	///Offset: 0x00000034 - Transmit Identifier (Tx Buffer 1)
-	__IO uint32_t TID1;
-
-	///Offset: 0x00000038 - Transmit data bytes 1-4 (Tx Buffer 1)
-	__IO uint32_t TDA1;
-
-	///Offset: 0x0000003C - Transmit data bytes 5-8 (Tx Buffer 1)
-	__IO uint32_t TDB1;
-
-	///Offset: 0x00000040 - Transmit frame info (Tx Buffer 2)
-	__IO uint32_t TFI2;
-
-	///Offset: 0x00000044 - Transmit Identifier (Tx Buffer 2)
-	__IO uint32_t TID2;
-
-	///Offset: 0x00000048 - Transmit data bytes 1-4 (Tx Buffer 2)
-	__IO uint32_t TDA2;
-
-	///Offset: 0x0000004C - Transmit data bytes 5-8 (Tx Buffer 2)
-	__IO uint32_t TDB2;
-
-	///Offset: 0x00000050 - Transmit frame info (Tx Buffer 3)
-	__IO uint32_t TFI3;
-
-	///Offset: 0x00000054 - Transmit Identifier (Tx Buffer 3)
-	__IO uint32_t TID3;
-
-	///Offset: 0x00000058 - Transmit data bytes 1-4 (Tx Buffer 3)
-	__IO uint32_t TDA3;
-
-	///Offset: 0x0000005C - Transmit data bytes 5-8 (Tx Buffer 3)
-	__IO uint32_t TDB3;
-} LPC_CAN_TypeDef;
-
-/*------------- Digital-to-Analog Converter (DAC) ----------------------------*/
-typedef struct
-{
-  __IO uint32_t CR;
-  __IO uint32_t CTRL;
-  __IO uint32_t CNTVAL;
-} LPC_DAC_TypeDef;
-
-
-/*------------- Inter IC Sound (I2S) -----------------------------------------*/
-typedef struct
-{
-  __IO uint32_t DAO;
-  __IO uint32_t DAI;
-  __O  uint32_t TXFIFO;
-  __I  uint32_t RXFIFO;
-  __I  uint32_t STATE;
-  __IO uint32_t DMA1;
-  __IO uint32_t DMA2;
-  __IO uint32_t IRQ;
-  __IO uint32_t TXRATE;
-  __IO uint32_t RXRATE;
-  __IO uint32_t TXBITRATE;
-  __IO uint32_t RXBITRATE;
-  __IO uint32_t TXMODE;
-  __IO uint32_t RXMODE;
-} LPC_I2S_TypeDef;
-
-
-
-
-
-
-/*------------- Motor Control Pulse-Width Modulation (MCPWM) -----------------*/
-typedef struct
-{
-  __I  uint32_t CON;
-  __O  uint32_t CON_SET;
-  __O  uint32_t CON_CLR;
-  __I  uint32_t CAPCON;
-  __O  uint32_t CAPCON_SET;
-  __O  uint32_t CAPCON_CLR;
-  __IO uint32_t TC0;
-  __IO uint32_t TC1;
-  __IO uint32_t TC2;
-  __IO uint32_t LIM0;
-  __IO uint32_t LIM1;
-  __IO uint32_t LIM2;
-  __IO uint32_t MAT0;
-  __IO uint32_t MAT1;
-  __IO uint32_t MAT2;
-  __IO uint32_t DT;
-  __IO uint32_t CP;
-  __IO uint32_t CAP0;
-  __IO uint32_t CAP1;
-  __IO uint32_t CAP2;
-  __I  uint32_t INTEN;
-  __O  uint32_t INTEN_SET;
-  __O  uint32_t INTEN_CLR;
-  __I  uint32_t CNTCON;
-  __O  uint32_t CNTCON_SET;
-  __O  uint32_t CNTCON_CLR;
-  __I  uint32_t INTF;
-  __O  uint32_t INTF_SET;
-  __O  uint32_t INTF_CLR;
-  __O  uint32_t CAP_CLR;
-} LPC_MCPWM_TypeDef;
-
-/*------------- Quadrature Encoder Interface (QEI) ---------------------------*/
-typedef struct
-{
-  __O  uint32_t CON;
-  __I  uint32_t STAT;
-  __IO uint32_t CONF;
-  __I  uint32_t POS;
-  __IO uint32_t MAXPOS;
-  __IO uint32_t CMPOS0;
-  __IO uint32_t CMPOS1;
-  __IO uint32_t CMPOS2;
-  __I  uint32_t INXCNT;
-  __IO uint32_t INXCMP0;
-  __IO uint32_t LOAD;
-  __I  uint32_t TIME;
-  __I  uint32_t VEL;
-  __I  uint32_t CAP;
-  __IO uint32_t VELCOMP;
-  __IO uint32_t FILTERPHA;
-  __IO uint32_t FILTERPHB;
-  __IO uint32_t FILTERINX;
-  __IO uint32_t WINDOW;
-  __IO uint32_t INXCMP1;
-  __IO uint32_t INXCMP2;
-       uint32_t RESERVED0[993];
-  __O  uint32_t IEC;
-  __O  uint32_t IES;
-  __I  uint32_t INTSTAT;
-  __I  uint32_t IE;
-  __O  uint32_t CLR;
-  __O  uint32_t SET;
-} LPC_QEI_TypeDef;
-
-/*------------- SD/MMC card Interface (MCI)-----------------------------------*/
-typedef struct
-{
-  __IO uint32_t POWER;
-  __IO uint32_t CLOCK;
-  __IO uint32_t ARGUMENT;
-  __IO uint32_t COMMAND;
-  __I  uint32_t RESP_CMD;
-  __I  uint32_t RESP0;
-  __I  uint32_t RESP1;
-  __I  uint32_t RESP2;
-  __I  uint32_t RESP3;
-  __IO uint32_t DATATMR;
-  __IO uint32_t DATALEN;
-  __IO uint32_t DATACTRL;
-  __I  uint32_t DATACNT;
-  __I  uint32_t STATUS;
-  __O  uint32_t CLEAR;
-  __IO uint32_t MASK0;
-       uint32_t RESERVED0[2];
-  __I  uint32_t FIFOCNT;
-       uint32_t RESERVED1[13];
-  __IO uint32_t FIFO[16];
-} LPC_MCI_TypeDef;
-
-
-
-
-
-
-
-
-
-
-/*------------- EEPROM Controller (EEPROM) -----------------------------------*/
-typedef struct
-{
-  __IO uint32_t CMD;			/* 0x0080 */
-  __IO uint32_t ADDR;
-  __IO uint32_t WDATA;
-  __IO uint32_t RDATA;
-  __IO uint32_t WSTATE;			/* 0x0090 */
-  __IO uint32_t CLKDIV;
-  __IO uint32_t PWRDWN;			/* 0x0098 */
-       uint32_t RESERVED0[975];
-  __IO uint32_t INT_CLR_ENABLE;	/* 0x0FD8 */
-  __IO uint32_t INT_SET_ENABLE;
-  __IO uint32_t INT_STATUS;		/* 0x0FE0 */
-  __IO uint32_t INT_ENABLE;
-  __IO uint32_t INT_CLR_STATUS;
-  __IO uint32_t INT_SET_STATUS;
-} LPC_EEPROM_TypeDef;
-
-
-/*------------- COMPARATOR ----------------------------------------------------*/
-
-typedef struct {                                    /*!< (@ 0x40020000) COMPARATOR Structure                                   */
-  __IO uint32_t  CTRL;                              /*!< (@ 0x40020000) Comparator block control register                      */
-  __IO uint32_t  CTRL0;                             /*!< (@ 0x40020004) Comparator 0 control register                          */
-  __IO uint32_t  CTRL1;                             /*!< (@ 0x40020008) Comparator 1 control register                          */
-} LPC_COMPARATOR_Type;
-
-
-#if defined ( __CC_ARM   )
-#pragma no_anon_unions
-#endif
-
-/******************************************************************************/
-/*                         Peripheral memory map                              */
-/******************************************************************************/
-/* Base addresses                                                             */
-#define LPC_FLASH_BASE        (0x00000000UL)
-#define LPC_RAM_BASE          (0x10000000UL)
-#define LPC_PERI_RAM_BASE     (0x20000000UL)
-#define LPC_APB0_BASE         (0x40000000UL)
-#define LPC_APB1_BASE         (0x40080000UL)
-#define LPC_AHBRAM1_BASE      (0x20004000UL)
-#define LPC_AHB_BASE          (0x20080000UL)
-#define LPC_CM3_BASE          (0xE0000000UL)
-
-/* APB0 peripherals                                                           */
-#define LPC_WDT_BASE          (LPC_APB0_BASE + 0x00000)
-#define LPC_TIM0_BASE         (LPC_APB0_BASE + 0x04000)
-#define LPC_TIM1_BASE         (LPC_APB0_BASE + 0x08000)
-#define LPC_UART0_BASE        (LPC_APB0_BASE + 0x0C000)
-#define LPC_UART1_BASE        (LPC_APB0_BASE + 0x10000)
-#define LPC_PWM0_BASE         (LPC_APB0_BASE + 0x14000)
-#define LPC_PWM1_BASE         (LPC_APB0_BASE + 0x18000)
-#define LPC_I2C0_BASE         (LPC_APB0_BASE + 0x1C000)
-#define LPC_COMPARATOR_BASE   (LPC_APB0_BASE + 0x20000)					
-#define LPC_RTC_BASE          (LPC_APB0_BASE + 0x24000)
-#define LPC_GPIOINT_BASE      (LPC_APB0_BASE + 0x28080)
-#define LPC_IOCON_BASE        (LPC_APB0_BASE + 0x2C000)
-#define LPC_SSP1_BASE         (LPC_APB0_BASE + 0x30000)
-#define LPC_ADC_BASE          (LPC_APB0_BASE + 0x34000)
-#define LPC_CANAF_RAM_BASE    (LPC_APB0_BASE + 0x38000)
-#define LPC_CANAF_BASE        (LPC_APB0_BASE + 0x3C000)
-#define LPC_CANCR_BASE        (LPC_APB0_BASE + 0x40000)
-#define LPC_CAN1_BASE         (LPC_APB0_BASE + 0x44000)
-#define LPC_CAN2_BASE         (LPC_APB0_BASE + 0x48000)
-#define LPC_I2C1_BASE         (LPC_APB0_BASE + 0x5C000)
-
-/* APB1 peripherals                                                           */
-#define LPC_SSP0_BASE         (LPC_APB1_BASE + 0x08000)
-#define LPC_DAC_BASE          (LPC_APB1_BASE + 0x0C000)
-#define LPC_TIM2_BASE         (LPC_APB1_BASE + 0x10000)
-#define LPC_TIM3_BASE         (LPC_APB1_BASE + 0x14000)
-#define LPC_UART2_BASE        (LPC_APB1_BASE + 0x18000)
-#define LPC_UART3_BASE        (LPC_APB1_BASE + 0x1C000)
-#define LPC_I2C2_BASE         (LPC_APB1_BASE + 0x20000)
-#define LPC_UART4_BASE        (LPC_APB1_BASE + 0x24000)
-#define LPC_I2S_BASE          (LPC_APB1_BASE + 0x28000)
-#define LPC_SSP2_BASE         (LPC_APB1_BASE + 0x2C000)
-#define LPC_MCPWM_BASE        (LPC_APB1_BASE + 0x38000)
-#define LPC_QEI_BASE          (LPC_APB1_BASE + 0x3C000)
-#define LPC_MCI_BASE          (LPC_APB1_BASE + 0x40000)
-#define LPC_SC_BASE           (LPC_APB1_BASE + 0x7C000)
-
-/* AHB peripherals                                                            */
-#define LPC_GPDMA_BASE        (LPC_AHB_BASE  + 0x00000)
-#define LPC_GPDMACH0_BASE     (LPC_AHB_BASE  + 0x00100)
-#define LPC_GPDMACH1_BASE     (LPC_AHB_BASE  + 0x00120)
-#define LPC_GPDMACH2_BASE     (LPC_AHB_BASE  + 0x00140)
-#define LPC_GPDMACH3_BASE     (LPC_AHB_BASE  + 0x00160)
-#define LPC_GPDMACH4_BASE     (LPC_AHB_BASE  + 0x00180)
-#define LPC_GPDMACH5_BASE     (LPC_AHB_BASE  + 0x001A0)
-#define LPC_GPDMACH6_BASE     (LPC_AHB_BASE  + 0x001C0)
-#define LPC_GPDMACH7_BASE     (LPC_AHB_BASE  + 0x001E0)
-#define LPC_EMAC_BASE         (LPC_AHB_BASE  + 0x04000)
-#define LPC_LCD_BASE          (LPC_AHB_BASE  + 0x08000)
-#define LPC_USB_BASE          (LPC_AHB_BASE  + 0x0C000)
-#define LPC_CRC_BASE          (LPC_AHB_BASE  + 0x10000)
-#define LPC_GPIO0_BASE        (LPC_AHB_BASE  + 0x18000)
-#define LPC_GPIO1_BASE        (LPC_AHB_BASE  + 0x18020)
-#define LPC_GPIO2_BASE        (LPC_AHB_BASE  + 0x18040)
-#define LPC_GPIO3_BASE        (LPC_AHB_BASE  + 0x18060)
-#define LPC_GPIO4_BASE        (LPC_AHB_BASE  + 0x18080)
-#define LPC_GPIO5_BASE        (LPC_AHB_BASE  + 0x180A0)
-#define LPC_EMC_BASE          (LPC_AHB_BASE  + 0x1C000)
-
-#define LPC_EEPROM_BASE       (LPC_FLASH_BASE+ 0x200080)
-
-
-/******************************************************************************/
-/*                         Peripheral declaration                             */
-/******************************************************************************/
-#define LPC_SC                ((LPC_SC_TypeDef        *) LPC_SC_BASE       )
-#define LPC_WDT               ((LPC_WDT_TypeDef       *) LPC_WDT_BASE      )
-#define LPC_TIM0              ((LPC_TIM_TypeDef       *) LPC_TIM0_BASE     )
-#define LPC_TIM1              ((LPC_TIM_TypeDef       *) LPC_TIM1_BASE     )
-#define LPC_TIM2              ((LPC_TIM_TypeDef       *) LPC_TIM2_BASE     )
-#define LPC_TIM3              ((LPC_TIM_TypeDef       *) LPC_TIM3_BASE     )
-#define LPC_UART0             ((LPC_UART_TypeDef      *) LPC_UART0_BASE    )
-#define LPC_UART1             ((LPC_UART1_TypeDef     *) LPC_UART1_BASE    )
-#define LPC_UART2             ((LPC_UART_TypeDef      *) LPC_UART2_BASE    )
-#define LPC_UART3             ((LPC_UART_TypeDef      *) LPC_UART3_BASE    )
-#define LPC_UART4             ((LPC_UART4_TypeDef     *) LPC_UART4_BASE    )
-#define LPC_PWM0              ((LPC_PWM_TypeDef       *) LPC_PWM0_BASE     )
-#define LPC_PWM1              ((LPC_PWM_TypeDef       *) LPC_PWM1_BASE     )
-#define LPC_I2C0              ((LPC_I2C_TypeDef       *) LPC_I2C0_BASE     )
-#define LPC_I2C1              ((LPC_I2C_TypeDef       *) LPC_I2C1_BASE     )
-#define LPC_I2C2              ((LPC_I2C_TypeDef       *) LPC_I2C2_BASE     )
-#define LPC_I2S               ((LPC_I2S_TypeDef       *) LPC_I2S_BASE      )
-#define LPC_COMPARATOR        ((LPC_COMPARATOR_Type	  *) LPC_COMPARATOR_BASE)
-#define LPC_RTC               ((LPC_RTC_TypeDef       *) LPC_RTC_BASE      )
-#define LPC_GPIOINT           ((LPC_GPIOINT_TypeDef   *) LPC_GPIOINT_BASE  )
-#define LPC_IOCON             ((LPC_IOCON_TypeDef     *) LPC_IOCON_BASE    )
-#define LPC_SSP0              ((LPC_SSP_TypeDef       *) LPC_SSP0_BASE     )
-#define LPC_SSP1              ((LPC_SSP_TypeDef       *) LPC_SSP1_BASE     )
-#define LPC_SSP2              ((LPC_SSP_TypeDef       *) LPC_SSP2_BASE     )
-#define LPC_ADC               ((LPC_ADC_TypeDef       *) LPC_ADC_BASE      )
-#define LPC_DAC               ((LPC_DAC_TypeDef       *) LPC_DAC_BASE      )
-#define LPC_CANAF_RAM         ((LPC_CANAF_RAM_TypeDef *) LPC_CANAF_RAM_BASE)
-#define LPC_CANAF             ((LPC_CANAF_TypeDef     *) LPC_CANAF_BASE    )
-#define LPC_CANCR             ((LPC_CANCR_TypeDef     *) LPC_CANCR_BASE    )
-#define LPC_CAN1              ((LPC_CAN_TypeDef       *) LPC_CAN1_BASE     )
-#define LPC_CAN2              ((LPC_CAN_TypeDef       *) LPC_CAN2_BASE     )
-#define LPC_MCPWM             ((LPC_MCPWM_TypeDef     *) LPC_MCPWM_BASE    )
-#define LPC_QEI               ((LPC_QEI_TypeDef       *) LPC_QEI_BASE      )
-#define LPC_MCI               ((LPC_MCI_TypeDef       *) LPC_MCI_BASE      )
-#define LPC_GPDMA             ((LPC_GPDMA_TypeDef     *) LPC_GPDMA_BASE    )
-#define LPC_GPDMACH0          ((LPC_GPDMACH_TypeDef   *) LPC_GPDMACH0_BASE )
-#define LPC_GPDMACH1          ((LPC_GPDMACH_TypeDef   *) LPC_GPDMACH1_BASE )
-#define LPC_GPDMACH2          ((LPC_GPDMACH_TypeDef   *) LPC_GPDMACH2_BASE )
-#define LPC_GPDMACH3          ((LPC_GPDMACH_TypeDef   *) LPC_GPDMACH3_BASE )
-#define LPC_GPDMACH4          ((LPC_GPDMACH_TypeDef   *) LPC_GPDMACH4_BASE )
-#define LPC_GPDMACH5          ((LPC_GPDMACH_TypeDef   *) LPC_GPDMACH5_BASE )
-#define LPC_GPDMACH6          ((LPC_GPDMACH_TypeDef   *) LPC_GPDMACH6_BASE )
-#define LPC_GPDMACH7          ((LPC_GPDMACH_TypeDef   *) LPC_GPDMACH7_BASE )
-#define LPC_EMAC              ((LPC_EMAC_TypeDef      *) LPC_EMAC_BASE     )
-#define LPC_LCD               ((LPC_LCD_TypeDef       *) LPC_LCD_BASE      )
-#define LPC_USB               ((LPC_USB_TypeDef       *) LPC_USB_BASE      )
-#define LPC_GPIO0             ((LPC_GPIO_TypeDef      *) LPC_GPIO0_BASE    )
-#define LPC_GPIO1             ((LPC_GPIO_TypeDef      *) LPC_GPIO1_BASE    )
-#define LPC_GPIO2             ((LPC_GPIO_TypeDef      *) LPC_GPIO2_BASE    )
-#define LPC_GPIO3             ((LPC_GPIO_TypeDef      *) LPC_GPIO3_BASE    )
-#define LPC_GPIO4             ((LPC_GPIO_TypeDef      *) LPC_GPIO4_BASE    )
-#define LPC_GPIO5             ((LPC_GPIO_TypeDef      *) LPC_GPIO5_BASE    )
-#define LPC_EMC               ((LPC_EMC_TypeDef       *) LPC_EMC_BASE      )
-#define LPC_CRC               ((LPC_CRC_TypeDef       *) LPC_CRC_BASE      )
-#define LPC_EEPROM            ((LPC_EEPROM_TypeDef    *) LPC_EEPROM_BASE   )
-
-
-
-#endif  // __LPC407x_8x_177x_8x_H__
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_ARM_STD/TARGET_LPC4088/LPC407X_8X.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-; *************************************************************
-; *** Scatter-Loading Description File generated by uVision ***
-; *************************************************************
-
-LR_IROM1 0x00000000 0x00080000  {    ; load region size_region
-  ER_IROM1 0x00000000 0x00080000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  RW_IRAM1 0x100000E8 0x0000FF18  {  ; RW data
-   .ANY (+RW +ZI)
-  }
-  RW_IRAM2 0x20000000 0x00008000  {
-   .ANY (AHBSRAM1)
-  }
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_ARM_STD/TARGET_LPC4088_EA/LPC407X_8X.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-; *************************************************************
-; *** Scatter-Loading Description File generated by uVision ***
-; *************************************************************
-
-LR_IROM1 0x00000000 0x00080000  {    ; load region size_region
-  ER_IROM1 0x00000000 0x00080000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  RW_IRAM1 0x100000E8 0x0000FF18  {  ; RW data
-   .ANY (+RW +ZI)
-  }
-  RW_IRAM2 0x20000000 0x00004000  {
-   .ANY (AHBSRAM0)
-  }
-  RW_IRAM3 0x20004000 0x00004000  {
-   .ANY (AHBSRAM1)
-  }
-}
-
-LR_IROM2 0x28000000 0x01000000  {
-  ER_IROM2 0x28000000 0x01000000  {  ; load address = execution address
-    .ANY (+RO)
-  }
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_ARM_STD/startup_LPC407x_8x_177x_8x.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,254 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_LPC407x_8x.s
-; * @purpose: CMSIS Cortex-M4 Core Device Startup File
-; *           for the NXP LPC407x_8x Device Series
-; * @version: V1.20
-; * @date:    16. January 2012
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; * Copyright (C) 2012 ARM Limited. All rights reserved.
-; * ARM Limited (ARM) is supplying this software for use with Cortex-M4
-; * processor based microcontrollers.  This file can be freely distributed
-; * within development tools that are supporting such ARM based processors.
-; *
-; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
-; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
-; *
-; *****************************************************************************/
-
-
-
-__initial_sp        EQU     0x10010000  ; Top of RAM from LPC4088
-
-                PRESERVE8
-                THUMB
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-
-__Vectors       DCD     __initial_sp              ; Top of Stack
-                DCD     Reset_Handler             ; Reset Handler
-                DCD     NMI_Handler               ; NMI Handler
-                DCD     HardFault_Handler         ; Hard Fault Handler
-                DCD     MemManage_Handler         ; MPU Fault Handler
-                DCD     BusFault_Handler          ; Bus Fault Handler
-                DCD     UsageFault_Handler        ; Usage Fault Handler
-                ; DCD   0xEFFFF5D6                ; Reserved- vector sum
-                DCD     0xEFFFF39E                ; Reserved- vector sum
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     SVC_Handler               ; SVCall Handler
-                DCD     DebugMon_Handler          ; Debug Monitor Handler
-                DCD     0                         ; Reserved
-                DCD     PendSV_Handler            ; PendSV Handler
-                DCD     SysTick_Handler           ; SysTick Handler
-
-                ; External Interrupts
-                DCD     WDT_IRQHandler            ; 16: Watchdog Timer
-                DCD     TIMER0_IRQHandler         ; 17: Timer0
-                DCD     TIMER1_IRQHandler         ; 18: Timer1
-                DCD     TIMER2_IRQHandler         ; 19: Timer2
-                DCD     TIMER3_IRQHandler         ; 20: Timer3
-                DCD     UART0_IRQHandler          ; 21: UART0
-                DCD     UART1_IRQHandler          ; 22: UART1
-                DCD     UART2_IRQHandler          ; 23: UART2
-                DCD     UART3_IRQHandler          ; 24: UART3
-                DCD     PWM1_IRQHandler           ; 25: PWM1
-                DCD     I2C0_IRQHandler           ; 26: I2C0
-                DCD     I2C1_IRQHandler           ; 27: I2C1
-                DCD     I2C2_IRQHandler           ; 28: I2C2
-                DCD     0                         ; 29: reserved, not for SPIFI anymore
-                DCD     SSP0_IRQHandler           ; 30: SSP0
-                DCD     SSP1_IRQHandler           ; 31: SSP1
-                DCD     PLL0_IRQHandler           ; 32: PLL0 Lock (Main PLL)
-                DCD     RTC_IRQHandler            ; 33: Real Time Clock
-                DCD     EINT0_IRQHandler          ; 34: External Interrupt 0
-                DCD     EINT1_IRQHandler          ; 35: External Interrupt 1
-                DCD     EINT2_IRQHandler          ; 36: External Interrupt 2
-                DCD     EINT3_IRQHandler          ; 37: External Interrupt 3
-                DCD     ADC_IRQHandler            ; 38: A/D Converter
-                DCD     BOD_IRQHandler            ; 39: Brown-Out Detect
-                DCD     USB_IRQHandler            ; 40: USB
-                DCD     CAN_IRQHandler            ; 41: CAN
-                DCD     DMA_IRQHandler            ; 42: General Purpose DMA
-                DCD     I2S_IRQHandler            ; 43: I2S
-                DCD     ENET_IRQHandler           ; 44: Ethernet
-                DCD     MCI_IRQHandler            ; 45: SD/MMC card I/F
-                DCD     MCPWM_IRQHandler          ; 46: Motor Control PWM
-                DCD     QEI_IRQHandler            ; 47: Quadrature Encoder Interface
-                DCD     PLL1_IRQHandler           ; 48: PLL1 Lock (USB PLL)
-                DCD     USBActivity_IRQHandler    ; 49: USB Activity interrupt to wakeup
-                DCD     CANActivity_IRQHandler    ; 50: CAN Activity interrupt to wakeup
-                DCD     UART4_IRQHandler          ; 51: UART4
-                DCD     SSP2_IRQHandler           ; 52: SSP2
-                DCD     LCD_IRQHandler            ; 53: LCD
-                DCD     GPIO_IRQHandler           ; 54: GPIO
-                DCD     PWM0_IRQHandler           ; 55: PWM0
-                DCD     EEPROM_IRQHandler         ; 56: EEPROM
-
-
-                IF      :LNOT::DEF:NO_CRP
-                AREA    |.ARM.__at_0x02FC|, CODE, READONLY
-CRP_Key         DCD     0xFFFFFFFF
-                ENDIF
-
-
-                AREA    |.text|, CODE, READONLY
-
-
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-
-; Dummy Exception Handlers (infinite loops which can be modified)
-
-NMI_Handler     PROC
-                EXPORT  NMI_Handler               [WEAK]
-                B       .
-                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-MemManage_Handler\
-                PROC
-                EXPORT  MemManage_Handler         [WEAK]
-                B       .
-                ENDP
-BusFault_Handler\
-                PROC
-                EXPORT  BusFault_Handler          [WEAK]
-                B       .
-                ENDP
-UsageFault_Handler\
-                PROC
-                EXPORT  UsageFault_Handler        [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-DebugMon_Handler\
-                PROC
-                EXPORT  DebugMon_Handler          [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-
-                EXPORT  WDT_IRQHandler            [WEAK]
-                EXPORT  TIMER0_IRQHandler         [WEAK]
-                EXPORT  TIMER1_IRQHandler         [WEAK]
-                EXPORT  TIMER2_IRQHandler         [WEAK]
-                EXPORT  TIMER3_IRQHandler         [WEAK]
-                EXPORT  UART0_IRQHandler          [WEAK]
-                EXPORT  UART1_IRQHandler          [WEAK]
-                EXPORT  UART2_IRQHandler          [WEAK]
-                EXPORT  UART3_IRQHandler          [WEAK]
-                EXPORT  PWM1_IRQHandler           [WEAK]
-                EXPORT  I2C0_IRQHandler           [WEAK]
-                EXPORT  I2C1_IRQHandler           [WEAK]
-                EXPORT  I2C2_IRQHandler           [WEAK]
-                ;EXPORT  SPIFI_IRQHandler          [WEAK]
-                EXPORT  SSP0_IRQHandler           [WEAK]
-                EXPORT  SSP1_IRQHandler           [WEAK]
-                EXPORT  PLL0_IRQHandler           [WEAK]
-                EXPORT  RTC_IRQHandler            [WEAK]
-                EXPORT  EINT0_IRQHandler          [WEAK]
-                EXPORT  EINT1_IRQHandler          [WEAK]
-                EXPORT  EINT2_IRQHandler          [WEAK]
-                EXPORT  EINT3_IRQHandler          [WEAK]
-                EXPORT  ADC_IRQHandler            [WEAK]
-                EXPORT  BOD_IRQHandler            [WEAK]
-                EXPORT  USB_IRQHandler            [WEAK]
-                EXPORT  CAN_IRQHandler            [WEAK]
-                EXPORT  DMA_IRQHandler            [WEAK]
-                EXPORT  I2S_IRQHandler            [WEAK]
-                EXPORT  ENET_IRQHandler           [WEAK]
-                EXPORT  MCI_IRQHandler            [WEAK]
-                EXPORT  MCPWM_IRQHandler          [WEAK]
-                EXPORT  QEI_IRQHandler            [WEAK]
-                EXPORT  PLL1_IRQHandler           [WEAK]
-                EXPORT  USBActivity_IRQHandler    [WEAK]
-                EXPORT  CANActivity_IRQHandler    [WEAK]
-                EXPORT  UART4_IRQHandler          [WEAK]
-                EXPORT  SSP2_IRQHandler           [WEAK]
-                EXPORT  LCD_IRQHandler            [WEAK]
-                EXPORT  GPIO_IRQHandler           [WEAK]
-                EXPORT  PWM0_IRQHandler           [WEAK]
-                EXPORT  EEPROM_IRQHandler         [WEAK]
-
-WDT_IRQHandler
-TIMER0_IRQHandler
-TIMER1_IRQHandler
-TIMER2_IRQHandler
-TIMER3_IRQHandler
-UART0_IRQHandler
-UART1_IRQHandler
-UART2_IRQHandler
-UART3_IRQHandler
-PWM1_IRQHandler
-I2C0_IRQHandler
-I2C1_IRQHandler
-I2C2_IRQHandler
-;SPIFI_IRQHandler ;not used
-SSP0_IRQHandler
-SSP1_IRQHandler
-PLL0_IRQHandler
-RTC_IRQHandler
-EINT0_IRQHandler
-EINT1_IRQHandler
-EINT2_IRQHandler
-EINT3_IRQHandler
-ADC_IRQHandler
-BOD_IRQHandler
-USB_IRQHandler
-CAN_IRQHandler
-DMA_IRQHandler
-I2S_IRQHandler
-ENET_IRQHandler
-MCI_IRQHandler
-MCPWM_IRQHandler
-QEI_IRQHandler
-PLL1_IRQHandler
-USBActivity_IRQHandler
-CANActivity_IRQHandler
-UART4_IRQHandler
-SSP2_IRQHandler
-LCD_IRQHandler
-GPIO_IRQHandler
-PWM0_IRQHandler
-EEPROM_IRQHandler
-
-                B       .
-
-                ENDP
-
-
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_ARM_STD/sys.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library - stackheap
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * Setup a fixed single stack/heap memory model, 
- *  between the top of the RW/ZI region and the stackpointer
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-#include <rt_misc.h>
-#include <stdint.h>
-
-extern char Image$$RW_IRAM1$$ZI$$Limit[];
-
-extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
-    uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
-    uint32_t sp_limit = __current_sp();
-
-    zi_limit = (zi_limit + 7) & ~0x7;    // ensure zi_limit is 8-byte aligned
-
-    struct __initial_stackheap r;
-    r.heap_base = zi_limit;
-    r.heap_limit = sp_limit;
-    return r;
-}
-
-#ifdef __cplusplus
-}
-#endif 
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_GCC_CR/LPC407x_8x.ld	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-/*
- * GENERATED FILE - DO NOT EDIT
- * (C) Code Red Technologies Ltd, 2008-2013
- * Generated linker script file for LPC4088
- * Created from generic_c.ld (vLPCXpresso v5.1 (2 [Build 2065] [2013-02-20] ))
- * By LPCXpresso v5.1.2 [Build 2065] [2013-02-20]  on Wed Apr 17 14:50:07 CEST 2013
- */
-
-
-GROUP(libgcc.a libc.a libstdc++.a libm.a libcr_newlib_nohost.a crti.o crtn.o crtbegin.o crtend.o)
-
-MEMORY
-{
-  /* Define each memory region */
-  MFlash512 (rx) : ORIGIN = 0x0, LENGTH = 0x80000 /* 512k */
-  RamLoc64 (rwx) : ORIGIN = 0x100000E8, LENGTH = 0xFF18 /* 64k */
-  RamPeriph32 (rwx) : ORIGIN = 0x20000000, LENGTH = 0x8000 /* 32k */
-
-}
-  /* Define a symbol for the top of each memory region */
-  __top_MFlash512 = 0x0 + 0x80000;
-  __top_RamLoc64 = 0x10000000 + 0x10000;
-  __top_RamPeriph32 = 0x20000000 + 0x8000;
-
-ENTRY(ResetISR)
-
-SECTIONS
-{
-
-    /* MAIN TEXT SECTION */    
-    .text : ALIGN(4)
-    {
-        FILL(0xff)
-        KEEP(*(.isr_vector))
-        
-        /* Global Section Table */
-        . = ALIGN(4) ;
-        __section_table_start = .;
-        __data_section_table = .;
-        LONG(LOADADDR(.data));
-        LONG(    ADDR(.data)) ;
-        LONG(  SIZEOF(.data));
-        LONG(LOADADDR(.data_RAM2));
-        LONG(    ADDR(.data_RAM2)) ;
-        LONG(  SIZEOF(.data_RAM2));
-        __data_section_table_end = .;
-        __bss_section_table = .;
-        LONG(    ADDR(.bss));
-        LONG(  SIZEOF(.bss));
-        LONG(    ADDR(.bss_RAM2));
-        LONG(  SIZEOF(.bss_RAM2));
-        __bss_section_table_end = .;
-        __section_table_end = . ;
-        /* End of Global Section Table */
-        
-
-        *(.after_vectors*)
-        
-        *(.text*)
-        *(.rodata .rodata.*)
-        . = ALIGN(4);
-        
-        /* C++ constructors etc */
-        . = ALIGN(4);
-        KEEP(*(.init))
-        
-        . = ALIGN(4);
-        __preinit_array_start = .;
-        KEEP (*(.preinit_array))
-        __preinit_array_end = .;
-        
-        . = ALIGN(4);
-        __init_array_start = .;
-        KEEP (*(SORT(.init_array.*)))
-        KEEP (*(.init_array))
-        __init_array_end = .;
-        
-        KEEP(*(.fini));
-        
-        . = ALIGN(4);
-        KEEP (*crtbegin.o(.ctors))
-        KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
-        KEEP (*(SORT(.ctors.*)))
-        KEEP (*crtend.o(.ctors))
-        
-        . = ALIGN(4);
-        KEEP (*crtbegin.o(.dtors))
-        KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
-        KEEP (*(SORT(.dtors.*)))
-        KEEP (*crtend.o(.dtors))
-        /* End C++ */
-    } > MFlash512
-
-    /*
-     * for exception handling/unwind - some Newlib functions (in common
-     * with C++ and STDC++) use this. 
-     */
-    .ARM.extab : ALIGN(4)
-    {
-    	*(.ARM.extab* .gnu.linkonce.armextab.*)
-    } > MFlash512
-    __exidx_start = .;
-    
-    .ARM.exidx : ALIGN(4)
-    {
-    	*(.ARM.exidx* .gnu.linkonce.armexidx.*)
-    } > MFlash512
-    __exidx_end = .;
-    
-    _etext = .;
-        
-    
-    /* DATA section for RamPeriph32 */
-    .data_RAM2 : ALIGN(4)
-    {
-       FILL(0xff)
-    	*(.data.$RAM2*)
-    	*(.data.$RamPeriph32*)
-       . = ALIGN(4) ;
-    } > RamPeriph32 AT>MFlash512
-    
-    /* MAIN DATA SECTION */
-    
-
-    .uninit_RESERVED : ALIGN(4)
-    {
-        KEEP(*(.bss.$RESERVED*))
-        . = ALIGN(4) ;
-        _end_uninit_RESERVED = .;
-    } > RamLoc64
-
-    .data : ALIGN(4)
-    {
-        FILL(0xff)
-        _data = .;
-        *(vtable)
-        *(.data*)
-        . = ALIGN(4) ;
-        _edata = .;
-    } > RamLoc64 AT>MFlash512
-
-    /* BSS section for RamPeriph32 */
-    .bss_RAM2 : ALIGN(4)
-    {
-    	*(.bss.$RAM2*)
-    	*(.bss.$RamPeriph32*)
-       . = ALIGN(4) ;
-    } > RamPeriph32
-
-    /* MAIN BSS SECTION */
-    .bss : ALIGN(4)
-    {
-        _bss = .;
-        *(.bss*)
-        *(COMMON)
-        . = ALIGN(4) ;
-        _ebss = .;
-        PROVIDE(end = .);
-    } > RamLoc64
-        
-    /* NOINIT section for RamPeriph32 */
-    .noinit_RAM2 (NOLOAD) : ALIGN(4)
-    {
-    	*(.noinit.$RAM2*)
-    	*(.noinit.$RamPeriph32*)
-       . = ALIGN(4) ;
-    } > RamPeriph32 
-    
-    /* DEFAULT NOINIT SECTION */
-    .noinit (NOLOAD): ALIGN(4)
-    {
-        _noinit = .;
-        *(.noinit*) 
-         . = ALIGN(4) ;
-        _end_noinit = .;
-    } > RamLoc64
-    
-    PROVIDE(_pvHeapStart = .);
-    PROVIDE(_vStackTop = __top_RamLoc64 - 0);
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_GCC_CR/startup_lpc407x_8x.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,433 +0,0 @@
-//*****************************************************************************
-//   +--+       
-//   | ++----+   
-//   +-++    |  
-//     |     |  
-//   +-+--+  |   
-//   | +--+--+  
-//   +----+    Copyright (c) 2012 Code Red Technologies Ltd.
-//
-// LPC407x_8x Microcontroller Startup code for use with Red Suite
-//
-// Version : 120624
-//
-// Software License Agreement
-// 
-// The software is owned by Code Red Technologies and/or its suppliers, and is 
-// protected under applicable copyright laws.  All rights are reserved.  Any 
-// use in violation of the foregoing restrictions may subject the user to criminal 
-// sanctions under applicable laws, as well as to civil liability for the breach
-// of the terms and conditions of this license.
-// 
-// THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-// USE OF THIS SOFTWARE FOR COMMERCIAL DEVELOPMENT AND/OR EDUCATION IS SUBJECT
-// TO A CURRENT END USER LICENSE AGREEMENT (COMMERCIAL OR EDUCATIONAL) WITH
-// CODE RED TECHNOLOGIES LTD. 
-//
-//*****************************************************************************
-#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 (__USE_CMSIS)
-#include "LPC407x_8x_177x_8x.h"
-//#endif
-
-//*****************************************************************************
-#if defined (__cplusplus)
-extern "C" {
-#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 TIMER0_IRQHandler(void) ALIAS(IntDefaultHandler);
-void TIMER1_IRQHandler(void) ALIAS(IntDefaultHandler);
-void TIMER2_IRQHandler(void) ALIAS(IntDefaultHandler);
-void TIMER3_IRQHandler(void) ALIAS(IntDefaultHandler);
-void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
-void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
-void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
-void UART3_IRQHandler(void) ALIAS(IntDefaultHandler);
-void PWM1_IRQHandler(void) ALIAS(IntDefaultHandler);
-void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
-void I2C1_IRQHandler(void) ALIAS(IntDefaultHandler);
-void I2C2_IRQHandler(void) ALIAS(IntDefaultHandler);
-void SPI_IRQHandler(void) ALIAS(IntDefaultHandler);
-void SSP0_IRQHandler(void) ALIAS(IntDefaultHandler);
-void SSP1_IRQHandler(void) ALIAS(IntDefaultHandler);
-void PLL0_IRQHandler(void) ALIAS(IntDefaultHandler);
-void RTC_IRQHandler(void) ALIAS(IntDefaultHandler);
-void EINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
-void EINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
-void EINT2_IRQHandler(void) ALIAS(IntDefaultHandler);
-void EINT3_IRQHandler(void) ALIAS(IntDefaultHandler);
-void ADC_IRQHandler(void) ALIAS(IntDefaultHandler);
-void BOD_IRQHandler(void) ALIAS(IntDefaultHandler);
-void USB_IRQHandler(void) ALIAS(IntDefaultHandler);
-void CAN_IRQHandler(void) ALIAS(IntDefaultHandler);
-void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
-void I2S_IRQHandler(void) ALIAS(IntDefaultHandler);
-void ENET_IRQHandler(void) ALIAS(IntDefaultHandler);
-void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
-void MCPWM_IRQHandler(void) ALIAS(IntDefaultHandler);
-void QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
-void PLL1_IRQHandler(void) ALIAS(IntDefaultHandler);
-void USBActivity_IRQHandler(void) ALIAS(IntDefaultHandler);
-void CANActivity_IRQHandler(void) ALIAS(IntDefaultHandler);
-void MCI_IRQHandler(void) ALIAS(IntDefaultHandler);
-void UART4_IRQHandler(void) ALIAS(IntDefaultHandler);
-void SSP2_IRQHandler(void) ALIAS(IntDefaultHandler);
-void LCD_IRQHandler(void) ALIAS(IntDefaultHandler);
-void GPIO_IRQHandler(void) ALIAS(IntDefaultHandler);
-void PWM0_IRQHandler(void) ALIAS(IntDefaultHandler);
-void EEPROM_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 - LPC17
-	WDT_IRQHandler,							// 16, 0x40 - WDT
-	TIMER0_IRQHandler,						// 17, 0x44 - TIMER0
-	TIMER1_IRQHandler,						// 18, 0x48 - TIMER1
-	TIMER2_IRQHandler,						// 19, 0x4c - TIMER2
-	TIMER3_IRQHandler,						// 20, 0x50 - TIMER3
-	UART0_IRQHandler,						// 21, 0x54 - UART0
-	UART1_IRQHandler,						// 22, 0x58 - UART1
-	UART2_IRQHandler,						// 23, 0x5c - UART2
-	UART3_IRQHandler,						// 24, 0x60 - UART3
-	PWM1_IRQHandler,						// 25, 0x64 - PWM1
-	I2C0_IRQHandler,						// 26, 0x68 - I2C0
-	I2C1_IRQHandler,						// 27, 0x6c - I2C1
-	I2C2_IRQHandler,						// 28, 0x70 - I2C2
-	IntDefaultHandler,						// 29, Not used
-	SSP0_IRQHandler,						// 30, 0x78 - SSP0
-	SSP1_IRQHandler,						// 31, 0x7c - SSP1
-	PLL0_IRQHandler,						// 32, 0x80 - PLL0 (Main PLL)
-	RTC_IRQHandler,							// 33, 0x84 - RTC
-	EINT0_IRQHandler,						// 34, 0x88 - EINT0
-	EINT1_IRQHandler,						// 35, 0x8c - EINT1
-	EINT2_IRQHandler,						// 36, 0x90 - EINT2
-	EINT3_IRQHandler,						// 37, 0x94 - EINT3
-	ADC_IRQHandler,							// 38, 0x98 - ADC
-	BOD_IRQHandler,							// 39, 0x9c - BOD
-	USB_IRQHandler,							// 40, 0xA0 - USB
-	CAN_IRQHandler,							// 41, 0xa4 - CAN
-	DMA_IRQHandler,							// 42, 0xa8 - GP DMA
-	I2S_IRQHandler,							// 43, 0xac - I2S
-	ENET_IRQHandler,						// 44, 0xb0 - Ethernet
-	MCI_IRQHandler,							// 45, 0xb4 - SD/MMC card I/F
-	MCPWM_IRQHandler,						// 46, 0xb8 - Motor Control PWM
-	QEI_IRQHandler,							// 47, 0xbc - Quadrature Encoder
-	PLL1_IRQHandler,						// 48, 0xc0 - PLL1 (USB PLL)
-	USBActivity_IRQHandler,						// 49, 0xc4 - USB Activity interrupt to wakeup
-	CANActivity_IRQHandler, 					// 50, 0xc8 - CAN Activity interrupt to wakeup
-	UART4_IRQHandler, 						// 51, 0xcc - UART4
-
-	SSP2_IRQHandler, 						// 52, 0xd0 - SSP2
-	LCD_IRQHandler, 						// 53, 0xd4 - LCD
-	GPIO_IRQHandler, 						// 54, 0xd8 - GPIO
-	PWM0_IRQHandler, 						// 55, 0xdc - PWM0
-	EEPROM_IRQHandler, 						// 56, 0xe0 - EEPROM
-
-};
-
-//*****************************************************************************
-// 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 (__VFP_FP__) && !defined (__SOFTFP__)
-/*
- * Code to enable the Cortex-M4 FPU only included
- * if appropriate build options have been selected.
- * Code taken from Section 7.1, Cortex-M4 TRM (DDI0439C)
- */	 
-    // Read CPACR (located at address 0xE000ED88)
-    // Set bits 20-23 to enable CP10 and CP11 coprocessors
-    // Write back the modified value to the CPACR
-	asm volatile ("LDR.W R0, =0xE000ED88\n\t"
-                  "LDR R1, [R0]\n\t"
-                  "ORR R1, R1, #(0xF << 20)\n\t"
-                  "STR R1, [R0]");	
-#endif // (__VFP_FP__) && !(__SOFTFP__)
-
-	// Check to see if we are running the code from a non-zero
-    // address (eg RAM, external flash), in which case we need
-    // to modify the VTOR register to tell the CPU that the
-    // vector table is located at a non-0x0 address.
-
-	// Note that we do not use the CMSIS register access mechanism,
-	// as there is no guarantee that the project has been configured
-	// to use CMSIS.
-	unsigned int * pSCB_VTOR = (unsigned int *) 0xE000ED08;
-	if ((unsigned int *)g_pfnVectors!=(unsigned int *) 0x00000000) {
-		// CMSIS : SCB->VTOR = <address of vector table>
-		*pSCB_VTOR = (unsigned int)g_pfnVectors;
-	}
-
-//#ifdef __USE_CMSIS
-	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)
-    {
-    }
-}
-
-#include <stdlib.h>
-
-void *operator new(size_t size)  {return malloc(size);}
-void *operator new[](size_t size){return malloc(size);}
-
-void operator delete(void *p)   {free(p);}
-void operator delete[](void *p) {free(p);}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC408X/cmsis.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-/* mbed Microcontroller Library - CMSIS
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * A generic CMSIS include header, pulling in LPC407x_8x specifics
- */
-
-#ifndef MBED_CMSIS_H
-#define MBED_CMSIS_H
-
-#include "LPC407x_8x_177x_8x.h"
-#include "cmsis_nvic.h"
-
-#endif
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC408X/cmsis_nvic.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic for LCP407x_8x
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */ 
-#include "cmsis_nvic.h"
-
-#define NVIC_RAM_VECTOR_ADDRESS   (0x10000000)  // Location of vectors in RAM
-#define NVIC_FLASH_VECTOR_ADDRESS (0x0)       // Initial vector position in flash
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
-    uint32_t *vectors = (uint32_t*)SCB->VTOR;
-    uint32_t i;
-
-    // Copy and switch to dynamic vectors if the first time called
-    if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
-        uint32_t *old_vectors = vectors;
-        vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
-        for (i=0; i<NVIC_NUM_VECTORS; i++) {
-            vectors[i] = old_vectors[i];
-        }
-        SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
-    }
-    vectors[IRQn + 16] = vector;
-}
-
-uint32_t NVIC_GetVector(IRQn_Type IRQn) {
-    uint32_t *vectors = (uint32_t*)SCB->VTOR;
-    return vectors[IRQn + 16];
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC408X/cmsis_nvic.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */ 
-
-#ifndef MBED_CMSIS_NVIC_H
-#define MBED_CMSIS_NVIC_H
-
-#define NVIC_NUM_VECTORS      (16 + 41)   // CORE + MCU Peripherals
-#define NVIC_USER_IRQ_OFFSET  16
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
-uint32_t NVIC_GetVector(IRQn_Type IRQn);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC408X/system_LPC407x_8x_177x_8x.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,571 +0,0 @@
-/**********************************************************************
-* $Id$		system_LPC407x_8x_177x_8x.c			2012-01-16
-*//**
-* @file		system_LPC407x_8x_177x_8x.c
-* @brief	CMSIS Cortex-M3, M4 Device Peripheral Access Layer Source File
-*          	for the NXP LPC407x_8x_177x_8x Device Series
-*
-*			ARM Limited (ARM) is supplying this software for use with
-*			Cortex-M processor based microcontrollers.  This file can be
-*			freely distributed within development tools that are supporting
-*			such ARM based processors.
-*
-* @version	1.2
-* @date		20. June. 2012
-* @author	NXP MCU SW Application Team
-*
-* Copyright(C) 2012, 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.
-**********************************************************************/
-
-#include <stdint.h>
-#include "LPC407x_8x_177x_8x.h"
-#include "system_LPC407x_8x_177x_8x.h"
-
-#define __CLK_DIV(x,y) (((y) == 0) ? 0: (x)/(y))
-
-/*
-//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-*/
-/*--------------------- Clock Configuration ----------------------------------
-//
-//	<e>	Clock Configuration
-//		<h>	System Controls and Status Register (SCS - address 0x400F C1A0)
-//			<o1.0>	EMC Shift Control Bit
-//					<i>		Controls how addresses are output on the EMC address pins for static memories
-//					<0=>	Static CS addresses match bus width; AD[1] = 0 for 32 bit, AD[0] = 0 for 16+32 bit (Bit 0 is 0)
-//					<1=>	Static CS addresses start at LSB 0 regardless of memory width (Bit 0 is 1)
-//
-//			<o1.1>	EMC Reset Disable Bit
-//					<i>		If 0 (zero), all registers and functions of the EMC are initialized upon any reset condition
-//					<i>		If 1, EMC is still retained its state through a warm reset
-//					<0=>	Both EMC resets are asserted when any type of chip reset event occurs (Bit 1 is 0)
-//					<1=>	Portions of EMC will only be reset by POR or BOR event (Bit 1 is 1)
-//
-//			<o1.2>	EMC Burst Control
-//					<i>		Set to 1 to prevent multiple sequential accesses to memory via EMC static memory chip selects
-//					<0=>	Burst enabled (Bit 2 is 0)
-//					<1=>	Bust disbled (Bit 2 is 1)
-//
-//			<o1.3>	MCIPWR Active Level
-//					<i>		Selects the active level for the SD card interface signal SD_PWR
-//					<0=>	SD_PWR is active low (inverted output of the SD Card interface block) (Bit 3 is 0)
-//					<1=>	SD_PWR is active high (follows the output of the SD Card interface block) (Bit 3 is 1)
-//
-//			<o1.4>	Main Oscillator Range Select
-//					<0=>	In Range 1 MHz to 20 MHz (Bit 4 is 0)
-//					<1=>	In Range 15 MHz to 25 MHz (Bit 4 is 1)
-//
-//			<o1.5>	Main Oscillator enable
-//					<i>		0 (zero) means disabled, 1 means enable
-//
-//			<o1.6>	Main Oscillator status (Read-Only)
-//		</h>
-//
-//		<h>	Clock Source Select Register (CLKSRCSEL - address 0x400F C10C)
-//			<o2.0>	CLKSRC: Select the clock source for sysclk to PLL0 clock
-//					<0=>	Internal RC oscillator (Bit 0 is 0)
-//					<1=>	Main oscillator (Bit 0 is 1)
-//		</h>
-//
-//		<e3>PLL0 Configuration (Main PLL PLL0CFG - address 0x400F C084)
-//			<i>			F_in  is in the range of 1 MHz to 25 MHz
-//			<i>			F_cco = (F_in * M * 2 * P) is in range of 156 MHz to 320 MHz
-//			<i>			PLL out clock = (F_cco / (2 * P)) is in rane of 9.75 MHz to 160 MHz
-//
-//			<o4.0..4>   MSEL: PLL Multiplier Value
-//						<i>				M Value
-//						<1-32><#-1>
-//
-//			<o4.5..6>	PSEL: PLL Divider Value
-//						<i>				P Value
-//						<0=> 			1
-//						<1=>			2
-//						<2=>			4
-//						<3=>			8
-//		</e>
-//
-//		<e5>PLL1 Configuration (Alt PLL PLL1CFG - address 0x400F C0A4)
-//			<i>			F_in  is in the range of 1 MHz to 25 MHz
-//			<i>			F_cco = (F_in * M * 2 * P) is in range of 156 MHz to 320 MHz
-//			<i>			PLL out clock = (F_cco / (2 * P)) is in rane of 9.75 MHz to 160 MHz
-//
-//			<o6.0..4>   MSEL: PLL Multiplier Value
-//						<i>				M Value
-//						<1-32><#-1>
-//
-//			<o6.5..6>	PSEL: PLL Divider Value
-//						<i>		P Value
-//						<0=>	1
-//						<1=>	2
-//						<2=>	4
-//						<3=>	8
-//		</e>
-//
-//		<h>	CPU Clock Selection Register (CCLKSEL - address 0x400F C104)
-//			<o7.0..4>	CCLKDIV: Select the value for divider of CPU clock (CCLK)
-//						<i>		0: The divider is turned off. No clock will be provided to the CPU
-//						<i>		n: The input clock is divided by n to produce the CPU clock
-//						<0-31>
-//
-//			<o7.8>		CCLKSEL: Select the input to the divider of CPU clock
-//						<0=>	sysclk clock is used
-//						<1=>	Main PLL0 clock is used
-//		</h>
-//
-//		<h>	USB Clock Selection Register (USBCLKSEL - 0x400F C108)
-//			<o8.0..4>	USBDIV: USB clock (source PLL0) divider selection
-//						<0=>	Divider is off and no clock provides to USB subsystem
-//						<4=>	Divider value is 4 (The source clock is divided by 4)
-//						<6=>	Divider value is 6 (The source clock is divided by 6)
-//
-//			<o8.8..9>	USBSEL: Select the source for USB clock divider
-//						<i>		When CPU clock is selected, the USB can be accessed
-//						<i>		by software but cannot perform USB functions
-//						<0=>	sysclk clock (the clock input to PLL0)
-//						<1=>	The clock output from PLL0
-//						<2=>	The clock output from PLL1
-//		</h>
-//
-//		<h>	EMC Clock Selection Register (EMCCLKSEL - address 0x400F C100)
-//			<o9.0>	EMCDIV: Set the divider for EMC clock
-//					<0=> Divider value is 1
-//					<1=> Divider value is 2 (EMC clock is equal a half of input clock)
-//		</h>
-//
-//		<h>	Peripheral Clock Selection Register (PCLKSEL - address 0x400F C1A8)
-//			<o10.0..4>	PCLKDIV: APB Peripheral clock divider
-//						<i>	0: The divider is turned off. No clock will be provided to APB peripherals
-//						<i>	n: The input clock is divided by n to produce the APB peripheral clock
-//						<0-31>
-//		</h>
-//
-//		<h>	SPIFI Clock Selection Register (SPIFICLKSEL - address 0x400F C1B4)
-//			<o11.0..4>	SPIFIDIV: Set the divider for SPIFI clock
-//						<i>	0: The divider is turned off. No clock will be provided to the SPIFI
-//						<i>	n: The input clock is divided by n to produce the SPIFI clock
-//						<0-31>
-//
-//			<o11.8..9>	SPIFISEL: Select the input clock for SPIFI clock divider
-//						<0=>	sysclk clock (the clock input to PLL0)
-//						<1=>	The clock output from PLL0
-//						<2=>	The clock output from PLL1
-//		</h>
-//
-//		<h>	Power Control for Peripherals Register (PCONP - address 0x400F C1C8)
-//			<o12.0>		PCLCD: LCD controller power/clock enable (bit 0)
-//			<o12.1>		PCTIM0: Timer/Counter 0 power/clock enable (bit 1)
-//			<o12.2>		PCTIM1: Timer/Counter 1 power/clock enable (bit 2)
-//			<o12.3>		PCUART0: UART 0 power/clock enable (bit 3)
-//			<o12.4>		PCUART1: UART 1 power/clock enable (bit 4)
-//			<o12.5>		PCPWM0: PWM0 power/clock enable (bit 5)
-//			<o12.6>		PCPWM1: PWM1 power/clock enable (bit 6)
-//			<o12.7>		PCI2C0: I2C 0 interface power/clock enable (bit 7)
-//			<o12.8>		PCUART4: UART 4 power/clock enable (bit 8)
-//			<o12.9>		PCRTC: RTC and Event Recorder power/clock enable (bit 9)
-//			<o12.10>	PCSSP1: SSP 1 interface power/clock enable (bit 10)
-//			<o12.11>	PCEMC: External Memory Controller power/clock enable (bit 11)
-//			<o12.12>	PCADC: A/D converter power/clock enable (bit 12)
-//			<o12.13>	PCCAN1: CAN controller 1 power/clock enable (bit 13)
-//			<o12.14>	PCCAN2: CAN controller 2 power/clock enable (bit 14)
-//			<o12.15>	PCGPIO: IOCON, GPIO, and GPIO interrupts power/clock enable (bit 15)
-//			<o12.17>	PCMCPWM: Motor Control PWM power/clock enable (bit 17)
-//			<o12.18>	PCQEI: Quadrature encoder interface power/clock enable (bit 18)
-//			<o12.19>	PCI2C1: I2C 1 interface power/clock enable (bit 19)
-//			<o12.20>	PCSSP2: SSP 2 interface power/clock enable (bit 20)
-//			<o12.21>	PCSSP0: SSP 0 interface power/clock enable (bit 21)
-//			<o12.22>	PCTIM2: Timer 2 power/clock enable (bit 22)
-//			<o12.23>	PCTIM3: Timer 3 power/clock enable (bit 23)
-//			<o12.24>	PCUART2: UART 2 power/clock enable (bit 24)
-//			<o12.25>	PCUART3: UART 3 power/clock enable (bit 25)
-//			<o12.26>	PCI2C2: I2C 2 interface power/clock enable (bit 26)
-//			<o12.27>	PCI2S: I2S interface power/clock enable (bit 27)
-//			<o12.28>	PCSDC: SD Card interface power/clock enable (bit 28)
-//			<o12.29>	PCGPDMA: GPDMA function power/clock enable (bit 29)
-//			<o12.30>	PCENET: Ethernet block power/clock enable (bit 30)
-//			<o12.31>	PCUSB: USB interface power/clock enable (bit 31)
-//		</h>
-//
-//		<h>	Clock Output Configuration Register (CLKOUTCFG)
-//			<o13.0..3>	CLKOUTSEL: Clock Source for CLKOUT Selection
-//						<0=>	CPU clock
-//						<1=>	Main Oscillator
-//						<2=>	Internal RC Oscillator
-//						<3=>	USB clock
-//						<4=>	RTC Oscillator
-//						<5=>	unused
-//						<6=>	Watchdog Oscillator
-//
-//			<o13.4..7>	CLKOUTDIV: Output Clock Divider
-//						<1-16><#-1>
-//
-//			<o13.8>		CLKOUT_EN: CLKOUT enable
-//		</h>
-//
-//	</e>
-*/
-
-#define CLOCK_SETUP           1
-#define SCS_Val               0x00000020
-#define CLKSRCSEL_Val         0x00000001
-#define PLL0_SETUP            1
-#define PLL0CFG_Val           0x00000009
-#define PLL1_SETUP            1
-#define PLL1CFG_Val           0x00000023
-#define CCLKSEL_Val           0x00000101
-#define USBCLKSEL_Val         0x00000201
-#define EMCCLKSEL_Val         0x00000001
-#define PCLKSEL_Val           0x00000002
-#define SPIFICLKSEL_Val       0x00000002
-#define PCONP_Val             0x042887DE
-#define CLKOUTCFG_Val         0x00000100
-
-#ifdef CORE_M4
-#define	LPC_CPACR	        0xE000ED88
-
-#define SCB_MVFR0           0xE000EF40
-#define SCB_MVFR0_RESET     0x10110021
-
-#define SCB_MVFR1           0xE000EF44
-#define SCB_MVFR1_RESET     0x11000011
-#endif
-
-
-/*--------------------- Flash Accelerator Configuration ----------------------
-//
-//	<e>	Flash Accelerator Configuration register (FLASHCFG - address 0x400F C000)
-//		<o1.12..15>	FLASHTIM: Flash Access Time
-//					<0=>	1 CPU clock (for CPU clock up to 20 MHz)
-//					<1=>	2 CPU clocks (for CPU clock up to 40 MHz)
-//					<2=>	3 CPU clocks (for CPU clock up to 60 MHz)
-//					<3=>	4 CPU clocks (for CPU clock up to 80 MHz)
-//					<4=>	5 CPU clocks (for CPU clock up to 100 MHz)
-//					<5=>	6 CPU clocks (for any CPU clock)
-//	</e>
-*/
-
-#define FLASH_SETUP           1
-#define FLASHCFG_Val          0x00005000
-
-/*----------------------------------------------------------------------------
-  Check the register settings
- *----------------------------------------------------------------------------*/
-#define CHECK_RANGE(val, min, max)                ((val < min) || (val > max))
-#define CHECK_RSVD(val, mask)                     (val & mask)
-
-/* Clock Configuration -------------------------------------------------------*/
-#if (CHECK_RSVD((SCS_Val),       ~0x0000003F))
-   #error "SCS: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RANGE((CLKSRCSEL_Val), 0, 1))
-   #error "CLKSRCSEL: Value out of range!"
-#endif
-
-#if (CHECK_RSVD((PLL0CFG_Val),   ~0x0000007F))
-   #error "PLL0CFG: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((PLL1CFG_Val),   ~0x0000007F))
-   #error "PLL1CFG: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((CCLKSEL_Val),   ~0x0000011F))
-   #error "CCLKSEL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((USBCLKSEL_Val), ~0x0000031F))
-   #error "USBCLKSEL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((EMCCLKSEL_Val), ~0x00000001))
-   #error "EMCCLKSEL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((PCLKSEL_Val), ~0x0000001F))
-   #error "PCLKSEL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((PCONP_Val), ~0xFFFEFFFF))
-   #error "PCONP: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((CLKOUTCFG_Val), ~0x000001FF))
-   #error "CLKOUTCFG: Invalid values of reserved bits!"
-#endif
-
-/* Flash Accelerator Configuration -------------------------------------------*/
-#if (CHECK_RSVD((FLASHCFG_Val), ~0x0000F000))
-   #warning "FLASHCFG: Invalid values of reserved bits!"
-#endif
-
-
-/*----------------------------------------------------------------------------
-  DEFINES
- *----------------------------------------------------------------------------*/
-/* pll_out_clk = F_cco / (2 � P)
-   F_cco = pll_in_clk � M � 2 � P */
-#define __M                   ((PLL0CFG_Val & 0x1F) + 1)
-#define __PLL0_CLK(__F_IN)    (__F_IN * __M)
-#define __CCLK_DIV            (CCLKSEL_Val & 0x1F)
-#define __PCLK_DIV			  (PCLKSEL_Val & 0x1F)
-#define __ECLK_DIV			  ((EMCCLKSEL_Val & 0x01) + 1)
-
-/* Determine core clock frequency according to settings */
-#if (CLOCK_SETUP)                       /* Clock Setup                        */
-
-  #if ((CLKSRCSEL_Val & 0x01) == 1) && ((SCS_Val & 0x20)== 0)
-   #error "Main Oscillator is selected as clock source but is not enabled!"
-  #endif
-
-  #if ((CCLKSEL_Val & 0x100) == 0x100) && (PLL0_SETUP == 0)
-   #error "Main PLL is selected as clock source but is not enabled!"
-  #endif
-
-  #if ((CCLKSEL_Val & 0x100) == 0)      /* cclk = sysclk */
-    #if ((CLKSRCSEL_Val & 0x01) == 0)   /* sysclk = irc_clk */
-        #define __CORE_CLK (IRC_OSC / __CCLK_DIV)
-		#define __PER_CLK  (IRC_OSC/  __PCLK_DIV)
-        #define __EMC_CLK  (__CORE_CLK/  __ECLK_DIV)
-    #else                               /* sysclk = osc_clk */
-        #define __CORE_CLK (OSC_CLK / __CCLK_DIV)
-        #define __PER_CLK  (OSC_CLK/  __PCLK_DIV)
-        #define __EMC_CLK  (__CORE_CLK/  __ECLK_DIV)
-    #endif
-  #else                                 /* cclk = pll_clk */
-    #if ((CLKSRCSEL_Val & 0x01) == 0)   /* sysclk = irc_clk */
-        #define __CORE_CLK (__PLL0_CLK(IRC_OSC) / __CCLK_DIV)
-        #define __PER_CLK  (__PLL0_CLK(IRC_OSC) / __PCLK_DIV)
-        #define __EMC_CLK  (__CORE_CLK / __ECLK_DIV)
-    #else                               /* sysclk = osc_clk */
-        #define __CORE_CLK (__PLL0_CLK(OSC_CLK) / __CCLK_DIV)
-        #define __PER_CLK  (__PLL0_CLK(OSC_CLK) / __PCLK_DIV)
-		#define __EMC_CLK  (__CORE_CLK / __ECLK_DIV)
-    #endif
-  #endif
-
-#else
-        #define __CORE_CLK (IRC_OSC)
-        #define __PER_CLK  (IRC_OSC)
-        #define __EMC_CLK  (__CORE_CLK)
-#endif
-
-/*----------------------------------------------------------------------------
-  Clock Variable definitions
- *----------------------------------------------------------------------------*/
-uint32_t SystemCoreClock = __CORE_CLK;/*!< System Clock Frequency (Core Clock)*/
-uint32_t PeripheralClock = __PER_CLK; /*!< Peripheral Clock Frequency (Pclk)  */
-uint32_t EMCClock		 = __EMC_CLK; /*!< EMC Clock Frequency 				  */
-uint32_t USBClock 		 = (48000000UL);		  /*!< USB Clock Frequency - this value will
-									be updated after call SystemCoreClockUpdate, should be 48MHz*/
-
-
-/*----------------------------------------------------------------------------
-  Clock functions
- *----------------------------------------------------------------------------*/
-void SystemCoreClockUpdate (void)            /* Get Core Clock Frequency      */
-{
-  /* Determine clock frequency according to clock register values             */
-  if ((LPC_SC->CCLKSEL &0x100) == 0) {            /* cclk = sysclk    */
-    if ((LPC_SC->CLKSRCSEL & 0x01) == 0) {    /* sysclk = irc_clk */
-		  SystemCoreClock = __CLK_DIV(IRC_OSC , (LPC_SC->CCLKSEL & 0x1F));
-          PeripheralClock = __CLK_DIV(IRC_OSC , (LPC_SC->PCLKSEL & 0x1F));
-          EMCClock        = (SystemCoreClock / ((LPC_SC->EMCCLKSEL & 0x01)+1));
-    }
-    else {                                        /* sysclk = osc_clk */
-      if ((LPC_SC->SCS & 0x40) == 0) {
-          SystemCoreClock = 0;                      /* this should never happen! */
-          PeripheralClock = 0;
-          EMCClock        = 0;
-      }
-      else {
-          SystemCoreClock = __CLK_DIV(OSC_CLK , (LPC_SC->CCLKSEL & 0x1F));
-          PeripheralClock = __CLK_DIV(OSC_CLK , (LPC_SC->PCLKSEL & 0x1F));
-          EMCClock        = (SystemCoreClock / ((LPC_SC->EMCCLKSEL & 0x01)+1));
-      }
-    }
-  }
-  else {                                          /* cclk = pll_clk */
-    if ((LPC_SC->PLL0STAT & 0x100) == 0) {        /* PLL0 not enabled */
-          SystemCoreClock = 0;                      /* this should never happen! */
-          PeripheralClock = 0;
-          EMCClock 		  = 0;
-    }
-    else {
-      if ((LPC_SC->CLKSRCSEL & 0x01) == 0) {    /* sysclk = irc_clk */
-          uint8_t mul = ((LPC_SC->PLL0STAT & 0x1F) + 1);
-          uint8_t cpu_div = (LPC_SC->CCLKSEL & 0x1F);
-          uint8_t per_div = (LPC_SC->PCLKSEL & 0x1F);
-          uint8_t emc_div = (LPC_SC->EMCCLKSEL & 0x01)+1;
-          SystemCoreClock = __CLK_DIV(IRC_OSC * mul , cpu_div);
-          PeripheralClock = __CLK_DIV(IRC_OSC * mul , per_div);
-          EMCClock        = SystemCoreClock / emc_div;
-      }
-      else {                                        /* sysclk = osc_clk */
-        if ((LPC_SC->SCS & 0x40) == 0) {
-          SystemCoreClock = 0;                      /* this should never happen! */
-          PeripheralClock = 0;
-          EMCClock 		  = 0;
-        }
-        else {
-          uint8_t mul = ((LPC_SC->PLL0STAT & 0x1F) + 1);
-          uint8_t cpu_div = (LPC_SC->CCLKSEL & 0x1F);
-          uint8_t per_div = (LPC_SC->PCLKSEL & 0x1F);
-		  uint8_t emc_div = (LPC_SC->EMCCLKSEL & 0x01)+1;
-          SystemCoreClock = __CLK_DIV(OSC_CLK * mul , cpu_div);
-          PeripheralClock = __CLK_DIV(OSC_CLK * mul , per_div);
-          EMCClock        = SystemCoreClock / emc_div;
-        }
-      }
-    }
-  }
-  /* ---update USBClock------------------*/
-  if(LPC_SC->USBCLKSEL & (0x01<<8))//Use PLL0 as the input to the USB clock divider
-  {
-	  switch (LPC_SC->USBCLKSEL & 0x1F)
-	  {
-	  case 0:
-		  USBClock = 0; //no clock will be provided to the USB subsystem
-		  break;
-	  case 4:
-	  case 6:
-            {
-                 uint8_t mul = ((LPC_SC->PLL0STAT & 0x1F) + 1);
-                 uint8_t usb_div = (LPC_SC->USBCLKSEL & 0x1F);
-		  if(LPC_SC->CLKSRCSEL & 0x01)	//pll_clk_in = main_osc
-			  USBClock = OSC_CLK * mul / usb_div;
-		  else //pll_clk_in = irc_clk
-			  USBClock = IRC_OSC * mul / usb_div;
-            }
-            break;
-	  default:
-		  USBClock = 0;  /* this should never happen! */
-	  }
-  }
-  else if(LPC_SC->USBCLKSEL & (0x02<<8))//usb_input_clk = alt_pll (pll1)
-  {
-	  if(LPC_SC->CLKSRCSEL & 0x01)	//pll1_clk_in = main_osc
-	  		USBClock = (OSC_CLK * ((LPC_SC->PLL1STAT & 0x1F) + 1));
-	  else //pll1_clk_in = irc_clk
-	  		USBClock = (IRC_OSC * ((LPC_SC->PLL0STAT & 0x1F) + 1));
-  }
-  else
-	  USBClock = 0; /* this should never happen! */
-}
-
-  /* Determine clock frequency according to clock register values             */
-
-#ifdef CORE_M4
-
-void fpu_init(void)
-{
- // from arm trm manual:
-//                ; CPACR is located at address 0xE000ED88
-//                LDR.W R0, =0xE000ED88
-//                ; Read CPACR
-//                LDR R1, [R0]
-//                ; Set bits 20-23 to enable CP10 and CP11 coprocessors
-//                ORR R1, R1, #(0xF << 20)
-//                ; Write back the modified value to the CPACR
-//                STR R1, [R0]
-
-
-    volatile uint32_t* regCpacr = (uint32_t*) LPC_CPACR;
-    volatile uint32_t* regMvfr0 = (uint32_t*) SCB_MVFR0;
-    volatile uint32_t* regMvfr1 = (uint32_t*) SCB_MVFR1;
-    volatile uint32_t Cpacr;
-    volatile uint32_t Mvfr0;
-    volatile uint32_t Mvfr1;
-    char vfpPresent = 0;
-
-    Mvfr0 = *regMvfr0;
-    Mvfr1 = *regMvfr1;
-
-    vfpPresent = ((SCB_MVFR0_RESET == Mvfr0) && (SCB_MVFR1_RESET == Mvfr1));
-
-    if(vfpPresent)
-    {
-        Cpacr = *regCpacr;
-        Cpacr |= (0xF << 20);
-        *regCpacr = Cpacr;   // enable CP10 and CP11 for full access
-    }
-
-}
-#endif
-
-/**
- * Initialize the system
- *
- * @param  none
- * @return none
- *
- * @brief  Setup the microcontroller system.
- *         Initialize the System.
- */
-void SystemInit (void)
-{
-#ifndef __CODE_RED
-#ifdef CORE_M4
-fpu_init();
-#endif
-#endif
-
-#if (CLOCK_SETUP)                       /* Clock Setup                        */
-  LPC_SC->SCS       = SCS_Val;
-  if (SCS_Val & (1 << 5)) {             /* If Main Oscillator is enabled      */
-    while ((LPC_SC->SCS & (1<<6)) == 0);/* Wait for Oscillator to be ready    */
-  }
-
-  LPC_SC->CLKSRCSEL = CLKSRCSEL_Val;    /* Select Clock Source for sysclk/PLL0*/
-
-#if (PLL0_SETUP)
-  LPC_SC->PLL0CFG   = PLL0CFG_Val;
-  LPC_SC->PLL0CON   = 0x01;             /* PLL0 Enable                        */
-  LPC_SC->PLL0FEED  = 0xAA;
-  LPC_SC->PLL0FEED  = 0x55;
-  while (!(LPC_SC->PLL0STAT & (1<<10)));/* Wait for PLOCK0                    */
-#endif
-
-#if (PLL1_SETUP)
-  LPC_SC->PLL1CFG   = PLL1CFG_Val;
-  LPC_SC->PLL1CON   = 0x01;             /* PLL1 Enable                        */
-  LPC_SC->PLL1FEED  = 0xAA;
-  LPC_SC->PLL1FEED  = 0x55;
-  while (!(LPC_SC->PLL1STAT & (1<<10)));/* Wait for PLOCK1                    */
-#endif
-
-  LPC_SC->CCLKSEL   = CCLKSEL_Val;      /* Setup Clock Divider                */
-  LPC_SC->USBCLKSEL = USBCLKSEL_Val;    /* Setup USB Clock Divider            */
-  LPC_SC->EMCCLKSEL = EMCCLKSEL_Val;    /* EMC Clock Selection                */
-  LPC_SC->SPIFICLKSEL  = SPIFICLKSEL_Val;  /* SPIFI Clock Selection              */
-  LPC_SC->PCLKSEL   = PCLKSEL_Val;      /* Peripheral Clock Selection         */
-  LPC_SC->PCONP     = PCONP_Val;        /* Power Control for Peripherals      */
-  LPC_SC->CLKOUTCFG = CLKOUTCFG_Val;    /* Clock Output Configuration         */
-#endif
-
-  LPC_SC->PBOOST 	|= 0x03;			/* Power Boost control				*/
-
-#if (FLASH_SETUP == 1)                  /* Flash Accelerator Setup            */
-  LPC_SC->FLASHCFG  = FLASHCFG_Val|0x03A;
-#endif
-#ifndef __CODE_RED
-#ifdef  __RAM_MODE__
-  SCB->VTOR  = 0x10000000 & 0x3FFFFF80;
-#else
-  SCB->VTOR  = 0x00000000 & 0x3FFFFF80;
-#endif
-#endif
-  SystemCoreClockUpdate();
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC408X/system_LPC407x_8x_177x_8x.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/**********************************************************************
-* $Id$		system_LPC407x_8x_177x_8x.h			2011-06-02
-*//**
-* @file		system_LPC407x_8x_177x_8x.h
-* @brief	CMSIS Cortex-M3 Device Peripheral Access Layer Source File
-*			for the NXP LPC Device Series
-* @version	1.0
-* @date		02. June. 2011
-* @author	NXP MCU SW Application Team
-*
-* 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.
-* Permission to use, copy, modify, and distribute this software and its
-* documentation is hereby granted, under NXP Semiconductors'
-* relevant copyright in the software, without fee, provided 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 __SYSTEM_LPC407x_8x_177x_8x_H
-#define __SYSTEM_LPC407x_8x_177x_8x_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-extern uint32_t SystemCoreClock;      /*!< System Clock Frequency (Core Clock)  	*/
-extern uint32_t PeripheralClock;	    /*!< Peripheral Clock Frequency (Pclk) 	    */
-extern uint32_t EMCClock;			        /*!< EMC Clock                              */
-extern uint32_t USBClock;			        /*!< USB Frequency 						              */
-
-
-/**
- * Initialize the system
- *
- * @param  none
- * @return none
- *
- * @brief  Setup the microcontroller system.
- *         Initialize the System and update the SystemCoreClock variable.
- */
-extern void SystemInit (void);
-
-/**
- * Update SystemCoreClock variable
- *
- * @param  none
- * @return none
- *
- * @brief  Updates the SystemCoreClock with current core Clock
- *         retrieved from cpu registers.
- */
-extern void SystemCoreClockUpdate (void);
-
-/*----------------------------------------------------------------------------
-  Define clocks
- *----------------------------------------------------------------------------*/
-#define XTAL        (12000000UL)        /* Oscillator frequency               */
-#define OSC_CLK     (      XTAL)        /* Main oscillator frequency          */
-#define RTC_CLK     (   32768UL)        /* RTC oscillator frequency           */
-#define IRC_OSC     (12000000UL)        /* Internal RC oscillator frequency   */
-#define WDT_OSC		  (  500000UL)		/* Internal WDT oscillator frequency  */
-
-
-
-/*
-//-------- <<< end of configuration section >>> ------------------------------
-*/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __SYSTEM_LPC407x_8x_177x_8x_H */
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC43XX/LPC43xx.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1987 +0,0 @@
-/*
- * @brief LPC43xx/LPC18xx MCU header
- *
- * Copyright(C) NXP Semiconductors, 2012
- * 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.
- *
- * Simplified version of NXP LPCOPEN LPC43XX/LPC18XX headers
- *   05/15/13  Micromint USA <support@micromint.com>
- */
-
-#ifndef __LPC43XX_H
-#define __LPC43XX_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** @defgroup LPC43XX_H: LPC43xx include file
- * @ingroup LPC43XX_Headers
- * @{
- */
-
-/* Treat __CORE_Mx as CORE_Mx for mbed builds */
-#if defined(__CORTEX_M0) && !defined(CORE_M0)
-  #define CORE_M0
-#endif
-#if defined(__CORTEX_M3) && !defined(CORE_M3)
-  #define CORE_M3
-#endif
-/* Default to M4 core if no core explicitly declared */
-#if !defined(CORE_M0) && !defined(CORE_M3)
-  #define CORE_M4
-#endif
-
-/* Start of section using anonymous unions */
-#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(__IAR_SYSTEMS_ICC__)
-  //#pragma push // FIXME not usable for IAR
-  #pragma language=extended
-#else /* defined(__GNUC__) and others */
-  /* Assume anonymous unions are enabled by default */
-#endif
-
-#if defined(CORE_M4)
-/**
- * @brief LPC43xx Cortex CMSIS definitions
- */
-
-#define __CM4_REV              0x0000		/*!< Cortex-M4 Core Revision               */
-#define __MPU_PRESENT             1			/*!< 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             1			/*!< FPU present or not                    */
-#define CHIP_LPC43XX                    /*!< LPCOPEN                               */
-
-/**
- * @brief LPC43xx peripheral interrupt numbers
- */
-
-typedef enum {
-	/* -------------------------  Cortex-M4 Processor Exceptions Numbers  ----------------------------- */
-	Reset_IRQn                        = -15,/*!<   1  Reset Vector, invoked on Power up and warm reset */
-	NonMaskableInt_IRQn               = -14,/*!<   2  Non maskable Interrupt, cannot be stopped or preempted */
-	HardFault_IRQn                    = -13,/*!<   3  Hard Fault, all classes of Fault */
-	MemoryManagement_IRQn             = -12,/*!<   4  Memory Management, MPU mismatch, including Access Violation and No Match */
-	BusFault_IRQn                     = -11,/*!<   5  Bus Fault, Pre-Fetch-, Memory Access Fault, other address/memory related Fault */
-	UsageFault_IRQn                   = -10,/*!<   6  Usage Fault, i.e. Undef Instruction, Illegal State Transition */
-	SVCall_IRQn                       =  -5,/*!<  11  System Service Call via SVC instruction */
-	DebugMonitor_IRQn                 =  -4,/*!<  12  Debug Monitor                    */
-	PendSV_IRQn                       =  -2,/*!<  14  Pendable request for system service */
-	SysTick_IRQn                      =  -1,/*!<  15  System Tick Timer                */
-
-	/* ---------------------------  LPC18xx/43xx Specific Interrupt Numbers  ------------------------------- */
-	DAC_IRQn                          =   0,/*!<   0  DAC                              */
-	M0CORE_IRQn                       =   1,/*!<   1  M0a                              */
-	DMA_IRQn                          =   2,/*!<   2  DMA                              */
-	RESERVED1_IRQn                    =   3,/*!<   3  EZH/EDM                          */
-	RESERVED2_IRQn                    =   4,
-	ETHERNET_IRQn                     =   5,/*!<   5  ETHERNET                         */
-	SDIO_IRQn                         =   6,/*!<   6  SDIO                             */
-	LCD_IRQn                          =   7,/*!<   7  LCD                              */
-	USB0_IRQn                         =   8,/*!<   8  USB0                             */
-	USB1_IRQn                         =   9,/*!<   9  USB1                             */
-	SCT_IRQn                          =  10,/*!<  10  SCT                              */
-	RITIMER_IRQn                      =  11,/*!<  11  RITIMER                          */
-	TIMER0_IRQn                       =  12,/*!<  12  TIMER0                           */
-	TIMER1_IRQn                       =  13,/*!<  13  TIMER1                           */
-	TIMER2_IRQn                       =  14,/*!<  14  TIMER2                           */
-	TIMER3_IRQn                       =  15,/*!<  15  TIMER3                           */
-	MCPWM_IRQn                        =  16,/*!<  16  MCPWM                            */
-	ADC0_IRQn                         =  17,/*!<  17  ADC0                             */
-	I2C0_IRQn                         =  18,/*!<  18  I2C0                             */
-	I2C1_IRQn                         =  19,/*!<  19  I2C1                             */
-	SPI_INT_IRQn                      =  20,/*!<  20  SPI_INT                          */
-	ADC1_IRQn                         =  21,/*!<  21  ADC1                             */
-	SSP0_IRQn                         =  22,/*!<  22  SSP0                             */
-	SSP1_IRQn                         =  23,/*!<  23  SSP1                             */
-	USART0_IRQn                       =  24,/*!<  24  USART0                           */
-	UART1_IRQn                        =  25,/*!<  25  UART1                            */
-	USART2_IRQn                       =  26,/*!<  26  USART2                           */
-	USART3_IRQn                       =  27,/*!<  27  USART3                           */
-	I2S0_IRQn                         =  28,/*!<  28  I2S0                             */
-	I2S1_IRQn                         =  29,/*!<  29  I2S1                             */
-	RESERVED4_IRQn                    =  30,
-	SGPIO_INT_IRQn                    =  31,/*!<  31  SGPIO_IINT                       */
-	PIN_INT0_IRQn                     =  32,/*!<  32  PIN_INT0                         */
-	PIN_INT1_IRQn                     =  33,/*!<  33  PIN_INT1                         */
-	PIN_INT2_IRQn                     =  34,/*!<  34  PIN_INT2                         */
-	PIN_INT3_IRQn                     =  35,/*!<  35  PIN_INT3                         */
-	PIN_INT4_IRQn                     =  36,/*!<  36  PIN_INT4                         */
-	PIN_INT5_IRQn                     =  37,/*!<  37  PIN_INT5                         */
-	PIN_INT6_IRQn                     =  38,/*!<  38  PIN_INT6                         */
-	PIN_INT7_IRQn                     =  39,/*!<  39  PIN_INT7                         */
-	GINT0_IRQn                        =  40,/*!<  40  GINT0                            */
-	GINT1_IRQn                        =  41,/*!<  41  GINT1                            */
-	EVENTROUTER_IRQn                  =  42,/*!<  42  EVENTROUTER                      */
-	C_CAN1_IRQn                       =  43,/*!<  43  C_CAN1                           */
-	RESERVED6_IRQn                    =  44,
-	RESERVED7_IRQn                    =  45,/*!<  45  VADC                             */
-	ATIMER_IRQn                       =  46,/*!<  46  ATIMER                           */
-	RTC_IRQn                          =  47,/*!<  47  RTC                              */
-	RESERVED8_IRQn                    =  48,
-	WWDT_IRQn                         =  49,/*!<  49  WWDT                             */
-	RESERVED9_IRQn                    =  50,
-	C_CAN0_IRQn                       =  51,/*!<  51  C_CAN0                           */
-	QEI_IRQn                          =  52,/*!<  52  QEI                              */
-} IRQn_Type;
-
-#include "core_cm4.h"						/*!< Cortex-M4 processor and core peripherals */
-
-#elif defined(CORE_M3)
-/**
- * @brief LPC18xx Cortex CMSIS definitions
- */
-#define __MPU_PRESENT             1			/*!< 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                    */
-#define CHIP_LPC18XX                    /*!< LPCOPEN                               */
-
-/**
- * @brief LPC18xx peripheral interrupt numbers
- */
-
-typedef enum {
-	/* -------------------------  Cortex-M3 Processor Exceptions Numbers  ----------------------------- */
-	Reset_IRQn                        = -15,/*!<   1  Reset Vector, invoked on Power up and warm reset */
-	NonMaskableInt_IRQn               = -14,/*!<   2  Non maskable Interrupt, cannot be stopped or preempted */
-	HardFault_IRQn                    = -13,/*!<   3  Hard Fault, all classes of Fault */
-	MemoryManagement_IRQn             = -12,/*!<   4  Memory Management, MPU mismatch, including Access Violation and No Match */
-	BusFault_IRQn                     = -11,/*!<   5  Bus Fault, Pre-Fetch-, Memory Access Fault, other address/memory related Fault */
-	UsageFault_IRQn                   = -10,/*!<   6  Usage Fault, i.e. Undef Instruction, Illegal State Transition */
-	SVCall_IRQn                       = -5,	/*!<  11  System Service Call via SVC instruction */
-	DebugMonitor_IRQn                 = -4,	/*!<  12  Debug Monitor                    */
-	PendSV_IRQn                       = -2,	/*!<  14  Pendable request for system service */
-	SysTick_IRQn                      = -1,	/*!<  15  System Tick Timer                */
-
-	/* ---------------------------  LPC18xx/43xx Specific Interrupt Numbers  ------------------------------- */
-	DAC_IRQn                          =   0,/*!<   0  DAC                              */
-	RESERVED0_IRQn                    =   1,
-	DMA_IRQn                          =   2,/*!<   2  DMA                              */
-	RESERVED1_IRQn                    =   3,/*!<   3  EZH/EDM                          */
-	RESERVED2_IRQn                    =   4,
-	ETHERNET_IRQn                     =   5,/*!<   5  ETHERNET                         */
-	SDIO_IRQn                         =   6,/*!<   6  SDIO                             */
-	LCD_IRQn                          =   7,/*!<   7  LCD                              */
-	USB0_IRQn                         =   8,/*!<   8  USB0                             */
-	USB1_IRQn                         =   9,/*!<   9  USB1                             */
-	SCT_IRQn                          =  10,/*!<  10  SCT                              */
-	RITIMER_IRQn                      =  11,/*!<  11  RITIMER                          */
-	TIMER0_IRQn                       =  12,/*!<  12  TIMER0                           */
-	TIMER1_IRQn                       =  13,/*!<  13  TIMER1                           */
-	TIMER2_IRQn                       =  14,/*!<  14  TIMER2                           */
-	TIMER3_IRQn                       =  15,/*!<  15  TIMER3                           */
-	MCPWM_IRQn                        =  16,/*!<  16  MCPWM                            */
-	ADC0_IRQn                         =  17,/*!<  17  ADC0                             */
-	I2C0_IRQn                         =  18,/*!<  18  I2C0                             */
-	I2C1_IRQn                         =  19,/*!<  19  I2C1                             */
-	RESERVED3_IRQn                    =  20,
-	ADC1_IRQn                         =  21,/*!<  21  ADC1                             */
-	SSP0_IRQn                         =  22,/*!<  22  SSP0                             */
-	SSP1_IRQn                         =  23,/*!<  23  SSP1                             */
-	USART0_IRQn                       =  24,/*!<  24  USART0                           */
-	UART1_IRQn                        =  25,/*!<  25  UART1                            */
-	USART2_IRQn                       =  26,/*!<  26  USART2                           */
-	USART3_IRQn                       =  27,/*!<  27  USART3                           */
-	I2S0_IRQn                         =  28,/*!<  28  I2S0                             */
-	I2S1_IRQn                         =  29,/*!<  29  I2S1                             */
-	RESERVED4_IRQn                    =  30,
-	RESERVED5_IRQn                    =  31,
-	PIN_INT0_IRQn                     =  32,/*!<  32  PIN_INT0                         */
-	PIN_INT1_IRQn                     =  33,/*!<  33  PIN_INT1                         */
-	PIN_INT2_IRQn                     =  34,/*!<  34  PIN_INT2                         */
-	PIN_INT3_IRQn                     =  35,/*!<  35  PIN_INT3                         */
-	PIN_INT4_IRQn                     =  36,/*!<  36  PIN_INT4                         */
-	PIN_INT5_IRQn                     =  37,/*!<  37  PIN_INT5                         */
-	PIN_INT6_IRQn                     =  38,/*!<  38  PIN_INT6                         */
-	PIN_INT7_IRQn                     =  39,/*!<  39  PIN_INT7                         */
-	GINT0_IRQn                        =  40,/*!<  40  GINT0                            */
-	GINT1_IRQn                        =  41,/*!<  41  GINT1                            */
-	EVENTROUTER_IRQn                  =  42,/*!<  42  EVENTROUTER                      */
-	C_CAN1_IRQn                       =  43,/*!<  43  C_CAN1                           */
-	RESERVED6_IRQn                    =  44,
-	RESERVED7_IRQn                    =  45,/*!<  45  VADC                             */
-	ATIMER_IRQn                       =  46,/*!<  46  ATIMER                           */
-	RTC_IRQn                          =  47,/*!<  47  RTC                              */
-	RESERVED8_IRQn                    =  48,
-	WWDT_IRQn                         =  49,/*!<  49  WWDT                             */
-	RESERVED9_IRQn                    =  50,
-	C_CAN0_IRQn                       =  51,/*!<  51  C_CAN0                           */
-	QEI_IRQn                          =  52,/*!<  52  QEI                              */
-} IRQn_Type;
-
-#include "core_cm3.h"						/*!< Cortex-M3 processor and core peripherals */
-
-#elif defined(CORE_M0)
-/**
- * @brief LPC43xx (M0 Core) Cortex CMSIS definitions
- */
-
-#define __MPU_PRESENT             0			/*!< MPU present or not                    */
-#define __NVIC_PRIO_BITS          2			/*!< 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                    */
-#define CHIP_LPC43XX                    /*!< LPCOPEN                               */
-
-/**
- * @brief LPC43xx (M0 Core) peripheral interrupt numbers
- */
-
-typedef enum {
-	/* -------------------------  Cortex-M0 Processor Exceptions Numbers  ----------------------------- */
-	Reset_IRQn                        = -15,/*!<   1  Reset Vector, invoked on Power up and warm reset */
-	NonMaskableInt_IRQn               = -14,/*!<   2  Non maskable Interrupt, cannot be stopped or preempted */
-	HardFault_IRQn                    = -13,/*!<   3  Hard Fault, all classes of Fault */
-	SVCall_IRQn                       = -5,	/*!<  11  System Service Call via SVC instruction */
-	DebugMonitor_IRQn                 = -4,	/*!<  12  Debug Monitor                    */
-	PendSV_IRQn                       = -2,	/*!<  14  Pendable request for system service */
-	SysTick_IRQn                      = -1,	/*!<  15  System Tick Timer           */
-
-	/* ---------------------------  LPC18xx/43xx Specific Interrupt Numbers  ------------------------------- */
-	DAC_IRQn                          =   0,/*!<   0  DAC                              */
-	M0_M4CORE_IRQn                    =   1,/*!<   1  M0a                              */
-	DMA_IRQn                          =   2,/*!<   2  DMA  r                            */
-	RESERVED1_IRQn                    =   3,/*!<   3  EZH/EDM                          */
-	FLASHEEPROM_IRQn                  =   4,/*!<   4  ORed Flash EEPROM Bank A, B, EEPROM   */
-	ETHERNET_IRQn                     =   5,/*!<   5  ETHERNET                         */
-	SDIO_IRQn                         =   6,/*!<   6  SDIO                             */
-	LCD_IRQn                          =   7,/*!<   7  LCD                              */
-	USB0_IRQn                         =   8,/*!<   8  USB0                             */
-	USB1_IRQn                         =   9,/*!<   9  USB1                             */
-	SCT_IRQn                          =  10,/*!<  10  SCT                              */
-	RITIMER_IRQn                      =  11,/*!<  11  ORed RITIMER, WDT                */
-	TIMER0_IRQn                       =  12,/*!<  12  TIMER0                           */
-	GINT1_IRQn                        =  13,/*!<  13  GINT1                            */
-	PIN_INT4_IRQn                     =  14,/*!<  14  GPIO 4                           */
-	TIMER3_IRQn                       =  15,/*!<  15  TIMER3                           */
-	MCPWM_IRQn                        =  16,/*!<  16  MCPWM                            */
-	ADC0_IRQn                         =  17,/*!<  17  ADC0                             */
-	I2C0_IRQn                         =  18,/*!<  18  ORed I2C0, I2C1                  */
-	SGPIO_INT_IRQn                    =  19,/*!<  19  SGPIO                            */
-	SPI_INT_IRQn                      =  20,/*!<  20  SPI_INT                          */
-	ADC1_IRQn                         =  21,/*!<  21  ADC1                             */
-	SSP0_IRQn                         =  22,/*!<  22  ORed SSP0, SSP1                  */
-	EVENTROUTER_IRQn                  =  23,/*!<  23  EVENTROUTER                      */
-	USART0_IRQn                       =  24,/*!<  24  USART0                           */
-	UART1_IRQn                        =  25,/*!<  25  UART1                            */
-	USART2_IRQn                       =  26,/*!<  26  USART2                           */
-	USART3_IRQn                       =  27,/*!<  27  USART3                           */
-	I2S0_IRQn                         =  28,/*!<  28  ORed I2S0, I2S1                  */
-	C_CAN0_IRQn                       =  29,/*!<  29  C_CAN0                           */
-	I2S1_IRQn                         =  29,/*!<  29  I2S1                             */
-	RESERVED2_IRQn                    =  30,
-	RESERVED3_IRQn                    =  31,
-} IRQn_Type;
-
-#include "core_cm0.h"						/*!< Cortex-M4 processor and core peripherals */
-#else
-#error Please #define CORE_M0, CORE_M3 or CORE_M4
-#endif
-
-#include "system_LPC43xx.h"
-
-/**
- * @brief State Configurable Timer register block structure
- */
-#define LPC_SCT_BASE              0x40000000
-#define CONFIG_SCT_nEV   (16)			/*!< Number of events */
-#define CONFIG_SCT_nRG   (16)			/*!< Number of match/compare registers */
-#define CONFIG_SCT_nOU   (16)			/*!< Number of outputs */
-
-typedef struct {
-	__IO  uint32_t CONFIG;				/*!< Configuration Register */
-	union {
-		__IO uint32_t CTRL_U;			/*!< Control Register */
-		struct {
-			__IO uint16_t CTRL_L;		/*!< Low control register */
-			__IO uint16_t CTRL_H;		/*!< High control register */
-		};
-
-	};
-
-	__IO uint16_t LIMIT_L;				/*!< limit register for counter L */
-	__IO uint16_t LIMIT_H;				/*!< limit register for counter H */
-	__IO uint16_t HALT_L;				/*!< halt register for counter L */
-	__IO uint16_t HALT_H;				/*!< halt register for counter H */
-	__IO uint16_t STOP_L;				/*!< stop register for counter L */
-	__IO uint16_t STOP_H;				/*!< stop register for counter H */
-	__IO uint16_t START_L;				/*!< start register for counter L */
-	__IO uint16_t START_H;				/*!< start register for counter H */
-	uint32_t RESERVED1[10];				/*!< 0x03C reserved */
-	union {
-		__IO uint32_t COUNT_U;			/*!< counter register */
-		struct {
-			__IO uint16_t COUNT_L;		/*!< counter register for counter L */
-			__IO uint16_t COUNT_H;		/*!< counter register for counter H */
-		};
-
-	};
-
-	__IO uint16_t STATE_L;				/*!< state register for counter L */
-	__IO uint16_t STATE_H;				/*!< state register for counter H */
-	__I  uint32_t INPUT;				/*!< input register */
-	__IO uint16_t REGMODE_L;			/*!< match - capture registers mode register L */
-	__IO uint16_t REGMODE_H;			/*!< match - capture registers mode register H */
-	__IO uint32_t OUTPUT;				/*!< output register */
-	__IO uint32_t OUTPUTDIRCTRL;		/*!< output counter direction Control Register */
-	__IO uint32_t RES;					/*!< conflict resolution register */
-	__IO uint32_t DMA0REQUEST;			/*!< DMA0 Request Register */
-	__IO uint32_t DMA1REQUEST;			/*!< DMA1 Request Register */
-	uint32_t RESERVED2[35];
-	__IO uint32_t EVEN;					/*!< event enable register */
-	__IO uint32_t EVFLAG;				/*!< event flag register */
-	__IO uint32_t CONEN;				/*!< conflict enable register */
-	__IO uint32_t CONFLAG;				/*!< conflict flag register */
-	union {
-		__IO union {					/*!< ... Match / Capture value */
-			uint32_t U;					/*!<       SCTMATCH[i].U  Unified 32-bit register */
-			struct {
-				uint16_t L;				/*!<       SCTMATCH[i].L  Access to L value */
-				uint16_t H;				/*!<       SCTMATCH[i].H  Access to H value */
-			};
-
-		} MATCH[CONFIG_SCT_nRG];
-
-		__I union {
-			uint32_t U;					/*!<       SCTCAP[i].U  Unified 32-bit register */
-			struct {
-				uint16_t L;				/*!<       SCTCAP[i].L  Access to L value */
-				uint16_t H;				/*!<       SCTCAP[i].H  Access to H value */
-			};
-
-		} CAP[CONFIG_SCT_nRG];
-
-	};
-
-	uint32_t RESERVED3[32 - CONFIG_SCT_nRG];		/*!< ...-0x17C reserved */
-	union {
-		__IO uint16_t MATCH_L[CONFIG_SCT_nRG];		/*!< 0x180-... Match Value L counter */
-		__I  uint16_t CAP_L[CONFIG_SCT_nRG];		/*!< 0x180-... Capture Value L counter */
-	};
-
-	uint16_t RESERVED4[32 - CONFIG_SCT_nRG];		/*!< ...-0x1BE reserved */
-	union {
-		__IO uint16_t MATCH_H[CONFIG_SCT_nRG];		/*!< 0x1C0-... Match Value H counter */
-		__I  uint16_t CAP_H[CONFIG_SCT_nRG];		/*!< 0x1C0-... Capture Value H counter */
-	};
-
-	uint16_t RESERVED5[32 - CONFIG_SCT_nRG];		/*!< ...-0x1FE reserved */
-	union {
-		__IO union {					/*!< 0x200-... Match Reload / Capture Control value */
-			uint32_t U;					/*!<       SCTMATCHREL[i].U  Unified 32-bit register */
-			struct {
-				uint16_t L;				/*!<       SCTMATCHREL[i].L  Access to L value */
-				uint16_t H;				/*!<       SCTMATCHREL[i].H  Access to H value */
-			};
-
-		} MATCHREL[CONFIG_SCT_nRG];
-
-		__IO union {
-			uint32_t U;					/*!<       SCTCAPCTRL[i].U  Unified 32-bit register */
-			struct {
-				uint16_t L;				/*!<       SCTCAPCTRL[i].L  Access to L value */
-				uint16_t H;				/*!<       SCTCAPCTRL[i].H  Access to H value */
-			};
-
-		} CAPCTRL[CONFIG_SCT_nRG];
-
-	};
-
-	uint32_t RESERVED6[32 - CONFIG_SCT_nRG];		/*!< ...-0x27C reserved */
-	union {
-		__IO uint16_t MATCHREL_L[CONFIG_SCT_nRG];	/*!< 0x280-... Match Reload value L counter */
-		__IO uint16_t CAPCTRL_L[CONFIG_SCT_nRG];	/*!< 0x280-... Capture Control value L counter */
-	};
-
-	uint16_t RESERVED7[32 - CONFIG_SCT_nRG];		/*!< ...-0x2BE reserved */
-	union {
-		__IO uint16_t MATCHREL_H[CONFIG_SCT_nRG];	/*!< 0x2C0-... Match Reload value H counter */
-		__IO uint16_t CAPCTRL_H[CONFIG_SCT_nRG];	/*!< 0x2C0-... Capture Control value H counter */
-	};
-
-	uint16_t RESERVED8[32 - CONFIG_SCT_nRG];		/*!< ...-0x2FE reserved */
-	__IO struct {						/*!< 0x300-0x3FC  SCTEVENT[i].STATE / SCTEVENT[i].CTRL*/
-		uint32_t STATE;					/*!< Event State Register */
-		uint32_t CTRL;					/*!< Event Control Register */
-	} EVENT[CONFIG_SCT_nEV];
-
-	uint32_t RESERVED9[128 - 2 * CONFIG_SCT_nEV];	/*!< ...-0x4FC reserved */
-	__IO struct {						/*!< 0x500-0x57C  SCTOUT[i].SET / SCTOUT[i].CLR */
-		uint32_t SET;					/*!< Output n Set Register */
-		uint32_t CLR;					/*!< Output n Clear Register */
-	} OUT[CONFIG_SCT_nOU];
-
-	uint32_t RESERVED10[191 - 2 * CONFIG_SCT_nOU];	/*!< ...-0x7F8 reserved */
-	__I  uint32_t MODULECONTENT;		/*!< 0x7FC Module Content */
-} LPC_SCT_T;
-
-/**
- * @brief GPDMA Channel register block structure
- */
-#define LPC_GPDMA_BASE            0x40002000
-
-typedef struct {
-	__IO uint32_t  SRCADDR;				/*!< DMA Channel Source Address Register */
-	__IO uint32_t  DESTADDR;			/*!< DMA Channel Destination Address Register */
-	__IO uint32_t  LLI;					/*!< DMA Channel Linked List Item Register */
-	__IO uint32_t  CONTROL;				/*!< DMA Channel Control Register */
-	__IO uint32_t  CONFIG;				/*!< DMA Channel Configuration Register */
-	__I  uint32_t  RESERVED1[3];
-} LPC_GPDMA_CH_T;
-
-#define GPDMA_CHANNELS 8
-
-/**
- * @brief GPDMA register block
- */
-typedef struct {						/*!< GPDMA Structure */
-	__I  uint32_t  INTSTAT;				/*!< DMA Interrupt Status Register */
-	__I  uint32_t  INTTCSTAT;			/*!< DMA Interrupt Terminal Count Request Status Register */
-	__O  uint32_t  INTTCCLEAR;			/*!< DMA Interrupt Terminal Count Request Clear Register */
-	__I  uint32_t  INTERRSTAT;			/*!< DMA Interrupt Error Status Register */
-	__O  uint32_t  INTERRCLR;			/*!< DMA Interrupt Error Clear Register */
-	__I  uint32_t  RAWINTTCSTAT;		/*!< DMA Raw Interrupt Terminal Count Status Register */
-	__I  uint32_t  RAWINTERRSTAT;		/*!< DMA Raw Error Interrupt Status Register */
-	__I  uint32_t  ENBLDCHNS;			/*!< DMA Enabled Channel Register */
-	__IO uint32_t  SOFTBREQ;			/*!< DMA Software Burst Request Register */
-	__IO uint32_t  SOFTSREQ;			/*!< DMA Software Single Request Register */
-	__IO uint32_t  SOFTLBREQ;			/*!< DMA Software Last Burst Request Register */
-	__IO uint32_t  SOFTLSREQ;			/*!< DMA Software Last Single Request Register */
-	__IO uint32_t  CONFIG;				/*!< DMA Configuration Register */
-	__IO uint32_t  SYNC;				/*!< DMA Synchronization Register */
-	__I  uint32_t  RESERVED0[50];
-	LPC_GPDMA_CH_T CH[GPDMA_CHANNELS];
-} LPC_GPDMA_T;
-
-/**
- * @brief SD/MMC & SDIO register block structure
- */
-#define LPC_SDMMC_BASE            0x40004000
-
-typedef struct {				/*!< SDMMC Structure        */
-	__IO uint32_t  CTRL;		/*!< Control Register       */
-	__IO uint32_t  PWREN;		/*!< Power Enable Register  */
-	__IO uint32_t  CLKDIV;		/*!< Clock Divider Register */
-	__IO uint32_t  CLKSRC;		/*!< SD Clock Source Register */
-	__IO uint32_t  CLKENA;		/*!< Clock Enable Register  */
-	__IO uint32_t  TMOUT;		/*!< Timeout Register       */
-	__IO uint32_t  CTYPE;		/*!< Card Type Register     */
-	__IO uint32_t  BLKSIZ;		/*!< Block Size Register    */
-	__IO uint32_t  BYTCNT;		/*!< Byte Count Register    */
-	__IO uint32_t  INTMASK;		/*!< Interrupt Mask Register */
-	__IO uint32_t  CMDARG;		/*!< Command Argument Register */
-	__IO uint32_t  CMD;			/*!< Command Register       */
-	__I  uint32_t  RESP0;		/*!< Response Register 0    */
-	__I  uint32_t  RESP1;		/*!< Response Register 1    */
-	__I  uint32_t  RESP2;		/*!< Response Register 2    */
-	__I  uint32_t  RESP3;		/*!< Response Register 3    */
-	__I  uint32_t  MINTSTS;		/*!< Masked Interrupt Status Register */
-	__IO uint32_t  RINTSTS;		/*!< Raw Interrupt Status Register */
-	__I  uint32_t  STATUS;		/*!< Status Register        */
-	__IO uint32_t  FIFOTH;		/*!< FIFO Threshold Watermark Register */
-	__I  uint32_t  CDETECT;		/*!< Card Detect Register   */
-	__I  uint32_t  WRTPRT;		/*!< Write Protect Register */
-	__IO uint32_t  GPIO;		/*!< General Purpose Input/Output Register */
-	__I  uint32_t  TCBCNT;		/*!< Transferred CIU Card Byte Count Register */
-	__I  uint32_t  TBBCNT;		/*!< Transferred Host to BIU-FIFO Byte Count Register */
-	__IO uint32_t  DEBNCE;		/*!< Debounce Count Register */
-	__IO uint32_t  USRID;		/*!< User ID Register       */
-	__I  uint32_t  VERID;		/*!< Version ID Register    */
-	__I  uint32_t  RESERVED0;
-	__IO uint32_t  UHS_REG;		/*!< UHS-1 Register         */
-	__IO uint32_t  RST_N;		/*!< Hardware Reset         */
-	__I  uint32_t  RESERVED1;
-	__IO uint32_t  BMOD;		/*!< Bus Mode Register      */
-	__O  uint32_t  PLDMND;		/*!< Poll Demand Register   */
-	__IO uint32_t  DBADDR;		/*!< Descriptor List Base Address Register */
-	__IO uint32_t  IDSTS;		/*!< Internal DMAC Status Register */
-	__IO uint32_t  IDINTEN;		/*!< Internal DMAC Interrupt Enable Register */
-	__I  uint32_t  DSCADDR;		/*!< Current Host Descriptor Address Register */
-	__I  uint32_t  BUFADDR;		/*!< Current Buffer Descriptor Address Register */
-} LPC_SDMMC_T;
-
-/**
- * @brief External Memory Controller (EMC) register block structure
- */
-#define LPC_EMC_BASE              0x40005000
-
-typedef struct {							/*!< EMC Structure          */
-	__IO uint32_t  CONTROL;					/*!< Controls operation of the memory controller. */
-	__I  uint32_t  STATUS;					/*!< Provides EMC status information. */
-	__IO uint32_t  CONFIG;					/*!< Configures operation of the memory controller. */
-	__I  uint32_t  RESERVED0[5];
-	__IO uint32_t  DYNAMICCONTROL;			/*!< Controls dynamic memory operation. */
-	__IO uint32_t  DYNAMICREFRESH;			/*!< Configures dynamic memory refresh operation. */
-	__IO uint32_t  DYNAMICREADCONFIG;		/*!< Configures the dynamic memory read strategy. */
-	__I  uint32_t  RESERVED1;
-	__IO uint32_t  DYNAMICRP;				/*!< Selects the precharge command period. */
-	__IO uint32_t  DYNAMICRAS;				/*!< Selects the active to precharge command period. */
-	__IO uint32_t  DYNAMICSREX;				/*!< Selects the self-refresh exit time. */
-	__IO uint32_t  DYNAMICAPR;				/*!< Selects the last-data-out to active command time. */
-	__IO uint32_t  DYNAMICDAL;				/*!< Selects the data-in to active command time. */
-	__IO uint32_t  DYNAMICWR;				/*!< Selects the write recovery time. */
-	__IO uint32_t  DYNAMICRC;				/*!< Selects the active to active command period. */
-	__IO uint32_t  DYNAMICRFC;				/*!< Selects the auto-refresh period. */
-	__IO uint32_t  DYNAMICXSR;				/*!< Selects the exit self-refresh to active command time. */
-	__IO uint32_t  DYNAMICRRD;				/*!< Selects the active bank A to active bank B latency. */
-	__IO uint32_t  DYNAMICMRD;				/*!< Selects the load mode register to active command time. */
-	__I  uint32_t  RESERVED2[9];
-	__IO uint32_t  STATICEXTENDEDWAIT;		/*!< Selects time for long static memory read and write transfers. */
-	__I  uint32_t  RESERVED3[31];
-	__IO uint32_t  DYNAMICCONFIG0;			/*!< Selects the configuration information for dynamic memory chip select n. */
-	__IO uint32_t  DYNAMICRASCAS0;			/*!< Selects the RAS and CAS latencies for dynamic memory chip select n. */
-	__I  uint32_t  RESERVED4[6];
-	__IO uint32_t  DYNAMICCONFIG1;			/*!< Selects the configuration information for dynamic memory chip select n. */
-	__IO uint32_t  DYNAMICRASCAS1;			/*!< Selects the RAS and CAS latencies for dynamic memory chip select n. */
-	__I  uint32_t  RESERVED5[6];
-	__IO uint32_t  DYNAMICCONFIG2;			/*!< Selects the configuration information for dynamic memory chip select n. */
-	__IO uint32_t  DYNAMICRASCAS2;			/*!< Selects the RAS and CAS latencies for dynamic memory chip select n. */
-	__I  uint32_t  RESERVED6[6];
-	__IO uint32_t  DYNAMICCONFIG3;			/*!< Selects the configuration information for dynamic memory chip select n. */
-	__IO uint32_t  DYNAMICRASCAS3;			/*!< Selects the RAS and CAS latencies for dynamic memory chip select n. */
-	__I  uint32_t  RESERVED7[38];
-	__IO uint32_t  STATICCONFIG0;			/*!< Selects the memory configuration for static chip select n. */
-	__IO uint32_t  STATICWAITWEN0;			/*!< Selects the delay from chip select n to write enable. */
-	__IO uint32_t  STATICWAITOEN0;			/*!< Selects the delay from chip select n or address change, whichever is later, to output enable. */
-	__IO uint32_t  STATICWAITRD0;			/*!< Selects the delay from chip select n to a read access. */
-	__IO uint32_t  STATICWAITPAG0;			/*!< Selects the delay for asynchronous page mode sequential accesses for chip select n. */
-	__IO uint32_t  STATICWAITWR0;			/*!< Selects the delay from chip select n to a write access. */
-	__IO uint32_t  STATICWAITTURN0;			/*!< Selects bus turnaround cycles */
-	__I  uint32_t  RESERVED8;
-	__IO uint32_t  STATICCONFIG1;			/*!< Selects the memory configuration for static chip select n. */
-	__IO uint32_t  STATICWAITWEN1;			/*!< Selects the delay from chip select n to write enable. */
-	__IO uint32_t  STATICWAITOEN1;			/*!< Selects the delay from chip select n or address change, whichever is later, to output enable. */
-	__IO uint32_t  STATICWAITRD1;			/*!< Selects the delay from chip select n to a read access. */
-	__IO uint32_t  STATICWAITPAG1;			/*!< Selects the delay for asynchronous page mode sequential accesses for chip select n. */
-	__IO uint32_t  STATICWAITWR1;			/*!< Selects the delay from chip select n to a write access. */
-	__IO uint32_t  STATICWAITTURN1;			/*!< Selects bus turnaround cycles */
-	__I  uint32_t  RESERVED9;
-	__IO uint32_t  STATICCONFIG2;			/*!< Selects the memory configuration for static chip select n. */
-	__IO uint32_t  STATICWAITWEN2;			/*!< Selects the delay from chip select n to write enable. */
-	__IO uint32_t  STATICWAITOEN2;			/*!< Selects the delay from chip select n or address change, whichever is later, to output enable. */
-	__IO uint32_t  STATICWAITRD2;			/*!< Selects the delay from chip select n to a read access. */
-	__IO uint32_t  STATICWAITPAG2;			/*!< Selects the delay for asynchronous page mode sequential accesses for chip select n. */
-	__IO uint32_t  STATICWAITWR2;			/*!< Selects the delay from chip select n to a write access. */
-	__IO uint32_t  STATICWAITTURN2;			/*!< Selects bus turnaround cycles */
-	__I  uint32_t  RESERVED10;
-	__IO uint32_t  STATICCONFIG3;			/*!< Selects the memory configuration for static chip select n. */
-	__IO uint32_t  STATICWAITWEN3;			/*!< Selects the delay from chip select n to write enable. */
-	__IO uint32_t  STATICWAITOEN3;			/*!< Selects the delay from chip select n or address change, whichever is later, to output enable. */
-	__IO uint32_t  STATICWAITRD3;			/*!< Selects the delay from chip select n to a read access. */
-	__IO uint32_t  STATICWAITPAG3;			/*!< Selects the delay for asynchronous page mode sequential accesses for chip select n. */
-	__IO uint32_t  STATICWAITWR3;			/*!< Selects the delay from chip select n to a write access. */
-	__IO uint32_t  STATICWAITTURN3;			/*!< Selects bus turnaround cycles */
-} LPC_EMC_T;
-
-/**
- * @brief USB High-Speed register block structure
- */
-#define LPC_USB0_BASE             0x40006000
-#define LPC_USB1_BASE             0x40007000
-
-typedef struct {							/*!< USB Structure         */
-	__I  uint32_t  RESERVED0[64];
-	__I  uint32_t  CAPLENGTH;				/*!< Capability register length */
-	__I  uint32_t  HCSPARAMS;				/*!< Host controller structural parameters */
-	__I  uint32_t  HCCPARAMS;				/*!< Host controller capability parameters */
-	__I  uint32_t  RESERVED1[5];
-	__I  uint32_t  DCIVERSION;				/*!< Device interface version number */
-	__I  uint32_t  RESERVED2[7];
-	union {
-		__IO uint32_t  USBCMD_H;			/*!< USB command (host mode) */
-		__IO uint32_t  USBCMD_D;			/*!< USB command (device mode) */
-	};
-
-	union {
-		__IO uint32_t  USBSTS_H;			/*!< USB status (host mode) */
-		__IO uint32_t  USBSTS_D;			/*!< USB status (device mode) */
-	};
-
-	union {
-		__IO uint32_t  USBINTR_H;			/*!< USB interrupt enable (host mode) */
-		__IO uint32_t  USBINTR_D;			/*!< USB interrupt enable (device mode) */
-	};
-
-	union {
-		__IO uint32_t  FRINDEX_H;			/*!< USB frame index (host mode) */
-		__I  uint32_t  FRINDEX_D;			/*!< USB frame index (device mode) */
-	};
-
-	__I  uint32_t  RESERVED3;
-	union {
-		__IO uint32_t  PERIODICLISTBASE;	/*!< Frame list base address */
-		__IO uint32_t  DEVICEADDR;			/*!< USB device address     */
-	};
-
-	union {
-		__IO uint32_t  ASYNCLISTADDR;		/*!< Address of endpoint list in memory (host mode) */
-		__IO uint32_t  ENDPOINTLISTADDR;	/*!< Address of endpoint list in memory (device mode) */
-	};
-
-	__IO uint32_t  TTCTRL;					/*!< Asynchronous buffer status for embedded TT (host mode) */
-	__IO uint32_t  BURSTSIZE;				/*!< Programmable burst size */
-	__IO uint32_t  TXFILLTUNING;			/*!< Host transmit pre-buffer packet tuning (host mode) */
-	__I  uint32_t  RESERVED4[2];
-	__IO uint32_t  ULPIVIEWPORT;			/*!< ULPI viewport          */
-	__IO uint32_t  BINTERVAL;				/*!< Length of virtual frame */
-	__IO uint32_t  ENDPTNAK;				/*!< Endpoint NAK (device mode) */
-	__IO uint32_t  ENDPTNAKEN;				/*!< Endpoint NAK Enable (device mode) */
-	__I  uint32_t  RESERVED5;
-	union {
-		__IO uint32_t  PORTSC1_H;			/*!< Port 1 status/control (host mode) */
-		__IO uint32_t  PORTSC1_D;			/*!< Port 1 status/control (device mode) */
-	};
-
-	__I  uint32_t  RESERVED6[7];
-	__IO uint32_t  OTGSC;					/*!< OTG status and control */
-	union {
-		__IO uint32_t  USBMODE_H;			/*!< USB mode (host mode)   */
-		__IO uint32_t  USBMODE_D;			/*!< USB mode (device mode) */
-	};
-
-	__IO uint32_t  ENDPTSETUPSTAT;			/*!< Endpoint setup status  */
-	__IO uint32_t  ENDPTPRIME;				/*!< Endpoint initialization */
-	__IO uint32_t  ENDPTFLUSH;				/*!< Endpoint de-initialization */
-	__I  uint32_t  ENDPTSTAT;				/*!< Endpoint status        */
-	__IO uint32_t  ENDPTCOMPLETE;			/*!< Endpoint complete      */
-	__IO uint32_t  ENDPTCTRL[6];			/*!< Endpoint control 0     */
-} LPC_USBHS_T;
-
-/**
- * @brief LCD Controller register block structure
- */
-#define LPC_LCD_BASE              0x40008000
-
-typedef struct {				/*!< LCD Structure          */
-	__IO uint32_t  TIMH;		/*!< Horizontal Timing Control register */
-	__IO uint32_t  TIMV;		/*!< Vertical Timing Control register */
-	__IO uint32_t  POL;			/*!< Clock and Signal Polarity Control register */
-	__IO uint32_t  LE;			/*!< Line End Control register */
-	__IO uint32_t  UPBASE;		/*!< Upper Panel Frame Base Address register */
-	__IO uint32_t  LPBASE;		/*!< Lower Panel Frame Base Address register */
-	__IO uint32_t  CTRL;		/*!< LCD Control register   */
-	__IO uint32_t  INTMSK;		/*!< Interrupt Mask register */
-	__I  uint32_t  INTRAW;		/*!< Raw Interrupt Status register */
-	__I  uint32_t  INTSTAT;		/*!< Masked Interrupt Status register */
-	__O  uint32_t  INTCLR;		/*!< Interrupt Clear register */
-	__I  uint32_t  UPCURR;		/*!< Upper Panel Current Address Value register */
-	__I  uint32_t  LPCURR;		/*!< Lower Panel Current Address Value register */
-	__I  uint32_t  RESERVED0[115];
-	__IO uint16_t PAL[256];		/*!< 256x16-bit Color Palette registers */
-	__I  uint32_t  RESERVED1[256];
-	__IO uint32_t CRSR_IMG[256];/*!< Cursor Image registers */
-	__IO uint32_t  CRSR_CTRL;	/*!< Cursor Control register */
-	__IO uint32_t  CRSR_CFG;	/*!< Cursor Configuration register */
-	__IO uint32_t  CRSR_PAL0;	/*!< Cursor Palette register 0 */
-	__IO uint32_t  CRSR_PAL1;	/*!< Cursor Palette register 1 */
-	__IO uint32_t  CRSR_XY;		/*!< Cursor XY Position register */
-	__IO uint32_t  CRSR_CLIP;	/*!< Cursor Clip Position register */
-	__I  uint32_t  RESERVED2[2];
-	__IO uint32_t  CRSR_INTMSK;	/*!< Cursor Interrupt Mask register */
-	__O  uint32_t  CRSR_INTCLR;	/*!< Cursor Interrupt Clear register */
-	__I  uint32_t  CRSR_INTRAW;	/*!< Cursor Raw Interrupt Status register */
-	__I  uint32_t  CRSR_INTSTAT;/*!< Cursor Masked Interrupt Status register */
-} LPC_LCD_T;
-
-/**
- * @brief EEPROM register block structure
- */
-#define LPC_EEPROM_BASE           0x4000E000
-
-typedef struct {				/* EEPROM Structure */
-	__IO uint32_t CMD;			/*!< EEPROM command register */
-	uint32_t RESERVED0;
-	__IO uint32_t RWSTATE;		/*!< EEPROM read wait state register */
-	__IO uint32_t AUTOPROG;		/*!< EEPROM auto programming register */
-	__IO uint32_t WSTATE;		/*!< EEPROM wait state register */
-	__IO uint32_t CLKDIV;		/*!< EEPROM clock divider register */
-	__IO uint32_t PWRDWN;		/*!< EEPROM power-down register */
-	uint32_t RESERVED2[1007];
-	__O  uint32_t INTENCLR;		/*!< EEPROM interrupt enable clear */
-	__O  uint32_t INTENSET;		/*!< EEPROM interrupt enable set */
-	__I  uint32_t INTSTAT;		/*!< EEPROM interrupt status */
-	__I  uint32_t INTEN;		/*!< EEPROM interrupt enable */
-	__O  uint32_t INTSTATCLR;	/*!< EEPROM interrupt status clear */
-	__O  uint32_t INTSTATSET;	/*!< EEPROM interrupt status set */
-} LPC_EEPROM_T;
-
-/**
- * @brief 10/100 MII & RMII Ethernet with timestamping register block structure
- */
-#define LPC_ETHERNET_BASE         0x40010000
-
-typedef struct {							/*!< ETHERNET Structure */
-	__IO uint32_t  MAC_CONFIG;				/*!< MAC configuration register */
-	__IO uint32_t  MAC_FRAME_FILTER;		/*!< MAC frame filter */
-	__IO uint32_t  MAC_HASHTABLE_HIGH;		/*!< Hash table high register */
-	__IO uint32_t  MAC_HASHTABLE_LOW;		/*!< Hash table low register */
-	__IO uint32_t  MAC_MII_ADDR;			/*!< MII address register */
-	__IO uint32_t  MAC_MII_DATA;			/*!< MII data register */
-	__IO uint32_t  MAC_FLOW_CTRL;			/*!< Flow control register */
-	__IO uint32_t  MAC_VLAN_TAG;			/*!< VLAN tag register */
-	__I  uint32_t  RESERVED0;
-	__I  uint32_t  MAC_DEBUG;				/*!< Debug register */
-	__IO uint32_t  MAC_RWAKE_FRFLT;			/*!< Remote wake-up frame filter */
-	__IO uint32_t  MAC_PMT_CTRL_STAT;		/*!< PMT control and status */
-	__I  uint32_t  RESERVED1[2];
-	__I  uint32_t  MAC_INTR;				/*!< Interrupt status register */
-	__IO uint32_t  MAC_INTR_MASK;			/*!< Interrupt mask register */
-	__IO uint32_t  MAC_ADDR0_HIGH;			/*!< MAC address 0 high register */
-	__IO uint32_t  MAC_ADDR0_LOW;			/*!< MAC address 0 low register */
-	__I  uint32_t  RESERVED2[430];
-	__IO uint32_t  MAC_TIMESTP_CTRL;		/*!< Time stamp control register */
-	__IO uint32_t  SUBSECOND_INCR;			/*!< Sub-second increment register */
-	__I  uint32_t  SECONDS;					/*!< System time seconds register */
-	__I  uint32_t  NANOSECONDS;				/*!< System time nanoseconds register */
-	__IO uint32_t  SECONDSUPDATE;			/*!< System time seconds update register */
-	__IO uint32_t  NANOSECONDSUPDATE;		/*!< System time nanoseconds update register */
-	__IO uint32_t  ADDEND;					/*!< Time stamp addend register */
-	__IO uint32_t  TARGETSECONDS;			/*!< Target time seconds register */
-	__IO uint32_t  TARGETNANOSECONDS;		/*!< Target time nanoseconds register */
-	__IO uint32_t  HIGHWORD;				/*!< System time higher word seconds register */
-	__I  uint32_t  TIMESTAMPSTAT;			/*!< Time stamp status register */
-	__IO uint32_t  PPSCTRL;					/*!< PPS control register */
-	__I  uint32_t  AUXNANOSECONDS;			/*!< Auxiliary time stamp nanoseconds register */
-	__I  uint32_t  AUXSECONDS;				/*!< Auxiliary time stamp seconds register */
-	__I  uint32_t  RESERVED3[562];
-	__IO uint32_t  DMA_BUS_MODE;			/*!< Bus Mode Register      */
-	__IO uint32_t  DMA_TRANS_POLL_DEMAND;	/*!< Transmit poll demand register */
-	__IO uint32_t  DMA_REC_POLL_DEMAND;		/*!< Receive poll demand register */
-	__IO uint32_t  DMA_REC_DES_ADDR;		/*!< Receive descriptor list address register */
-	__IO uint32_t  DMA_TRANS_DES_ADDR;		/*!< Transmit descriptor list address register */
-	__IO uint32_t  DMA_STAT;				/*!< Status register */
-	__IO uint32_t  DMA_OP_MODE;				/*!< Operation mode register */
-	__IO uint32_t  DMA_INT_EN;				/*!< Interrupt enable register */
-	__I  uint32_t  DMA_MFRM_BUFOF;			/*!< Missed frame and buffer overflow register */
-	__IO uint32_t  DMA_REC_INT_WDT;			/*!< Receive interrupt watchdog timer register */
-	__I  uint32_t  RESERVED4[8];
-	__I  uint32_t  DMA_CURHOST_TRANS_DES;	/*!< Current host transmit descriptor register */
-	__I  uint32_t  DMA_CURHOST_REC_DES;		/*!< Current host receive descriptor register */
-	__I  uint32_t  DMA_CURHOST_TRANS_BUF;	/*!< Current host transmit buffer address register */
-	__I  uint32_t  DMA_CURHOST_REC_BUF;		/*!< Current host receive buffer address register */
-} LPC_ENET_T;
-
-/**
- * @brief Alarm Timer register block structure
- */
-#define LPC_ATIMER_BASE           0x40040000
-
-typedef struct {					/*!< ATIMER Structure       */
-	__IO uint32_t DOWNCOUNTER;		/*!< Downcounter register   */
-	__IO uint32_t PRESET;			/*!< Preset value register  */
-	__I  uint32_t RESERVED0[1012];
-	__O  uint32_t CLR_EN;			/*!< Interrupt clear enable register */
-	__O  uint32_t SET_EN;			/*!< Interrupt set enable register */
-	__I  uint32_t STATUS;			/*!< Status register        */
-	__I  uint32_t ENABLE;			/*!< Enable register        */
-	__O  uint32_t CLR_STAT;			/*!< Clear register         */
-	__O  uint32_t SET_STAT;			/*!< Set register           */
-} LPC_ATIMER_T;
-
-/**
- * @brief Register File register block structure
- */
-#define LPC_REGFILE_BASE          0x40041000
-
-typedef struct {
-	__IO uint32_t REGFILE[64];	/*!< General purpose storage register */
-} LPC_REGFILE_T;
-
-/**
- * @brief Power Management Controller register block structure
- */
-#define LPC_PMC_BASE              0x40042000
-
-typedef struct {						/*!< PMC Structure          */
-	__IO uint32_t  PD0_SLEEP0_HW_ENA;	/*!< Hardware sleep event enable register */
-	__I  uint32_t  RESERVED0[6];
-	__IO uint32_t  PD0_SLEEP0_MODE;		/*!< Sleep power mode register */
-} LPC_PMC_T;
-
-/**
- * @brief CREG Register Block
- */
-#define LPC_CREG_BASE             0x40043000
-
-typedef struct {						/*!< CREG Structure         */
-	__I  uint32_t  RESERVED0;
-	__IO uint32_t  CREG0;				/*!< Chip configuration register 32 kHz oscillator output and BOD control register. */
-	__I  uint32_t  RESERVED1[62];
-	__IO uint32_t  MXMEMMAP;			/*!< ARM Cortex-M3/M4 memory mapping */
-#if defined(CHIP_LPC18XX)
-	__I  uint32_t  RESERVED2[5];
-#else
-	__I  uint32_t  RESERVED2;
-	__I  uint32_t  CREG1;				/*!< Configuration Register 1 */
-	__I  uint32_t  CREG2;				/*!< Configuration Register 2 */
-	__I  uint32_t  CREG3;				/*!< Configuration Register 3 */
-	__I  uint32_t  CREG4;				/*!< Configuration Register 4 */
-#endif
-	__IO uint32_t  CREG5;				/*!< Chip configuration register 5. Controls JTAG access. */
-	__IO uint32_t  DMAMUX;				/*!< DMA muxing control     */
-	__IO uint32_t  FLASHCFGA;			/*!< Flash accelerator configuration register for flash bank A */
-	__IO uint32_t  FLASHCFGB;			/*!< Flash accelerator configuration register for flash bank B */
-	__IO uint32_t  ETBCFG;				/*!< ETB RAM configuration  */
-	__IO uint32_t  CREG6;				/*!< Chip configuration register 6. */
-#if defined(CHIP_LPC18XX)
-	__I  uint32_t  RESERVED4[52];
-#else
-	__IO uint32_t  M4TXEVENT;			/*!< M4 IPC event register */
-	__I  uint32_t  RESERVED4[51];
-#endif
-	__I  uint32_t  CHIPID;				/*!< Part ID                */
-#if defined(CHIP_LPC18XX)
-	__I  uint32_t  RESERVED5[191];
-#else
-	__I  uint32_t  RESERVED5[127];
-	__IO uint32_t  M0TXEVENT;			/*!< M0 IPC Event register */
-	__IO uint32_t  M0APPMEMMAP;			/*!< ARM Cortex M0 memory mapping */
-	__I  uint32_t  RESERVED6[62];
-#endif
-	__IO uint32_t  USB0FLADJ;			/*!< USB0 frame length adjust register */
-	__I  uint32_t  RESERVED7[63];
-	__IO uint32_t  USB1FLADJ;			/*!< USB1 frame length adjust register */
-} LPC_CREG_T;
-
-/**
- * @brief Event Router register structure
- */
-#define LPC_EVRT_BASE             0x40044000
-
-typedef struct {						/*!< EVENTROUTER Structure  */
-	__IO uint32_t HILO;					/*!< Level configuration register */
-	__IO uint32_t EDGE;					/*!< Edge configuration     */
-	__I  uint32_t RESERVED0[1012];
-	__O  uint32_t CLR_EN;				/*!< Event clear enable register */
-	__O  uint32_t SET_EN;				/*!< Event set enable register */
-	__I  uint32_t STATUS;				/*!< Status register        */
-	__I  uint32_t ENABLE;				/*!< Enable register        */
-	__O  uint32_t CLR_STAT;				/*!< Clear register         */
-	__O  uint32_t SET_STAT;				/*!< Set register           */
-} LPC_EVRT_T;
-
-/**
- * @brief Real Time Clock register block structure
- */
-#define LPC_RTC_BASE              0x40046000
-#define RTC_EV_SUPPORT      1			/* Event Monitor/Recorder support */
-
-typedef enum IP_RTC_TIMEINDEX {
-	RTC_TIMETYPE_SECOND,		/*!< Second */
-	RTC_TIMETYPE_MINUTE,		/*!< Month */
-	RTC_TIMETYPE_HOUR,			/*!< Hour */
-	RTC_TIMETYPE_DAYOFMONTH,	/*!< Day of month */
-	RTC_TIMETYPE_DAYOFWEEK,		/*!< Day of week */
-	RTC_TIMETYPE_DAYOFYEAR,		/*!< Day of year */
-	RTC_TIMETYPE_MONTH,			/*!< Month */
-	RTC_TIMETYPE_YEAR,			/*!< Year */
-	RTC_TIMETYPE_LAST
-} IP_RTC_TIMEINDEX_T;
-
-#if RTC_EV_SUPPORT
-typedef enum LPC_RTC_EV_CHANNEL {
-	RTC_EV_CHANNEL_1 = 0,
-	RTC_EV_CHANNEL_2,
-	RTC_EV_CHANNEL_3,
-	RTC_EV_CHANNEL_NUM,
-} LPC_RTC_EV_CHANNEL_T;
-#endif /*RTC_EV_SUPPORT*/
-
-typedef struct {							/*!< RTC Structure          */
-	__IO uint32_t  ILR;						/*!< Interrupt Location Register */
-	__I  uint32_t  RESERVED0;
-	__IO uint32_t  CCR;						/*!< Clock Control Register */
-	__IO uint32_t  CIIR;					/*!< Counter Increment Interrupt Register */
-	__IO uint32_t  AMR;						/*!< Alarm Mask Register    */
-	__I  uint32_t  CTIME[3];				/*!< Consolidated Time Register 0,1,2 */
-	__IO uint32_t  TIME[RTC_TIMETYPE_LAST];	/*!< Timer field registers */
-	__IO uint32_t  CALIBRATION;				/*!< Calibration Value Register */
-	__I  uint32_t  RESERVED1[7];
-	__IO uint32_t  ALRM[RTC_TIMETYPE_LAST];	/*!< Alarm field registers */
-#if RTC_EV_SUPPORT
-	__IO uint32_t ERSTATUS;					/*!< Event Monitor/Recorder Status register*/
-	__IO uint32_t ERCONTROL;				/*!< Event Monitor/Recorder Control register*/
-	__I  uint32_t ERCOUNTERS;				/*!< Event Monitor/Recorder Counters register*/
-	__I  uint32_t RESERVED2;
-	__I  uint32_t ERFIRSTSTAMP[RTC_EV_CHANNEL_NUM];			/*!<Event Monitor/Recorder First Stamp registers*/
-	__I  uint32_t RESERVED3;
-	__I  uint32_t ERLASTSTAMP[RTC_EV_CHANNEL_NUM];			/*!<Event Monitor/Recorder Last Stamp registers*/
-#endif /*RTC_EV_SUPPORT*/
-} LPC_RTC_T;
-
-/**
- * @brief LPC18XX/43XX CGU register block structure
- */
-#define LPC_CGU_BASE              0x40050000
-#define LPC_CCU1_BASE             0x40051000
-#define LPC_CCU2_BASE             0x40052000
-/**
- * These are possible input clocks for the CGU and can come
- * from both external (crystal) and internal (PLL) sources. These
- * clock inputs can be routed to the base clocks (@ref CGU_BASE_CLK_T).
- */
-typedef enum CGU_CLKIN {
-	CLKIN_32K,      /*!< External 32KHz input */
-	CLKIN_IRC,      /*!< Internal IRC (12MHz) input */
-	CLKIN_ENET_RX,  /*!< External ENET_RX pin input */
-	CLKIN_ENET_TX,  /*!< External ENET_TX pin input */
-	CLKIN_CLKIN,    /*!< External GPCLKIN pin input */
-	CLKIN_RESERVED1,
-	CLKIN_CRYSTAL,  /*!< External (main) crystal pin input */
-	CLKIN_USBPLL,   /*!< Internal USB PLL input */
-	CLKIN_AUDIOPLL, /*!< Internal Audio PLL input */
-	CLKIN_MAINPLL,  /*!< Internal Main PLL input */
-	CLKIN_RESERVED2,
-	CLKIN_RESERVED3,
-	CLKIN_IDIVA,    /*!< Internal divider A input */
-	CLKIN_IDIVB,    /*!< Internal divider B input */
-	CLKIN_IDIVC,    /*!< Internal divider C input */
-	CLKIN_IDIVD,    /*!< Internal divider D input */
-	CLKIN_IDIVE,    /*!< Internal divider E input */
-	CLKINPUT_PD     /*!< External 32KHz input */
-} CGU_CLKIN_T;
-
-#define CLKIN_PLL0USB    CLKIN_USBPLL
-#define CLKIN_PLL0AUDIO  CLKIN_AUDIOPLL
-#define CLKIN_PLL1       CLKIN_MAINPLL
-
-/**
- * CGU base clocks are clocks that are associated with a single input clock
- * and are routed out to 1 or more peripherals. For example, the CLK_BASE_PERIPH
- * clock can be configured to use the CLKIN_MAINPLL input clock, which will in
- * turn route that clock to the CLK_PERIPH_BUS, CLK_PERIPH_CORE, and
- * CLK_PERIPH_SGPIO periphral clocks.
- */
-typedef enum CGU_BASE_CLK {
-	CLK_BASE_SAFE,		/*!< Base clock for WDT oscillator, IRC input only */
-	CLK_BASE_USB0,		/*!< Base USB clock for USB0, USB PLL input only */
-#if defined(CHIP_LPC43XX)
-	CLK_BASE_PERIPH,	/*!< Base clock for SGPIO */
-#else
-	CLK_BASE_RESERVED1,
-#endif
-	CLK_BASE_USB1,		/*!< Base USB clock for USB1 */
-	CLK_BASE_MX,		/*!< Base clock for CPU core */
-	CLK_BASE_SPIFI,		/*!< Base clock for SPIFI */
-#if defined(CHIP_LPC43XX)
-	CLK_BASE_SPI,		/*!< Base clock for SPI */
-#else
-	CLK_BASE_RESERVED2,
-#endif
-	CLK_BASE_PHY_RX,	/*!< Base clock for PHY RX */
-	CLK_BASE_PHY_TX,	/*!< Base clock for PHY TX */
-	CLK_BASE_APB1,		/*!< Base clock for APB1 group */
-	CLK_BASE_APB3,		/*!< Base clock for APB3 group */
-	CLK_BASE_LCD,		/*!< Base clock for LCD pixel clock */
-#if defined(CHIP_LPC43XX)
-	CLK_BASE_VADC,		/*!< Base clock for VADC */
-#else
-	CLK_BASE_RESERVED3,
-#endif
-	CLK_BASE_SDIO,		/*!< Base clock for SDIO */
-	CLK_BASE_SSP0,		/*!< Base clock for SSP0 */
-	CLK_BASE_SSP1,		/*!< Base clock for SSP1 */
-	CLK_BASE_UART0,		/*!< Base clock for UART0 */
-	CLK_BASE_UART1,		/*!< Base clock for UART1 */
-	CLK_BASE_UART2,		/*!< Base clock for UART2 */
-	CLK_BASE_UART3,		/*!< Base clock for UART3 */
-	CLK_BASE_OUT,		/*!< Base clock for CLKOUT pin */
-	CLK_BASE_RESERVED4,
-	CLK_BASE_RESERVED5,
-	CLK_BASE_RESERVED6,
-	CLK_BASE_RESERVED7,
-	CLK_BASE_APLL,		/*!< Base clock for audio PLL */
-	CLK_BASE_CGU_OUT0,	/*!< Base clock for CGUOUT0 pin */
-	CLK_BASE_CGU_OUT1,	/*!< Base clock for CGUOUT1 pin */
-	CLK_BASE_LAST,
-	CLK_BASE_NONE = CLK_BASE_LAST
-} CGU_BASE_CLK_T;
-
-/**
- * CGU dividers provide an extra clock state where a specific clock can be
- * divided before being routed to a peripheral group. A divider accepts an
- * input clock and then divides it. To use the divided clock for a base clock
- * group, use the divider as the input clock for the base clock (for example,
- * use CLKIN_IDIVB, where CLKIN_MAINPLL might be the input into the divider).
- */
-typedef enum CGU_IDIV {
-	CLK_IDIV_A,		/*!< CGU clock divider A */
-	CLK_IDIV_B,		/*!< CGU clock divider B */
-	CLK_IDIV_C,		/*!< CGU clock divider A */
-	CLK_IDIV_D,		/*!< CGU clock divider D */
-	CLK_IDIV_E,		/*!< CGU clock divider E */
-	CLK_IDIV_LAST
-} CGU_IDIV_T;
-
-/**
- * Peripheral clocks are individual clocks routed to peripherals. Although
- * multiple peripherals may share a same base clock, each peripheral's clock
- * can be enabled or disabled individually. Some peripheral clocks also have
- * additional dividers associated with them.
- */
-typedef enum CCU_CLK {
-	/* CCU1 clocks */
-	CLK_APB3_BUS,		/*!< APB3 bus clock from base clock CLK_BASE_APB3 */
-	CLK_APB3_I2C1,		/*!< I2C1 register/perigheral clock from base clock CLK_BASE_APB3 */
-	CLK_APB3_DAC,		/*!< DAC peripheral clock from base clock CLK_BASE_APB3 */
-	CLK_APB3_ADC0,		/*!< ADC0 register/perigheral clock from base clock CLK_BASE_APB3 */
-	CLK_APB3_ADC1,		/*!< ADC1 register/perigheral clock from base clock CLK_BASE_APB3 */
-	CLK_APB3_CAN0,		/*!< CAN0 register/perigheral clock from base clock CLK_BASE_APB3 */
-	CLK_APB1_BUS = 32,	/*!< APB1 bus clock clock from base clock CLK_BASE_APB1 */
-	CLK_APB1_MOTOCON,	/*!< Motor controller register/perigheral clock from base clock CLK_BASE_APB1 */
-	CLK_APB1_I2C0,		/*!< I2C0 register/perigheral clock from base clock CLK_BASE_APB1 */
-	CLK_APB1_I2S,		/*!< I2S register/perigheral clock from base clock CLK_BASE_APB1 */
-	CLK_APB1_CAN1,		/*!< CAN1 register/perigheral clock from base clock CLK_BASE_APB1 */
-	CLK_SPIFI = 64,		/*!< SPIFI SCKI input clock from base clock CLK_BASE_SPIFI */
-	CLK_MX_BUS = 96,	/*!< M3/M4 BUS core clock from base clock CLK_BASE_MX */
-	CLK_MX_SPIFI,		/*!< SPIFI register clock from base clock CLK_BASE_MX */
-	CLK_MX_GPIO,		/*!< GPIO register clock from base clock CLK_BASE_MX */
-	CLK_MX_LCD,			/*!< LCD register clock from base clock CLK_BASE_MX */
-	CLK_MX_ETHERNET,	/*!< ETHERNET register clock from base clock CLK_BASE_MX */
-	CLK_MX_USB0,		/*!< USB0 register clock from base clock CLK_BASE_MX */
-	CLK_MX_EMC,			/*!< EMC clock from base clock CLK_BASE_MX */
-	CLK_MX_SDIO,		/*!< SDIO register clock from base clock CLK_BASE_MX */
-	CLK_MX_DMA,			/*!< DMA register clock from base clock CLK_BASE_MX */
-	CLK_MX_MXCORE,		/*!< M3/M4 CPU core clock from base clock CLK_BASE_MX */
-	RESERVED_ALIGN = CLK_MX_MXCORE + 3,
-	CLK_MX_SCT,			/*!< SCT register clock from base clock CLK_BASE_MX */
-	CLK_MX_USB1,		/*!< USB1 register clock from base clock CLK_BASE_MX */
-	CLK_MX_EMC_DIV,		/*!< ENC divider clock from base clock CLK_BASE_MX */
-	CLK_MX_FLASHA,		/*!< FLASHA bank clock from base clock CLK_BASE_MX */
-	CLK_MX_FLASHB,		/*!< FLASHB bank clock from base clock CLK_BASE_MX */
-#if defined(CHIP_LPC43XX)
-	CLK_M4_M0APP,		/*!< M0 app CPU core clock from base clock CLK_BASE_MX */
-	CLK_MX_VADC,		/*!< VADC clock from base clock CLK_BASE_MX */
-#else
-	CLK_RESERVED1,
-	CLK_RESERVED2,
-#endif
-	CLK_MX_EEPROM,		/*!< EEPROM clock from base clock CLK_BASE_MX */
-	CLK_MX_WWDT = 128,	/*!< WWDT register clock from base clock CLK_BASE_MX */
-	CLK_MX_UART0,		/*!< UART0 register clock from base clock CLK_BASE_MX */
-	CLK_MX_UART1,		/*!< UART1 register clock from base clock CLK_BASE_MX */
-	CLK_MX_SSP0,		/*!< SSP0 register clock from base clock CLK_BASE_MX */
-	CLK_MX_TIMER0,		/*!< TIMER0 register/perigheral clock from base clock CLK_BASE_MX */
-	CLK_MX_TIMER1,		/*!< TIMER1 register/perigheral clock from base clock CLK_BASE_MX */
-	CLK_MX_SCU,			/*!< SCU register/perigheral clock from base clock CLK_BASE_MX */
-	CLK_MX_CREG,		/*!< CREG clock from base clock CLK_BASE_MX */
-	CLK_MX_RITIMER = 160,	/*!< RITIMER register/perigheral clock from base clock CLK_BASE_MX */
-	CLK_MX_UART2,		/*!< UART3 register clock from base clock CLK_BASE_MX */
-	CLK_MX_UART3,		/*!< UART4 register clock from base clock CLK_BASE_MX */
-	CLK_MX_TIMER2,		/*!< TIMER2 register/perigheral clock from base clock CLK_BASE_MX */
-	CLK_MX_TIMER3,		/*!< TIMER3 register/perigheral clock from base clock CLK_BASE_MX */
-	CLK_MX_SSP1,		/*!< SSP1 register clock from base clock CLK_BASE_MX */
-	CLK_MX_QEI,			/*!< QEI register/perigheral clock from base clock CLK_BASE_MX */
-#if defined(CHIP_LPC43XX)
-	CLK_PERIPH_BUS = 192,	/*!< Peripheral bus clock from base clock CLK_BASE_PERIPH */
-	CLK_RESERVED3,
-	CLK_PERIPH_CORE,	/*!< Peripheral core clock from base clock CLK_BASE_PERIPH */
-	CLK_PERIPH_SGPIO,	/*!< SGPIO clock from base clock CLK_BASE_PERIPH */
-#else
-	CLK_RESERVED3 = 192,
-	CLK_RESERVED3A,
-	CLK_RESERVED4,
-	CLK_RESERVED5,
-#endif
-	CLK_USB0 = 224,			/*!< USB0 clock from base clock CLK_BASE_USB0 */
-	CLK_USB1 = 256,			/*!< USB1 clock from base clock CLK_BASE_USB1 */
-#if defined(CHIP_LPC43XX)
-	CLK_SPI = 288,			/*!< SPI clock from base clock CLK_BASE_SPI */
-	CLK_VADC,				/*!< VADC clock from base clock CLK_BASE_VADC */
-#else
-	CLK_RESERVED7 = 320,
-	CLK_RESERVED8,
-#endif
-	CLK_CCU1_LAST,
-
-	/* CCU2 clocks */
-	CLK_CCU2_START,
-	CLK_APLL = CLK_CCU2_START,	/*!< Audio PLL clock from base clock CLK_BASE_APLL */
-	RESERVED_ALIGNB = CLK_CCU2_START + 31,
-	CLK_APB2_UART3,			/*!< UART3 clock from base clock CLK_BASE_UART3 */
-	RESERVED_ALIGNC = CLK_CCU2_START + 63,
-	CLK_APB2_UART2,			/*!< UART2 clock from base clock CLK_BASE_UART2 */
-	RESERVED_ALIGND = CLK_CCU2_START + 95,
-	CLK_APB0_UART1,			/*!< UART1 clock from base clock CLK_BASE_UART1 */
-	RESERVED_ALIGNE = CLK_CCU2_START + 127,
-	CLK_APB0_UART0,			/*!< UART0 clock from base clock CLK_BASE_UART0 */
-	RESERVED_ALIGNF = CLK_CCU2_START + 159,
-	CLK_APB2_SSP1,			/*!< SSP1 clock from base clock CLK_BASE_SSP1 */
-	RESERVED_ALIGNG = CLK_CCU2_START + 191,
-	CLK_APB0_SSP0,			/*!< SSP0 clock from base clock CLK_BASE_SSP0 */
-	RESERVED_ALIGNH = CLK_CCU2_START + 223,
-	CLK_APB2_SDIO,			/*!< SDIO clock from base clock CLK_BASE_SDIO */
-	CLK_CCU2_LAST
-} CCU_CLK_T;
-
-/**
- * Audio or USB PLL selection
- */
-typedef enum CHIP_CGU_USB_AUDIO_PLL {
-	CGU_USB_PLL,
-	CGU_AUDIO_PLL
-} CHIP_CGU_USB_AUDIO_PLL_T;
-
-/**
- * PLL register block
- */
-typedef struct {
-	__I  uint32_t  PLL_STAT;				/*!< PLL status register */
-	__IO uint32_t  PLL_CTRL;				/*!< PLL control register */
-	__IO uint32_t  PLL_MDIV;				/*!< PLL M-divider register */
-	__IO uint32_t  PLL_NP_DIV;				/*!< PLL N/P-divider register */
-} CGU_PLL_REG_T;
-
-typedef struct {							/*!< (@ 0x40050000) CGU Structure          */
-	__I  uint32_t  RESERVED0[5];
-	__IO uint32_t  FREQ_MON;				/*!< (@ 0x40050014) Frequency monitor register */
-	__IO uint32_t  XTAL_OSC_CTRL;			/*!< (@ 0x40050018) Crystal oscillator control register */
-	CGU_PLL_REG_T  PLL[CGU_AUDIO_PLL + 1];	/*!< (@ 0x4005001C) USB and audio PLL blocks */
-	__IO uint32_t  PLL0AUDIO_FRAC;			/*!< (@ 0x4005003C) PLL0 (audio)           */
-	__I  uint32_t  PLL1_STAT;				/*!< (@ 0x40050040) PLL1 status register   */
-	__IO uint32_t  PLL1_CTRL;				/*!< (@ 0x40050044) PLL1 control register  */
-	__IO uint32_t  IDIV_CTRL[CLK_IDIV_LAST];/*!< (@ 0x40050048) Integer divider A-E control registers */
-	__IO uint32_t  BASE_CLK[CLK_BASE_LAST];	/*!< (@ 0x4005005C) Start of base clock registers */
-} LPC_CGU_T;
-
-/**
- * @brief CCU clock config/status register pair
- */
-typedef struct {
-	__IO uint32_t  CFG;						/*!< CCU clock configuration register */
-	__I  uint32_t  STAT;					/*!< CCU clock status register */
-} CCU_CFGSTAT_T;
-
-/**
- * @brief CCU1 register block structure
- */
-typedef struct {							/*!< (@ 0x40051000) CCU1 Structure         */
-	__IO uint32_t  PM;						/*!< (@ 0x40051000) CCU1 power mode register */
-	__I  uint32_t  BASE_STAT;				/*!< (@ 0x40051004) CCU1 base clocks status register */
-	__I  uint32_t  RESERVED0[62];
-	CCU_CFGSTAT_T  CLKCCU[CLK_CCU1_LAST];	/*!< (@ 0x40051100) Start of CCU1 clock registers */
-} LPC_CCU1_T;
-
-/**
- * @brief CCU2 register block structure
- */
-typedef struct {							/*!< (@ 0x40052000) CCU2 Structure         */
-	__IO uint32_t  PM;						/*!< (@ 0x40052000) Power mode register    */
-	__I  uint32_t  BASE_STAT;				/*!< (@ 0x40052004) CCU base clocks status register */
-	__I  uint32_t  RESERVED0[62];
-	CCU_CFGSTAT_T  CLKCCU[CLK_CCU2_LAST - CLK_CCU1_LAST];	/*!< (@ 0x40052100) Start of CCU2 clock registers */
-} LPC_CCU2_T;
-
-/**
- * @brief RGU register structure
- */
-#define LPC_RGU_BASE              0x40053000
-
-typedef enum CHIP_RGU_RST {
-	RGU_CORE_RST,
-	RGU_PERIPH_RST,
-	RGU_MASTER_RST,
-	RGU_WWDT_RST = 4,
-	RGU_CREG_RST,
-	RGU_BUS_RST = 8,
-	RGU_SCU_RST,
-	RGU_M3_RST = 13,
-	RGU_LCD_RST = 16,
-	RGU_USB0_RST,
-	RGU_USB1_RST,
-	RGU_DMA_RST,
-	RGU_SDIO_RST,
-	RGU_EMC_RST,
-	RGU_ETHERNET_RST,
-	RGU_FLASHA_RST = 25,
-	RGU_EEPROM_RST = 27,
-	RGU_GPIO_RST,
-	RGU_FLASHB_RST,
-	RGU_TIMER0_RST = 32,
-	RGU_TIMER1_RST,
-	RGU_TIMER2_RST,
-	RGU_TIMER3_RST,
-	RGU_RITIMER_RST,
-	RGU_SCT_RST,
-	RGU_MOTOCONPWM_RST,
-	RGU_QEI_RST,
-	RGU_ADC0_RST,
-	RGU_ADC1_RST,
-	RGU_DAC_RST,
-	RGU_UART0_RST = 44,
-	RGU_UART1_RST,
-	RGU_UART2_RST,
-	RGU_UART3_RST,
-	RGU_I2C0_RST,
-	RGU_I2C1_RST,
-	RGU_SSP0_RST,
-	RGU_SSP1_RST,
-	RGU_I2S_RST,
-	RGU_SPIFI_RST,
-	RGU_CAN1_RST,
-	RGU_CAN0_RST,
-#ifdef CHIP_LPC43XX
-	RGU_M0APP_RST,
-	RGU_SGPIO_RST,
-	RGU_SPI_RST,
-#endif
-	RGU_LAST_RST = 63,
-} CHIP_RGU_RST_T;
-
-typedef struct {							/*!< RGU Structure          */
-	__I  uint32_t  RESERVED0[64];
-	__O  uint32_t  RESET_CTRL0;				/*!< Reset control register 0 */
-	__O  uint32_t  RESET_CTRL1;				/*!< Reset control register 1 */
-	__I  uint32_t  RESERVED1[2];
-	__IO uint32_t  RESET_STATUS0;			/*!< Reset status register 0 */
-	__IO uint32_t  RESET_STATUS1;			/*!< Reset status register 1 */
-	__IO uint32_t  RESET_STATUS2;			/*!< Reset status register 2 */
-	__IO uint32_t  RESET_STATUS3;			/*!< Reset status register 3 */
-	__I  uint32_t  RESERVED2[12];
-	__I  uint32_t  RESET_ACTIVE_STATUS0;	/*!< Reset active status register 0 */
-	__I  uint32_t  RESET_ACTIVE_STATUS1;	/*!< Reset active status register 1 */
-	__I  uint32_t  RESERVED3[170];
-	__IO uint32_t  RESET_EXT_STAT[RGU_LAST_RST + 1];/*!< Reset external status registers */
-} LPC_RGU_T;
-
-/**
- * @brief Windowed Watchdog register block structure
- */
-#define LPC_WWDT_BASE             0x40080000
-
-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. */
-#ifdef WATCHDOG_CLKSEL_SUPPORT
-	__IO uint32_t CLKSEL;		/*!< Watchdog clock select register. */
-#else
-	__I  uint32_t  RESERVED0;
-#endif
-#ifdef WATCHDOG_WINDOW_SUPPORT
-	__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. */
-#endif
-} LPC_WWDT_T;
-
-/**
- * @brief USART register block structure
- */
-#define LPC_USART0_BASE           0x40081000
-#define LPC_UART1_BASE            0x40082000
-#define LPC_USART2_BASE           0x400C1000
-#define LPC_USART3_BASE           0x400C2000
-
-typedef struct {							/*!< USARTn Structure       */
-
-	union {
-		__IO uint32_t  DLL;					/*!< Divisor Latch LSB. Least significant byte of the baud rate divisor value. The full divisor is used to generate a baud rate from the fractional rate divider (DLAB = 1). */
-		__O  uint32_t  THR;					/*!< Transmit Holding Register. The next character to be transmitted is written here (DLAB = 0). */
-		__I  uint32_t  RBR;					/*!< Receiver Buffer Register. Contains the next received character to be read (DLAB = 0). */
-	};
-
-	union {
-		__IO uint32_t IER;					/*!< Interrupt Enable Register. Contains individual interrupt enable bits for the 7 potential UART interrupts (DLAB = 0). */
-		__IO uint32_t DLM;					/*!< Divisor Latch MSB. Most significant byte of the baud rate divisor value. The full divisor is used to generate a baud rate from the fractional rate divider (DLAB = 1). */
-	};
-
-	union {
-		__O  uint32_t FCR;					/*!< FIFO Control Register. Controls UART FIFO usage and modes. */
-		__I  uint32_t IIR;					/*!< Interrupt ID Register. Identifies which interrupt(s) are pending. */
-	};
-
-	__IO uint32_t LCR;						/*!< Line Control Register. Contains controls for frame formatting and break generation. */
-	__IO uint32_t MCR;						/*!< Modem Control Register. Only present on USART ports with full modem support. */
-	__I  uint32_t LSR;						/*!< Line Status Register. Contains flags for transmit and receive status, including line errors. */
-	__I  uint32_t MSR;						/*!< Modem Status Register. Only present on USART ports with full modem support. */
-	__IO uint32_t SCR;						/*!< Scratch Pad Register. Eight-bit temporary storage for software. */
-	__IO uint32_t ACR;						/*!< Auto-baud Control Register. Contains controls for the auto-baud feature. */
-	__IO uint32_t ICR;						/*!< IrDA control register (not all UARTS) */
-	__IO uint32_t FDR;						/*!< Fractional Divider Register. Generates a clock input for the baud rate divider. */
-	__IO uint32_t OSR;						/*!< Oversampling Register. Controls the degree of oversampling during each bit time. Only on some UARTS. */
-	__IO uint32_t TER1;						/*!< Transmit Enable Register. Turns off USART transmitter for use with software flow control. */
-	uint32_t  RESERVED0[3];
-	__IO uint32_t HDEN;						/*!< Half-duplex enable Register- only on some UARTs */
-	__I  uint32_t RESERVED1[1];
-	__IO uint32_t SCICTRL;					/*!< Smart card interface control register- only on some UARTs */
-	__IO uint32_t RS485CTRL;				/*!< RS-485/EIA-485 Control. Contains controls to configure various aspects of RS-485/EIA-485 modes. */
-	__IO uint32_t RS485ADRMATCH;			/*!< RS-485/EIA-485 address match. Contains the address match value for RS-485/EIA-485 mode. */
-	__IO uint32_t RS485DLY;					/*!< RS-485/EIA-485 direction control delay. */
-	union {
-		__IO uint32_t SYNCCTRL;				/*!< Synchronous mode control register. Only on USARTs. */
-		__I  uint32_t FIFOLVL;				/*!< FIFO Level register. Provides the current fill levels of the transmit and receive FIFOs. */
-	};
-
-	__IO uint32_t TER2;						/*!< Transmit Enable Register. Only on LPC177X_8X UART4 and LPC18XX/43XX USART0/2/3. */
-} LPC_USART_T;
-
-/**
- * @brief SSP register block structure
- */
-#define LPC_SSP0_BASE             0x40083000
-#define LPC_SSP1_BASE             0x400C5000
-
-typedef struct {			/*!< SSPn Structure         */
-	__IO uint32_t CR0;		/*!< Control Register 0. Selects the serial clock rate, bus type, and data size. */
-	__IO uint32_t CR1;		/*!< Control Register 1. Selects master/slave and other modes. */
-	__IO uint32_t DR;		/*!< Data Register. Writes fill the transmit FIFO, and reads empty the receive FIFO. */
-	__I  uint32_t SR;		/*!< Status Register        */
-	__IO uint32_t CPSR;		/*!< Clock Prescale Register */
-	__IO uint32_t IMSC;		/*!< Interrupt Mask Set and Clear Register */
-	__I  uint32_t RIS;		/*!< Raw Interrupt Status Register */
-	__I  uint32_t MIS;		/*!< Masked Interrupt Status Register */
-	__O  uint32_t ICR;		/*!< SSPICR Interrupt Clear Register */
-	__IO uint32_t DMACR;	/*!< SSPn DMA control register */
-} LPC_SSP_T;
-
-/**
- * @brief 32-bit Standard timer register block structure
- */
-typedef struct {					/*!< TIMERn Structure       */
-	__IO uint32_t IR;				/*!< Interrupt Register. The IR can be written to clear interrupts. The IR can be read to identify which of eight possible interrupt sources are pending. */
-	__IO uint32_t TCR;				/*!< Timer Control Register. The TCR is used to control the Timer Counter functions. The Timer Counter can be disabled or reset through the TCR. */
-	__IO uint32_t TC;				/*!< Timer Counter. The 32 bit TC is incremented every PR+1 cycles of PCLK. The TC is controlled through the TCR. */
-	__IO uint32_t PR;				/*!< Prescale Register. The Prescale Counter (below) is equal to this value, the next clock increments the TC and clears the PC. */
-	__IO uint32_t PC;				/*!< Prescale Counter. The 32 bit PC is a counter which is incremented to the value stored in PR. When the value in PR is reached, the TC is incremented and the PC is cleared. The PC is observable and controllable through the bus interface. */
-	__IO uint32_t MCR;				/*!< Match Control Register. The MCR is used to control if an interrupt is generated and if the TC is reset when a Match occurs. */
-	__IO uint32_t MR[4];			/*!< Match Register. MR can be enabled through the MCR to reset the TC, stop both the TC and PC, and/or generate an interrupt every time MR matches the TC. */
-	__IO uint32_t CCR;				/*!< Capture Control Register. The CCR controls which edges of the capture inputs are used to load the Capture Registers and whether or not an interrupt is generated when a capture takes place. */
-	__IO uint32_t CR[4];			/*!< Capture Register. CR is loaded with the value of TC when there is an event on the CAPn.0 input. */
-	__IO uint32_t EMR;				/*!< External Match Register. The EMR controls the external match pins MATn.0-3 (MAT0.0-3 and MAT1.0-3 respectively). */
-	__I  uint32_t RESERVED0[12];
-	__IO uint32_t CTCR;				/*!< Count Control Register. The CTCR selects between Timer and Counter mode, and in Counter mode selects the signal and edge(s) for counting. */
-} LPC_TIMER_T;
-
-#define LPC_TIMER0_BASE           0x40084000
-#define LPC_TIMER1_BASE           0x40085000
-#define LPC_TIMER2_BASE           0x400C3000
-#define LPC_TIMER3_BASE           0x400C4000
-
-/**
- * @brief System Control Unit register block
- */
-#define LPC_SCU_BASE              0x40086000
-
-typedef struct {
-	__IO uint32_t  SFSP[16][32];
-	__I  uint32_t  RESERVED0[256];
-	__IO uint32_t  SFSCLK[4];			/*!< Pin configuration register for pins CLK0-3 */
-	__I  uint32_t  RESERVED16[28];
-	__IO uint32_t  SFSUSB;				/*!< Pin configuration register for USB */
-	__IO uint32_t  SFSI2C0;				/*!< Pin configuration register for I2C0-bus pins */
-	__IO uint32_t  ENAIO[3];			/*!< Analog function select registers */
-	__I  uint32_t  RESERVED17[27];
-	__IO uint32_t  EMCDELAYCLK;			/*!< EMC clock delay register */
-	__I  uint32_t  RESERVED18[63];
-	__IO uint32_t  PINTSEL0;			/*!< Pin interrupt select register for pin interrupts 0 to 3. */
-	__IO uint32_t  PINTSEL1;			/*!< Pin interrupt select register for pin interrupts 4 to 7. */
-} LPC_SCU_T;
-
-/**
- * SCU function and mode selection definitions
- * See the User Manual for specific modes and functions supoprted by the
- * various LPC18xx/43xx devices. Functionality can vary per device.
- */
-#define SCU_MODE_MODE_INACT        (0x0 << 3)		/*!< Disable pull-down and pull-up resistor at resistor at pad */
-#define SCU_MODE_MODE_PULLDOWN     (0x1 << 3)		/*!< Enable pull-down resistor at pad */
-#define SCU_MODE_MODE_PULLUP_DIS   (0x2 << 3)		/*!< Disable pull-up resistor at pad */
-#define SCU_MODE_MODE_REPEATER     (0x3 << 3)		/*!< Enable pull-down and pull-up resistor at resistor at pad (repeater mode) */
-#define SCU_MODE_HIGHSPEEDSLEW_EN  (0x1 << 5)		/*!< Enable high-speed slew */
-#define SCU_MODE_INBUFF_EN         (0x1 << 6)		/*!< Enable Input buffer */
-#define SCU_MODE_ZIF_DIS           (0x1 << 7)		/*!< Disable input glitch filter */
-#define SCU_MODE_4MA_DRIVESTR      (0x0 << 8)		/*!< Normal drive: 4mA drive strength */
-#define SCU_MODE_8MA_DRIVESTR      (0x1 << 8)		/*!< Medium drive: 8mA drive strength */
-#define SCU_MODE_14MA_DRIVESTR     (0x2 << 8)		/*!< High drive: 14mA drive strength */
-#define SCU_MODE_20MA_DRIVESTR     (0x3 << 8)		/*!< Ultra high- drive: 20mA drive strength */
-
-/* Common SCU configurations */
-#define SCU_PINIO_FAST             (SCU_MODE_MODE_PULLUP_DIS | SCU_MODE_HIGHSPEEDSLEW_EN | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS)
-#define SCU_PINIO_PULLUP           (SCU_MODE_INBUFF_EN)
-#define SCU_PINIO_PULLDOWN         (SCU_MODE_MODE_PULLDOWN  | SCU_MODE_MODE_PULLUP_DIS | SCU_MODE_INBUFF_EN)
-#define SCU_PINIO_PULLNONE         (SCU_MODE_MODE_PULLUP_DIS | SCU_MODE_INBUFF_EN)
-
-/* Calculate SCU offset and register address from group and pin number */
-#define SCU_OFF(group, num)        ((0x80 * group) + (0x04 * num))
-#define SCU_REG(group, num)        ((__IO uint32_t *)(LPC_SCU_BASE + SCU_OFF(group, num)))
-
-/**
- * @brief GPIO pin interrupt register block structure
- */
-#define LPC_GPIO_PIN_INT_BASE     0x40087000
-
-typedef struct {				/*!< GPIO_PIN_INT Structure */
-	__IO uint32_t  ISEL;		/*!< Pin Interrupt Mode register */
-	__IO uint32_t  IENR;		/*!< Pin Interrupt Enable (Rising) register */
-	__O  uint32_t  SIENR;		/*!< Set Pin Interrupt Enable (Rising) register */
-	__O  uint32_t  CIENR;		/*!< Clear Pin Interrupt Enable (Rising) register */
-	__IO uint32_t  IENF;		/*!< Pin Interrupt Enable Falling Edge / Active Level register */
-	__O  uint32_t  SIENF;		/*!< Set Pin Interrupt Enable Falling Edge / Active Level register */
-	__O  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_GPIOPININT_T;
-
-typedef enum LPC_GPIOPININT_MODE {
-	GPIOPININT_RISING_EDGE = 0x01,
-	GPIOPININT_FALLING_EDGE = 0x02,
-	GPIOPININT_ACTIVE_HIGH_LEVEL = 0x04,
-	GPIOPININT_ACTIVE_LOW_LEVEL = 0x08
-} LPC_GPIOPININT_MODE_T;
-
-/**
- * @brief GPIO grouped interrupt register block structure
- */
-#define LPC_GPIO_GROUP_INT0_BASE  0x40088000
-#define LPC_GPIO_GROUP_INT1_BASE  0x40089000
-
-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 */
-} LPC_GPIOGROUPINT_T;
-
-/**
- * @brief Motor Control PWM register block structure
- */
-#define LPC_MCPWM_BASE            0x400A0000
-
-typedef struct {					/*!< MCPWM Structure        */
-	__I  uint32_t  CON;				/*!< PWM Control read address */
-	__O  uint32_t  CON_SET;			/*!< PWM Control set address */
-	__O  uint32_t  CON_CLR;			/*!< PWM Control clear address */
-	__I  uint32_t  CAPCON;			/*!< Capture Control read address */
-	__O  uint32_t  CAPCON_SET;		/*!< Capture Control set address */
-	__O  uint32_t  CAPCON_CLR;		/*!< Event Control clear address */
-	__IO uint32_t TC[3];			/*!< Timer Counter register */
-	__IO uint32_t LIM[3];			/*!< Limit register         */
-	__IO uint32_t MAT[3];			/*!< Match register         */
-	__IO uint32_t  DT;				/*!< Dead time register     */
-	__IO uint32_t  CCP;				/*!< Communication Pattern register */
-	__I  uint32_t CAP[3];			/*!< Capture register       */
-	__I  uint32_t  INTEN;			/*!< Interrupt Enable read address */
-	__O  uint32_t  INTEN_SET;		/*!< Interrupt Enable set address */
-	__O  uint32_t  INTEN_CLR;		/*!< Interrupt Enable clear address */
-	__I  uint32_t  CNTCON;			/*!< Count Control read address */
-	__O  uint32_t  CNTCON_SET;		/*!< Count Control set address */
-	__O  uint32_t  CNTCON_CLR;		/*!< Count Control clear address */
-	__I  uint32_t  INTF;			/*!< Interrupt flags read address */
-	__O  uint32_t  INTF_SET;		/*!< Interrupt flags set address */
-	__O  uint32_t  INTF_CLR;		/*!< Interrupt flags clear address */
-	__O  uint32_t  CAP_CLR;			/*!< Capture clear address  */
-} LPC_MCPWM_T;
-
-/**
- * @brief I2C register block structure
- */
-#define LPC_I2C0_BASE             0x400A1000
-#define LPC_I2C1_BASE             0x400E0000
-
-typedef struct {				/* I2C0 Structure         */
-	__IO uint32_t CONSET;		/*!< I2C Control Set Register. When a one is written to a bit of this register, the corresponding bit in the I2C control register is set. Writing a zero has no effect on the corresponding bit in the I2C control register. */
-	__I  uint32_t STAT;			/*!< I2C Status Register. During I2C operation, this register provides detailed status codes that allow software to determine the next action needed. */
-	__IO uint32_t DAT;			/*!< I2C Data Register. During master or slave transmit mode, data to be transmitted is written to this register. During master or slave receive mode, data that has been received may be read from this register. */
-	__IO uint32_t ADR0;			/*!< I2C Slave Address Register 0. Contains the 7-bit slave address for operation of the I2C interface in slave mode, and is not used in master mode. The least significant bit determines whether a slave responds to the General Call address. */
-	__IO uint32_t SCLH;			/*!< SCH Duty Cycle Register High Half Word. Determines the high time of the I2C clock. */
-	__IO uint32_t SCLL;			/*!< SCL Duty Cycle Register Low Half Word. Determines the low time of the I2C clock. SCLL and SCLH together determine the clock frequency generated by an I2C master and certain times used in slave mode. */
-	__O  uint32_t CONCLR;		/*!< I2C Control Clear Register. When a one is written to a bit of this register, the corresponding bit in the I2C control register is cleared. Writing a zero has no effect on the corresponding bit in the I2C control register. */
-	__IO uint32_t MMCTRL;		/*!< Monitor mode control register. */
-	__IO uint32_t ADR1;			/*!< I2C Slave Address Register. Contains the 7-bit slave address for operation of the I2C interface in slave mode, and is not used in master mode. The least significant bit determines whether a slave responds to the General Call address. */
-	__IO uint32_t ADR2;			/*!< I2C Slave Address Register. Contains the 7-bit slave address for operation of the I2C interface in slave mode, and is not used in master mode. The least significant bit determines whether a slave responds to the General Call address. */
-	__IO uint32_t ADR3;			/*!< I2C Slave Address Register. Contains the 7-bit slave address for operation of the I2C interface in slave mode, and is not used in master mode. The least significant bit determines whether a slave responds to the General Call address. */
-	__I  uint32_t DATA_BUFFER;	/*!< Data buffer register. The contents of the 8 MSBs of the DAT shift register will be transferred to the DATA_BUFFER automatically after every nine bits (8 bits of data plus ACK or NACK) has been received on the bus. */
-	__IO uint32_t MASK[4];		/*!< I2C Slave address mask register */
-} LPC_I2C_T;
-
-/**
- * @brief I2S register block structure
- */
-#define LPC_I2S0_BASE             0x400A2000
-#define LPC_I2S1_BASE             0x400A3000
-
-typedef struct {				/*!< I2S Structure */
-	__IO uint32_t DAO;			/*!< I2S Digital Audio Output Register. Contains control bits for the I2S transmit channel */
-	__IO uint32_t DAI;			/*!< I2S Digital Audio Input Register. Contains control bits for the I2S receive channel */
-	__O uint32_t TXFIFO;		/*!< I2S Transmit FIFO. Access register for the 8 x 32-bit transmitter FIFO */
-	__I uint32_t RXFIFO;		/*!< I2S Receive FIFO. Access register for the 8 x 32-bit receiver FIFO */
-	__I uint32_t STATE;			/*!< I2S Status Feedback Register. Contains status information about the I2S interface */
-	__IO uint32_t DMA1;			/*!< I2S DMA Configuration Register 1. Contains control information for DMA request 1 */
-	__IO uint32_t DMA2;			/*!< I2S DMA Configuration Register 2. Contains control information for DMA request 2 */
-	__IO uint32_t IRQ;			/*!< I2S Interrupt Request Control Register. Contains bits that control how the I2S interrupt request is generated */
-	__IO uint32_t TXRATE;		/*!< I2S Transmit MCLK divider. This register determines the I2S TX MCLK rate by specifying the value to divide PCLK by in order to produce MCLK */
-	__IO uint32_t RXRATE;		/*!< I2S Receive MCLK divider. This register determines the I2S RX MCLK rate by specifying the value to divide PCLK by in order to produce MCLK */
-	__IO uint32_t TXBITRATE;	/*!< I2S Transmit bit rate divider. This register determines the I2S transmit bit rate by specifying the value to divide TX_MCLK by in order to produce the transmit bit clock */
-	__IO uint32_t RXBITRATE;	/*!< I2S Receive bit rate divider. This register determines the I2S receive bit rate by specifying the value to divide RX_MCLK by in order to produce the receive bit clock */
-	__IO uint32_t TXMODE;		/*!< I2S Transmit mode control */
-	__IO uint32_t RXMODE;		/*!< I2S Receive mode control */
-} LPC_I2S_T;
-
-/**
- * @brief CCAN Controller Area Network register block structure
- */
-#define LPC_C_CAN1_BASE           0x400A4000
-#define LPC_C_CAN0_BASE           0x400E2000
-
-typedef struct {	/*!< C_CAN message interface Structure       */
-	__IO uint32_t IF_CMDREQ;			/*!< Message interface command request  */
-	union {
-		__IO uint32_t IF_CMDMSK_R;		/*!< Message interface command mask (read direction) */
-		__IO uint32_t IF_CMDMSK_W;		/*!< Message interface command mask (write direction) */
-	};
-
-	__IO uint32_t IF_MSK1;				/*!< Message interface mask 1 */
-	__IO uint32_t IF_MSK2;				/*!< Message interface mask 2 */
-	__IO uint32_t IF_ARB1;				/*!< Message interface arbitration 1 */
-	__IO uint32_t IF_ARB2;				/*!< Message interface arbitration 2 */
-	__IO uint32_t IF_MCTRL;			/*!< Message interface message control */
-	__IO uint32_t IF_DA1;				/*!< Message interface data A1 */
-	__IO uint32_t IF_DA2;				/*!< Message interface data A2 */
-	__IO uint32_t IF_DB1;				/*!< Message interface data B1 */
-	__IO uint32_t IF_DB2;				/*!< Message interface data B2 */
-	__I  uint32_t  RESERVED[13];
-} LPC_CCAN_IF_T;
-
-typedef struct {						/*!< C_CAN Structure       */
-	__IO uint32_t CNTL;					/*!< CAN control            */
-	__IO uint32_t STAT;					/*!< Status register        */
-	__I  uint32_t EC;					/*!< Error counter          */
-	__IO uint32_t BT;					/*!< Bit timing register    */
-	__I  uint32_t INT;					/*!< Interrupt register     */
-	__IO uint32_t TEST;					/*!< Test register          */
-	__IO uint32_t BRPE;					/*!< Baud rate prescaler extension register */
-	__I  uint32_t  RESERVED0;
-	LPC_CCAN_IF_T IF[2];
-	__I  uint32_t  RESERVED2[8];
-	__I  uint32_t TXREQ1;				/*!< Transmission request 1 */
-	__I  uint32_t TXREQ2;				/*!< Transmission request 2 */
-	__I  uint32_t  RESERVED3[6];
-	__I  uint32_t ND1;					/*!< New data 1             */
-	__I  uint32_t ND2;					/*!< New data 2             */
-	__I  uint32_t  RESERVED4[6];
-	__I  uint32_t IR1;					/*!< Interrupt pending 1    */
-	__I  uint32_t IR2;					/*!< Interrupt pending 2    */
-	__I  uint32_t  RESERVED5[6];
-	__I  uint32_t MSGV1;				/*!< Message valid 1        */
-	__I  uint32_t MSGV2;				/*!< Message valid 2        */
-	__I  uint32_t  RESERVED6[6];
-	__IO uint32_t CLKDIV;				/*!< CAN clock divider register */
-} LPC_CCAN_T;
-
-/**
- * @brief Repetitive Interrupt Timer register block structure
- */
-#define LPC_RITIMER_BASE          0x400C0000
-
-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         */
-#if defined(CHIP_LPC1347)
-	__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 */
-#endif
-} LPC_RITIMER_T;
-
-/**
- * @brief Quadrature Encoder Interface register block structure
- */
-#define LPC_QEI_BASE              0x400C6000
-
-typedef struct {				/*!< QEI Structure          */
-	__O  uint32_t  CON;			/*!< Control register       */
-	__I  uint32_t  STAT;		/*!< Encoder status register */
-	__IO uint32_t  CONF;		/*!< Configuration register */
-	__I  uint32_t  POS;			/*!< Position register      */
-	__IO uint32_t  MAXPOS;		/*!< Maximum position register */
-	__IO uint32_t  CMPOS0;		/*!< position compare register 0 */
-	__IO uint32_t  CMPOS1;		/*!< position compare register 1 */
-	__IO uint32_t  CMPOS2;		/*!< position compare register 2 */
-	__I  uint32_t  INXCNT;		/*!< Index count register   */
-	__IO uint32_t  INXCMP0;		/*!< Index compare register 0 */
-	__IO uint32_t  LOAD;		/*!< Velocity timer reload register */
-	__I  uint32_t  TIME;		/*!< Velocity timer register */
-	__I  uint32_t  VEL;			/*!< Velocity counter register */
-	__I  uint32_t  CAP;			/*!< Velocity capture register */
-	__IO uint32_t  VELCOMP;		/*!< Velocity compare register */
-	__IO uint32_t  FILTERPHA;	/*!< Digital filter register on input phase A (QEI_A) */
-	__IO uint32_t  FILTERPHB;	/*!< Digital filter register on input phase B (QEI_B) */
-	__IO uint32_t  FILTERINX;	/*!< Digital filter register on input index (QEI_IDX) */
-	__IO uint32_t  WINDOW;		/*!< Index acceptance window register */
-	__IO uint32_t  INXCMP1;		/*!< Index compare register 1 */
-	__IO uint32_t  INXCMP2;		/*!< Index compare register 2 */
-	__I  uint32_t  RESERVED0[993];
-	__O  uint32_t  IEC;			/*!< Interrupt enable clear register */
-	__O  uint32_t  IES;			/*!< Interrupt enable set register */
-	__I  uint32_t  INTSTAT;		/*!< Interrupt status register */
-	__I  uint32_t  IE;			/*!< Interrupt enable register */
-	__O  uint32_t  CLR;			/*!< Interrupt status clear register */
-	__O  uint32_t  SET;			/*!< Interrupt status set register */
-} LPC_QEI_T;
-
-/**
- * @brief Global Input Multiplexer Array (GIMA) register block structure
- */
-#define LPC_GIMA_BASE             0x400C7000
-
-typedef struct {						/*!< GIMA Structure */
-	__IO uint32_t  CAP0_IN[4][4];		/*!< Timer x CAP0_y capture input multiplexer (GIMA output ((x*4)+y)) */
-	__IO uint32_t  CTIN_IN[8];			/*!< SCT CTIN_x capture input multiplexer (GIMA output (16+x)) */
-	__IO uint32_t  VADC_TRIGGER_IN;		/*!< VADC trigger input multiplexer (GIMA output 24) */
-	__IO uint32_t  EVENTROUTER_13_IN;	/*!< Event router input 13 multiplexer (GIMA output 25) */
-	__IO uint32_t  EVENTROUTER_14_IN;	/*!< Event router input 14 multiplexer (GIMA output 26) */
-	__IO uint32_t  EVENTROUTER_16_IN;	/*!< Event router input 16 multiplexer (GIMA output 27) */
-	__IO uint32_t  ADCSTART0_IN;		/*!< ADC start0 input multiplexer (GIMA output 28) */
-	__IO uint32_t  ADCSTART1_IN;		/*!< ADC start1 input multiplexer (GIMA output 29) */
-} LPC_GIMA_T;
-
-/**
- * @brief DAC register block structure
- */
-#define LPC_DAC_BASE              0x400E1000
-
-typedef struct {			/*!< DAC Structure          */
-	__IO uint32_t  CR;		/*!< 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 the selected settling time after this field is written with a
- * new VALUE, the voltage on the AOUT pin (with respect to VSSA)
- * is VALUE/1024 ? VREF
- */
-#define DAC_RANGE           0x3FF
-#define DAC_VALUE(n)        ((uint32_t) ((n & DAC_RANGE) << 6))
-/* If this bit = 0: The settling time of the DAC is 1 microsecond max,
- * and the maximum current is 700 microAmpere
- * If this bit = 1: The settling time of the DAC is 2.5 microsecond
- * and the maximum current is 350 microAmpere
- */
-#define DAC_BIAS_EN         ((uint32_t) (1 << 16))
-/* Value to reload interrupt DMA counter */
-#define DAC_CCNT_VALUE(n)   ((uint32_t) (n & 0xffff))
-
-#define DAC_DBLBUF_ENA      ((uint32_t) (1 << 1))
-#define DAC_CNT_ENA         ((uint32_t) (1 << 2))
-#define DAC_DMA_ENA         ((uint32_t) (1 << 3))
-#define DAC_DACCTRL_MASK    ((uint32_t) (0x0F))
-
-/* Current option in DAC configuration option */
-typedef enum IP_DAC_CURRENT_OPT {
-	DAC_MAX_UPDATE_RATE_1MHz = 0,	/*!< Shorter settling times and higher power consumption;
-									    allows for a maximum update rate of 1 MHz */
-	DAC_MAX_UPDATE_RATE_400kHz		/*!< Longer settling times and lower power consumption;
-									    allows for a maximum update rate of 400 kHz */
-} IP_DAC_CURRENT_OPT_T;
-
-/**
- * @brief  ADC register block structure
- */
-#define LPC_ADC0_BASE             0x400E3000
-#define LPC_ADC1_BASE             0x400E4000
-#define ADC_ACC_10BITS
-
-/**
- * @brief 10 or 12-bit ADC register block structure
- */
-typedef struct {					/*!< ADCn Structure */
-	__IO uint32_t CR;				/*!< A/D Control Register. The AD0CR register must be written to select the operating mode before A/D conversion can occur. */
-	__I  uint32_t GDR;				/*!< A/D Global Data Register. Contains the result of the most recent A/D conversion. */
-	__I  uint32_t RESERVED0;
-	__IO uint32_t INTEN;			/*!< A/D Interrupt Enable Register. This register contains enable bits that allow the DONE flag of each A/D channel to be included or excluded from contributing to the generation of an A/D interrupt. */
-	__I  uint32_t DR[8];			/*!< A/D Channel Data Register. This register contains the result of the most recent conversion completed on channel n. */
-	__I  uint32_t STAT;				/*!< A/D Status Register. This register contains DONE and OVERRUN flags for all of the A/D channels, as well as the A/D interrupt flag. */
-} LPC_ADC_T;
-
-/* ADC register support bitfields and mask */
-#define ADC_RANGE               0x3FF
-#define ADC_DR_RESULT(n)        ((((n) >> 6) & 0x3FF))	/*!< Mask for getting the 10 bits ADC data read value */
-#define ADC_CR_BITACC(n)        ((((n) & 0x7) << 17))	/*!< Number of ADC accuracy bits */
-#define ADC_DR_DONE(n)          (((n) >> 31))			/*!< Mask for reading the ADC done status */
-#define ADC_DR_OVERRUN(n)       ((((n) >> 30) & (1UL)))	/*!< Mask for reading the ADC overrun status */
-#define ADC_CR_CH_SEL(n)        ((1UL << (n)))			/*!< Selects which of the AD0.0:7 pins is (are) to be sampled and converted */
-#define ADC_CR_CLKDIV(n)        ((((n) & 0xFF) << 8))	/*!< The APB clock (PCLK) is divided by (this value plus one) to produce the clock for the A/D */
-#define ADC_CR_BURST            ((1UL << 16))			/*!< Repeated conversions A/D enable bit */
-#define ADC_CR_PDN              ((1UL << 21))			/*!< ADC convert is operational */
-#define ADC_CR_START_MASK       ((7UL << 24))			/*!< ADC start mask bits */
-#define ADC_CR_START_MODE_SEL(SEL)  ((SEL << 24))		/*!< Select Start Mode */
-#define ADC_CR_START_NOW        ((1UL << 24))			/*!< Start conversion now */
-#define ADC_CR_START_CTOUT15    ((2UL << 24))			/*!< Start conversion when the edge selected by bit 27 occurs on CTOUT_15 */
-#define ADC_CR_START_CTOUT8     ((3UL << 24))			/*!< Start conversion when the edge selected by bit 27 occurs on CTOUT_8 */
-#define ADC_CR_START_ADCTRIG0   ((4UL << 24))			/*!< Start conversion when the edge selected by bit 27 occurs on ADCTRIG0 */
-#define ADC_CR_START_ADCTRIG1   ((5UL << 24))			/*!< Start conversion when the edge selected by bit 27 occurs on ADCTRIG1 */
-#define ADC_CR_START_MCOA2      ((6UL << 24))			/*!< Start conversion when the edge selected by bit 27 occurs on Motocon PWM output MCOA2 */
-#define ADC_CR_EDGE             ((1UL << 27))			/*!< Start conversion on a falling edge on the selected CAP/MAT signal */
-#define ADC_CONFIG_MASK         (ADC_CR_CLKDIV(0xFF) | ADC_CR_BITACC(0x07) | ADC_CR_PDN)
-
-/*	ADC status register used for IP drivers */
-typedef enum IP_ADC_STATUS {
-	ADC_DR_DONE_STAT,	/*!< ADC data register staus */
-	ADC_DR_OVERRUN_STAT,/*!< ADC data overrun staus */
-	ADC_DR_ADINT_STAT	/*!< ADC interrupt status */
-} IP_ADC_STATUS_T;
-
-/**
- * @brief  GPIO port register block structure
- */
-#define LPC_GPIO_PORT_BASE        0x400F4000
-
-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;
-
-/* Calculate GPIO offset and port register address from group and pin number */
-#define GPIO_OFF(port, pin)        ((port << 5) + pin)
-#define GPIO_REG(port, pin)        ((__IO uint32_t *)(LPC_GPIO_PORT_BASE + 0x2000 + GPIO_OFF(port, pin)))
-
-/**
- * @brief SPI register block structure
- */
-#define LPC_SPI_BASE              0x40100000
-
-typedef struct {					/*!< SPI Structure          */
-	__IO uint32_t  CR;				/*!< SPI Control Register. This register controls the operation of the SPI. */
-	__I  uint32_t  SR;				/*!< SPI Status Register. This register shows the status of the SPI. */
-	__IO uint32_t  DR;				/*!< SPI Data Register. This bi-directional register provides the transmit and receive data for the SPI. Transmit data is provided to the SPI0 by writing to this register. Data received by the SPI0 can be read from this register. */
-	__IO uint32_t  CCR;				/*!< SPI Clock Counter Register. This register controls the frequency of a master's SCK0. */
-	__I  uint32_t  RESERVED0[3];
-	__IO uint32_t  INT;				/*!< SPI Interrupt Flag. This register contains the interrupt flag for the SPI interface. */
-} LPC_SPI_T;
-
-/* SPI CFG Register BitMask */
-#define SPI_CR_BITMASK       ((uint32_t) 0xFFC)
-/* Enable of controlling the number of bits per transfer  */
-#define SPI_CR_BIT_EN         ((uint32_t) (1 << 2))
-/* Mask of field of bit controlling */
-#define SPI_CR_BITS_MASK      ((uint32_t) 0xF00)
-/* Set the number of bits per a transfer */
-#define SPI_CR_BITS(n)        ((uint32_t) ((n << 8) & 0xF00))	/* n is in range 8-16 */
-/* SPI Clock Phase Select*/
-#define SPI_CR_CPHA_FIRST     ((uint32_t) (0))	/*Capture data on the first edge, Change data on the following edge*/
-#define SPI_CR_CPHA_SECOND    ((uint32_t) (1 << 3))	/*Change data on the first edge, Capture data on the following edge*/
-/* SPI Clock Polarity Select*/
-#define SPI_CR_CPOL_LO        ((uint32_t) (0))	/* The rest state of the clock (between frames) is low.*/
-#define SPI_CR_CPOL_HI        ((uint32_t) (1 << 4))	/* The rest state of the clock (between frames) is high.*/
-/* SPI Slave Mode Select */
-#define SPI_CR_SLAVE_EN       ((uint32_t) 0)
-/* SPI Master Mode Select */
-#define SPI_CR_MASTER_EN      ((uint32_t) (1 << 5))
-/* SPI MSB First mode enable */
-#define SPI_CR_MSB_FIRST_EN   ((uint32_t) 0)	/*Data will be transmitted and received in standard order (MSB first).*/
-/* SPI LSB First mode enable */
-#define SPI_CR_LSB_FIRST_EN   ((uint32_t) (1 << 6))	/*Data will be transmitted and received in reverse order (LSB first).*/
-/* SPI interrupt enable */
-#define SPI_CR_INT_EN         ((uint32_t) (1 << 7))
-/* SPI STAT Register BitMask */
-#define SPI_SR_BITMASK        ((uint32_t) 0xF8)
-/* Slave abort Flag */
-#define SPI_SR_ABRT           ((uint32_t) (1 << 3))	/* When 1, this bit indicates that a slave abort has occurred. */
-/* Mode fault Flag */
-#define SPI_SR_MODF           ((uint32_t) (1 << 4))	/* when 1, this bit indicates that a Mode fault error has occurred. */
-/* Read overrun flag*/
-#define SPI_SR_ROVR           ((uint32_t) (1 << 5))	/* When 1, this bit indicates that a read overrun has occurred. */
-/* Write collision flag. */
-#define SPI_SR_WCOL           ((uint32_t) (1 << 6))	/* When 1, this bit indicates that a write collision has occurred.. */
-/* SPI transfer complete flag. */
-#define SPI_SR_SPIF           ((uint32_t) (1 << 7))		/* When 1, this bit indicates when a SPI data transfer is complete.. */
-/**SPI error flag */
-#define SPI_SR_ERROR          (SPI_SR_ABRT | SPI_SR_MODF | SPI_SR_ROVR | SPI_SR_WCOL)
-/* Enable SPI Test Mode */
-#define SPI_TCR_TEST(n)       ((uint32_t) ((n & 0x3F) << 1))
-/* SPI interrupt flag */
-#define SPI_INT_SPIF          ((uint32_t) (1 << 0))
-/* Receiver Data  */
-#define SPI_DR_DATA(n)        ((uint32_t) ((n) & 0xFFFF))
-
-/* SPI Mode*/
-typedef enum LPC_SPI_MODE {
-	SPI_MODE_MASTER = SPI_CR_MASTER_EN,			/* Master Mode */
-	SPI_MODE_SLAVE = SPI_CR_SLAVE_EN,			/* Slave Mode */
-} LPC_SPI_MODE_T;
-
-/* SPI Clock Mode*/
-typedef enum LPC_SPI_CLOCK_MODE {
-	SPI_CLOCK_CPHA0_CPOL0 = SPI_CR_CPOL_LO | SPI_CR_CPHA_FIRST,		/**< CPHA = 0, CPOL = 0 */
-	SPI_CLOCK_CPHA0_CPOL1 = SPI_CR_CPOL_HI | SPI_CR_CPHA_FIRST,		/**< CPHA = 0, CPOL = 1 */
-	SPI_CLOCK_CPHA1_CPOL0 = SPI_CR_CPOL_LO | SPI_CR_CPHA_SECOND,	/**< CPHA = 1, CPOL = 0 */
-	SPI_CLOCK_CPHA1_CPOL1 = SPI_CR_CPOL_HI | SPI_CR_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 */
-} LPC_SPI_CLOCK_MODE_T;
-
-/* SPI Data Order Mode*/
-typedef enum LPC_SPI_DATA_ORDER {
-	SPI_DATA_MSB_FIRST = SPI_CR_MSB_FIRST_EN,			/* Standard Order */
-	SPI_DATA_LSB_FIRST = SPI_CR_LSB_FIRST_EN,			/* Reverse Order */
-} LPC_SPI_DATA_ORDER_T;
-
-/**
- * @brief Serial GPIO register block structure
- */
-#define LPC_SGPIO_BASE            0x40101000
-
-typedef struct {						/*!< SGPIO Structure        */
-	__IO uint32_t  OUT_MUX_CFG[16];		/*!< Pin multiplexer configurationregisters. */
-	__IO uint32_t  SGPIO_MUX_CFG[16];	/*!< SGPIO multiplexer configuration registers. */
-	__IO uint32_t  SLICE_MUX_CFG[16];	/*!< Slice multiplexer configuration registers. */
-	__IO uint32_t  REG[16];				/*!< Slice data registers. Eachtime COUNT0 reaches 0x0 the register shifts loading bit 31 withdata captured from DIN(n). DOUT(n) is set to REG(0) */
-	__IO uint32_t  REG_SS[16];			/*!< Slice data shadow registers. Each time POSreaches 0x0 the contents of REG_SS is exchanged with the contentof REG */
-	__IO uint32_t  PRESET[16];			/*!< Reload valueof COUNT0, loaded when COUNT0 reaches 0x0 */
-	__IO uint32_t  COUNT[16];			/*!< Down counter, counts down each clock cycle. */
-	__IO uint32_t  POS[16];				/*!< Each time COUNT0 reaches 0x0 */
-	__IO uint32_t  MASK_A;				/*!< Mask for pattern match function of slice A */
-	__IO uint32_t  MASK_H;				/*!< Mask for pattern match function of slice H */
-	__IO uint32_t  MASK_I;				/*!< Mask for pattern match function of slice I */
-	__IO uint32_t  MASK_P;				/*!< Mask for pattern match function of slice P */
-	__I  uint32_t  GPIO_INREG;			/*!< GPIO input status register */
-	__IO uint32_t  GPIO_OUTREG;			/*!< GPIO output control register */
-	__IO uint32_t  GPIO_OENREG;			/*!< GPIO OE control register */
-	__IO uint32_t  CTRL_ENABLED;		/*!< Enables the slice COUNT counter */
-	__IO uint32_t  CTRL_DISABLED;		/*!< Disables the slice COUNT counter */
-	__I  uint32_t  RESERVED0[823];
-	__O  uint32_t  CLR_EN_0;			/*!< Shift clock interrupt clear mask */
-	__O  uint32_t  SET_EN_0;			/*!< Shift clock interrupt set mask */
-	__I  uint32_t  ENABLE_0;			/*!< Shift clock interrupt enable */
-	__I  uint32_t  STATUS_0;			/*!< Shift clock interrupt status */
-	__O  uint32_t  CTR_STATUS_0;		/*!< Shift clock interrupt clear status */
-	__O  uint32_t  SET_STATUS_0;		/*!< Shift clock interrupt set status */
-	__I  uint32_t  RESERVED1[2];
-	__O  uint32_t  CLR_EN_1;			/*!< Capture clock interrupt clear mask */
-	__O  uint32_t  SET_EN_1;			/*!< Capture clock interrupt set mask */
-	__I  uint32_t  ENABLE_1;			/*!< Capture clock interrupt enable */
-	__I  uint32_t  STATUS_1;			/*!< Capture clock interrupt status */
-	__O  uint32_t  CTR_STATUS_1;		/*!< Capture clock interrupt clear status */
-	__O  uint32_t  SET_STATUS_1;		/*!< Capture clock interrupt set status */
-	__I  uint32_t  RESERVED2[2];
-	__O  uint32_t  CLR_EN_2;			/*!< Pattern match interrupt clear mask */
-	__O  uint32_t  SET_EN_2;			/*!< Pattern match interrupt set mask */
-	__I  uint32_t  ENABLE_2;			/*!< Pattern match interrupt enable */
-	__I  uint32_t  STATUS_2;			/*!< Pattern match interrupt status */
-	__O  uint32_t  CTR_STATUS_2;		/*!< Pattern match interrupt clear status */
-	__O  uint32_t  SET_STATUS_2;		/*!< Pattern match interrupt set status */
-	__I  uint32_t  RESERVED3[2];
-	__O  uint32_t  CLR_EN_3;			/*!< Input interrupt clear mask */
-	__O  uint32_t  SET_EN_3;			/*!< Input bit match interrupt set mask */
-	__I  uint32_t  ENABLE_3;			/*!< Input bit match interrupt enable */
-	__I  uint32_t  STATUS_3;			/*!< Input bit match interrupt status */
-	__O  uint32_t  CTR_STATUS_3;		/*!< Input bit match interrupt clear status */
-	__O  uint32_t  SET_STATUS_3;		/*!< Shift clock interrupt set status */
-} LPC_SGPIO_T;
-
-/* End of section using anonymous unions */
-#if defined(__ARMCC_VERSION)
-  #pragma pop
-#elif defined(__CWCC__)
-  #pragma pop
-#elif defined(__IAR_SYSTEMS_ICC__)
-  //#pragma pop // FIXME not usable for IAR
-#else /* defined(__GNUC__) and others */
-  /* Leave anonymous unions enabled */
-#endif
-
-/**
- * @brief  LPC43xx Peripheral register set declarations
- */
-#define LPC_SCT                   ((LPC_SCT_T               *) LPC_SCT_BASE)
-#define LPC_GPDMA                 ((LPC_GPDMA_T             *) LPC_GPDMA_BASE)
-#define LPC_SDMMC                 ((LPC_SDMMC_T             *) LPC_SDMMC_BASE)
-#define LPC_EMC                   ((LPC_EMC_T               *) LPC_EMC_BASE)
-#define LPC_USB0                  ((LPC_USBHS_T             *) LPC_USB0_BASE)
-#define LPC_USB1                  ((LPC_USBHS_T             *) LPC_USB1_BASE)
-#define LPC_LCD                   ((LPC_LCD_T               *) LPC_LCD_BASE)
-#define LPC_EEPROM                ((LPC_EEPROM_T            *) LPC_EEPROM_BASE)
-#define LPC_ETHERNET              ((LPC_ENET_T              *) LPC_ETHERNET_BASE)
-#define LPC_ATIMER                ((LPC_ATIMER_T            *) LPC_ATIMER_BASE)
-#define LPC_REGFILE               ((LPC_REGFILE_T           *) LPC_REGFILE_BASE)
-#define LPC_PMC                   ((LPC_PMC_T               *) LPC_PMC_BASE)
-#define LPC_CREG                  ((LPC_CREG_T              *) LPC_CREG_BASE)
-#define LPC_EVRT                  ((LPC_EVRT_T              *) LPC_EVRT_BASE)
-#define LPC_RTC                   ((LPC_RTC_T               *) LPC_RTC_BASE)
-#define LPC_CGU                   ((LPC_CGU_T               *) LPC_CGU_BASE)
-#define LPC_CCU1                  ((LPC_CCU1_T              *) LPC_CCU1_BASE)
-#define LPC_CCU2                  ((LPC_CCU2_T              *) LPC_CCU2_BASE)
-#define LPC_RGU                   ((LPC_RGU_T               *) LPC_RGU_BASE)
-#define LPC_WWDT                  ((LPC_WWDT_T              *) LPC_WWDT_BASE)
-#define LPC_USART0                ((LPC_USART_T             *) LPC_USART0_BASE)
-#define LPC_USART2                ((LPC_USART_T             *) LPC_USART2_BASE)
-#define LPC_USART3                ((LPC_USART_T             *) LPC_USART3_BASE)
-#define LPC_UART1                 ((LPC_USART_T             *) LPC_UART1_BASE)
-#define LPC_SSP0                  ((LPC_SSP_T               *) LPC_SSP0_BASE)
-#define LPC_SSP1                  ((LPC_SSP_T               *) LPC_SSP1_BASE)
-#define LPC_TIMER0                ((LPC_TIMER_T             *) LPC_TIMER0_BASE)
-#define LPC_TIMER1                ((LPC_TIMER_T             *) LPC_TIMER1_BASE)
-#define LPC_TIMER2                ((LPC_TIMER_T             *) LPC_TIMER2_BASE)
-#define LPC_TIMER3                ((LPC_TIMER_T             *) LPC_TIMER3_BASE)
-#define LPC_SCU                   ((LPC_SCU_T               *) LPC_SCU_BASE)
-#define LPC_GPIO_PIN_INT          ((LPC_GPIOPININT_T        *) LPC_GPIO_PIN_INT_BASE)
-#define LPC_GPIO_GROUP_INT0       ((IP_GPIOGROUPINT_T       *) LPC_GPIO_GROUP_INT0_BASE)
-#define LPC_GPIO_GROUP_INT1       ((IP_GPIOGROUPINT_T       *) LPC_GPIO_GROUP_INT1_BASE)
-#define LPC_MCPWM                 ((LPC_MCPWM_T             *) LPC_MCPWM_BASE)
-#define LPC_I2C0                  ((LPC_I2C_T               *) LPC_I2C0_BASE)
-#define LPC_I2C1                  ((LPC_I2C_T               *) LPC_I2C1_BASE)
-#define LPC_I2S0                  ((LPC_I2S_T               *) LPC_I2S0_BASE)
-#define LPC_I2S1                  ((LPC_I2S_T               *) LPC_I2S1_BASE)
-#define LPC_C_CAN1                ((LPC_CCAN_T              *) LPC_C_CAN1_BASE)
-#define LPC_RITIMER               ((LPC_RITIMER_T           *) LPC_RITIMER_BASE)
-#define LPC_QEI                   ((LPC_QEI_T               *) LPC_QEI_BASE)
-#define LPC_GIMA                  ((LPC_GIMA_T              *) LPC_GIMA_BASE)
-#define LPC_DAC                   ((LPC_DAC_T               *) LPC_DAC_BASE)
-#define LPC_C_CAN0                ((LPC_CCAN_T              *) LPC_C_CAN0_BASE)
-#define LPC_ADC0                  ((LPC_ADC_T               *) LPC_ADC0_BASE)
-#define LPC_ADC1                  ((LPC_ADC_T               *) LPC_ADC1_BASE)
-#define LPC_GPIO_PORT             ((LPC_GPIO_T              *) LPC_GPIO_PORT_BASE)
-#define LPC_SPI                   ((LPC_SPI_T               *) LPC_SPI_BASE)
-#define LPC_SGPIO                 ((LPC_SGPIO_T             *) LPC_SGPIO_BASE)
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LPC43XX_H */
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC43XX/TOOLCHAIN_ARM_STD/LPC43xx.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-
-LR_IROM1 0x14000000 0x00400000  {    ; load region size_region
-  ER_IROM1 0x14000000 0x00400000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  ; 8_byte_aligned(69 vect * 4 bytes) =  8_byte_aligned(0x0114) = 0x0118
-  ; 128KB - 0x0118 = 0x0001FEE8
-  RW_IRAM1 0x10000118 0x1FEE8  {
-   .ANY (+RW +ZI)
-  }
-  RW_IRAM2 0x10080000 0x12000 {  ; RW data
-   .ANY (IRAM2)
-  }
-  RW_IRAM3 0x20000000 0x8000  {  ; RW data
-   .ANY (AHBSRAM0)
-  }
-  RW_IRAM4 0x20008000 0x4000  {  ; RW data
-   .ANY (AHBSRAM1)
-  }
-  RW_IRAM5 0x2000C000 0x4000  {  ; RW data
-   .ANY (AHBSRAM2)
-  }
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC43XX/TOOLCHAIN_ARM_STD/startup_LPC43xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,291 +0,0 @@
-;/***********************************************************************
-; * @brief: LPC18xx/43xx M3/M4 startup code
-; *
-; * @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.
-; */
-
-__initial_sp    EQU     0x10020000  ; Top of first RAM segment for LPC43XX
-
-                PRESERVE8
-                THUMB
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-
-Sign_Value		EQU		0x5A5A5A5A
-
-__Vectors       DCD     __initial_sp              	; 0 Top of Stack
-                DCD     Reset_Handler             	; 1 Reset Handler
-                DCD     NMI_Handler               	; 2 NMI Handler
-                DCD     HardFault_Handler         	; 3 Hard Fault Handler
-                DCD     MemManage_Handler         	; 4 MPU Fault Handler
-                DCD     BusFault_Handler          	; 5 Bus Fault Handler
-                DCD     UsageFault_Handler        	; 6 Usage Fault Handler
-                DCD     Sign_Value                	; 7 Reserved
-                DCD     UnHandled_Vector           	; 8 Reserved
-                DCD     UnHandled_Vector           	; 9 Reserved
-                DCD     UnHandled_Vector          	; 10 Reserved
-                DCD     SVC_Handler               	; 11 SVCall Handler
-                DCD     DebugMon_Handler          	; 12 Debug Monitor Handler
-                DCD     UnHandled_Vector          	; 13 Reserved
-                DCD     PendSV_Handler            	; 14 PendSV Handler
-                DCD     SysTick_Handler           	; 15 SysTick Handler
-
-                ; External Interrupts
-				DCD		DAC_IRQHandler	 			; 16 D/A Converter
-				DCD		MX_CORE_IRQHandler			; 17 M0/M4 IRQ handler (LPC43XX ONLY)
-				DCD		DMA_IRQHandler				; 18 General Purpose DMA
-				DCD		UnHandled_Vector			; 19 Reserved
-				DCD		FLASHEEPROM_IRQHandler		; 20 ORed flash bank A, flash bank B, EEPROM interrupts
-				DCD		ETH_IRQHandler				; 21 Ethernet
-				DCD		SDIO_IRQHandler				; 22 SD/MMC
-				DCD		LCD_IRQHandler				; 23 LCD
-				DCD		USB0_IRQHandler				; 24 USB0
-				DCD		USB1_IRQHandler				; 25 USB1
-				DCD		SCT_IRQHandler				; 26 State Configurable Timer
-				DCD		RIT_IRQHandler				; 27 Repetitive Interrupt Timer
-				DCD		TIMER0_IRQHandler			; 28 Timer0
-				DCD		TIMER1_IRQHandler			; 29 Timer1
-				DCD		TIMER2_IRQHandler			; 30 Timer2
-				DCD		TIMER3_IRQHandler			; 31 Timer3
-				DCD		MCPWM_IRQHandler			; 32 Motor Control PWM
-				DCD		ADC0_IRQHandler				; 33 A/D Converter 0
-				DCD		I2C0_IRQHandler				; 34 I2C0
-				DCD		I2C1_IRQHandler				; 35 I2C1
-				DCD		SPI_IRQHandler				; 36 SPI (LPC43XX ONLY)
-				DCD		ADC1_IRQHandler				; 37 A/D Converter 1
-				DCD		SSP0_IRQHandler				; 38 SSP0
-				DCD		SSP1_IRQHandler				; 39 SSP1
-				DCD		UART0_IRQHandler			; 40 UART0
-				DCD		UART1_IRQHandler			; 41 UART1
-				DCD		UART2_IRQHandler			; 42 UART2
-				DCD		UART3_IRQHandler			; 43 UART3
-				DCD		I2S0_IRQHandler				; 44 I2S0
-				DCD		I2S1_IRQHandler				; 45 I2S1
-				DCD		SPIFI_IRQHandler			; 46 SPI Flash Interface
-				DCD		SGPIO_IRQHandler			; 47 SGPIO (LPC43XX ONLY)
-				DCD		GPIO0_IRQHandler			; 48 GPIO0
-				DCD		GPIO1_IRQHandler			; 49 GPIO1
-				DCD		GPIO2_IRQHandler			; 50 GPIO2
-				DCD		GPIO3_IRQHandler			; 51 GPIO3
-				DCD		GPIO4_IRQHandler			; 52 GPIO4
-				DCD		GPIO5_IRQHandler			; 53 GPIO5
-				DCD		GPIO6_IRQHandler			; 54 GPIO6
-				DCD		GPIO7_IRQHandler			; 55 GPIO7
-				DCD		GINT0_IRQHandler			; 56 GINT0
-				DCD		GINT1_IRQHandler			; 57 GINT1
-				DCD		EVRT_IRQHandler				; 58 Event Router
-				DCD		CAN1_IRQHandler				; 59 C_CAN1
- 				DCD		UnHandled_Vector			; 60 Reserved
-				DCD		VADC_IRQHandler 			; 61 VADC
-				DCD		ATIMER_IRQHandler			; 62 ATIMER
-				DCD		RTC_IRQHandler				; 63 RTC
- 				DCD		UnHandled_Vector			; 64 Reserved
-				DCD		WDT_IRQHandler				; 65 WDT
-				DCD		UnHandled_Vector			; 66 M0s
-				DCD		CAN0_IRQHandler				; 67 C_CAN0
-				DCD 	QEI_IRQHandler				; 68 QEI
-
-
-;                IF      :LNOT::DEF:NO_CRP
-;                AREA    |.ARM.__at_0x02FC|, CODE, READONLY
-;CRP_Key         DCD     0xFFFFFFFF
-;                ENDIF
-
-                AREA    |.text|, CODE, READONLY
-
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  __main
-				IMPORT  SystemInit
-				LDR		R0, =SystemInit
-				BLX		R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-; Dummy Exception Handlers (infinite loops which can be modified)
-
-NMI_Handler     PROC
-                EXPORT  NMI_Handler               [WEAK]
-                B       .
-                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-MemManage_Handler\
-                PROC
-                EXPORT  MemManage_Handler         [WEAK]
-                B       .
-                ENDP
-BusFault_Handler\
-                PROC
-                EXPORT  BusFault_Handler          [WEAK]
-                B       .
-                ENDP
-UsageFault_Handler\
-                PROC
-                EXPORT  UsageFault_Handler        [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-DebugMon_Handler\
-                PROC
-                EXPORT  DebugMon_Handler          [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-UnHandled_Vector	PROC
-                EXPORT  UnHandled_Vector          [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-
-                EXPORT DAC_IRQHandler 	    	[WEAK]
-                EXPORT MX_CORE_IRQHandler	    [WEAK]
-				EXPORT DMA_IRQHandler		    [WEAK]
-                EXPORT FLASHEEPROM_IRQHandler	[WEAK]
-				EXPORT ETH_IRQHandler	    	[WEAK]
-				EXPORT SDIO_IRQHandler	    	[WEAK]
-				EXPORT LCD_IRQHandler	    	[WEAK]
-				EXPORT USB0_IRQHandler	    	[WEAK]
-				EXPORT USB1_IRQHandler	    	[WEAK]
-				EXPORT SCT_IRQHandler	    	[WEAK]
-				EXPORT RIT_IRQHandler	    	[WEAK]
-				EXPORT TIMER0_IRQHandler    	[WEAK]
-				EXPORT TIMER1_IRQHandler    	[WEAK]
-				EXPORT TIMER2_IRQHandler    	[WEAK]
-				EXPORT TIMER3_IRQHandler    	[WEAK]
-				EXPORT MCPWM_IRQHandler	    	[WEAK]
-				EXPORT ADC0_IRQHandler	    	[WEAK]
-				EXPORT I2C0_IRQHandler	    	[WEAK]
-				EXPORT I2C1_IRQHandler	    	[WEAK]
-                EXPORT SPI_IRQHandler	    	[WEAK]
-				EXPORT ADC1_IRQHandler		    [WEAK]
-				EXPORT SSP0_IRQHandler	    	[WEAK]
-				EXPORT SSP1_IRQHandler	    	[WEAK]
-				EXPORT UART0_IRQHandler	    	[WEAK]
-				EXPORT UART1_IRQHandler	    	[WEAK]
-				EXPORT UART2_IRQHandler	    	[WEAK]
-				EXPORT UART3_IRQHandler	    	[WEAK]
-				EXPORT I2S0_IRQHandler	    	[WEAK]
-				EXPORT I2S1_IRQHandler	    	[WEAK]
-				EXPORT SPIFI_IRQHandler     	[WEAK]
-				EXPORT SGPIO_IRQHandler     	[WEAK]
-				EXPORT GPIO0_IRQHandler	        [WEAK]
-				EXPORT GPIO1_IRQHandler     	[WEAK]
-				EXPORT GPIO2_IRQHandler	        [WEAK]
-				EXPORT GPIO3_IRQHandler     	[WEAK]
-				EXPORT GPIO4_IRQHandler     	[WEAK]
-				EXPORT GPIO5_IRQHandler     	[WEAK]
-				EXPORT GPIO6_IRQHandler	        [WEAK]
-				EXPORT GPIO7_IRQHandler	        [WEAK]
-				EXPORT GINT0_IRQHandler	        [WEAK]
-				EXPORT GINT1_IRQHandler	        [WEAK]
-				EXPORT EVRT_IRQHandler		    [WEAK]
-				EXPORT CAN1_IRQHandler	    	[WEAK]
-				EXPORT VADC_IRQHandler	    	[WEAK]
-				EXPORT ATIMER_IRQHandler    	[WEAK]
-				EXPORT RTC_IRQHandler	    	[WEAK]
-				EXPORT WDT_IRQHandler	    	[WEAK]
-				EXPORT CAN0_IRQHandler	    	[WEAK]
-				EXPORT QEI_IRQHandler	    	[WEAK]
-
-DAC_IRQHandler
-MX_CORE_IRQHandler
-DMA_IRQHandler
-FLASHEEPROM_IRQHandler
-ETH_IRQHandler
-SDIO_IRQHandler
-LCD_IRQHandler
-USB0_IRQHandler
-USB1_IRQHandler
-SCT_IRQHandler
-RIT_IRQHandler
-TIMER0_IRQHandler
-TIMER1_IRQHandler
-TIMER2_IRQHandler
-TIMER3_IRQHandler
-MCPWM_IRQHandler
-ADC0_IRQHandler
-I2C0_IRQHandler
-I2C1_IRQHandler
-SPI_IRQHandler
-ADC1_IRQHandler
-SSP0_IRQHandler
-SSP1_IRQHandler
-UART0_IRQHandler
-UART1_IRQHandler
-UART2_IRQHandler
-UART3_IRQHandler
-I2S0_IRQHandler
-I2S1_IRQHandler
-SPIFI_IRQHandler
-SGPIO_IRQHandler
-GPIO0_IRQHandler
-GPIO1_IRQHandler
-GPIO2_IRQHandler
-GPIO3_IRQHandler
-GPIO4_IRQHandler
-GPIO5_IRQHandler
-GPIO6_IRQHandler
-GPIO7_IRQHandler
-GINT0_IRQHandler
-GINT1_IRQHandler
-EVRT_IRQHandler
-CAN1_IRQHandler
-VADC_IRQHandler
-ATIMER_IRQHandler
-RTC_IRQHandler
-WDT_IRQHandler
-CAN0_IRQHandler
-QEI_IRQHandler
-
-                B       .
-
-                ENDP
-                
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC43XX/TOOLCHAIN_ARM_STD/sys.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library - stackheap
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * Setup a fixed single stack/heap memory model, 
- *  between the top of the RW/ZI region and the stackpointer
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-#include <rt_misc.h>
-#include <stdint.h>
-
-extern char Image$$RW_IRAM1$$ZI$$Limit[];
-
-extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
-    uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
-    uint32_t sp_limit = __current_sp();
-
-    zi_limit = (zi_limit + 7) & ~0x7;    // ensure zi_limit is 8-byte aligned
-
-    struct __initial_stackheap r;
-    r.heap_base = zi_limit;
-    r.heap_limit = sp_limit;
-    return r;
-}
-
-#ifdef __cplusplus
-}
-#endif 
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC43XX/TOOLCHAIN_GCC_CR/LPC43xx.ld	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-/*
- * LPC43XX Dual core Blinky stand-alone Cortex-M4 LD script
-*/
-
-MEMORY
-{
-  /* Define each memory region */
-  RO_MEM (rx) : ORIGIN = 0x14000000, LENGTH = 0x40000 /* 256K */
-  RW_MEM (rwx) : ORIGIN = 0x10000000, LENGTH = 0x8000 /* 32k */
-  RW_MEM1 (rwx) : ORIGIN = 0x20004000, LENGTH = 0x4000 /* 16K */
-  SH_MEM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x2000 /* 8k */
-  FAT12_MEM (rwx) : ORIGIN = 0x20002000, LENGTH = 0x2000 /* 8k */
-
-}
-
-  __top_RW_MEM = 0x10000000 + 0x8000;
-
-INCLUDE "lpc43xx_dualcore_lib.ld"
-INCLUDE "lpc43xx_dualcore.ld"
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC43XX/TOOLCHAIN_GCC_CR/startup_LPC43xx.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,445 +0,0 @@
-// *****************************************************************************
-//   +--+
-//   | ++----+
-//   +-++    |
-//     |     |
-//   +-+--+  |
-//   | +--+--+
-//   +----+    Copyright (c) 2011-12 Code Red Technologies Ltd.
-//
-// LPC43xx Microcontroller Startup code for use with Red Suite
-//
-// Version : 120430
-//
-// Software License Agreement
-//
-// The software is owned by Code Red Technologies and/or its suppliers, and is
-// protected under applicable copyright laws.  All rights are reserved.  Any
-// use in violation of the foregoing restrictions may subject the user to criminal
-// sanctions under applicable laws, as well as to civil liability for the breach
-// of the terms and conditions of this license.
-//
-// THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-// USE OF THIS SOFTWARE FOR COMMERCIAL DEVELOPMENT AND/OR EDUCATION IS SUBJECT
-// TO A CURRENT END USER LICENSE AGREEMENT (COMMERCIAL OR EDUCATIONAL) WITH
-// CODE RED TECHNOLOGIES LTD.
-//
-// *****************************************************************************
-#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 (__USE_CMSIS)
-#include "LPC43xx.h"
-//#endif
-
-#if defined(OS_UCOS_III)
-extern void OS_CPU_PendSVHandler(void);
-extern void OS_CPU_SysTickHandler (void);
-#endif
-
-// *****************************************************************************
-#if defined(__cplusplus)
-extern "C" {
-#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 DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
-void MX_CORE_IRQHandler(void) ALIAS(IntDefaultHandler);
-void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
-void FLASHEEPROM_IRQHandler(void) ALIAS(IntDefaultHandler);
-void ETH_IRQHandler(void) ALIAS(IntDefaultHandler);
-void SDIO_IRQHandler(void) ALIAS(IntDefaultHandler);
-void LCD_IRQHandler(void) ALIAS(IntDefaultHandler);
-void USB0_IRQHandler(void) ALIAS(IntDefaultHandler);
-void USB1_IRQHandler(void) ALIAS(IntDefaultHandler);
-void SCT_IRQHandler(void) ALIAS(IntDefaultHandler);
-void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
-void TIMER0_IRQHandler(void) ALIAS(IntDefaultHandler);
-void TIMER1_IRQHandler(void) ALIAS(IntDefaultHandler);
-void TIMER2_IRQHandler(void) ALIAS(IntDefaultHandler);
-void TIMER3_IRQHandler(void) ALIAS(IntDefaultHandler);
-void MCPWM_IRQHandler(void) ALIAS(IntDefaultHandler);
-void ADC0_IRQHandler(void) ALIAS(IntDefaultHandler);
-void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
-void I2C1_IRQHandler(void) ALIAS(IntDefaultHandler);
-void SPI_IRQHandler (void) ALIAS(IntDefaultHandler);
-void ADC1_IRQHandler(void) ALIAS(IntDefaultHandler);
-void SSP0_IRQHandler(void) ALIAS(IntDefaultHandler);
-void SSP1_IRQHandler(void) ALIAS(IntDefaultHandler);
-void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
-void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
-void UART2_IRQHandler(void) ALIAS(IntDefaultHandler);
-void UART3_IRQHandler(void) ALIAS(IntDefaultHandler);
-void I2S0_IRQHandler(void) ALIAS(IntDefaultHandler);
-void I2S1_IRQHandler(void) ALIAS(IntDefaultHandler);
-void SPIFI_IRQHandler(void) ALIAS(IntDefaultHandler);
-void SGPIO_IRQHandler(void) ALIAS(IntDefaultHandler);
-void GPIO0_IRQHandler(void) ALIAS(IntDefaultHandler);
-void GPIO1_IRQHandler(void) ALIAS(IntDefaultHandler);
-void GPIO2_IRQHandler(void) ALIAS(IntDefaultHandler);
-void GPIO3_IRQHandler(void) ALIAS(IntDefaultHandler);
-void GPIO4_IRQHandler(void) ALIAS(IntDefaultHandler);
-void GPIO5_IRQHandler(void) ALIAS(IntDefaultHandler);
-void GPIO6_IRQHandler(void) ALIAS(IntDefaultHandler);
-void GPIO7_IRQHandler(void) ALIAS(IntDefaultHandler);
-void GINT0_IRQHandler(void) ALIAS(IntDefaultHandler);
-void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
-void EVRT_IRQHandler(void) ALIAS(IntDefaultHandler);
-void CAN1_IRQHandler(void) ALIAS(IntDefaultHandler);
-void ATIMER_IRQHandler(void) ALIAS(IntDefaultHandler);
-void RTC_IRQHandler(void) ALIAS(IntDefaultHandler);
-void WDT_IRQHandler(void) ALIAS(IntDefaultHandler);
-void CAN0_IRQHandler(void) ALIAS(IntDefaultHandler);
-void QEI_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);
-
-// *****************************************************************************
-//
-// Application can define Stack size (If not defined, default stack size will
-// used
-//
-// *****************************************************************************
-#ifndef STACK_SIZE
-#define STACK_SIZE  (0x200)
-#endif
-
-// *****************************************************************************
-//
-// Application can define Heap size (If not defined, default Heap size will
-// used
-//
-// *****************************************************************************
-#ifndef HEAP_SIZE
-#define HEAP_SIZE   (0x4000)
-#endif
-
-unsigned int __vStack[STACK_SIZE / sizeof(unsigned int)]  __attribute__((section("STACK,\"aw\",%nobits@")));
-unsigned int __vHeap[HEAP_SIZE / sizeof(unsigned int)]  __attribute__((section("HEAP,\"aw\",%nobits@")));
-
-// *****************************************************************************
-#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 - CM4/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
-#if defined(OS_UCOS_III)
-    OS_CPU_PendSVHandler,           // uCOS-III PendSV handler
-    OS_CPU_SysTickHandler,          // uCOS-III SysTick handler
-#else
-	PendSV_Handler,					// The PendSV handler
-	SysTick_Handler,				// The SysTick handler
-#endif
-
-	// Chip Level - LPC18xx/43xx
-	DAC_IRQHandler,					// 16 D/A Converter
-	MX_CORE_IRQHandler,				// 17 CortexM4/M0 (LPC43XX ONLY)
-	DMA_IRQHandler,					// 18 General Purpose DMA
-	0,								// 19 Reserved
-	FLASHEEPROM_IRQHandler,			// 20 ORed flash Bank A, flash Bank B, EEPROM interrupts
-	ETH_IRQHandler,					// 21 Ethernet
-	SDIO_IRQHandler,				// 22 SD/MMC
-	LCD_IRQHandler,					// 23 LCD
-	USB0_IRQHandler,				// 24 USB0
-	USB1_IRQHandler,				// 25 USB1
-	SCT_IRQHandler,					// 26 State Configurable Timer
-	RIT_IRQHandler,					// 27 Repetitive Interrupt Timer
-	TIMER0_IRQHandler,				// 28 Timer0
-	TIMER1_IRQHandler,				// 29 Timer 1
-	TIMER2_IRQHandler,				// 30 Timer 2
-	TIMER3_IRQHandler,				// 31 Timer 3
-	MCPWM_IRQHandler,				// 32 Motor Control PWM
-	ADC0_IRQHandler,				// 33 A/D Converter 0
-	I2C0_IRQHandler,				// 34 I2C0
-	I2C1_IRQHandler,				// 35 I2C1
-	SPI_IRQHandler,					// 36 SPI (LPC43XX ONLY)
-	ADC1_IRQHandler,				// 37 A/D Converter 1
-	SSP0_IRQHandler,				// 38 SSP0 
-	SSP1_IRQHandler,				// 39 SSP1
-	UART0_IRQHandler,				// 40 UART0
-	UART1_IRQHandler,				// 41 UART1
-	UART2_IRQHandler,				// 42 UART2
-	UART3_IRQHandler,				// 43 USRT3
-	I2S0_IRQHandler,				// 44 I2S0
-	I2S1_IRQHandler,				// 45 I2S1
-	SPIFI_IRQHandler,				// 46 SPI Flash Interface
-	SGPIO_IRQHandler,				// 47 SGPIO (LPC43XX ONLY)
-	GPIO0_IRQHandler,				// 48 GPIO0
-	GPIO1_IRQHandler,				// 49 GPIO1
-	GPIO2_IRQHandler,				// 50 GPIO2
-	GPIO3_IRQHandler,				// 51 GPIO3 
-	GPIO4_IRQHandler,				// 52 GPIO4
-	GPIO5_IRQHandler,				// 53 GPIO5
-	GPIO6_IRQHandler,				// 54 GPIO6
-	GPIO7_IRQHandler,				// 55 GPIO7
-	GINT0_IRQHandler,				// 56 GINT0
-	GINT1_IRQHandler,				// 57 GINT1
-	EVRT_IRQHandler,				// 58 Event Router
-	CAN1_IRQHandler,				// 59 C_CAN1
-	0,								// 60 Reserved
-	0,				                // 61 Reserved 
-	ATIMER_IRQHandler,				// 62 ATIMER
-	RTC_IRQHandler,					// 63 RTC
-	0,								// 64 Reserved
-	WDT_IRQHandler,					// 65 WDT
-	0,								// 66 Reserved
-	CAN0_IRQHandler,				// 67 C_CAN0
-	QEI_IRQHandler,					// 68 QEI
-};
-
-// *****************************************************************************
-// 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.
-//
-// *****************************************************************************
-void
-ResetISR(void) {
-
-	//
-	// Copy the data sections from flash to SRAM.
-	//
-	unsigned int LoadAddr, ExeAddr, SectionLen;
-	unsigned int *SectionTableAddr;
-
-	/* Call SystemInit() for clocking/memory setup prior to scatter load */
-	SystemInit();
-
-	// 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(__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) {}
-}
-
-// *****************************************************************************
-//
-// Heap overflow check function required by REDLib_V2 library
-//
-// *****************************************************************************
-extern unsigned int *_pvHeapStart;
-unsigned int __check_heap_overflow (void * new_end_of_heap)
-{
-	return (new_end_of_heap >= (void *)&__vHeap[HEAP_SIZE/sizeof(unsigned int)]);
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC43XX/TOOLCHAIN_IAR/LPC43xx.icf	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/* [ROM] */
-define symbol __intvec_start__     = 0x14000000;
-define symbol __region_ROM_start__ = 0x14000000;
-define symbol __region_ROM_end__   = 0x143FFFFF;
-
-/* [RAM] Vector table dynamic copy: 8_byte_aligned(69 vect * 4 bytes) =  8_byte_aligned(0x0114) = 0x0118*/
-define symbol __NVIC_start__       = 0x10000000;
-define symbol __NVIC_end__         = 0x10000117;
-define symbol __region_RAM_start__ = 0x10000118;
-define symbol __region_RAM_end__   = 0x1001FFDF;
-define symbol _AHB_RAM_start__     = 0x20000000;
-define symbol _AHB_RAM_end__       = 0x20007FFF;
-
-/* Memory regions */
-define memory mem with size = 4G;
-
-define region ROM_region     = mem:[from __region_ROM_start__   to __region_ROM_end__];
-
-define region RAM_region     = mem:[from __region_RAM_start__   to __region_RAM_end__];
-define region AHB_RAM_region = mem:[from _AHB_RAM_start__ to _AHB_RAM_end__];
-
-/* Stack and Heap */
-define symbol __size_cstack__   = 0x800;
-define symbol __size_heap__     = 0x800;
-define block CSTACK    with alignment = 8, size = __size_cstack__   { };
-define block HEAP      with alignment = 8, size = __size_heap__     { };
-define block STACKHEAP with fixed order { block HEAP, block CSTACK };
-
-initialize by copy with packing = zeros { readwrite };
-do not initialize  { section .noinit };
-
-place at address mem:__intvec_start__ { section .intvec };
-place in ROM_region     { readonly };
-place in RAM_region     { readwrite, block STACKHEAP };
-place in AHB_RAM_region { section USB_RAM };
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC43XX/TOOLCHAIN_IAR/startup_LPC43xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,292 +0,0 @@
-/**************************************************
- *
- * Part one of the system initialization code, contains low-level
- * initialization, plain thumb variant.
- *
- * Copyright 2011 IAR Systems. All rights reserved.
- *
- * $Revision: 47876 $
- *
- **************************************************/
-
-;
-; The modules in this file are included in the libraries, and may be replaced
-; by any user-defined modules that define the PUBLIC symbol _program_start or
-; a user defined start symbol.
-; To override the cstartup defined in the library, simply add your modified
-; version to the workbench project.
-;
-; The vector table is normally located at address 0.
-; When debugging in RAM, it can be located in RAM, aligned to at least 2^6.
-; The name "__vector_table" has special meaning for C-SPY:
-; it is where the SP start value is found, and the NVIC vector
-; table register (VTOR) is initialized to this address if != 0.
-;
-; Cortex-M version
-;
-
-
-        MODULE  ?cstartup
-
-        ;; Forward declaration of sections.
-        SECTION CSTACK:DATA:NOROOT(3)
-
-        SECTION .intvec:CODE:NOROOT(2)
-
-        EXTERN  __iar_program_start 
-        EXTERN  SystemInit        
-        PUBLIC  __vector_table
-        PUBLIC  __vector_table_0x1c
-        PUBLIC  __Vectors
-        PUBLIC  __Vectors_End
-        PUBLIC  __Vectors_Size
-
-        DATA
-
-__vector_table
-        DCD     sfe(CSTACK)
-        DCD     Reset_Handler
-        DCD     NMI_Handler
-        DCD     HardFault_Handler
-        DCD     MemManage_Handler
-        DCD     BusFault_Handler
-        DCD     UsageFault_Handler
-__vector_table_0x1c
-        DCD     0
-        DCD     0
-        DCD     0
-        DCD     0
-        DCD     SVC_Handler
-        DCD     DebugMon_Handler
-        DCD     0
-        DCD     PendSV_Handler
-        DCD     SysTick_Handler
-
-        ; External Interrupts
-        DCD		DAC_IRQHandler	 			; 16 D/A Converter
-        DCD		MX_CORE_IRQHandler          ; 17 CortexM0 (LPC43XX ONLY) 
-        DCD		DMA_IRQHandler				; 18 General Purpose DMA
-        DCD		0				            ; 19 Reserved
-        DCD		FLASHEEPROM_IRQHandler		; 20 ORed flash bank A, flash bank B, EEPROM interrupts
-        DCD		ETH_IRQHandler				; 21 Ethernet
-        DCD		SDIO_IRQHandler				; 22 SD/MMC
-        DCD		LCD_IRQHandler				; 23 LCD
-        DCD		USB0_IRQHandler				; 24 USB0
-        DCD		USB1_IRQHandler				; 25 USB1
-        DCD		SCT_IRQHandler				; 26 State Configurable Timer
-        DCD		RIT_IRQHandler				; 27 Repetitive Interrupt Timer
-        DCD		TIMER0_IRQHandler			; 28 Timer0
-        DCD		TIMER1_IRQHandler			; 29 Timer1
-        DCD		TIMER2_IRQHandler			; 30 Timer2
-        DCD		TIMER3_IRQHandler			; 31 Timer3
-        DCD		MCPWM_IRQHandler			; 32 Motor Control PWM
-        DCD		ADC0_IRQHandler				; 33 A/D Converter 0
-        DCD		I2C0_IRQHandler				; 34 I2C0
-        DCD		I2C1_IRQHandler				; 35 I2C1
-        DCD		SPI_IRQHandler				; 36 SPI (LPC43XX ONLY)
-        DCD		ADC1_IRQHandler				; 37 A/D Converter 1
-        DCD		SSP0_IRQHandler				; 38 SSP0
-        DCD		SSP1_IRQHandler				; 39 SSP1
-        DCD		UART0_IRQHandler			; 40 UART0
-        DCD		UART1_IRQHandler			; 41 UART1
-        DCD		UART2_IRQHandler			; 42 UART2
-        DCD		UART3_IRQHandler			; 43 UART3
-        DCD		I2S0_IRQHandler				; 44 I2S0
-        DCD		I2S1_IRQHandler				; 45 I2S1
-        DCD		SPIFI_IRQHandler			; 46 SPI Flash Interface
-        DCD		SGPIO_IRQHandler			; 47 SGPIO (LPC43XX ONLY)
-        DCD		GPIO0_IRQHandler			; 48 GPIO0
-        DCD		GPIO1_IRQHandler			; 49 GPIO1
-        DCD		GPIO2_IRQHandler			; 50 GPIO2
-        DCD		GPIO3_IRQHandler			; 51 GPIO3
-        DCD		GPIO4_IRQHandler			; 52 GPIO4
-        DCD		GPIO5_IRQHandler			; 53 GPIO5
-        DCD		GPIO6_IRQHandler			; 54 GPIO6
-        DCD		GPIO7_IRQHandler			; 55 GPIO7
-        DCD		GINT0_IRQHandler			; 56 GINT0
-        DCD		GINT1_IRQHandler			; 57 GINT1
-        DCD		EVRT_IRQHandler             ; 58 Event Router
-        DCD		CAN1_IRQHandler             ; 59 C_CAN1
-        DCD		0
-        DCD		0
-        DCD 	ATIMER_IRQHandler           ; 62 ATIMER
-        DCD 	RTC_IRQHandler              ; 63 RTC
-        DCD 	0
-        DCD 	WDT_IRQHandler              ; 65 WDT
-        DCD 	0
-        DCD 	CAN0_IRQHandler             ; 67 C_CAN0
-        DCD 	QEI_IRQHandler              ; 68 QEI
-__Vectors_End
-
-__Vectors       EQU   __vector_table
-__Vectors_Size 	EQU   __Vectors_End - __Vectors
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
-;; Default interrupt handlers.
-;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-        THUMB
-
-        PUBWEAK Reset_Handler
-        SECTION .text:CODE:REORDER(2)
-Reset_Handler
-        LDR     R0, =SystemInit
-        BLX     R0
-        LDR     R0, =__iar_program_start
-        BX      R0
-  
-        PUBWEAK NMI_Handler
-        PUBWEAK HardFault_Handler
-        PUBWEAK MemManage_Handler
-        PUBWEAK BusFault_Handler
-        PUBWEAK UsageFault_Handler
-        PUBWEAK SVC_Handler
-        PUBWEAK DebugMon_Handler
-        PUBWEAK PendSV_Handler
-        PUBWEAK SysTick_Handler
-        PUBWEAK DAC_IRQHandler
-        PUBWEAK MX_CORE_IRQHandler
-        PUBWEAK DMA_IRQHandler
-        PUBWEAK FLASHEEPROM_IRQHandler
-        PUBWEAK ETH_IRQHandler
-        PUBWEAK SDIO_IRQHandler
-        PUBWEAK LCD_IRQHandler
-        PUBWEAK USB0_IRQHandler
-        PUBWEAK USB1_IRQHandler
-        PUBWEAK SCT_IRQHandler
-        PUBWEAK RIT_IRQHandler
-        PUBWEAK TIMER0_IRQHandler
-        PUBWEAK TIMER1_IRQHandler
-        PUBWEAK TIMER2_IRQHandler
-        PUBWEAK TIMER3_IRQHandler
-        PUBWEAK MCPWM_IRQHandler
-        PUBWEAK ADC0_IRQHandler
-        PUBWEAK I2C0_IRQHandler
-        PUBWEAK I2C1_IRQHandler
-        PUBWEAK SPI_IRQHandler
-        PUBWEAK ADC1_IRQHandler
-        PUBWEAK SSP0_IRQHandler
-        PUBWEAK SSP1_IRQHandler
-        PUBWEAK UART0_IRQHandler
-        PUBWEAK UART1_IRQHandler
-        PUBWEAK UART2_IRQHandler
-        PUBWEAK UART3_IRQHandler
-        PUBWEAK I2S0_IRQHandler
-        PUBWEAK I2S1_IRQHandler
-        PUBWEAK SPIFI_IRQHandler
-        PUBWEAK SGPIO_IRQHandler
-        PUBWEAK GPIO0_IRQHandler
-        PUBWEAK GPIO1_IRQHandler
-        PUBWEAK GPIO2_IRQHandler
-        PUBWEAK GPIO3_IRQHandler
-        PUBWEAK GPIO4_IRQHandler
-        PUBWEAK GPIO5_IRQHandler
-        PUBWEAK GPIO6_IRQHandler
-        PUBWEAK GPIO7_IRQHandler
-        PUBWEAK GINT0_IRQHandler
-        PUBWEAK GINT1_IRQHandler
-        PUBWEAK EVRT_IRQHandler
-        PUBWEAK CAN1_IRQHandler
-        PUBWEAK ATIMER_IRQHandler
-        PUBWEAK RTC_IRQHandler
-        PUBWEAK WDT_IRQHandler
-        PUBWEAK CAN0_IRQHandler
-        PUBWEAK QEI_IRQHandler
-        SECTION .text:CODE:REORDER(1)
-NMI_Handler
-        B NMI_Handler
-SVC_Handler
-        B SVC_Handler
-DebugMon_Handler
-        B DebugMon_Handler
-PendSV_Handler
-        B PendSV_Handler
-SysTick_Handler
-        B SysTick_Handler
-HardFault_Handler
-        B HardFault_Handler
-MemManage_Handler
-        B MemManage_Handler
-BusFault_Handler
-        B BusFault_Handler
-UsageFault_Handler
-DAC_IRQHandler
-MX_CORE_IRQHandler
-DMA_IRQHandler 
-FLASHEEPROM_IRQHandler
-ETH_IRQHandler
-SDIO_IRQHandler
-LCD_IRQHandler
-USB0_IRQHandler
-USB1_IRQHandler
-SCT_IRQHandler
-RIT_IRQHandler
-TIMER0_IRQHandler
-TIMER1_IRQHandler
-TIMER2_IRQHandler
-TIMER3_IRQHandler
-MCPWM_IRQHandler
-ADC0_IRQHandler
-I2C0_IRQHandler
-I2C1_IRQHandler
-SPI_IRQHandler
-ADC1_IRQHandler
-SSP0_IRQHandler
-SSP1_IRQHandler
-UART0_IRQHandler
-UART1_IRQHandler
-UART2_IRQHandler
-UART3_IRQHandler
-I2S0_IRQHandler
-I2S1_IRQHandler
-SPIFI_IRQHandler
-SGPIO_IRQHandler
-GPIO0_IRQHandler
-GPIO1_IRQHandler
-GPIO2_IRQHandler
-GPIO3_IRQHandler
-GPIO4_IRQHandler
-GPIO5_IRQHandler
-GPIO6_IRQHandler
-GPIO7_IRQHandler
-GINT0_IRQHandler
-GINT1_IRQHandler
-EVRT_IRQHandler
-CAN1_IRQHandler
-ATIMER_IRQHandler
-RTC_IRQHandler
-WDT_IRQHandler
-CAN0_IRQHandler
-QEI_IRQHandler
-Default_IRQHandler
-        B Default_IRQHandler
-
-/* CRP Section - not needed for flashless devices */
-
-;;;        SECTION .crp:CODE:ROOT(2)
-;;;        DATA
-/* Code Read Protection
-NO_ISP  0x4E697370 -  Prevents sampling of pin PIO0_1 for entering ISP mode
-CRP1    0x12345678 - Write to RAM command cannot access RAM below 0x10000300.
-                   - Copy RAM to flash command can not write to Sector 0.
-                   - Erase command can erase Sector 0 only when all sectors
-                     are selected for erase.
-                   - Compare command is disabled.
-                   - Read Memory command is disabled.
-CRP2    0x87654321 - Read Memory is disabled.
-                   - Write to RAM is disabled.
-                   - "Go" command is disabled.
-                   - Copy RAM to flash is disabled.
-                   - Compare is disabled.
-CRP3    0x43218765 - Access to chip via the SWD pins is disabled. ISP entry
-                     by pulling PIO0_1 LOW is disabled if a valid user code is
-                     present in flash sector 0.
-Caution: If CRP3 is selected, no future factory testing can be
-performed on the device.
-*/
-;;;	    DCD	0xFFFFFFFF
-;;;
-
-        END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC43XX/cmsis.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-/* mbed Microcontroller Library - CMSIS
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * A generic CMSIS include header, pulling in LPC43xx specifics
- *
- * Ported to NXP LPC43XX by Micromint USA <support@micromint.com>
- */
-
-#ifndef MBED_CMSIS_H
-#define MBED_CMSIS_H
-
-#include "LPC43xx.h"
-#include "cmsis_nvic.h"
-
-#endif
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC43XX/cmsis_nvic.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic for LCP43xx
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */ 
-#include "cmsis_nvic.h"
-
-#define NVIC_RAM_VECTOR_ADDRESS   (0x10000000)  // Location of vectors in RAM
-
-// The LPC43xx can boot from multiple memories (internal Flash, external NOR,
-// external SPIFI) so we don't know the initial value of VTOR. Thus we use
-// a variable to keep track if the vector table was relocated or not
-static unsigned char vtor_relocated;
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
-    uint32_t *vectors = (uint32_t*)SCB->VTOR;
-    uint32_t i;
-    
-    // Copy and switch to dynamic vectors if first time called
-   if (!vtor_relocated) {
-        uint32_t *old_vectors = vectors;
-        vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
-        for (i=0; i<NVIC_NUM_VECTORS; i++) {
-            vectors[i] = old_vectors[i];
-        }
-        SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
-        vtor_relocated = 1;
-    }
-    vectors[IRQn + 16] = vector;
-}
-
-uint32_t NVIC_GetVector(IRQn_Type IRQn) {
-    uint32_t *vectors = (uint32_t*)SCB->VTOR;
-    return vectors[IRQn + 16];
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC43XX/cmsis_nvic.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */ 
-
-#ifndef MBED_CMSIS_NVIC_H
-#define MBED_CMSIS_NVIC_H
-
-#define NVIC_NUM_VECTORS      (16 + 53)   // CORE + MCU Peripherals
-#define NVIC_USER_IRQ_OFFSET  16
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
-uint32_t NVIC_GetVector(IRQn_Type IRQn);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC43XX/system_LPC43xx.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,229 +0,0 @@
-/*
- * @brief LPC43xx System Initialization
- *
- * @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.
- *
- * Modified by Micromint USA <support@micromint.com>
- */
-#include "LPC43xx.h"
-
-#define COUNT_OF(a) (sizeof(a)/sizeof(a[0]))
-
-/* Clock variables */
-//uint32_t SystemCoreClock = CRYSTAL_MAIN_FREQ_IN;		/*!< System Clock Frequency (Core Clock)*/
-uint32_t SystemCoreClock = 204000000;
-
-#if !defined(CORE_M0)
-/* SCU pin definitions for pin muxing */
-typedef struct {
-    __IO uint32_t *reg; /* SCU register address */
-    uint16_t mode;      /* SCU pin mode and function */
-} PINMUX_GRP_T;
-
-/* Local functions */
-static void SystemCoreClockUpdate(void);
-static void SystemSetupClock(void);
-static void SystemSetupPins(const PINMUX_GRP_T *mux, uint32_t n);
-static void SystemSetupMemory(void);
-static void WaitUs(uint32_t us);
-
-/* Pins to initialize before clocks are configured */
-static const PINMUX_GRP_T pre_clock_mux[] = {
-    /* SPIFI pins */
-    {SCU_REG(0x3, 3), (SCU_PINIO_FAST | 0x3)},  // P3_3 SPIFI CLK
-    {SCU_REG(0x3, 4), (SCU_PINIO_FAST | 0x3)},  // P3_4 SPIFI D3
-    {SCU_REG(0x3, 5), (SCU_PINIO_FAST | 0x3)},  // P3_5 SPIFI D2
-    {SCU_REG(0x3, 6), (SCU_PINIO_FAST | 0x3)},  // P3_6 SPIFI D1
-    {SCU_REG(0x3, 7), (SCU_PINIO_FAST | 0x3)},  // P3_7 SPIFI D0
-    {SCU_REG(0x3, 8), (SCU_PINIO_FAST | 0x3)}   // P3_8 SPIFI CS/SSEL
-};
-
-/* Pins to initialize after clocks are configured */
-static const PINMUX_GRP_T post_clock_mux[] = {
-    /* Boot pins */
-    {SCU_REG(0x1, 1), (SCU_PINIO_FAST | 0x0)},  // P1_1  BOOT0
-    {SCU_REG(0x1, 2), (SCU_PINIO_FAST | 0x0)},  // P1_2  BOOT1
-    {SCU_REG(0x2, 8), (SCU_PINIO_FAST | 0x0)},  // P2_8  BOOT2
-    {SCU_REG(0x2, 9), (SCU_PINIO_FAST | 0x0)}   // P2_9  BOOT3
-};
-#endif /* !defined(CORE_M0) */
-
-/*
- * SystemInit() - Initialize the system
- */
-void SystemInit(void)
-{
-#if !defined(CORE_M0)
-    unsigned int *pSCB_VTOR = (unsigned int *) 0xE000ED08;
-
-#if defined(__ARMCC_VERSION)
-    extern void *__Vectors;
-
-    *pSCB_VTOR = (unsigned int) &__Vectors;
-#elif defined(__IAR_SYSTEMS_ICC__)
-    extern void *__vector_table;
-
-    *pSCB_VTOR = (unsigned int) &__vector_table;
-#else /* defined(__GNUC__) and others */
-    extern void *g_pfnVectors;
-
-    *pSCB_VTOR = (unsigned int) &g_pfnVectors;
-#endif
-
-#if defined(__FPU_PRESENT) && __FPU_PRESENT == 1
-    /* Initialize floating point */
-    fpuInit();
-#endif
-
-    SystemSetupPins(pre_clock_mux, COUNT_OF(pre_clock_mux)); /* Configure pins */
-
-    SystemSetupClock();   /* Configure processor and peripheral clocks */
-    SystemSetupPins(post_clock_mux, COUNT_OF(post_clock_mux)); /* Configure pins */
-    SystemSetupMemory();  /* Configure external memory */
-#endif /* !defined(CORE_M0) */
-
-    SystemCoreClockUpdate(); /* Update SystemCoreClock variable */
-}
-
-/*
- * SystemCoreClockUpdate() - Update SystemCoreClock variable
- */
-void SystemCoreClockUpdate(void)
-{
-}
-
-#if !defined(CORE_M0)
-/*
- * SystemSetupClock() - Set processor and peripheral clocks
- */
-void SystemSetupClock(void)
-{
-#if (CLOCK_SETUP)
-    /* Switch main clock to Internal RC (IRC) */
-    LPC_CGU->BASE_CLK[CLK_BASE_MX] = ((1 << 11) | (CLKIN_IRC << 24));
-
-    /* Enable the oscillator and wait 100 us */
-    LPC_CGU->XTAL_OSC_CTRL = 0;
-    WaitUs(100);
-
-#if (SPIFI_INIT)
-    /* Switch IDIVA clock to IRC and connect to SPIFI clock */
-    LPC_CGU->IDIV_CTRL[CLK_IDIV_A] =  ((1 << 11) | (CLKIN_IRC << 24));
-    LPC_CGU->BASE_CLK[CLK_BASE_SPIFI] =  ((1 << 11) | (CLKIN_IDIVA << 24));
-#endif /* SPIFI_INIT */
-
-    /* Power down PLL1 */
-    LPC_CGU->PLL1_CTRL |= 1;
-
-    /* Change PLL1 to 108 Mhz (msel=9, 12 MHz*9=108 MHz) */
-//    LPC_CGU->PLL1_CTRL = (DIRECT << 7) | (PSEL << 8) | (1 << 11) | (P(NSEL-1) << 12)  | ((MSEL-1) << 16) | (CLKIN_PLL1 << 24);
-    LPC_CGU->PLL1_CTRL = (1 << 7) | (0 << 8) | (1 << 11) | (0 << 12) | (8 << 16) | (CLKIN_PLL1 << 24);
-    while (!(LPC_CGU->PLL1_STAT & 1)); /* Wait for PLL1 to lock */
-    WaitUs(100);
-
-    /* Change PLL1 to 204 Mhz (msel=17, 12 MHz*17=204 MHz) */
-    LPC_CGU->PLL1_CTRL = (1 << 7) | (0 << 8) | (1 << 11) | (0 << 12) | (16 << 16) | (CLKIN_PLL1 << 24);
-    while (!(LPC_CGU->PLL1_STAT & 1)); /* Wait for PLL1 to lock */
-
-    /* Switch main clock to PLL1 */
-    LPC_CGU->BASE_CLK[CLK_BASE_MX] = ((1 << 11) | (CLKIN_PLL1 << 24));
-    SystemCoreClock = 204000000;
-#endif /* CLOCK_SETUP */
-}
-
-/*
- * SystemSetupPins() - Configure MCU pins
- */
-void SystemSetupPins(const PINMUX_GRP_T *mux, uint32_t n)
-{
-    uint16_t i;
-
-    for (i = 0; i < n; i++) {
-        *(mux[i].reg) = mux[i].mode;
-    }
-}
-
-/*
- * SystemSetupMemory() - Configure external memory
- */
-void SystemSetupMemory(void)
-{
-#if (MEMORY_SETUP)
-    /* None required for boards without external memory */
-#endif /* MEMORY_SETUP */
-}
-
-#if defined(__FPU_PRESENT) && __FPU_PRESENT == 1
-/*
- * fpuInit() - Early initialization of the FPU
- */
-void fpuInit(void)
-{
-	// from ARM TRM manual:
-	//   ; CPACR is located at address 0xE000ED88
-	//   LDR.W R0, =0xE000ED88
-	//   ; Read CPACR
-	//   LDR R1, [R0]
-	//   ; Set bits 20-23 to enable CP10 and CP11 coprocessors
-	//   ORR R1, R1, #(0xF << 20)
-	//   ; Write back the modified value to the CPACR
-	//   STR R1, [R0]
-
-	volatile uint32_t *regCpacr = (uint32_t *) LPC_CPACR;
-	volatile uint32_t *regMvfr0 = (uint32_t *) SCB_MVFR0;
-	volatile uint32_t *regMvfr1 = (uint32_t *) SCB_MVFR1;
-	volatile uint32_t Cpacr;
-	volatile uint32_t Mvfr0;
-	volatile uint32_t Mvfr1;
-	char vfpPresent = 0;
-
-	Mvfr0 = *regMvfr0;
-	Mvfr1 = *regMvfr1;
-
-	vfpPresent = ((SCB_MVFR0_RESET == Mvfr0) && (SCB_MVFR1_RESET == Mvfr1));
-
-	if (vfpPresent) {
-		Cpacr = *regCpacr;
-		Cpacr |= (0xF << 20);
-		*regCpacr = Cpacr;	// enable CP10 and CP11 for full access
-	}
-
-}
-#endif /* defined(__FPU_PRESENT) && __FPU_PRESENT == 1 */
-
-/* Approximate delay function */
-#define CPU_NANOSEC(x)  (((uint64_t) (x) * SystemCoreClock) / 1000000000)
-
-static void WaitUs(uint32_t us)
-{
-    uint32_t  cyc = us * CPU_NANOSEC(1000) / 4;
-    while (cyc--)
-        ;
-}
-
-#endif /* !defined(CORE_M0) */
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC43XX/system_LPC43xx.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
- * @brief LPC43xx/LPC18xx mcu header
- *
- * Copyright(C) NXP Semiconductors, 2012
- * 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 __SYSTEM_LPC43XX_H
-#define __SYSTEM_LPC43XX_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* System initialization options */
-#define PIN_SETUP             1 /* Configure pins during initialization */
-#define CLOCK_SETUP           1 /* Configure clocks during initialization */
-#define MEMORY_SETUP          0 /* Configure external memory during init */
-#define SPIFI_INIT            1 /* Initialize SPIFI */
-
-/* Crystal frequency into device */
-#define CRYSTAL_MAIN_FREQ_IN 12000000
-
-/* Crystal frequency into device for RTC/32K input */
-#define CRYSTAL_32K_FREQ_IN 32768
-
-/* Default CPU clock frequency */
-#if defined(CHIP_LPC43XX)
-#define MAX_CLOCK_FREQ (204000000)
-#else
-#define MAX_CLOCK_FREQ (180000000)
-#endif
-
-#if defined(__FPU_PRESENT) && __FPU_PRESENT == 1
-  /* FPU declarations */
-  #define LPC_CPACR	          0xE000ED88
-
-  #define SCB_MVFR0           0xE000EF40
-  #define SCB_MVFR0_RESET     0x10110021
-
-  #define SCB_MVFR1           0xE000EF44
-  #define SCB_MVFR1_RESET     0x11000011
-
-  #if defined(__ARMCC_VERSION)
-    void fpuInit(void) __attribute__ ((section("BOOTSTRAP_CODE")));
-  #else
-    extern void fpuInit(void);
-  #endif
-#endif
-
-extern uint32_t SystemCoreClock;     /*!< System Clock Frequency (Core Clock)  */
-
-/**
- * Initialize the system
- *
- * @param  none
- * @return none
- *
- * @brief  Setup the microcontroller system.
- *         Initialize the System and update the SystemCoreClock variable.
- */
-extern void SystemInit (void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __SYSTEM_LPC43XX_H */
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC810/TOOLCHAIN_ARM_MICRO/LPC810.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-
-LR_IROM1 0x00000000 0x1000  {    ; load region size_region (4k)
-  ER_IROM1 0x00000000 0x1000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  ; 8_byte_aligned(48 vect * 4 bytes) = 0xC0
-  ; 1KB(0x0400) - 0xC0 = 0x340
-  RW_IRAM1 (0x10000000+0xC0) (0x400-0xC0)  {
-   .ANY (+RW +ZI)
-  }
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC810/TOOLCHAIN_ARM_MICRO/startup_LPC8xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,211 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_LPC8xx.s
-; * @purpose: CMSIS Cortex-M0+ Core Device Startup File
-; *           for the NXP LPC8xx Device Series
-; * @version: V1.0
-; * @date:    16. Aug. 2012
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; * Copyright (C) 2012 ARM Limited. All rights reserved.
-; * ARM Limited (ARM) is supplying this software for use with Cortex-M0+
-; * processor based microcontrollers.  This file can be freely distributed
-; * within development tools that are supporting such ARM based processors.
-; *
-; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
-; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
-; *
-; *****************************************************************************/
-
-
-; <h> Stack Configuration
-;   <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
-; </h>
-
-Stack_Size      EQU     0x00000200
-
-                AREA    STACK, NOINIT, READWRITE, ALIGN=3
-                EXPORT  __initial_sp
-
-Stack_Mem       SPACE   Stack_Size
-__initial_sp            EQU     0x10000400
-
-
-; <h> Heap Configuration
-;   <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
-; </h>
-
-Heap_Size       EQU     0x00000000
-
-                AREA    HEAP, NOINIT, READWRITE, ALIGN=3
-                EXPORT  __heap_base
-                EXPORT  __heap_limit
-
-__heap_base
-Heap_Mem        SPACE   Heap_Size
-__heap_limit
-
-                PRESERVE8
-                THUMB
-
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-
-__Vectors       DCD     __initial_sp              ; Top of Stack
-                DCD     Reset_Handler             ; Reset Handler
-                DCD     NMI_Handler               ; NMI Handler
-                DCD     HardFault_Handler         ; Hard Fault Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     SVC_Handler               ; SVCall Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     PendSV_Handler            ; PendSV Handler
-                DCD     SysTick_Handler           ; SysTick Handler
-
-                ; External Interrupts
-                DCD     SPI0_IRQHandler             ; SPI0 controller
-                DCD     SPI1_IRQHandler             ; SPI1 controller
-                DCD     0                           ; Reserved
-                DCD     UART0_IRQHandler            ; UART0
-                DCD     UART1_IRQHandler            ; UART1
-                DCD     UART2_IRQHandler            ; UART2
-                DCD     0                           ; Reserved
-                DCD     0                           ; Reserved
-                DCD     I2C_IRQHandler              ; I2C controller
-                DCD     SCT_IRQHandler              ; Smart Counter Timer
-                DCD     MRT_IRQHandler              ; Multi-Rate Timer
-                DCD     CMP_IRQHandler              ; Comparator
-                DCD     WDT_IRQHandler              ; PIO1 (0:11)
-                DCD     BOD_IRQHandler              ; Brown Out Detect
-                DCD     0                           ; Reserved
-                DCD     WKT_IRQHandler              ; Wakeup timer
-                DCD     0                           ; Reserved
-                DCD     0                           ; Reserved
-                DCD     0                           ; Reserved
-                DCD     0                           ; Reserved
-                DCD     0                           ; Reserved
-                DCD     0                           ; Reserved
-                DCD     0                           ; Reserved
-                DCD     0                           ; Reserved
-                DCD     PININT0_IRQHandler          ; PIO INT0
-                DCD     PININT1_IRQHandler         ; PIO INT1
-                DCD     PININT2_IRQHandler         ; PIO INT2
-                DCD     PININT3_IRQHandler         ; PIO INT3
-                DCD     PININT4_IRQHandler         ; PIO INT4
-                DCD     PININT5_IRQHandler         ; PIO INT5
-                DCD     PININT6_IRQHandler         ; PIO INT6
-                DCD     PININT7_IRQHandler         ; PIO INT7
-
-
-                IF      :LNOT::DEF:NO_CRP
-                AREA    |.ARM.__at_0x02FC|, CODE, READONLY
-CRP_Key         DCD     0xFFFFFFFF
-                ENDIF
-
-
-                AREA    |.text|, CODE, READONLY
-
-
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-
-; Dummy Exception Handlers (infinite loops which can be modified)
-; now, under COMMON lpc8xx_nmi.c and lpc8xx_nmi.h, a real NMI handler is created if NMI is enabled
-; for particular peripheral.
-;NMI_Handler     PROC
-;                EXPORT  NMI_Handler               [WEAK]
-;                B       .
-;                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-
-                EXPORT  NMI_Handler               [WEAK]
-                EXPORT  SPI0_IRQHandler           [WEAK]
-                EXPORT  SPI1_IRQHandler           [WEAK]
-                EXPORT  UART0_IRQHandler          [WEAK]
-                EXPORT  UART1_IRQHandler          [WEAK]
-                EXPORT  UART2_IRQHandler          [WEAK]
-                EXPORT  I2C_IRQHandler            [WEAK]
-                EXPORT  SCT_IRQHandler            [WEAK]
-                EXPORT  MRT_IRQHandler            [WEAK]
-                EXPORT  CMP_IRQHandler            [WEAK]
-                EXPORT  WDT_IRQHandler            [WEAK]
-                EXPORT  BOD_IRQHandler            [WEAK]
-
-                EXPORT  WKT_IRQHandler            [WEAK]
-
-                EXPORT  PININT0_IRQHandler      [WEAK]
-                EXPORT  PININT1_IRQHandler      [WEAK]
-                EXPORT  PININT2_IRQHandler      [WEAK]
-                EXPORT  PININT3_IRQHandler      [WEAK]
-                EXPORT  PININT4_IRQHandler      [WEAK]
-                EXPORT  PININT5_IRQHandler      [WEAK]
-                EXPORT  PININT6_IRQHandler      [WEAK]
-                EXPORT  PININT7_IRQHandler      [WEAK]
-
-NMI_Handler
-SPI0_IRQHandler
-SPI1_IRQHandler
-UART0_IRQHandler
-UART1_IRQHandler
-UART2_IRQHandler
-I2C_IRQHandler
-SCT_IRQHandler
-MRT_IRQHandler
-CMP_IRQHandler
-WDT_IRQHandler
-BOD_IRQHandler
-WKT_IRQHandler
-PININT0_IRQHandler
-PININT1_IRQHandler
-PININT2_IRQHandler
-PININT3_IRQHandler
-PININT4_IRQHandler
-PININT5_IRQHandler
-PININT6_IRQHandler
-PININT7_IRQHandler
-
-                B       .
-
-                ENDP
-
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC810/system_LPC8xx.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,367 +0,0 @@
-/******************************************************************************
- * @file:    system_LPC8xx.c
- * @purpose: CMSIS Cortex-M0+ Device Peripheral Access Layer Source File
- *           for the NXP LPC8xx Device Series
- * @version: V1.0
- * @date:    16. Aug. 2012
- *----------------------------------------------------------------------------
- *
- * Copyright (C) 2012 ARM Limited. All rights reserved.
- *
- * ARM Limited (ARM) is supplying this software for use with Cortex-M0+
- * processor based microcontrollers.  This file can be freely distributed
- * within development tools that are supporting such ARM based processors.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- *
- ******************************************************************************/
-#include <stdint.h>
-#include "LPC8xx.h"
-
-/*
-//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-*/
-
-/*--------------------- Clock Configuration ----------------------------------
-//
-// <e> Clock Configuration
-//   <h> System Oscillator Control Register (SYSOSCCTRL)
-//     <o1.0>      BYPASS: System Oscillator Bypass Enable
-//                     <i> If enabled then PLL input (sys_osc_clk) is fed
-//                     <i> directly from XTALIN and XTALOUT pins.
-//     <o1.9>      FREQRANGE: System Oscillator Frequency Range
-//                     <i> Determines frequency range for Low-power oscillator.
-//                   <0=> 1 - 20 MHz
-//                   <1=> 15 - 25 MHz
-//   </h>
-//
-//   <h> Watchdog Oscillator Control Register (WDTOSCCTRL)
-//     <o2.0..4>   DIVSEL: Select Divider for Fclkana
-//                     <i> wdt_osc_clk = Fclkana/ (2 * (1 + DIVSEL))
-//                   <0-31>
-//     <o2.5..8>   FREQSEL: Select Watchdog Oscillator Analog Output Frequency (Fclkana)
-//                   <0=> Undefined
-//                   <1=> 0.5 MHz
-//                   <2=> 0.8 MHz
-//                   <3=> 1.1 MHz
-//                   <4=> 1.4 MHz
-//                   <5=> 1.6 MHz
-//                   <6=> 1.8 MHz
-//                   <7=> 2.0 MHz
-//                   <8=> 2.2 MHz
-//                   <9=> 2.4 MHz
-//                   <10=> 2.6 MHz
-//                   <11=> 2.7 MHz
-//                   <12=> 2.9 MHz
-//                   <13=> 3.1 MHz
-//                   <14=> 3.2 MHz
-//                   <15=> 3.4 MHz
-//   </h>
-//
-//   <h> System PLL Control Register (SYSPLLCTRL)
-//                   <i> F_clkout = M * F_clkin = F_CCO / (2 * P)
-//                   <i> F_clkin must be in the range of  10 MHz to  25 MHz
-//                   <i> F_CCO   must be in the range of 156 MHz to 320 MHz
-//     <o3.0..4>   MSEL: Feedback Divider Selection
-//                     <i> M = MSEL + 1
-//                   <0-31>
-//     <o3.5..6>   PSEL: Post Divider Selection
-//                   <0=> P = 1
-//                   <1=> P = 2
-//                   <2=> P = 4
-//                   <3=> P = 8
-//   </h>
-//
-//   <h> System PLL Clock Source Select Register (SYSPLLCLKSEL)
-//     <o4.0..1>   SEL: System PLL Clock Source
-//                   <0=> IRC Oscillator
-//                   <1=> System Oscillator
-//                   <2=> Reserved
-//                   <3=> CLKIN pin
-//   </h>
-//
-//   <h> Main Clock Source Select Register (MAINCLKSEL)
-//     <o5.0..1>   SEL: Clock Source for Main Clock
-//                   <0=> IRC Oscillator
-//                   <1=> Input Clock to System PLL
-//                   <2=> WDT Oscillator
-//                   <3=> System PLL Clock Out
-//   </h>
-//
-//   <h> System AHB Clock Divider Register (SYSAHBCLKDIV)
-//     <o6.0..7>   DIV: System AHB Clock Divider
-//                     <i> Divides main clock to provide system clock to core, memories, and peripherals.
-//                     <i> 0 = is disabled
-//                   <0-255>
-//   </h>
-// </e>
-*/
-#define CLOCK_SETUP           1
-#define SYSOSCCTRL_Val        0x00000000              // Reset: 0x000
-#define WDTOSCCTRL_Val        0x00000000              // Reset: 0x000
-#define SYSPLLCTRL_Val        0x00000041              // Reset: 0x000
-#define SYSPLLCLKSEL_Val      0x00000000              // Reset: 0x000
-#define MAINCLKSEL_Val        0x00000003              // Reset: 0x000
-#define SYSAHBCLKDIV_Val      0x00000001              // Reset: 0x001
-
-/*
-//-------- <<< end of configuration section >>> ------------------------------
-*/
-
-/*----------------------------------------------------------------------------
-  Check the register settings
- *----------------------------------------------------------------------------*/
-#define CHECK_RANGE(val, min, max)                ((val < min) || (val > max))
-#define CHECK_RSVD(val, mask)                     (val & mask)
-
-/* Clock Configuration -------------------------------------------------------*/
-#if (CHECK_RSVD((SYSOSCCTRL_Val),  ~0x00000003))
-   #error "SYSOSCCTRL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((WDTOSCCTRL_Val),  ~0x000001FF))
-   #error "WDTOSCCTRL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RANGE((SYSPLLCLKSEL_Val), 0, 3))
-   #error "SYSPLLCLKSEL: Value out of range!"
-#endif
-
-#if (CHECK_RSVD((SYSPLLCTRL_Val),  ~0x000001FF))
-   #error "SYSPLLCTRL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((MAINCLKSEL_Val),  ~0x00000003))
-   #error "MAINCLKSEL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RANGE((SYSAHBCLKDIV_Val), 0, 255))
-   #error "SYSAHBCLKDIV: Value out of range!"
-#endif
-
-
-/*----------------------------------------------------------------------------
-  DEFINES
- *----------------------------------------------------------------------------*/
-
-/*----------------------------------------------------------------------------
-  Define clocks
- *----------------------------------------------------------------------------*/
-#define __XTAL            (12000000UL)    /* Oscillator frequency             */
-#define __SYS_OSC_CLK     (    __XTAL)    /* Main oscillator frequency        */
-#define __IRC_OSC_CLK     (12000000UL)    /* Internal RC oscillator frequency */
-#define __CLKIN_CLK       (12000000UL)    /* CLKIN pin frequency              */
-
-
-#define __FREQSEL   ((WDTOSCCTRL_Val >> 5) & 0x0F)
-#define __DIVSEL   (((WDTOSCCTRL_Val & 0x1F) << 1) + 2)
-
-#if (CLOCK_SETUP)                         /* Clock Setup              */
-  #if  (__FREQSEL ==  0)
-    #define __WDT_OSC_CLK        ( 0)                  /* undefined */
-  #elif (__FREQSEL ==  1)
-    #define __WDT_OSC_CLK        ( 500000 / __DIVSEL)
-  #elif (__FREQSEL ==  2)
-    #define __WDT_OSC_CLK        ( 800000 / __DIVSEL)
-  #elif (__FREQSEL ==  3)
-    #define __WDT_OSC_CLK        (1100000 / __DIVSEL)
-  #elif (__FREQSEL ==  4)
-    #define __WDT_OSC_CLK        (1400000 / __DIVSEL)
-  #elif (__FREQSEL ==  5)
-    #define __WDT_OSC_CLK        (1600000 / __DIVSEL)
-  #elif (__FREQSEL ==  6)
-    #define __WDT_OSC_CLK        (1800000 / __DIVSEL)
-  #elif (__FREQSEL ==  7)
-    #define __WDT_OSC_CLK        (2000000 / __DIVSEL)
-  #elif (__FREQSEL ==  8)
-    #define __WDT_OSC_CLK        (2200000 / __DIVSEL)
-  #elif (__FREQSEL ==  9)
-    #define __WDT_OSC_CLK        (2400000 / __DIVSEL)
-  #elif (__FREQSEL == 10)
-    #define __WDT_OSC_CLK        (2600000 / __DIVSEL)
-  #elif (__FREQSEL == 11)
-    #define __WDT_OSC_CLK        (2700000 / __DIVSEL)
-  #elif (__FREQSEL == 12)
-    #define __WDT_OSC_CLK        (2900000 / __DIVSEL)
-  #elif (__FREQSEL == 13)
-    #define __WDT_OSC_CLK        (3100000 / __DIVSEL)
-  #elif (__FREQSEL == 14)
-    #define __WDT_OSC_CLK        (3200000 / __DIVSEL)
-  #else
-    #define __WDT_OSC_CLK        (3400000 / __DIVSEL)
-  #endif
-
-  /* sys_pllclkin calculation */
-  #if   ((SYSPLLCLKSEL_Val & 0x03) == 0)
-    #define __SYS_PLLCLKIN           (__IRC_OSC_CLK)
-  #elif ((SYSPLLCLKSEL_Val & 0x03) == 1)
-    #define __SYS_PLLCLKIN           (__SYS_OSC_CLK)
-  #elif ((SYSPLLCLKSEL_Val & 0x03) == 3)
-    #define __SYS_PLLCLKIN           (__CLKIN_CLK)
-  #else
-    #define __SYS_PLLCLKIN           (0)
-  #endif
-
-  #define  __SYS_PLLCLKOUT         (__SYS_PLLCLKIN * ((SYSPLLCTRL_Val & 0x01F) + 1))
-
-  /* main clock calculation */
-  #if   ((MAINCLKSEL_Val & 0x03) == 0)
-    #define __MAIN_CLOCK             (__IRC_OSC_CLK)
-  #elif ((MAINCLKSEL_Val & 0x03) == 1)
-    #define __MAIN_CLOCK             (__SYS_PLLCLKIN)
-  #elif ((MAINCLKSEL_Val & 0x03) == 2)
-    #if (__FREQSEL ==  0)
-      #error "MAINCLKSEL: WDT Oscillator selected but FREQSEL is undefined!"
-    #else
-      #define __MAIN_CLOCK           (__WDT_OSC_CLK)
-    #endif
-  #elif ((MAINCLKSEL_Val & 0x03) == 3)
-    #define __MAIN_CLOCK             (__SYS_PLLCLKOUT)
-  #else
-    #define __MAIN_CLOCK             (0)
-  #endif
-
-  #define __SYSTEM_CLOCK             (__MAIN_CLOCK / SYSAHBCLKDIV_Val)
-
-#else
-  #define __SYSTEM_CLOCK             (__IRC_OSC_CLK)
-#endif  // CLOCK_SETUP
-
-
-/*----------------------------------------------------------------------------
-  Clock Variable definitions
- *----------------------------------------------------------------------------*/
-uint32_t SystemCoreClock = __SYSTEM_CLOCK;/*!< System Clock Frequency (Core Clock)*/
-
-
-/*----------------------------------------------------------------------------
-  Clock functions
- *----------------------------------------------------------------------------*/
-void SystemCoreClockUpdate (void)            /* Get Core Clock Frequency      */
-{
-  uint32_t wdt_osc = 0;
-
-  /* Determine clock frequency according to clock register values             */
-  switch ((LPC_SYSCON->WDTOSCCTRL >> 5) & 0x0F) {
-    case 0:  wdt_osc =       0; break;
-    case 1:  wdt_osc =  500000; break;
-    case 2:  wdt_osc =  800000; break;
-    case 3:  wdt_osc = 1100000; break;
-    case 4:  wdt_osc = 1400000; break;
-    case 5:  wdt_osc = 1600000; break;
-    case 6:  wdt_osc = 1800000; break;
-    case 7:  wdt_osc = 2000000; break;
-    case 8:  wdt_osc = 2200000; break;
-    case 9:  wdt_osc = 2400000; break;
-    case 10: wdt_osc = 2600000; break;
-    case 11: wdt_osc = 2700000; break;
-    case 12: wdt_osc = 2900000; break;
-    case 13: wdt_osc = 3100000; break;
-    case 14: wdt_osc = 3200000; break;
-    case 15: wdt_osc = 3400000; break;
-  }
-  wdt_osc /= ((LPC_SYSCON->WDTOSCCTRL & 0x1F) << 1) + 2;
-
-  switch (LPC_SYSCON->MAINCLKSEL & 0x03) {
-    case 0:                             /* Internal RC oscillator             */
-      SystemCoreClock = __IRC_OSC_CLK;
-      break;
-    case 1:                             /* Input Clock to System PLL          */
-      switch (LPC_SYSCON->SYSPLLCLKSEL & 0x03) {
-          case 0:                       /* Internal RC oscillator             */
-            SystemCoreClock = __IRC_OSC_CLK;
-            break;
-          case 1:                       /* System oscillator                  */
-            SystemCoreClock = __SYS_OSC_CLK;
-            break;
-          case 2:                       /* Reserved                           */
-            SystemCoreClock = 0;
-            break;
-          case 3:                       /* CLKIN pin                          */
-            SystemCoreClock = __CLKIN_CLK;
-            break;
-      }
-      break;
-    case 2:                             /* WDT Oscillator                     */
-      SystemCoreClock = wdt_osc;
-      break;
-    case 3:                             /* System PLL Clock Out               */
-      switch (LPC_SYSCON->SYSPLLCLKSEL & 0x03) {
-          case 0:                       /* Internal RC oscillator             */
-            SystemCoreClock = __IRC_OSC_CLK * ((LPC_SYSCON->SYSPLLCTRL & 0x01F) + 1);
-            break;
-          case 1:                       /* System oscillator                  */
-            SystemCoreClock = __SYS_OSC_CLK * ((LPC_SYSCON->SYSPLLCTRL & 0x01F) + 1);
-            break;
-          case 2:                       /* Reserved                           */
-            SystemCoreClock = 0;
-            break;
-          case 3:                       /* CLKIN pin                          */
-            SystemCoreClock = __CLKIN_CLK * ((LPC_SYSCON->SYSPLLCTRL & 0x01F) + 1);
-            break;
-      }
-      break;
-  }
-
-  SystemCoreClock /= LPC_SYSCON->SYSAHBCLKDIV;
-
-}
-
-/**
- * Initialize the system
- *
- * @param  none
- * @return none
- *
- * @brief  Setup the microcontroller system.
- *         Initialize the System.
- */
-void SystemInit (void) {
-  volatile uint32_t i;
-
-  /* System clock to the IOCON & the SWM need to be enabled or
-  most of the I/O related peripherals won't work. */
-  LPC_SYSCON->SYSAHBCLKCTRL |= ( (0x1 << 7) | (0x1 << 18) );
-
-#if (CLOCK_SETUP)                                 /* Clock Setup              */
-
-#if ((SYSPLLCLKSEL_Val & 0x03) == 1)
-  LPC_IOCON->PIO0_8 &= ~(0x3 << 3);
-  LPC_IOCON->PIO0_9 &= ~(0x3 << 3);
-  LPC_SWM->PINENABLE0 &= ~(0x3 << 4);
-  LPC_SYSCON->PDRUNCFG     &= ~(0x1 << 5);        /* Power-up System Osc      */
-  LPC_SYSCON->SYSOSCCTRL    = SYSOSCCTRL_Val;
-  for (i = 0; i < 200; i++) __NOP();
-#endif
-#if ((SYSPLLCLKSEL_Val & 0x03) == 3)
-  LPC_IOCON->PIO0_1 &= ~(0x3 << 3);
-  LPC_SWM->PINENABLE0 &= ~(0x1 << 7);
-  for (i = 0; i < 200; i++) __NOP();
-#endif
-
-  LPC_SYSCON->SYSPLLCLKSEL  = SYSPLLCLKSEL_Val;   /* Select PLL Input         */
-  LPC_SYSCON->SYSPLLCLKUEN  = 0x01;               /* Update Clock Source      */
-  while (!(LPC_SYSCON->SYSPLLCLKUEN & 0x01));     /* Wait Until Updated       */
-#if ((MAINCLKSEL_Val & 0x03) == 3)                /* Main Clock is PLL Out    */
-  LPC_SYSCON->SYSPLLCTRL    = SYSPLLCTRL_Val;
-  LPC_SYSCON->PDRUNCFG     &= ~(0x1 << 7);        /* Power-up SYSPLL          */
-  while (!(LPC_SYSCON->SYSPLLSTAT & 0x01));	      /* Wait Until PLL Locked    */
-#endif
-
-#if (((MAINCLKSEL_Val & 0x03) == 2) )
-  LPC_SYSCON->WDTOSCCTRL    = WDTOSCCTRL_Val;
-  LPC_SYSCON->PDRUNCFG     &= ~(0x1 << 6);        /* Power-up WDT Clock       */
-  for (i = 0; i < 200; i++) __NOP();
-#endif
-
-  LPC_SYSCON->MAINCLKSEL    = MAINCLKSEL_Val;     /* Select PLL Clock Output  */
-  LPC_SYSCON->MAINCLKUEN    = 0x01;               /* Update MCLK Clock Source */
-  while (!(LPC_SYSCON->MAINCLKUEN & 0x01));       /* Wait Until Updated       */
-
-  LPC_SYSCON->SYSAHBCLKDIV  = SYSAHBCLKDIV_Val;
-#endif
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC812/TOOLCHAIN_ARM_MICRO/LPC812.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-
-LR_IROM1 0x00000000 0x4000  {    ; load region size_region (32k)
-  ER_IROM1 0x00000000 0x4000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  ; 8_byte_aligned(48 vect * 4 bytes) =  8_byte_aligned(0xC0) = 0xC0
-  ; 8KB - 0xC0 = 0xF40
-  RW_IRAM1 0x100000C0 0xF40  {
-   .ANY (+RW +ZI)
-  }
-}
-
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC812/TOOLCHAIN_ARM_MICRO/startup_LPC8xx.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,211 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_LPC8xx.s
-; * @purpose: CMSIS Cortex-M0+ Core Device Startup File
-; *           for the NXP LPC8xx Device Series
-; * @version: V1.0
-; * @date:    16. Aug. 2012
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; * Copyright (C) 2012 ARM Limited. All rights reserved.
-; * ARM Limited (ARM) is supplying this software for use with Cortex-M0+
-; * processor based microcontrollers.  This file can be freely distributed
-; * within development tools that are supporting such ARM based processors.
-; *
-; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
-; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
-; *
-; *****************************************************************************/
-
-
-; <h> Stack Configuration
-;   <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
-; </h>
-
-Stack_Size      EQU     0x00000200
-
-                AREA    STACK, NOINIT, READWRITE, ALIGN=3
-                EXPORT  __initial_sp
-
-Stack_Mem       SPACE   Stack_Size
-__initial_sp            EQU     0x10001000
-
-
-; <h> Heap Configuration
-;   <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
-; </h>
-
-Heap_Size       EQU     0x00000000
-
-                AREA    HEAP, NOINIT, READWRITE, ALIGN=3
-                EXPORT  __heap_base
-                EXPORT  __heap_limit
-
-__heap_base
-Heap_Mem        SPACE   Heap_Size
-__heap_limit
-
-                PRESERVE8
-                THUMB
-
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-
-__Vectors       DCD     __initial_sp              ; Top of Stack
-                DCD     Reset_Handler             ; Reset Handler
-                DCD     NMI_Handler               ; NMI Handler
-                DCD     HardFault_Handler         ; Hard Fault Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     SVC_Handler               ; SVCall Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     PendSV_Handler            ; PendSV Handler
-                DCD     SysTick_Handler           ; SysTick Handler
-
-                ; External Interrupts
-                DCD     SPI0_IRQHandler             ; SPI0 controller
-                DCD     SPI1_IRQHandler             ; SPI1 controller
-                DCD     0                           ; Reserved
-                DCD     UART0_IRQHandler            ; UART0
-                DCD     UART1_IRQHandler            ; UART1
-                DCD     UART2_IRQHandler            ; UART2
-                DCD     0                           ; Reserved
-                DCD     0                           ; Reserved
-                DCD     I2C_IRQHandler              ; I2C controller
-                DCD     SCT_IRQHandler              ; Smart Counter Timer
-                DCD     MRT_IRQHandler              ; Multi-Rate Timer
-                DCD     CMP_IRQHandler              ; Comparator
-                DCD     WDT_IRQHandler              ; PIO1 (0:11)
-                DCD     BOD_IRQHandler              ; Brown Out Detect
-                DCD     0                           ; Reserved
-                DCD     WKT_IRQHandler              ; Wakeup timer
-                DCD     0                           ; Reserved
-                DCD     0                           ; Reserved
-                DCD     0                           ; Reserved
-                DCD     0                           ; Reserved
-                DCD     0                           ; Reserved
-                DCD     0                           ; Reserved
-                DCD     0                           ; Reserved
-                DCD     0                           ; Reserved
-                DCD     PININT0_IRQHandler          ; PIO INT0
-                DCD     PININT1_IRQHandler         ; PIO INT1
-                DCD     PININT2_IRQHandler         ; PIO INT2
-                DCD     PININT3_IRQHandler         ; PIO INT3
-                DCD     PININT4_IRQHandler         ; PIO INT4
-                DCD     PININT5_IRQHandler         ; PIO INT5
-                DCD     PININT6_IRQHandler         ; PIO INT6
-                DCD     PININT7_IRQHandler         ; PIO INT7
-
-
-                IF      :LNOT::DEF:NO_CRP
-                AREA    |.ARM.__at_0x02FC|, CODE, READONLY
-CRP_Key         DCD     0xFFFFFFFF
-                ENDIF
-
-
-                AREA    |.text|, CODE, READONLY
-
-
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-
-; Dummy Exception Handlers (infinite loops which can be modified)
-; now, under COMMON lpc8xx_nmi.c and lpc8xx_nmi.h, a real NMI handler is created if NMI is enabled
-; for particular peripheral.
-;NMI_Handler     PROC
-;                EXPORT  NMI_Handler               [WEAK]
-;                B       .
-;                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-
-                EXPORT  NMI_Handler               [WEAK]
-                EXPORT  SPI0_IRQHandler           [WEAK]
-                EXPORT  SPI1_IRQHandler           [WEAK]
-                EXPORT  UART0_IRQHandler          [WEAK]
-                EXPORT  UART1_IRQHandler          [WEAK]
-                EXPORT  UART2_IRQHandler          [WEAK]
-                EXPORT  I2C_IRQHandler            [WEAK]
-                EXPORT  SCT_IRQHandler            [WEAK]
-                EXPORT  MRT_IRQHandler            [WEAK]
-                EXPORT  CMP_IRQHandler            [WEAK]
-                EXPORT  WDT_IRQHandler            [WEAK]
-                EXPORT  BOD_IRQHandler            [WEAK]
-
-                EXPORT  WKT_IRQHandler            [WEAK]
-
-                EXPORT  PININT0_IRQHandler      [WEAK]
-                EXPORT  PININT1_IRQHandler      [WEAK]
-                EXPORT  PININT2_IRQHandler      [WEAK]
-                EXPORT  PININT3_IRQHandler      [WEAK]
-                EXPORT  PININT4_IRQHandler      [WEAK]
-                EXPORT  PININT5_IRQHandler      [WEAK]
-                EXPORT  PININT6_IRQHandler      [WEAK]
-                EXPORT  PININT7_IRQHandler      [WEAK]
-
-NMI_Handler
-SPI0_IRQHandler
-SPI1_IRQHandler
-UART0_IRQHandler
-UART1_IRQHandler
-UART2_IRQHandler
-I2C_IRQHandler
-SCT_IRQHandler
-MRT_IRQHandler
-CMP_IRQHandler
-WDT_IRQHandler
-BOD_IRQHandler
-WKT_IRQHandler
-PININT0_IRQHandler
-PININT1_IRQHandler
-PININT2_IRQHandler
-PININT3_IRQHandler
-PININT4_IRQHandler
-PININT5_IRQHandler
-PININT6_IRQHandler
-PININT7_IRQHandler
-
-                B       .
-
-                ENDP
-
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC812/system_LPC8xx.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,367 +0,0 @@
-/******************************************************************************
- * @file:    system_LPC8xx.c
- * @purpose: CMSIS Cortex-M0+ Device Peripheral Access Layer Source File
- *           for the NXP LPC8xx Device Series
- * @version: V1.0
- * @date:    16. Aug. 2012
- *----------------------------------------------------------------------------
- *
- * Copyright (C) 2012 ARM Limited. All rights reserved.
- *
- * ARM Limited (ARM) is supplying this software for use with Cortex-M0+
- * processor based microcontrollers.  This file can be freely distributed
- * within development tools that are supporting such ARM based processors.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- *
- ******************************************************************************/
-#include <stdint.h>
-#include "LPC8xx.h"
-
-/*
-//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-*/
-
-/*--------------------- Clock Configuration ----------------------------------
-//
-// <e> Clock Configuration
-//   <h> System Oscillator Control Register (SYSOSCCTRL)
-//     <o1.0>      BYPASS: System Oscillator Bypass Enable
-//                     <i> If enabled then PLL input (sys_osc_clk) is fed
-//                     <i> directly from XTALIN and XTALOUT pins.
-//     <o1.9>      FREQRANGE: System Oscillator Frequency Range
-//                     <i> Determines frequency range for Low-power oscillator.
-//                   <0=> 1 - 20 MHz
-//                   <1=> 15 - 25 MHz
-//   </h>
-//
-//   <h> Watchdog Oscillator Control Register (WDTOSCCTRL)
-//     <o2.0..4>   DIVSEL: Select Divider for Fclkana
-//                     <i> wdt_osc_clk = Fclkana/ (2 * (1 + DIVSEL))
-//                   <0-31>
-//     <o2.5..8>   FREQSEL: Select Watchdog Oscillator Analog Output Frequency (Fclkana)
-//                   <0=> Undefined
-//                   <1=> 0.5 MHz
-//                   <2=> 0.8 MHz
-//                   <3=> 1.1 MHz
-//                   <4=> 1.4 MHz
-//                   <5=> 1.6 MHz
-//                   <6=> 1.8 MHz
-//                   <7=> 2.0 MHz
-//                   <8=> 2.2 MHz
-//                   <9=> 2.4 MHz
-//                   <10=> 2.6 MHz
-//                   <11=> 2.7 MHz
-//                   <12=> 2.9 MHz
-//                   <13=> 3.1 MHz
-//                   <14=> 3.2 MHz
-//                   <15=> 3.4 MHz
-//   </h>
-//
-//   <h> System PLL Control Register (SYSPLLCTRL)
-//                   <i> F_clkout = M * F_clkin = F_CCO / (2 * P)
-//                   <i> F_clkin must be in the range of  10 MHz to  25 MHz
-//                   <i> F_CCO   must be in the range of 156 MHz to 320 MHz
-//     <o3.0..4>   MSEL: Feedback Divider Selection
-//                     <i> M = MSEL + 1
-//                   <0-31>
-//     <o3.5..6>   PSEL: Post Divider Selection
-//                   <0=> P = 1
-//                   <1=> P = 2
-//                   <2=> P = 4
-//                   <3=> P = 8
-//   </h>
-//
-//   <h> System PLL Clock Source Select Register (SYSPLLCLKSEL)
-//     <o4.0..1>   SEL: System PLL Clock Source
-//                   <0=> IRC Oscillator
-//                   <1=> System Oscillator
-//                   <2=> Reserved
-//                   <3=> CLKIN pin
-//   </h>
-//
-//   <h> Main Clock Source Select Register (MAINCLKSEL)
-//     <o5.0..1>   SEL: Clock Source for Main Clock
-//                   <0=> IRC Oscillator
-//                   <1=> Input Clock to System PLL
-//                   <2=> WDT Oscillator
-//                   <3=> System PLL Clock Out
-//   </h>
-//
-//   <h> System AHB Clock Divider Register (SYSAHBCLKDIV)
-//     <o6.0..7>   DIV: System AHB Clock Divider
-//                     <i> Divides main clock to provide system clock to core, memories, and peripherals.
-//                     <i> 0 = is disabled
-//                   <0-255>
-//   </h>
-// </e>
-*/
-#define CLOCK_SETUP           1
-#define SYSOSCCTRL_Val        0x00000000              // Reset: 0x000
-#define WDTOSCCTRL_Val        0x00000000              // Reset: 0x000
-#define SYSPLLCTRL_Val        0x00000041              // Reset: 0x000
-#define SYSPLLCLKSEL_Val      0x00000000              // Reset: 0x000
-#define MAINCLKSEL_Val        0x00000000              // Reset: 0x000
-#define SYSAHBCLKDIV_Val      0x00000001              // Reset: 0x001
-
-/*
-//-------- <<< end of configuration section >>> ------------------------------
-*/
-
-/*----------------------------------------------------------------------------
-  Check the register settings
- *----------------------------------------------------------------------------*/
-#define CHECK_RANGE(val, min, max)                ((val < min) || (val > max))
-#define CHECK_RSVD(val, mask)                     (val & mask)
-
-/* Clock Configuration -------------------------------------------------------*/
-#if (CHECK_RSVD((SYSOSCCTRL_Val),  ~0x00000003))
-   #error "SYSOSCCTRL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((WDTOSCCTRL_Val),  ~0x000001FF))
-   #error "WDTOSCCTRL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RANGE((SYSPLLCLKSEL_Val), 0, 3))
-   #error "SYSPLLCLKSEL: Value out of range!"
-#endif
-
-#if (CHECK_RSVD((SYSPLLCTRL_Val),  ~0x000001FF))
-   #error "SYSPLLCTRL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RSVD((MAINCLKSEL_Val),  ~0x00000003))
-   #error "MAINCLKSEL: Invalid values of reserved bits!"
-#endif
-
-#if (CHECK_RANGE((SYSAHBCLKDIV_Val), 0, 255))
-   #error "SYSAHBCLKDIV: Value out of range!"
-#endif
-
-
-/*----------------------------------------------------------------------------
-  DEFINES
- *----------------------------------------------------------------------------*/
-
-/*----------------------------------------------------------------------------
-  Define clocks
- *----------------------------------------------------------------------------*/
-#define __XTAL            (12000000UL)    /* Oscillator frequency             */
-#define __SYS_OSC_CLK     (    __XTAL)    /* Main oscillator frequency        */
-#define __IRC_OSC_CLK     (12000000UL)    /* Internal RC oscillator frequency */
-#define __CLKIN_CLK       (12000000UL)    /* CLKIN pin frequency              */
-
-
-#define __FREQSEL   ((WDTOSCCTRL_Val >> 5) & 0x0F)
-#define __DIVSEL   (((WDTOSCCTRL_Val & 0x1F) << 1) + 2)
-
-#if (CLOCK_SETUP)                         /* Clock Setup              */
-  #if  (__FREQSEL ==  0)
-    #define __WDT_OSC_CLK        ( 0)                  /* undefined */
-  #elif (__FREQSEL ==  1)
-    #define __WDT_OSC_CLK        ( 500000 / __DIVSEL)
-  #elif (__FREQSEL ==  2)
-    #define __WDT_OSC_CLK        ( 800000 / __DIVSEL)
-  #elif (__FREQSEL ==  3)
-    #define __WDT_OSC_CLK        (1100000 / __DIVSEL)
-  #elif (__FREQSEL ==  4)
-    #define __WDT_OSC_CLK        (1400000 / __DIVSEL)
-  #elif (__FREQSEL ==  5)
-    #define __WDT_OSC_CLK        (1600000 / __DIVSEL)
-  #elif (__FREQSEL ==  6)
-    #define __WDT_OSC_CLK        (1800000 / __DIVSEL)
-  #elif (__FREQSEL ==  7)
-    #define __WDT_OSC_CLK        (2000000 / __DIVSEL)
-  #elif (__FREQSEL ==  8)
-    #define __WDT_OSC_CLK        (2200000 / __DIVSEL)
-  #elif (__FREQSEL ==  9)
-    #define __WDT_OSC_CLK        (2400000 / __DIVSEL)
-  #elif (__FREQSEL == 10)
-    #define __WDT_OSC_CLK        (2600000 / __DIVSEL)
-  #elif (__FREQSEL == 11)
-    #define __WDT_OSC_CLK        (2700000 / __DIVSEL)
-  #elif (__FREQSEL == 12)
-    #define __WDT_OSC_CLK        (2900000 / __DIVSEL)
-  #elif (__FREQSEL == 13)
-    #define __WDT_OSC_CLK        (3100000 / __DIVSEL)
-  #elif (__FREQSEL == 14)
-    #define __WDT_OSC_CLK        (3200000 / __DIVSEL)
-  #else
-    #define __WDT_OSC_CLK        (3400000 / __DIVSEL)
-  #endif
-
-  /* sys_pllclkin calculation */
-  #if   ((SYSPLLCLKSEL_Val & 0x03) == 0)
-    #define __SYS_PLLCLKIN           (__IRC_OSC_CLK)
-  #elif ((SYSPLLCLKSEL_Val & 0x03) == 1)
-    #define __SYS_PLLCLKIN           (__SYS_OSC_CLK)
-  #elif ((SYSPLLCLKSEL_Val & 0x03) == 3)
-    #define __SYS_PLLCLKIN           (__CLKIN_CLK)
-  #else
-    #define __SYS_PLLCLKIN           (0)
-  #endif
-
-  #define  __SYS_PLLCLKOUT         (__SYS_PLLCLKIN * ((SYSPLLCTRL_Val & 0x01F) + 1))
-
-  /* main clock calculation */
-  #if   ((MAINCLKSEL_Val & 0x03) == 0)
-    #define __MAIN_CLOCK             (__IRC_OSC_CLK)
-  #elif ((MAINCLKSEL_Val & 0x03) == 1)
-    #define __MAIN_CLOCK             (__SYS_PLLCLKIN)
-  #elif ((MAINCLKSEL_Val & 0x03) == 2)
-    #if (__FREQSEL ==  0)
-      #error "MAINCLKSEL: WDT Oscillator selected but FREQSEL is undefined!"
-    #else
-      #define __MAIN_CLOCK           (__WDT_OSC_CLK)
-    #endif
-  #elif ((MAINCLKSEL_Val & 0x03) == 3)
-    #define __MAIN_CLOCK             (__SYS_PLLCLKOUT)
-  #else
-    #define __MAIN_CLOCK             (0)
-  #endif
-
-  #define __SYSTEM_CLOCK             (__MAIN_CLOCK / SYSAHBCLKDIV_Val)
-
-#else
-  #define __SYSTEM_CLOCK             (__IRC_OSC_CLK)
-#endif  // CLOCK_SETUP
-
-
-/*----------------------------------------------------------------------------
-  Clock Variable definitions
- *----------------------------------------------------------------------------*/
-uint32_t SystemCoreClock = __SYSTEM_CLOCK;/*!< System Clock Frequency (Core Clock)*/
-
-
-/*----------------------------------------------------------------------------
-  Clock functions
- *----------------------------------------------------------------------------*/
-void SystemCoreClockUpdate (void)            /* Get Core Clock Frequency      */
-{
-  uint32_t wdt_osc = 0;
-
-  /* Determine clock frequency according to clock register values             */
-  switch ((LPC_SYSCON->WDTOSCCTRL >> 5) & 0x0F) {
-    case 0:  wdt_osc =       0; break;
-    case 1:  wdt_osc =  500000; break;
-    case 2:  wdt_osc =  800000; break;
-    case 3:  wdt_osc = 1100000; break;
-    case 4:  wdt_osc = 1400000; break;
-    case 5:  wdt_osc = 1600000; break;
-    case 6:  wdt_osc = 1800000; break;
-    case 7:  wdt_osc = 2000000; break;
-    case 8:  wdt_osc = 2200000; break;
-    case 9:  wdt_osc = 2400000; break;
-    case 10: wdt_osc = 2600000; break;
-    case 11: wdt_osc = 2700000; break;
-    case 12: wdt_osc = 2900000; break;
-    case 13: wdt_osc = 3100000; break;
-    case 14: wdt_osc = 3200000; break;
-    case 15: wdt_osc = 3400000; break;
-  }
-  wdt_osc /= ((LPC_SYSCON->WDTOSCCTRL & 0x1F) << 1) + 2;
-
-  switch (LPC_SYSCON->MAINCLKSEL & 0x03) {
-    case 0:                             /* Internal RC oscillator             */
-      SystemCoreClock = __IRC_OSC_CLK;
-      break;
-    case 1:                             /* Input Clock to System PLL          */
-      switch (LPC_SYSCON->SYSPLLCLKSEL & 0x03) {
-          case 0:                       /* Internal RC oscillator             */
-            SystemCoreClock = __IRC_OSC_CLK;
-            break;
-          case 1:                       /* System oscillator                  */
-            SystemCoreClock = __SYS_OSC_CLK;
-            break;
-          case 2:                       /* Reserved                           */
-            SystemCoreClock = 0;
-            break;
-          case 3:                       /* CLKIN pin                          */
-            SystemCoreClock = __CLKIN_CLK;
-            break;
-      }
-      break;
-    case 2:                             /* WDT Oscillator                     */
-      SystemCoreClock = wdt_osc;
-      break;
-    case 3:                             /* System PLL Clock Out               */
-      switch (LPC_SYSCON->SYSPLLCLKSEL & 0x03) {
-          case 0:                       /* Internal RC oscillator             */
-            SystemCoreClock = __IRC_OSC_CLK * ((LPC_SYSCON->SYSPLLCTRL & 0x01F) + 1);
-            break;
-          case 1:                       /* System oscillator                  */
-            SystemCoreClock = __SYS_OSC_CLK * ((LPC_SYSCON->SYSPLLCTRL & 0x01F) + 1);
-            break;
-          case 2:                       /* Reserved                           */
-            SystemCoreClock = 0;
-            break;
-          case 3:                       /* CLKIN pin                          */
-            SystemCoreClock = __CLKIN_CLK * ((LPC_SYSCON->SYSPLLCTRL & 0x01F) + 1);
-            break;
-      }
-      break;
-  }
-
-  SystemCoreClock /= LPC_SYSCON->SYSAHBCLKDIV;
-
-}
-
-/**
- * Initialize the system
- *
- * @param  none
- * @return none
- *
- * @brief  Setup the microcontroller system.
- *         Initialize the System.
- */
-void SystemInit (void) {
-  volatile uint32_t i;
-
-  /* System clock to the IOCON & the SWM need to be enabled or
-  most of the I/O related peripherals won't work. */
-  LPC_SYSCON->SYSAHBCLKCTRL |= ( (0x1 << 7) | (0x1 << 18) );
-
-#if (CLOCK_SETUP)                                 /* Clock Setup              */
-
-#if ((SYSPLLCLKSEL_Val & 0x03) == 1)
-  LPC_IOCON->PIO0_8 &= ~(0x3 << 3);
-  LPC_IOCON->PIO0_9 &= ~(0x3 << 3);
-  LPC_SWM->PINENABLE0 &= ~(0x3 << 4);
-  LPC_SYSCON->PDRUNCFG     &= ~(0x1 << 5);        /* Power-up System Osc      */
-  LPC_SYSCON->SYSOSCCTRL    = SYSOSCCTRL_Val;
-  for (i = 0; i < 200; i++) __NOP();
-#endif
-#if ((SYSPLLCLKSEL_Val & 0x03) == 3)
-  LPC_IOCON->PIO0_1 &= ~(0x3 << 3);
-  LPC_SWM->PINENABLE0 &= ~(0x1 << 7);
-  for (i = 0; i < 200; i++) __NOP();
-#endif
-
-  LPC_SYSCON->SYSPLLCLKSEL  = SYSPLLCLKSEL_Val;   /* Select PLL Input         */
-  LPC_SYSCON->SYSPLLCLKUEN  = 0x01;               /* Update Clock Source      */
-  while (!(LPC_SYSCON->SYSPLLCLKUEN & 0x01));     /* Wait Until Updated       */
-#if ((MAINCLKSEL_Val & 0x03) == 3)                /* Main Clock is PLL Out    */
-  LPC_SYSCON->SYSPLLCTRL    = SYSPLLCTRL_Val;
-  LPC_SYSCON->PDRUNCFG     &= ~(0x1 << 7);        /* Power-up SYSPLL          */
-  while (!(LPC_SYSCON->SYSPLLSTAT & 0x01));	      /* Wait Until PLL Locked    */
-#endif
-
-#if (((MAINCLKSEL_Val & 0x03) == 2) )
-  LPC_SYSCON->WDTOSCCTRL    = WDTOSCCTRL_Val;
-  LPC_SYSCON->PDRUNCFG     &= ~(0x1 << 6);        /* Power-up WDT Clock       */
-  for (i = 0; i < 200; i++) __NOP();
-#endif
-
-  LPC_SYSCON->MAINCLKSEL    = MAINCLKSEL_Val;     /* Select PLL Clock Output  */
-  LPC_SYSCON->MAINCLKUEN    = 0x01;               /* Update MCLK Clock Source */
-  while (!(LPC_SYSCON->MAINCLKUEN & 0x01));       /* Wait Until Updated       */
-
-  LPC_SYSCON->SYSAHBCLKDIV  = SYSAHBCLKDIV_Val;
-#endif
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/LPC8xx.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,687 +0,0 @@
-/****************************************************************************
- *   $Id:: LPC8xx.h 6437 2012-10-31 11:06:06Z dep00694                     $
- *   Project: NXP LPC8xx software example
- *
- *   Description:
- *     CMSIS Cortex-M0+ Core Peripheral Access Layer Header File for
- *     NXP LPC800 Device Series
- *
- ****************************************************************************
- * 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.
-
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, under NXP Semiconductors'
- * relevant copyright in the software, without fee, provided 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 __LPC8xx_H__
-#define __LPC8xx_H__
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-/** @addtogroup LPC8xx_Definitions LPC8xx Definitions
-  This file defines all structures and symbols for LPC8xx:
-    - Registers and bitfields
-    - peripheral base address
-    - PIO definitions
-  @{
-*/
-
-
-/******************************************************************************/
-/*                Processor and Core Peripherals                              */
-/******************************************************************************/
-/** @addtogroup LPC8xx_CMSIS LPC8xx CMSIS Definitions
-  Configuration of the Cortex-M0+ Processor and Core Peripherals
-  @{
-*/
-
-/*
- * ==========================================================================
- * ---------- Interrupt Number Definition -----------------------------------
- * ==========================================================================
- */
-typedef enum IRQn
-{
-/******  Cortex-M0 Processor Exceptions Numbers ***************************************************/
-  Reset_IRQn                    = -15,    /*!< 1 Reset Vector, invoked on Power up and warm reset*/
-  NonMaskableInt_IRQn           = -14,    /*!< 2 Non Maskable Interrupt                           */
-  HardFault_IRQn                = -13,    /*!< 3 Cortex-M0 Hard Fault Interrupt                   */
-  SVCall_IRQn                   = -5,     /*!< 11 Cortex-M0 SV Call Interrupt                     */
-  PendSV_IRQn                   = -2,     /*!< 14 Cortex-M0 Pend SV Interrupt                     */
-  SysTick_IRQn                  = -1,     /*!< 15 Cortex-M0 System Tick Interrupt                 */
-
-/******  LPC8xx Specific Interrupt Numbers ********************************************************/
-  SPI0_IRQn                     = 0,        /*!< SPI0                                             */
-  SPI1_IRQn                     = 1,        /*!< SPI1                                             */
-  Reserved0_IRQn                = 2,        /*!< Reserved Interrupt                               */
-  UART0_IRQn                    = 3,        /*!< USART0                                            */
-  UART1_IRQn                    = 4,        /*!< USART1                                            */
-  UART2_IRQn                    = 5,        /*!< USART2                                            */
-  Reserved1_IRQn                = 6,        /*!< Reserved Interrupt                               */
-  Reserved2_IRQn                = 7,        /*!< Reserved Interrupt                               */
-  I2C_IRQn                      = 8,        /*!< I2C                                              */
-  SCT_IRQn                      = 9,        /*!< SCT                                              */
-  MRT_IRQn                      = 10,       /*!< MRT                                              */
-  CMP_IRQn                      = 11,       /*!< CMP                                              */
-  WDT_IRQn                      = 12,      /*!< WDT                                              */
-  BOD_IRQn                      = 13,       /*!< BOD                                              */
-  Reserved3_IRQn                = 14,       /*!< Reserved Interrupt                               */
-  WKT_IRQn                      = 15,       /*!< WKT Interrupt                                    */
-  Reserved4_IRQn                = 16,       /*!< Reserved Interrupt                               */
-  Reserved5_IRQn                = 17,       /*!< Reserved Interrupt                               */
-  Reserved6_IRQn                = 18,       /*!< Reserved Interrupt                               */
-  Reserved7_IRQn                = 19,       /*!< Reserved Interrupt                               */
-  Reserved8_IRQn                = 20,       /*!< Reserved Interrupt                               */
-  Reserved9_IRQn                = 21,       /*!< Reserved Interrupt                               */
-  Reserved10_IRQn               = 22,       /*!< Reserved Interrupt                               */
-  Reserved11_IRQn               = 23,       /*!< Reserved Interrupt                               */
-  PININT0_IRQn               	  = 24,       /*!< External Interrupt 0                             */
-  PININT1_IRQn                  = 25,       /*!< External Interrupt 1                             */
-  PININT2_IRQn                  = 26,       /*!< External Interrupt 2                             */
-  PININT3_IRQn                  = 27,       /*!< External Interrupt 3                             */
-  PININT4_IRQn                  = 28,       /*!< External Interrupt 4                             */
-  PININT5_IRQn                  = 29,       /*!< External Interrupt 5                             */
-  PININT6_IRQn                  = 30,       /*!< External Interrupt 6                             */
-  PININT7_IRQn                  = 31,       /*!< External Interrupt 7                             */
-} IRQn_Type;
-
-/*
- * ==========================================================================
- * ----------- Processor and Core Peripheral Section ------------------------
- * ==========================================================================
- */
-
-/* Configuration of the Cortex-M0+ Processor and Core Peripherals */
-#define __MPU_PRESENT             0         /*!< MPU present or not                               */
-#define __VTOR_PRESENT            1         /**< Defines if an VTOR is present or not */
-#define __NVIC_PRIO_BITS          2         /*!< Number of Bits used for Priority Levels          */
-#define __Vendor_SysTickConfig    0         /*!< Set to 1 if different SysTick Config is used     */
-
-/*@}*/ /* end of group LPC8xx_CMSIS */
-
-
-#include "core_cm0plus.h"                  /* Cortex-M0+ processor and core peripherals          */
-#include "system_LPC8xx.h"                 /* System Header                                      */
-
-
-/******************************************************************************/
-/*                Device Specific Peripheral Registers structures             */
-/******************************************************************************/
-
-#if defined ( __CC_ARM   )
-#pragma anon_unions
-#endif
-
-/*------------- System Control (SYSCON) --------------------------------------*/
-/** @addtogroup LPC8xx_SYSCON LPC8xx System Control Block
-  @{
-*/
-typedef struct
-{
-  __IO uint32_t SYSMEMREMAP;            /*!< Offset: 0x000 System memory remap (R/W) */
-  __IO uint32_t PRESETCTRL;             /*!< Offset: 0x004 Peripheral reset control (R/W) */
-  __IO uint32_t SYSPLLCTRL;             /*!< Offset: 0x008 System PLL control (R/W) */
-  __IO uint32_t SYSPLLSTAT;             /*!< Offset: 0x00C System PLL status (R/W ) */
-       uint32_t RESERVED0[4];
-
-  __IO uint32_t SYSOSCCTRL;             /*!< Offset: 0x020 System oscillator control (R/W) */
-  __IO uint32_t WDTOSCCTRL;             /*!< Offset: 0x024 Watchdog oscillator control (R/W) */
-       uint32_t RESERVED1[2];
-  __IO uint32_t SYSRSTSTAT;             /*!< Offset: 0x030 System reset status Register (R/W ) */
-       uint32_t RESERVED2[3];
-  __IO uint32_t SYSPLLCLKSEL;           /*!< Offset: 0x040 System PLL clock source select (R/W) */
-  __IO uint32_t SYSPLLCLKUEN;           /*!< Offset: 0x044 System PLL clock source update enable (R/W) */
-       uint32_t RESERVED3[10];
-
-  __IO uint32_t MAINCLKSEL;             /*!< Offset: 0x070 Main clock source select (R/W) */
-  __IO uint32_t MAINCLKUEN;             /*!< Offset: 0x074 Main clock source update enable (R/W) */
-  __IO uint32_t SYSAHBCLKDIV;           /*!< Offset: 0x078 System AHB clock divider (R/W) */
-       uint32_t RESERVED4[1];
-
-  __IO uint32_t SYSAHBCLKCTRL;          /*!< Offset: 0x080 System AHB clock control (R/W) */
-       uint32_t RESERVED5[4];
-  __IO uint32_t UARTCLKDIV;             /*!< Offset: 0x094 UART clock divider (R/W) */
-       uint32_t RESERVED6[18];
-
-  __IO uint32_t CLKOUTSEL;              /*!< Offset: 0x0E0 CLKOUT clock source select (R/W) */
-  __IO uint32_t CLKOUTUEN;              /*!< Offset: 0x0E4 CLKOUT clock source update enable (R/W) */
-  __IO uint32_t CLKOUTDIV;              /*!< Offset: 0x0E8 CLKOUT clock divider (R/W) */
-       uint32_t RESERVED7;
-  __IO uint32_t UARTFRGDIV;             /*!< Offset: 0x0F0 UART fractional divider SUB(R/W) */
-  __IO uint32_t UARTFRGMULT;             /*!< Offset: 0x0F4 UART fractional divider ADD(R/W) */
-       uint32_t RESERVED8[1];
-  __IO uint32_t EXTTRACECMD;            /*!< (@ 0x400480FC) External trace buffer command register  */
-  __IO uint32_t PIOPORCAP0;             /*!< Offset: 0x100 POR captured PIO status 0 (R/ ) */
-       uint32_t RESERVED9[12];
-  __IO uint32_t IOCONCLKDIV[7];       /*!< (@0x40048134-14C) Peripheral clock x to the IOCON block for programmable glitch filter */
-  __IO uint32_t BODCTRL;                /*!< Offset: 0x150 BOD control (R/W) */
-  __IO uint32_t SYSTCKCAL;              /*!< Offset: 0x154 System tick counter calibration (R/W) */
-       uint32_t RESERVED10[6];
-  __IO uint32_t IRQLATENCY;             /*!< (@ 0x40048170) IRQ delay */
-  __IO uint32_t NMISRC;                 /*!< (@ 0x40048174) NMI Source Control     */
-  __IO uint32_t PINTSEL[8];             /*!< (@ 0x40048178) GPIO Pin Interrupt Select register 0 */
-       uint32_t RESERVED11[27];
-  __IO uint32_t STARTERP0;              /*!< Offset: 0x204 Start logic signal enable Register 0 (R/W) */
-       uint32_t RESERVED12[3];
-  __IO uint32_t STARTERP1;              /*!< Offset: 0x214 Start logic signal enable Register 0 (R/W) */
-       uint32_t RESERVED13[6];
-  __IO uint32_t PDSLEEPCFG;             /*!< Offset: 0x230 Power-down states in Deep-sleep mode (R/W) */
-  __IO uint32_t PDAWAKECFG;             /*!< Offset: 0x234 Power-down states after wake-up (R/W) */
-  __IO uint32_t PDRUNCFG;               /*!< Offset: 0x238 Power-down configuration Register (R/W) */
-       uint32_t RESERVED14[110];
-  __I  uint32_t DEVICE_ID;              /*!< Offset: 0x3F4 Device ID (R/ ) */
-} LPC_SYSCON_TypeDef;
-/*@}*/ /* end of group LPC8xx_SYSCON */
-
-
-/**
-  * @brief Product name title=UM10462 Chapter title=LPC8xx I/O configuration Modification date=3/16/2011 Major revision=0 Minor revision=3  (IOCONFIG)
-  */
-
-typedef struct {                            /*!< (@ 0x40044000) IOCONFIG Structure     */
-  __IO uint32_t PIO0_17;                    /*!< (@ 0x40044000) I/O configuration for pin PIO0_17 */
-  __IO uint32_t PIO0_13;                    /*!< (@ 0x40044004) I/O configuration for pin PIO0_13 */
-  __IO uint32_t PIO0_12;                    /*!< (@ 0x40044008) I/O configuration for pin PIO0_12 */
-  __IO uint32_t PIO0_5;                     /*!< (@ 0x4004400C) I/O configuration for pin PIO0_5 */
-  __IO uint32_t PIO0_4;                     /*!< (@ 0x40044010) I/O configuration for pin PIO0_4 */
-  __IO uint32_t PIO0_3;                     /*!< (@ 0x40044014) I/O configuration for pin PIO0_3 */
-  __IO uint32_t PIO0_2;                     /*!< (@ 0x40044018) I/O configuration for pin PIO0_2 */
-  __IO uint32_t PIO0_11;                    /*!< (@ 0x4004401C) I/O configuration for pin PIO0_11 */
-  __IO uint32_t PIO0_10;                    /*!< (@ 0x40044020) I/O configuration for pin PIO0_10 */
-  __IO uint32_t PIO0_16;                    /*!< (@ 0x40044024) I/O configuration for pin PIO0_16 */
-  __IO uint32_t PIO0_15;                    /*!< (@ 0x40044028) I/O configuration for pin PIO0_15 */
-  __IO uint32_t PIO0_1;                     /*!< (@ 0x4004402C) I/O configuration for pin PIO0_1 */
-  __IO uint32_t Reserved;                   /*!< (@ 0x40044030) I/O configuration for pin (Reserved) */
-  __IO uint32_t PIO0_9;                     /*!< (@ 0x40044034) I/O configuration for pin PIO0_9 */
-  __IO uint32_t PIO0_8;                     /*!< (@ 0x40044038) I/O configuration for pin PIO0_8 */
-  __IO uint32_t PIO0_7;                     /*!< (@ 0x4004403C) I/O configuration for pin PIO0_7 */
-  __IO uint32_t PIO0_6;                     /*!< (@ 0x40044040) I/O configuration for pin PIO0_6 */
-  __IO uint32_t PIO0_0;                     /*!< (@ 0x40044044) I/O configuration for pin PIO0_0 */
-  __IO uint32_t PIO0_14;                    /*!< (@ 0x40044048) I/O configuration for pin PIO0_14 */
-} LPC_IOCON_TypeDef;
-/*@}*/ /* end of group LPC8xx_IOCON */
-
-/**
-  * @brief Product name title=UM10462 Chapter title=LPC8xx Flash programming firmware Major revision=0 Minor revision=3  (FLASHCTRL)
-  */
-typedef struct {                            /*!< (@ 0x40040000) FLASHCTRL Structure    */
-  __I  uint32_t  RESERVED0[4];
-  __IO uint32_t  FLASHCFG;                          /*!< (@ 0x40040010) Flash configuration register                           */
-  __I  uint32_t  RESERVED1[3];
-  __IO uint32_t  FMSSTART;                          /*!< (@ 0x40040020) Signature start address register                       */
-  __IO uint32_t  FMSSTOP;                           /*!< (@ 0x40040024) Signature stop-address register                        */
-  __I  uint32_t  RESERVED2;
-  __I  uint32_t  FMSW0;
-} LPC_FLASHCTRL_TypeDef;
-/*@}*/ /* end of group LPC8xx_FLASHCTRL */
-
-
-/*------------- Power Management Unit (PMU) --------------------------*/
-/** @addtogroup LPC8xx_PMU LPC8xx Power Management Unit
-  @{
-*/
-typedef struct
-{
-  __IO uint32_t PCON;                   /*!< Offset: 0x000 Power control Register (R/W) */
-  __IO uint32_t GPREG0;                 /*!< Offset: 0x004 General purpose Register 0 (R/W) */
-  __IO uint32_t GPREG1;                 /*!< Offset: 0x008 General purpose Register 1 (R/W) */
-  __IO uint32_t GPREG2;                 /*!< Offset: 0x00C General purpose Register 2 (R/W) */
-  __IO uint32_t GPREG3;                 /*!< Offset: 0x010 General purpose Register 3 (R/W) */
-  __IO uint32_t DPDCTRL;                /*!< Offset: 0x014 Deep power-down control register (R/W) */
-} LPC_PMU_TypeDef;
-/*@}*/ /* end of group LPC8xx_PMU */
-
-
-/*------------- Switch Matrix Port --------------------------*/
-/** @addtogroup LPC8xx_SWM LPC8xx Switch Matrix Port
-  @{
-*/
-typedef struct
-{
-  union {
-    __IO uint32_t PINASSIGN[9];
-    struct {
-      __IO uint32_t PINASSIGN0;
-      __IO uint32_t PINASSIGN1;
-      __IO uint32_t PINASSIGN2;
-      __IO uint32_t PINASSIGN3;
-      __IO uint32_t PINASSIGN4;
-      __IO uint32_t PINASSIGN5;
-      __IO uint32_t PINASSIGN6;
-      __IO uint32_t PINASSIGN7;
-      __IO uint32_t PINASSIGN8;
-    };
-  };
-  __I  uint32_t  RESERVED0[103];
-  __IO uint32_t  PINENABLE0;
-} LPC_SWM_TypeDef;
-/*@}*/ /* end of group LPC8xx_SWM */
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                       GPIO_PORT                                      -----
-// ------------------------------------------------------------------------------------------------
-
-/**
-  * @brief Product name title=UM10462 Chapter title=LPC8xx GPIO Modification date=3/17/2011 Major revision=0 Minor revision=3  (GPIO_PORT)
-  */
-
-typedef struct {
-  __IO uint8_t B0[18];                   /*!< (@ 0xA0000000) Byte pin registers port 0 */
-  __I  uint16_t RESERVED0[2039];
-  __IO uint32_t W0[18];                  /*!< (@ 0xA0001000) Word pin registers port 0 */
-       uint32_t RESERVED1[1006];
-  __IO uint32_t DIR0;                          /* 0x2000 */
-       uint32_t RESERVED2[31];
-  __IO uint32_t MASK0;                                  /* 0x2080 */
-       uint32_t RESERVED3[31];
-  __IO uint32_t PIN0;                          /* 0x2100 */
-       uint32_t RESERVED4[31];
-  __IO uint32_t MPIN0;                                   /* 0x2180 */
-       uint32_t RESERVED5[31];
-  __IO uint32_t SET0;                         /* 0x2200 */
-       uint32_t RESERVED6[31];
-  __O  uint32_t CLR0;                         /* 0x2280 */
-       uint32_t RESERVED7[31];
-  __O  uint32_t NOT0;                                    /* 0x2300 */
-
-} LPC_GPIO_PORT_TypeDef;
-
-
-// ------------------------------------------------------------------------------------------------
-// -----                                     PIN_INT                                     -----
-// ------------------------------------------------------------------------------------------------
-
-/**
-  * @brief Product name title=UM10462 Chapter title=LPC8xx GPIO Modification date=3/17/2011 Major revision=0 Minor revision=3  (PIN_INT)
-  */
-
-typedef struct {                            /*!< (@ 0xA0004000) PIN_INT Structure */
-  __IO uint32_t ISEL;                       /*!< (@ 0xA0004000) Pin Interrupt Mode register */
-  __IO uint32_t IENR;                       /*!< (@ 0xA0004004) Pin Interrupt Enable (Rising) register */
-  __IO uint32_t SIENR;                      /*!< (@ 0xA0004008) Set Pin Interrupt Enable (Rising) register */
-  __IO uint32_t CIENR;                      /*!< (@ 0xA000400C) Clear Pin Interrupt Enable (Rising) register */
-  __IO uint32_t IENF;                       /*!< (@ 0xA0004010) Pin Interrupt Enable Falling Edge / Active Level register */
-  __IO uint32_t SIENF;                      /*!< (@ 0xA0004014) Set Pin Interrupt Enable Falling Edge / Active Level register */
-  __IO uint32_t CIENF;                      /*!< (@ 0xA0004018) Clear Pin Interrupt Enable Falling Edge / Active Level address */
-  __IO uint32_t RISE;                       /*!< (@ 0xA000401C) Pin Interrupt Rising Edge register */
-  __IO uint32_t FALL;                       /*!< (@ 0xA0004020) Pin Interrupt Falling Edge register */
-  __IO uint32_t IST;                        /*!< (@ 0xA0004024) Pin Interrupt Status register */
-  __IO uint32_t PMCTRL;                     /*!< (@ 0xA0004028) GPIO pattern match interrupt control register          */
-  __IO uint32_t PMSRC;                      /*!< (@ 0xA000402C) GPIO pattern match interrupt bit-slice source register */
-  __IO uint32_t PMCFG;                      /*!< (@ 0xA0004030) GPIO pattern match interrupt bit slice configuration register */
-} LPC_PIN_INT_TypeDef;
-
-
-/*------------- CRC Engine (CRC) -----------------------------------------*/
-/** @addtogroup LPC8xx_CRC
-  @{
-*/
-typedef struct
-{
-  __IO uint32_t MODE;
-  __IO uint32_t SEED;
-  union {
-  __I  uint32_t SUM;
-  __O  uint32_t WR_DATA_DWORD;
-  __O  uint16_t WR_DATA_WORD;
-       uint16_t RESERVED_WORD;
-  __O  uint8_t WR_DATA_BYTE;
-       uint8_t RESERVED_BYTE[3];
-  };
-} LPC_CRC_TypeDef;
-/*@}*/ /* end of group LPC8xx_CRC */
-
-/*------------- Comparator (CMP) --------------------------------------------------*/
-/** @addtogroup LPC8xx_CMP LPC8xx Comparator
-  @{
-*/
-typedef struct {                            /*!< (@ 0x40024000) CMP Structure          */
-  __IO uint32_t  CTRL;                      /*!< (@ 0x40024000) Comparator control register */
-  __IO uint32_t  LAD;                       /*!< (@ 0x40024004) Voltage ladder register */
-} LPC_CMP_TypeDef;
-/*@}*/ /* end of group LPC8xx_CMP */
-
-
-/*------------- Wakeup Timer (WKT) --------------------------------------------------*/
-/** @addtogroup LPC8xx_WKT
-  @{
-*/
-typedef struct {                            /*!< (@ 0x40028000) WKT Structure          */
-  __IO uint32_t  CTRL;                      /*!< (@ 0x40028000) Alarm/Wakeup Timer Control register */
-       uint32_t  Reserved[2];
-  __IO uint32_t  COUNT;                     /*!< (@ 0x4002800C) Alarm/Wakeup TImer counter register */
-} LPC_WKT_TypeDef;
-/*@}*/ /* end of group LPC8xx_WKT */
-
-
-/*------------- Multi-Rate Timer(MRT) --------------------------------------------------*/
-typedef struct {
-__IO uint32_t INTVAL;
-__IO uint32_t TIMER;
-__IO uint32_t CTRL;
-__IO uint32_t STAT;
-} MRT_Channel_cfg_Type;
-
-typedef struct {
-  MRT_Channel_cfg_Type Channel[4];
-   uint32_t Reserved0[1];
-  __IO uint32_t IDLE_CH;
-  __IO uint32_t IRQ_FLAG;
-} LPC_MRT_TypeDef;
-
-
-/*------------- Universal Asynchronous Receiver Transmitter (USART) -----------*/
-/** @addtogroup LPC8xx_UART LPC8xx Universal Asynchronous Receiver/Transmitter
-  @{
-*/
-/**
-  * @brief Product name title=LPC8xx MCU Chapter title=USART Modification date=4/18/2012 Major revision=0 Minor revision=9  (USART)
-  */
-typedef struct
-{
-  __IO uint32_t  CFG;								/* 0x00 */
-  __IO uint32_t  CTRL;
-  __IO uint32_t  STAT;
-  __IO uint32_t  INTENSET;
-  __O  uint32_t  INTENCLR;					/* 0x10 */
-  __I  uint32_t  RXDATA;
-  __I  uint32_t  RXDATA_STAT;
-  __IO uint32_t  TXDATA;
-  __IO uint32_t  BRG;								/* 0x20 */
-  __IO uint32_t  INTSTAT;
-} LPC_USART_TypeDef;
-
-/*@}*/ /* end of group LPC8xx_USART */
-
-
-/*------------- Synchronous Serial Interface Controller (SPI) -----------------------*/
-/** @addtogroup LPC8xx_SPI LPC8xx Synchronous Serial Port
-  @{
-*/
-typedef struct
-{
-  __IO uint32_t  CFG;			    /* 0x00 */
-  __IO uint32_t  DLY;
-  __IO uint32_t  STAT;
-  __IO uint32_t  INTENSET;
-  __O  uint32_t  INTENCLR;		/* 0x10 */
-  __I  uint32_t  RXDAT;
-  __IO uint32_t  TXDATCTL;
-  __IO uint32_t  TXDAT;
-  __IO uint32_t  TXCTRL;		  /* 0x20 */
-  __IO uint32_t  DIV;
-  __I  uint32_t  INTSTAT;
-} LPC_SPI_TypeDef;
-/*@}*/ /* end of group LPC8xx_SPI */
-
-
-/*------------- Inter-Integrated Circuit (I2C) -------------------------------*/
-/** @addtogroup LPC8xx_I2C I2C-Bus Interface
-  @{
-*/
-typedef struct
-{
-  __IO uint32_t  CFG;			  /* 0x00 */
-  __IO uint32_t  STAT;
-  __IO uint32_t  INTENSET;
-  __O  uint32_t  INTENCLR;
-  __IO uint32_t  TIMEOUT;		/* 0x10 */
-  __IO uint32_t  DIV;
-  __IO uint32_t  INTSTAT;
-       uint32_t  Reserved0[1];
-  __IO uint32_t  MSTCTL;			  /* 0x20 */
-  __IO uint32_t  MSTTIME;
-  __IO uint32_t  MSTDAT;
-       uint32_t  Reserved1[5];
-  __IO uint32_t  SLVCTL;			  /* 0x40 */
-  __IO uint32_t  SLVDAT;
-  __IO uint32_t  SLVADR0;
-  __IO uint32_t  SLVADR1;
-  __IO uint32_t  SLVADR2;			  /* 0x50 */
-  __IO uint32_t  SLVADR3;
-  __IO uint32_t  SLVQUAL0;
-       uint32_t  Reserved2[9];
-  __I  uint32_t  MONRXDAT;			/* 0x80 */
-} LPC_I2C_TypeDef;
-
-/*@}*/ /* end of group LPC8xx_I2C */
-
-/**
-  * @brief State Configurable Timer (SCT) (SCT)
-  */
-
-/**
-  * @brief Product name title=UM10430 Chapter title=LPC8xx State Configurable Timer (SCT) Modification date=1/18/2011 Major revision=0 Minor revision=7  (SCT)
-  */
-
-#define CONFIG_SCT_nEV   (6)             /* Number of events */
-#define CONFIG_SCT_nRG   (5)             /* Number of match/compare registers */
-#define CONFIG_SCT_nOU   (4)             /* Number of outputs */
-
-typedef struct
-{
-    __IO  uint32_t CONFIG;              /* 0x000 Configuration Register */
-    union {
-        __IO uint32_t CTRL_U;           /* 0x004 Control Register */
-        struct {
-            __IO uint16_t CTRL_L;       /* 0x004 low control register */
-            __IO uint16_t CTRL_H;       /* 0x006 high control register */
-        };
-    };
-    __IO uint16_t LIMIT_L;              /* 0x008 limit register for counter L */
-    __IO uint16_t LIMIT_H;              /* 0x00A limit register for counter H */
-    __IO uint16_t HALT_L;               /* 0x00C halt register for counter L */
-    __IO uint16_t HALT_H;               /* 0x00E halt register for counter H */
-    __IO uint16_t STOP_L;               /* 0x010 stop register for counter L */
-    __IO uint16_t STOP_H;               /* 0x012 stop register for counter H */
-    __IO uint16_t START_L;              /* 0x014 start register for counter L */
-    __IO uint16_t START_H;              /* 0x016 start register for counter H */
-         uint32_t RESERVED1[10];        /* 0x018-0x03C reserved */
-    union {
-        __IO uint32_t COUNT_U;          /* 0x040 counter register */
-        struct {
-            __IO uint16_t COUNT_L;      /* 0x040 counter register for counter L */
-            __IO uint16_t COUNT_H;      /* 0x042 counter register for counter H */
-        };
-    };
-    __IO uint16_t STATE_L;              /* 0x044 state register for counter L */
-    __IO uint16_t STATE_H;              /* 0x046 state register for counter H */
-    __I  uint32_t INPUT;                /* 0x048 input register */
-    __IO uint16_t REGMODE_L;            /* 0x04C match - capture registers mode register L */
-    __IO uint16_t REGMODE_H;            /* 0x04E match - capture registers mode register H */
-    __IO uint32_t OUTPUT;               /* 0x050 output register */
-    __IO uint32_t OUTPUTDIRCTRL;        /* 0x054 Output counter direction Control Register */
-    __IO uint32_t RES;                  /* 0x058 conflict resolution register */
-         uint32_t RESERVED2[37];        /* 0x05C-0x0EC reserved */
-    __IO uint32_t EVEN;                 /* 0x0F0 event enable register */
-    __IO uint32_t EVFLAG;               /* 0x0F4 event flag register */
-    __IO uint32_t CONEN;                /* 0x0F8 conflict enable register */
-    __IO uint32_t CONFLAG;              /* 0x0FC conflict flag register */
-
-    union {
-        __IO union {                    /* 0x100-... Match / Capture value */
-            uint32_t U;                 /*       SCTMATCH[i].U  Unified 32-bit register */
-            struct {
-                uint16_t L;             /*       SCTMATCH[i].L  Access to L value */
-                uint16_t H;             /*       SCTMATCH[i].H  Access to H value */
-            };
-        } MATCH[CONFIG_SCT_nRG];
-        __I union {
-            uint32_t U;                 /*       SCTCAP[i].U  Unified 32-bit register */
-            struct {
-                uint16_t L;             /*       SCTCAP[i].L  Access to H value */
-                uint16_t H;             /*       SCTCAP[i].H  Access to H value */
-            };
-        } CAP[CONFIG_SCT_nRG];
-    };
-
-
-         uint32_t RESERVED3[32-CONFIG_SCT_nRG];      /* ...-0x17C reserved */
-
-    union {
-        __IO uint16_t MATCH_L[CONFIG_SCT_nRG];       /* 0x180-... Match Value L counter */
-        __I  uint16_t CAP_L[CONFIG_SCT_nRG];         /* 0x180-... Capture Value L counter */
-    };
-         uint16_t RESERVED4[32-CONFIG_SCT_nRG];      /* ...-0x1BE reserved */
-    union {
-        __IO uint16_t MATCH_H[CONFIG_SCT_nRG];       /* 0x1C0-... Match Value H counter */
-        __I  uint16_t CAP_H[CONFIG_SCT_nRG];         /* 0x1C0-... Capture Value H counter */
-    };
-
-         uint16_t RESERVED5[32-CONFIG_SCT_nRG];      /* ...-0x1FE reserved */
-
-
-    union {
-        __IO union {                    /* 0x200-... Match Reload / Capture Control value */
-            uint32_t U;                 /*       SCTMATCHREL[i].U  Unified 32-bit register */
-            struct {
-                uint16_t L;             /*       SCTMATCHREL[i].L  Access to L value */
-                uint16_t H;             /*       SCTMATCHREL[i].H  Access to H value */
-            };
-        } MATCHREL[CONFIG_SCT_nRG];
-        __IO union {
-            uint32_t U;                 /*       SCTCAPCTRL[i].U  Unified 32-bit register */
-            struct {
-                uint16_t L;             /*       SCTCAPCTRL[i].L  Access to H value */
-                uint16_t H;             /*       SCTCAPCTRL[i].H  Access to H value */
-            };
-        } CAPCTRL[CONFIG_SCT_nRG];
-    };
-
-         uint32_t RESERVED6[32-CONFIG_SCT_nRG];      /* ...-0x27C reserved */
-
-    union {
-        __IO uint16_t MATCHREL_L[CONFIG_SCT_nRG];    /* 0x280-... Match Reload value L counter */
-        __IO uint16_t CAPCTRL_L[CONFIG_SCT_nRG];     /* 0x280-... Capture Control value L counter */
-    };
-         uint16_t RESERVED7[32-CONFIG_SCT_nRG];      /* ...-0x2BE reserved */
-    union {
-        __IO uint16_t MATCHREL_H[CONFIG_SCT_nRG];    /* 0x2C0-... Match Reload value H counter */
-        __IO uint16_t CAPCTRL_H[CONFIG_SCT_nRG];     /* 0x2C0-... Capture Control value H counter */
-    };
-         uint16_t RESERVED8[32-CONFIG_SCT_nRG];      /* ...-0x2FE reserved */
-
-    __IO struct {                       /* 0x300-0x3FC  SCTEVENT[i].STATE / SCTEVENT[i].CTRL*/
-        uint32_t STATE;                 /* Event State Register */
-        uint32_t CTRL;                  /* Event Control Register */
-    } EVENT[CONFIG_SCT_nEV];
-
-         uint32_t RESERVED9[128-2*CONFIG_SCT_nEV];   /* ...-0x4FC reserved */
-
-    __IO struct {                       /* 0x500-0x57C  SCTOUT[i].SET / SCTOUT[i].CLR */
-        uint32_t SET;                   /* Output n Set Register */
-        uint32_t CLR;                   /* Output n Clear Register */
-    } OUT[CONFIG_SCT_nOU];
-
-         uint32_t RESERVED10[191-2*CONFIG_SCT_nOU];  /* ...-0x7F8 reserved */
-
-    __I  uint32_t MODULECONTENT;        /* 0x7FC Module Content */
-
-} LPC_SCT_TypeDef;
-/*@}*/ /* end of group LPC8xx_SCT */
-
-
-/*------------- Watchdog Timer (WWDT) -----------------------------------------*/
-/** @addtogroup LPC8xx_WDT LPC8xx WatchDog Timer
-  @{
-*/
-typedef struct
-{
-  __IO uint32_t MOD;                    /*!< Offset: 0x000 Watchdog mode register (R/W) */
-  __IO uint32_t TC;                     /*!< Offset: 0x004 Watchdog timer constant register (R/W) */
-  __O  uint32_t FEED;                   /*!< Offset: 0x008 Watchdog feed sequence register (W) */
-  __I  uint32_t TV;                     /*!< Offset: 0x00C Watchdog timer value register (R) */
-       uint32_t RESERVED;               /*!< Offset: 0x010 RESERVED                          */
-  __IO uint32_t WARNINT;                /*!< Offset: 0x014 Watchdog timer warning int. register (R/W) */
-  __IO uint32_t WINDOW;                 /*!< Offset: 0x018 Watchdog timer window value register (R/W) */
-} LPC_WWDT_TypeDef;
-/*@}*/ /* end of group LPC8xx_WDT */
-
-
-#if defined ( __CC_ARM   )
-#pragma no_anon_unions
-#endif
-
-/******************************************************************************/
-/*                         Peripheral memory map                              */
-/******************************************************************************/
-/* Base addresses                                                             */
-#define LPC_FLASH_BASE        (0x00000000UL)
-#define LPC_RAM_BASE          (0x10000000UL)
-#define LPC_ROM_BASE          (0x1FFF0000UL)
-#define LPC_APB0_BASE         (0x40000000UL)
-#define LPC_AHB_BASE          (0x50000000UL)
-
-/* APB0 peripherals */
-#define LPC_WWDT_BASE         (LPC_APB0_BASE + 0x00000)
-#define LPC_MRT_BASE          (LPC_APB0_BASE + 0x04000)
-#define LPC_WKT_BASE          (LPC_APB0_BASE + 0x08000)
-#define LPC_SWM_BASE          (LPC_APB0_BASE + 0x0C000)
-#define LPC_PMU_BASE          (LPC_APB0_BASE + 0x20000)
-#define LPC_CMP_BASE          (LPC_APB0_BASE + 0x24000)
-
-#define LPC_FLASHCTRL_BASE    (LPC_APB0_BASE + 0x40000)
-#define LPC_IOCON_BASE        (LPC_APB0_BASE + 0x44000)
-#define LPC_SYSCON_BASE       (LPC_APB0_BASE + 0x48000)
-#define LPC_I2C_BASE          (LPC_APB0_BASE + 0x50000)
-#define LPC_SPI0_BASE         (LPC_APB0_BASE + 0x58000)
-#define LPC_SPI1_BASE         (LPC_APB0_BASE + 0x5C000)
-#define LPC_USART0_BASE       (LPC_APB0_BASE + 0x64000)
-#define LPC_USART1_BASE       (LPC_APB0_BASE + 0x68000)
-#define LPC_USART2_BASE       (LPC_APB0_BASE + 0x6C000)
-
-/* AHB peripherals                                                            */
-#define LPC_CRC_BASE         (LPC_AHB_BASE + 0x00000)
-#define LPC_SCT_BASE         (LPC_AHB_BASE + 0x04000)
-
-#define LPC_GPIO_PORT_BASE    (0xA0000000)
-#define LPC_PIN_INT_BASE     (LPC_GPIO_PORT_BASE  + 0x4000)
-
-/******************************************************************************/
-/*                         Peripheral declaration                             */
-/******************************************************************************/
-#define LPC_WWDT              ((LPC_WWDT_TypeDef   *) LPC_WWDT_BASE  )
-#define LPC_MRT               ((LPC_MRT_TypeDef    *) LPC_MRT_BASE   )
-
-
-#define LPC_WKT               ((LPC_WKT_TypeDef    *) LPC_WKT_BASE   )
-#define LPC_SWM               ((LPC_SWM_TypeDef    *) LPC_SWM_BASE   )
-#define LPC_PMU               ((LPC_PMU_TypeDef    *) LPC_PMU_BASE   )
-#define LPC_CMP               ((LPC_CMP_TypeDef    *) LPC_CMP_BASE   )
-
-#define LPC_FLASHCTRL         ((LPC_FLASHCTRL_TypeDef *) LPC_FLASHCTRL_BASE )
-#define LPC_IOCON             ((LPC_IOCON_TypeDef  *) LPC_IOCON_BASE )
-#define LPC_SYSCON            ((LPC_SYSCON_TypeDef *) LPC_SYSCON_BASE)
-#define LPC_I2C               ((LPC_I2C_TypeDef    *) LPC_I2C_BASE   )
-#define LPC_SPI0              ((LPC_SPI_TypeDef    *) LPC_SPI0_BASE  )
-#define LPC_SPI1              ((LPC_SPI_TypeDef    *) LPC_SPI1_BASE  )
-#define LPC_USART0            ((LPC_USART_TypeDef   *) LPC_USART0_BASE )
-#define LPC_USART1            ((LPC_USART_TypeDef   *) LPC_USART1_BASE )
-#define LPC_USART2            ((LPC_USART_TypeDef   *) LPC_USART2_BASE )
-
-#define LPC_CRC               ((LPC_CRC_TypeDef    *) LPC_CRC_BASE   )
-#define LPC_SCT               ((LPC_SCT_TypeDef    *) LPC_SCT_BASE   )
-
-#define LPC_GPIO_PORT         ((LPC_GPIO_PORT_TypeDef  *) LPC_GPIO_PORT_BASE  )
-#define LPC_PIN_INT          ((LPC_PIN_INT_TypeDef   *) LPC_PIN_INT_BASE  )
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /* __LPC8xx_H__ */
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/TOOLCHAIN_ARM_MICRO/sys.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library - stackheap
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * Setup a fixed single stack/heap memory model, 
- *  between the top of the RW/ZI region and the stackpointer
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-#include <rt_misc.h>
-#include <stdint.h>
-
-extern char Image$$RW_IRAM1$$ZI$$Limit[];
-
-extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
-    uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
-    uint32_t sp_limit = __current_sp();
-
-    zi_limit = (zi_limit + 7) & ~0x7;    // ensure zi_limit is 8-byte aligned
-
-    struct __initial_stackheap r;
-    r.heap_base = zi_limit;
-    r.heap_limit = sp_limit;
-    return r;
-}
-
-#ifdef __cplusplus
-}
-#endif 
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/cmsis.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-/* mbed Microcontroller Library - CMSIS
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * A generic CMSIS include header, pulling in LPC8xx specifics
- */
-
-#ifndef MBED_CMSIS_H
-#define MBED_CMSIS_H
-
-#include "LPC8xx.h"
-#include "cmsis_nvic.h"
-
-#endif
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/cmsis_nvic.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic for LPC11U24
- * Copyright (c) 2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */ 
-#include "cmsis_nvic.h"
-
-#define NVIC_RAM_VECTOR_ADDRESS (0x10000000)  // Vectors positioned at start of RAM
-#define NVIC_FLASH_VECTOR_ADDRESS (0x0)       // Initial vector position in flash
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
-    uint32_t *vectors = (uint32_t*)SCB->VTOR;
-    uint32_t i;
-
-    // Copy and switch to dynamic vectors if the first time called
-    if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
-        uint32_t *old_vectors = vectors;
-        vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
-        for (i=0; i<NVIC_NUM_VECTORS; i++) {
-            vectors[i] = old_vectors[i];
-        }
-        SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
-    }
-    vectors[IRQn + 16] = vector;
-}
-
-uint32_t NVIC_GetVector(IRQn_Type IRQn) {
-    uint32_t *vectors = (uint32_t*)SCB->VTOR;
-    return vectors[IRQn + 16];
-}
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/cmsis_nvic.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */ 
-
-#ifndef MBED_CMSIS_NVIC_H
-#define MBED_CMSIS_NVIC_H
-
-#define NVIC_NUM_VECTORS      (16 + 32)   // CORE + MCU Peripherals
-#define NVIC_USER_IRQ_OFFSET  16
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
-uint32_t NVIC_GetVector(IRQn_Type IRQn);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/cmsis/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/system_LPC8xx.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/******************************************************************************
- * @file:    system_LPC8xx.h
- * @purpose: CMSIS Cortex-M0+ Device Peripheral Access Layer Header File
- *           for the NXP LPC8xx Device Series
- * @version: V1.0
- * @date:    16. Aug. 2012
- *----------------------------------------------------------------------------
- *
- * Copyright (C) 2012 ARM Limited. All rights reserved.
- *
- * ARM Limited (ARM) is supplying this software for use with Cortex-M0+
- * processor based microcontrollers.  This file can be freely distributed
- * within development tools that are supporting such ARM based processors.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- *
- ******************************************************************************/
-
-
-#ifndef __SYSTEM_LPC8xx_H
-#define __SYSTEM_LPC8xx_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-extern uint32_t SystemCoreClock;     /*!< System Clock Frequency (Core Clock)  */
-
-
-/**
- * Initialize the system
- *
- * @param  none
- * @return none
- *
- * @brief  Setup the microcontroller system.
- *         Initialize the System and update the SystemCoreClock variable.
- */
-extern void SystemInit (void);
-
-/**
- * Update SystemCoreClock variable
- *
- * @param  none
- * @return none
- *
- * @brief  Updates the SystemCoreClock with current core Clock
- *         retrieved from cpu registers.
- */
-extern void SystemCoreClockUpdate (void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __SYSTEM_LPC8xx_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/cmsis/TARGET_NXP/TOOLCHAIN_ARM_MICRO/TARGET_LPC11CXX/LPC11C24.sct	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,16 @@
+
+LR_IROM1 0x00000000 0x8000  {    ; load region size_region (32k)
+
+  ER_IROM1 0x00000000 0x8000  {  ; load address = execution address
+   *.o (RESET, +First)
+   *(InRoot$$Sections)
+   .ANY (+RO)
+  }
+
+  ; 48 vectors * 4 bytes = 0xC0 for remap
+  RW_IRAM1 (0x10000000+0xC0) (0x2000-0xC0)  {
+   .ANY (+RW +ZI)
+  }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/cmsis/TARGET_NXP/TOOLCHAIN_ARM_MICRO/TARGET_LPC11CXX/startup_LPC11xx.s	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,304 @@
+;/*****************************************************************************
+; * @file:    startup_LPC11xx.s
+; * @purpose: CMSIS Cortex-M0 Core Device Startup File 
+; *           for the NXP LPC11xx Device Series 
+; * @version: V1.0
+; * @date:    25. Nov. 2008
+; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
+; *
+; * Copyright (C) 2008 ARM Limited. All rights reserved.
+; * ARM Limited (ARM) is supplying this software for use with Cortex-M0 
+; * processor based microcontrollers.  This file can be freely distributed 
+; * within development tools that are supporting such ARM based processors. 
+; *
+; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
+; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
+; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
+; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
+; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
+; *
+; *****************************************************************************/
+
+Stack_Size      EQU     0x00000400
+
+                AREA    STACK, NOINIT, READWRITE, ALIGN=3
+                EXPORT  __initial_sp
+
+Stack_Mem       SPACE   Stack_Size
+__initial_sp        EQU     0x10002000  ; Top of RAM from LPC1114
+
+
+Heap_Size       EQU     0x00000000
+
+                AREA    HEAP, NOINIT, READWRITE, ALIGN=3
+                EXPORT  __heap_base
+                EXPORT  __heap_limit
+
+__heap_base
+Heap_Mem        SPACE   Heap_Size
+__heap_limit
+
+                PRESERVE8
+                THUMB
+
+; Vector Table Mapped to Address 0 at Reset
+
+                AREA    RESET, DATA, READONLY
+                EXPORT  __Vectors
+
+__Vectors       DCD     __initial_sp              ; Top of Stack
+                DCD     Reset_Handler             ; Reset Handler
+                DCD     NMI_Handler               ; NMI Handler
+                DCD     HardFault_Handler         ; Hard Fault Handler
+                DCD     0                         ; Reserved
+                DCD     0                         ; Reserved
+                DCD     0                         ; Reserved
+                DCD     0                         ; Reserved
+                DCD     0                         ; Reserved
+                DCD     0                         ; Reserved
+                DCD     0                         ; Reserved
+                DCD     SVC_Handler               ; SVCall Handler
+                DCD     0                         ; Reserved
+                DCD     0                         ; Reserved
+                DCD     PendSV_Handler            ; PendSV Handler
+                DCD     SysTick_Handler           ; SysTick Handler
+
+                DCD     SLWU_INT0_IRQHandler      ; Start logic wake-up interrupt 0
+                DCD     SLWU_INT1_IRQHandler      ; Start logic wake-up interrupt 1
+                DCD     SLWU_INT2_IRQHandler      ; Start logic wake-up interrupt 2
+                DCD     SLWU_INT3_IRQHandler      ; Start logic wake-up interrupt 3
+                DCD     SLWU_INT4_IRQHandler      ; Start logic wake-up interrupt 4
+                DCD     SLWU_INT5_IRQHandler      ; Start logic wake-up interrupt 5
+                DCD     SLWU_INT6_IRQHandler      ; Start logic wake-up interrupt 6
+                DCD     SLWU_INT7_IRQHandler      ; Start logic wake-up interrupt 7
+                DCD     SLWU_INT8_IRQHandler      ; Start logic wake-up interrupt 8
+                DCD     SLWU_INT9_IRQHandler      ; Start logic wake-up interrupt 9
+                DCD     SLWU_INT10_IRQHandler     ; Start logic wake-up interrupt 10
+                DCD     SLWU_INT11_IRQHandler     ; Start logic wake-up interrupt 11
+                DCD     SLWU_INT12_IRQHandler     ; Start logic wake-up interrupt 12
+                DCD     C_CAN_IRQHandler          ; C_CAN
+                DCD     SSP1_IRQHandler           ; SSP1
+                DCD     I2C_IRQHandler            ; I2C
+                DCD     TIMER16_0_IRQHandler      ; 16-bit Timer0
+                DCD     TIMER16_1_IRQHandler      ; 16-bit Timer1
+                DCD     TIMER32_0_IRQHandler      ; 32-bit Timer0
+                DCD     TIMER32_1_IRQHandler      ; 32-bit Timer1
+                DCD     SSP0_IRQHandler           ; SSP0
+                DCD     UART_IRQHandler           ; UART
+                DCD     Reserved_IRQHandler       ; Reserved
+                DCD     Reserved_IRQHandler       ; Reserved
+                DCD     ADC_IRQHandler            ; A/D Converter
+                DCD     WDT_IRQHandler            ; Watchdog timer
+                DCD     BOD_IRQHandler            ; Brown Out Detect
+                DCD     Reserved_IRQHandler       ; Reserved
+                DCD     PIO_3_IRQHandler	  ; GPIO interrupt status of port 3
+                DCD     PIO_2_IRQHandler          ; GPIO interrupt status of port 2
+                DCD     PIO_1_IRQHandler          ; GPIO interrupt status of port 1
+                DCD     PIO_0_IRQHandler          ; GPIO interrupt status of port 0
+	
+	;; 48 vector entries. We pad to 128 to fill the 0x0 - 0x1FF REMAP address space
+
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+
+        	DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+
+        	DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+
+        	DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+
+        	DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+
+        	DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+
+        	DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+
+        	DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+
+                IF      :LNOT::DEF:NO_CRP
+                AREA    |.ARM.__at_0x02FC|, CODE, READONLY
+CRP_Key         DCD     0xFFFFFFFF
+                ENDIF
+
+                AREA    |.text|, CODE, READONLY
+
+; Reset Handler
+
+Reset_Handler   PROC
+                EXPORT  Reset_Handler             [WEAK]
+                IMPORT  SystemInit
+                IMPORT  __main
+                LDR     R0, =SystemInit
+                BLX     R0
+                LDR     R0, =__main
+                BX      R0
+                ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+; now, under COMMON NMI.c and NMI.h, a real NMI handler is created if NMI is enabled 
+; for particular peripheral.
+HardFault_Handler\
+                PROC
+                EXPORT  HardFault_Handler         [WEAK]
+                B       .
+                ENDP
+SVC_Handler     PROC
+                EXPORT  SVC_Handler               [WEAK]
+                B       .
+                ENDP
+PendSV_Handler  PROC
+                EXPORT  PendSV_Handler            [WEAK]
+                B       .
+                ENDP
+SysTick_Handler PROC
+                EXPORT  SysTick_Handler           [WEAK]
+                B       .
+                ENDP
+Reserved_IRQHandler PROC
+                EXPORT  Reserved_IRQHandler       [WEAK]
+                B       .
+                ENDP
+
+Default_Handler PROC
+; for LPC1114
+                EXPORT  NMI_Handler               [WEAK]
+                EXPORT  SLWU_INT0_IRQHandler      [WEAK]
+                EXPORT  SLWU_INT1_IRQHandler      [WEAK]
+                EXPORT  SLWU_INT2_IRQHandler      [WEAK]
+                EXPORT  SLWU_INT3_IRQHandler      [WEAK]
+                EXPORT  SLWU_INT4_IRQHandler      [WEAK]
+                EXPORT  SLWU_INT5_IRQHandler      [WEAK]
+                EXPORT  SLWU_INT6_IRQHandler      [WEAK]
+                EXPORT  SLWU_INT7_IRQHandler      [WEAK]
+                EXPORT  SLWU_INT8_IRQHandler      [WEAK]
+                EXPORT  SLWU_INT9_IRQHandler      [WEAK]
+                EXPORT  SLWU_INT10_IRQHandler     [WEAK]
+                EXPORT  SLWU_INT11_IRQHandler     [WEAK]
+                EXPORT  SLWU_INT12_IRQHandler     [WEAK]
+                EXPORT  C_CAN_IRQHandler          [WEAK]
+                EXPORT  SSP1_IRQHandler           [WEAK]
+                EXPORT  I2C_IRQHandler            [WEAK]
+                EXPORT  TIMER16_0_IRQHandler      [WEAK]
+                EXPORT  TIMER16_1_IRQHandler      [WEAK]
+                EXPORT  TIMER32_0_IRQHandler      [WEAK]
+                EXPORT  TIMER32_1_IRQHandler      [WEAK]
+                EXPORT  SSP0_IRQHandler           [WEAK]
+                EXPORT  UART_IRQHandler           [WEAK]
+                EXPORT  ADC_IRQHandler            [WEAK]
+                EXPORT  WDT_IRQHandler            [WEAK]
+                EXPORT  BOD_IRQHandler            [WEAK]
+                EXPORT  PIO_3_IRQHandler          [WEAK]
+                EXPORT  PIO_2_IRQHandler          [WEAK]
+                EXPORT  PIO_1_IRQHandler          [WEAK]
+                EXPORT  PIO_0_IRQHandler          [WEAK]
+
+NMI_Handler
+
+SLWU_INT0_IRQHandler
+SLWU_INT1_IRQHandler
+SLWU_INT2_IRQHandler
+SLWU_INT3_IRQHandler
+SLWU_INT4_IRQHandler
+SLWU_INT5_IRQHandler
+SLWU_INT6_IRQHandler
+SLWU_INT7_IRQHandler
+SLWU_INT8_IRQHandler
+SLWU_INT9_IRQHandler
+SLWU_INT10_IRQHandler
+SLWU_INT11_IRQHandler
+SLWU_INT12_IRQHandler
+C_CAN_IRQHandler
+SSP1_IRQHandler
+I2C_IRQHandler
+TIMER16_0_IRQHandler
+TIMER16_1_IRQHandler
+TIMER32_0_IRQHandler
+TIMER32_1_IRQHandler
+SSP0_IRQHandler
+UART_IRQHandler
+ADC_IRQHandler
+WDT_IRQHandler
+BOD_IRQHandler
+PIO_3_IRQHandler
+PIO_2_IRQHandler
+PIO_1_IRQHandler
+PIO_0_IRQHandler
+
+                B       .
+
+                ENDP
+
+                ALIGN
+                END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/cmsis/TARGET_NXP/TOOLCHAIN_ARM_MICRO/TARGET_LPC11XX/LPC1114.sct	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,16 @@
+
+LR_IROM1 0x00000000 0x8000  {    ; load region size_region (32k)
+
+  ER_IROM1 0x00000000 0x8000  {  ; load address = execution address
+   *.o (RESET, +First)
+   *(InRoot$$Sections)
+   .ANY (+RO)
+  }
+
+  ; 48 vectors * 4 bytes = 0xC0 for remap
+  RW_IRAM1 (0x10000000+0xC0) (0x1000-0xC0)  {
+   .ANY (+RW +ZI)
+  }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/cmsis/TARGET_NXP/TOOLCHAIN_ARM_MICRO/TARGET_LPC11XX/startup_LPC11xx.s	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,304 @@
+;/*****************************************************************************
+; * @file:    startup_LPC11xx.s
+; * @purpose: CMSIS Cortex-M0 Core Device Startup File 
+; *           for the NXP LPC11xx Device Series 
+; * @version: V1.0
+; * @date:    25. Nov. 2008
+; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
+; *
+; * Copyright (C) 2008 ARM Limited. All rights reserved.
+; * ARM Limited (ARM) is supplying this software for use with Cortex-M0 
+; * processor based microcontrollers.  This file can be freely distributed 
+; * within development tools that are supporting such ARM based processors. 
+; *
+; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
+; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
+; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
+; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
+; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
+; *
+; *****************************************************************************/
+
+Stack_Size      EQU     0x00000400
+
+                AREA    STACK, NOINIT, READWRITE, ALIGN=3
+                EXPORT  __initial_sp
+
+Stack_Mem       SPACE   Stack_Size
+__initial_sp        EQU     0x10001000  ; Top of RAM from LPC1114
+
+
+Heap_Size       EQU     0x00000000
+
+                AREA    HEAP, NOINIT, READWRITE, ALIGN=3
+                EXPORT  __heap_base
+                EXPORT  __heap_limit
+
+__heap_base
+Heap_Mem        SPACE   Heap_Size
+__heap_limit
+
+                PRESERVE8
+                THUMB
+
+; Vector Table Mapped to Address 0 at Reset
+
+                AREA    RESET, DATA, READONLY
+                EXPORT  __Vectors
+
+__Vectors       DCD     __initial_sp              ; Top of Stack
+                DCD     Reset_Handler             ; Reset Handler
+                DCD     NMI_Handler               ; NMI Handler
+                DCD     HardFault_Handler         ; Hard Fault Handler
+                DCD     0                         ; Reserved
+                DCD     0                         ; Reserved
+                DCD     0                         ; Reserved
+                DCD     0                         ; Reserved
+                DCD     0                         ; Reserved
+                DCD     0                         ; Reserved
+                DCD     0                         ; Reserved
+                DCD     SVC_Handler               ; SVCall Handler
+                DCD     0                         ; Reserved
+                DCD     0                         ; Reserved
+                DCD     PendSV_Handler            ; PendSV Handler
+                DCD     SysTick_Handler           ; SysTick Handler
+
+                DCD     SLWU_INT0_IRQHandler      ; Start logic wake-up interrupt 0
+                DCD     SLWU_INT1_IRQHandler      ; Start logic wake-up interrupt 1
+                DCD     SLWU_INT2_IRQHandler      ; Start logic wake-up interrupt 2
+                DCD     SLWU_INT3_IRQHandler      ; Start logic wake-up interrupt 3
+                DCD     SLWU_INT4_IRQHandler      ; Start logic wake-up interrupt 4
+                DCD     SLWU_INT5_IRQHandler      ; Start logic wake-up interrupt 5
+                DCD     SLWU_INT6_IRQHandler      ; Start logic wake-up interrupt 6
+                DCD     SLWU_INT7_IRQHandler      ; Start logic wake-up interrupt 7
+                DCD     SLWU_INT8_IRQHandler      ; Start logic wake-up interrupt 8
+                DCD     SLWU_INT9_IRQHandler      ; Start logic wake-up interrupt 9
+                DCD     SLWU_INT10_IRQHandler     ; Start logic wake-up interrupt 10
+                DCD     SLWU_INT11_IRQHandler     ; Start logic wake-up interrupt 11
+                DCD     SLWU_INT12_IRQHandler     ; Start logic wake-up interrupt 12
+                DCD     C_CAN_IRQHandler          ; C_CAN
+                DCD     SSP1_IRQHandler           ; SSP1
+                DCD     I2C_IRQHandler            ; I2C
+                DCD     TIMER16_0_IRQHandler      ; 16-bit Timer0
+                DCD     TIMER16_1_IRQHandler      ; 16-bit Timer1
+                DCD     TIMER32_0_IRQHandler      ; 32-bit Timer0
+                DCD     TIMER32_1_IRQHandler      ; 32-bit Timer1
+                DCD     SSP0_IRQHandler           ; SSP0
+                DCD     UART_IRQHandler           ; UART
+                DCD     Reserved_IRQHandler       ; Reserved
+                DCD     Reserved_IRQHandler       ; Reserved
+                DCD     ADC_IRQHandler            ; A/D Converter
+                DCD     WDT_IRQHandler            ; Watchdog timer
+                DCD     BOD_IRQHandler            ; Brown Out Detect
+                DCD     Reserved_IRQHandler       ; Reserved
+                DCD     PIO_3_IRQHandler	  ; GPIO interrupt status of port 3
+                DCD     PIO_2_IRQHandler          ; GPIO interrupt status of port 2
+                DCD     PIO_1_IRQHandler          ; GPIO interrupt status of port 1
+                DCD     PIO_0_IRQHandler          ; GPIO interrupt status of port 0
+	
+	;; 48 vector entries. We pad to 128 to fill the 0x0 - 0x1FF REMAP address space
+
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+
+        	DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+
+        	DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+
+        	DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+
+        	DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+
+        	DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+
+        	DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+
+        	DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+                DCD     0xFFFFFFFF                ; Datafill
+
+                IF      :LNOT::DEF:NO_CRP
+                AREA    |.ARM.__at_0x02FC|, CODE, READONLY
+CRP_Key         DCD     0xFFFFFFFF
+                ENDIF
+
+                AREA    |.text|, CODE, READONLY
+
+; Reset Handler
+
+Reset_Handler   PROC
+                EXPORT  Reset_Handler             [WEAK]
+                IMPORT  SystemInit
+                IMPORT  __main
+                LDR     R0, =SystemInit
+                BLX     R0
+                LDR     R0, =__main
+                BX      R0
+                ENDP
+
+; Dummy Exception Handlers (infinite loops which can be modified)
+
+; now, under COMMON NMI.c and NMI.h, a real NMI handler is created if NMI is enabled 
+; for particular peripheral.
+HardFault_Handler\
+                PROC
+                EXPORT  HardFault_Handler         [WEAK]
+                B       .
+                ENDP
+SVC_Handler     PROC
+                EXPORT  SVC_Handler               [WEAK]
+                B       .
+                ENDP
+PendSV_Handler  PROC
+                EXPORT  PendSV_Handler            [WEAK]
+                B       .
+                ENDP
+SysTick_Handler PROC
+                EXPORT  SysTick_Handler           [WEAK]
+                B       .
+                ENDP
+Reserved_IRQHandler PROC
+                EXPORT  Reserved_IRQHandler       [WEAK]
+                B       .
+                ENDP
+
+Default_Handler PROC
+; for LPC1114
+                EXPORT  NMI_Handler               [WEAK]
+                EXPORT  SLWU_INT0_IRQHandler      [WEAK]
+                EXPORT  SLWU_INT1_IRQHandler      [WEAK]
+                EXPORT  SLWU_INT2_IRQHandler      [WEAK]
+                EXPORT  SLWU_INT3_IRQHandler      [WEAK]
+                EXPORT  SLWU_INT4_IRQHandler      [WEAK]
+                EXPORT  SLWU_INT5_IRQHandler      [WEAK]
+                EXPORT  SLWU_INT6_IRQHandler      [WEAK]
+                EXPORT  SLWU_INT7_IRQHandler      [WEAK]
+                EXPORT  SLWU_INT8_IRQHandler      [WEAK]
+                EXPORT  SLWU_INT9_IRQHandler      [WEAK]
+                EXPORT  SLWU_INT10_IRQHandler     [WEAK]
+                EXPORT  SLWU_INT11_IRQHandler     [WEAK]
+                EXPORT  SLWU_INT12_IRQHandler     [WEAK]
+                EXPORT  C_CAN_IRQHandler          [WEAK]
+                EXPORT  SSP1_IRQHandler           [WEAK]
+                EXPORT  I2C_IRQHandler            [WEAK]
+                EXPORT  TIMER16_0_IRQHandler      [WEAK]
+                EXPORT  TIMER16_1_IRQHandler      [WEAK]
+                EXPORT  TIMER32_0_IRQHandler      [WEAK]
+                EXPORT  TIMER32_1_IRQHandler      [WEAK]
+                EXPORT  SSP0_IRQHandler           [WEAK]
+                EXPORT  UART_IRQHandler           [WEAK]
+                EXPORT  ADC_IRQHandler            [WEAK]
+                EXPORT  WDT_IRQHandler            [WEAK]
+                EXPORT  BOD_IRQHandler            [WEAK]
+                EXPORT  PIO_3_IRQHandler          [WEAK]
+                EXPORT  PIO_2_IRQHandler          [WEAK]
+                EXPORT  PIO_1_IRQHandler          [WEAK]
+                EXPORT  PIO_0_IRQHandler          [WEAK]
+
+NMI_Handler
+
+SLWU_INT0_IRQHandler
+SLWU_INT1_IRQHandler
+SLWU_INT2_IRQHandler
+SLWU_INT3_IRQHandler
+SLWU_INT4_IRQHandler
+SLWU_INT5_IRQHandler
+SLWU_INT6_IRQHandler
+SLWU_INT7_IRQHandler
+SLWU_INT8_IRQHandler
+SLWU_INT9_IRQHandler
+SLWU_INT10_IRQHandler
+SLWU_INT11_IRQHandler
+SLWU_INT12_IRQHandler
+C_CAN_IRQHandler
+SSP1_IRQHandler
+I2C_IRQHandler
+TIMER16_0_IRQHandler
+TIMER16_1_IRQHandler
+TIMER32_0_IRQHandler
+TIMER32_1_IRQHandler
+SSP0_IRQHandler
+UART_IRQHandler
+ADC_IRQHandler
+WDT_IRQHandler
+BOD_IRQHandler
+PIO_3_IRQHandler
+PIO_2_IRQHandler
+PIO_1_IRQHandler
+PIO_0_IRQHandler
+
+                B       .
+
+                ENDP
+
+                ALIGN
+                END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/cmsis/TARGET_NXP/TOOLCHAIN_ARM_MICRO/sys.cpp	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,31 @@
+/* mbed Microcontroller Library - stackheap
+ * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
+ * 
+ * Setup a fixed single stack/heap memory model, 
+ *  between the top of the RW/ZI region and the stackpointer
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif 
+
+#include <rt_misc.h>
+#include <stdint.h>
+
+extern char Image$$RW_IRAM1$$ZI$$Limit[];
+
+extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
+    uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
+    uint32_t sp_limit = __current_sp();
+
+    zi_limit = (zi_limit + 7) & ~0x7;    // ensure zi_limit is 8-byte aligned
+
+    struct __initial_stackheap r;
+    r.heap_base = zi_limit;
+    r.heap_limit = sp_limit;
+    return r;
+}
+
+#ifdef __cplusplus
+}
+#endif 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/cmsis/TARGET_NXP/bitfields.h	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,1768 @@
+#ifndef MBED_BITFIELDS_H
+#define MBED_BITFIELDS_H
+
+//! Massage  x for use in bitfield  name.
+#define BFN_PREP(x, name)    ( ((x)<<name##_SHIFT) & name##_MASK )
+
+//! Get the value of bitfield  name from  y. Equivalent to (var=) y.name
+#define BFN_GET(y, name)     ( ((y) & name##_MASK)>>name##_SHIFT )
+
+//! Set bitfield  name from  y to  x: y.name= x.
+#define BFN_SET(y, x, name)  (y = ((y)&~name##_MASK) | BFN_PREP(x,name) )
+
+
+/* SYSMEMREMAP, address 0x4004 8000 */
+#define SYSMEMREMAP_MAP_MASK           0x0003             // System memory remap
+#define SYSMEMREMAP_MAP_SHIFT          0                 
+
+/* PRESETCTRL, address 0x4004 8004 */
+#define PRESETCTRL_SSP0_RST_N          (1 << 0)           // SPI0 reset control
+#define PRESETCTRL_I2C_RST_N           (1 << 1)           // I2C reset control
+#define PRESETCTRL_SSP1_RST_N          (1 << 2)           // SPI1 reset control
+#define PRESETCTRL_CAN_RST_N           (1 << 3)           // C_CAN reset control. See Section 3.1 for part specific details.
+
+/* SYSPLLCTRL, address 0x4004 8008 */
+#define SYSPLLCTRL_MSEL_MASK           0x001F             // Feedback divider value. The division value M is the programmed MSEL value + 1. 00000: Division ratio M = 1 to 11111: Division ratio M = 32.
+#define SYSPLLCTRL_MSEL_SHIFT          0                 
+#define SYSPLLCTRL_PSEL_MASK           0x0060             // Post divider ratio P. The division ratio is 2  P.
+#define SYSPLLCTRL_PSEL_SHIFT          5                 
+
+/* SYSPLLSTAT, address 0x4004 800C */
+#define SYSPLLSTAT_LOCK                (1 << 0)           // PLL lock status
+
+/* SYSOSCCTRL, address 0x4004 8020 */
+#define SYSOSCCTRL_BYPASS              (1 << 0)           // Bypass system oscillator
+#define SYSOSCCTRL_FREQRANGE           (1 << 1)           // Determines frequency range for Low-power oscillator.
+
+/* WDTOSCCTRL, address 0x4004 8024 */
+#define WDTOSCCTRL_DIVSEL_MASK         0x001F             // Select divider for Fclkana. wdt_osc_clk = Fclkana/ (2  (1 + DIVSEL)) 00000: 2  (1 + DIVSEL) = 2 00001: 2  (1 + DIVSEL) = 4 to 11111: 2  (1 + DIVSEL) = 64
+#define WDTOSCCTRL_DIVSEL_SHIFT        0                 
+#define WDTOSCCTRL_FREQSEL_MASK        0x01E0             // Select watchdog oscillator analog output frequency (Fclkana).
+#define WDTOSCCTRL_FREQSEL_SHIFT       5                 
+
+/* IRCCTRL, address 0x4004 8028 */
+#define IRCCTRL_TRIM_MASK              0x00FF             // Trim value 
+#define IRCCTRL_TRIM_SHIFT             0                 
+
+/* SYSRSTSTAT, address 0x4004 8030 */
+#define SYSRSTSTAT_POR                 (1 << 0)           // POR reset status
+#define SYSRSTSTAT_EXTRST              (1 << 1)           // Status of the external RESET pin.
+#define SYSRSTSTAT_WDT                 (1 << 2)           // Status of the Watchdog reset
+#define SYSRSTSTAT_BOD                 (1 << 3)           // Status of the Brown-out detect reset
+#define SYSRSTSTAT_SYSRST              (1 << 4)           // Status of the software system reset
+
+/* SYSPLLCLKSEL, address 0x4004 8040 */
+#define SYSPLLCLKSEL_SEL_MASK          0x0003             // System PLL clock source
+#define SYSPLLCLKSEL_SEL_SHIFT         0                 
+
+/* SYSPLLCLKUEN, address 0x4004 8044 */
+#define SYSPLLCLKUEN_ENA               (1 << 0)           // Enable system PLL clock source update
+
+/* MAINCLKSEL, address 0x4004 8070 */
+#define MAINCLKSEL_SEL_MASK            0x0003             // Clock source for main clock
+#define MAINCLKSEL_SEL_SHIFT           0                 
+
+/* MAINCLKUEN, address 0x4004 8074 */
+#define MAINCLKUEN_ENA                 (1 << 0)           // Enable main clock source update                                   0
+
+/* SYSAHBCLKDIV, address 0x4004 8078 */
+#define SYSAHBCLKDIV_DIV_MASK          0x00FF             // System AHB clock divider values 0: System clock disabled. 1: Divide by 1. to 255: Divide by 255.
+#define SYSAHBCLKDIV_DIV_SHIFT         0                 
+
+/* SYSAHBCLKCTRL, address 0x4004 8080 */
+#define SYSAHBCLKCTRL_SYS              (1 << 0)           // Enables clock for AHB to APB bridge, to the AHB matrix, to the Cortex-M0 FCLK and HCLK, to the SysCon, and to the PMU. This bit is read only.
+#define SYSAHBCLKCTRL_ROM              (1 << 1)           // Enables clock for ROM.
+#define SYSAHBCLKCTRL_RAM              (1 << 2)           // Enables clock for RAM.
+#define SYSAHBCLKCTRL_FLASHREG         (1 << 3)           // Enables clock for flash register interface.
+#define SYSAHBCLKCTRL_FLASHARRAY       (1 << 4)           // Enables clock for flash array access.
+#define SYSAHBCLKCTRL_I2C              (1 << 5)           // Enables clock for I2C.
+#define SYSAHBCLKCTRL_GPIO             (1 << 6)           // Enables clock for GPIO.
+#define SYSAHBCLKCTRL_CT16B0           (1 << 7)           // Enables clock for 16-bit counter/timer 0.
+#define SYSAHBCLKCTRL_CT16B1           (1 << 8)           // Enables clock for 16-bit counter/timer 1.
+#define SYSAHBCLKCTRL_CT32B0           (1 << 9)           // Enables clock for 32-bit counter/timer 0.
+#define SYSAHBCLKCTRL_CT32B1           (1 << 10)          // Enables clock for 32-bit counter/timer 1.
+#define SYSAHBCLKCTRL_SSP0             (1 << 11)          // Enables clock for SPI0.
+#define SYSAHBCLKCTRL_UART             (1 << 12)          // Enables clock for UART. See Section 3.1 for part specific details.
+#define SYSAHBCLKCTRL_ADC              (1 << 13)          // Enables clock for ADC.
+#define SYSAHBCLKCTRL_WDT              (1 << 15)          // Enables clock for WDT.
+#define SYSAHBCLKCTRL_IOCON            (1 << 16)          // Enables clock for I/O configuration block.
+#define SYSAHBCLKCTRL_CAN              (1 << 17)          // Enables clock for C_CAN. See Section 3.1 for part specific details.
+#define SYSAHBCLKCTRL_SSP1             (1 << 18)          // Enables clock for SPI1.
+
+/* SSP0CLKDIV, address 0x4004 8094 */
+#define SSP0CLKDIV_DIV_MASK            0x00FF             // SPI0_PCLK clock divider values 0: Disable SPI0_PCLK. 1: Divide by 1. to 255: Divide by 255.
+#define SSP0CLKDIV_DIV_SHIFT           0                 
+
+/* UARTCLKDIV, address 0x4004 8098 */
+#define UARTCLKDIV_DIV_MASK            0x00FF             // UART_PCLK clock divider values 0: Disable UART_PCLK. 1: Divide by 1. to 255: Divide by 255.
+#define UARTCLKDIV_DIV_SHIFT           0                 
+
+/* SSP1CLKDIV, address 0x4004 809C */
+#define SSP1CLKDIV_DIV_MASK            0x00FF             // SPI1_PCLK clock divider values 0: Disable SPI1_PCLK. 1: Divide by 1. to 255: Divide by 255.
+#define SSP1CLKDIV_DIV_SHIFT           0                 
+
+/* WDTCLKSEL, address 0x4004 80D0 */
+#define WDTCLKSEL_SEL_MASK             0x0003             // WDT clock source
+#define WDTCLKSEL_SEL_SHIFT            0                 
+
+/* WDTCLKUEN, address 0x4004 80D4 */
+#define WDTCLKUEN_ENA                  (1 << 0)           // Enable WDT clock source update
+
+/* WDTCLKDIV, address 0x4004 80D8 */
+#define WDTCLKDIV_DIV_MASK             0x00FF             // WDT clock divider values 0: Disable WDCLK. 1: Divide by 1. to 255: Divide by 255.
+#define WDTCLKDIV_DIV_SHIFT            0                 
+
+/* CLKOUTCLKSEL, address 0x4004 80E0 */
+#define CLKOUTCLKSEL_SEL_MASK          0x0003             // CLKOUT clock source
+#define CLKOUTCLKSEL_SEL_SHIFT         0                 
+
+/* CLKOUTUEN, address 0x4004 80E4 */
+#define CLKOUTUEN_ENA                  (1 << 0)           // Enable CLKOUT clock source update                              0
+
+/* CLKOUTCLKDIV, address 0x4004 80E8 */
+#define CLKOUTCLKDIV_DIV_MASK          0x00FF             // Clock output divider values 0: Disable CLKOUT. 1: Divide by 1. to 255: Divide by 255.
+#define CLKOUTCLKDIV_DIV_SHIFT         0                 
+
+/* PIOPORCAP0, address 0x4004 8100 */
+#define PIOPORCAP0_CAPPIO0_N_MASK      0x0FFF             // Raw reset status input PIO0_n: PIO0_11 to PIO0_0
+#define PIOPORCAP0_CAPPIO0_N_SHIFT     0                 
+#define PIOPORCAP0_CAPPIO1_N_MASK      0xFFF000           // Raw reset status input PIO1_n: PIO1_11 to PIO1_0
+#define PIOPORCAP0_CAPPIO1_N_SHIFT     12                
+#define PIOPORCAP0_CAPPIO2_N_MASK      0xFF000000         // Raw reset status input PIO2_n: PIO2_7 to PIO2_0
+#define PIOPORCAP0_CAPPIO2_N_SHIFT     24                
+
+/* PIOPORCAP1, address 0x4004 8104 */
+#define PIOPORCAP1_CAPPIO2_8           (1 << 0)           // Raw reset status input PIO2_8
+#define PIOPORCAP1_CAPPIO2_9           (1 << 1)           // Raw reset status input PIO2_9
+#define PIOPORCAP1_CAPPIO2_10          (1 << 2)           // Raw reset status input PIO2_10
+#define PIOPORCAP1_CAPPIO2_11          (1 << 3)           // Raw reset status input PIO2_11
+#define PIOPORCAP1_CAPPIO3_0           (1 << 4)           // Raw reset status input PIO3_0
+#define PIOPORCAP1_CAPPIO3_1           (1 << 5)           // Raw reset status input PIO3_1
+#define PIOPORCAP1_CAPPIO3_2           (1 << 6)           // Raw reset status input PIO3_2
+#define PIOPORCAP1_CAPPIO3_3           (1 << 7)           // Raw reset status input PIO3_3
+#define PIOPORCAP1_CAPPIO3_4           (1 << 8)           // Raw reset status input PIO3_4
+#define PIOPORCAP1_CAPPIO3_5           (1 << 9)           // Raw reset status input PIO3_5
+
+/* BODCTRL, address 0x4004 8150 */
+#define BODCTRL_BODRSTLEV_MASK         0x0003             // BOD reset level
+#define BODCTRL_BODRSTLEV_SHIFT        0                 
+#define BODCTRL_BODINTVAL_MASK         0x000C             // BOD interrupt level
+#define BODCTRL_BODINTVAL_SHIFT        2                 
+#define BODCTRL_BODRSTENA              (1 << 4)           // BOD reset enable
+
+/* SYSTCKCAL, address 0x4004 8154 */
+#define SYSTCKCAL_CAL_MASK             0x3FFFFFF          // System tick timer calibration value
+#define SYSTCKCAL_CAL_SHIFT            0                 
+
+/* NMISRC, address 0x4004 8174 */
+#define NMISRC_IRQNO_MASK              0x001F             // The IRQ number of the interrupt that acts as the Non-Maskable Interrupt 0 (NMI) if bit 31 in this register is 1. See Table 54 for the list of interrupt sources and their IRQ numbers.
+#define NMISRC_IRQNO_SHIFT             0                 
+#define NMISRC_NMIEN                   (1 << 31)          // Write a 1 to this bit to enable the Non-Maskable Interrupt (NMI) source selected by bits 4:0.
+
+/* STARTAPRP0, address 0x4004 8200 */
+#define STARTAPRP0_APRPIO0_N_MASK      0x0FFF             // Edge select for start logic input PIO0_n: PIO0_11 to PIO0_0 0 = Falling edge 1 = Rising edge
+#define STARTAPRP0_APRPIO0_N_SHIFT     0                 
+#define STARTAPRP0_APRPIO1_0           (1 << 12)          // Edge select for start logic input PIO1_0 0 = Falling edge 1 = Rising edge Reserved. Do not write a 1 to reserved bits in this register.
+
+/* STARTERP0, address 0x4004 8204 */
+#define STARTERP0_ERPIO0_N_MASK        0x0FFF             // Enable start signal for start logic input PIO0_n: PIO0_11 to PIO0_0 0 = Disabled 1 = Enabled
+#define STARTERP0_ERPIO0_N_SHIFT       0                 
+#define STARTERP0_ERPIO1_0             (1 << 12)          // Enable start signal for start logic input PIO1_0 0 = Disabled 1 = Enabled Reserved. Do not write a 1 to reserved bits in this register.
+
+/* STARTRSRP0CLR, address 0x4004 8208 */
+#define STARTRSRP0CLR_RSRPIO0_N_MASK   0x0FFF             // Start signal reset for start logic input PIO0_n:PIO0_11 to PIO0_0 0 = Do nothing. 1 = Writing 1 resets the start signal.
+#define STARTRSRP0CLR_RSRPIO0_N_SHIFT  0                 
+#define STARTRSRP0CLR_RSRPIO1_0        (1 << 12)          // Start signal reset for start logic input PIO1_0 0 = Do nothing. 1 = Writing 1 resets the start signal.
+
+/* STARTSRP0, address 0x4004 820C */
+#define STARTSRP0_SRPIO0_N_MASK        0x0FFF             // Start signal status for start logic input PIO0_n: PIO0_11 to PIO0_0 0 = No start signal received. 1 = Start signal pending.
+#define STARTSRP0_SRPIO0_N_SHIFT       0                 
+#define STARTSRP0_SRPIO1_0             (1 << 12)          // Start signal status for start logic input PIO1_0 0 = No start signal received. 1 = Start signal pending.
+
+/* PDSLEEPCFG, address 0x4004 8230 */
+#define PDSLEEPCFG_BOD_PD              (1 << 3)           // BOD power-down control in Deep-sleep mode, see Table 40.
+#define PDSLEEPCFG_WDTOSC_PD           (1 << 6)           // Watchdog oscillator power control in Deep-sleep mode, see Table 40.
+
+/* PDAWAKECFG, address 0x4004 8234 */
+#define PDAWAKECFG_IRCOUT_PD           (1 << 0)           // IRC oscillator output wake-up configuration
+#define PDAWAKECFG_IRC_PD              (1 << 1)           // IRC oscillator power-down wake-up configuration
+#define PDAWAKECFG_FLASH_PD            (1 << 2)           // Flash wake-up configuration
+#define PDAWAKECFG_BOD_PD              (1 << 3)           // BOD wake-up configuration
+#define PDAWAKECFG_ADC_PD              (1 << 4)           // ADC wake-up configuration
+#define PDAWAKECFG_SYSOSC_PD           (1 << 5)           // System oscillator wake-up configuration
+#define PDAWAKECFG_WDTOSC_PD           (1 << 6)           // Watchdog oscillator wake-up configuration
+#define PDAWAKECFG_SYSPLL_PD           (1 << 7)           // System PLL wake-up configuration
+
+/* PDRUNCFG, address 0x4004 8238 */
+#define PDRUNCFG_IRCOUT_PD             (1 << 0)           // IRC oscillator output power-down
+#define PDRUNCFG_IRC_PD                (1 << 1)           // IRC oscillator power-down
+#define PDRUNCFG_FLASH_PD              (1 << 2)           // Flash power-down
+#define PDRUNCFG_BOD_PD                (1 << 3)           // BOD power-down
+#define PDRUNCFG_ADC_PD                (1 << 4)           // ADC power-down
+#define PDRUNCFG_SYSOSC_PD             (1 << 5)           // System oscillator power-down
+#define PDRUNCFG_WDTOSC_PD             (1 << 6)           // Watchdog oscillator power-down
+#define PDRUNCFG_SYSPLL_PD             (1 << 7)           // System PLL power-down
+
+/* DEVICE_ID, address 0x4004 83F4 */
+#define DEVICE_ID_DEVICEID_MASK        0xFFFFFFFF         // Part ID numbers for LPC111x/LPC11Cxx parts
+#define DEVICE_ID_DEVICEID_SHIFT       0                 
+
+/* FLASHCFG, address 0x4003 C010 */
+#define FLASHCFG_FLASHTIM_MASK         0x0003             // Flash memory access time. FLASHTIM +1 is equal to the number of system clocks used for flash access.
+#define FLASHCFG_FLASHTIM_SHIFT        0                 
+
+/* PCON, address 0x4003 8000 */
+#define PCON_DPDEN                     (1 << 1)           // Deep power-down mode enable
+#define PCON_SLEEPFLAG                 (1 << 8)           // Sleep mode flag
+#define PCON_DPDFLAG                   (1 << 11)          // Deep power-down flag
+
+/* GPREG0 - GPREG3, address 0x4003 8004 to 0x4003 8010 */
+#define GPREGn_GPDATA_MASK             0xFFFFFFFF         // Data retained during Deep power-down mode.
+#define GPREGn_GPDATA_SHIFT            0                 
+
+/* GPREG4, address 0x4003 8014 */
+#define GPREG4_WAKEUPHYS               (1 << 10)          // WAKEUP pin hysteresis enable
+#define GPREG4_GPDATA_MASK             0xFFFFF800         // Data retained during Deep power-down mode.
+#define GPREG4_GPDATA_SHIFT            11                
+
+/* IOCON_PIO2_6, address 0x4004 4000 */
+#define IOCON_PIO2_6_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_6_FUNC_SHIFT        0                 
+#define IOCON_PIO2_6_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_6_MODE_SHIFT        3                 
+#define IOCON_PIO2_6_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_6_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO2_0, address 0x4004 4008 */
+#define IOCON_PIO2_0_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_0_FUNC_SHIFT        0                 
+#define IOCON_PIO2_0_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_0_MODE_SHIFT        3                 
+#define IOCON_PIO2_0_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_0_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_RESET_PIO0_0, address 0x4004 400C */
+#define IOCON_RESET_PIO0_0_FUNC_MASK   0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_RESET_PIO0_0_FUNC_SHIFT  0                 
+#define IOCON_RESET_PIO0_0_MODE_MASK   0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_RESET_PIO0_0_MODE_SHIFT  3                 
+#define IOCON_RESET_PIO0_0_HYS         (1 << 5)           // Hysteresis.
+#define IOCON_RESET_PIO0_0_OD          (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO0_1, address 0x4004 4010 */
+#define IOCON_PIO0_1_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO0_1_FUNC_SHIFT        0                 
+#define IOCON_PIO0_1_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO0_1_MODE_SHIFT        3                 
+#define IOCON_PIO0_1_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO0_1_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO1_8, address 0x4004 4014 */
+#define IOCON_PIO1_8_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO1_8_FUNC_SHIFT        0                 
+#define IOCON_PIO1_8_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO1_8_MODE_SHIFT        3                 
+#define IOCON_PIO1_8_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO1_8_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO0_2, address 0x4004 401C */
+#define IOCON_PIO0_2_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO0_2_FUNC_SHIFT        0                 
+#define IOCON_PIO0_2_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO0_2_MODE_SHIFT        3                 
+#define IOCON_PIO0_2_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO0_2_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO2_7, address 0x4004 4020 */
+#define IOCON_PIO2_7_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_7_FUNC_SHIFT        0                 
+#define IOCON_PIO2_7_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_7_MODE_SHIFT        3                 
+#define IOCON_PIO2_7_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_7_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO2_8, address 0x4004 4024 */
+#define IOCON_PIO2_8_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_8_FUNC_SHIFT        0                 
+#define IOCON_PIO2_8_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_8_MODE_SHIFT        3                 
+#define IOCON_PIO2_8_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_8_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO2_1, address 0x4004 4028 */
+#define IOCON_PIO2_1_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_1_FUNC_SHIFT        0                 
+#define IOCON_PIO2_1_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_1_MODE_SHIFT        3                 
+#define IOCON_PIO2_1_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_1_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO0_3, address 0x4004 402C */
+#define IOCON_PIO0_3_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO0_3_FUNC_SHIFT        0                 
+#define IOCON_PIO0_3_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO0_3_MODE_SHIFT        3                 
+#define IOCON_PIO0_3_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO0_3_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO0_4, address 0x4004 4030 */
+#define IOCON_PIO0_4_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO0_4_FUNC_SHIFT        0                 
+#define IOCON_PIO0_4_I2CMODE_MASK      0x0300             // Selects I2C mode. Select Standard mode (I2CMODE = 00, 00 default) or Standard I/O functionality (I2CMODE = 01) if the pin function is GPIO (FUNC = 000).
+#define IOCON_PIO0_4_I2CMODE_SHIFT     8                 
+
+/* IOCON_PIO0_5, address 0x4004 4034 */
+#define IOCON_PIO0_5_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO0_5_FUNC_SHIFT        0                 
+#define IOCON_PIO0_5_I2CMODE_MASK      0x0300             // Selects I2C mode. Select Standard mode (I2CMODE = 00, default) or Standard I/O functionality (I2CMODE = 01) if the pin function is GPIO (FUNC = 000).
+#define IOCON_PIO0_5_I2CMODE_SHIFT     8                 
+
+/* IOCON_PIO1_9, address 0x4004 4038 */
+#define IOCON_PIO1_9_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO1_9_FUNC_SHIFT        0                 
+#define IOCON_PIO1_9_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO1_9_MODE_SHIFT        3                 
+#define IOCON_PIO1_9_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO1_9_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO3_4, address 0x4004 403C */
+#define IOCON_PIO3_4_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO3_4_FUNC_SHIFT        0                 
+#define IOCON_PIO3_4_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO3_4_MODE_SHIFT        3                 
+#define IOCON_PIO3_4_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO3_4_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO2_4, address 0x4004 4040 */
+#define IOCON_PIO2_4_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_4_FUNC_SHIFT        0                 
+#define IOCON_PIO2_4_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_4_MODE_SHIFT        3                 
+#define IOCON_PIO2_4_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_4_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO2_5, address 0x4004 4044 */
+#define IOCON_PIO2_5_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_5_FUNC_SHIFT        0                 
+#define IOCON_PIO2_5_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_5_MODE_SHIFT        3                 
+#define IOCON_PIO2_5_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_5_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO3_5, address 0x4004 4048 */
+#define IOCON_PIO3_5_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO3_5_FUNC_SHIFT        0                 
+#define IOCON_PIO3_5_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO3_5_MODE_SHIFT        3                 
+#define IOCON_PIO3_5_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO3_5_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO0_6, address 0x4004 404C */
+#define IOCON_PIO0_6_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO0_6_FUNC_SHIFT        0                 
+#define IOCON_PIO0_6_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO0_6_MODE_SHIFT        3                 
+#define IOCON_PIO0_6_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO0_6_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO0_7, address 0x4004 4050 */
+#define IOCON_PIO0_7_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO0_7_FUNC_SHIFT        0                 
+#define IOCON_PIO0_7_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO0_7_MODE_SHIFT        3                 
+#define IOCON_PIO0_7_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO0_7_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO2_9, address 0x4004 4054 */
+#define IOCON_PIO2_9_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_9_FUNC_SHIFT        0                 
+#define IOCON_PIO2_9_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_9_MODE_SHIFT        3                 
+#define IOCON_PIO2_9_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_9_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO2_10, address 0x4004 4058 */
+#define IOCON_PIO2_10_FUNC_MASK        0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_10_FUNC_SHIFT       0                 
+#define IOCON_PIO2_10_MODE_MASK        0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_10_MODE_SHIFT       3                 
+#define IOCON_PIO2_10_HYS              (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_10_OD               (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO2_2, address 0x4004 405C */
+#define IOCON_PIO2_2_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_2_FUNC_SHIFT        0                 
+#define IOCON_PIO2_2_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_2_MODE_SHIFT        3                 
+#define IOCON_PIO2_2_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_2_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO0_8, address 0x4004 4060 */
+#define IOCON_PIO0_8_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO0_8_FUNC_SHIFT        0                 
+#define IOCON_PIO0_8_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO0_8_MODE_SHIFT        3                 
+#define IOCON_PIO0_8_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO0_8_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO0_9, address 0x4004 4064 */
+#define IOCON_PIO0_9_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO0_9_FUNC_SHIFT        0                 
+#define IOCON_PIO0_9_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO0_9_MODE_SHIFT        3                 
+#define IOCON_PIO0_9_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO0_9_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_SWCLK_PIO0_10, address 0x4004 4068 */
+#define IOCON_SWCLK_PIO0_10_FUNC_MASK  0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_SWCLK_PIO0_10_FUNC_SHIFT 0                 
+#define IOCON_SWCLK_PIO0_10_MODE_MASK  0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_SWCLK_PIO0_10_MODE_SHIFT 3                 
+#define IOCON_SWCLK_PIO0_10_HYS        (1 << 5)           // Hysteresis.
+#define IOCON_SWCLK_PIO0_10_OD         (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO1_10, address 0x4004 406C */
+#define IOCON_PIO1_10_FUNC_MASK        0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO1_10_FUNC_SHIFT       0                 
+#define IOCON_PIO1_10_MODE_MASK        0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO1_10_MODE_SHIFT       3                 
+#define IOCON_PIO1_10_HYS              (1 << 5)           // Hysteresis.
+#define IOCON_PIO1_10_ADMODE           (1 << 7)           // Selects Analog/Digital mode
+#define IOCON_PIO1_10_OD               (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO2_11, address 0x4004 4070 */
+#define IOCON_PIO2_11_FUNC_MASK        0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_11_FUNC_SHIFT       0                 
+#define IOCON_PIO2_11_MODE_MASK        0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_11_MODE_SHIFT       3                 
+#define IOCON_PIO2_11_HYS              (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_11_OD               (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_R_PIO0_11, address 0x4004 4074 */
+#define IOCON_R_PIO0_11_FUNC_MASK      0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_R_PIO0_11_FUNC_SHIFT     0                 
+#define IOCON_R_PIO0_11_MODE_MASK      0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_R_PIO0_11_MODE_SHIFT     3                 
+#define IOCON_R_PIO0_11_HYS            (1 << 5)           // Hysteresis.
+#define IOCON_R_PIO0_11_ADMODE         (1 << 7)           // Selects Analog/Digital mode
+#define IOCON_R_PIO0_11_OD             (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_R_PIO1_0, address 0x4004 4078 */
+#define IOCON_R_PIO1_0_FUNC_MASK       0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_R_PIO1_0_FUNC_SHIFT      0                 
+#define IOCON_R_PIO1_0_MODE_MASK       0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_R_PIO1_0_MODE_SHIFT      3                 
+#define IOCON_R_PIO1_0_HYS             (1 << 5)           // Hysteresis.
+#define IOCON_R_PIO1_0_ADMODE          (1 << 7)           // Selects Analog/Digital mode
+#define IOCON_R_PIO1_0_OD              (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_R_PIO1_1, address 0x4004 407C */
+#define IOCON_R_PIO1_1_FUNC_MASK       0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_R_PIO1_1_FUNC_SHIFT      0                 
+#define IOCON_R_PIO1_1_MODE_MASK       0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_R_PIO1_1_MODE_SHIFT      3                 
+#define IOCON_R_PIO1_1_HYS             (1 << 5)           // Hysteresis.
+#define IOCON_R_PIO1_1_ADMODE          (1 << 7)           // Selects Analog/Digital mode
+#define IOCON_R_PIO1_1_OD              (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_R_PIO1_2, address 0x4004 4080 */
+#define IOCON_R_PIO1_2_FUNC_MASK       0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_R_PIO1_2_FUNC_SHIFT      0                 
+#define IOCON_R_PIO1_2_MODE_MASK       0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_R_PIO1_2_MODE_SHIFT      3                 
+#define IOCON_R_PIO1_2_HYS             (1 << 5)           // Hysteresis.
+#define IOCON_R_PIO1_2_ADMODE          (1 << 7)           // Selects Analog/Digital mode
+#define IOCON_R_PIO1_2_OD              (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO3_0, address 0x4004 4084 */
+#define IOCON_PIO3_0_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO3_0_FUNC_SHIFT        0                 
+#define IOCON_PIO3_0_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO3_0_MODE_SHIFT        3                 
+#define IOCON_PIO3_0_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO3_0_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO3_1, address 0x4004 4088 */
+#define IOCON_PIO3_1_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO3_1_FUNC_SHIFT        0                 
+#define IOCON_PIO3_1_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO3_1_MODE_SHIFT        3                 
+#define IOCON_PIO3_1_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO3_1_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO2_3, address 0x4004 408C */
+#define IOCON_PIO2_3_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_3_FUNC_SHIFT        0                 
+#define IOCON_PIO2_3_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_3_MODE_SHIFT        3                 
+#define IOCON_PIO2_3_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_3_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_SWDIO_PIO1_3, address 0x4004 4090 */
+#define IOCON_SWDIO_PIO1_3_FUNC_MASK   0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_SWDIO_PIO1_3_FUNC_SHIFT  0                 
+#define IOCON_SWDIO_PIO1_3_MODE_MASK   0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_SWDIO_PIO1_3_MODE_SHIFT  3                 
+#define IOCON_SWDIO_PIO1_3_HYS         (1 << 5)           // Hysteresis.
+#define IOCON_SWDIO_PIO1_3_ADMODE      (1 << 7)           // Selects Analog/Digital mode
+#define IOCON_SWDIO_PIO1_3_OD          (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO1_4, address 0x4004 4094 */
+#define IOCON_PIO1_4_FUNC_MASK         0x0007             // Selects pin function. This pin functions as WAKEUP pin if the 000 LPC111x/LPC11Cxx is in Deep power-down mode regardless of the value of FUNC. All other values are reserved.
+#define IOCON_PIO1_4_FUNC_SHIFT        0                 
+#define IOCON_PIO1_4_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO1_4_MODE_SHIFT        3                 
+#define IOCON_PIO1_4_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO1_4_ADMODE            (1 << 7)           // Selects Analog/Digital mode
+#define IOCON_PIO1_4_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO1_11, address 0x4004 4098 */
+#define IOCON_PIO1_11_FUNC_MASK        0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO1_11_FUNC_SHIFT       0                 
+#define IOCON_PIO1_11_MODE_MASK        0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO1_11_MODE_SHIFT       3                 
+#define IOCON_PIO1_11_HYS              (1 << 5)           // Hysteresis.
+#define IOCON_PIO1_11_ADMODE           (1 << 7)           // Selects Analog/Digital mode
+#define IOCON_PIO1_11_OD               (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO3_2, address 0x4004 409C */
+#define IOCON_PIO3_2_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO3_2_FUNC_SHIFT        0                 
+#define IOCON_PIO3_2_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO3_2_MODE_SHIFT        3                 
+#define IOCON_PIO3_2_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO3_2_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO1_5, address 0x4004 40A0 */
+#define IOCON_PIO1_5_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO1_5_FUNC_SHIFT        0                 
+#define IOCON_PIO1_5_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO1_5_MODE_SHIFT        3                 
+#define IOCON_PIO1_5_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO1_5_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO1_6, address 0x4004 40A4 */
+#define IOCON_PIO1_6_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO1_6_FUNC_SHIFT        0                 
+#define IOCON_PIO1_6_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO1_6_MODE_SHIFT        3                 
+#define IOCON_PIO1_6_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO1_6_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO1_7, address 0x4004 40A8 */
+#define IOCON_PIO1_7_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO1_7_FUNC_SHIFT        0                 
+#define IOCON_PIO1_7_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO1_7_MODE_SHIFT        3                 
+#define IOCON_PIO1_7_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO1_7_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_PIO3_3, address 0x4004 40AC */
+#define IOCON_PIO3_3_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO3_3_FUNC_SHIFT        0                 
+#define IOCON_PIO3_3_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO3_3_MODE_SHIFT        3                 
+#define IOCON_PIO3_3_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO3_3_OD                (1 << 10)          // Selects pseudo open-drain mode. See Section 7.1 for part specific details.
+
+/* IOCON_SCK_LOC, address 0x4004 40B0 */
+#define IOCON_SCK_LOC_SCKLOC_MASK      0x0003             // Selects pin location for SCK0 function.
+#define IOCON_SCK_LOC_SCKLOC_SHIFT     0                 
+
+/* IOCON_DSR_LOC, address 0x4004 40B4 */
+#define IOCON_DSR_LOC_DSRLOC_MASK      0x0003             // elects pin location for DSR function.
+#define IOCON_DSR_LOC_DSRLOC_SHIFT     0                 
+
+/* IOCON_DCD_LOC, address 0x4004 40B8 */
+#define IOCON_DCD_LOC_DCDLOC_MASK      0x0003             // Selects pin location for DCD function.
+#define IOCON_DCD_LOC_DCDLOC_SHIFT     0                 
+
+/* IOCON_RI_LOC, address 0x4004 40BC */
+#define IOCON_RI_LOC_RILOC_MASK        0x0003             // Selects pin location for RI function.
+#define IOCON_RI_LOC_RILOC_SHIFT       0                 
+
+/* IOCON_PIO2_6, address 0x4004 4000 */
+#define IOCON_PIO2_6_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_6_FUNC_SHIFT        0                 
+#define IOCON_PIO2_6_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_6_MODE_SHIFT        3                 
+#define IOCON_PIO2_6_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_6_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO2_0, address 0x4004 4008 */
+#define IOCON_PIO2_0_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_0_FUNC_SHIFT        0                 
+#define IOCON_PIO2_0_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_0_MODE_SHIFT        3                 
+#define IOCON_PIO2_0_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_0_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_RESET_PIO0_0, address 0x4004 400C */
+#define IOCON_RESET_PIO0_0_FUNC_MASK   0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_RESET_PIO0_0_FUNC_SHIFT  0                 
+#define IOCON_RESET_PIO0_0_MODE_MASK   0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_RESET_PIO0_0_MODE_SHIFT  3                 
+#define IOCON_RESET_PIO0_0_HYS         (1 << 5)           // Hysteresis.
+#define IOCON_RESET_PIO0_0_OD          (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO0_1, address 0x4004 4010 */
+#define IOCON_PIO0_1_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO0_1_FUNC_SHIFT        0                 
+#define IOCON_PIO0_1_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO0_1_MODE_SHIFT        3                 
+#define IOCON_PIO0_1_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO0_1_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO1_8, address 0x4004 4014 */
+#define IOCON_PIO1_8_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO1_8_FUNC_SHIFT        0                 
+#define IOCON_PIO1_8_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO1_8_MODE_SHIFT        3                 
+#define IOCON_PIO1_8_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO1_8_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO0_2, address 0x4004 401C */
+#define IOCON_PIO0_2_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO0_2_FUNC_SHIFT        0                 
+#define IOCON_PIO0_2_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO0_2_MODE_SHIFT        3                 
+#define IOCON_PIO0_2_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO0_2_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO2_7, address 0x4004 4020 */
+#define IOCON_PIO2_7_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_7_FUNC_SHIFT        0                 
+#define IOCON_PIO2_7_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_7_MODE_SHIFT        3                 
+#define IOCON_PIO2_7_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_7_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO2_8, address 0x4004 4024 */
+#define IOCON_PIO2_8_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_8_FUNC_SHIFT        0                 
+#define IOCON_PIO2_8_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_8_MODE_SHIFT        3                 
+#define IOCON_PIO2_8_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_8_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO2_1, address 0x4004 4028 */
+#define IOCON_PIO2_1_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_1_FUNC_SHIFT        0                 
+#define IOCON_PIO2_1_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_1_MODE_SHIFT        3                 
+#define IOCON_PIO2_1_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_1_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO0_3, address 0x4004 402C */
+#define IOCON_PIO0_3_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO0_3_FUNC_SHIFT        0                 
+#define IOCON_PIO0_3_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO0_3_MODE_SHIFT        3                 
+#define IOCON_PIO0_3_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO0_3_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO0_4, address 0x4004 4030 */
+#define IOCON_PIO0_4_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO0_4_FUNC_SHIFT        0                 
+#define IOCON_PIO0_4_I2CMODE_MASK      0x0300             // Selects I2C mode. Select Standard mode (I2CMODE = 00, 00 default) or Standard I/O functionality (I2CMODE = 01) if the pin function is GPIO (FUNC = 000).
+#define IOCON_PIO0_4_I2CMODE_SHIFT     8                 
+
+/* IOCON_PIO0_5, address 0x4004 4034 */
+#define IOCON_PIO0_5_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO0_5_FUNC_SHIFT        0                 
+#define IOCON_PIO0_5_I2CMODE_MASK      0x0300             // Selects I2C mode. Select Standard mode (I2CMODE = 00, default) or Standard I/O functionality (I2CMODE = 01) if the pin function is GPIO (FUNC = 000).
+#define IOCON_PIO0_5_I2CMODE_SHIFT     8                 
+
+/* IOCON_PIO1_9, address 0x4004 4038 */
+#define IOCON_PIO1_9_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO1_9_FUNC_SHIFT        0                 
+#define IOCON_PIO1_9_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO1_9_MODE_SHIFT        3                 
+#define IOCON_PIO1_9_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO1_9_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO3_4, address 0x4004 403C */
+#define IOCON_PIO3_4_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO3_4_FUNC_SHIFT        0                 
+#define IOCON_PIO3_4_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO3_4_MODE_SHIFT        3                 
+#define IOCON_PIO3_4_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO3_4_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO2_4, address 0x4004 4040 */
+#define IOCON_PIO2_4_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_4_FUNC_SHIFT        0                 
+#define IOCON_PIO2_4_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_4_MODE_SHIFT        3                 
+#define IOCON_PIO2_4_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_4_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO2_5, address 0x4004 4044 */
+#define IOCON_PIO2_5_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_5_FUNC_SHIFT        0                 
+#define IOCON_PIO2_5_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_5_MODE_SHIFT        3                 
+#define IOCON_PIO2_5_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_5_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO3_5, address 0x4004 4048 */
+#define IOCON_PIO3_5_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO3_5_FUNC_SHIFT        0                 
+#define IOCON_PIO3_5_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO3_5_MODE_SHIFT        3                 
+#define IOCON_PIO3_5_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO3_5_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO0_6, address 0x4004 404C */
+#define IOCON_PIO0_6_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO0_6_FUNC_SHIFT        0                 
+#define IOCON_PIO0_6_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO0_6_MODE_SHIFT        3                 
+#define IOCON_PIO0_6_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO0_6_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO0_7, address 0x4004 4050 */
+#define IOCON_PIO0_7_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO0_7_FUNC_SHIFT        0                 
+#define IOCON_PIO0_7_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO0_7_MODE_SHIFT        3                 
+#define IOCON_PIO0_7_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO0_7_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO2_9, address 0x4004 4054 */
+#define IOCON_PIO2_9_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_9_FUNC_SHIFT        0                 
+#define IOCON_PIO2_9_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_9_MODE_SHIFT        3                 
+#define IOCON_PIO2_9_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_9_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO2_10, address 0x4004 4058 */
+#define IOCON_PIO2_10_FUNC_MASK        0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_10_FUNC_SHIFT       0                 
+#define IOCON_PIO2_10_MODE_MASK        0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_10_MODE_SHIFT       3                 
+#define IOCON_PIO2_10_HYS              (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_10_OD               (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO2_2, address 0x4004 405C */
+#define IOCON_PIO2_2_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_2_FUNC_SHIFT        0                 
+#define IOCON_PIO2_2_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_2_MODE_SHIFT        3                 
+#define IOCON_PIO2_2_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_2_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO0_8, address 0x4004 4060 */
+#define IOCON_PIO0_8_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO0_8_FUNC_SHIFT        0                 
+#define IOCON_PIO0_8_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO0_8_MODE_SHIFT        3                 
+#define IOCON_PIO0_8_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO0_8_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO0_9, address 0x4004 4064 */
+#define IOCON_PIO0_9_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO0_9_FUNC_SHIFT        0                 
+#define IOCON_PIO0_9_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO0_9_MODE_SHIFT        3                 
+#define IOCON_PIO0_9_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO0_9_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_SWCLK_PIO0_10, address 0x4004 4068 */
+#define IOCON_SWCLK_PIO0_10_FUNC_MASK  0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_SWCLK_PIO0_10_FUNC_SHIFT 0                 
+#define IOCON_SWCLK_PIO0_10_MODE_MASK  0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_SWCLK_PIO0_10_MODE_SHIFT 3                 
+#define IOCON_SWCLK_PIO0_10_HYS        (1 << 5)           // Hysteresis.
+#define IOCON_SWCLK_PIO0_10_OD         (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO1_10, address 0x4004 406C */
+#define IOCON_PIO1_10_FUNC_MASK        0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO1_10_FUNC_SHIFT       0                 
+#define IOCON_PIO1_10_MODE_MASK        0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO1_10_MODE_SHIFT       3                 
+#define IOCON_PIO1_10_HYS              (1 << 5)           // Hysteresis.
+#define IOCON_PIO1_10_ADMODE           (1 << 7)           // Selects Analog/Digital mode
+#define IOCON_PIO1_10_OD               (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO2_11, address 0x4004 4070 */
+#define IOCON_PIO2_11_FUNC_MASK        0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_11_FUNC_SHIFT       0                 
+#define IOCON_PIO2_11_MODE_MASK        0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_11_MODE_SHIFT       3                 
+#define IOCON_PIO2_11_HYS              (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_11_OD               (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_R_PIO0_11, address 0x4004 4074 */
+#define IOCON_R_PIO0_11_FUNC_MASK      0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_R_PIO0_11_FUNC_SHIFT     0                 
+#define IOCON_R_PIO0_11_MODE_MASK      0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_R_PIO0_11_MODE_SHIFT     3                 
+#define IOCON_R_PIO0_11_HYS            (1 << 5)           // Hysteresis.
+#define IOCON_R_PIO0_11_ADMODE         (1 << 7)           // Selects Analog/Digital mode
+#define IOCON_R_PIO0_11_OD             (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_R_PIO1_0, address 0x4004 4078 */
+#define IOCON_R_PIO1_0_FUNC_MASK       0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_R_PIO1_0_FUNC_SHIFT      0                 
+#define IOCON_R_PIO1_0_MODE_MASK       0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_R_PIO1_0_MODE_SHIFT      3                 
+#define IOCON_R_PIO1_0_HYS             (1 << 5)           // Hysteresis.
+#define IOCON_R_PIO1_0_ADMODE          (1 << 7)           // Selects Analog/Digital mode
+#define IOCON_R_PIO1_0_OD              (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_R_PIO1_1, address 0x4004 407C */
+#define IOCON_R_PIO1_1_FUNC_MASK       0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_R_PIO1_1_FUNC_SHIFT      0                 
+#define IOCON_R_PIO1_1_MODE_MASK       0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_R_PIO1_1_MODE_SHIFT      3                 
+#define IOCON_R_PIO1_1_HYS             (1 << 5)           // Hysteresis.
+#define IOCON_R_PIO1_1_ADMODE          (1 << 7)           // Selects Analog/Digital mode
+#define IOCON_R_PIO1_1_OD              (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_R_PIO1_2, address 0x4004 4080 */
+#define IOCON_R_PIO1_2_FUNC_MASK       0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_R_PIO1_2_FUNC_SHIFT      0                 
+#define IOCON_R_PIO1_2_MODE_MASK       0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_R_PIO1_2_MODE_SHIFT      3                 
+#define IOCON_R_PIO1_2_HYS             (1 << 5)           // Hysteresis.
+#define IOCON_R_PIO1_2_ADMODE          (1 << 7)           // Selects Analog/Digital mode
+#define IOCON_R_PIO1_2_OD              (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO3_0, address 0x4004 4084 */
+#define IOCON_PIO3_0_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO3_0_FUNC_SHIFT        0                 
+#define IOCON_PIO3_0_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO3_0_MODE_SHIFT        3                 
+#define IOCON_PIO3_0_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO3_0_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO3_1, address 0x4004 4088 */
+#define IOCON_PIO3_1_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO3_1_FUNC_SHIFT        0                 
+#define IOCON_PIO3_1_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO3_1_MODE_SHIFT        3                 
+#define IOCON_PIO3_1_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO3_1_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO2_3, address 0x4004 408C */
+#define IOCON_PIO2_3_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO2_3_FUNC_SHIFT        0                 
+#define IOCON_PIO2_3_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO2_3_MODE_SHIFT        3                 
+#define IOCON_PIO2_3_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO2_3_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_SWDIO_PIO1_3, address 0x4004 4090 */
+#define IOCON_SWDIO_PIO1_3_FUNC_MASK   0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_SWDIO_PIO1_3_FUNC_SHIFT  0                 
+#define IOCON_SWDIO_PIO1_3_MODE_MASK   0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_SWDIO_PIO1_3_MODE_SHIFT  3                 
+#define IOCON_SWDIO_PIO1_3_HYS         (1 << 5)           // Hysteresis.
+#define IOCON_SWDIO_PIO1_3_ADMODE      (1 << 7)           // Selects Analog/Digital mode
+#define IOCON_SWDIO_PIO1_3_OD          (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO1_4, address 0x4004 4094 */
+#define IOCON_PIO1_4_FUNC_MASK         0x0007             // Selects pin function. This pin functions as WAKEUP pin if the 000 LPC111x/LPC11Cxx is in Deep power-down mode regardless of the value of FUNC. All other values are reserved.
+#define IOCON_PIO1_4_FUNC_SHIFT        0                 
+#define IOCON_PIO1_4_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO1_4_MODE_SHIFT        3                 
+#define IOCON_PIO1_4_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO1_4_ADMODE            (1 << 7)           // Selects Analog/Digital mode
+#define IOCON_PIO1_4_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO1_11, address 0x4004 4098 */
+#define IOCON_PIO1_11_FUNC_MASK        0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO1_11_FUNC_SHIFT       0                 
+#define IOCON_PIO1_11_MODE_MASK        0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO1_11_MODE_SHIFT       3                 
+#define IOCON_PIO1_11_HYS              (1 << 5)           // Hysteresis.
+#define IOCON_PIO1_11_ADMODE           (1 << 7)           // Selects Analog/Digital mode
+#define IOCON_PIO1_11_OD               (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO3_2, address 0x4004 409C */
+#define IOCON_PIO3_2_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO3_2_FUNC_SHIFT        0                 
+#define IOCON_PIO3_2_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO3_2_MODE_SHIFT        3                 
+#define IOCON_PIO3_2_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO3_2_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO1_5, address 0x4004 40A0 */
+#define IOCON_PIO1_5_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO1_5_FUNC_SHIFT        0                 
+#define IOCON_PIO1_5_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO1_5_MODE_SHIFT        3                 
+#define IOCON_PIO1_5_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO1_5_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO1_6, address 0x4004 40A4 */
+#define IOCON_PIO1_6_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO1_6_FUNC_SHIFT        0                 
+#define IOCON_PIO1_6_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO1_6_MODE_SHIFT        3                 
+#define IOCON_PIO1_6_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO1_6_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO1_7, address 0x4004 40A8 */
+#define IOCON_PIO1_7_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO1_7_FUNC_SHIFT        0                 
+#define IOCON_PIO1_7_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO1_7_MODE_SHIFT        3                 
+#define IOCON_PIO1_7_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO1_7_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_PIO3_3, address 0x4004 40AC */
+#define IOCON_PIO3_3_FUNC_MASK         0x0007             // Selects pin function. All other values are reserved.
+#define IOCON_PIO3_3_FUNC_SHIFT        0                 
+#define IOCON_PIO3_3_MODE_MASK         0x0018             // Selects function mode (on-chip pull-up/pull-down resistor control).
+#define IOCON_PIO3_3_MODE_SHIFT        3                 
+#define IOCON_PIO3_3_HYS               (1 << 5)           // Hysteresis.
+#define IOCON_PIO3_3_OD                (1 << 10)          // Selects pseudo open-drain mode.
+
+/* IOCON_SCK0_LOC, address 0x4004 40B0 */
+#define IOCON_SCK0_LOC_SCKLOC_MASK     0x0003             // Selects pin location for SCK0 function.
+#define IOCON_SCK0_LOC_SCKLOC_SHIFT    0                 
+
+/* IOCON_DSR_LOC, address 0x4004 40B4 */
+#define IOCON_DSR_LOC_DSRLOC_MASK      0x0003             // elects pin location for DSR function.
+#define IOCON_DSR_LOC_DSRLOC_SHIFT     0                 
+
+/* IOCON_DCD_LOC, address 0x4004 40B8 */
+#define IOCON_DCD_LOC_DCDLOC_MASK      0x0003             // Selects pin location for DCD function.
+#define IOCON_DCD_LOC_DCDLOC_SHIFT     0                 
+
+/* IOCON_RI_LOC, address 0x4004 40BC */
+#define IOCON_RI_LOC_RILOC_MASK        0x0003             // Selects pin location for RI function.
+#define IOCON_RI_LOC_RILOC_SHIFT       0                 
+
+/* IOCON_SSEL1_LOC, address 0x4004 4018 */
+#define IOCON_SSEL1_LOC_SSEL1LOC_MASK  0x0003             // Selects pin location for SSEL1 function.
+#define IOCON_SSEL1_LOC_SSEL1LOC_SHIFT 0                 
+
+/* IOCON_CT16B0_CAP0_LOC, address 0x4004 40C0 */
+#define IOCON_CT16B0_CAP0_LOC_CT16B0_CAP0LOC_MASK 0x0003             // Selects pin location for CT16B0_CAP0 function.
+#define IOCON_CT16B0_CAP0_LOC_CT16B0_CAP0LOC_SHIFT 0                 
+
+/* IOCON_SCK1_LOC, address 0x4004 40C4 */
+#define IOCON_SCK1_LOC_SCK1LOC_MASK    0x0003             // Selects pin location for SCK1 function.
+#define IOCON_SCK1_LOC_SCK1LOC_SHIFT   0                 
+
+/* IOCON_MISO1_LOC, address 0x4004 40C8 */
+#define IOCON_MISO1_LOC_MISO1LOC_MASK  0x0003             // Selects pin location for the MISO1 function.
+#define IOCON_MISO1_LOC_MISO1LOC_SHIFT 0                 
+
+/* IOCON_MOSI1_LOC, address 0x4004 40CC */
+#define IOCON_MOSI1_LOC_MOSI1LOC_MASK  0x0003             // Selects pin location for the MOSI1 function.
+#define IOCON_MOSI1_LOC_MOSI1LOC_SHIFT 0                 
+
+/* IOCON_CT32B0_CAP0_LOC, address 0x4004 40D0 */
+#define IOCON_CT32B0_CAP0_LOC_CT32B0_CAP0LOC_MASK 0x0003             // Selects pin location for the CT32B0_CAP0 function.
+#define IOCON_CT32B0_CAP0_LOC_CT32B0_CAP0LOC_SHIFT 0                 
+
+/* IOCON_RXD_LOC, address 0x4004 40D4 */
+#define IOCON_RXD_LOC_RXDLOC_MASK      0x0003             // Selects pin location for the RXD function.
+#define IOCON_RXD_LOC_RXDLOC_SHIFT     0                 
+
+/* GPIO0DIR, address 0x5000 8000 to GPIO3DIR, address 0x5003 8000 */
+#define GPIO0DIR_IO_MASK               0x0FFF             // Selects pin x as input or output (x = 0 to 11). 0 = Pin PIOn_x is configured as input. 1 = Pin PIOn_x is configured as output.
+#define GPIO0DIR_IO_SHIFT              0                 
+
+/* GPIO0IS, address 0x5000 8004 to GPIO3IS, address 0x5003 8004 */
+#define GPIO0IS_ISENSE_MASK            0x0FFF             // Selects interrupt on pin x as level or edge sensitive (x = 0 to 0x00 11). 0 = Interrupt on pin PIOn_x is configured as edge sensitive. 1 = Interrupt on pin PIOn_x is configured as level sensitive.
+#define GPIO0IS_ISENSE_SHIFT           0                 
+
+/* GPIO0IBE, address 0x5000 8008 to GPIO3IBE, address 0x5003 8008 */
+#define GPIO0IBE_IBE_MASK              0x0FFF             // Selects interrupt on pin x to be triggered on both edges (x = 0 0x00 to 11). 0 = Interrupt on pin PIOn_x is controlled through register GPIOnIEV. 1 = Both edges on pin PIOn_x trigger an interrupt.
+#define GPIO0IBE_IBE_SHIFT             0                 
+
+/* GPIO0IEV, address 0x5000 800C to GPIO3IEV, address 0x5003 800C */
+#define GPIO0IEV_IEV_MASK              0x0FFF             // Selects interrupt on pin x to be triggered rising or falling edges (x = 0 to 11). 0 = Depending on setting in register GPIOnIS (see Table 175), falling edges or LOW level on pin PIOn_x trigger an interrupt. 1 = Depending on setting in register GPIOnIS (see Table 175), rising edges or HIGH level on pin PIOn_x trigger an interrupt.
+#define GPIO0IEV_IEV_SHIFT             0                 
+
+/* GPIO0IE, address 0x5000 8010 to GPIO3IE, address 0x5003 8010 */
+#define GPIO0IE_MASK_MASK              0x0FFF             // Selects interrupt on pin x to be masked (x = 0 to 11). 0 = Interrupt on pin PIOn_x is masked. 1 = Interrupt on pin PIOn_x is not masked.
+#define GPIO0IE_MASK_SHIFT             0                 
+
+/* GPIO0RIS, address 0x5000 8014 to GPIO3RIS, address 0x5003 8014 */
+#define GPIO0RIS_RAWST_MASK            0x0FFF             // Raw interrupt status (x = 0 to 11). 0 = No interrupt on pin PIOn_x. 1 = Interrupt requirements met on PIOn_x.
+#define GPIO0RIS_RAWST_SHIFT           0                 
+
+/* GPIO0MIS, address 0x5000 8018 to GPIO3MIS, address 0x5003 8018 */
+#define GPIO0MIS_MASK_MASK             0x0FFF             // Selects interrupt on pin x to be masked (x = 0 to 11). 0 = No interrupt or interrupt masked on pin PIOn_x. 1 = Interrupt on PIOn_x.
+#define GPIO0MIS_MASK_SHIFT            0                 
+
+/* GPIO0IC, address 0x5000 801C to GPIO3IC, address 0x5003 801C */
+#define GPIO0IC_CLR_MASK               0x0FFF             // Selects interrupt on pin x to be cleared (x = 0 to 11). Clears 0x00 the interrupt edge detection logic. This register is write-only. Remark: The synchronizer between the GPIO and the NVIC blocks causes a delay of 2 clocks. It is recommended to add two NOPs after the clear of the interrupt edge detection logic before the exit of the interrupt service routine. 0 = No effect. 1 = Clears edge detection logic for pin PIOn_x.
+#define GPIO0IC_CLR_SHIFT              0                 
+
+/* U0IIR - address 0x4004 8008, Read Only */
+#define U0IIR_INTSTATUS                (1 << 0)           // Interrupt status. Note that U0IIR[0] is active low. The pending interrupt can be determined by evaluating U0IIR[3:1].
+#define U0IIR_INTID_MASK               0x000E             // Interrupt identification. U0IER[3:1] identifies an interrupt 0 corresponding to the UART Rx FIFO. All other combinations of U0IER[3:1] not listed below are reserved (100,101,111).
+#define U0IIR_INTID_SHIFT              1                 
+#define U0IIR_FIFOENABLE_MASK          0x00C0             // These bits are equivalent to U0FCR[0].
+#define U0IIR_FIFOENABLE_SHIFT         6                 
+#define U0IIR_ABEOINT                  (1 << 8)           // End of auto-baud interrupt. True if auto-baud has finished successfully and interrupt is enabled.
+#define U0IIR_ABTOINT                  (1 << 9)           // Auto-baud time-out interrupt. True if auto-baud has timed out and interrupt is enabled. Reserved, user software should not write ones to reserved bits. The value read from a reserved bit is not defined.
+
+/* U0FCR - address 0x4000 8008, Write Only */
+#define U0FCR_FIFOEN                   (1 << 0)           // FIFO Enable
+#define U0FCR_RXFIFORES                (1 << 1)           // RX FIFO Reset
+#define U0FCR_TXFIFORES                (1 << 2)           // TX FIFO Reset
+#define U0FCR_RXTL_MASK                0x00C0             // RX Trigger Level. These two bits determine how many     0 receiver UART FIFO characters must be written before an interrupt is activated.
+#define U0FCR_RXTL_SHIFT               6                 
+
+/* U0LCR - address 0x4000 800C */
+#define U0LCR_WLS_MASK                 0x0003             // Word Length Select
+#define U0LCR_WLS_SHIFT                0                 
+#define U0LCR_SBS                      (1 << 2)           // Stop Bit Select
+#define U0LCR_PE                       (1 << 3)           // Parity Enable
+#define U0LCR_PS_MASK                  0x0030             // Parity Select 0x0         Odd parity. Number of 1s in the transmitted character and the attached parity bit will be odd. 0x1         Even Parity. Number of 1s in the transmitted character and the attached parity bit will be even. 0x2         Forced 1 stick parity. 0x3         Forced 0 stick parity.
+#define U0LCR_PS_SHIFT                 4                 
+#define U0LCR_BC                       (1 << 6)           // Break Control
+#define U0LCR_DLAB                     (1 << 7)           // Divisor Latch Access Bit
+
+/* U0MCR - address 0x4000 8010 */
+#define U0MCR_DTRC                     (1 << 0)           // DTR Control. Source for modem output pin, DTR. This bit reads as 0 when modem loopback mode is active.
+#define U0MCR_RTSC                     (1 << 1)           // RTS Control. Source for modem output pin RTS. This bit reads as 0 0 when modem loopback mode is active.
+#define U0MCR_LMS                      (1 << 4)           // Loopback Mode Select. The modem loopback mode provides a 0 mechanism to perform diagnostic loopback testing. Serial data from the transmitter is connected internally to serial input of the receiver. Input pin, RXD, has no effect on loopback and output pin, TXD is held in marking state. The four modem inputs (CTS, DSR, RI and DCD) are disconnected externally. Externally, the modem outputs (RTS, DTR) are set inactive. Internally, the four modem outputs are connected to the four modem inputs. As a result of these connections, the upper four bits of the U0MSR will be driven by the lower four bits of the U0MCR rather than the four modem inputs in normal mode. This permits modem status interrupts to be generated in loopback mode by writing the lower four bits of U0MCR.
+#define U0MCR_RTSEN                    (1 << 6)           // RTS flow control
+#define U0MCR_CTSEN                    (1 << 7)           // CTS flow control
+
+/* U0LSR - address 0x4000 8014, Read Only */
+#define U0LSR_RDR                      (1 << 0)           // Receiver Data Ready. U0LSR[0] is set when the U0RBR holds 0 an unread character and is cleared when the UART RBR FIFO is empty.
+#define U0LSR_OE                       (1 << 1)           // Overrun Error. The overrun error condition is set as soon as it 0 occurs. A U0LSR read clears U0LSR[1]. U0LSR[1] is set when UART RSR has a new character assembled and the UART RBR FIFO is full. In this case, the UART RBR FIFO will not be overwritten and the character in the UART RSR will be lost.
+#define U0LSR_PE                       (1 << 2)           // Parity Error. When the parity bit of a received character is in the wrong state, a parity error occurs. A U0LSR read clears U0LSR[2]. Time of parity error detection is dependent on U0FCR[0]. Note: A parity error is associated with the character at the top of the UART RBR FIFO.
+#define U0LSR_FE                       (1 << 3)           // Framing Error. When the stop bit of a received character is a 0 logic 0, a framing error occurs. A U0LSR read clears U0LSR[3]. The time of the framing error detection is dependent on U0FCR0. Upon detection of a framing error, the RX will attempt to re-synchronize to the data and assume that the bad stop bit is actually an early start bit. However, it cannot be assumed that the next received byte will be correct even if there is no Framing Error. Note: A framing error is associated with the character at the top of the UART RBR FIFO.
+#define U0LSR_BI                       (1 << 4)           // Break Interrupt. When RXD1 is held in the spacing state (all zeros) for one full character transmission (start, data, parity, stop), a break interrupt occurs. Once the break condition has been detected, the receiver goes idle until RXD1 goes to marking state (all ones). A U0LSR read clears this status bit. The time of break detection is dependent on U0FCR[0]. Note: The break interrupt is associated with the character at the top of the UART RBR FIFO.
+#define U0LSR_THRE                     (1 << 5)           // Transmitter Holding Register Empty. THRE is set immediately 1 upon detection of an empty UART THR and is cleared on a U0THR write.
+#define U0LSR_TEMT                     (1 << 6)           // Transmitter Empty. TEMT is set when both U0THR and            1 U0TSR are empty; TEMT is cleared when either the U0TSR or the U0THR contain valid data. This bit is updated as soon as 50 % of the first stop bit has been transmitted or a byte has been written into the THR.
+#define U0LSR_RXFE                     (1 << 7)           // Error in RX FIFO. U0LSR[7] is set when a character with a RX 0 error such as framing error, parity error or break interrupt, is loaded into the U0RBR. This bit is cleared when the U0LSR register is read and there are no subsequent errors in the UART FIFO.
+
+/* U0MSR - address 0x4000 8018 */
+#define U0MSR_DCTS                     (1 << 0)           // Delta CTS. Set upon state change of input CTS. Cleared on a U0MSR read. 0         No change detected on modem input CTS. 1         State change detected on modem input CTS.
+#define U0MSR_DDSR                     (1 << 1)           // Delta DSR. Set upon state change of input DSR. Cleared on a U0MSR read. 0         No change detected on modem input DSR. 1         State change detected on modem input DSR.
+#define U0MSR_TERI                     (1 << 2)           // Trailing Edge RI. Set upon low to high transition of input RI. Cleared 0 on a U0MSR read. 0         No change detected on modem input, RI. 1         Low-to-high transition detected on RI.
+#define U0MSR_DDCD                     (1 << 3)           // Delta DCD. Set upon state change of input DCD. Cleared on a U0MSR read. 0         No change detected on modem input DCD. 1         State change detected on modem input DCD.
+#define U0MSR_CTS                      (1 << 4)           // Clear To Send State. Complement of input signal CTS. This bit is connected to U0MCR[1] in modem loopback mode.
+#define U0MSR_DSR                      (1 << 5)           // Data Set Ready State. Complement of input signal DSR. This bit is connected to U0MCR[0] in modem loopback mode.
+#define U0MSR_RI                       (1 << 6)           // Ring Indicator State. Complement of input RI. This bit is connected to U0MCR[2] in modem loopback mode.
+#define U0MSR_DCD                      (1 << 7)           // Data Carrier Detect State. Complement of input DCD. This bit is connected to U0MCR[3] in modem loopback mode.
+
+/* U0SCR - address 0x4000 801C */
+#define U0SCR_PAD_MASK                 0x00FF             // A readable, writable byte.
+#define U0SCR_PAD_SHIFT                0                 
+
+/* U0ACR - address 0x4000 8020 */
+#define U0ACR_START                    (1 << 0)           // Start bit. This bit is automatically cleared after auto-baud completion.
+#define U0ACR_MODE                     (1 << 1)           // Auto-baud mode select
+#define U0ACR_AUTORESTART              (1 << 2)           // Restart enable
+#define U0ACR_ABEOINTCLR               (1 << 8)           // End of auto-baud interrupt clear (write only accessible)
+#define U0ACR_ABTOINTCLR               (1 << 9)           // Auto-baud time-out interrupt clear (write only accessible)
+
+/* U0TER - address 0x4000 8030 */
+#define U0TER_TXEN                     (1 << 7)           // When this bit is 1, as it is after a Reset, data written to the THR 1 is output on the TXD pin as soon as any preceding data has been sent. If this bit cleared to 0 while a character is being sent, the transmission of that character is completed, but no further characters are sent until this bit is set again. In other words, a 0 in this bit blocks the transfer of characters from the THR or TX FIFO into the transmit shift register. Software can clear this bit when it detects that the a hardware-handshaking TX-permit signal (CTS) has gone false, or with software handshaking, when it receives an XOFF character (DC3). Software can set this bit again when it detects that the TX-permit signal has gone true, or when it receives an XON (DC1) character. Reserved
+
+/* U0RS485CTRL - address 0x4000 804C */
+#define U0RS485CTRL_NMMEN              (1 << 0)           // NMM enable.
+#define U0RS485CTRL_RXDIS              (1 << 1)           // Receiver enable.
+#define U0RS485CTRL_AADEN              (1 << 2)           // AAD enable.
+#define U0RS485CTRL_SEL                (1 << 3)           // Select direction control pin
+#define U0RS485CTRL_DCTRL              (1 << 4)           // Auto direction control enable.
+#define U0RS485CTRL_OINV               (1 << 5)           // Polarity control. This bit reverses the polarity of the direction control signal on the RTS (or DTR) pin.
+
+/* U0RS485ADRMATCH - address 0x4000 8050 */
+#define U0RS485ADRMATCH_ADRMATCH_MASK  0x00FF             // Contains the address match value.                                        0
+#define U0RS485ADRMATCH_ADRMATCH_SHIFT 0                 
+
+/* U0RS485DLY - address 0x4000 8054 */
+#define U0RS485DLY_DLY_MASK            0x00FF             // Contains the direction control (RTS or DTR) delay value. This register works in conjunction with an 8-bit counter.
+#define U0RS485DLY_DLY_SHIFT           0                 
+
+/* SSP0CR0 - address 0x4004 0000, SSP1CR0 - address 0x4005 8000 */
+#define SSP0CR0_DSS_MASK               0x000F             // Data Size Select. This field controls the number of bits transferred in each frame. Values 0000-0010 are not supported and should not be used.
+#define SSP0CR0_DSS_SHIFT              0                 
+#define SSP0CR0_FRF_MASK               0x0030             // Frame Format.
+#define SSP0CR0_FRF_SHIFT              4                 
+#define SSP0CR0_CPOL                   (1 << 6)           // Clock Out Polarity. This bit is only used in SPI mode.
+#define SSP0CR0_CPHA                   (1 << 7)           // Clock Out Phase. This bit is only used in SPI mode.
+#define SSP0CR0_SCR_MASK               0xFF00             // Serial Clock Rate. The number of prescaler output clocks per 0x00 bit on the bus, minus one. Given that CPSDVSR is the prescale divider, and the APB clock PCLK clocks the prescaler, the bit frequency is PCLK / (CPSDVSR  [SCR+1]). Reserved
+#define SSP0CR0_SCR_SHIFT              8                 
+
+/* SSP0CR1 - address 0x4004 0004, SSP1CR1 - address 0x4005 8004 */
+#define SSP0CR1_LBM                    (1 << 0)           // Loop Back Mode.
+#define SSP0CR1_SSE                    (1 << 1)           // SPI Enable.
+#define SSP0CR1_MS                     (1 << 2)           // Master/Slave Mode.This bit can only be written when the SSE bit is 0.
+#define SSP0CR1_SOD                    (1 << 3)           // Slave Output Disable. This bit is relevant only in slave        0 mode (MS = 1). If it is 1, this blocks this SPI controller from driving the transmit data line (MISO).
+
+/* SSP0DR - address 0x4004 0008, SSP1DR - address 0x4005 8008 */
+#define SSP0DR_DATA_MASK               0xFFFF             // Write: software can write data to be sent in a future frame to this 0x0000 register whenever the TNF bit in the Status register is 1, indicating that the Tx FIFO is not full. If the Tx FIFO was previously empty and the SPI controller is not busy on the bus, transmission of the data will begin immediately. Otherwise the data written to this register will be sent as soon as all previous data has been sent (and received). If the data length is less than 16 bit, software must right-justify the data written to this register. Read: software can read data from this register whenever the RNE bit in the Status register is 1, indicating that the Rx FIFO is not empty. When software reads this register, the SPI controller returns data from the least recent frame in the Rx FIFO. If the data length is less than 16 bit, the data is right-justified in this field with higher order bits filled with 0s. Reserved.
+#define SSP0DR_DATA_SHIFT              0                 
+
+/* SSP0SR - address 0x4004 000C, SSP1SR - address 0x4005 800C */
+#define SSP0SR_TFE                     (1 << 0)           // Transmit FIFO Empty. This bit is 1 is the Transmit FIFO is empty, 0 if not.
+#define SSP0SR_TNF                     (1 << 1)           // Transmit FIFO Not Full. This bit is 0 if the Tx FIFO is full, 1 if not. 1
+#define SSP0SR_RNE                     (1 << 2)           // Receive FIFO Not Empty. This bit is 0 if the Receive FIFO is empty, 1 if not.
+#define SSP0SR_RFF                     (1 << 3)           // Receive FIFO Full. This bit is 1 if the Receive FIFO is full, 0 if not.
+#define SSP0SR_BSY                     (1 << 4)           // Busy. This bit is 0 if the SPI controller is idle, 1 if it is currently sending/receiving a frame and/or the Tx FIFO is not empty.
+
+/* SSP0CPSR - address 0x4004 0010, SSP1CPSR - address 0x4005 8010 */
+#define SSP0CPSR_CPSDVSR_MASK          0x00FF             // This even value between 2 and 254, by which SPI_PCLK is divided to yield the prescaler output clock. Bit 0 always reads as 0.
+#define SSP0CPSR_CPSDVSR_SHIFT         0                 
+
+/* SSP0IMSC - address 0x4004 0014, SSP1IMSC - address 0x4005 8014 */
+#define SSP0IMSC_RORIM                 (1 << 0)           // Software should set this bit to enable interrupt when a Receive        0 Overrun occurs, that is, when the Rx FIFO is full and another frame is completely received. The ARM spec implies that the preceding frame data is overwritten by the new frame data when this occurs.
+#define SSP0IMSC_RTIM                  (1 << 1)           // Software should set this bit to enable interrupt when a Receive Time-out condition occurs. A Receive Time-out occurs when the Rx FIFO is not empty, and no has not been read for a time-out period. The time-out period is the same for master and slave modes and is determined by the SSP bit rate: 32 bits at PCLK / (CPSDVSR [SCR+1]).
+#define SSP0IMSC_RXIM                  (1 << 2)           // Software should set this bit to enable interrupt when the Rx FIFO is at 0 least half full.
+#define SSP0IMSC_TXIM                  (1 << 3)           // Software should set this bit to enable interrupt when the Tx FIFO is at 0 least half empty.
+
+/* SSP0RIS - address 0x4004 0018, SSP1RIS - address 0x4005 8018 */
+#define SSP0RIS_RORRIS                 (1 << 0)           // This bit is 1 if another frame was completely received while the 0 RxFIFO was full. The ARM spec implies that the preceding frame data is overwritten by the new frame data when this occurs.
+#define SSP0RIS_RTRIS                  (1 << 1)           // This bit is 1 if the Rx FIFO is not empty, and has not been read 0 for a time-out period. The time-out period is the same for master and slave modes and is determined by the SSP bit rate: 32 bits at PCLK / (CPSDVSR  [SCR+1]).
+#define SSP0RIS_RXRIS                  (1 << 2)           // This bit is 1 if the Rx FIFO is at least half full.
+#define SSP0RIS_TXRIS                  (1 << 3)           // This bit is 1 if the Tx FIFO is at least half empty.
+
+/* SSP0MIS - address 0x4004 001C, SSP1MIS - address 0x4005 801C */
+#define SSP0MIS_RORMIS                 (1 << 0)           // This bit is 1 if another frame was completely received while the 0 RxFIFO was full, and this interrupt is enabled.
+#define SSP0MIS_RTMIS                  (1 << 1)           // This bit is 1 if the Rx FIFO is not empty, has not been read for a time-out period, and this interrupt is enabled. The time-out period is the same for master and slave modes and is determined by the SSP bit rate: 32 bits at PCLK / (CPSDVSR [SCR+1]).
+#define SSP0MIS_RXMIS                  (1 << 2)           // This bit is 1 if the Rx FIFO is at least half full, and this interrupt 0 is enabled.
+#define SSP0MIS_TXMIS                  (1 << 3)           // This bit is 1 if the Tx FIFO is at least half empty, and this interrupt is enabled.
+
+/* SSP0ICR - address 0x4004 0020, SSP1ICR - address 0x4005 8020 */
+#define SSP0ICR_RORIC                  (1 << 0)           // Writing a 1 to this bit clears the "frame was received when RxFIFO was full" interrupt.
+#define SSP0ICR_RTIC                   (1 << 1)           // Writing a 1 to this bit clears the Rx FIFO was not empty and has not been read for a timeout period interrupt. The timeout period is the same for master and slave modes and is determined by the SSP bit rate: 32 bits at PCLK / (CPSDVSR [SCR+1]).
+
+/* I2C0CONSET - address 0x4000 0000 */
+#define I2C0CONSET_AA                  (1 << 2)           // Assert acknowledge flag.
+#define I2C0CONSET_SI                  (1 << 3)           // I2C interrupt flag.
+#define I2C0CONSET_STO                 (1 << 4)           // STOP flag.
+#define I2C0CONSET_STA                 (1 << 5)           // START flag.
+#define I2C0CONSET_I2EN                (1 << 6)           // I2C    interface enable. Reserved. The value read from a reserved bit is not defined.
+
+/* I2C0STAT - 0x4000 0004 */
+#define I2C0STAT_STATUS_MASK           0x00F8             // These bits give the actual status information about the                      I2 C interface. Reserved. The value read from a reserved bit is not defined.
+#define I2C0STAT_STATUS_SHIFT          3                 
+
+/* I2C0DAT - 0x4000 0008 */
+#define I2C0DAT_DATA_MASK              0x00FF             // This register holds data values that have been received or are to 0 be transmitted. Reserved. The value read from a reserved bit is not defined.
+#define I2C0DAT_DATA_SHIFT             0                 
+
+/* I2C0ADR0 - 0x4000 000C */
+#define I2C0ADR0_GC                    (1 << 0)           // General Call enable bit.
+#define I2C0ADR0_ADDRESS_MASK          0x00FE             // The I2C device address for slave mode. Reserved. The value read from a reserved bit is not defined.
+#define I2C0ADR0_ADDRESS_SHIFT         1                 
+
+/* I2C0SCLH - address 0x4000 0010 */
+#define I2C0SCLH_SCLH_MASK             0xFFFF             // Count for SCL HIGH time period selection.
+#define I2C0SCLH_SCLH_SHIFT            0                 
+
+/* I2C0SCLL - 0x4000 0014 */
+#define I2C0SCLL_SCLL_MASK             0xFFFF             // Count for SCL low time period selection.
+#define I2C0SCLL_SCLL_SHIFT            0                 
+
+/* I2C0CONCLR - 0x4000 0018 */
+#define I2C0CONCLR_AAC                 (1 << 2)           // Assert acknowledge Clear bit.
+#define I2C0CONCLR_SIC                 (1 << 3)           // I2C interrupt Clear bit.
+#define I2C0CONCLR_STAC                (1 << 5)           // START flag Clear bit.
+#define I2C0CONCLR_I2ENC               (1 << 6)           // I2C    interface Disable bit. Reserved. The value read from a reserved bit is not defined.
+
+/* I2C0MMCTRL - 0x4000 001C */
+#define I2C0MMCTRL_MM_ENA              (1 << 0)           // Monitor mode enable.
+#define I2C0MMCTRL_ENA_SCL             (1 << 1)           // SCL output enable.
+
+/* I2C0DATA_BUFFER - 0x4000 002C */
+#define I2C0DATA_BUFFER_DATA_MASK      0x00FF             // This register holds contents of the 8 MSBs of the DAT shift register. Reserved. The value read from a reserved bit is not defined.
+#define I2C0DATA_BUFFER_DATA_SHIFT     0                 
+
+/* CANCNTL, address 0x4005 0000 */
+#define CANCNTL_INIT                   (1 << 0)           // Initialization
+#define CANCNTL_IE                     (1 << 1)           // Module interrupt enable
+#define CANCNTL_SIE                    (1 << 2)           // Status change interrupt enable
+#define CANCNTL_EIE                    (1 << 3)           // Error interrupt enable
+#define CANCNTL_DAR                    (1 << 5)           // Disable automatic retransmission
+#define CANCNTL_CCE                    (1 << 6)           // Configuration change enable
+#define CANCNTL_TEST                   (1 << 7)           // Test mode enable
+
+/* CANSTAT, address 0x4005 0004 */
+#define CANSTAT_LEC_MASK               0x0007             // Last error code Type of the last error to occur on the CAN bus.The LEC field holds a code which indicates the type of the last error to occur on the CAN bus. This field will be cleared to `0' when a message has been transferred (reception or transmission) without error. The unused code `111' may be written by the CPU to check for updates.
+#define CANSTAT_LEC_SHIFT              0                 
+#define CANSTAT_TXOK                   (1 << 3)           // Transmitted a message successfully This bit must be reset by the CPU. It is never reset by the CAN controller.
+#define CANSTAT_RXOK                   (1 << 4)           // Received a message successfully This bit must be reset by the CPU. It is never reset by the CAN controller.
+#define CANSTAT_EPASS                  (1 << 5)           // Error passive
+#define CANSTAT_EWARN                  (1 << 6)           // Warning status
+#define CANSTAT_BOFF                   (1 << 7)           // Busoff status
+
+/* CANEC, address 0x4005 0008 */
+#define CANEC_TEC_MASK                 0x00FF             // Transmit error counter Current value of the transmit error counter (maximum value 255)
+#define CANEC_TEC_SHIFT                0                 
+#define CANEC_REC_MASK                 0x7F00             // Receive error counter Current value of the receive error counter (maximum value 127).
+#define CANEC_REC_SHIFT                8                 
+#define CANEC_RP                       (1 << 15)          // Receive error passive
+
+/* CANBT, address 0x4005 000C */
+#define CANBT_BRP_MASK                 0x003F             // Baud rate prescaler The value by which the oscillator frequency is divided for generating the bit time quanta. The bit time is built up from a multiple of this quanta. Valid values for the Baud Rate Prescaler are 0 to 63.[1]
+#define CANBT_BRP_SHIFT                0                 
+#define CANBT_SJW_MASK                 0x00C0             // (Re)synchronization jump width Valid programmed values are 0 to 3.[1]
+#define CANBT_SJW_SHIFT                6                 
+#define CANBT_TSEG1_MASK               0x0F00             // Time segment before the sample point Valid values are 1 to                  15.[1]
+#define CANBT_TSEG1_SHIFT              8                 
+#define CANBT_TSEG2_MASK               0x7000             // Time segment after the sample point Valid values are 0 to                  7.[1]
+#define CANBT_TSEG2_SHIFT              12                
+
+/* CANINT, address 0x4005 0010 */
+#define CANINT_INTID_MASK              0xFFFF             // 0x0000 = No interrupt is pending.                0 0x0001 - 0x0020 = Number of message object which caused the interrupt. 0x0021 - 0x7FFF = Unused 0x8000 = Status interrupt 0x8001 - 0xFFFF = Unused
+#define CANINT_INTID_SHIFT             0                 
+
+/* CANTEST, address 0x4005 0014 */
+#define CANTEST_BASIC                  (1 << 2)           // Basic mode
+#define CANTEST_SILENT                 (1 << 3)           // Silent mode
+#define CANTEST_LBACK                  (1 << 4)           // Loop back mode
+#define CANTEST_TX_MASK                0x0060             // Control of CAN_TXD pins
+#define CANTEST_TX_SHIFT               5                 
+#define CANTEST_RX                     (1 << 7)           // Monitors the actual value of the CAN_RXD pin.
+
+/* CANBRPE, address 0x4005 0018 */
+#define CANBRPE_BRPE_MASK              0x000F             // Baud rate prescaler extension By programming BRPE the Baud Rate Prescaler can be extended to values up to 1023. Hardware interprets the value as the value of BRPE (MSBs) and BRP (LSBs) plus one. Allowed values are 0 to 15.
+#define CANBRPE_BRPE_SHIFT             0                 
+
+/* CANIF1_CMDREQ, address 0x4005 0020 and CANIF2_CMDREQ, address 0x4005 0080 */
+#define CANIFn_CMDREQ_MN_MASK          0x003F             // Message number 0x01 - 0x20 = Valid message numbers. The message object in the message RAM is selected for data transfer. 0x00 = Not a valid message number. This value is interpreted as 0x20.[1] 0x21 - 0x3F = Not a valid message number. This value is interpreted as 0x01 - 0x1F.[1]
+#define CANIFn_CMDREQ_MN_SHIFT         0                 
+#define CANIFn_CMDREQ_BUSY             (1 << 15)          // BUSY flag
+
+/* CANIF1_CMDMSK, address 0x4005 0024 and CANIF2_CMDMSK, address 0x4005 0084 */
+#define CANIFn_CMDMSK_DATA_B           (1 << 0)           // Access data bytes 4-7
+#define CANIFn_CMDMSK_DATA_A           (1 << 1)           // Access data bytes 0-3
+#define CANIFn_CMDMSK_TXRQST           (1 << 2)           // Access transmission request bit (Write direction)
+#define CANIFn_CMDMSK_NEWDAT           (1 << 2)           // Access new data bit (Read direction)
+#define CANIFn_CMDMSK_CLRINTPND        (1 << 3)           // This bit is ignored in the write direction.
+#define CANIFn_CMDMSK_CTRL             (1 << 4)           // Access control bits
+#define CANIFn_CMDMSK_ARB              (1 << 5)           // Access arbitration bits
+#define CANIFn_CMDMSK_MASK             (1 << 6)           // Access mask bits
+#define CANIFn_CMDMSK_WR               (1 << 7)           // Write transfer Transfer data from the selected message buffer registers to the message object addressed by the command request register CANIFn_CMDREQ.
+#define CANIFn_CMDMSK_RD               (0 << 7)           // Read transfer Read data from the selected message buffer registers to the message object addressed by the command request register CANIFn_CMDREQ.
+
+/* CANIF1_MSK1, address 0x4005 0028 and CANIF2_MASK1, address 0x4005 0088 */
+#define CANIFn_MSK1_MSK_MASK           0xFFFF             // Identifier mask
+#define CANIFn_MSK1_MSK_SHIFT          0                 
+
+/* CANIF1_MSK2, address 0x4005 002C and CANIF2_MASK2, address 0x4005 008C */
+#define CANIFn_MSK2_MSK_MASK           0x1FFF             // Identifier mask
+#define CANIFn_MSK2_MSK_SHIFT          0                 
+#define CANIFn_MSK2_MDIR               (1 << 14)          // Mask message direction
+#define CANIFn_MSK2_MXTD               (1 << 15)          // Mask extend identifier
+
+/* CANIF1_ARB1, address 0x4005 0030 and CANIF2_ARB1, address 0x4005 0090 */
+#define CANIFn_ARB1_ID_MASK            0xFFFF             // Message identifier 29-bit identifier (extended frame) 11-bit identifier (standard frame)
+#define CANIFn_ARB1_ID_SHIFT           0                 
+
+/* CANIF1_ARB2, address 0x4005 0034 and CANIF2_ARB2, address 0x4005 0094 */
+#define CANIFn_ARB2_ID_MASK            0x1FFF             // Message identifier 29-bit identifier (extended frame) 11-bit identifier (standard frame)
+#define CANIFn_ARB2_ID_SHIFT           0                 
+#define CANIFn_ARB2_DIR                (1 << 13)          // Message direction
+#define CANIFn_ARB2_XTD                (1 << 14)          // Extend identifier
+#define CANIFn_ARB2_MSGVAL             (1 << 15)          // Message valid Remark: The CPU must reset the MSGVAL bit of all unused Messages Objects during the initialization before it resets bit INIT in the CAN Control Register. This bit must also be reset before the identifier ID28:0, the control bits XTD, DIR, or the Data Length Code DLC3:0 are modified, or if the Messages Object is no longer required.
+
+/* CANIF1_MCTRL, address 0x4005 0038 and CANIF2_MCTRL, address 0x4005 0098 */
+#define CANIFn_MCTRL_DLC_MASK          0x000F             // Data length code Remark: The Data Length Code of a Message Object must be defined the same as in all the corresponding objects with the same identifier at other nodes. When the Message Handler stores a data frame, it will write the DLC to the value given by the received message. 0000 - 1000 = Data frame has 0 - 8 data bytes. 1001 - 1111 = Data frame has 8 data bytes.
+#define CANIFn_MCTRL_DLC_SHIFT         0                 
+#define CANIFn_MCTRL_EOB               (1 << 7)           // End of buffer
+#define CANIFn_MCTRL_TXRQST            (1 << 8)           // Transmit request
+#define CANIFn_MCTRL_RMTEN             (1 << 9)           // Remote enable
+#define CANIFn_MCTRL_RXIE              (1 << 10)          // Receive interrupt enable
+#define CANIFn_MCTRL_TXIE              (1 << 11)          // Transmit interrupt enable
+#define CANIFn_MCTRL_UMASK             (1 << 12)          // Use acceptance mask Remark: If UMASK is set to 1, the message object's mask bits have to be programmed during initialization of the message object before MAGVAL is set to 1.
+#define CANIFn_MCTRL_INTPND            (1 << 13)          // Interrupt pending
+#define CANIFn_MCTRL_MSGLST            (1 << 14)          // Message lost (only valid for message objects in the direction receive).
+#define CANIFn_MCTRL_NEWDAT            (1 << 15)          // New data
+
+/* CANIF1_DA1, address 0x4005 003C and CANIF2_DA1, address 0x4005 009C */
+#define CANIFn_DA1_DATA0_MASK          0x00FF             // Data byte 0
+#define CANIFn_DA1_DATA0_SHIFT         0                 
+#define CANIFn_DA1_DATA1_MASK          0xFF00             // Data byte 1
+#define CANIFn_DA1_DATA1_SHIFT         8                 
+
+/* CANIF1_DA2, address 0x4005 0040 and CANIF2_DA2, address 0x4005 00A0 */
+#define CANIFn_DA2_DATA2_MASK          0x00FF             // Data byte 2
+#define CANIFn_DA2_DATA2_SHIFT         0                 
+#define CANIFn_DA2_DATA3_MASK          0xFF00             // Data byte 3
+#define CANIFn_DA2_DATA3_SHIFT         8                 
+
+/* CANIF1_DB1, address 0x4005 0044 and CANIF2_DB1, address 0x4005 00A4 */
+#define CANIFn_DB1_DATA4_MASK          0x00FF             // Data byte 4
+#define CANIFn_DB1_DATA4_SHIFT         0                 
+#define CANIFn_DB1_DATA5_MASK          0xFF00             // Data byte 5
+#define CANIFn_DB1_DATA5_SHIFT         8                 
+
+/* CANIF1_DB2, address 0x4005 0048 and CANIF2_DB2, address 0x4005 00A8 */
+#define CANIFn_DB2_DATA6_MASK          0x00FF             // Data byte 6
+#define CANIFn_DB2_DATA6_SHIFT         0                 
+#define CANIFn_DB2_DATA7_MASK          0xFF00             // Data byte 7
+#define CANIFn_DB2_DATA7_SHIFT         8                 
+
+/* CANTXREQ1, address 0x4005 0100 */
+#define CANTXREQ1_TXRQST_MASK          0xFFFF             // Transmission request bit of message objects 16 to 1. 0 = This message object is not waiting for transmission. 1 = The transmission of this message object is requested and not yet done. Reserved
+#define CANTXREQ1_TXRQST_SHIFT         0                 
+
+/* CANTXREQ2, address 0x4005 0104 */
+#define CANTXREQ2_TXRQST_MASK          0xFFFF             // Transmission request bit of message objects 32 to 17. 0 = This message object is not waiting for transmission. 1 = The transmission of this message object is requested and not yet done. Reserved
+#define CANTXREQ2_TXRQST_SHIFT         0                 
+
+/* CANND1, address 0x4005 0120 */
+#define CANND1_NEWDAT_MASK             0xFFFF             // New data bits of message objects 16 to 1. 0 = No new data has been written into the data portion of this Message Object by the Message Handler since last time this flag was cleared by the CPU. 1 = The Message Handler or the CPU has written new data into the data portion of this Message Object.
+#define CANND1_NEWDAT_SHIFT            0                 
+
+/* CANND2, address 0x4005 0124 */
+#define CANND2_NEWDAT_MASK             0xFFFF             // New data bits of message objects 32 to 17. 0 = No new data has been written into the data portion of this Message Object by the Message Handler since last time this flag was cleared by the CPU. 1 = The Message Handler or the CPU has written new data into the data portion of this Message Object.
+#define CANND2_NEWDAT_SHIFT            0                 
+
+/* CANIR1, address 0x4005 0140 */
+#define CANIR1_INTPND_INTERRUPT_MASK   0xFFFF             // pending bits of message objects 16 to 1. essage object is ignored by the message essage object is the source of an interrupt. Reserved
+#define CANIR1_INTPND_INTERRUPT_SHIFT  0                 
+
+/* CANIR2, addresses 0x4005 0144 */
+#define CANIR2_INTPND_MASK             0xFFFF             // Interrupt pending bits of message objects 32 to 17. 0 = This message object is ignored by the message handler. 1 = This message object is the source of an interrupt. Reserved
+#define CANIR2_INTPND_SHIFT            0                 
+
+/* CANMSGV1, addresses 0x4005 0160 */
+#define CANMSGV1_MSGVAL_MASK           0xFFFF             // Message valid bits of message objects 16 to 1. 0 = This message object is ignored by the message handler. 1 = This message object is configured and should be considered by the message handler. Reserved
+#define CANMSGV1_MSGVAL_SHIFT          0                 
+
+/* CANMSGV2, address 0x4005 0164 */
+#define CANMSGV2_MSGVAL_MASK           0xFFFF             // Message valid bits of message objects 32 to 17. 0 = This message object is ignored by the message handler. 1 = This message object is configured and should be considered by the message handler. Reserved
+#define CANMSGV2_MSGVAL_SHIFT          0                 
+
+/* CANCLKDIV, address 0x4005 0180 */
+#define CANCLKDIV_CLKDIVVAL_MASK       0x000F             // Clock divider value. CAN_CLK = PCLK/(CLKDIVVAL +1) 0000: CAN_CLK = PCLK divided by 1. 0001: CAN_CLK = PCLK divided by 2. 0010: CAN_CLK = PCLK divided by 3 0011: CAN_CLK = PCLK divided by 4. ... 1111: CAN_CLK = PCLK divided by 16.
+#define CANCLKDIV_CLKDIVVAL_SHIFT      0                 
+
+/* TMR16B0IR - address 0x4000 C000 and TMR16B1IR - address 0x4001 0000 */
+#define TMR16B0IR_MR0                  (1 << 0)           // Interrupt flag for match channel 0.
+#define TMR16B0IR_MR1                  (1 << 1)           // Interrupt flag for match channel 1.
+#define TMR16B0IR_MR2                  (1 << 2)           // Interrupt flag for match channel 2.
+#define TMR16B0IR_MR3                  (1 << 3)           // Interrupt flag for match channel 3.
+#define TMR16B0IR_CR0                  (1 << 4)           // Interrupt flag for capture channel 0 event.
+
+/* TMR16B0TCR - address 0x4000 C004 and TMR16B1TCR - address 0x4001 0004 */
+#define TMR16B0TCR_CEN                 (1 << 0)           // Counter Enable. When one, the Timer Counter and Prescale Counter are enabled for counting. When zero, the counters are disabled.
+#define TMR16B0TCR_CRST                (1 << 1)           // Counter Reset. When one, the Timer Counter and the Prescale Counter are synchronously reset on the next positive edge of PCLK. The counters remain reset until TCR[1] is returned to zero.
+
+/* TMR16B0TC, address 0x4000 C008 and TMR16B1TC 0x4001 0008 */
+#define TMR16B0TC_TC_MASK              0xFFFF             // Timer counter value.
+#define TMR16B0TC_TC_SHIFT             0                 
+
+/* TMR16B0PR, address 0x4000 C00C and TMR16B1PR 0x4001 000C */
+#define TMR16B0PR_PR_MASK              0xFFFF             // Prescale max value.
+#define TMR16B0PR_PR_SHIFT             0                 
+
+/* TMR16B0PC, address 0x4001 C010 and TMR16B1PC 0x4000 0010 */
+#define TMR16B0PC_PC_MASK              0xFFFF             // Prescale counter value.
+#define TMR16B0PC_PC_SHIFT             0                 
+
+/* TMR16B0MCR - address 0x4000 C014 and TMR16B1MCR - address 0x4001 0014 */
+#define TMR16B0MCR_MR0I                (1 << 0)           // Interrupt on MR0: an interrupt is generated when MR0 matches the value in the TC.
+#define TMR16B0MCR_MR0R                (1 << 1)           // Reset on MR0: the TC will be reset if MR0 matches it.
+#define TMR16B0MCR_MR0S                (1 << 2)           // Stop on MR0: the TC and PC will be stopped and TCR[0] will be set to 0 if MR0 matches 0 the TC.
+#define TMR16B0MCR_MR1I                (1 << 3)           // Interrupt on MR1: an interrupt is generated when MR1 matches the value in the TC.
+#define TMR16B0MCR_MR1R                (1 << 4)           // Reset on MR1: the TC will be reset if MR1 matches it.
+#define TMR16B0MCR_MR1S                (1 << 5)           // Stop on MR1: the TC and PC will be stopped and TCR[0] will be set to 0 if MR1 matches 0 the TC.
+#define TMR16B0MCR_MR2I                (1 << 6)           // Interrupt on MR2: an interrupt is generated when MR2 matches the value in the TC.
+#define TMR16B0MCR_MR2R                (1 << 7)           // Reset on MR2: the TC will be reset if MR2 matches it.
+#define TMR16B0MCR_MR2S                (1 << 8)           // Stop on MR2: the TC and PC will be stopped and TCR[0] will be set to 0 if MR2 matches 0 the TC.
+#define TMR16B0MCR_MR3I                (1 << 9)           // Interrupt on MR3: an interrupt is generated when MR3 matches the value in the TC.
+#define TMR16B0MCR_MR3R                (1 << 10)          // Reset on MR3: the TC will be reset if MR3 matches it.
+#define TMR16B0MCR_MR3S                (1 << 11)          // Stop on MR3: the TC and PC will be stopped and TCR[0] will be set to 0 if MR3 matches 0 the TC.
+
+/* TMR16B0MR0 to 3, addresses 0x4000 C018 to 24 and TMR16B1MR0 to 3, addresses 0x4001 0018 to 24 */
+#define TMR16B0MR0_to_3_MATCH_MASK     0xFFFF             // Timer counter match value.
+#define TMR16B0MR0_to_3_MATCH_SHIFT    0                 
+
+/* TMR16B0CCR - address 0x4000 C028 and TMR16B1CCR - address 0x4001 0028 */
+#define TMR16B0CCR_CAP0RE              (1 << 0)           // Capture on CT16Bn_CAP0 rising edge: a sequence of 0 then 1 on CT16Bn_CAP0 will cause CR0 to be loaded with the contents of TC.
+#define TMR16B0CCR_CAP0FE              (1 << 1)           // Capture on CT16Bn_CAP0 falling edge: a sequence of 1 then 0 on CT16Bn_CAP0 will 0 cause CR0 to be loaded with the contents of TC.
+#define TMR16B0CCR_CAP0I               (1 << 2)           // Interrupt on CT16Bn_CAP0 event: a CR0 load due to a CT16Bn_CAP0 event will generate an interrupt.
+
+/* TMR16B0CR0, address 0x4000 C02C and TMR16B1CR0, address 0x4001 002C */
+#define TMR16B0CR0_CAP_MASK            0xFFFF             // Timer counter capture value.
+#define TMR16B0CR0_CAP_SHIFT           0                 
+
+/* TMR16B0EMR - address 0x4000 C03C and TMR16B1EMR - address 0x4001 003C */
+#define TMR16B0EMR_EM0                 (1 << 0)           // External Match 0. This bit reflects the state of output CT16B0_MAT0/CT16B1_MAT0,       0 whether or not this output is connected to its pin. When a match occurs between the TC and MR0, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[5:4] control the functionality of this output. This bit is driven to the CT16B0_MAT0/CT16B1_MAT0 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
+#define TMR16B0EMR_EM1                 (1 << 1)           // External Match 1. This bit reflects the state of output CT16B0_MAT1/CT16B1_MAT1,       0 whether or not this output is connected to its pin. When a match occurs between the TC and MR1, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[7:6] control the functionality of this output. This bit is driven to the CT16B0_MAT1/CT16B1_MAT1 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
+#define TMR16B0EMR_EM2                 (1 << 2)           // External Match 2. This bit reflects the state of output match channel 2, whether or not     0 this output is connected to its pin. When a match occurs between the TC and MR2, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[9:8] control the functionality of this output. Note that on counter/timer 0 this match channel is not pinned out. This bit is driven to the CT16B1_MAT2 pin if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
+#define TMR16B0EMR_EM3                 (1 << 3)           // External Match 3. This bit reflects the state of output of match channel 3. When a match 0 occurs between the TC and MR3, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[11:10] control the functionality of this output. There is no output pin available for this channel on either of the 16-bit timers.
+#define TMR16B0EMR_EMC0_MASK           0x0030             // External Match Control 0. Determines the functionality of External Match 0.
+#define TMR16B0EMR_EMC0_SHIFT          4                 
+#define TMR16B0EMR_EMC1_MASK           0x00C0             // External Match Control 1. Determines the functionality of External Match 1.
+#define TMR16B0EMR_EMC1_SHIFT          6                 
+#define TMR16B0EMR_EMC2_MASK           0x0300             // External Match Control 2. Determines the functionality of External Match 2.
+#define TMR16B0EMR_EMC2_SHIFT          8                 
+#define TMR16B0EMR_EMC3_MASK           0x0C00             // External Match Control 3. Determines the functionality of External Match 3.
+#define TMR16B0EMR_EMC3_SHIFT          10                
+
+/* TMR16B0CTCR - address 0x4000 C070 and TMR16B1CTCR - address 0x4001 0070 */
+#define TMR16B0CTCR_CTM_MASK           0x0003             // Counter/Timer Mode. This field selects which rising PCLK    00 edges can increment Timer's Prescale Counter (PC), or clear PC and increment Timer Counter (TC).
+#define TMR16B0CTCR_CTM_SHIFT          0                 
+
+/* TMR16B0PWMC - address 0x4000 C074 and TMR16B1PWMC- address 0x4001 0074 */
+#define TMR16B0PWMC_PWMEN0             (1 << 0)           // PWM channel0 enable
+#define TMR16B0PWMC_PWMEN1             (1 << 1)           // PWM channel1 enable
+#define TMR16B0PWMC_PWMEN2             (1 << 2)           // PWM channel2 enable
+#define TMR16B0PWMC_PWMEN3             (1 << 3)           // PWM channel3 enable Note: It is recommended to use match channel 3 to set the PWM cycle because it is not pinned out.
+
+/* TMR16B0IR - address 0x4000 C000 and TMR16B1IR - address 0x4001 0000 */
+#define TMR16B0IR_MR0INT               (1 << 0)           // Interrupt flag for match channel 0.
+#define TMR16B0IR_MR1INT               (1 << 1)           // Interrupt flag for match channel 1.
+#define TMR16B0IR_MR2INT               (1 << 2)           // Interrupt flag for match channel 2.
+#define TMR16B0IR_MR3INT               (1 << 3)           // Interrupt flag for match channel 3.
+#define TMR16B0IR_CR0INT               (1 << 4)           // Interrupt flag for capture channel 0 event.
+#define TMR16B0IR_CR1INT               (1 << 5)           // Interrupt flag for capture channel 1 event.
+
+/* TMR16B0TCR - address 0x4000 C004 and TMR16B1TCR - address 0x4001 0004 */
+#define TMR16B0TCR_CEN                 (1 << 0)           // Counter Enable. When one, the Timer Counter and Prescale Counter are enabled for counting. When zero, the counters are disabled.
+#define TMR16B0TCR_CRST                (1 << 1)           // Counter Reset. When one, the Timer Counter and the Prescale Counter are synchronously reset on the next positive edge of PCLK. The counters remain reset until TCR[1] is returned to zero.
+
+/* TMR16B0TC, address 0x4000 C008 and TMR16B1TC 0x4001 0008 */
+#define TMR16B0TC_TC_MASK              0xFFFF             // Timer counter value.
+#define TMR16B0TC_TC_SHIFT             0                 
+
+/* TMR16B0PR, address 0x4000 C00C and TMR16B1PR 0x4001 000C */
+#define TMR16B0PR_PR_MASK              0xFFFF             // Prescale max value.
+#define TMR16B0PR_PR_SHIFT             0                 
+
+/* TMR16B0PC, address 0x4001 C010 and TMR16B1PC 0x4000 0010 */
+#define TMR16B0PC_PC_MASK              0xFFFF             // Prescale counter value.
+#define TMR16B0PC_PC_SHIFT             0                 
+
+/* TMR16B0MCR - address 0x4000 C014 and TMR16B1MCR - address 0x4001 0014 */
+#define TMR16B0MCR_MR0I                (1 << 0)           // Interrupt on MR0: an interrupt is generated when MR0 matches the value in the TC.
+#define TMR16B0MCR_MR0R                (1 << 1)           // Reset on MR0: the TC will be reset if MR0 matches it.
+#define TMR16B0MCR_MR0S                (1 << 2)           // Stop on MR0: the TC and PC will be stopped and TCR[0] will be set to 0 if MR0 matches 0 the TC.
+#define TMR16B0MCR_MR1I                (1 << 3)           // Interrupt on MR1: an interrupt is generated when MR1 matches the value in the TC.
+#define TMR16B0MCR_MR1R                (1 << 4)           // Reset on MR1: the TC will be reset if MR1 matches it.
+#define TMR16B0MCR_MR1S                (1 << 5)           // Stop on MR1: the TC and PC will be stopped and TCR[0] will be set to 0 if MR1 matches 0 the TC.
+#define TMR16B0MCR_MR2I                (1 << 6)           // Interrupt on MR2: an interrupt is generated when MR2 matches the value in the TC.
+#define TMR16B0MCR_MR2R                (1 << 7)           // Reset on MR2: the TC will be reset if MR2 matches it.
+#define TMR16B0MCR_MR2S                (1 << 8)           // Stop on MR2: the TC and PC will be stopped and TCR[0] will be set to 0 if MR2 matches 0 the TC.
+#define TMR16B0MCR_MR3I                (1 << 9)           // Interrupt on MR3: an interrupt is generated when MR3 matches the value in the TC.
+#define TMR16B0MCR_MR3R                (1 << 10)          // Reset on MR3: the TC will be reset if MR3 matches it.
+#define TMR16B0MCR_MR3S                (1 << 11)          // Stop on MR3: the TC and PC will be stopped and TCR[0] will be set to 0 if MR3 matches 0 the TC.
+
+/* TMR16B0MR0 to 3, addresses 0x4000 C018 to 24 and TMR16B1MR0 to 3, addresses 0x4001 0018 to 24 */
+#define TMR16B0MR0_to_3_MATCH_MASK     0xFFFF             // Timer counter match value.
+#define TMR16B0MR0_to_3_MATCH_SHIFT    0                 
+
+/* TMR16B0CCR - address 0x4000 C028 and TMR16B1CCR - address 0x4001 0028 */
+#define TMR16B0CCR_CAP0RE              (1 << 0)           // Capture on CT16Bn_CAP0 rising edge: a sequence of 0 then 1 on CT16Bn_CAP0 will cause CR0 to be loaded with the contents of TC.
+#define TMR16B0CCR_CAP0FE              (1 << 1)           // Capture on CT16Bn_CAP0 falling edge: a sequence of 1 then 0 on CT16Bn_CAP0 will 0 cause CR0 to be loaded with the contents of TC.
+#define TMR16B0CCR_CAP0I               (1 << 2)           // Interrupt on CT16Bn_CAP0 event: a CR0 load due to a CT16Bn_CAP0 event will generate an interrupt.
+#define TMR16B0CCR_CAP1RE              (1 << 3)           // Capture on CT16Bn_CAP1 rising edge: a sequence of 0 then 1 on CT16Bn_CAP1 will cause CR1 to be loaded with the contents of TC.
+#define TMR16B0CCR_CAP1FE              (1 << 4)           // Capture on CT16Bn_CAP1 falling edge: a sequence of 1 then 0 on CT16Bn_CAP1 will 0 cause CR1 to be loaded with the contents of TC.
+#define TMR16B0CCR_CAP1I               (1 << 5)           // Interrupt on CT16Bn_CAP1 event: a CR1 load due to a CT16Bn_CAP1 event will generate an interrupt.
+
+/* TMR16B0EMR - address 0x4000 C03C and TMR16B1EMR - address 0x4001 003C */
+#define TMR16B0EMR_EM0                 (1 << 0)           // External Match 0. This bit reflects the state of output CT16B0_MAT0/CT16B1_MAT0,       0 whether or not this output is connected to its pin. When a match occurs between the TC and MR0, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[5:4] control the functionality of this output. This bit is driven to the CT16B0_MAT0/CT16B1_MAT0 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
+#define TMR16B0EMR_EM1                 (1 << 1)           // External Match 1. This bit reflects the state of output CT16B0_MAT1/CT16B1_MAT1,       0 whether or not this output is connected to its pin. When a match occurs between the TC and MR1, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[7:6] control the functionality of this output. This bit is driven to the CT16B0_MAT1/CT16B1_MAT1 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
+#define TMR16B0EMR_EM2                 (1 << 2)           // External Match 2. This bit reflects the state of output match channel 2, whether or not     0 this output is connected to its pin. When a match occurs between the TC and MR2, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[9:8] control the functionality of this output. Note that on counter/timer 0 this match channel is not pinned out. This bit is driven to the CT16B1_MAT2 pin if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
+#define TMR16B0EMR_EM3                 (1 << 3)           // External Match 3. This bit reflects the state of output of match channel 3. When a match 0 occurs between the TC and MR3, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[11:10] control the functionality of this output. There is no output pin available for this channel on either of the 16-bit timers.
+#define TMR16B0EMR_EMC0_MASK           0x0030             // External Match Control 0. Determines the functionality of External Match 0.
+#define TMR16B0EMR_EMC0_SHIFT          4                 
+#define TMR16B0EMR_EMC1_MASK           0x00C0             // External Match Control 1. Determines the functionality of External Match 1.
+#define TMR16B0EMR_EMC1_SHIFT          6                 
+#define TMR16B0EMR_EMC2_MASK           0x0300             // External Match Control 2. Determines the functionality of External Match 2.
+#define TMR16B0EMR_EMC2_SHIFT          8                 
+#define TMR16B0EMR_EMC3_MASK           0x0C00             // External Match Control 3. Determines the functionality of External Match 3.
+#define TMR16B0EMR_EMC3_SHIFT          10                
+
+/* TMR16B0CTCR - address 0x4000 C070 and TMR16B1CTCR - address 0x4001 0070 */
+#define TMR16B0CTCR_CTM_MASK           0x0003             // Counter/Timer Mode. This field selects which rising PCLK    00 edges can increment Timer's Prescale Counter (PC), or clear PC and increment Timer Counter (TC).
+#define TMR16B0CTCR_CTM_SHIFT          0                 
+#define TMR16B0CTCR_SELCC_MASK         0x00E0             // When bit 4 is one, these bits select which capture input edge 0 will cause the timer and prescaler to be cleared. These bits have no effect when bit 4 is zero.
+#define TMR16B0CTCR_SELCC_SHIFT        5                 
+
+/* TMR16B0PWMC - address 0x4000 C074 and TMR16B1PWMC- address 0x4001 0074 */
+#define TMR16B0PWMC_PWMEN0             (1 << 0)           // PWM channel0 enable
+#define TMR16B0PWMC_PWMEN1             (1 << 1)           // PWM channel1 enable
+#define TMR16B0PWMC_PWMEN2             (1 << 2)           // PWM channel2 enable
+#define TMR16B0PWMC_PWMEN3             (1 << 3)           // PWM channel3 enable Note: It is recommended to use match channel 3 to set the PWM cycle because it is not pinned out.
+
+/* TMR32B0IR - address 0x4001 4000 and TMR32B1IR - address 0x4001 8000 */
+#define TMR32B0IR_MR0_INTERRUPT        (1 << 0)           // Interrupt flag for match channel 0.
+#define TMR32B0IR_MR1_INTERRUPT        (1 << 1)           // Interrupt flag for match channel 1.
+#define TMR32B0IR_MR2_INTERRUPT        (1 << 2)           // Interrupt flag for match channel 2.
+#define TMR32B0IR_MR3_INTERRUPT        (1 << 3)           // Interrupt flag for match channel 3.
+#define TMR32B0IR_CR0_INTERRUPT        (1 << 4)           // Interrupt flag for capture channel 0 event.
+
+/* TMR32B0TCR - address 0x4001 4004 and TMR32B1TCR - address 0x4001 8004 */
+#define TMR32B0TCR_CEN                 (1 << 0)           // When one, the Timer Counter and Prescale Counter are 0 enabled for counting. When zero, the counters are disabled.
+#define TMR32B0TCR_CRST                (1 << 1)           // When one, the Timer Counter and the Prescale Counter 0 are synchronously reset on the next positive edge of PCLK. The counters remain reset until TCR[1] is returned to zero.
+
+/* TMR32B0TC, address 0x4001 4008 and TMR32B1TC 0x4001 8008 */
+#define TMR32B0TC_TC_MASK              0xFFFFFFFF         // Timer counter value.
+#define TMR32B0TC_TC_SHIFT             0                 
+
+/* TMR32B0PR, address 0x4001 400C and TMR32B1PR 0x4001 800C */
+#define TMR32B0PR_PR_MASK              0xFFFFFFFF         // Prescale value.
+#define TMR32B0PR_PR_SHIFT             0                 
+
+/* TMR32B0PC, address 0x4001 4010 and TMR32B1PC 0x4001 8010 */
+#define TMR32B0PC_PC_MASK              0xFFFFFFFF         // Prescale counter value.
+#define TMR32B0PC_PC_SHIFT             0                 
+
+/* TMR32B0MCR - address 0x4001 4014 and TMR32B1MCR - address 0x4001 8014 */
+#define TMR32B0MCR_MR0I                (1 << 0)           // Interrupt on MR0: an interrupt is generated when MR0 matches the value in the TC.
+#define TMR32B0MCR_MR0R                (1 << 1)           // Reset on MR0: the TC will be reset if MR0 matches it.
+#define TMR32B0MCR_MR0S                (1 << 2)           // Stop on MR0: the TC and PC will be stopped and TCR[0] will be set to 0 if MR0 matches 0 the TC.
+#define TMR32B0MCR_MR1I                (1 << 3)           // Interrupt on MR1: an interrupt is generated when MR1 matches the value in the TC.
+#define TMR32B0MCR_MR1R                (1 << 4)           // Reset on MR1: the TC will be reset if MR1 matches it.
+#define TMR32B0MCR_MR1S                (1 << 5)           // Stop on MR1: the TC and PC will be stopped and TCR[0] will be set to 0 if MR1 matches 0 the TC.
+#define TMR32B0MCR_MR2I                (1 << 6)           // Interrupt on MR2: an interrupt is generated when MR2 matches the value in the TC.
+#define TMR32B0MCR_MR2R                (1 << 7)           // Reset on MR2: the TC will be reset if MR2 matches it.
+#define TMR32B0MCR_MR2S                (1 << 8)           // Stop on MR2: the TC and PC will be stopped and TCR[0] will be set to 0 if MR2 matches 0 the TC.
+#define TMR32B0MCR_MR3I                (1 << 9)           // Interrupt on MR3: an interrupt is generated when MR3 matches the value in the TC.
+#define TMR32B0MCR_MR3R                (1 << 10)          // Reset on MR3: the TC will be reset if MR3 matches it.
+#define TMR32B0MCR_MR3S                (1 << 11)          // Stop on MR3: the TC and PC will be stopped and TCR[0] will be set to 0 if MR3 matches 0 the TC.
+
+/* TMR32B0MR0 to 3, addresses 0x4001 4018 to 24 and TMR32B1MR0 to 3, addresses 0x4001 8018 to 24 */
+#define TMR32B0MRn_MATCH_MASK          0xFFFFFFFF         // Timer counter match value.
+#define TMR32B0MRn_MATCH_SHIFT         0                 
+
+/* TMR32B0CCR - address 0x4001 4028 and TMR32B1CCR - address 0x4001 8028 */
+#define TMR32B0CCR_CAP0RE              (1 << 0)           // Capture on CT32Bn_CAP0 rising edge: a sequence of 0 then 1 on CT32Bn_CAP0 will cause CR0 to be loaded with the contents of TC.
+#define TMR32B0CCR_CAP0FE              (1 << 1)           // Capture on CT32Bn_CAP0 falling edge: a sequence of 1 then 0 on CT32Bn_CAP0 will 0 cause CR0 to be loaded with the contents of TC.
+#define TMR32B0CCR_CAP0I               (1 << 2)           // Interrupt on CT32Bn_CAP0 event: a CR0 load due to a CT32Bn_CAP0 event will generate an interrupt.
+
+/* TMR32B0CR0, addresses 0x4001 402C and TMR32B1CR0, addresses 0x4001 802C */
+#define TMR32B0CR0_CAP_MASK            0xFFFFFFFF         // Timer counter capture value.
+#define TMR32B0CR0_CAP_SHIFT           0                 
+
+/* TMR32B0EMR - address 0x4001 403C and TMR32B1EMR - address0x4001 803C */
+#define TMR32B0EMR_EM0                 (1 << 0)           // External Match 0. This bit reflects the state of output CT32Bn_MAT0, whether or not this 0 output is connected to its pin. When a match occurs between the TC and MR0, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[5:4] control the functionality of this output. This bit is driven to the CT32B0_MAT0/CT16B1_MAT0 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
+#define TMR32B0EMR_EM1                 (1 << 1)           // External Match 1. This bit reflects the state of output CT32Bn_MAT1, whether or not this 0 output is connected to its pin. When a match occurs between the TC and MR1, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[7:6] control the functionality of this output. This bit is driven to the CT32B0_MAT1/CT16B1_MAT1 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
+#define TMR32B0EMR_EM2                 (1 << 2)           // External Match 2. This bit reflects the state of output CT32Bn_MAT2, whether or not this 0 output is connected to its pin. When a match occurs between the TC and MR2, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[9:8] control the functionality of this output. This bit is driven to the CT32B0_MAT2/CT16B1_MAT2 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
+#define TMR32B0EMR_EM3                 (1 << 3)           // External Match 3. This bit reflects the state of output CT32Bn_MAT3, whether or not this output is connected to its pin. When a match occurs between the TC and MR3, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[11:10] control the functionality of this output. This bit is driven to the CT32B0_MAT3/CT16B1_MAT3 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
+#define TMR32B0EMR_EMC0_MASK           0x0030             // External Match Control 0. Determines the functionality of External Match 0.
+#define TMR32B0EMR_EMC0_SHIFT          4                 
+#define TMR32B0EMR_EMC1_MASK           0x00C0             // External Match Control 1. Determines the functionality of External Match 1.
+#define TMR32B0EMR_EMC1_SHIFT          6                 
+#define TMR32B0EMR_EMC2_MASK           0x0300             // External Match Control 2. Determines the functionality of External Match 2.
+#define TMR32B0EMR_EMC2_SHIFT          8                 
+#define TMR32B0EMR_EMC3_MASK           0x0C00             // External Match Control 3. Determines the functionality of External Match 3.
+#define TMR32B0EMR_EMC3_SHIFT          10                
+
+/* TMR32B0CTCR - address 0x4001 4070 and TMR32B1TCR - address 0x4001 8070 */
+#define TMR32B0CTCR_CTM_MASK           0x0003             // Counter/Timer Mode. This field selects which rising PCLK edges can increment Timer's Prescale Counter (PC), or clear PC and increment Timer Counter (TC). Timer Mode: every rising PCLK edge
+#define TMR32B0CTCR_CTM_SHIFT          0                 
+#define TMR32B0CTCR_CIS_MASK           0x000C             // Count Input Select. When bits 1:0 in this register are not 00, these bits select which CAP pin is sampled for clocking:
+#define TMR32B0CTCR_CIS_SHIFT          2                 
+
+/* TMR32B0PWMC - 0x4001 4074 and TMR32B1PWMC - 0x4001 8074 */
+#define TMR32B0PWMC_PWMEN0             (1 << 0)           // PWM channel 0 enable
+#define TMR32B0PWMC_PWMEN1             (1 << 1)           // PWM channel 1 enable
+#define TMR32B0PWMC_PWMEN2             (1 << 2)           // PWM channel 2 enable
+#define TMR32B0PWMC_PWMEN3             (1 << 3)           // PWM channel 3 enable Note: It is recommended to use match channel 3 to set the PWM cycle.
+
+/* TMR32B0IR - address 0x4001 4000 and TMR32B1IR - address 0x4001 8000 */
+#define TMR32B0IR_MR0INT               (1 << 0)           // Interrupt flag for match channel 0.
+#define TMR32B0IR_MR1INT               (1 << 1)           // Interrupt flag for match channel 1.
+#define TMR32B0IR_MR2INT               (1 << 2)           // Interrupt flag for match channel 2.
+#define TMR32B0IR_MR3INT               (1 << 3)           // Interrupt flag for match channel 3.
+#define TMR32B0IR_CR0INT               (1 << 4)           // Interrupt flag for capture channel 0 event.
+#define TMR32B0IR_CR1INT               (1 << 5)           // Interrupt flag for capture channel 1 event.
+
+/* TMR32B0TCR - address 0x4001 4004 and TMR32B1TCR - address 0x4001 8004 */
+#define TMR32B0TCR_CEN                 (1 << 0)           // When one, the Timer Counter and Prescale Counter are 0 enabled for counting. When zero, the counters are disabled.
+#define TMR32B0TCR_CRST                (1 << 1)           // When one, the Timer Counter and the Prescale Counter 0 are synchronously reset on the next positive edge of PCLK. The counters remain reset until TCR[1] is returned to zero.
+
+/* TMR32B0TC, address 0x4001 4008 and TMR32B1TC 0x4001 8008 */
+#define TMR32B0TC_TC_MASK              0xFFFFFFFF         // Timer counter value.
+#define TMR32B0TC_TC_SHIFT             0                 
+
+/* TMR32B0PR, address 0x4001 400C and TMR32B1PR 0x4001 800C */
+#define TMR32B0PR_PR_MASK              0xFFFFFFFF         // Prescale value.
+#define TMR32B0PR_PR_SHIFT             0                 
+
+/* TMR32B0PC, address 0x4001 4010 and TMR32B1PC 0x4001 8010 */
+#define TMR32B0PC_PC_MASK              0xFFFFFFFF         // Prescale counter value.
+#define TMR32B0PC_PC_SHIFT             0                 
+
+/* TMR32B0MCR - address 0x4001 4014 and TMR32B1MCR - address 0x4001 8014 */
+#define TMR32B0MCR_MR0I                (1 << 0)           // Interrupt on MR0: an interrupt is generated when MR0 matches the value in the TC.
+#define TMR32B0MCR_MR0R                (1 << 1)           // Reset on MR0: the TC will be reset if MR0 matches it.
+#define TMR32B0MCR_MR0S                (1 << 2)           // Stop on MR0: the TC and PC will be stopped and TCR[0] will be set to 0 if MR0 matches 0 the TC.
+#define TMR32B0MCR_MR1I                (1 << 3)           // Interrupt on MR1: an interrupt is generated when MR1 matches the value in the TC.
+#define TMR32B0MCR_MR1R                (1 << 4)           // Reset on MR1: the TC will be reset if MR1 matches it.
+#define TMR32B0MCR_MR1S                (1 << 5)           // Stop on MR1: the TC and PC will be stopped and TCR[0] will be set to 0 if MR1 matches 0 the TC.
+#define TMR32B0MCR_MR2I                (1 << 6)           // Interrupt on MR2: an interrupt is generated when MR2 matches the value in the TC.
+#define TMR32B0MCR_MR2R                (1 << 7)           // Reset on MR2: the TC will be reset if MR2 matches it.
+#define TMR32B0MCR_MR2S                (1 << 8)           // Stop on MR2: the TC and PC will be stopped and TCR[0] will be set to 0 if MR2 matches 0 the TC.
+#define TMR32B0MCR_MR3I                (1 << 9)           // Interrupt on MR3: an interrupt is generated when MR3 matches the value in the TC.
+#define TMR32B0MCR_MR3R                (1 << 10)          // Reset on MR3: the TC will be reset if MR3 matches it.
+#define TMR32B0MCR_MR3S                (1 << 11)          // Stop on MR3: the TC and PC will be stopped and TCR[0] will be set to 0 if MR3 matches 0 the TC.
+
+/* TMR32B0MR0 to 3, addresses 0x4001 4018 to 24 and TMR32B1MR0 to 3, addresses 0x4001 8018 to 24 */
+#define TMR32B0MRn_MATCH_MASK          0xFFFFFFFF         // Timer counter match value.
+#define TMR32B0MRn_MATCH_SHIFT         0                 
+
+/* TMR32B0CCR - address 0x4001 4028 and TMR32B1CCR - address 0x4001 8028 */
+#define TMR32B0CCR_CAP0RE              (1 << 0)           // Capture on CT32Bn_CAP0 rising edge: a sequence of 0 then 1 on CT32Bn_CAP0 will cause CR0 to be loaded with the contents of TC.
+#define TMR32B0CCR_CAP0FE              (1 << 1)           // Capture on CT32Bn_CAP0 falling edge: a sequence of 1 then 0 on CT32Bn_CAP0 will 0 cause CR0 to be loaded with the contents of TC.
+#define TMR32B0CCR_CAP0I               (1 << 2)           // Interrupt on CT32Bn_CAP0 event: a CR0 load due to a CT32Bn_CAP0 event will generate an interrupt.
+#define TMR32B0CCR_CAP1RE              (1 << 3)           // Capture on CT32Bn_CAP1 rising edge: a sequence of 0 then 1 on CT32Bn_CAP1 will cause CR1 to be loaded with the contents of TC.
+#define TMR32B0CCR_CAP1FE              (1 << 4)           // Capture on CT32Bn_CAP1 falling edge: a sequence of 1 then 0 on CT32Bn_CAP1 will 0 cause CR1 to be loaded with the contents of TC.
+#define TMR32B0CCR_CAP1I               (1 << 5)           // Interrupt on CT32Bn_CAP1 event: a CR1 load due to a CT32Bn_CAP1 event will generate an interrupt.
+
+/* TMR32B0EMR - address 0x4001 403C and TMR32B1EMR - address0x4001 803C */
+#define TMR32B0EMR_EM0                 (1 << 0)           // External Match 0. This bit reflects the state of output CT32Bn_MAT0, whether or not this 0 output is connected to its pin. When a match occurs between the TC and MR0, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[5:4] control the functionality of this output. This bit is driven to the CT32B0_MAT0/CT16B1_MAT0 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
+#define TMR32B0EMR_EM1                 (1 << 1)           // External Match 1. This bit reflects the state of output CT32Bn_MAT1, whether or not this 0 output is connected to its pin. When a match occurs between the TC and MR1, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[7:6] control the functionality of this output. This bit is driven to the CT32B0_MAT1/CT16B1_MAT1 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
+#define TMR32B0EMR_EM2                 (1 << 2)           // External Match 2. This bit reflects the state of output CT32Bn_MAT2, whether or not this 0 output is connected to its pin. When a match occurs between the TC and MR2, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[9:8] control the functionality of this output. This bit is driven to the CT32B0_MAT2/CT16B1_MAT2 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
+#define TMR32B0EMR_EM3                 (1 << 3)           // External Match 3. This bit reflects the state of output CT32Bn_MAT3, whether or not this output is connected to its pin. When a match occurs between the TC and MR3, this bit can either toggle, go LOW, go HIGH, or do nothing. Bits EMR[11:10] control the functionality of this output. This bit is driven to the CT32B0_MAT3/CT16B1_MAT3 pins if the match function is selected in the IOCON registers (0 = LOW, 1 = HIGH).
+#define TMR32B0EMR_EMC0_MASK           0x0030             // External Match Control 0. Determines the functionality of External Match 0.
+#define TMR32B0EMR_EMC0_SHIFT          4                 
+#define TMR32B0EMR_EMC1_MASK           0x00C0             // External Match Control 1. Determines the functionality of External Match 1.
+#define TMR32B0EMR_EMC1_SHIFT          6                 
+#define TMR32B0EMR_EMC2_MASK           0x0300             // External Match Control 2. Determines the functionality of External Match 2.
+#define TMR32B0EMR_EMC2_SHIFT          8                 
+#define TMR32B0EMR_EMC3_MASK           0x0C00             // External Match Control 3. Determines the functionality of External Match 3.
+#define TMR32B0EMR_EMC3_SHIFT          10                
+
+/* TMR32B0CTCR - address 0x4001 4070 and TMR32B1TCR - address 0x4001 8070 */
+#define TMR32B0CTCR_CTM_MASK           0x0003             // Counter/Timer Mode. This field selects which rising PCLK edges can increment Timer's Prescale Counter (PC), or clear PC and increment Timer Counter (TC). Timer Mode: every rising PCLK edge
+#define TMR32B0CTCR_CTM_SHIFT          0                 
+#define TMR32B0CTCR_CIS_MASK           0x000C             // Count Input Select. When bits 1:0 in this register are not 00, these bits select which CAP pin is sampled for clocking:
+#define TMR32B0CTCR_CIS_SHIFT          2                 
+#define TMR32B0CTCR_ENCC               (1 << 4)           // Setting this bit to one enables clearing of the timer and the prescaler when the capture-edge event specified in bits 7:5 occurs.
+#define TMR32B0CTCR_SELCC_MASK         0x00E0             // When bit 4 is one, these bits select which capture input edge 0 will cause the timer and prescaler to be cleared. These bits have no effect when bit 4 is zero.
+#define TMR32B0CTCR_SELCC_SHIFT        5                 
+
+/* TMR32B0PWMC - 0x4001 4074 and TMR32B1PWMC - 0x4001 8074 */
+#define TMR32B0PWMC_PWMEN0             (1 << 0)           // PWM channel 0 enable
+#define TMR32B0PWMC_PWMEN1             (1 << 1)           // PWM channel 1 enable
+#define TMR32B0PWMC_PWMEN2             (1 << 2)           // PWM channel 2 enable
+#define TMR32B0PWMC_PWMEN3             (1 << 3)           // PWM channel 3 enable Note: It is recommended to use match channel 3 to set the PWM cycle.
+
+/* WDMOD - 0x4000 4000 */
+#define WDMOD_WDEN                     (1 << 0)           // Watchdog enable bit. This bit is Set Only. Remark: Setting this bit to one also locks the watchdog clock source. Once the watchdog timer is enabled, the watchdog timer clock source cannot be changed. If the watchdog timer is needed in Deep-sleep mode, the watchdog clock source must be changed to the watchdog oscillator before setting this bit to one.
+#define WDMOD_WDRESET                  (1 << 1)           // Watchdog reset enable bit. This bit is Set Only.
+#define WDMOD_WDTOF                    (1 << 2)           // Watchdog time-out flag. Set when the watchdog timer times out, by a feed error, or by events associated with WDPROTECT, cleared by software. Causes a chip reset if WDRESET = 1.
+#define WDMOD_WDINT                    (1 << 3)           // Watchdog interrupt flag. Set when the timer reaches the value in WDWARNINT. Cleared by software.
+#define WDMOD_WDPROTECT                (1 << 4)           // Watchdog update mode. This bit is Set Only.
+
+/* WDTC - 0x4000 4004 */
+#define WDTC_COUNT_MASK                0xFFFFFF           // Watchdog time-out interval.
+#define WDTC_COUNT_SHIFT               0                 
+
+/* WDFEED - 0x4000 4008 */
+#define WDFEED_FEED_MASK               0x00FF             // Feed value should be 0xAA followed by 0x55.
+#define WDFEED_FEED_SHIFT              0                 
+
+/* WDTV - 0x4000 400C */
+#define WDTV_COUNT_MASK                0xFFFFFF           // Counter timer value.
+#define WDTV_COUNT_SHIFT               0                 
+
+/* WDWARNINT - 0x4000 4014 */
+#define WDWARNINT_WARNINT_MASK         0x03FF             // Watchdog warning interrupt compare value.
+#define WDWARNINT_WARNINT_SHIFT        0                 
+
+/* WDWINDOW - 0x4000 4018 */
+#define WDWINDOW_WINDOW_MASK           0xFFFFFF           // Watchdog window value.
+#define WDWINDOW_WINDOW_SHIFT          0                 
+
+/* WDMOD - address 0x4000 4000 */
+#define WDMOD_WDEN                     (1 << 0)           // WDEN Watchdog enable bit (Set Only). When 1, the watchdog timer is running. Remark: Setting this bit to one also locks the watchdog clock source. Once the watchdog timer is enabled, the watchdog timer clock source cannot be changed. If the watchdog timer is needed in Deep-sleep mode, the watchdog clock source must be changed to the watchdog oscillator before setting this bit to one. The clock source lock feature is not available on all parts, see Section 23.1).
+#define WDMOD_WDRESET_WDRESET          (1 << 1)           // Watchdog reset enable bit (Set Only). When 1, og time-out will cause a chip reset.
+#define WDMOD_WDTOF                    (1 << 2)           // WDTOF Watchdog time-out flag. Set when the watchdog
+#define WDMOD_WDINT                    (1 << 3)           // WDINT Watchdog interrupt flag (Read Only, not clearable by software).
+
+/* WDTC - address 0x4000 4004 */
+#define WDTC_COUNT_MASK                0xFFFFFF           // Watchdog time-out interval.
+#define WDTC_COUNT_SHIFT               0                 
+
+/* WDFEED - address 0x4000 4008 */
+#define WDFEED_FEED_MASK               0x00FF             // Feed value should be 0xAA followed by 0x55.
+#define WDFEED_FEED_SHIFT              0                 
+
+/* WDTV - address 0x4000 000C */
+#define WDTV_COUNT_MASK                0xFFFFFF           // Counter timer value.
+#define WDTV_COUNT_SHIFT               0                 
+
+/* SYST_CSR - 0xE000 E010 */
+#define SYST_CSR_ENABLE                (1 << 0)           // System Tick counter enable. When 1, the counter is enabled. When 0, the counter is disabled.
+#define SYST_CSR_TICKINT               (1 << 1)           // System Tick interrupt enable. When 1, the System Tick interrupt 0 is enabled. When 0, the System Tick interrupt is disabled. When enabled, the interrupt is generated when the System Tick counter counts down to 0.
+#define SYST_CSR_CLKSOURCE             (1 << 2)           // System Tick clock source selection. When 1, the system clock (CPU) clock is selected. When 0, the system clock/2 is selected as the reference clock.
+#define SYST_CSR_COUNTFLAG             (1 << 16)          // Returns 1 if the SysTick timer counted to 0 since the last read of this register. Reserved, user software should not write ones to reserved bits. The value read from a reserved bit is not defined.
+
+/* SYST_RVR - 0xE000 E014 */
+#define SYST_RVR_RELOAD_MASK           0xFFFFFF           // This is the value that is loaded into the System Tick counter when it 0 counts down to 0.
+#define SYST_RVR_RELOAD_SHIFT          0                 
+
+/* SYST_CVR - 0xE000 E018 */
+#define SYST_CVR_CURRENT_MASK          0xFFFFFF           // Reading this register returns the current value of the System Tick counter. Writing any value clears the System Tick counter and the COUNTFLAG bit in STCTRL.
+#define SYST_CVR_CURRENT_SHIFT         0                 
+
+/* SYST_CALIB - 0xE000 E01C */
+#define SYST_CALIB_TENMS_MASK          0xFFFFFF           // See Table 461.
+#define SYST_CALIB_TENMS_SHIFT         0                 
+#define SYST_CALIB_SKEW                (1 << 30)          // See Table 461.
+#define SYST_CALIB_NOREF               (1 << 31)          // See Table 461.
+
+/* AD0CR - address 0x4001 C000 */
+#define AD0CR_SEL_MASK                 0x00FF             // Selects which of the AD7:0 pins is (are) to be sampled and converted. Bit 0 selects Pin           0x00 AD0, bit 1 selects pin AD1,..., and bit 7 selects pin AD7. In software-controlled mode (BURST = 0), only one channel can be selected, i.e. only one of these bits should be 1. In hardware scan mode (BURST = 1), any numbers of channels can be selected, i.e any or all bits can be set to 1. If all bits are set to 0, channel 0 is selected automatically (SEL = 0x01).
+#define AD0CR_SEL_SHIFT                0                 
+#define AD0CR_CLKDIV_MASK              0xFF00             // The APB clock (PCLK) is divided by CLKDIV +1 to produce the clock for the ADC, which 0 should be less than or equal to 4.5 MHz. Typically, software should program the smallest value in this field that yields a clock of 4.5 MHz or slightly less, but in certain cases (such as a high-impedance analog source) a slower clock may be desirable.
+#define AD0CR_CLKDIV_SHIFT             8                 
+#define AD0CR_BURST                    (1 << 16)          // Burst mode Remark: If BURST is set to 1, the ADGINTEN bit in the AD0INTEN register (Table 365) must be set to 0.
+#define AD0CR_CLKS_MASK                0xE0000            // This field selects the number of clocks used for each conversion in Burst mode, and the number of bits of accuracy of the result in the LS bits of ADDR, between 11 clocks (10 bits) and 4 clocks (3 bits).
+#define AD0CR_CLKS_SHIFT               17                
+#define AD0CR_START_MASK               0x7000000          // When the BURST bit is 0, these bits control whether and when an A/D conversion is started:
+#define AD0CR_START_SHIFT              24                
+#define AD0CR_EDGE                     (1 << 27)          // This bit is significant only when the START field contains 010-111. In these cases:
+
+/* AD0GDR - address 0x4001 C004 */
+#define AD0GDR_V_VREF_MASK             0xFFC0             // When DONE is 1, this field contains a binary fraction representing X the voltage on the ADn pin selected by the SEL field, divided by the voltage on the VDD pin. Zero in the field indicates that the voltage on the ADn pin was less than, equal to, or close to that on VSS, while 0x3FF indicates that the voltage on ADn was close to, equal to, or greater than that on VREF.
+#define AD0GDR_V_VREF_SHIFT            6                 
+#define AD0GDR_CHN_MASK                0x7000000          // These bits contain the channel from which the result bits V_VREF X were converted.
+#define AD0GDR_CHN_SHIFT               24                
+#define AD0GDR_OVERRUN                 (1 << 30)          // This bit is 1 in burst mode if the results of one or more conversions 0 was (were) lost and overwritten before the conversion that produced the result in the V_VREF bits.
+#define AD0GDR_DONE                    (1 << 31)          // This bit is set to 1 when an A/D conversion completes. It is cleared 0 when this register is read and when the ADCR is written. If the ADCR is written while a conversion is still in progress, this bit is set and a new conversion is started.
+
+/* AD0INTEN - address 0x4001 C00C */
+#define AD0INTEN_ADINTEN_MASK          0x00FF             // These bits allow control over which A/D channels generate             0x00 interrupts for conversion completion. When bit 0 is one, completion of a conversion on A/D channel 0 will generate an interrupt, when bit 1 is one, completion of a conversion on A/D channel 1 will generate an interrupt, etc.
+#define AD0INTEN_ADINTEN_SHIFT         0                 
+#define AD0INTEN_ADGINTEN              (1 << 8)           // When 1, enables the global DONE flag in ADDR to generate an interrupt. When 0, only the individual A/D channels enabled by ADINTEN 7:0 will generate interrupts. Remark: This bit must be set to 0 in burst mode (BURST = 1 in the AD0CR register). Reserved. Unused, always 0.
+
+/* AD0DR0 to AD0DR7 - addresses 0x4001 C010 to 0x4001 C02C */
+#define AD0DRn_V_VREF_MASK             0xFFC0             // When DONE is 1, this field contains a binary fraction representing the NA voltage on the ADn pin, divided by the voltage on the VREF pin. Zero in the field indicates that the voltage on the ADn pin was less than, equal to, or close to that on VREF, while 0x3FF indicates that the voltage on AD input was close to, equal to, or greater than that on VREF. Reserved.
+#define AD0DRn_V_VREF_SHIFT            6                 
+#define AD0DRn_OVERRUN                 (1 << 30)          // This bit is 1 in burst mode if the results of one or more conversions was (were) lost and overwritten before the conversion that produced the result in the V_VREF bits.This bit is cleared by reading this register.
+#define AD0DRn_DONE                    (1 << 31)          // This bit is set to 1 when an A/D conversion completes. It is cleared when this register is read.
+
+/* AD0STAT - address 0x4001 C030 */
+#define AD0STAT_DONE_MASK              0x00FF             // These bits mirror the DONE status flags that appear in the result register for each A/D channel n.
+#define AD0STAT_DONE_SHIFT             0                 
+#define AD0STAT_OVERRUN_MASK           0xFF00             // These bits mirror the OVERRRUN status flags that appear in the result register for each A/D channel n. Reading ADSTAT allows checking the status of all A/D channels simultaneously.
+#define AD0STAT_OVERRUN_SHIFT          8                 
+#define AD0STAT_ADINT                  (1 << 16)          // This bit is the A/D interrupt flag. It is one when any of the individual A/D channel Done flags is asserted and enabled to contribute to the A/D interrupt via the ADINTEN register. Reserved. Unused, always 0.
+
+/* FLASHCFG, address 0x4003 C010 */
+#define FLASHCFG_FLASHTIM_MASK         0x0003             // Flash memory access time. FLASHTIM +1 is equal to the number of system clocks used for flash access.
+#define FLASHCFG_FLASHTIM_SHIFT        0                 
+
+/* FMSSTART - 0x4003 C020 */
+#define FMSSTART_START_MASK            0x1FFFF            // Signature generation start address (corresponds to AHB byte address bits[20:4]).
+#define FMSSTART_START_SHIFT           0                 
+
+/* FMSSTOP - 0x4003 C024 */
+#define FMSSTOP_STOP_MASK              0x1FFFF            // BIST stop address divided by 16 (corresponds to AHB byte address [20:4]).
+#define FMSSTOP_STOP_SHIFT             0                 
+#define FMSSTOP_SIG_START              (1 << 17)          // Start control bit for signature generation.
+
+/* FMSTAT - 0x4003 CFE0 */
+#define FMSTAT_SIG_DONE                (1 << 2)           // When 1, a previously started signature generation has           0 completed. See FMSTATCLR register description for clearing this flag.
+
+/* FMSTATCLR - 0x0x4003 CFE8 */
+#define FMSTATCLR_SIG_DONE_CLR         (1 << 2)           // Writing a 1 to this bits clears the signature generation completion flag (SIG_DONE) in the FMSTAT register.
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/cmsis/TARGET_NXP/cmsis.h	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,14 @@
+/* mbed Microcontroller Library - CMSIS
+ * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
+ * 
+ * A generic CMSIS include header, pulling in LPC11U24 specifics
+ */
+
+#ifndef MBED_CMSIS_H
+#define MBED_CMSIS_H
+
+#include "LPC11xx.h"
+#include "cmsis_nvic.h"
+#include "bitfields.h"
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/cmsis/TARGET_NXP/cmsis_nvic.c	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,57 @@
+/* mbed Microcontroller Library - cmsis_nvic for LPC11U24
+ * Copyright (c) 2011 ARM Limited. All rights reserved.
+ *
+ * CMSIS-style functionality to support dynamic vectors
+ */ 
+
+#include "cmsis_nvic.h"
+
+/* In the M0, there is no VTOR. In the LPC range such as the LPC11U,
+ * whilst the vector table may only be something like 48 entries (192 bytes, 0xC0), 
+ * the SYSMEMREMAP register actually remaps the memory from 0x10000000-0x100001FF 
+ * to adress 0x0-0x1FF. In this case, RAM can be addressed at both 0x10000000 and 0x0
+ * 
+ * If we just copy the vectors to RAM and switch the SYSMEMMAP, any accesses to FLASH
+ * above the vector table before 0x200 will actually go to RAM. So we need to provide 
+ * a solution where the compiler gets the right results based on the memory map
+ *
+ * Option 1 - We allocate and copy 0x200 of RAM rather than just the table
+ *  - const data and instructions before 0x200 will be copied to and fetched/exec from RAM
+ *  - RAM overhead: 0x200 - 0xC0 = 320 bytes, FLASH overhead: 0
+ * 
+ * Option 2 - We pad the flash to 0x200 to ensure the compiler doesn't allocate anything there  
+ *  - No flash accesses will go to ram, as there will be nothing there
+ *  - RAM only needs to be allocated for the vectors, as all other ram addresses are normal
+ *  - RAM overhead: 0, FLASH overhead: 320 bytes
+ *
+ * Option 2 is the one to go for, as RAM is the most valuable resource
+ */
+
+#define NVIC_RAM_VECTOR_ADDRESS (0x10000000)  // Vectors positioned at start of RAM
+
+void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
+    int i;
+    // Space for dynamic vectors, initialised to allocate in R/W
+    static volatile uint32_t* vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
+
+    // Copy and switch to dynamic vectors if first time called
+    if((LPC_SYSCON->SYSMEMREMAP & 0x3) != 0x1) {     
+      uint32_t *old_vectors = (uint32_t *)0;         // FLASH vectors are at 0x0
+      for(i = 0; i < NVIC_NUM_VECTORS; i++) {    
+            vectors[i] = old_vectors[i];
+        }
+        LPC_SYSCON->SYSMEMREMAP = 0x1; // Remaps 0x0-0x1FF FLASH block to RAM block
+    }
+
+    // Set the vector 
+    vectors[IRQn + 16] = vector; 
+}
+
+uint32_t NVIC_GetVector(IRQn_Type IRQn) {
+    // We can always read vectors at 0x0, as the addresses are remapped
+    uint32_t *vectors = (uint32_t*)0; 
+
+    // Return the vector
+    return vectors[IRQn + 16];
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/cmsis/TARGET_NXP/cmsis_nvic.h	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,26 @@
+/* mbed Microcontroller Library - cmsis_nvic
+ * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
+ *
+ * CMSIS-style functionality to support dynamic vectors
+ */ 
+
+#ifndef MBED_CMSIS_NVIC_H
+#define MBED_CMSIS_NVIC_H
+
+#include "cmsis.h"
+
+#define NVIC_NUM_VECTORS      (16 + 32)   // CORE + MCU Peripherals
+#define NVIC_USER_IRQ_OFFSET  16
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
+uint32_t NVIC_GetVector(IRQn_Type IRQn);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/cmsis/TARGET_NXP/system_LPC11xx.c	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,367 @@
+/**************************************************************************//**
+ * @file     system_LPC11xx.c
+ * @brief    CMSIS Cortex-M0 Device Peripheral Access Layer Source File
+ *           for the NXP LPC11xx/LPC11Cxx Devices
+ * @version  V1.10
+ * @date     24. November 2010
+ *
+ * @note
+ * Copyright (C) 2009-2010 ARM Limited. All rights reserved.
+ *
+ * @par
+ * ARM Limited (ARM) is supplying this software for use with Cortex-M 
+ * processor based microcontrollers.  This file can be freely distributed 
+ * within development tools that are supporting such ARM based processors. 
+ *
+ * @par
+ * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
+ * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
+ * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
+ * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
+ *
+ ******************************************************************************/
+
+
+#include <stdint.h>
+#include "LPC11xx.h"
+
+/*
+//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
+*/
+
+/*--------------------- Clock Configuration ----------------------------------
+//
+// <e> Clock Configuration
+//   <h> System Oscillator Control Register (SYSOSCCTRL)
+//     <o1.0>      BYPASS: System Oscillator Bypass Enable
+//                     <i> If enabled then PLL input (sys_osc_clk) is fed
+//                     <i> directly from XTALIN and XTALOUT pins.
+//     <o1.9>      FREQRANGE: System Oscillator Frequency Range
+//                     <i> Determines frequency range for Low-power oscillator.
+//                   <0=> 1 - 20 MHz
+//                   <1=> 15 - 25 MHz
+//   </h>
+//
+//   <h> Watchdog Oscillator Control Register (WDTOSCCTRL)
+//     <o2.0..4>   DIVSEL: Select Divider for Fclkana
+//                     <i> wdt_osc_clk = Fclkana/ (2 * (1 + DIVSEL))
+//                   <0-31>
+//     <o2.5..8>   FREQSEL: Select Watchdog Oscillator Analog Output Frequency (Fclkana)
+//                   <0=> Undefined
+//                   <1=> 0.5 MHz
+//                   <2=> 0.8 MHz
+//                   <3=> 1.1 MHz
+//                   <4=> 1.4 MHz
+//                   <5=> 1.6 MHz
+//                   <6=> 1.8 MHz
+//                   <7=> 2.0 MHz
+//                   <8=> 2.2 MHz
+//                   <9=> 2.4 MHz
+//                   <10=> 2.6 MHz
+//                   <11=> 2.7 MHz
+//                   <12=> 2.9 MHz
+//                   <13=> 3.1 MHz
+//                   <14=> 3.2 MHz
+//                   <15=> 3.4 MHz
+//   </h>
+//
+//   <h> System PLL Control Register (SYSPLLCTRL)
+//                   <i> F_clkout = M * F_clkin = F_CCO / (2 * P)
+//                   <i> F_clkin must be in the range of  10 MHz to  25 MHz
+//                   <i> F_CCO   must be in the range of 156 MHz to 320 MHz
+//     <o3.0..4>   MSEL: Feedback Divider Selection
+//                     <i> M = MSEL + 1
+//                   <0-31>
+//     <o3.5..6>   PSEL: Post Divider Selection
+//                   <0=> P = 1
+//                   <1=> P = 2
+//                   <2=> P = 4
+//                   <3=> P = 8
+//   </h>
+//
+//   <h> System PLL Clock Source Select Register (SYSPLLCLKSEL)
+//     <o4.0..1>   SEL: System PLL Clock Source
+//                   <0=> IRC Oscillator
+//                   <1=> System Oscillator
+//                   <2=> Reserved
+//                   <3=> Reserved
+//   </h>
+//
+//   <h> Main Clock Source Select Register (MAINCLKSEL)
+//     <o5.0..1>   SEL: Clock Source for Main Clock
+//                   <0=> IRC Oscillator
+//                   <1=> Input Clock to System PLL
+//                   <2=> WDT Oscillator
+//                   <3=> System PLL Clock Out
+//   </h>
+//
+//   <h> System AHB Clock Divider Register (SYSAHBCLKDIV)
+//     <o6.0..7>   DIV: System AHB Clock Divider
+//                     <i> Divides main clock to provide system clock to core, memories, and peripherals.
+//                     <i> 0 = is disabled
+//                   <0-255>
+//   </h>
+// </e>
+*/
+#define CLOCK_SETUP           1
+#define SYSOSCCTRL_Val        0x00000000              // Reset: 0x000
+#define WDTOSCCTRL_Val        0x00000000              // Reset: 0x000
+#define SYSPLLCTRL_Val        0x00000023              // Reset: 0x000
+#define SYSPLLCLKSEL_Val      0x00000000              // Reset: 0x000	// Define as using IRC
+#define MAINCLKSEL_Val        0x00000003              // Reset: 0x000	// Define as using System PLL clock out
+#define SYSAHBCLKDIV_Val      0x00000001              // Reset: 0x001
+
+/*
+//-------- <<< end of configuration section >>> ------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+  Check the register settings
+ *----------------------------------------------------------------------------*/
+#define CHECK_RANGE(val, min, max)                ((val < min) || (val > max))
+#define CHECK_RSVD(val, mask)                     (val & mask)
+
+/* Clock Configuration -------------------------------------------------------*/
+#if (CHECK_RSVD((SYSOSCCTRL_Val),  ~0x00000003))
+   #error "SYSOSCCTRL: Invalid values of reserved bits!"
+#endif
+
+#if (CHECK_RSVD((WDTOSCCTRL_Val),  ~0x000001FF))
+   #error "WDTOSCCTRL: Invalid values of reserved bits!"
+#endif
+
+#if (CHECK_RANGE((SYSPLLCLKSEL_Val), 0, 2))
+   #error "SYSPLLCLKSEL: Value out of range!"
+#endif
+
+#if (CHECK_RSVD((SYSPLLCTRL_Val),  ~0x000001FF))
+   #error "SYSPLLCTRL: Invalid values of reserved bits!"
+#endif
+
+#if (CHECK_RSVD((MAINCLKSEL_Val),  ~0x00000003))
+   #error "MAINCLKSEL: Invalid values of reserved bits!"
+#endif
+
+#if (CHECK_RANGE((SYSAHBCLKDIV_Val), 0, 255))
+   #error "SYSAHBCLKDIV: Value out of range!"
+#endif
+
+
+/*----------------------------------------------------------------------------
+  DEFINES
+ *----------------------------------------------------------------------------*/
+    
+/*----------------------------------------------------------------------------
+  Define clocks
+ *----------------------------------------------------------------------------*/
+#define __XTAL            (12000000UL)    /* Oscillator frequency             */
+#define __SYS_OSC_CLK     (    __XTAL)    /* Main oscillator frequency        */
+#define __IRC_OSC_CLK     (12000000UL)    /* Internal RC oscillator frequency */
+
+
+#define __FREQSEL   ((WDTOSCCTRL_Val >> 5) & 0x0F)
+#define __DIVSEL   (((WDTOSCCTRL_Val & 0x1F) << 1) + 2)
+
+#if (CLOCK_SETUP)                         /* Clock Setup              */
+  #if  (__FREQSEL ==  0)
+    #define __WDT_OSC_CLK        ( 0)                  /* undefined */
+  #elif (__FREQSEL ==  1)
+    #define __WDT_OSC_CLK        ( 500000 / __DIVSEL)
+  #elif (__FREQSEL ==  2)
+    #define __WDT_OSC_CLK        ( 800000 / __DIVSEL)
+  #elif (__FREQSEL ==  3)
+    #define __WDT_OSC_CLK        (1100000 / __DIVSEL)
+  #elif (__FREQSEL ==  4)
+    #define __WDT_OSC_CLK        (1400000 / __DIVSEL)
+  #elif (__FREQSEL ==  5)
+    #define __WDT_OSC_CLK        (1600000 / __DIVSEL)
+  #elif (__FREQSEL ==  6)
+    #define __WDT_OSC_CLK        (1800000 / __DIVSEL)
+  #elif (__FREQSEL ==  7)
+    #define __WDT_OSC_CLK        (2000000 / __DIVSEL)
+  #elif (__FREQSEL ==  8)
+    #define __WDT_OSC_CLK        (2200000 / __DIVSEL)
+  #elif (__FREQSEL ==  9)
+    #define __WDT_OSC_CLK        (2400000 / __DIVSEL)
+  #elif (__FREQSEL == 10)
+    #define __WDT_OSC_CLK        (2600000 / __DIVSEL)
+  #elif (__FREQSEL == 11)
+    #define __WDT_OSC_CLK        (2700000 / __DIVSEL)
+  #elif (__FREQSEL == 12)
+    #define __WDT_OSC_CLK        (2900000 / __DIVSEL)
+  #elif (__FREQSEL == 13)
+    #define __WDT_OSC_CLK        (3100000 / __DIVSEL)
+  #elif (__FREQSEL == 14)
+    #define __WDT_OSC_CLK        (3200000 / __DIVSEL)
+  #else
+    #define __WDT_OSC_CLK        (3400000 / __DIVSEL)
+  #endif
+
+  /* sys_pllclkin calculation */
+  #if   ((SYSPLLCLKSEL_Val & 0x03) == 0)
+    #define __SYS_PLLCLKIN           (__IRC_OSC_CLK)
+  #elif ((SYSPLLCLKSEL_Val & 0x03) == 1)
+    #define __SYS_PLLCLKIN           (__SYS_OSC_CLK)
+  #else
+    #define __SYS_PLLCLKIN           (0)
+  #endif
+
+  #define  __SYS_PLLCLKOUT         (__SYS_PLLCLKIN * ((SYSPLLCTRL_Val & 0x01F) + 1))
+
+  /* main clock calculation */
+  #if   ((MAINCLKSEL_Val & 0x03) == 0)
+    #define __MAIN_CLOCK             (__IRC_OSC_CLK)
+  #elif ((MAINCLKSEL_Val & 0x03) == 1)
+    #define __MAIN_CLOCK             (__SYS_PLLCLKIN)
+  #elif ((MAINCLKSEL_Val & 0x03) == 2)
+    #if (__FREQSEL ==  0)
+      #error "MAINCLKSEL: WDT Oscillator selected but FREQSEL is undefined!"
+    #else
+      #define __MAIN_CLOCK           (__WDT_OSC_CLK)
+    #endif
+  #elif ((MAINCLKSEL_Val & 0x03) == 3)
+    #define __MAIN_CLOCK             (__SYS_PLLCLKOUT)
+  #else
+    #define __MAIN_CLOCK             (0)
+  #endif
+
+  #define __SYSTEM_CLOCK             (__MAIN_CLOCK / SYSAHBCLKDIV_Val)         
+
+#else
+  #define __SYSTEM_CLOCK             (__IRC_OSC_CLK)
+#endif  // CLOCK_SETUP 
+
+
+/*----------------------------------------------------------------------------
+  Clock Variable definitions
+ *----------------------------------------------------------------------------*/
+uint32_t SystemCoreClock = __SYSTEM_CLOCK;/*!< System Clock Frequency (Core Clock)*/
+
+
+/*----------------------------------------------------------------------------
+  Clock functions
+ *----------------------------------------------------------------------------*/
+void SystemCoreClockUpdate (void)            /* Get Core Clock Frequency      */
+{
+  uint32_t wdt_osc = 0;
+
+  /* Determine clock frequency according to clock register values             */
+  switch ((LPC_SYSCON->WDTOSCCTRL >> 5) & 0x0F) {
+    case 0:  wdt_osc =       0; break;
+    case 1:  wdt_osc =  500000; break;
+    case 2:  wdt_osc =  800000; break;
+    case 3:  wdt_osc = 1100000; break;
+    case 4:  wdt_osc = 1400000; break;
+    case 5:  wdt_osc = 1600000; break;
+    case 6:  wdt_osc = 1800000; break;
+    case 7:  wdt_osc = 2000000; break;
+    case 8:  wdt_osc = 2200000; break;
+    case 9:  wdt_osc = 2400000; break;
+    case 10: wdt_osc = 2600000; break;
+    case 11: wdt_osc = 2700000; break;
+    case 12: wdt_osc = 2900000; break;
+    case 13: wdt_osc = 3100000; break;
+    case 14: wdt_osc = 3200000; break;
+    case 15: wdt_osc = 3400000; break;
+  }
+  wdt_osc /= ((LPC_SYSCON->WDTOSCCTRL & 0x1F) << 1) + 2;
+ 
+  switch (LPC_SYSCON->MAINCLKSEL & 0x03) {
+    case 0:                             /* Internal RC oscillator             */
+      SystemCoreClock = __IRC_OSC_CLK;
+      break;
+    case 1:                             /* Input Clock to System PLL          */
+      switch (LPC_SYSCON->SYSPLLCLKSEL & 0x03) {
+          case 0:                       /* Internal RC oscillator             */
+            SystemCoreClock = __IRC_OSC_CLK;
+            break;
+          case 1:                       /* System oscillator                  */
+            SystemCoreClock = __SYS_OSC_CLK;
+            break;
+          case 2:                       /* Reserved                           */
+          case 3:                       /* Reserved                           */
+            SystemCoreClock = 0;
+            break;
+      }
+      break;
+    case 2:                             /* WDT Oscillator                     */
+      SystemCoreClock = wdt_osc;
+      break;
+    case 3:                             /* System PLL Clock Out               */
+      switch (LPC_SYSCON->SYSPLLCLKSEL & 0x03) {
+          case 0:                       /* Internal RC oscillator             */
+            if (LPC_SYSCON->SYSPLLCTRL & 0x180) {
+              SystemCoreClock = __IRC_OSC_CLK;
+            } else {
+              SystemCoreClock = __IRC_OSC_CLK * ((LPC_SYSCON->SYSPLLCTRL & 0x01F) + 1);
+            }
+            break;
+          case 1:                       /* System oscillator                  */
+            if (LPC_SYSCON->SYSPLLCTRL & 0x180) {
+              SystemCoreClock = __SYS_OSC_CLK;
+            } else {
+              SystemCoreClock = __SYS_OSC_CLK * ((LPC_SYSCON->SYSPLLCTRL & 0x01F) + 1);
+            }
+            break;
+          case 2:                       /* Reserved                           */
+          case 3:                       /* Reserved                           */
+            SystemCoreClock = 0;
+            break;
+      }
+      break;
+  }
+
+  SystemCoreClock /= LPC_SYSCON->SYSAHBCLKDIV;  
+
+}
+
+/**
+ * Initialize the system
+ *
+ * @param  none
+ * @return none
+ *
+ * @brief  Setup the microcontroller system.
+ *         Initialize the System.
+ */
+void SystemInit (void) {
+  volatile uint32_t i;
+
+#if (CLOCK_SETUP)                                 /* Clock Setup              */
+
+#if ((SYSPLLCLKSEL_Val & 0x03) == 1)
+  LPC_SYSCON->PDRUNCFG     &= ~(1 << 5);          /* Power-up System Osc      */
+  LPC_SYSCON->SYSOSCCTRL    = SYSOSCCTRL_Val;
+  for (i = 0; i < 200; i++) __NOP();
+#endif
+
+  LPC_SYSCON->SYSPLLCLKSEL  = SYSPLLCLKSEL_Val;   /* Select PLL Input         */
+  LPC_SYSCON->SYSPLLCLKUEN  = 0x01;               /* Update Clock Source      */
+  LPC_SYSCON->SYSPLLCLKUEN  = 0x00;               /* Toggle Update Register   */
+  LPC_SYSCON->SYSPLLCLKUEN  = 0x01;
+  while (!(LPC_SYSCON->SYSPLLCLKUEN & 0x01));     /* Wait Until Updated       */
+#if ((MAINCLKSEL_Val & 0x03) == 3)                /* Main Clock is PLL Out    */
+  LPC_SYSCON->SYSPLLCTRL    = SYSPLLCTRL_Val;
+  LPC_SYSCON->PDRUNCFG     &= ~(1 << 7);          /* Power-up SYSPLL          */
+  while (!(LPC_SYSCON->SYSPLLSTAT & 0x01));	      /* Wait Until PLL Locked    */
+#endif
+
+#if (((MAINCLKSEL_Val & 0x03) == 2) )
+  LPC_SYSCON->WDTOSCCTRL    = WDTOSCCTRL_Val;
+  LPC_SYSCON->PDRUNCFG     &= ~(1 << 6);          /* Power-up WDT Clock       */
+  for (i = 0; i < 200; i++) __NOP();
+#endif
+
+  LPC_SYSCON->MAINCLKSEL    = MAINCLKSEL_Val;     /* Select PLL Clock Output  */
+  LPC_SYSCON->MAINCLKUEN    = 0x01;               /* Update MCLK Clock Source */
+  LPC_SYSCON->MAINCLKUEN    = 0x00;               /* Toggle Update Register   */
+  LPC_SYSCON->MAINCLKUEN    = 0x01;
+  while (!(LPC_SYSCON->MAINCLKUEN & 0x01));       /* Wait Until Updated       */
+
+  LPC_SYSCON->SYSAHBCLKDIV  = SYSAHBCLKDIV_Val;
+#endif
+   /* System clock to the IOCON needs to be enabled or
+  most of the I/O related peripherals won't work. */
+  LPC_SYSCON->SYSAHBCLKCTRL |= (1<<16);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/cmsis/TARGET_NXP/system_LPC11xx.h	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,64 @@
+/**************************************************************************//**
+ * @file     system_LPC11xx.h
+ * @brief    CMSIS Cortex-M0 Device Peripheral Access Layer Header File
+ *           for the NXP LPC11xx/LPC11Cxx Device Series
+ * @version  V1.10
+ * @date     24. November 2010
+ *
+ * @note
+ * Copyright (C) 2009-2010 ARM Limited. All rights reserved.
+ *
+ * @par
+ * ARM Limited (ARM) is supplying this software for use with Cortex-M 
+ * processor based microcontrollers.  This file can be freely distributed 
+ * within development tools that are supporting such ARM based processors. 
+ *
+ * @par
+ * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
+ * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
+ * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
+ * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
+ *
+ ******************************************************************************/
+
+
+#ifndef __SYSTEM_LPC11xx_H
+#define __SYSTEM_LPC11xx_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+extern uint32_t SystemCoreClock;     /*!< System Clock Frequency (Core Clock)  */
+
+
+/**
+ * Initialize the system
+ *
+ * @param  none
+ * @return none
+ *
+ * @brief  Setup the microcontroller system.
+ *         Initialize the System and update the SystemCoreClock variable.
+ */
+extern void SystemInit (void);
+
+/**
+ * Update SystemCoreClock variable
+ *
+ * @param  none
+ * @return none
+ *
+ * @brief  Updates the SystemCoreClock with current core Clock 
+ *         retrieved from cpu registers.
+ */
+extern void SystemCoreClockUpdate (void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SYSTEM_LPC11xx_H */
--- a/targets/cmsis/TARGET_STM/TARGET_STM32F4XX/TOOLCHAIN_ARM_STD/STM32F407.sct	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-; *************************************************************
-; *** Scatter-Loading Description File generated by uVision ***
-; *************************************************************
-
-LR_IROM1 0x08000000 0x00100000  {    ; load region size_region
-  ER_IROM1 0x08000000 0x00100000  {  ; load address = execution address
-   *.o (RESET, +First)
-   *(InRoot$$Sections)
-   .ANY (+RO)
-  }
-  RW_IRAM1 0x10000000 0x00010000  {  ; CCM
-  }
-  RW_IRAM2 0x20000188 0x0001FE78 {
-   .ANY (+RW +ZI)
-  }
-}
-
--- a/targets/cmsis/TARGET_STM/TARGET_STM32F4XX/TOOLCHAIN_ARM_STD/startup_STM32F40x.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,369 +0,0 @@
-;/*****************************************************************************
-; * @file:    startup_STM32F40x.s
-; * @purpose: CMSIS Cortex-M4 Core Device Startup File
-; *           for the ST STM32F40x Device Series
-; * @version: V1.20
-; * @date:    16. January 2012
-; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------
-; *
-; * Copyright (C) 2012 ARM Limited. All rights reserved.
-; * ARM Limited (ARM) is supplying this software for use with Cortex-M4
-; * processor based microcontrollers.  This file can be freely distributed
-; * within development tools that are supporting such ARM based processors.
-; *
-; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
-; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
-; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
-; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
-; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
-; *
-; *****************************************************************************/
-
-
-
-__initial_sp        EQU     0x20020000  ; Top of RAM from LPC4088
-
-                PRESERVE8
-                THUMB
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-
-__Vectors       DCD     __initial_sp              ; Top of Stack
-                DCD     Reset_Handler             ; Reset Handler
-                DCD     NMI_Handler               ; NMI Handler
-                DCD     HardFault_Handler         ; Hard Fault Handler
-                DCD     MemManage_Handler         ; MPU Fault Handler
-                DCD     BusFault_Handler          ; Bus Fault Handler
-                DCD     UsageFault_Handler        ; Usage Fault Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     SVC_Handler               ; SVCall Handler
-                DCD     DebugMon_Handler          ; Debug Monitor Handler
-                DCD     0                         ; Reserved
-                DCD     PendSV_Handler            ; PendSV Handler
-                DCD     SysTick_Handler           ; SysTick Handler
-
-                DCD     WWDG_IRQHandler               ; Window WatchDog 
-                DCD     PVD_IRQHandler                ; PVD through EXTI Line detection 
-                DCD     TAMP_STAMP_IRQHandler         ; Tamper and TimeStamps through the EXTI line 
-                DCD     RTC_WKUP_IRQHandler           ; RTC Wakeup through the EXTI line 
-                DCD     FLASH_IRQHandler              ; FLASH 
-                DCD     RCC_IRQHandler                ; RCC 
-                DCD     EXTI0_IRQHandler              ; EXTI Line0 
-                DCD     EXTI1_IRQHandler              ; EXTI Line1 
-                DCD     EXTI2_IRQHandler              ; EXTI Line2 
-                DCD     EXTI3_IRQHandler              ; EXTI Line3 
-                DCD     EXTI4_IRQHandler              ; EXTI Line4 
-                DCD     DMA1_Stream0_IRQHandler       ; DMA1 Stream 0 
-                DCD     DMA1_Stream1_IRQHandler       ; DMA1 Stream 1 
-                DCD     DMA1_Stream2_IRQHandler       ; DMA1 Stream 2 
-                DCD     DMA1_Stream3_IRQHandler       ; DMA1 Stream 3 
-                DCD     DMA1_Stream4_IRQHandler       ; DMA1 Stream 4 
-                DCD     DMA1_Stream5_IRQHandler       ; DMA1 Stream 5 
-                DCD     DMA1_Stream6_IRQHandler       ; DMA1 Stream 6 
-                DCD     ADC_IRQHandler                ; ADC1, ADC2 and ADC3s 
-                DCD     CAN1_TX_IRQHandler            ; CAN1 TX 
-                DCD     CAN1_RX0_IRQHandler           ; CAN1 RX0 
-                DCD     CAN1_RX1_IRQHandler           ; CAN1 RX1 
-                DCD     CAN1_SCE_IRQHandler           ; CAN1 SCE 
-                DCD     EXTI9_5_IRQHandler            ; External Line[9:5]s 
-                DCD     TIM1_BRK_TIM9_IRQHandler      ; TIM1 Break and TIM9 
-                DCD     TIM1_UP_TIM10_IRQHandler      ; TIM1 Update and TIM10 
-                DCD     TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11 
-                DCD     TIM1_CC_IRQHandler            ; TIM1 Capture Compare 
-                DCD     TIM2_IRQHandler               ; TIM2 
-                DCD     TIM3_IRQHandler               ; TIM3 
-                DCD     TIM4_IRQHandler               ; TIM4 
-                DCD     I2C1_EV_IRQHandler            ; I2C1 Event 
-                DCD     I2C1_ER_IRQHandler            ; I2C1 Error 
-                DCD     I2C2_EV_IRQHandler            ; I2C2 Event 
-                DCD     I2C2_ER_IRQHandler            ; I2C2 Error 
-                DCD     SPI1_IRQHandler               ; SPI1 
-                DCD     SPI2_IRQHandler               ; SPI2 
-                DCD     USART1_IRQHandler             ; USART1 
-                DCD     USART2_IRQHandler             ; USART2 
-                DCD     USART3_IRQHandler             ; USART3 
-                DCD     EXTI15_10_IRQHandler          ; External Line[15:10]s 
-                DCD     RTC_Alarm_IRQHandler          ; RTC Alarm (A and B) through EXTI Line 
-                DCD     OTG_FS_WKUP_IRQHandler        ; USB OTG FS Wakeup through EXTI line 
-                DCD     TIM8_BRK_TIM12_IRQHandler     ; TIM8 Break and TIM12 
-                DCD     TIM8_UP_TIM13_IRQHandler      ; TIM8 Update and TIM13 
-                DCD     TIM8_TRG_COM_TIM14_IRQHandler ; TIM8 Trigger and Commutation and TIM14 
-                DCD     TIM8_CC_IRQHandler            ; TIM8 Capture Compare 
-                DCD     DMA1_Stream7_IRQHandler       ; DMA1 Stream7 
-                DCD     FSMC_IRQHandler               ; FSMC 
-                DCD     SDIO_IRQHandler               ; SDIO 
-                DCD     TIM5_IRQHandler               ; TIM5 
-                DCD     SPI3_IRQHandler               ; SPI3 
-                DCD     UART4_IRQHandler              ; UART4 
-                DCD     UART5_IRQHandler              ; UART5 
-                DCD     TIM6_DAC_IRQHandler           ; TIM6 and DAC1&2 underrun errors 
-                DCD     TIM7_IRQHandler               ; TIM7 
-                DCD     DMA2_Stream0_IRQHandler       ; DMA2 Stream 0 
-                DCD     DMA2_Stream1_IRQHandler       ; DMA2 Stream 1 
-                DCD     DMA2_Stream2_IRQHandler       ; DMA2 Stream 2 
-                DCD     DMA2_Stream3_IRQHandler       ; DMA2 Stream 3 
-                DCD     DMA2_Stream4_IRQHandler       ; DMA2 Stream 4 
-                DCD     ETH_IRQHandler                ; Ethernet 
-                DCD     ETH_WKUP_IRQHandler           ; Ethernet Wakeup through EXTI line 
-                DCD     CAN2_TX_IRQHandler            ; CAN2 TX 
-                DCD     CAN2_RX0_IRQHandler           ; CAN2 RX0 
-                DCD     CAN2_RX1_IRQHandler           ; CAN2 RX1 
-                DCD     CAN2_SCE_IRQHandler           ; CAN2 SCE 
-                DCD     OTG_FS_IRQHandler             ; USB OTG FS 
-                DCD     DMA2_Stream5_IRQHandler       ; DMA2 Stream 5 
-                DCD     DMA2_Stream6_IRQHandler       ; DMA2 Stream 6 
-                DCD     DMA2_Stream7_IRQHandler       ; DMA2 Stream 7 
-                DCD     USART6_IRQHandler             ; USART6 
-                DCD     I2C3_EV_IRQHandler            ; I2C3 event 
-                DCD     I2C3_ER_IRQHandler            ; I2C3 error 
-                DCD     OTG_HS_EP1_OUT_IRQHandler     ; USB OTG HS End Point 1 Out 
-                DCD     OTG_HS_EP1_IN_IRQHandler      ; USB OTG HS End Point 1 In 
-                DCD     OTG_HS_WKUP_IRQHandler        ; USB OTG HS Wakeup through EXTI 
-                DCD     OTG_HS_IRQHandler             ; USB OTG HS 
-                DCD     DCMI_IRQHandler               ; DCMI 
-                DCD     CRYP_IRQHandler               ; CRYP crypto 
-                DCD     HASH_RNG_IRQHandler           ; Hash and Rng 
-                DCD     FPU_IRQHandler                ; FPU 
-
-
-                AREA    |.text|, CODE, READONLY
-
-
-; Reset Handler
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-
-; Dummy Exception Handlers (infinite loops which can be modified)
-
-NMI_Handler     PROC
-                EXPORT  NMI_Handler               [WEAK]
-                B       .
-                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-MemManage_Handler\
-                PROC
-                EXPORT  MemManage_Handler         [WEAK]
-                B       .
-                ENDP
-BusFault_Handler\
-                PROC
-                EXPORT  BusFault_Handler          [WEAK]
-                B       .
-                ENDP
-UsageFault_Handler\
-                PROC
-                EXPORT  UsageFault_Handler        [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-DebugMon_Handler\
-                PROC
-                EXPORT  DebugMon_Handler          [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-
-                EXPORT  WWDG_IRQHandler                 [WEAK]
-                EXPORT  PVD_IRQHandler                  [WEAK]
-                EXPORT  TAMP_STAMP_IRQHandler           [WEAK]
-                EXPORT  RTC_WKUP_IRQHandler             [WEAK]
-                EXPORT  FLASH_IRQHandler                [WEAK]
-                EXPORT  RCC_IRQHandler                  [WEAK]
-                EXPORT  EXTI0_IRQHandler                [WEAK]
-                EXPORT  EXTI1_IRQHandler                [WEAK]
-                EXPORT  EXTI2_IRQHandler                [WEAK]
-                EXPORT  EXTI3_IRQHandler                [WEAK]
-                EXPORT  EXTI4_IRQHandler                [WEAK]
-                EXPORT  DMA1_Stream0_IRQHandler         [WEAK]
-                EXPORT  DMA1_Stream1_IRQHandler         [WEAK]
-                EXPORT  DMA1_Stream2_IRQHandler         [WEAK]
-                EXPORT  DMA1_Stream3_IRQHandler         [WEAK]
-                EXPORT  DMA1_Stream4_IRQHandler         [WEAK]
-                EXPORT  DMA1_Stream5_IRQHandler         [WEAK]
-                EXPORT  DMA1_Stream6_IRQHandler         [WEAK]
-                EXPORT  ADC_IRQHandler                  [WEAK]
-                EXPORT  CAN1_TX_IRQHandler              [WEAK]
-                EXPORT  CAN1_RX0_IRQHandler             [WEAK]
-                EXPORT  CAN1_RX1_IRQHandler             [WEAK]
-                EXPORT  CAN1_SCE_IRQHandler             [WEAK]
-                EXPORT  EXTI9_5_IRQHandler              [WEAK]
-                EXPORT  TIM1_BRK_TIM9_IRQHandler        [WEAK]
-                EXPORT  TIM1_UP_TIM10_IRQHandler        [WEAK]
-                EXPORT  TIM1_TRG_COM_TIM11_IRQHandler   [WEAK]
-                EXPORT  TIM1_CC_IRQHandler              [WEAK]
-                EXPORT  TIM2_IRQHandler                 [WEAK]
-                EXPORT  TIM3_IRQHandler                 [WEAK]
-                EXPORT  TIM4_IRQHandler                 [WEAK]
-                EXPORT  I2C1_EV_IRQHandler              [WEAK]
-                EXPORT  I2C1_ER_IRQHandler              [WEAK]
-                EXPORT  I2C2_EV_IRQHandler              [WEAK]
-                EXPORT  I2C2_ER_IRQHandler              [WEAK]
-                EXPORT  SPI1_IRQHandler                 [WEAK]
-                EXPORT  SPI2_IRQHandler                 [WEAK]
-                EXPORT  USART1_IRQHandler               [WEAK]
-                EXPORT  USART2_IRQHandler               [WEAK]
-                EXPORT  USART3_IRQHandler               [WEAK]
-                EXPORT  EXTI15_10_IRQHandler            [WEAK]
-                EXPORT  RTC_Alarm_IRQHandler            [WEAK]
-                EXPORT  OTG_FS_WKUP_IRQHandler          [WEAK]
-                EXPORT  TIM8_BRK_TIM12_IRQHandler       [WEAK]
-                EXPORT  TIM8_UP_TIM13_IRQHandler        [WEAK]
-                EXPORT  TIM8_TRG_COM_TIM14_IRQHandler   [WEAK]
-                EXPORT  TIM8_CC_IRQHandler              [WEAK]
-                EXPORT  DMA1_Stream7_IRQHandler         [WEAK]
-                EXPORT  FSMC_IRQHandler                 [WEAK]
-                EXPORT  SDIO_IRQHandler                 [WEAK]
-                EXPORT  TIM5_IRQHandler                 [WEAK]
-                EXPORT  SPI3_IRQHandler                 [WEAK]
-                EXPORT  UART4_IRQHandler                [WEAK]
-                EXPORT  UART5_IRQHandler                [WEAK]
-                EXPORT  TIM6_DAC_IRQHandler             [WEAK]
-                EXPORT  TIM7_IRQHandler                 [WEAK]
-                EXPORT  DMA2_Stream0_IRQHandler         [WEAK]
-                EXPORT  DMA2_Stream1_IRQHandler         [WEAK]
-                EXPORT  DMA2_Stream2_IRQHandler         [WEAK]
-                EXPORT  DMA2_Stream3_IRQHandler         [WEAK]
-                EXPORT  DMA2_Stream4_IRQHandler         [WEAK]
-                EXPORT  ETH_IRQHandler                  [WEAK]
-                EXPORT  ETH_WKUP_IRQHandler             [WEAK]
-                EXPORT  CAN2_TX_IRQHandler              [WEAK]
-                EXPORT  CAN2_RX0_IRQHandler             [WEAK]
-                EXPORT  CAN2_RX1_IRQHandler             [WEAK]
-                EXPORT  CAN2_SCE_IRQHandler             [WEAK]
-                EXPORT  OTG_FS_IRQHandler               [WEAK]
-                EXPORT  DMA2_Stream5_IRQHandler         [WEAK]
-                EXPORT  DMA2_Stream6_IRQHandler         [WEAK]
-                EXPORT  DMA2_Stream7_IRQHandler         [WEAK]
-                EXPORT  USART6_IRQHandler               [WEAK]
-                EXPORT  I2C3_EV_IRQHandler              [WEAK]
-                EXPORT  I2C3_ER_IRQHandler              [WEAK]
-                EXPORT  OTG_HS_EP1_OUT_IRQHandler       [WEAK]
-                EXPORT  OTG_HS_EP1_IN_IRQHandler        [WEAK]
-                EXPORT  OTG_HS_WKUP_IRQHandler          [WEAK]
-                EXPORT  OTG_HS_IRQHandler               [WEAK]
-                EXPORT  DCMI_IRQHandler                 [WEAK]
-                EXPORT  CRYP_IRQHandler                 [WEAK]
-                EXPORT  HASH_RNG_IRQHandler             [WEAK]
-                EXPORT  FPU_IRQHandler                  [WEAK]
-
-WWDG_IRQHandler
-PVD_IRQHandler
-TAMP_STAMP_IRQHandler
-RTC_WKUP_IRQHandler
-FLASH_IRQHandler
-RCC_IRQHandler
-EXTI0_IRQHandler
-EXTI1_IRQHandler
-EXTI2_IRQHandler
-EXTI3_IRQHandler
-EXTI4_IRQHandler
-DMA1_Stream0_IRQHandler
-DMA1_Stream1_IRQHandler
-DMA1_Stream2_IRQHandler
-DMA1_Stream3_IRQHandler
-DMA1_Stream4_IRQHandler
-DMA1_Stream5_IRQHandler
-DMA1_Stream6_IRQHandler
-ADC_IRQHandler
-CAN1_TX_IRQHandler
-CAN1_RX0_IRQHandler
-CAN1_RX1_IRQHandler
-CAN1_SCE_IRQHandler
-EXTI9_5_IRQHandler
-TIM1_BRK_TIM9_IRQHandler
-TIM1_UP_TIM10_IRQHandler
-TIM1_TRG_COM_TIM11_IRQHandler
-TIM1_CC_IRQHandler
-TIM2_IRQHandler
-TIM3_IRQHandler
-TIM4_IRQHandler
-I2C1_EV_IRQHandler
-I2C1_ER_IRQHandler
-I2C2_EV_IRQHandler
-I2C2_ER_IRQHandler
-SPI1_IRQHandler
-SPI2_IRQHandler
-USART1_IRQHandler
-USART2_IRQHandler
-USART3_IRQHandler
-EXTI15_10_IRQHandler
-RTC_Alarm_IRQHandler
-OTG_FS_WKUP_IRQHandler
-TIM8_BRK_TIM12_IRQHandler
-TIM8_UP_TIM13_IRQHandler
-TIM8_TRG_COM_TIM14_IRQHandler
-TIM8_CC_IRQHandler
-DMA1_Stream7_IRQHandler
-FSMC_IRQHandler
-SDIO_IRQHandler
-TIM5_IRQHandler
-SPI3_IRQHandler
-UART4_IRQHandler
-UART5_IRQHandler
-TIM6_DAC_IRQHandler
-TIM7_IRQHandler
-DMA2_Stream0_IRQHandler
-DMA2_Stream1_IRQHandler
-DMA2_Stream2_IRQHandler
-DMA2_Stream3_IRQHandler
-DMA2_Stream4_IRQHandler
-ETH_IRQHandler
-ETH_WKUP_IRQHandler
-CAN2_TX_IRQHandler
-CAN2_RX0_IRQHandler
-CAN2_RX1_IRQHandler
-CAN2_SCE_IRQHandler
-OTG_FS_IRQHandler
-DMA2_Stream5_IRQHandler
-DMA2_Stream6_IRQHandler
-DMA2_Stream7_IRQHandler
-USART6_IRQHandler
-I2C3_EV_IRQHandler
-I2C3_ER_IRQHandler
-OTG_HS_EP1_OUT_IRQHandler
-OTG_HS_EP1_IN_IRQHandler
-OTG_HS_WKUP_IRQHandler
-OTG_HS_IRQHandler
-DCMI_IRQHandler
-CRYP_IRQHandler
-HASH_RNG_IRQHandler
-FPU_IRQHandler
- 
-                B       .
-
-                ENDP
-
-
-                ALIGN
-                END
--- a/targets/cmsis/TARGET_STM/TARGET_STM32F4XX/TOOLCHAIN_ARM_STD/sys.cpp	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library - stackheap
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * Setup a fixed single stack/heap memory model, 
- *  between the top of the RW/ZI region and the stackpointer
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif 
-
-#include <rt_misc.h>
-#include <stdint.h>
-
-extern char Image$$RW_IRAM1$$ZI$$Limit[];
-
-extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
-    uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
-    uint32_t sp_limit = __current_sp();
-
-    zi_limit = (zi_limit + 7) & ~0x7;    // ensure zi_limit is 8-byte aligned
-
-    struct __initial_stackheap r;
-    r.heap_base = zi_limit;
-    r.heap_limit = sp_limit;
-    return r;
-}
-
-#ifdef __cplusplus
-}
-#endif 
--- a/targets/cmsis/TARGET_STM/TARGET_STM32F4XX/TOOLCHAIN_GCC_ARM/STM32F407.ld	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/* Linker script for STM32F407 */
-
-/* Linker script to configure memory regions. */
-MEMORY
-{ 
-  FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
-  CCM (rwx) : ORIGIN = 0x10000000, LENGTH = 64K
-  RAM (rwx) : ORIGIN = 0x20000188, LENGTH = 0x1FE78 
-}
-
-/* Linker script to place sections and symbol values. Should be used together
- * with other linker script that defines memory regions FLASH and RAM.
- * It references following symbols, which must be defined in code:
- *   Reset_Handler : Entry of reset handler
- * 
- * It defines following symbols, which code can use without definition:
- *   __exidx_start
- *   __exidx_end
- *   __etext
- *   __data_start__
- *   __preinit_array_start
- *   __preinit_array_end
- *   __init_array_start
- *   __init_array_end
- *   __fini_array_start
- *   __fini_array_end
- *   __data_end__
- *   __bss_start__
- *   __bss_end__
- *   __end__
- *   end
- *   __HeapLimit
- *   __StackLimit
- *   __StackTop
- *   __stack
- */
-ENTRY(Reset_Handler)
-
-SECTIONS
-{
-    .text :
-    {
-        KEEP(*(.isr_vector))
-        *(.text*)
-
-        KEEP(*(.init))
-        KEEP(*(.fini))
-
-        /* .ctors */
-        *crtbegin.o(.ctors)
-        *crtbegin?.o(.ctors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
-        *(SORT(.ctors.*))
-        *(.ctors)
-
-        /* .dtors */
-        *crtbegin.o(.dtors)
-        *crtbegin?.o(.dtors)
-        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
-        *(SORT(.dtors.*))
-        *(.dtors)
-
-        *(.rodata*)
-
-        KEEP(*(.eh_frame*))
-    } > FLASH
-
-    .ARM.extab : 
-    {
-        *(.ARM.extab* .gnu.linkonce.armextab.*)
-    } > FLASH
-
-    __exidx_start = .;
-    .ARM.exidx :
-    {
-        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-    } > FLASH
-    __exidx_end = .;
-
-    __etext = .;
-        
-    .data : AT (__etext)
-    {
-        __data_start__ = .;
-        *(vtable)
-        *(.data*)
-
-        . = ALIGN(4);
-        /* preinit data */
-        PROVIDE_HIDDEN (__preinit_array_start = .);
-        KEEP(*(.preinit_array))
-        PROVIDE_HIDDEN (__preinit_array_end = .);
-
-        . = ALIGN(4);
-        /* init data */
-        PROVIDE_HIDDEN (__init_array_start = .);
-        KEEP(*(SORT(.init_array.*)))
-        KEEP(*(.init_array))
-        PROVIDE_HIDDEN (__init_array_end = .);
-
-
-        . = ALIGN(4);
-        /* finit data */
-        PROVIDE_HIDDEN (__fini_array_start = .);
-        KEEP(*(SORT(.fini_array.*)))
-        KEEP(*(.fini_array))
-        PROVIDE_HIDDEN (__fini_array_end = .);
-
-        KEEP(*(.jcr*))
-        . = ALIGN(4);
-        /* All data end */
-        __data_end__ = .;
-
-    } > RAM
-
-    .bss :
-    {
-        . = ALIGN(4);
-        __bss_start__ = .;
-        *(.bss*)
-        *(COMMON)
-        . = ALIGN(4);
-        __bss_end__ = .;
-    } > RAM
-    
-    .heap (COPY):
-    {
-        __end__ = .;
-        end = __end__;
-        *(.heap*)
-        __HeapLimit = .;
-    } > RAM
-
-    /* .stack_dummy section doesn't contains any symbols. It is only
-     * used for linker to calculate size of stack sections, and assign
-     * values to stack symbols later */
-    .stack_dummy (COPY):
-    {
-        *(.stack*)
-    } > RAM
-
-    /* Set stack top to end of RAM, and stack limit move down by
-     * size of stack_dummy section */
-    __StackTop = ORIGIN(RAM) + LENGTH(RAM);
-    __StackLimit = __StackTop - SIZEOF(.stack_dummy);
-    PROVIDE(__stack = __StackTop);
-    
-    /* Check if data + heap + stack exceeds RAM limit */
-    ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
-}
-
--- a/targets/cmsis/TARGET_STM/TARGET_STM32F4XX/TOOLCHAIN_GCC_ARM/startup_STM32F40x.s	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,338 +0,0 @@
-/* File: startup_STM32F40x.S
- * Purpose: startup file for Cortex-M4 devices. Should use with
- *   GCC for ARM Embedded Processors
- * Version: V1.4
- * Date: 09 July 2012
- *
- * Copyright (c) 2011, 2012, 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 the ARM Limited 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 ARM LIMITED 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.
- */
-    .syntax unified
-    .arch armv7-m
-
-    .section .stack
-    .align 3
-#ifdef __STACK_SIZE
-    .equ    Stack_Size, __STACK_SIZE
-#else
-    .equ    Stack_Size, 0xc00
-#endif
-    .globl    __StackTop
-    .globl    __StackLimit
-__StackLimit:
-    .space    Stack_Size
-    .size __StackLimit, . - __StackLimit
-__StackTop:
-    .size __StackTop, . - __StackTop
-
-    .section .heap
-    .align 3
-#ifdef __HEAP_SIZE
-    .equ    Heap_Size, __HEAP_SIZE
-#else
-    .equ    Heap_Size, 0
-#endif
-    .globl    __HeapBase
-    .globl    __HeapLimit
-__HeapBase:
-    .if    Heap_Size
-    .space    Heap_Size
-    .endif
-    .size __HeapBase, . - __HeapBase
-__HeapLimit:
-    .size __HeapLimit, . - __HeapLimit
-
-    .section .isr_vector
-    .align 2
-    .globl __isr_vector
-__isr_vector:
-    .long    __StackTop            /* Top of Stack */
-    .long    Reset_Handler         /* Reset Handler */
-    .long    NMI_Handler           /* NMI Handler */
-    .long    HardFault_Handler     /* Hard Fault Handler */
-    .long    MemManage_Handler     /* MPU Fault Handler */
-    .long    BusFault_Handler      /* Bus Fault Handler */
-    .long    UsageFault_Handler    /* Usage Fault Handler */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    0                     /* Reserved */
-    .long    SVC_Handler           /* SVCall Handler */
-    .long    DebugMon_Handler      /* Debug Monitor Handler */
-    .long    0                     /* Reserved */
-    .long    PendSV_Handler        /* PendSV Handler */
-    .long    SysTick_Handler       /* SysTick Handler */
-
-    /* External interrupts */
-    .long     WWDG_IRQHandler               /* Window WatchDog */
-    .long     PVD_IRQHandler                /* PVD through EXTI Line detection */
-    .long     TAMP_STAMP_IRQHandler         /* Tamper and TimeStamps through the EXTI line */
-    .long     RTC_WKUP_IRQHandler           /* RTC Wakeup through the EXTI line */
-    .long     FLASH_IRQHandler              /* FLASH */
-    .long     RCC_IRQHandler                /* RCC */
-    .long     EXTI0_IRQHandler              /* EXTI Line0 */
-    .long     EXTI1_IRQHandler              /* EXTI Line1 */
-    .long     EXTI2_IRQHandler              /* EXTI Line2 */
-    .long     EXTI3_IRQHandler              /* EXTI Line3 */
-    .long     EXTI4_IRQHandler              /* EXTI Line4 */
-    .long     DMA1_Stream0_IRQHandler       /* DMA1 Stream 0 */
-    .long     DMA1_Stream1_IRQHandler       /* DMA1 Stream 1 */
-    .long     DMA1_Stream2_IRQHandler       /* DMA1 Stream 2 */
-    .long     DMA1_Stream3_IRQHandler       /* DMA1 Stream 3 */
-    .long     DMA1_Stream4_IRQHandler       /* DMA1 Stream 4 */
-    .long     DMA1_Stream5_IRQHandler       /* DMA1 Stream 5 */
-    .long     DMA1_Stream6_IRQHandler       /* DMA1 Stream 6 */
-    .long     ADC_IRQHandler                /* ADC1, ADC2 and ADC3s */
-    .long     CAN1_TX_IRQHandler            /* CAN1 TX */
-    .long     CAN1_RX0_IRQHandler           /* CAN1 RX0 */
-    .long     CAN1_RX1_IRQHandler           /* CAN1 RX1 */
-    .long     CAN1_SCE_IRQHandler           /* CAN1 SCE */
-    .long     EXTI9_5_IRQHandler            /* External Line[9:5]s */
-    .long     TIM1_BRK_TIM9_IRQHandler      /* TIM1 Break and TIM9 */
-    .long     TIM1_UP_TIM10_IRQHandler      /* TIM1 Update and TIM10 */
-    .long     TIM1_TRG_COM_TIM11_IRQHandler /* TIM1 Trigger and Commutation and TIM11 */
-    .long     TIM1_CC_IRQHandler            /* TIM1 Capture Compare */
-    .long     TIM2_IRQHandler               /* TIM2 */
-    .long     TIM3_IRQHandler               /* TIM3 */
-    .long     TIM4_IRQHandler               /* TIM4 */
-    .long     I2C1_EV_IRQHandler            /* I2C1 Event */
-    .long     I2C1_ER_IRQHandler            /* I2C1 Error */
-    .long     I2C2_EV_IRQHandler            /* I2C2 Event */
-    .long     I2C2_ER_IRQHandler            /* I2C2 Error */
-    .long     SPI1_IRQHandler               /* SPI1 */
-    .long     SPI2_IRQHandler               /* SPI2 */
-    .long     USART1_IRQHandler             /* USART1 */
-    .long     USART2_IRQHandler             /* USART2 */
-    .long     USART3_IRQHandler             /* USART3 */
-    .long     EXTI15_10_IRQHandler          /* External Line[15:10]s */
-    .long     RTC_Alarm_IRQHandler          /* RTC Alarm (A and B) through EXTI Line */
-    .long     OTG_FS_WKUP_IRQHandler        /* USB OTG FS Wakeup through EXTI line */
-    .long     TIM8_BRK_TIM12_IRQHandler     /* TIM8 Break and TIM12 */
-    .long     TIM8_UP_TIM13_IRQHandler      /* TIM8 Update and TIM13 */
-    .long     TIM8_TRG_COM_TIM14_IRQHandler /* TIM8 Trigger and Commutation and TIM14 */
-    .long     TIM8_CC_IRQHandler            /* TIM8 Capture Compare */
-    .long     DMA1_Stream7_IRQHandler       /* DMA1 Stream7 */
-    .long     FSMC_IRQHandler               /* FSMC */
-    .long     SDIO_IRQHandler               /* SDIO */
-    .long     TIM5_IRQHandler               /* TIM5 */
-    .long     SPI3_IRQHandler               /* SPI3 */
-    .long     UART4_IRQHandler              /* UART4 */
-    .long     UART5_IRQHandler              /* UART5 */
-    .long     TIM6_DAC_IRQHandler           /* TIM6 and DAC1&2 underrun errors */
-    .long     TIM7_IRQHandler               /* TIM7 */
-    .long     DMA2_Stream0_IRQHandler       /* DMA2 Stream 0 */
-    .long     DMA2_Stream1_IRQHandler       /* DMA2 Stream 1 */
-    .long     DMA2_Stream2_IRQHandler       /* DMA2 Stream 2 */
-    .long     DMA2_Stream3_IRQHandler       /* DMA2 Stream 3 */
-    .long     DMA2_Stream4_IRQHandler       /* DMA2 Stream 4 */
-    .long     ETH_IRQHandler                /* Ethernet */
-    .long     ETH_WKUP_IRQHandler           /* Ethernet Wakeup through EXTI line */
-    .long     CAN2_TX_IRQHandler            /* CAN2 TX */
-    .long     CAN2_RX0_IRQHandler           /* CAN2 RX0 */
-    .long     CAN2_RX1_IRQHandler           /* CAN2 RX1 */
-    .long     CAN2_SCE_IRQHandler           /* CAN2 SCE */
-    .long     OTG_FS_IRQHandler             /* USB OTG FS */
-    .long     DMA2_Stream5_IRQHandler       /* DMA2 Stream 5 */
-    .long     DMA2_Stream6_IRQHandler       /* DMA2 Stream 6 */
-    .long     DMA2_Stream7_IRQHandler       /* DMA2 Stream 7 */
-    .long     USART6_IRQHandler             /* USART6 */
-    .long     I2C3_EV_IRQHandler            /* I2C3 event */
-    .long     I2C3_ER_IRQHandler            /* I2C3 error */
-    .long     OTG_HS_EP1_OUT_IRQHandler     /* USB OTG HS End Point 1 Out */
-    .long     OTG_HS_EP1_IN_IRQHandler      /* USB OTG HS End Point 1 In */
-    .long     OTG_HS_WKUP_IRQHandler        /* USB OTG HS Wakeup through EXTI */
-    .long     OTG_HS_IRQHandler             /* USB OTG HS */
-    .long     DCMI_IRQHandler               /* DCMI */
-    .long     CRYP_IRQHandler               /* CRYP crypto */
-    .long     HASH_RNG_IRQHandler           /* Hash and Rng */
-    .long     FPU_IRQHandler                /* FPU */
-
-    .size    __isr_vector, . - __isr_vector
-
-    .text
-    .thumb
-    .thumb_func
-    .align 2
-    .globl    Reset_Handler
-    .type    Reset_Handler, %function
-Reset_Handler:
-/*     Loop to copy data from read only memory to RAM. The ranges
- *      of copy from/to are specified by following symbols evaluated in
- *      linker script.
- *      __etext: End of code section, i.e., begin of data sections to copy from.
- *      __data_start__/__data_end__: RAM address range that data should be
- *      copied to. Both must be aligned to 4 bytes boundary.  */
-
-    ldr    r1, =__etext
-    ldr    r2, =__data_start__
-    ldr    r3, =__data_end__
-
-.LC0:
-    cmp     r2, r3
-    ittt    lt
-    ldrlt   r0, [r1], #4
-    strlt   r0, [r2], #4
-    blt    .LC0
-
-/*     This part of work usually is done in C library startup code. Otherwise,
- *     define this macro to enable it in this startup.
- *
- *     Loop to zero out BSS section, which uses following symbols
- *     in linker script:
- *      __bss_start__: start of BSS section. Must align to 4
- *      __bss_end__: end of BSS section. Must align to 4
- *
- *      Question - Why is this not in the mbed version?
- */
-    ldr r1, =__bss_start__
-    ldr r2, =__bss_end__
-
-    movs    r0, 0
-.LC2:
-    cmp     r1, r2
-    itt    lt
-    strlt   r0, [r1], #4
-    blt    .LC2
-# End clearing the BSS section
-
-    ldr    r0, =SystemInit
-    blx    r0
-    ldr    r0, =_start
-    bx     r0
-    .pool
-    .size Reset_Handler, . - Reset_Handler
-
-/*    Macro to define default handlers. Default handler
- *    will be weak symbol and just dead loops. They can be
- *    overwritten by other handlers */
-    .macro    def_default_handler    handler_name
-    .align 1
-    .thumb_func
-    .weak    \handler_name
-    .type    \handler_name, %function
-\handler_name :
-    b    .
-    .size    \handler_name, . - \handler_name
-    .endm
-
-    def_default_handler    NMI_Handler
-    def_default_handler    HardFault_Handler
-    def_default_handler    MemManage_Handler
-    def_default_handler    BusFault_Handler
-    def_default_handler    UsageFault_Handler
-    def_default_handler    SVC_Handler
-    def_default_handler    DebugMon_Handler
-    def_default_handler    PendSV_Handler
-    def_default_handler    SysTick_Handler
-    def_default_handler    Default_Handler
-
-    def_default_handler     WWDG_IRQHandler
-    def_default_handler     PVD_IRQHandler
-    def_default_handler     TAMP_STAMP_IRQHandler
-    def_default_handler     RTC_WKUP_IRQHandler
-    def_default_handler     FLASH_IRQHandler
-    def_default_handler     RCC_IRQHandler
-    def_default_handler     EXTI0_IRQHandler
-    def_default_handler     EXTI1_IRQHandler
-    def_default_handler     EXTI2_IRQHandler
-    def_default_handler     EXTI3_IRQHandler
-    def_default_handler     EXTI4_IRQHandler
-    def_default_handler     DMA1_Stream0_IRQHandler
-    def_default_handler     DMA1_Stream1_IRQHandler
-    def_default_handler     DMA1_Stream2_IRQHandler
-    def_default_handler     DMA1_Stream3_IRQHandler
-    def_default_handler     DMA1_Stream4_IRQHandler
-    def_default_handler     DMA1_Stream5_IRQHandler
-    def_default_handler     DMA1_Stream6_IRQHandler
-    def_default_handler     ADC_IRQHandler
-    def_default_handler     CAN1_TX_IRQHandler
-    def_default_handler     CAN1_RX0_IRQHandler
-    def_default_handler     CAN1_RX1_IRQHandler
-    def_default_handler     CAN1_SCE_IRQHandler
-    def_default_handler     EXTI9_5_IRQHandler
-    def_default_handler     TIM1_BRK_TIM9_IRQHandler
-    def_default_handler     TIM1_UP_TIM10_IRQHandler
-    def_default_handler     TIM1_TRG_COM_TIM11_IRQHandler
-    def_default_handler     TIM1_CC_IRQHandler
-    def_default_handler     TIM2_IRQHandler
-    def_default_handler     TIM3_IRQHandler
-    def_default_handler     TIM4_IRQHandler
-    def_default_handler     I2C1_EV_IRQHandler
-    def_default_handler     I2C1_ER_IRQHandler
-    def_default_handler     I2C2_EV_IRQHandler
-    def_default_handler     I2C2_ER_IRQHandler
-    def_default_handler     SPI1_IRQHandler
-    def_default_handler     SPI2_IRQHandler
-    def_default_handler     USART1_IRQHandler
-    def_default_handler     USART2_IRQHandler
-    def_default_handler     USART3_IRQHandler
-    def_default_handler     EXTI15_10_IRQHandler
-    def_default_handler     RTC_Alarm_IRQHandler
-    def_default_handler     OTG_FS_WKUP_IRQHandler
-    def_default_handler     TIM8_BRK_TIM12_IRQHandler
-    def_default_handler     TIM8_UP_TIM13_IRQHandler
-    def_default_handler     TIM8_TRG_COM_TIM14_IRQHandler
-    def_default_handler     TIM8_CC_IRQHandler
-    def_default_handler     DMA1_Stream7_IRQHandler
-    def_default_handler     FSMC_IRQHandler
-    def_default_handler     SDIO_IRQHandler
-    def_default_handler     TIM5_IRQHandler
-    def_default_handler     SPI3_IRQHandler
-    def_default_handler     UART4_IRQHandler
-    def_default_handler     UART5_IRQHandler
-    def_default_handler     TIM6_DAC_IRQHandler
-    def_default_handler     TIM7_IRQHandler
-    def_default_handler     DMA2_Stream0_IRQHandler
-    def_default_handler     DMA2_Stream1_IRQHandler
-    def_default_handler     DMA2_Stream2_IRQHandler
-    def_default_handler     DMA2_Stream3_IRQHandler
-    def_default_handler     DMA2_Stream4_IRQHandler
-    def_default_handler     ETH_IRQHandler
-    def_default_handler     ETH_WKUP_IRQHandler
-    def_default_handler     CAN2_TX_IRQHandler
-    def_default_handler     CAN2_RX0_IRQHandler
-    def_default_handler     CAN2_RX1_IRQHandler
-    def_default_handler     CAN2_SCE_IRQHandler
-    def_default_handler     OTG_FS_IRQHandler
-    def_default_handler     DMA2_Stream5_IRQHandler
-    def_default_handler     DMA2_Stream6_IRQHandler
-    def_default_handler     DMA2_Stream7_IRQHandler
-    def_default_handler     USART6_IRQHandler
-    def_default_handler     I2C3_EV_IRQHandler
-    def_default_handler     I2C3_ER_IRQHandler
-    def_default_handler     OTG_HS_EP1_OUT_IRQHandler
-    def_default_handler     OTG_HS_EP1_IN_IRQHandler
-    def_default_handler     OTG_HS_WKUP_IRQHandler
-    def_default_handler     OTG_HS_IRQHandler
-    def_default_handler     DCMI_IRQHandler
-    def_default_handler     CRYP_IRQHandler
-    def_default_handler     HASH_RNG_IRQHandler
-    def_default_handler     FPU_IRQHandler
-
-
-    .weak    DEF_IRQHandler
-    .set    DEF_IRQHandler, Default_Handler
-
-    .end
--- a/targets/cmsis/TARGET_STM/TARGET_STM32F4XX/cmsis.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-/* mbed Microcontroller Library - CMSIS
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- * 
- * A generic CMSIS include header, pulling in STM32F407 specifics
- */
-
-#ifndef MBED_CMSIS_H
-#define MBED_CMSIS_H
-
-#include "stm32f4xx.h"
-#include "cmsis_nvic.h"
-
-#endif
-
--- a/targets/cmsis/TARGET_STM/TARGET_STM32F4XX/cmsis_nvic.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic for STM32F4
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */ 
-#include "cmsis_nvic.h"
-
-#define NVIC_RAM_VECTOR_ADDRESS   (0x20000000)  // Location of vectors in RAM
-
-static unsigned char vtor_relocated;
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
-    uint32_t *vectors = (uint32_t*)SCB->VTOR;
-    uint32_t i;
-
-    // Copy and switch to dynamic vectors if the first time called
-    if (!vtor_relocated) {
-        uint32_t *old_vectors = vectors;
-        vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
-        for (i=0; i<NVIC_NUM_VECTORS; i++) {
-            vectors[i] = old_vectors[i];
-        }
-        SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
-        vtor_relocated = 1;
-    }
-    vectors[IRQn + 16] = vector;
-}
-
-uint32_t NVIC_GetVector(IRQn_Type IRQn) {
-    uint32_t *vectors = (uint32_t*)SCB->VTOR;
-    return vectors[IRQn + 16];
-}
-
--- a/targets/cmsis/TARGET_STM/TARGET_STM32F4XX/cmsis_nvic.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/* mbed Microcontroller Library - cmsis_nvic
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */
-
-#ifndef MBED_CMSIS_NVIC_H
-#define MBED_CMSIS_NVIC_H
-
-#define NVIC_NUM_VECTORS      (16 + 81)   // CORE + MCU Peripherals
-#define NVIC_USER_IRQ_OFFSET  16
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
-uint32_t NVIC_GetVector(IRQn_Type IRQn);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/cmsis/TARGET_STM/TARGET_STM32F4XX/stm32f4xx.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7155 +0,0 @@
-/**
-  ******************************************************************************
-  * @file    stm32f4xx.h
-  * @author  MCD Application Team
-  * @version V1.1.0
-  * @date    11-January-2013
-  * @brief   CMSIS Cortex-M4 Device Peripheral Access Layer Header File. 
-  *          This file contains all the peripheral register's definitions, bits 
-  *          definitions and memory mapping for STM32F4xx devices.            
-  *            
-  *          The file is the unique include file that the application programmer
-  *          is using in the C source code, usually in main.c. This file contains:
-  *           - Configuration section that allows to select:
-  *              - The device used in the target application
-  *              - To use or not the peripheral's drivers in application code(i.e. 
-  *                code will be based on direct access to peripheral's registers 
-  *                rather than drivers API), this option is controlled by 
-  *                "#define USE_STDPERIPH_DRIVER"
-  *              - To change few application-specific parameters such as the HSE 
-  *                crystal frequency
-  *           - Data structures and the address mapping for all peripherals
-  *           - Peripheral's registers declarations and bits definition
-  *           - Macros to access peripheral's registers hardware
-  *  
-  ******************************************************************************
-  * @attention
-  *
-  * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2>
-  *
-  * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
-  * You may not use this file except in compliance with the License.
-  * You may obtain a copy of the License at:
-  *
-  *        http://www.st.com/software_license_agreement_liberty_v2
-  *
-  * Unless required by applicable law or agreed to in writing, software 
-  * distributed under the License is distributed on an "AS IS" BASIS, 
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  *
-  ******************************************************************************  
-  */ 
-
-/** @addtogroup CMSIS
-  * @{
-  */
-
-/** @addtogroup stm32f4xx
-  * @{
-  */
-    
-#ifndef __STM32F4xx_H
-#define __STM32F4xx_H
-
-#ifdef __cplusplus
- extern "C" {
-#endif /* __cplusplus */
-  
-/** @addtogroup Library_configuration_section
-  * @{
-  */
-  
-/* Uncomment the line below according to the target STM32 device used in your
-   application 
-  */
-
-#if !defined (STM32F4XX) && !defined (STM32F40XX) && !defined (STM32F427X)
-   #define STM32F40XX    /*!< STM32F40xx/41xx Devices */
-  /* #define STM32F427X */   /*!< STM32F427x/437x Devices*/
-#endif
-
-
-/*  Tip: To avoid modifying this file each time you need to switch between these
-        devices, you can define the device in your toolchain compiler preprocessor.
-  */
-
-#if !defined (STM32F4XX) && !defined (STM32F40XX) && !defined (STM32F427X)
- #error "Please select first the target STM32F4xx device used in your application (in stm32f4xx.h file)"
-#endif
-
-#if !defined  (USE_STDPERIPH_DRIVER)
-/**
- * @brief Comment the line below if you will not use the peripherals drivers.
-   In this case, these drivers will not be included and the application code will 
-   be based on direct access to peripherals registers 
-   */
-  /*#define USE_STDPERIPH_DRIVER */
-#endif /* USE_STDPERIPH_DRIVER */
-
-/**
- * @brief In the following line adjust the value of External High Speed oscillator (HSE)
-   used in your application 
-   
-   Tip: To avoid modifying this file each time you need to use different HSE, you
-        can define the HSE value in your toolchain compiler preprocessor.
-  */           
-
-#if !defined  (HSE_VALUE) 
-  #define HSE_VALUE    ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */
-#endif /* HSE_VALUE */
-
-/**
- * @brief In the following line adjust the External High Speed oscillator (HSE) Startup 
-   Timeout value 
-   */
-#if !defined  (HSE_STARTUP_TIMEOUT) 
-  #define HSE_STARTUP_TIMEOUT    ((uint16_t)0x0500)   /*!< Time out for HSE start up */
-#endif /* HSE_STARTUP_TIMEOUT */   
-
-#if !defined  (HSI_VALUE)   
-  #define HSI_VALUE    ((uint32_t)16000000) /*!< Value of the Internal oscillator in Hz*/
-#endif /* HSI_VALUE */   
-
-/**
- * @brief STM32F4XX Standard Peripherals Library version number V1.1.0
-   */
-#define __STM32F4XX_STDPERIPH_VERSION_MAIN   (0x01) /*!< [31:24] main version */                                  
-#define __STM32F4XX_STDPERIPH_VERSION_SUB1   (0x01) /*!< [23:16] sub1 version */
-#define __STM32F4XX_STDPERIPH_VERSION_SUB2   (0x00) /*!< [15:8]  sub2 version */
-#define __STM32F4XX_STDPERIPH_VERSION_RC     (0x00) /*!< [7:0]  release candidate */ 
-#define __STM32F4XX_STDPERIPH_VERSION        ((__STM32F4XX_STDPERIPH_VERSION_MAIN << 24)\
-                                             |(__STM32F4XX_STDPERIPH_VERSION_SUB1 << 16)\
-                                             |(__STM32F4XX_STDPERIPH_VERSION_SUB2 << 8)\
-                                             |(__STM32F4XX_STDPERIPH_VERSION_RC))
-                                             
-/**
-  * @}
-  */
-
-/** @addtogroup Configuration_section_for_CMSIS
-  * @{
-  */
-
-/**
- * @brief Configuration of the Cortex-M4 Processor and Core Peripherals 
- */
-#define __CM4_REV                 0x0001  /*!< Core revision r0p1                            */
-#define __MPU_PRESENT             1       /*!< STM32F4XX provides an MPU                     */
-#define __NVIC_PRIO_BITS          4       /*!< STM32F4XX uses 4 Bits for the Priority Levels */
-#define __Vendor_SysTickConfig    0       /*!< Set to 1 if different SysTick Config is used  */
-#define __FPU_PRESENT             1       /*!< FPU present                                   */
-
-/**
- * @brief STM32F4XX Interrupt Number Definition, according to the selected device 
- *        in @ref Library_configuration_section 
- */
-typedef enum IRQn
-{
-/******  Cortex-M4 Processor Exceptions Numbers ****************************************************************/
-  NonMaskableInt_IRQn         = -14,    /*!< 2 Non Maskable Interrupt                                          */
-  MemoryManagement_IRQn       = -12,    /*!< 4 Cortex-M4 Memory Management Interrupt                           */
-  BusFault_IRQn               = -11,    /*!< 5 Cortex-M4 Bus Fault Interrupt                                   */
-  UsageFault_IRQn             = -10,    /*!< 6 Cortex-M4 Usage Fault Interrupt                                 */
-  SVCall_IRQn                 = -5,     /*!< 11 Cortex-M4 SV Call Interrupt                                    */
-  DebugMonitor_IRQn           = -4,     /*!< 12 Cortex-M4 Debug Monitor Interrupt                              */
-  PendSV_IRQn                 = -2,     /*!< 14 Cortex-M4 Pend SV Interrupt                                    */
-  SysTick_IRQn                = -1,     /*!< 15 Cortex-M4 System Tick Interrupt                                */
-/******  STM32 specific Interrupt Numbers **********************************************************************/
-  WWDG_IRQn                   = 0,      /*!< Window WatchDog Interrupt                                         */
-  PVD_IRQn                    = 1,      /*!< PVD through EXTI Line detection Interrupt                         */
-  TAMP_STAMP_IRQn             = 2,      /*!< Tamper and TimeStamp interrupts through the EXTI line             */
-  RTC_WKUP_IRQn               = 3,      /*!< RTC Wakeup interrupt through the EXTI line                        */
-  FLASH_IRQn                  = 4,      /*!< FLASH global Interrupt                                            */
-  RCC_IRQn                    = 5,      /*!< RCC global Interrupt                                              */
-  EXTI0_IRQn                  = 6,      /*!< EXTI Line0 Interrupt                                              */
-  EXTI1_IRQn                  = 7,      /*!< EXTI Line1 Interrupt                                              */
-  EXTI2_IRQn                  = 8,      /*!< EXTI Line2 Interrupt                                              */
-  EXTI3_IRQn                  = 9,      /*!< EXTI Line3 Interrupt                                              */
-  EXTI4_IRQn                  = 10,     /*!< EXTI Line4 Interrupt                                              */
-  DMA1_Stream0_IRQn           = 11,     /*!< DMA1 Stream 0 global Interrupt                                    */
-  DMA1_Stream1_IRQn           = 12,     /*!< DMA1 Stream 1 global Interrupt                                    */
-  DMA1_Stream2_IRQn           = 13,     /*!< DMA1 Stream 2 global Interrupt                                    */
-  DMA1_Stream3_IRQn           = 14,     /*!< DMA1 Stream 3 global Interrupt                                    */
-  DMA1_Stream4_IRQn           = 15,     /*!< DMA1 Stream 4 global Interrupt                                    */
-  DMA1_Stream5_IRQn           = 16,     /*!< DMA1 Stream 5 global Interrupt                                    */
-  DMA1_Stream6_IRQn           = 17,     /*!< DMA1 Stream 6 global Interrupt                                    */
-  ADC_IRQn                    = 18,     /*!< ADC1, ADC2 and ADC3 global Interrupts                             */
-  CAN1_TX_IRQn                = 19,     /*!< CAN1 TX Interrupt                                                 */
-  CAN1_RX0_IRQn               = 20,     /*!< CAN1 RX0 Interrupt                                                */
-  CAN1_RX1_IRQn               = 21,     /*!< CAN1 RX1 Interrupt                                                */
-  CAN1_SCE_IRQn               = 22,     /*!< CAN1 SCE Interrupt                                                */
-  EXTI9_5_IRQn                = 23,     /*!< External Line[9:5] Interrupts                                     */
-  TIM1_BRK_TIM9_IRQn          = 24,     /*!< TIM1 Break interrupt and TIM9 global interrupt                    */
-  TIM1_UP_TIM10_IRQn          = 25,     /*!< TIM1 Update Interrupt and TIM10 global interrupt                  */
-  TIM1_TRG_COM_TIM11_IRQn     = 26,     /*!< TIM1 Trigger and Commutation Interrupt and TIM11 global interrupt */
-  TIM1_CC_IRQn                = 27,     /*!< TIM1 Capture Compare Interrupt                                    */
-  TIM2_IRQn                   = 28,     /*!< TIM2 global Interrupt                                             */
-  TIM3_IRQn                   = 29,     /*!< TIM3 global Interrupt                                             */
-  TIM4_IRQn                   = 30,     /*!< TIM4 global Interrupt                                             */
-  I2C1_EV_IRQn                = 31,     /*!< I2C1 Event Interrupt                                              */
-  I2C1_ER_IRQn                = 32,     /*!< I2C1 Error Interrupt                                              */
-  I2C2_EV_IRQn                = 33,     /*!< I2C2 Event Interrupt                                              */
-  I2C2_ER_IRQn                = 34,     /*!< I2C2 Error Interrupt                                              */  
-  SPI1_IRQn                   = 35,     /*!< SPI1 global Interrupt                                             */
-  SPI2_IRQn                   = 36,     /*!< SPI2 global Interrupt                                             */
-  USART1_IRQn                 = 37,     /*!< USART1 global Interrupt                                           */
-  USART2_IRQn                 = 38,     /*!< USART2 global Interrupt                                           */
-  USART3_IRQn                 = 39,     /*!< USART3 global Interrupt                                           */
-  EXTI15_10_IRQn              = 40,     /*!< External Line[15:10] Interrupts                                   */
-  RTC_Alarm_IRQn              = 41,     /*!< RTC Alarm (A and B) through EXTI Line Interrupt                   */
-  OTG_FS_WKUP_IRQn            = 42,     /*!< USB OTG FS Wakeup through EXTI line interrupt                     */    
-  TIM8_BRK_TIM12_IRQn         = 43,     /*!< TIM8 Break Interrupt and TIM12 global interrupt                   */
-  TIM8_UP_TIM13_IRQn          = 44,     /*!< TIM8 Update Interrupt and TIM13 global interrupt                  */
-  TIM8_TRG_COM_TIM14_IRQn     = 45,     /*!< TIM8 Trigger and Commutation Interrupt and TIM14 global interrupt */
-  TIM8_CC_IRQn                = 46,     /*!< TIM8 Capture Compare Interrupt                                    */
-  DMA1_Stream7_IRQn           = 47,     /*!< DMA1 Stream7 Interrupt                                            */
-  FSMC_IRQn                   = 48,     /*!< FSMC global Interrupt                                             */
-  SDIO_IRQn                   = 49,     /*!< SDIO global Interrupt                                             */
-  TIM5_IRQn                   = 50,     /*!< TIM5 global Interrupt                                             */
-  SPI3_IRQn                   = 51,     /*!< SPI3 global Interrupt                                             */
-  UART4_IRQn                  = 52,     /*!< UART4 global Interrupt                                            */
-  UART5_IRQn                  = 53,     /*!< UART5 global Interrupt                                            */
-  TIM6_DAC_IRQn               = 54,     /*!< TIM6 global and DAC1&2 underrun error  interrupts                 */
-  TIM7_IRQn                   = 55,     /*!< TIM7 global interrupt                                             */
-  DMA2_Stream0_IRQn           = 56,     /*!< DMA2 Stream 0 global Interrupt                                    */
-  DMA2_Stream1_IRQn           = 57,     /*!< DMA2 Stream 1 global Interrupt                                    */
-  DMA2_Stream2_IRQn           = 58,     /*!< DMA2 Stream 2 global Interrupt                                    */
-  DMA2_Stream3_IRQn           = 59,     /*!< DMA2 Stream 3 global Interrupt                                    */
-  DMA2_Stream4_IRQn           = 60,     /*!< DMA2 Stream 4 global Interrupt                                    */
-  ETH_IRQn                    = 61,     /*!< Ethernet global Interrupt                                         */
-  ETH_WKUP_IRQn               = 62,     /*!< Ethernet Wakeup through EXTI line Interrupt                       */
-  CAN2_TX_IRQn                = 63,     /*!< CAN2 TX Interrupt                                                 */
-  CAN2_RX0_IRQn               = 64,     /*!< CAN2 RX0 Interrupt                                                */
-  CAN2_RX1_IRQn               = 65,     /*!< CAN2 RX1 Interrupt                                                */
-  CAN2_SCE_IRQn               = 66,     /*!< CAN2 SCE Interrupt                                                */
-  OTG_FS_IRQn                 = 67,     /*!< USB OTG FS global Interrupt                                       */
-  DMA2_Stream5_IRQn           = 68,     /*!< DMA2 Stream 5 global interrupt                                    */
-  DMA2_Stream6_IRQn           = 69,     /*!< DMA2 Stream 6 global interrupt                                    */
-  DMA2_Stream7_IRQn           = 70,     /*!< DMA2 Stream 7 global interrupt                                    */
-  USART6_IRQn                 = 71,     /*!< USART6 global interrupt                                           */
-  I2C3_EV_IRQn                = 72,     /*!< I2C3 event interrupt                                              */
-  I2C3_ER_IRQn                = 73,     /*!< I2C3 error interrupt                                              */
-  OTG_HS_EP1_OUT_IRQn         = 74,     /*!< USB OTG HS End Point 1 Out global interrupt                       */
-  OTG_HS_EP1_IN_IRQn          = 75,     /*!< USB OTG HS End Point 1 In global interrupt                        */
-  OTG_HS_WKUP_IRQn            = 76,     /*!< USB OTG HS Wakeup through EXTI interrupt                          */
-  OTG_HS_IRQn                 = 77,     /*!< USB OTG HS global interrupt                                       */
-  DCMI_IRQn                   = 78,     /*!< DCMI global interrupt                                             */
-  CRYP_IRQn                   = 79,     /*!< CRYP crypto global interrupt                                      */
-  HASH_RNG_IRQn               = 80,     /*!< Hash and Rng global interrupt                                     */
-
-#ifdef STM32F40XX
-  FPU_IRQn                    = 81      /*!< FPU global interrupt                                              */
-#endif /* STM32F40XX */
-
-#ifdef STM32F427X 
-  FPU_IRQn                    = 81,     /*!< FPU global interrupt                                              */
-  UART7_IRQn                  = 82,     /*!< UART7 global interrupt                                            */
-  UART8_IRQn                  = 83,     /*!< UART8 global interrupt                                            */
-  SPI4_IRQn                   = 84,     /*!< SPI4 global Interrupt                                             */
-  SPI5_IRQn                   = 85,     /*!< SPI5 global Interrupt                                             */
-  SPI6_IRQn                   = 86      /*!< SPI6 global Interrupt                                             */
-#endif /* STM32F427X */
- 
-} IRQn_Type;
-
-/**
-  * @}
-  */
-
-#include "core_cm4.h"             /* Cortex-M4 processor and core peripherals */
-#include "system_stm32f4xx.h"
-#include <stdint.h>
-
-/** @addtogroup Exported_types
-  * @{
-  */  
-/*!< STM32F10x Standard Peripheral Library old types (maintained for legacy purpose) */
-typedef int32_t  s32;
-typedef int16_t s16;
-typedef int8_t  s8;
-
-typedef const int32_t sc32;  /*!< Read Only */
-typedef const int16_t sc16;  /*!< Read Only */
-typedef const int8_t sc8;   /*!< Read Only */
-
-typedef __IO int32_t  vs32;
-typedef __IO int16_t  vs16;
-typedef __IO int8_t   vs8;
-
-typedef __I int32_t vsc32;  /*!< Read Only */
-typedef __I int16_t vsc16;  /*!< Read Only */
-typedef __I int8_t vsc8;   /*!< Read Only */
-
-typedef uint32_t  u32;
-typedef uint16_t u16;
-typedef uint8_t  u8;
-
-typedef const uint32_t uc32;  /*!< Read Only */
-typedef const uint16_t uc16;  /*!< Read Only */
-typedef const uint8_t uc8;   /*!< Read Only */
-
-typedef __IO uint32_t  vu32;
-typedef __IO uint16_t vu16;
-typedef __IO uint8_t  vu8;
-
-typedef __I uint32_t vuc32;  /*!< Read Only */
-typedef __I uint16_t vuc16;  /*!< Read Only */
-typedef __I uint8_t vuc8;   /*!< Read Only */
-
-typedef enum {RESET = 0, SET = !RESET} FlagStatus, ITStatus;
-
-typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
-#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
-
-typedef enum {ERROR = 0, SUCCESS = !ERROR} ErrorStatus;
-
-/**
-  * @}
-  */
-
-/** @addtogroup Peripheral_registers_structures
-  * @{
-  */   
-
-/** 
-  * @brief Analog to Digital Converter  
-  */
-
-typedef struct
-{
-  __IO uint32_t SR;     /*!< ADC status register,                         Address offset: 0x00 */
-  __IO uint32_t CR1;    /*!< ADC control register 1,                      Address offset: 0x04 */      
-  __IO uint32_t CR2;    /*!< ADC control register 2,                      Address offset: 0x08 */
-  __IO uint32_t SMPR1;  /*!< ADC sample time register 1,                  Address offset: 0x0C */
-  __IO uint32_t SMPR2;  /*!< ADC sample time register 2,                  Address offset: 0x10 */
-  __IO uint32_t JOFR1;  /*!< ADC injected channel data offset register 1, Address offset: 0x14 */
-  __IO uint32_t JOFR2;  /*!< ADC injected channel data offset register 2, Address offset: 0x18 */
-  __IO uint32_t JOFR3;  /*!< ADC injected channel data offset register 3, Address offset: 0x1C */
-  __IO uint32_t JOFR4;  /*!< ADC injected channel data offset register 4, Address offset: 0x20 */
-  __IO uint32_t HTR;    /*!< ADC watchdog higher threshold register,      Address offset: 0x24 */
-  __IO uint32_t LTR;    /*!< ADC watchdog lower threshold register,       Address offset: 0x28 */
-  __IO uint32_t SQR1;   /*!< ADC regular sequence register 1,             Address offset: 0x2C */
-  __IO uint32_t SQR2;   /*!< ADC regular sequence register 2,             Address offset: 0x30 */
-  __IO uint32_t SQR3;   /*!< ADC regular sequence register 3,             Address offset: 0x34 */
-  __IO uint32_t JSQR;   /*!< ADC injected sequence register,              Address offset: 0x38*/
-  __IO uint32_t JDR1;   /*!< ADC injected data register 1,                Address offset: 0x3C */
-  __IO uint32_t JDR2;   /*!< ADC injected data register 2,                Address offset: 0x40 */
-  __IO uint32_t JDR3;   /*!< ADC injected data register 3,                Address offset: 0x44 */
-  __IO uint32_t JDR4;   /*!< ADC injected data register 4,                Address offset: 0x48 */
-  __IO uint32_t DR;     /*!< ADC regular data register,                   Address offset: 0x4C */
-} ADC_TypeDef;
-
-typedef struct
-{
-  __IO uint32_t CSR;    /*!< ADC Common status register,                  Address offset: ADC1 base address + 0x300 */
-  __IO uint32_t CCR;    /*!< ADC common control register,                 Address offset: ADC1 base address + 0x304 */
-  __IO uint32_t CDR;    /*!< ADC common regular data register for dual
-                             AND triple modes,                            Address offset: ADC1 base address + 0x308 */
-} ADC_Common_TypeDef;
-
-
-/** 
-  * @brief Controller Area Network TxMailBox 
-  */
-
-typedef struct
-{
-  __IO uint32_t TIR;  /*!< CAN TX mailbox identifier register */
-  __IO uint32_t TDTR; /*!< CAN mailbox data length control and time stamp register */
-  __IO uint32_t TDLR; /*!< CAN mailbox data low register */
-  __IO uint32_t TDHR; /*!< CAN mailbox data high register */
-} CAN_TxMailBox_TypeDef;
-
-/** 
-  * @brief Controller Area Network FIFOMailBox 
-  */
-  
-typedef struct
-{
-  __IO uint32_t RIR;  /*!< CAN receive FIFO mailbox identifier register */
-  __IO uint32_t RDTR; /*!< CAN receive FIFO mailbox data length control and time stamp register */
-  __IO uint32_t RDLR; /*!< CAN receive FIFO mailbox data low register */
-  __IO uint32_t RDHR; /*!< CAN receive FIFO mailbox data high register */
-} CAN_FIFOMailBox_TypeDef;
-
-/** 
-  * @brief Controller Area Network FilterRegister 
-  */
-  
-typedef struct
-{
-  __IO uint32_t FR1; /*!< CAN Filter bank register 1 */
-  __IO uint32_t FR2; /*!< CAN Filter bank register 1 */
-} CAN_FilterRegister_TypeDef;
-
-/** 
-  * @brief Controller Area Network 
-  */
-  
-typedef struct
-{
-  __IO uint32_t              MCR;                 /*!< CAN master control register,         Address offset: 0x00          */
-  __IO uint32_t              MSR;                 /*!< CAN master status register,          Address offset: 0x04          */
-  __IO uint32_t              TSR;                 /*!< CAN transmit status register,        Address offset: 0x08          */
-  __IO uint32_t              RF0R;                /*!< CAN receive FIFO 0 register,         Address offset: 0x0C          */
-  __IO uint32_t              RF1R;                /*!< CAN receive FIFO 1 register,         Address offset: 0x10          */
-  __IO uint32_t              IER;                 /*!< CAN interrupt enable register,       Address offset: 0x14          */
-  __IO uint32_t              ESR;                 /*!< CAN error status register,           Address offset: 0x18          */
-  __IO uint32_t              BTR;                 /*!< CAN bit timing register,             Address offset: 0x1C          */
-  uint32_t                   RESERVED0[88];       /*!< Reserved, 0x020 - 0x17F                                            */
-  CAN_TxMailBox_TypeDef      sTxMailBox[3];       /*!< CAN Tx MailBox,                      Address offset: 0x180 - 0x1AC */
-  CAN_FIFOMailBox_TypeDef    sFIFOMailBox[2];     /*!< CAN FIFO MailBox,                    Address offset: 0x1B0 - 0x1CC */
-  uint32_t                   RESERVED1[12];       /*!< Reserved, 0x1D0 - 0x1FF                                            */
-  __IO uint32_t              FMR;                 /*!< CAN filter master register,          Address offset: 0x200         */
-  __IO uint32_t              FM1R;                /*!< CAN filter mode register,            Address offset: 0x204         */
-  uint32_t                   RESERVED2;           /*!< Reserved, 0x208                                                    */
-  __IO uint32_t              FS1R;                /*!< CAN filter scale register,           Address offset: 0x20C         */
-  uint32_t                   RESERVED3;           /*!< Reserved, 0x210                                                    */
-  __IO uint32_t              FFA1R;               /*!< CAN filter FIFO assignment register, Address offset: 0x214         */
-  uint32_t                   RESERVED4;           /*!< Reserved, 0x218                                                    */
-  __IO uint32_t              FA1R;                /*!< CAN filter activation register,      Address offset: 0x21C         */
-  uint32_t                   RESERVED5[8];        /*!< Reserved, 0x220-0x23F                                              */ 
-  CAN_FilterRegister_TypeDef sFilterRegister[28]; /*!< CAN Filter Register,                 Address offset: 0x240-0x31C   */
-} CAN_TypeDef;
-
-/** 
-  * @brief CRC calculation unit 
-  */
-
-typedef struct
-{
-  __IO uint32_t DR;         /*!< CRC Data register,             Address offset: 0x00 */
-  __IO uint8_t  IDR;        /*!< CRC Independent data register, Address offset: 0x04 */
-  uint8_t       RESERVED0;  /*!< Reserved, 0x05                                      */
-  uint16_t      RESERVED1;  /*!< Reserved, 0x06                                      */
-  __IO uint32_t CR;         /*!< CRC Control register,          Address offset: 0x08 */
-} CRC_TypeDef;
-
-/** 
-  * @brief Digital to Analog Converter
-  */
-
-typedef struct
-{
-  __IO uint32_t CR;       /*!< DAC control register,                                    Address offset: 0x00 */
-  __IO uint32_t SWTRIGR;  /*!< DAC software trigger register,                           Address offset: 0x04 */
-  __IO uint32_t DHR12R1;  /*!< DAC channel1 12-bit right-aligned data holding register, Address offset: 0x08 */
-  __IO uint32_t DHR12L1;  /*!< DAC channel1 12-bit left aligned data holding register,  Address offset: 0x0C */
-  __IO uint32_t DHR8R1;   /*!< DAC channel1 8-bit right aligned data holding register,  Address offset: 0x10 */
-  __IO uint32_t DHR12R2;  /*!< DAC channel2 12-bit right aligned data holding register, Address offset: 0x14 */
-  __IO uint32_t DHR12L2;  /*!< DAC channel2 12-bit left aligned data holding register,  Address offset: 0x18 */
-  __IO uint32_t DHR8R2;   /*!< DAC channel2 8-bit right-aligned data holding register,  Address offset: 0x1C */
-  __IO uint32_t DHR12RD;  /*!< Dual DAC 12-bit right-aligned data holding register,     Address offset: 0x20 */
-  __IO uint32_t DHR12LD;  /*!< DUAL DAC 12-bit left aligned data holding register,      Address offset: 0x24 */
-  __IO uint32_t DHR8RD;   /*!< DUAL DAC 8-bit right aligned data holding register,      Address offset: 0x28 */
-  __IO uint32_t DOR1;     /*!< DAC channel1 data output register,                       Address offset: 0x2C */
-  __IO uint32_t DOR2;     /*!< DAC channel2 data output register,                       Address offset: 0x30 */
-  __IO uint32_t SR;       /*!< DAC status register,                                     Address offset: 0x34 */
-} DAC_TypeDef;
-
-/** 
-  * @brief Debug MCU
-  */
-
-typedef struct
-{
-  __IO uint32_t IDCODE;  /*!< MCU device ID code,               Address offset: 0x00 */
-  __IO uint32_t CR;      /*!< Debug MCU configuration register, Address offset: 0x04 */
-  __IO uint32_t APB1FZ;  /*!< Debug MCU APB1 freeze register,   Address offset: 0x08 */
-  __IO uint32_t APB2FZ;  /*!< Debug MCU APB2 freeze register,   Address offset: 0x0C */
-}DBGMCU_TypeDef;
-
-/** 
-  * @brief DCMI
-  */
-
-typedef struct
-{
-  __IO uint32_t CR;       /*!< DCMI control register 1,                       Address offset: 0x00 */
-  __IO uint32_t SR;       /*!< DCMI status register,                          Address offset: 0x04 */
-  __IO uint32_t RISR;     /*!< DCMI raw interrupt status register,            Address offset: 0x08 */
-  __IO uint32_t IER;      /*!< DCMI interrupt enable register,                Address offset: 0x0C */
-  __IO uint32_t MISR;     /*!< DCMI masked interrupt status register,         Address offset: 0x10 */
-  __IO uint32_t ICR;      /*!< DCMI interrupt clear register,                 Address offset: 0x14 */
-  __IO uint32_t ESCR;     /*!< DCMI embedded synchronization code register,   Address offset: 0x18 */
-  __IO uint32_t ESUR;     /*!< DCMI embedded synchronization unmask register, Address offset: 0x1C */
-  __IO uint32_t CWSTRTR;  /*!< DCMI crop window start,                        Address offset: 0x20 */
-  __IO uint32_t CWSIZER;  /*!< DCMI crop window size,                         Address offset: 0x24 */
-  __IO uint32_t DR;       /*!< DCMI data register,                            Address offset: 0x28 */
-} DCMI_TypeDef;
-
-/** 
-  * @brief DMA Controller
-  */
-
-typedef struct
-{
-  __IO uint32_t CR;     /*!< DMA stream x configuration register      */
-  __IO uint32_t NDTR;   /*!< DMA stream x number of data register     */
-  __IO uint32_t PAR;    /*!< DMA stream x peripheral address register */
-  __IO uint32_t M0AR;   /*!< DMA stream x memory 0 address register   */
-  __IO uint32_t M1AR;   /*!< DMA stream x memory 1 address register   */
-  __IO uint32_t FCR;    /*!< DMA stream x FIFO control register       */
-} DMA_Stream_TypeDef;
-
-typedef struct
-{
-  __IO uint32_t LISR;   /*!< DMA low interrupt status register,      Address offset: 0x00 */
-  __IO uint32_t HISR;   /*!< DMA high interrupt status register,     Address offset: 0x04 */
-  __IO uint32_t LIFCR;  /*!< DMA low interrupt flag clear register,  Address offset: 0x08 */
-  __IO uint32_t HIFCR;  /*!< DMA high interrupt flag clear register, Address offset: 0x0C */
-} DMA_TypeDef;
-
-/** 
-  * @brief Ethernet MAC
-  */
-
-typedef struct
-{
-  __IO uint32_t MACCR;
-  __IO uint32_t MACFFR;
-  __IO uint32_t MACHTHR;
-  __IO uint32_t MACHTLR;
-  __IO uint32_t MACMIIAR;
-  __IO uint32_t MACMIIDR;
-  __IO uint32_t MACFCR;
-  __IO uint32_t MACVLANTR;             /*    8 */
-  uint32_t      RESERVED0[2];
-  __IO uint32_t MACRWUFFR;             /*   11 */
-  __IO uint32_t MACPMTCSR;
-  uint32_t      RESERVED1[2];
-  __IO uint32_t MACSR;                 /*   15 */
-  __IO uint32_t MACIMR;
-  __IO uint32_t MACA0HR;
-  __IO uint32_t MACA0LR;
-  __IO uint32_t MACA1HR;
-  __IO uint32_t MACA1LR;
-  __IO uint32_t MACA2HR;
-  __IO uint32_t MACA2LR;
-  __IO uint32_t MACA3HR;
-  __IO uint32_t MACA3LR;               /*   24 */
-  uint32_t      RESERVED2[40];
-  __IO uint32_t MMCCR;                 /*   65 */
-  __IO uint32_t MMCRIR;
-  __IO uint32_t MMCTIR;
-  __IO uint32_t MMCRIMR;
-  __IO uint32_t MMCTIMR;               /*   69 */
-  uint32_t      RESERVED3[14];
-  __IO uint32_t MMCTGFSCCR;            /*   84 */
-  __IO uint32_t MMCTGFMSCCR;
-  uint32_t      RESERVED4[5];
-  __IO uint32_t MMCTGFCR;
-  uint32_t      RESERVED5[10];
-  __IO uint32_t MMCRFCECR;
-  __IO uint32_t MMCRFAECR;
-  uint32_t      RESERVED6[10];
-  __IO uint32_t MMCRGUFCR;
-  uint32_t      RESERVED7[334];
-  __IO uint32_t PTPTSCR;
-  __IO uint32_t PTPSSIR;
-  __IO uint32_t PTPTSHR;
-  __IO uint32_t PTPTSLR;
-  __IO uint32_t PTPTSHUR;
-  __IO uint32_t PTPTSLUR;
-  __IO uint32_t PTPTSAR;
-  __IO uint32_t PTPTTHR;
-  __IO uint32_t PTPTTLR;
-  __IO uint32_t RESERVED8;
-  __IO uint32_t PTPTSSR;
-  uint32_t      RESERVED9[565];
-  __IO uint32_t DMABMR;
-  __IO uint32_t DMATPDR;
-  __IO uint32_t DMARPDR;
-  __IO uint32_t DMARDLAR;
-  __IO uint32_t DMATDLAR;
-  __IO uint32_t DMASR;
-  __IO uint32_t DMAOMR;
-  __IO uint32_t DMAIER;
-  __IO uint32_t DMAMFBOCR;
-  __IO uint32_t DMARSWTR;
-  uint32_t      RESERVED10[8];
-  __IO uint32_t DMACHTDR;
-  __IO uint32_t DMACHRDR;
-  __IO uint32_t DMACHTBAR;
-  __IO uint32_t DMACHRBAR;
-} ETH_TypeDef;
-
-/** 
-  * @brief External Interrupt/Event Controller
-  */
-
-typedef struct
-{
-  __IO uint32_t IMR;    /*!< EXTI Interrupt mask register,            Address offset: 0x00 */
-  __IO uint32_t EMR;    /*!< EXTI Event mask register,                Address offset: 0x04 */
-  __IO uint32_t RTSR;   /*!< EXTI Rising trigger selection register,  Address offset: 0x08 */
-  __IO uint32_t FTSR;   /*!< EXTI Falling trigger selection register, Address offset: 0x0C */
-  __IO uint32_t SWIER;  /*!< EXTI Software interrupt event register,  Address offset: 0x10 */
-  __IO uint32_t PR;     /*!< EXTI Pending register,                   Address offset: 0x14 */
-} EXTI_TypeDef;
-
-/** 
-  * @brief FLASH Registers
-  */
-
-typedef struct
-{
-  __IO uint32_t ACR;      /*!< FLASH access control register,   Address offset: 0x00 */
-  __IO uint32_t KEYR;     /*!< FLASH key register,              Address offset: 0x04 */
-  __IO uint32_t OPTKEYR;  /*!< FLASH option key register,       Address offset: 0x08 */
-  __IO uint32_t SR;       /*!< FLASH status register,           Address offset: 0x0C */
-  __IO uint32_t CR;       /*!< FLASH control register,          Address offset: 0x10 */
-  __IO uint32_t OPTCR;    /*!< FLASH option control register ,  Address offset: 0x14 */
-  __IO uint32_t OPTCR1;   /*!< FLASH option control register 1, Address offset: 0x18 */
-} FLASH_TypeDef;
-
-/** 
-  * @brief Flexible Static Memory Controller
-  */
-
-typedef struct
-{
-  __IO uint32_t BTCR[8];    /*!< NOR/PSRAM chip-select control register(BCR) and chip-select timing register(BTR), Address offset: 0x00-1C */   
-} FSMC_Bank1_TypeDef; 
-
-/** 
-  * @brief Flexible Static Memory Controller Bank1E
-  */
-  
-typedef struct
-{
-  __IO uint32_t BWTR[7];    /*!< NOR/PSRAM write timing registers, Address offset: 0x104-0x11C */
-} FSMC_Bank1E_TypeDef;
-
-/** 
-  * @brief Flexible Static Memory Controller Bank2
-  */
-  
-typedef struct
-{
-  __IO uint32_t PCR2;       /*!< NAND Flash control register 2,                       Address offset: 0x60 */
-  __IO uint32_t SR2;        /*!< NAND Flash FIFO status and interrupt register 2,     Address offset: 0x64 */
-  __IO uint32_t PMEM2;      /*!< NAND Flash Common memory space timing register 2,    Address offset: 0x68 */
-  __IO uint32_t PATT2;      /*!< NAND Flash Attribute memory space timing register 2, Address offset: 0x6C */
-  uint32_t      RESERVED0;  /*!< Reserved, 0x70                                                            */
-  __IO uint32_t ECCR2;      /*!< NAND Flash ECC result registers 2,                   Address offset: 0x74 */
-} FSMC_Bank2_TypeDef;
-
-/** 
-  * @brief Flexible Static Memory Controller Bank3
-  */
-  
-typedef struct
-{
-  __IO uint32_t PCR3;       /*!< NAND Flash control register 3,                       Address offset: 0x80 */
-  __IO uint32_t SR3;        /*!< NAND Flash FIFO status and interrupt register 3,     Address offset: 0x84 */
-  __IO uint32_t PMEM3;      /*!< NAND Flash Common memory space timing register 3,    Address offset: 0x88 */
-  __IO uint32_t PATT3;      /*!< NAND Flash Attribute memory space timing register 3, Address offset: 0x8C */
-  uint32_t      RESERVED0;  /*!< Reserved, 0x90                                                            */
-  __IO uint32_t ECCR3;      /*!< NAND Flash ECC result registers 3,                   Address offset: 0x94 */
-} FSMC_Bank3_TypeDef;
-
-/** 
-  * @brief Flexible Static Memory Controller Bank4
-  */
-  
-typedef struct
-{
-  __IO uint32_t PCR4;       /*!< PC Card  control register 4,                       Address offset: 0xA0 */
-  __IO uint32_t SR4;        /*!< PC Card  FIFO status and interrupt register 4,     Address offset: 0xA4 */
-  __IO uint32_t PMEM4;      /*!< PC Card  Common memory space timing register 4,    Address offset: 0xA8 */
-  __IO uint32_t PATT4;      /*!< PC Card  Attribute memory space timing register 4, Address offset: 0xAC */
-  __IO uint32_t PIO4;       /*!< PC Card  I/O space timing register 4,              Address offset: 0xB0 */
-} FSMC_Bank4_TypeDef; 
-
-/** 
-  * @brief General Purpose I/O
-  */
-
-typedef struct
-{
-  __IO uint32_t MODER;    /*!< GPIO port mode register,               Address offset: 0x00      */
-  __IO uint32_t OTYPER;   /*!< GPIO port output type register,        Address offset: 0x04      */
-  __IO uint32_t OSPEEDR;  /*!< GPIO port output speed register,       Address offset: 0x08      */
-  __IO uint32_t PUPDR;    /*!< GPIO port pull-up/pull-down register,  Address offset: 0x0C      */
-  __IO uint32_t IDR;      /*!< GPIO port input data register,         Address offset: 0x10      */
-  __IO uint32_t ODR;      /*!< GPIO port output data register,        Address offset: 0x14      */
-  __IO uint16_t BSRRL;    /*!< GPIO port bit set/reset low register,  Address offset: 0x18      */
-  __IO uint16_t BSRRH;    /*!< GPIO port bit set/reset high register, Address offset: 0x1A      */
-  __IO uint32_t LCKR;     /*!< GPIO port configuration lock register, Address offset: 0x1C      */
-  __IO uint32_t AFR[2];   /*!< GPIO alternate function registers,     Address offset: 0x20-0x24 */
-} GPIO_TypeDef;
-
-/** 
-  * @brief System configuration controller
-  */
-  
-typedef struct
-{
-  __IO uint32_t MEMRMP;       /*!< SYSCFG memory remap register,                      Address offset: 0x00      */
-  __IO uint32_t PMC;          /*!< SYSCFG peripheral mode configuration register,     Address offset: 0x04      */
-  __IO uint32_t EXTICR[4];    /*!< SYSCFG external interrupt configuration registers, Address offset: 0x08-0x14 */
-  uint32_t      RESERVED[2];  /*!< Reserved, 0x18-0x1C                                                          */ 
-  __IO uint32_t CMPCR;        /*!< SYSCFG Compensation cell control register,         Address offset: 0x20      */
-} SYSCFG_TypeDef;
-
-/** 
-  * @brief Inter-integrated Circuit Interface
-  */
-
-typedef struct
-{
-  __IO uint16_t CR1;        /*!< I2C Control register 1,     Address offset: 0x00 */
-  uint16_t      RESERVED0;  /*!< Reserved, 0x02                                   */
-  __IO uint16_t CR2;        /*!< I2C Control register 2,     Address offset: 0x04 */
-  uint16_t      RESERVED1;  /*!< Reserved, 0x06                                   */
-  __IO uint16_t OAR1;       /*!< I2C Own address register 1, Address offset: 0x08 */
-  uint16_t      RESERVED2;  /*!< Reserved, 0x0A                                   */
-  __IO uint16_t OAR2;       /*!< I2C Own address register 2, Address offset: 0x0C */
-  uint16_t      RESERVED3;  /*!< Reserved, 0x0E                                   */
-  __IO uint16_t DR;         /*!< I2C Data register,          Address offset: 0x10 */
-  uint16_t      RESERVED4;  /*!< Reserved, 0x12                                   */
-  __IO uint16_t SR1;        /*!< I2C Status register 1,      Address offset: 0x14 */
-  uint16_t      RESERVED5;  /*!< Reserved, 0x16                                   */
-  __IO uint16_t SR2;        /*!< I2C Status register 2,      Address offset: 0x18 */
-  uint16_t      RESERVED6;  /*!< Reserved, 0x1A                                   */
-  __IO uint16_t CCR;        /*!< I2C Clock control register, Address offset: 0x1C */
-  uint16_t      RESERVED7;  /*!< Reserved, 0x1E                                   */
-  __IO uint16_t TRISE;      /*!< I2C TRISE register,         Address offset: 0x20 */
-  uint16_t      RESERVED8;  /*!< Reserved, 0x22                                   */
-  __IO uint16_t FLTR;       /*!< I2C FLTR register,          Address offset: 0x24 */
-  uint16_t      RESERVED9;  /*!< Reserved, 0x26                                   */
-} I2C_TypeDef;
-
-/** 
-  * @brief Independent WATCHDOG
-  */
-
-typedef struct
-{
-  __IO uint32_t KR;   /*!< IWDG Key register,       Address offset: 0x00 */
-  __IO uint32_t PR;   /*!< IWDG Prescaler register, Address offset: 0x04 */
-  __IO uint32_t RLR;  /*!< IWDG Reload register,    Address offset: 0x08 */
-  __IO uint32_t SR;   /*!< IWDG Status register,    Address offset: 0x0C */
-} IWDG_TypeDef;
-
-/** 
-  * @brief Power Control
-  */
-
-typedef struct
-{
-  __IO uint32_t CR;   /*!< PWR power control register,        Address offset: 0x00 */
-  __IO uint32_t CSR;  /*!< PWR power control/status register, Address offset: 0x04 */
-} PWR_TypeDef;
-
-/** 
-  * @brief Reset and Clock Control
-  */
-
-typedef struct
-{
-  __IO uint32_t CR;            /*!< RCC clock control register,                                  Address offset: 0x00 */
-  __IO uint32_t PLLCFGR;       /*!< RCC PLL configuration register,                              Address offset: 0x04 */
-  __IO uint32_t CFGR;          /*!< RCC clock configuration register,                            Address offset: 0x08 */
-  __IO uint32_t CIR;           /*!< RCC clock interrupt register,                                Address offset: 0x0C */
-  __IO uint32_t AHB1RSTR;      /*!< RCC AHB1 peripheral reset register,                          Address offset: 0x10 */
-  __IO uint32_t AHB2RSTR;      /*!< RCC AHB2 peripheral reset register,                          Address offset: 0x14 */
-  __IO uint32_t AHB3RSTR;      /*!< RCC AHB3 peripheral reset register,                          Address offset: 0x18 */
-  uint32_t      RESERVED0;     /*!< Reserved, 0x1C                                                                    */
-  __IO uint32_t APB1RSTR;      /*!< RCC APB1 peripheral reset register,                          Address offset: 0x20 */
-  __IO uint32_t APB2RSTR;      /*!< RCC APB2 peripheral reset register,                          Address offset: 0x24 */
-  uint32_t      RESERVED1[2];  /*!< Reserved, 0x28-0x2C                                                               */
-  __IO uint32_t AHB1ENR;       /*!< RCC AHB1 peripheral clock register,                          Address offset: 0x30 */
-  __IO uint32_t AHB2ENR;       /*!< RCC AHB2 peripheral clock register,                          Address offset: 0x34 */
-  __IO uint32_t AHB3ENR;       /*!< RCC AHB3 peripheral clock register,                          Address offset: 0x38 */
-  uint32_t      RESERVED2;     /*!< Reserved, 0x3C                                                                    */
-  __IO uint32_t APB1ENR;       /*!< RCC APB1 peripheral clock enable register,                   Address offset: 0x40 */
-  __IO uint32_t APB2ENR;       /*!< RCC APB2 peripheral clock enable register,                   Address offset: 0x44 */
-  uint32_t      RESERVED3[2];  /*!< Reserved, 0x48-0x4C                                                               */
-  __IO uint32_t AHB1LPENR;     /*!< RCC AHB1 peripheral clock enable in low power mode register, Address offset: 0x50 */
-  __IO uint32_t AHB2LPENR;     /*!< RCC AHB2 peripheral clock enable in low power mode register, Address offset: 0x54 */
-  __IO uint32_t AHB3LPENR;     /*!< RCC AHB3 peripheral clock enable in low power mode register, Address offset: 0x58 */
-  uint32_t      RESERVED4;     /*!< Reserved, 0x5C                                                                    */
-  __IO uint32_t APB1LPENR;     /*!< RCC APB1 peripheral clock enable in low power mode register, Address offset: 0x60 */
-  __IO uint32_t APB2LPENR;     /*!< RCC APB2 peripheral clock enable in low power mode register, Address offset: 0x64 */
-  uint32_t      RESERVED5[2];  /*!< Reserved, 0x68-0x6C                                                               */
-  __IO uint32_t BDCR;          /*!< RCC Backup domain control register,                          Address offset: 0x70 */
-  __IO uint32_t CSR;           /*!< RCC clock control & status register,                         Address offset: 0x74 */
-  uint32_t      RESERVED6[2];  /*!< Reserved, 0x78-0x7C                                                               */
-  __IO uint32_t SSCGR;         /*!< RCC spread spectrum clock generation register,               Address offset: 0x80 */
-  __IO uint32_t PLLI2SCFGR;    /*!< RCC PLLI2S configuration register,                           Address offset: 0x84 */
-
-#ifdef STM32F427X  
-  uint32_t      RESERVED7;     /*!< Reserved, 0x88                                                                    */
-  __IO uint32_t DCKCFGR;       /*!< RCC Dedicated Clocks configuration register,                 Address offset: 0x8C */
-#endif /* STM32F427X */
-
-} RCC_TypeDef;
-
-/** 
-  * @brief Real-Time Clock
-  */
-
-typedef struct
-{
-  __IO uint32_t TR;      /*!< RTC time register,                                        Address offset: 0x00 */
-  __IO uint32_t DR;      /*!< RTC date register,                                        Address offset: 0x04 */
-  __IO uint32_t CR;      /*!< RTC control register,                                     Address offset: 0x08 */
-  __IO uint32_t ISR;     /*!< RTC initialization and status register,                   Address offset: 0x0C */
-  __IO uint32_t PRER;    /*!< RTC prescaler register,                                   Address offset: 0x10 */
-  __IO uint32_t WUTR;    /*!< RTC wakeup timer register,                                Address offset: 0x14 */
-  __IO uint32_t CALIBR;  /*!< RTC calibration register,                                 Address offset: 0x18 */
-  __IO uint32_t ALRMAR;  /*!< RTC alarm A register,                                     Address offset: 0x1C */
-  __IO uint32_t ALRMBR;  /*!< RTC alarm B register,                                     Address offset: 0x20 */
-  __IO uint32_t WPR;     /*!< RTC write protection register,                            Address offset: 0x24 */
-  __IO uint32_t SSR;     /*!< RTC sub second register,                                  Address offset: 0x28 */
-  __IO uint32_t SHIFTR;  /*!< RTC shift control register,                               Address offset: 0x2C */
-  __IO uint32_t TSTR;    /*!< RTC time stamp time register,                             Address offset: 0x30 */
-  __IO uint32_t TSDR;    /*!< RTC time stamp date register,                             Address offset: 0x34 */
-  __IO uint32_t TSSSR;   /*!< RTC time-stamp sub second register,                       Address offset: 0x38 */
-  __IO uint32_t CALR;    /*!< RTC calibration register,                                 Address offset: 0x3C */
-  __IO uint32_t TAFCR;   /*!< RTC tamper and alternate function configuration register, Address offset: 0x40 */
-  __IO uint32_t ALRMASSR;/*!< RTC alarm A sub second register,                          Address offset: 0x44 */
-  __IO uint32_t ALRMBSSR;/*!< RTC alarm B sub second register,                          Address offset: 0x48 */
-  uint32_t RESERVED7;    /*!< Reserved, 0x4C                                                                 */
-  __IO uint32_t BKP0R;   /*!< RTC backup register 1,                                    Address offset: 0x50 */
-  __IO uint32_t BKP1R;   /*!< RTC backup register 1,                                    Address offset: 0x54 */
-  __IO uint32_t BKP2R;   /*!< RTC backup register 2,                                    Address offset: 0x58 */
-  __IO uint32_t BKP3R;   /*!< RTC backup register 3,                                    Address offset: 0x5C */
-  __IO uint32_t BKP4R;   /*!< RTC backup register 4,                                    Address offset: 0x60 */
-  __IO uint32_t BKP5R;   /*!< RTC backup register 5,                                    Address offset: 0x64 */
-  __IO uint32_t BKP6R;   /*!< RTC backup register 6,                                    Address offset: 0x68 */
-  __IO uint32_t BKP7R;   /*!< RTC backup register 7,                                    Address offset: 0x6C */
-  __IO uint32_t BKP8R;   /*!< RTC backup register 8,                                    Address offset: 0x70 */
-  __IO uint32_t BKP9R;   /*!< RTC backup register 9,                                    Address offset: 0x74 */
-  __IO uint32_t BKP10R;  /*!< RTC backup register 10,                                   Address offset: 0x78 */
-  __IO uint32_t BKP11R;  /*!< RTC backup register 11,                                   Address offset: 0x7C */
-  __IO uint32_t BKP12R;  /*!< RTC backup register 12,                                   Address offset: 0x80 */
-  __IO uint32_t BKP13R;  /*!< RTC backup register 13,                                   Address offset: 0x84 */
-  __IO uint32_t BKP14R;  /*!< RTC backup register 14,                                   Address offset: 0x88 */
-  __IO uint32_t BKP15R;  /*!< RTC backup register 15,                                   Address offset: 0x8C */
-  __IO uint32_t BKP16R;  /*!< RTC backup register 16,                                   Address offset: 0x90 */
-  __IO uint32_t BKP17R;  /*!< RTC backup register 17,                                   Address offset: 0x94 */
-  __IO uint32_t BKP18R;  /*!< RTC backup register 18,                                   Address offset: 0x98 */
-  __IO uint32_t BKP19R;  /*!< RTC backup register 19,                                   Address offset: 0x9C */
-} RTC_TypeDef;
-
-/** 
-  * @brief SD host Interface
-  */
-
-typedef struct
-{
-  __IO uint32_t POWER;          /*!< SDIO power control register,    Address offset: 0x00 */
-  __IO uint32_t CLKCR;          /*!< SDI clock control register,     Address offset: 0x04 */
-  __IO uint32_t ARG;            /*!< SDIO argument register,         Address offset: 0x08 */
-  __IO uint32_t CMD;            /*!< SDIO command register,          Address offset: 0x0C */
-  __I uint32_t  RESPCMD;        /*!< SDIO command response register, Address offset: 0x10 */
-  __I uint32_t  RESP1;          /*!< SDIO response 1 register,       Address offset: 0x14 */
-  __I uint32_t  RESP2;          /*!< SDIO response 2 register,       Address offset: 0x18 */
-  __I uint32_t  RESP3;          /*!< SDIO response 3 register,       Address offset: 0x1C */
-  __I uint32_t  RESP4;          /*!< SDIO response 4 register,       Address offset: 0x20 */
-  __IO uint32_t DTIMER;         /*!< SDIO data timer register,       Address offset: 0x24 */
-  __IO uint32_t DLEN;           /*!< SDIO data length register,      Address offset: 0x28 */
-  __IO uint32_t DCTRL;          /*!< SDIO data control register,     Address offset: 0x2C */
-  __I uint32_t  DCOUNT;         /*!< SDIO data counter register,     Address offset: 0x30 */
-  __I uint32_t  STA;            /*!< SDIO status register,           Address offset: 0x34 */
-  __IO uint32_t ICR;            /*!< SDIO interrupt clear register,  Address offset: 0x38 */
-  __IO uint32_t MASK;           /*!< SDIO mask register,             Address offset: 0x3C */
-  uint32_t      RESERVED0[2];   /*!< Reserved, 0x40-0x44                                  */
-  __I uint32_t  FIFOCNT;        /*!< SDIO FIFO counter register,     Address offset: 0x48 */
-  uint32_t      RESERVED1[13];  /*!< Reserved, 0x4C-0x7C                                  */
-  __IO uint32_t FIFO;           /*!< SDIO data FIFO register,        Address offset: 0x80 */
-} SDIO_TypeDef;
-
-/** 
-  * @brief Serial Peripheral Interface
-  */
-
-typedef struct
-{
-  __IO uint16_t CR1;        /*!< SPI control register 1 (not used in I2S mode),      Address offset: 0x00 */
-  uint16_t      RESERVED0;  /*!< Reserved, 0x02                                                           */
-  __IO uint16_t CR2;        /*!< SPI control register 2,                             Address offset: 0x04 */
-  uint16_t      RESERVED1;  /*!< Reserved, 0x06                                                           */
-  __IO uint16_t SR;         /*!< SPI status register,                                Address offset: 0x08 */
-  uint16_t      RESERVED2;  /*!< Reserved, 0x0A                                                           */
-  __IO uint16_t DR;         /*!< SPI data register,                                  Address offset: 0x0C */
-  uint16_t      RESERVED3;  /*!< Reserved, 0x0E                                                           */
-  __IO uint16_t CRCPR;      /*!< SPI CRC polynomial register (not used in I2S mode), Address offset: 0x10 */
-  uint16_t      RESERVED4;  /*!< Reserved, 0x12                                                           */
-  __IO uint16_t RXCRCR;     /*!< SPI RX CRC register (not used in I2S mode),         Address offset: 0x14 */
-  uint16_t      RESERVED5;  /*!< Reserved, 0x16                                                           */
-  __IO uint16_t TXCRCR;     /*!< SPI TX CRC register (not used in I2S mode),         Address offset: 0x18 */
-  uint16_t      RESERVED6;  /*!< Reserved, 0x1A                                                           */
-  __IO uint16_t I2SCFGR;    /*!< SPI_I2S configuration register,                     Address offset: 0x1C */
-  uint16_t      RESERVED7;  /*!< Reserved, 0x1E                                                           */
-  __IO uint16_t I2SPR;      /*!< SPI_I2S prescaler register,                         Address offset: 0x20 */
-  uint16_t      RESERVED8;  /*!< Reserved, 0x22                                                           */
-} SPI_TypeDef;
-
-/** 
-  * @brief TIM
-  */
-
-typedef struct
-{
-  __IO uint16_t CR1;         /*!< TIM control register 1,              Address offset: 0x00 */
-  uint16_t      RESERVED0;   /*!< Reserved, 0x02                                            */
-  __IO uint16_t CR2;         /*!< TIM control register 2,              Address offset: 0x04 */
-  uint16_t      RESERVED1;   /*!< Reserved, 0x06                                            */
-  __IO uint16_t SMCR;        /*!< TIM slave mode control register,     Address offset: 0x08 */
-  uint16_t      RESERVED2;   /*!< Reserved, 0x0A                                            */
-  __IO uint16_t DIER;        /*!< TIM DMA/interrupt enable register,   Address offset: 0x0C */
-  uint16_t      RESERVED3;   /*!< Reserved, 0x0E                                            */
-  __IO uint16_t SR;          /*!< TIM status register,                 Address offset: 0x10 */
-  uint16_t      RESERVED4;   /*!< Reserved, 0x12                                            */
-  __IO uint16_t EGR;         /*!< TIM event generation register,       Address offset: 0x14 */
-  uint16_t      RESERVED5;   /*!< Reserved, 0x16                                            */
-  __IO uint16_t CCMR1;       /*!< TIM capture/compare mode register 1, Address offset: 0x18 */
-  uint16_t      RESERVED6;   /*!< Reserved, 0x1A                                            */
-  __IO uint16_t CCMR2;       /*!< TIM capture/compare mode register 2, Address offset: 0x1C */
-  uint16_t      RESERVED7;   /*!< Reserved, 0x1E                                            */
-  __IO uint16_t CCER;        /*!< TIM capture/compare enable register, Address offset: 0x20 */
-  uint16_t      RESERVED8;   /*!< Reserved, 0x22                                            */
-  __IO uint32_t CNT;         /*!< TIM counter register,                Address offset: 0x24 */
-  __IO uint16_t PSC;         /*!< TIM prescaler,                       Address offset: 0x28 */
-  uint16_t      RESERVED9;   /*!< Reserved, 0x2A                                            */
-  __IO uint32_t ARR;         /*!< TIM auto-reload register,            Address offset: 0x2C */
-  __IO uint16_t RCR;         /*!< TIM repetition counter register,     Address offset: 0x30 */
-  uint16_t      RESERVED10;  /*!< Reserved, 0x32                                            */
-  __IO uint32_t CCR1;        /*!< TIM capture/compare register 1,      Address offset: 0x34 */
-  __IO uint32_t CCR2;        /*!< TIM capture/compare register 2,      Address offset: 0x38 */
-  __IO uint32_t CCR3;        /*!< TIM capture/compare register 3,      Address offset: 0x3C */
-  __IO uint32_t CCR4;        /*!< TIM capture/compare register 4,      Address offset: 0x40 */
-  __IO uint16_t BDTR;        /*!< TIM break and dead-time register,    Address offset: 0x44 */
-  uint16_t      RESERVED11;  /*!< Reserved, 0x46                                            */
-  __IO uint16_t DCR;         /*!< TIM DMA control register,            Address offset: 0x48 */
-  uint16_t      RESERVED12;  /*!< Reserved, 0x4A                                            */
-  __IO uint16_t DMAR;        /*!< TIM DMA address for full transfer,   Address offset: 0x4C */
-  uint16_t      RESERVED13;  /*!< Reserved, 0x4E                                            */
-  __IO uint16_t OR;          /*!< TIM option register,                 Address offset: 0x50 */
-  uint16_t      RESERVED14;  /*!< Reserved, 0x52                                            */
-} TIM_TypeDef;
-
-/** 
-  * @brief Universal Synchronous Asynchronous Receiver Transmitter
-  */
- 
-typedef struct
-{
-  __IO uint16_t SR;         /*!< USART Status register,                   Address offset: 0x00 */
-  uint16_t      RESERVED0;  /*!< Reserved, 0x02                                                */
-  __IO uint16_t DR;         /*!< USART Data register,                     Address offset: 0x04 */
-  uint16_t      RESERVED1;  /*!< Reserved, 0x06                                                */
-  __IO uint16_t BRR;        /*!< USART Baud rate register,                Address offset: 0x08 */
-  uint16_t      RESERVED2;  /*!< Reserved, 0x0A                                                */
-  __IO uint16_t CR1;        /*!< USART Control register 1,                Address offset: 0x0C */
-  uint16_t      RESERVED3;  /*!< Reserved, 0x0E                                                */
-  __IO uint16_t CR2;        /*!< USART Control register 2,                Address offset: 0x10 */
-  uint16_t      RESERVED4;  /*!< Reserved, 0x12                                                */
-  __IO uint16_t CR3;        /*!< USART Control register 3,                Address offset: 0x14 */
-  uint16_t      RESERVED5;  /*!< Reserved, 0x16                                                */
-  __IO uint16_t GTPR;       /*!< USART Guard time and prescaler register, Address offset: 0x18 */
-  uint16_t      RESERVED6;  /*!< Reserved, 0x1A                                                */
-} USART_TypeDef;
-
-/** 
-  * @brief Window WATCHDOG
-  */
-
-typedef struct
-{
-  __IO uint32_t CR;   /*!< WWDG Control register,       Address offset: 0x00 */
-  __IO uint32_t CFR;  /*!< WWDG Configuration register, Address offset: 0x04 */
-  __IO uint32_t SR;   /*!< WWDG Status register,        Address offset: 0x08 */
-} WWDG_TypeDef;
-
-/** 
-  * @brief Crypto Processor
-  */
-
-typedef struct
-{
-  __IO uint32_t CR;         /*!< CRYP control register,                                    Address offset: 0x00 */
-  __IO uint32_t SR;         /*!< CRYP status register,                                     Address offset: 0x04 */
-  __IO uint32_t DR;         /*!< CRYP data input register,                                 Address offset: 0x08 */
-  __IO uint32_t DOUT;       /*!< CRYP data output register,                                Address offset: 0x0C */
-  __IO uint32_t DMACR;      /*!< CRYP DMA control register,                                Address offset: 0x10 */
-  __IO uint32_t IMSCR;      /*!< CRYP interrupt mask set/clear register,                   Address offset: 0x14 */
-  __IO uint32_t RISR;       /*!< CRYP raw interrupt status register,                       Address offset: 0x18 */
-  __IO uint32_t MISR;       /*!< CRYP masked interrupt status register,                    Address offset: 0x1C */
-  __IO uint32_t K0LR;       /*!< CRYP key left  register 0,                                Address offset: 0x20 */
-  __IO uint32_t K0RR;       /*!< CRYP key right register 0,                                Address offset: 0x24 */
-  __IO uint32_t K1LR;       /*!< CRYP key left  register 1,                                Address offset: 0x28 */
-  __IO uint32_t K1RR;       /*!< CRYP key right register 1,                                Address offset: 0x2C */
-  __IO uint32_t K2LR;       /*!< CRYP key left  register 2,                                Address offset: 0x30 */
-  __IO uint32_t K2RR;       /*!< CRYP key right register 2,                                Address offset: 0x34 */
-  __IO uint32_t K3LR;       /*!< CRYP key left  register 3,                                Address offset: 0x38 */
-  __IO uint32_t K3RR;       /*!< CRYP key right register 3,                                Address offset: 0x3C */
-  __IO uint32_t IV0LR;      /*!< CRYP initialization vector left-word  register 0,         Address offset: 0x40 */
-  __IO uint32_t IV0RR;      /*!< CRYP initialization vector right-word register 0,         Address offset: 0x44 */
-  __IO uint32_t IV1LR;      /*!< CRYP initialization vector left-word  register 1,         Address offset: 0x48 */
-  __IO uint32_t IV1RR;      /*!< CRYP initialization vector right-word register 1,         Address offset: 0x4C */
-  __IO uint32_t CSGCMCCM0R; /*!< CRYP GCM/GMAC or CCM/CMAC context swap register 0,        Address offset: 0x50 */
-  __IO uint32_t CSGCMCCM1R; /*!< CRYP GCM/GMAC or CCM/CMAC context swap register 1,        Address offset: 0x54 */
-  __IO uint32_t CSGCMCCM2R; /*!< CRYP GCM/GMAC or CCM/CMAC context swap register 2,        Address offset: 0x58 */
-  __IO uint32_t CSGCMCCM3R; /*!< CRYP GCM/GMAC or CCM/CMAC context swap register 3,        Address offset: 0x5C */
-  __IO uint32_t CSGCMCCM4R; /*!< CRYP GCM/GMAC or CCM/CMAC context swap register 4,        Address offset: 0x60 */
-  __IO uint32_t CSGCMCCM5R; /*!< CRYP GCM/GMAC or CCM/CMAC context swap register 5,        Address offset: 0x64 */
-  __IO uint32_t CSGCMCCM6R; /*!< CRYP GCM/GMAC or CCM/CMAC context swap register 6,        Address offset: 0x68 */
-  __IO uint32_t CSGCMCCM7R; /*!< CRYP GCM/GMAC or CCM/CMAC context swap register 7,        Address offset: 0x6C */
-  __IO uint32_t CSGCM0R;    /*!< CRYP GCM/GMAC context swap register 0,                    Address offset: 0x70 */
-  __IO uint32_t CSGCM1R;    /*!< CRYP GCM/GMAC context swap register 1,                    Address offset: 0x74 */
-  __IO uint32_t CSGCM2R;    /*!< CRYP GCM/GMAC context swap register 2,                    Address offset: 0x78 */
-  __IO uint32_t CSGCM3R;    /*!< CRYP GCM/GMAC context swap register 3,                    Address offset: 0x7C */
-  __IO uint32_t CSGCM4R;    /*!< CRYP GCM/GMAC context swap register 4,                    Address offset: 0x80 */
-  __IO uint32_t CSGCM5R;    /*!< CRYP GCM/GMAC context swap register 5,                    Address offset: 0x84 */
-  __IO uint32_t CSGCM6R;    /*!< CRYP GCM/GMAC context swap register 6,                    Address offset: 0x88 */
-  __IO uint32_t CSGCM7R;    /*!< CRYP GCM/GMAC context swap register 7,                    Address offset: 0x8C */
-} CRYP_TypeDef;
-
-/** 
-  * @brief HASH
-  */
-  
-typedef struct 
-{
-  __IO uint32_t CR;               /*!< HASH control register,          Address offset: 0x00        */
-  __IO uint32_t DIN;              /*!< HASH data input register,       Address offset: 0x04        */
-  __IO uint32_t STR;              /*!< HASH start register,            Address offset: 0x08        */
-  __IO uint32_t HR[5];            /*!< HASH digest registers,          Address offset: 0x0C-0x1C   */
-  __IO uint32_t IMR;              /*!< HASH interrupt enable register, Address offset: 0x20        */
-  __IO uint32_t SR;               /*!< HASH status register,           Address offset: 0x24        */
-       uint32_t RESERVED[52];     /*!< Reserved, 0x28-0xF4                                         */
-  __IO uint32_t CSR[54];          /*!< HASH context swap registers,    Address offset: 0x0F8-0x1CC */
-} HASH_TypeDef;
-
-/** 
-  * @brief HASH_DIGEST
-  */
-  
-typedef struct 
-{
-  __IO uint32_t HR[8];     /*!< HASH digest registers,          Address offset: 0x310-0x32C */ 
-} HASH_DIGEST_TypeDef;
-
-/** 
-  * @brief RNG
-  */
-  
-typedef struct 
-{
-  __IO uint32_t CR;  /*!< RNG control register, Address offset: 0x00 */
-  __IO uint32_t SR;  /*!< RNG status register,  Address offset: 0x04 */
-  __IO uint32_t DR;  /*!< RNG data register,    Address offset: 0x08 */
-} RNG_TypeDef;
-
-/**
-  * @}
-  */
-  
-/** @addtogroup Peripheral_memory_map
-  * @{
-  */
-#define FLASH_BASE            ((uint32_t)0x08000000) /*!< FLASH(up to 1 MB) base address in the alias region                         */
-#define CCMDATARAM_BASE       ((uint32_t)0x10000000) /*!< CCM(core coupled memory) data RAM(64 KB) base address in the alias region  */
-#define SRAM1_BASE            ((uint32_t)0x20000000) /*!< SRAM1(112 KB) base address in the alias region                             */
-#define SRAM2_BASE            ((uint32_t)0x2001C000) /*!< SRAM2(16 KB) base address in the alias region                              */
-#define SRAM3_BASE            ((uint32_t)0x20020000) /*!< SRAM3(64 KB) base address in the alias region                              */
-#define PERIPH_BASE           ((uint32_t)0x40000000) /*!< Peripheral base address in the alias region                                */
-#define BKPSRAM_BASE          ((uint32_t)0x40024000) /*!< Backup SRAM(4 KB) base address in the alias region                         */
-#define FSMC_R_BASE           ((uint32_t)0xA0000000) /*!< FSMC registers base address                                                */
-
-#define CCMDATARAM_BB_BASE    ((uint32_t)0x12000000) /*!< CCM(core coupled memory) data RAM(64 KB) base address in the bit-band region  */
-#define SRAM1_BB_BASE         ((uint32_t)0x22000000) /*!< SRAM1(112 KB) base address in the bit-band region                             */
-#define SRAM2_BB_BASE         ((uint32_t)0x2201C000) /*!< SRAM2(16 KB) base address in the bit-band region                              */
-#define SRAM3_BB_BASE         ((uint32_t)0x22020000) /*!< SRAM3(64 KB) base address in the bit-band region                              */
-#define PERIPH_BB_BASE        ((uint32_t)0x42000000) /*!< Peripheral base address in the bit-band region                                */
-#define BKPSRAM_BB_BASE       ((uint32_t)0x42024000) /*!< Backup SRAM(4 KB) base address in the bit-band region                         */
-
-/* Legacy defines */
-#define SRAM_BASE             SRAM1_BASE
-#define SRAM_BB_BASE          SRAM1_BB_BASE
-
-/*!< Peripheral memory map */
-#define APB1PERIPH_BASE       PERIPH_BASE
-#define APB2PERIPH_BASE       (PERIPH_BASE + 0x00010000)
-#define AHB1PERIPH_BASE       (PERIPH_BASE + 0x00020000)
-#define AHB2PERIPH_BASE       (PERIPH_BASE + 0x10000000)
-
-/*!< APB1 peripherals */
-#define TIM2_BASE             (APB1PERIPH_BASE + 0x0000)
-#define TIM3_BASE             (APB1PERIPH_BASE + 0x0400)
-#define TIM4_BASE             (APB1PERIPH_BASE + 0x0800)
-#define TIM5_BASE             (APB1PERIPH_BASE + 0x0C00)
-#define TIM6_BASE             (APB1PERIPH_BASE + 0x1000)
-#define TIM7_BASE             (APB1PERIPH_BASE + 0x1400)
-#define TIM12_BASE            (APB1PERIPH_BASE + 0x1800)
-#define TIM13_BASE            (APB1PERIPH_BASE + 0x1C00)
-#define TIM14_BASE            (APB1PERIPH_BASE + 0x2000)
-#define RTC_BASE              (APB1PERIPH_BASE + 0x2800)
-#define WWDG_BASE             (APB1PERIPH_BASE + 0x2C00)
-#define IWDG_BASE             (APB1PERIPH_BASE + 0x3000)
-#define I2S2ext_BASE          (APB1PERIPH_BASE + 0x3400)
-#define SPI2_BASE             (APB1PERIPH_BASE + 0x3800)
-#define SPI3_BASE             (APB1PERIPH_BASE + 0x3C00)
-#define I2S3ext_BASE          (APB1PERIPH_BASE + 0x4000)
-#define USART2_BASE           (APB1PERIPH_BASE + 0x4400)
-#define USART3_BASE           (APB1PERIPH_BASE + 0x4800)
-#define UART4_BASE            (APB1PERIPH_BASE + 0x4C00)
-#define UART5_BASE            (APB1PERIPH_BASE + 0x5000)
-#define I2C1_BASE             (APB1PERIPH_BASE + 0x5400)
-#define I2C2_BASE             (APB1PERIPH_BASE + 0x5800)
-#define I2C3_BASE             (APB1PERIPH_BASE + 0x5C00)
-#define CAN1_BASE             (APB1PERIPH_BASE + 0x6400)
-#define CAN2_BASE             (APB1PERIPH_BASE + 0x6800)
-#define PWR_BASE              (APB1PERIPH_BASE + 0x7000)
-#define DAC_BASE              (APB1PERIPH_BASE + 0x7400)
-#define UART7_BASE            (APB1PERIPH_BASE + 0x7800)
-#define UART8_BASE            (APB1PERIPH_BASE + 0x7C00)
-
-/*!< APB2 peripherals */
-#define TIM1_BASE             (APB2PERIPH_BASE + 0x0000)
-#define TIM8_BASE             (APB2PERIPH_BASE + 0x0400)
-#define USART1_BASE           (APB2PERIPH_BASE + 0x1000)
-#define USART6_BASE           (APB2PERIPH_BASE + 0x1400)
-#define ADC1_BASE             (APB2PERIPH_BASE + 0x2000)
-#define ADC2_BASE             (APB2PERIPH_BASE + 0x2100)
-#define ADC3_BASE             (APB2PERIPH_BASE + 0x2200)
-#define ADC_BASE              (APB2PERIPH_BASE + 0x2300)
-#define SDIO_BASE             (APB2PERIPH_BASE + 0x2C00)
-#define SPI1_BASE             (APB2PERIPH_BASE + 0x3000)
-#define SPI4_BASE             (APB2PERIPH_BASE + 0x3400)
-#define SYSCFG_BASE           (APB2PERIPH_BASE + 0x3800)
-#define EXTI_BASE             (APB2PERIPH_BASE + 0x3C00)
-#define TIM9_BASE             (APB2PERIPH_BASE + 0x4000)
-#define TIM10_BASE            (APB2PERIPH_BASE + 0x4400)
-#define TIM11_BASE            (APB2PERIPH_BASE + 0x4800)
-#define SPI5_BASE             (APB2PERIPH_BASE + 0x5000)
-#define SPI6_BASE             (APB2PERIPH_BASE + 0x5400)
-
-/*!< AHB1 peripherals */
-#define GPIOA_BASE            (AHB1PERIPH_BASE + 0x0000)
-#define GPIOB_BASE            (AHB1PERIPH_BASE + 0x0400)
-#define GPIOC_BASE            (AHB1PERIPH_BASE + 0x0800)
-#define GPIOD_BASE            (AHB1PERIPH_BASE + 0x0C00)
-#define GPIOE_BASE            (AHB1PERIPH_BASE + 0x1000)
-#define GPIOF_BASE            (AHB1PERIPH_BASE + 0x1400)
-#define GPIOG_BASE            (AHB1PERIPH_BASE + 0x1800)
-#define GPIOH_BASE            (AHB1PERIPH_BASE + 0x1C00)
-#define GPIOI_BASE            (AHB1PERIPH_BASE + 0x2000)
-
-#define CRC_BASE              (AHB1PERIPH_BASE + 0x3000)
-#define RCC_BASE              (AHB1PERIPH_BASE + 0x3800)
-#define FLASH_R_BASE          (AHB1PERIPH_BASE + 0x3C00)
-#define DMA1_BASE             (AHB1PERIPH_BASE + 0x6000)
-#define DMA1_Stream0_BASE     (DMA1_BASE + 0x010)
-#define DMA1_Stream1_BASE     (DMA1_BASE + 0x028)
-#define DMA1_Stream2_BASE     (DMA1_BASE + 0x040)
-#define DMA1_Stream3_BASE     (DMA1_BASE + 0x058)
-#define DMA1_Stream4_BASE     (DMA1_BASE + 0x070)
-#define DMA1_Stream5_BASE     (DMA1_BASE + 0x088)
-#define DMA1_Stream6_BASE     (DMA1_BASE + 0x0A0)
-#define DMA1_Stream7_BASE     (DMA1_BASE + 0x0B8)
-#define DMA2_BASE             (AHB1PERIPH_BASE + 0x6400)
-#define DMA2_Stream0_BASE     (DMA2_BASE + 0x010)
-#define DMA2_Stream1_BASE     (DMA2_BASE + 0x028)
-#define DMA2_Stream2_BASE     (DMA2_BASE + 0x040)
-#define DMA2_Stream3_BASE     (DMA2_BASE + 0x058)
-#define DMA2_Stream4_BASE     (DMA2_BASE + 0x070)
-#define DMA2_Stream5_BASE     (DMA2_BASE + 0x088)
-#define DMA2_Stream6_BASE     (DMA2_BASE + 0x0A0)
-#define DMA2_Stream7_BASE     (DMA2_BASE + 0x0B8)
-#define ETH_BASE              (AHB1PERIPH_BASE + 0x8000)
-#define ETH_MAC_BASE          (ETH_BASE)
-#define ETH_MMC_BASE          (ETH_BASE + 0x0100)
-#define ETH_PTP_BASE          (ETH_BASE + 0x0700)
-#define ETH_DMA_BASE          (ETH_BASE + 0x1000)
-
-/*!< AHB2 peripherals */
-#define DCMI_BASE             (AHB2PERIPH_BASE + 0x50000)
-#define CRYP_BASE             (AHB2PERIPH_BASE + 0x60000)
-#define HASH_BASE             (AHB2PERIPH_BASE + 0x60400)
-#define HASH_DIGEST_BASE      (AHB2PERIPH_BASE + 0x60710)
-#define RNG_BASE              (AHB2PERIPH_BASE + 0x60800)
-
-/*!< FSMC Bankx registers base address */
-#define FSMC_Bank1_R_BASE     (FSMC_R_BASE + 0x0000)
-#define FSMC_Bank1E_R_BASE    (FSMC_R_BASE + 0x0104)
-#define FSMC_Bank2_R_BASE     (FSMC_R_BASE + 0x0060)
-#define FSMC_Bank3_R_BASE     (FSMC_R_BASE + 0x0080)
-#define FSMC_Bank4_R_BASE     (FSMC_R_BASE + 0x00A0)
-
-/* Debug MCU registers base address */
-#define DBGMCU_BASE           ((uint32_t )0xE0042000)
-
-/**
-  * @}
-  */
-  
-/** @addtogroup Peripheral_declaration
-  * @{
-  */  
-#define TIM2                ((TIM_TypeDef *) TIM2_BASE)
-#define TIM3                ((TIM_TypeDef *) TIM3_BASE)
-#define TIM4                ((TIM_TypeDef *) TIM4_BASE)
-#define TIM5                ((TIM_TypeDef *) TIM5_BASE)
-#define TIM6                ((TIM_TypeDef *) TIM6_BASE)
-#define TIM7                ((TIM_TypeDef *) TIM7_BASE)
-#define TIM12               ((TIM_TypeDef *) TIM12_BASE)
-#define TIM13               ((TIM_TypeDef *) TIM13_BASE)
-#define TIM14               ((TIM_TypeDef *) TIM14_BASE)
-#define RTC                 ((RTC_TypeDef *) RTC_BASE)
-#define WWDG                ((WWDG_TypeDef *) WWDG_BASE)
-#define IWDG                ((IWDG_TypeDef *) IWDG_BASE)
-#define I2S2ext             ((SPI_TypeDef *) I2S2ext_BASE)
-#define SPI2                ((SPI_TypeDef *) SPI2_BASE)
-#define SPI3                ((SPI_TypeDef *) SPI3_BASE)
-#define I2S3ext             ((SPI_TypeDef *) I2S3ext_BASE)
-#define USART2              ((USART_TypeDef *) USART2_BASE)
-#define USART3              ((USART_TypeDef *) USART3_BASE)
-#define UART4               ((USART_TypeDef *) UART4_BASE)
-#define UART5               ((USART_TypeDef *) UART5_BASE)
-#define I2C1                ((I2C_TypeDef *) I2C1_BASE)
-#define I2C2                ((I2C_TypeDef *) I2C2_BASE)
-#define I2C3                ((I2C_TypeDef *) I2C3_BASE)
-#define CAN1                ((CAN_TypeDef *) CAN1_BASE)
-#define CAN2                ((CAN_TypeDef *) CAN2_BASE)
-#define PWR                 ((PWR_TypeDef *) PWR_BASE)
-#define DAC                 ((DAC_TypeDef *) DAC_BASE)
-#define UART7               ((USART_TypeDef *) UART7_BASE)
-#define UART8               ((USART_TypeDef *) UART8_BASE)
-#define TIM1                ((TIM_TypeDef *) TIM1_BASE)
-#define TIM8                ((TIM_TypeDef *) TIM8_BASE)
-#define USART1              ((USART_TypeDef *) USART1_BASE)
-#define USART6              ((USART_TypeDef *) USART6_BASE)
-#define ADC                 ((ADC_Common_TypeDef *) ADC_BASE)
-#define ADC1                ((ADC_TypeDef *) ADC1_BASE)
-#define ADC2                ((ADC_TypeDef *) ADC2_BASE)
-#define ADC3                ((ADC_TypeDef *) ADC3_BASE)
-#define SDIO                ((SDIO_TypeDef *) SDIO_BASE)
-#define SPI1                ((SPI_TypeDef *) SPI1_BASE) 
-#define SPI4                ((SPI_TypeDef *) SPI4_BASE)
-#define SYSCFG              ((SYSCFG_TypeDef *) SYSCFG_BASE)
-#define EXTI                ((EXTI_TypeDef *) EXTI_BASE)
-#define TIM9                ((TIM_TypeDef *) TIM9_BASE)
-#define TIM10               ((TIM_TypeDef *) TIM10_BASE)
-#define TIM11               ((TIM_TypeDef *) TIM11_BASE)
-#define SPI5                ((SPI_TypeDef *) SPI5_BASE)
-#define SPI6                ((SPI_TypeDef *) SPI6_BASE)
-
-#define GPIOA               ((GPIO_TypeDef *) GPIOA_BASE)
-#define GPIOB               ((GPIO_TypeDef *) GPIOB_BASE)
-#define GPIOC               ((GPIO_TypeDef *) GPIOC_BASE)
-#define GPIOD               ((GPIO_TypeDef *) GPIOD_BASE)
-#define GPIOE               ((GPIO_TypeDef *) GPIOE_BASE)
-#define GPIOF               ((GPIO_TypeDef *) GPIOF_BASE)
-#define GPIOG               ((GPIO_TypeDef *) GPIOG_BASE)
-#define GPIOH               ((GPIO_TypeDef *) GPIOH_BASE)
-#define GPIOI               ((GPIO_TypeDef *) GPIOI_BASE)
-
-#define CRC                 ((CRC_TypeDef *) CRC_BASE)
-#define RCC                 ((RCC_TypeDef *) RCC_BASE)
-#define FLASH               ((FLASH_TypeDef *) FLASH_R_BASE)
-#define DMA1                ((DMA_TypeDef *) DMA1_BASE)
-#define DMA1_Stream0        ((DMA_Stream_TypeDef *) DMA1_Stream0_BASE)
-#define DMA1_Stream1        ((DMA_Stream_TypeDef *) DMA1_Stream1_BASE)
-#define DMA1_Stream2        ((DMA_Stream_TypeDef *) DMA1_Stream2_BASE)
-#define DMA1_Stream3        ((DMA_Stream_TypeDef *) DMA1_Stream3_BASE)
-#define DMA1_Stream4        ((DMA_Stream_TypeDef *) DMA1_Stream4_BASE)
-#define DMA1_Stream5        ((DMA_Stream_TypeDef *) DMA1_Stream5_BASE)
-#define DMA1_Stream6        ((DMA_Stream_TypeDef *) DMA1_Stream6_BASE)
-#define DMA1_Stream7        ((DMA_Stream_TypeDef *) DMA1_Stream7_BASE)
-#define DMA2                ((DMA_TypeDef *) DMA2_BASE)
-#define DMA2_Stream0        ((DMA_Stream_TypeDef *) DMA2_Stream0_BASE)
-#define DMA2_Stream1        ((DMA_Stream_TypeDef *) DMA2_Stream1_BASE)
-#define DMA2_Stream2        ((DMA_Stream_TypeDef *) DMA2_Stream2_BASE)
-#define DMA2_Stream3        ((DMA_Stream_TypeDef *) DMA2_Stream3_BASE)
-#define DMA2_Stream4        ((DMA_Stream_TypeDef *) DMA2_Stream4_BASE)
-#define DMA2_Stream5        ((DMA_Stream_TypeDef *) DMA2_Stream5_BASE)
-#define DMA2_Stream6        ((DMA_Stream_TypeDef *) DMA2_Stream6_BASE)
-#define DMA2_Stream7        ((DMA_Stream_TypeDef *) DMA2_Stream7_BASE)
-#define ETH                 ((ETH_TypeDef *) ETH_BASE)  
-#define DCMI                ((DCMI_TypeDef *) DCMI_BASE)
-#define CRYP                ((CRYP_TypeDef *) CRYP_BASE)
-#define HASH                ((HASH_TypeDef *) HASH_BASE)
-#define HASH_DIGEST         ((HASH_DIGEST_TypeDef *) HASH_DIGEST_BASE)
-#define RNG                 ((RNG_TypeDef *) RNG_BASE)
-#define FSMC_Bank1          ((FSMC_Bank1_TypeDef *) FSMC_Bank1_R_BASE)
-#define FSMC_Bank1E         ((FSMC_Bank1E_TypeDef *) FSMC_Bank1E_R_BASE)
-#define FSMC_Bank2          ((FSMC_Bank2_TypeDef *) FSMC_Bank2_R_BASE)
-#define FSMC_Bank3          ((FSMC_Bank3_TypeDef *) FSMC_Bank3_R_BASE)
-#define FSMC_Bank4          ((FSMC_Bank4_TypeDef *) FSMC_Bank4_R_BASE)                                                                     
-#define DBGMCU              ((DBGMCU_TypeDef *) DBGMCU_BASE)
-
-/**
-  * @}
-  */
-
-/** @addtogroup Exported_constants
-  * @{
-  */
-  
-  /** @addtogroup Peripheral_Registers_Bits_Definition
-  * @{
-  */
-    
-/******************************************************************************/
-/*                         Peripheral Registers_Bits_Definition               */
-/******************************************************************************/
-
-/******************************************************************************/
-/*                                                                            */
-/*                        Analog to Digital Converter                         */
-/*                                                                            */
-/******************************************************************************/
-/********************  Bit definition for ADC_SR register  ********************/
-#define  ADC_SR_AWD                          ((uint8_t)0x01)               /*!<Analog watchdog flag */
-#define  ADC_SR_EOC                          ((uint8_t)0x02)               /*!<End of conversion */
-#define  ADC_SR_JEOC                         ((uint8_t)0x04)               /*!<Injected channel end of conversion */
-#define  ADC_SR_JSTRT                        ((uint8_t)0x08)               /*!<Injected channel Start flag */
-#define  ADC_SR_STRT                         ((uint8_t)0x10)               /*!<Regular channel Start flag */
-#define  ADC_SR_OVR                          ((uint8_t)0x20)               /*!<Overrun flag */
-
-/*******************  Bit definition for ADC_CR1 register  ********************/
-#define  ADC_CR1_AWDCH                       ((uint32_t)0x0000001F)        /*!<AWDCH[4:0] bits (Analog watchdog channel select bits) */
-#define  ADC_CR1_AWDCH_0                     ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  ADC_CR1_AWDCH_1                     ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  ADC_CR1_AWDCH_2                     ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  ADC_CR1_AWDCH_3                     ((uint32_t)0x00000008)        /*!<Bit 3 */
-#define  ADC_CR1_AWDCH_4                     ((uint32_t)0x00000010)        /*!<Bit 4 */
-#define  ADC_CR1_EOCIE                       ((uint32_t)0x00000020)        /*!<Interrupt enable for EOC */
-#define  ADC_CR1_AWDIE                       ((uint32_t)0x00000040)        /*!<AAnalog Watchdog interrupt enable */
-#define  ADC_CR1_JEOCIE                      ((uint32_t)0x00000080)        /*!<Interrupt enable for injected channels */
-#define  ADC_CR1_SCAN                        ((uint32_t)0x00000100)        /*!<Scan mode */
-#define  ADC_CR1_AWDSGL                      ((uint32_t)0x00000200)        /*!<Enable the watchdog on a single channel in scan mode */
-#define  ADC_CR1_JAUTO                       ((uint32_t)0x00000400)        /*!<Automatic injected group conversion */
-#define  ADC_CR1_DISCEN                      ((uint32_t)0x00000800)        /*!<Discontinuous mode on regular channels */
-#define  ADC_CR1_JDISCEN                     ((uint32_t)0x00001000)        /*!<Discontinuous mode on injected channels */
-#define  ADC_CR1_DISCNUM                     ((uint32_t)0x0000E000)        /*!<DISCNUM[2:0] bits (Discontinuous mode channel count) */
-#define  ADC_CR1_DISCNUM_0                   ((uint32_t)0x00002000)        /*!<Bit 0 */
-#define  ADC_CR1_DISCNUM_1                   ((uint32_t)0x00004000)        /*!<Bit 1 */
-#define  ADC_CR1_DISCNUM_2                   ((uint32_t)0x00008000)        /*!<Bit 2 */
-#define  ADC_CR1_JAWDEN                      ((uint32_t)0x00400000)        /*!<Analog watchdog enable on injected channels */
-#define  ADC_CR1_AWDEN                       ((uint32_t)0x00800000)        /*!<Analog watchdog enable on regular channels */
-#define  ADC_CR1_RES                         ((uint32_t)0x03000000)        /*!<RES[2:0] bits (Resolution) */
-#define  ADC_CR1_RES_0                       ((uint32_t)0x01000000)        /*!<Bit 0 */
-#define  ADC_CR1_RES_1                       ((uint32_t)0x02000000)        /*!<Bit 1 */
-#define  ADC_CR1_OVRIE                       ((uint32_t)0x04000000)         /*!<overrun interrupt enable */
-  
-/*******************  Bit definition for ADC_CR2 register  ********************/
-#define  ADC_CR2_ADON                        ((uint32_t)0x00000001)        /*!<A/D Converter ON / OFF */
-#define  ADC_CR2_CONT                        ((uint32_t)0x00000002)        /*!<Continuous Conversion */
-#define  ADC_CR2_DMA                         ((uint32_t)0x00000100)        /*!<Direct Memory access mode */
-#define  ADC_CR2_DDS                         ((uint32_t)0x00000200)        /*!<DMA disable selection (Single ADC) */
-#define  ADC_CR2_EOCS                        ((uint32_t)0x00000400)        /*!<End of conversion selection */
-#define  ADC_CR2_ALIGN                       ((uint32_t)0x00000800)        /*!<Data Alignment */
-#define  ADC_CR2_JEXTSEL                     ((uint32_t)0x000F0000)        /*!<JEXTSEL[3:0] bits (External event select for injected group) */
-#define  ADC_CR2_JEXTSEL_0                   ((uint32_t)0x00010000)        /*!<Bit 0 */
-#define  ADC_CR2_JEXTSEL_1                   ((uint32_t)0x00020000)        /*!<Bit 1 */
-#define  ADC_CR2_JEXTSEL_2                   ((uint32_t)0x00040000)        /*!<Bit 2 */
-#define  ADC_CR2_JEXTSEL_3                   ((uint32_t)0x00080000)        /*!<Bit 3 */
-#define  ADC_CR2_JEXTEN                      ((uint32_t)0x00300000)        /*!<JEXTEN[1:0] bits (External Trigger Conversion mode for injected channelsp) */
-#define  ADC_CR2_JEXTEN_0                    ((uint32_t)0x00100000)        /*!<Bit 0 */
-#define  ADC_CR2_JEXTEN_1                    ((uint32_t)0x00200000)        /*!<Bit 1 */
-#define  ADC_CR2_JSWSTART                    ((uint32_t)0x00400000)        /*!<Start Conversion of injected channels */
-#define  ADC_CR2_EXTSEL                      ((uint32_t)0x0F000000)        /*!<EXTSEL[3:0] bits (External Event Select for regular group) */
-#define  ADC_CR2_EXTSEL_0                    ((uint32_t)0x01000000)        /*!<Bit 0 */
-#define  ADC_CR2_EXTSEL_1                    ((uint32_t)0x02000000)        /*!<Bit 1 */
-#define  ADC_CR2_EXTSEL_2                    ((uint32_t)0x04000000)        /*!<Bit 2 */
-#define  ADC_CR2_EXTSEL_3                    ((uint32_t)0x08000000)        /*!<Bit 3 */
-#define  ADC_CR2_EXTEN                       ((uint32_t)0x30000000)        /*!<EXTEN[1:0] bits (External Trigger Conversion mode for regular channelsp) */
-#define  ADC_CR2_EXTEN_0                     ((uint32_t)0x10000000)        /*!<Bit 0 */
-#define  ADC_CR2_EXTEN_1                     ((uint32_t)0x20000000)        /*!<Bit 1 */
-#define  ADC_CR2_SWSTART                     ((uint32_t)0x40000000)        /*!<Start Conversion of regular channels */
-
-/******************  Bit definition for ADC_SMPR1 register  *******************/
-#define  ADC_SMPR1_SMP10                     ((uint32_t)0x00000007)        /*!<SMP10[2:0] bits (Channel 10 Sample time selection) */
-#define  ADC_SMPR1_SMP10_0                   ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  ADC_SMPR1_SMP10_1                   ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  ADC_SMPR1_SMP10_2                   ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  ADC_SMPR1_SMP11                     ((uint32_t)0x00000038)        /*!<SMP11[2:0] bits (Channel 11 Sample time selection) */
-#define  ADC_SMPR1_SMP11_0                   ((uint32_t)0x00000008)        /*!<Bit 0 */
-#define  ADC_SMPR1_SMP11_1                   ((uint32_t)0x00000010)        /*!<Bit 1 */
-#define  ADC_SMPR1_SMP11_2                   ((uint32_t)0x00000020)        /*!<Bit 2 */
-#define  ADC_SMPR1_SMP12                     ((uint32_t)0x000001C0)        /*!<SMP12[2:0] bits (Channel 12 Sample time selection) */
-#define  ADC_SMPR1_SMP12_0                   ((uint32_t)0x00000040)        /*!<Bit 0 */
-#define  ADC_SMPR1_SMP12_1                   ((uint32_t)0x00000080)        /*!<Bit 1 */
-#define  ADC_SMPR1_SMP12_2                   ((uint32_t)0x00000100)        /*!<Bit 2 */
-#define  ADC_SMPR1_SMP13                     ((uint32_t)0x00000E00)        /*!<SMP13[2:0] bits (Channel 13 Sample time selection) */
-#define  ADC_SMPR1_SMP13_0                   ((uint32_t)0x00000200)        /*!<Bit 0 */
-#define  ADC_SMPR1_SMP13_1                   ((uint32_t)0x00000400)        /*!<Bit 1 */
-#define  ADC_SMPR1_SMP13_2                   ((uint32_t)0x00000800)        /*!<Bit 2 */
-#define  ADC_SMPR1_SMP14                     ((uint32_t)0x00007000)        /*!<SMP14[2:0] bits (Channel 14 Sample time selection) */
-#define  ADC_SMPR1_SMP14_0                   ((uint32_t)0x00001000)        /*!<Bit 0 */
-#define  ADC_SMPR1_SMP14_1                   ((uint32_t)0x00002000)        /*!<Bit 1 */
-#define  ADC_SMPR1_SMP14_2                   ((uint32_t)0x00004000)        /*!<Bit 2 */
-#define  ADC_SMPR1_SMP15                     ((uint32_t)0x00038000)        /*!<SMP15[2:0] bits (Channel 15 Sample time selection) */
-#define  ADC_SMPR1_SMP15_0                   ((uint32_t)0x00008000)        /*!<Bit 0 */
-#define  ADC_SMPR1_SMP15_1                   ((uint32_t)0x00010000)        /*!<Bit 1 */
-#define  ADC_SMPR1_SMP15_2                   ((uint32_t)0x00020000)        /*!<Bit 2 */
-#define  ADC_SMPR1_SMP16                     ((uint32_t)0x001C0000)        /*!<SMP16[2:0] bits (Channel 16 Sample time selection) */
-#define  ADC_SMPR1_SMP16_0                   ((uint32_t)0x00040000)        /*!<Bit 0 */
-#define  ADC_SMPR1_SMP16_1                   ((uint32_t)0x00080000)        /*!<Bit 1 */
-#define  ADC_SMPR1_SMP16_2                   ((uint32_t)0x00100000)        /*!<Bit 2 */
-#define  ADC_SMPR1_SMP17                     ((uint32_t)0x00E00000)        /*!<SMP17[2:0] bits (Channel 17 Sample time selection) */
-#define  ADC_SMPR1_SMP17_0                   ((uint32_t)0x00200000)        /*!<Bit 0 */
-#define  ADC_SMPR1_SMP17_1                   ((uint32_t)0x00400000)        /*!<Bit 1 */
-#define  ADC_SMPR1_SMP17_2                   ((uint32_t)0x00800000)        /*!<Bit 2 */
-#define  ADC_SMPR1_SMP18                     ((uint32_t)0x07000000)        /*!<SMP18[2:0] bits (Channel 18 Sample time selection) */
-#define  ADC_SMPR1_SMP18_0                   ((uint32_t)0x01000000)        /*!<Bit 0 */
-#define  ADC_SMPR1_SMP18_1                   ((uint32_t)0x02000000)        /*!<Bit 1 */
-#define  ADC_SMPR1_SMP18_2                   ((uint32_t)0x04000000)        /*!<Bit 2 */
-
-/******************  Bit definition for ADC_SMPR2 register  *******************/
-#define  ADC_SMPR2_SMP0                      ((uint32_t)0x00000007)        /*!<SMP0[2:0] bits (Channel 0 Sample time selection) */
-#define  ADC_SMPR2_SMP0_0                    ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  ADC_SMPR2_SMP0_1                    ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  ADC_SMPR2_SMP0_2                    ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  ADC_SMPR2_SMP1                      ((uint32_t)0x00000038)        /*!<SMP1[2:0] bits (Channel 1 Sample time selection) */
-#define  ADC_SMPR2_SMP1_0                    ((uint32_t)0x00000008)        /*!<Bit 0 */
-#define  ADC_SMPR2_SMP1_1                    ((uint32_t)0x00000010)        /*!<Bit 1 */
-#define  ADC_SMPR2_SMP1_2                    ((uint32_t)0x00000020)        /*!<Bit 2 */
-#define  ADC_SMPR2_SMP2                      ((uint32_t)0x000001C0)        /*!<SMP2[2:0] bits (Channel 2 Sample time selection) */
-#define  ADC_SMPR2_SMP2_0                    ((uint32_t)0x00000040)        /*!<Bit 0 */
-#define  ADC_SMPR2_SMP2_1                    ((uint32_t)0x00000080)        /*!<Bit 1 */
-#define  ADC_SMPR2_SMP2_2                    ((uint32_t)0x00000100)        /*!<Bit 2 */
-#define  ADC_SMPR2_SMP3                      ((uint32_t)0x00000E00)        /*!<SMP3[2:0] bits (Channel 3 Sample time selection) */
-#define  ADC_SMPR2_SMP3_0                    ((uint32_t)0x00000200)        /*!<Bit 0 */
-#define  ADC_SMPR2_SMP3_1                    ((uint32_t)0x00000400)        /*!<Bit 1 */
-#define  ADC_SMPR2_SMP3_2                    ((uint32_t)0x00000800)        /*!<Bit 2 */
-#define  ADC_SMPR2_SMP4                      ((uint32_t)0x00007000)        /*!<SMP4[2:0] bits (Channel 4 Sample time selection) */
-#define  ADC_SMPR2_SMP4_0                    ((uint32_t)0x00001000)        /*!<Bit 0 */
-#define  ADC_SMPR2_SMP4_1                    ((uint32_t)0x00002000)        /*!<Bit 1 */
-#define  ADC_SMPR2_SMP4_2                    ((uint32_t)0x00004000)        /*!<Bit 2 */
-#define  ADC_SMPR2_SMP5                      ((uint32_t)0x00038000)        /*!<SMP5[2:0] bits (Channel 5 Sample time selection) */
-#define  ADC_SMPR2_SMP5_0                    ((uint32_t)0x00008000)        /*!<Bit 0 */
-#define  ADC_SMPR2_SMP5_1                    ((uint32_t)0x00010000)        /*!<Bit 1 */
-#define  ADC_SMPR2_SMP5_2                    ((uint32_t)0x00020000)        /*!<Bit 2 */
-#define  ADC_SMPR2_SMP6                      ((uint32_t)0x001C0000)        /*!<SMP6[2:0] bits (Channel 6 Sample time selection) */
-#define  ADC_SMPR2_SMP6_0                    ((uint32_t)0x00040000)        /*!<Bit 0 */
-#define  ADC_SMPR2_SMP6_1                    ((uint32_t)0x00080000)        /*!<Bit 1 */
-#define  ADC_SMPR2_SMP6_2                    ((uint32_t)0x00100000)        /*!<Bit 2 */
-#define  ADC_SMPR2_SMP7                      ((uint32_t)0x00E00000)        /*!<SMP7[2:0] bits (Channel 7 Sample time selection) */
-#define  ADC_SMPR2_SMP7_0                    ((uint32_t)0x00200000)        /*!<Bit 0 */
-#define  ADC_SMPR2_SMP7_1                    ((uint32_t)0x00400000)        /*!<Bit 1 */
-#define  ADC_SMPR2_SMP7_2                    ((uint32_t)0x00800000)        /*!<Bit 2 */
-#define  ADC_SMPR2_SMP8                      ((uint32_t)0x07000000)        /*!<SMP8[2:0] bits (Channel 8 Sample time selection) */
-#define  ADC_SMPR2_SMP8_0                    ((uint32_t)0x01000000)        /*!<Bit 0 */
-#define  ADC_SMPR2_SMP8_1                    ((uint32_t)0x02000000)        /*!<Bit 1 */
-#define  ADC_SMPR2_SMP8_2                    ((uint32_t)0x04000000)        /*!<Bit 2 */
-#define  ADC_SMPR2_SMP9                      ((uint32_t)0x38000000)        /*!<SMP9[2:0] bits (Channel 9 Sample time selection) */
-#define  ADC_SMPR2_SMP9_0                    ((uint32_t)0x08000000)        /*!<Bit 0 */
-#define  ADC_SMPR2_SMP9_1                    ((uint32_t)0x10000000)        /*!<Bit 1 */
-#define  ADC_SMPR2_SMP9_2                    ((uint32_t)0x20000000)        /*!<Bit 2 */
-
-/******************  Bit definition for ADC_JOFR1 register  *******************/
-#define  ADC_JOFR1_JOFFSET1                  ((uint16_t)0x0FFF)            /*!<Data offset for injected channel 1 */
-
-/******************  Bit definition for ADC_JOFR2 register  *******************/
-#define  ADC_JOFR2_JOFFSET2                  ((uint16_t)0x0FFF)            /*!<Data offset for injected channel 2 */
-
-/******************  Bit definition for ADC_JOFR3 register  *******************/
-#define  ADC_JOFR3_JOFFSET3                  ((uint16_t)0x0FFF)            /*!<Data offset for injected channel 3 */
-
-/******************  Bit definition for ADC_JOFR4 register  *******************/
-#define  ADC_JOFR4_JOFFSET4                  ((uint16_t)0x0FFF)            /*!<Data offset for injected channel 4 */
-
-/*******************  Bit definition for ADC_HTR register  ********************/
-#define  ADC_HTR_HT                          ((uint16_t)0x0FFF)            /*!<Analog watchdog high threshold */
-
-/*******************  Bit definition for ADC_LTR register  ********************/
-#define  ADC_LTR_LT                          ((uint16_t)0x0FFF)            /*!<Analog watchdog low threshold */
-
-/*******************  Bit definition for ADC_SQR1 register  *******************/
-#define  ADC_SQR1_SQ13                       ((uint32_t)0x0000001F)        /*!<SQ13[4:0] bits (13th conversion in regular sequence) */
-#define  ADC_SQR1_SQ13_0                     ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  ADC_SQR1_SQ13_1                     ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  ADC_SQR1_SQ13_2                     ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  ADC_SQR1_SQ13_3                     ((uint32_t)0x00000008)        /*!<Bit 3 */
-#define  ADC_SQR1_SQ13_4                     ((uint32_t)0x00000010)        /*!<Bit 4 */
-#define  ADC_SQR1_SQ14                       ((uint32_t)0x000003E0)        /*!<SQ14[4:0] bits (14th conversion in regular sequence) */
-#define  ADC_SQR1_SQ14_0                     ((uint32_t)0x00000020)        /*!<Bit 0 */
-#define  ADC_SQR1_SQ14_1                     ((uint32_t)0x00000040)        /*!<Bit 1 */
-#define  ADC_SQR1_SQ14_2                     ((uint32_t)0x00000080)        /*!<Bit 2 */
-#define  ADC_SQR1_SQ14_3                     ((uint32_t)0x00000100)        /*!<Bit 3 */
-#define  ADC_SQR1_SQ14_4                     ((uint32_t)0x00000200)        /*!<Bit 4 */
-#define  ADC_SQR1_SQ15                       ((uint32_t)0x00007C00)        /*!<SQ15[4:0] bits (15th conversion in regular sequence) */
-#define  ADC_SQR1_SQ15_0                     ((uint32_t)0x00000400)        /*!<Bit 0 */
-#define  ADC_SQR1_SQ15_1                     ((uint32_t)0x00000800)        /*!<Bit 1 */
-#define  ADC_SQR1_SQ15_2                     ((uint32_t)0x00001000)        /*!<Bit 2 */
-#define  ADC_SQR1_SQ15_3                     ((uint32_t)0x00002000)        /*!<Bit 3 */
-#define  ADC_SQR1_SQ15_4                     ((uint32_t)0x00004000)        /*!<Bit 4 */
-#define  ADC_SQR1_SQ16                       ((uint32_t)0x000F8000)        /*!<SQ16[4:0] bits (16th conversion in regular sequence) */
-#define  ADC_SQR1_SQ16_0                     ((uint32_t)0x00008000)        /*!<Bit 0 */
-#define  ADC_SQR1_SQ16_1                     ((uint32_t)0x00010000)        /*!<Bit 1 */
-#define  ADC_SQR1_SQ16_2                     ((uint32_t)0x00020000)        /*!<Bit 2 */
-#define  ADC_SQR1_SQ16_3                     ((uint32_t)0x00040000)        /*!<Bit 3 */
-#define  ADC_SQR1_SQ16_4                     ((uint32_t)0x00080000)        /*!<Bit 4 */
-#define  ADC_SQR1_L                          ((uint32_t)0x00F00000)        /*!<L[3:0] bits (Regular channel sequence length) */
-#define  ADC_SQR1_L_0                        ((uint32_t)0x00100000)        /*!<Bit 0 */
-#define  ADC_SQR1_L_1                        ((uint32_t)0x00200000)        /*!<Bit 1 */
-#define  ADC_SQR1_L_2                        ((uint32_t)0x00400000)        /*!<Bit 2 */
-#define  ADC_SQR1_L_3                        ((uint32_t)0x00800000)        /*!<Bit 3 */
-
-/*******************  Bit definition for ADC_SQR2 register  *******************/
-#define  ADC_SQR2_SQ7                        ((uint32_t)0x0000001F)        /*!<SQ7[4:0] bits (7th conversion in regular sequence) */
-#define  ADC_SQR2_SQ7_0                      ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  ADC_SQR2_SQ7_1                      ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  ADC_SQR2_SQ7_2                      ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  ADC_SQR2_SQ7_3                      ((uint32_t)0x00000008)        /*!<Bit 3 */
-#define  ADC_SQR2_SQ7_4                      ((uint32_t)0x00000010)        /*!<Bit 4 */
-#define  ADC_SQR2_SQ8                        ((uint32_t)0x000003E0)        /*!<SQ8[4:0] bits (8th conversion in regular sequence) */
-#define  ADC_SQR2_SQ8_0                      ((uint32_t)0x00000020)        /*!<Bit 0 */
-#define  ADC_SQR2_SQ8_1                      ((uint32_t)0x00000040)        /*!<Bit 1 */
-#define  ADC_SQR2_SQ8_2                      ((uint32_t)0x00000080)        /*!<Bit 2 */
-#define  ADC_SQR2_SQ8_3                      ((uint32_t)0x00000100)        /*!<Bit 3 */
-#define  ADC_SQR2_SQ8_4                      ((uint32_t)0x00000200)        /*!<Bit 4 */
-#define  ADC_SQR2_SQ9                        ((uint32_t)0x00007C00)        /*!<SQ9[4:0] bits (9th conversion in regular sequence) */
-#define  ADC_SQR2_SQ9_0                      ((uint32_t)0x00000400)        /*!<Bit 0 */
-#define  ADC_SQR2_SQ9_1                      ((uint32_t)0x00000800)        /*!<Bit 1 */
-#define  ADC_SQR2_SQ9_2                      ((uint32_t)0x00001000)        /*!<Bit 2 */
-#define  ADC_SQR2_SQ9_3                      ((uint32_t)0x00002000)        /*!<Bit 3 */
-#define  ADC_SQR2_SQ9_4                      ((uint32_t)0x00004000)        /*!<Bit 4 */
-#define  ADC_SQR2_SQ10                       ((uint32_t)0x000F8000)        /*!<SQ10[4:0] bits (10th conversion in regular sequence) */
-#define  ADC_SQR2_SQ10_0                     ((uint32_t)0x00008000)        /*!<Bit 0 */
-#define  ADC_SQR2_SQ10_1                     ((uint32_t)0x00010000)        /*!<Bit 1 */
-#define  ADC_SQR2_SQ10_2                     ((uint32_t)0x00020000)        /*!<Bit 2 */
-#define  ADC_SQR2_SQ10_3                     ((uint32_t)0x00040000)        /*!<Bit 3 */
-#define  ADC_SQR2_SQ10_4                     ((uint32_t)0x00080000)        /*!<Bit 4 */
-#define  ADC_SQR2_SQ11                       ((uint32_t)0x01F00000)        /*!<SQ11[4:0] bits (11th conversion in regular sequence) */
-#define  ADC_SQR2_SQ11_0                     ((uint32_t)0x00100000)        /*!<Bit 0 */
-#define  ADC_SQR2_SQ11_1                     ((uint32_t)0x00200000)        /*!<Bit 1 */
-#define  ADC_SQR2_SQ11_2                     ((uint32_t)0x00400000)        /*!<Bit 2 */
-#define  ADC_SQR2_SQ11_3                     ((uint32_t)0x00800000)        /*!<Bit 3 */
-#define  ADC_SQR2_SQ11_4                     ((uint32_t)0x01000000)        /*!<Bit 4 */
-#define  ADC_SQR2_SQ12                       ((uint32_t)0x3E000000)        /*!<SQ12[4:0] bits (12th conversion in regular sequence) */
-#define  ADC_SQR2_SQ12_0                     ((uint32_t)0x02000000)        /*!<Bit 0 */
-#define  ADC_SQR2_SQ12_1                     ((uint32_t)0x04000000)        /*!<Bit 1 */
-#define  ADC_SQR2_SQ12_2                     ((uint32_t)0x08000000)        /*!<Bit 2 */
-#define  ADC_SQR2_SQ12_3                     ((uint32_t)0x10000000)        /*!<Bit 3 */
-#define  ADC_SQR2_SQ12_4                     ((uint32_t)0x20000000)        /*!<Bit 4 */
-
-/*******************  Bit definition for ADC_SQR3 register  *******************/
-#define  ADC_SQR3_SQ1                        ((uint32_t)0x0000001F)        /*!<SQ1[4:0] bits (1st conversion in regular sequence) */
-#define  ADC_SQR3_SQ1_0                      ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  ADC_SQR3_SQ1_1                      ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  ADC_SQR3_SQ1_2                      ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  ADC_SQR3_SQ1_3                      ((uint32_t)0x00000008)        /*!<Bit 3 */
-#define  ADC_SQR3_SQ1_4                      ((uint32_t)0x00000010)        /*!<Bit 4 */
-#define  ADC_SQR3_SQ2                        ((uint32_t)0x000003E0)        /*!<SQ2[4:0] bits (2nd conversion in regular sequence) */
-#define  ADC_SQR3_SQ2_0                      ((uint32_t)0x00000020)        /*!<Bit 0 */
-#define  ADC_SQR3_SQ2_1                      ((uint32_t)0x00000040)        /*!<Bit 1 */
-#define  ADC_SQR3_SQ2_2                      ((uint32_t)0x00000080)        /*!<Bit 2 */
-#define  ADC_SQR3_SQ2_3                      ((uint32_t)0x00000100)        /*!<Bit 3 */
-#define  ADC_SQR3_SQ2_4                      ((uint32_t)0x00000200)        /*!<Bit 4 */
-#define  ADC_SQR3_SQ3                        ((uint32_t)0x00007C00)        /*!<SQ3[4:0] bits (3rd conversion in regular sequence) */
-#define  ADC_SQR3_SQ3_0                      ((uint32_t)0x00000400)        /*!<Bit 0 */
-#define  ADC_SQR3_SQ3_1                      ((uint32_t)0x00000800)        /*!<Bit 1 */
-#define  ADC_SQR3_SQ3_2                      ((uint32_t)0x00001000)        /*!<Bit 2 */
-#define  ADC_SQR3_SQ3_3                      ((uint32_t)0x00002000)        /*!<Bit 3 */
-#define  ADC_SQR3_SQ3_4                      ((uint32_t)0x00004000)        /*!<Bit 4 */
-#define  ADC_SQR3_SQ4                        ((uint32_t)0x000F8000)        /*!<SQ4[4:0] bits (4th conversion in regular sequence) */
-#define  ADC_SQR3_SQ4_0                      ((uint32_t)0x00008000)        /*!<Bit 0 */
-#define  ADC_SQR3_SQ4_1                      ((uint32_t)0x00010000)        /*!<Bit 1 */
-#define  ADC_SQR3_SQ4_2                      ((uint32_t)0x00020000)        /*!<Bit 2 */
-#define  ADC_SQR3_SQ4_3                      ((uint32_t)0x00040000)        /*!<Bit 3 */
-#define  ADC_SQR3_SQ4_4                      ((uint32_t)0x00080000)        /*!<Bit 4 */
-#define  ADC_SQR3_SQ5                        ((uint32_t)0x01F00000)        /*!<SQ5[4:0] bits (5th conversion in regular sequence) */
-#define  ADC_SQR3_SQ5_0                      ((uint32_t)0x00100000)        /*!<Bit 0 */
-#define  ADC_SQR3_SQ5_1                      ((uint32_t)0x00200000)        /*!<Bit 1 */
-#define  ADC_SQR3_SQ5_2                      ((uint32_t)0x00400000)        /*!<Bit 2 */
-#define  ADC_SQR3_SQ5_3                      ((uint32_t)0x00800000)        /*!<Bit 3 */
-#define  ADC_SQR3_SQ5_4                      ((uint32_t)0x01000000)        /*!<Bit 4 */
-#define  ADC_SQR3_SQ6                        ((uint32_t)0x3E000000)        /*!<SQ6[4:0] bits (6th conversion in regular sequence) */
-#define  ADC_SQR3_SQ6_0                      ((uint32_t)0x02000000)        /*!<Bit 0 */
-#define  ADC_SQR3_SQ6_1                      ((uint32_t)0x04000000)        /*!<Bit 1 */
-#define  ADC_SQR3_SQ6_2                      ((uint32_t)0x08000000)        /*!<Bit 2 */
-#define  ADC_SQR3_SQ6_3                      ((uint32_t)0x10000000)        /*!<Bit 3 */
-#define  ADC_SQR3_SQ6_4                      ((uint32_t)0x20000000)        /*!<Bit 4 */
-
-/*******************  Bit definition for ADC_JSQR register  *******************/
-#define  ADC_JSQR_JSQ1                       ((uint32_t)0x0000001F)        /*!<JSQ1[4:0] bits (1st conversion in injected sequence) */  
-#define  ADC_JSQR_JSQ1_0                     ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  ADC_JSQR_JSQ1_1                     ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  ADC_JSQR_JSQ1_2                     ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  ADC_JSQR_JSQ1_3                     ((uint32_t)0x00000008)        /*!<Bit 3 */
-#define  ADC_JSQR_JSQ1_4                     ((uint32_t)0x00000010)        /*!<Bit 4 */
-#define  ADC_JSQR_JSQ2                       ((uint32_t)0x000003E0)        /*!<JSQ2[4:0] bits (2nd conversion in injected sequence) */
-#define  ADC_JSQR_JSQ2_0                     ((uint32_t)0x00000020)        /*!<Bit 0 */
-#define  ADC_JSQR_JSQ2_1                     ((uint32_t)0x00000040)        /*!<Bit 1 */
-#define  ADC_JSQR_JSQ2_2                     ((uint32_t)0x00000080)        /*!<Bit 2 */
-#define  ADC_JSQR_JSQ2_3                     ((uint32_t)0x00000100)        /*!<Bit 3 */
-#define  ADC_JSQR_JSQ2_4                     ((uint32_t)0x00000200)        /*!<Bit 4 */
-#define  ADC_JSQR_JSQ3                       ((uint32_t)0x00007C00)        /*!<JSQ3[4:0] bits (3rd conversion in injected sequence) */
-#define  ADC_JSQR_JSQ3_0                     ((uint32_t)0x00000400)        /*!<Bit 0 */
-#define  ADC_JSQR_JSQ3_1                     ((uint32_t)0x00000800)        /*!<Bit 1 */
-#define  ADC_JSQR_JSQ3_2                     ((uint32_t)0x00001000)        /*!<Bit 2 */
-#define  ADC_JSQR_JSQ3_3                     ((uint32_t)0x00002000)        /*!<Bit 3 */
-#define  ADC_JSQR_JSQ3_4                     ((uint32_t)0x00004000)        /*!<Bit 4 */
-#define  ADC_JSQR_JSQ4                       ((uint32_t)0x000F8000)        /*!<JSQ4[4:0] bits (4th conversion in injected sequence) */
-#define  ADC_JSQR_JSQ4_0                     ((uint32_t)0x00008000)        /*!<Bit 0 */
-#define  ADC_JSQR_JSQ4_1                     ((uint32_t)0x00010000)        /*!<Bit 1 */
-#define  ADC_JSQR_JSQ4_2                     ((uint32_t)0x00020000)        /*!<Bit 2 */
-#define  ADC_JSQR_JSQ4_3                     ((uint32_t)0x00040000)        /*!<Bit 3 */
-#define  ADC_JSQR_JSQ4_4                     ((uint32_t)0x00080000)        /*!<Bit 4 */
-#define  ADC_JSQR_JL                         ((uint32_t)0x00300000)        /*!<JL[1:0] bits (Injected Sequence length) */
-#define  ADC_JSQR_JL_0                       ((uint32_t)0x00100000)        /*!<Bit 0 */
-#define  ADC_JSQR_JL_1                       ((uint32_t)0x00200000)        /*!<Bit 1 */
-
-/*******************  Bit definition for ADC_JDR1 register  *******************/
-#define  ADC_JDR1_JDATA                      ((uint16_t)0xFFFF)            /*!<Injected data */
-
-/*******************  Bit definition for ADC_JDR2 register  *******************/
-#define  ADC_JDR2_JDATA                      ((uint16_t)0xFFFF)            /*!<Injected data */
-
-/*******************  Bit definition for ADC_JDR3 register  *******************/
-#define  ADC_JDR3_JDATA                      ((uint16_t)0xFFFF)            /*!<Injected data */
-
-/*******************  Bit definition for ADC_JDR4 register  *******************/
-#define  ADC_JDR4_JDATA                      ((uint16_t)0xFFFF)            /*!<Injected data */
-
-/********************  Bit definition for ADC_DR register  ********************/
-#define  ADC_DR_DATA                         ((uint32_t)0x0000FFFF)        /*!<Regular data */
-#define  ADC_DR_ADC2DATA                     ((uint32_t)0xFFFF0000)        /*!<ADC2 data */
-
-/*******************  Bit definition for ADC_CSR register  ********************/
-#define  ADC_CSR_AWD1                        ((uint32_t)0x00000001)        /*!<ADC1 Analog watchdog flag */
-#define  ADC_CSR_EOC1                        ((uint32_t)0x00000002)        /*!<ADC1 End of conversion */
-#define  ADC_CSR_JEOC1                       ((uint32_t)0x00000004)        /*!<ADC1 Injected channel end of conversion */
-#define  ADC_CSR_JSTRT1                      ((uint32_t)0x00000008)        /*!<ADC1 Injected channel Start flag */
-#define  ADC_CSR_STRT1                       ((uint32_t)0x00000010)        /*!<ADC1 Regular channel Start flag */
-#define  ADC_CSR_DOVR1                       ((uint32_t)0x00000020)        /*!<ADC1 DMA overrun  flag */
-#define  ADC_CSR_AWD2                        ((uint32_t)0x00000100)        /*!<ADC2 Analog watchdog flag */
-#define  ADC_CSR_EOC2                        ((uint32_t)0x00000200)        /*!<ADC2 End of conversion */
-#define  ADC_CSR_JEOC2                       ((uint32_t)0x00000400)        /*!<ADC2 Injected channel end of conversion */
-#define  ADC_CSR_JSTRT2                      ((uint32_t)0x00000800)        /*!<ADC2 Injected channel Start flag */
-#define  ADC_CSR_STRT2                       ((uint32_t)0x00001000)        /*!<ADC2 Regular channel Start flag */
-#define  ADC_CSR_DOVR2                       ((uint32_t)0x00002000)        /*!<ADC2 DMA overrun  flag */
-#define  ADC_CSR_AWD3                        ((uint32_t)0x00010000)        /*!<ADC3 Analog watchdog flag */
-#define  ADC_CSR_EOC3                        ((uint32_t)0x00020000)        /*!<ADC3 End of conversion */
-#define  ADC_CSR_JEOC3                       ((uint32_t)0x00040000)        /*!<ADC3 Injected channel end of conversion */
-#define  ADC_CSR_JSTRT3                      ((uint32_t)0x00080000)        /*!<ADC3 Injected channel Start flag */
-#define  ADC_CSR_STRT3                       ((uint32_t)0x00100000)        /*!<ADC3 Regular channel Start flag */
-#define  ADC_CSR_DOVR3                       ((uint32_t)0x00200000)        /*!<ADC3 DMA overrun  flag */
-
-/*******************  Bit definition for ADC_CCR register  ********************/
-#define  ADC_CCR_MULTI                       ((uint32_t)0x0000001F)        /*!<MULTI[4:0] bits (Multi-ADC mode selection) */  
-#define  ADC_CCR_MULTI_0                     ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  ADC_CCR_MULTI_1                     ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  ADC_CCR_MULTI_2                     ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  ADC_CCR_MULTI_3                     ((uint32_t)0x00000008)        /*!<Bit 3 */
-#define  ADC_CCR_MULTI_4                     ((uint32_t)0x00000010)        /*!<Bit 4 */
-#define  ADC_CCR_DELAY                       ((uint32_t)0x00000F00)        /*!<DELAY[3:0] bits (Delay between 2 sampling phases) */  
-#define  ADC_CCR_DELAY_0                     ((uint32_t)0x00000100)        /*!<Bit 0 */
-#define  ADC_CCR_DELAY_1                     ((uint32_t)0x00000200)        /*!<Bit 1 */
-#define  ADC_CCR_DELAY_2                     ((uint32_t)0x00000400)        /*!<Bit 2 */
-#define  ADC_CCR_DELAY_3                     ((uint32_t)0x00000800)        /*!<Bit 3 */
-#define  ADC_CCR_DDS                         ((uint32_t)0x00002000)        /*!<DMA disable selection (Multi-ADC mode) */
-#define  ADC_CCR_DMA                         ((uint32_t)0x0000C000)        /*!<DMA[1:0] bits (Direct Memory Access mode for multimode) */  
-#define  ADC_CCR_DMA_0                       ((uint32_t)0x00004000)        /*!<Bit 0 */
-#define  ADC_CCR_DMA_1                       ((uint32_t)0x00008000)        /*!<Bit 1 */
-#define  ADC_CCR_ADCPRE                      ((uint32_t)0x00030000)        /*!<ADCPRE[1:0] bits (ADC prescaler) */  
-#define  ADC_CCR_ADCPRE_0                    ((uint32_t)0x00010000)        /*!<Bit 0 */
-#define  ADC_CCR_ADCPRE_1                    ((uint32_t)0x00020000)        /*!<Bit 1 */
-#define  ADC_CCR_VBATE                       ((uint32_t)0x00400000)        /*!<VBAT Enable */
-#define  ADC_CCR_TSVREFE                     ((uint32_t)0x00800000)        /*!<Temperature Sensor and VREFINT Enable */
-
-/*******************  Bit definition for ADC_CDR register  ********************/
-#define  ADC_CDR_DATA1                      ((uint32_t)0x0000FFFF)         /*!<1st data of a pair of regular conversions */
-#define  ADC_CDR_DATA2                      ((uint32_t)0xFFFF0000)         /*!<2nd data of a pair of regular conversions */
-
-/******************************************************************************/
-/*                                                                            */
-/*                         Controller Area Network                            */
-/*                                                                            */
-/******************************************************************************/
-/*!<CAN control and status registers */
-/*******************  Bit definition for CAN_MCR register  ********************/
-#define  CAN_MCR_INRQ                        ((uint16_t)0x0001)            /*!<Initialization Request */
-#define  CAN_MCR_SLEEP                       ((uint16_t)0x0002)            /*!<Sleep Mode Request */
-#define  CAN_MCR_TXFP                        ((uint16_t)0x0004)            /*!<Transmit FIFO Priority */
-#define  CAN_MCR_RFLM                        ((uint16_t)0x0008)            /*!<Receive FIFO Locked Mode */
-#define  CAN_MCR_NART                        ((uint16_t)0x0010)            /*!<No Automatic Retransmission */
-#define  CAN_MCR_AWUM                        ((uint16_t)0x0020)            /*!<Automatic Wakeup Mode */
-#define  CAN_MCR_ABOM                        ((uint16_t)0x0040)            /*!<Automatic Bus-Off Management */
-#define  CAN_MCR_TTCM                        ((uint16_t)0x0080)            /*!<Time Triggered Communication Mode */
-#define  CAN_MCR_RESET                       ((uint16_t)0x8000)            /*!<bxCAN software master reset */
-
-/*******************  Bit definition for CAN_MSR register  ********************/
-#define  CAN_MSR_INAK                        ((uint16_t)0x0001)            /*!<Initialization Acknowledge */
-#define  CAN_MSR_SLAK                        ((uint16_t)0x0002)            /*!<Sleep Acknowledge */
-#define  CAN_MSR_ERRI                        ((uint16_t)0x0004)            /*!<Error Interrupt */
-#define  CAN_MSR_WKUI                        ((uint16_t)0x0008)            /*!<Wakeup Interrupt */
-#define  CAN_MSR_SLAKI                       ((uint16_t)0x0010)            /*!<Sleep Acknowledge Interrupt */
-#define  CAN_MSR_TXM                         ((uint16_t)0x0100)            /*!<Transmit Mode */
-#define  CAN_MSR_RXM                         ((uint16_t)0x0200)            /*!<Receive Mode */
-#define  CAN_MSR_SAMP                        ((uint16_t)0x0400)            /*!<Last Sample Point */
-#define  CAN_MSR_RX                          ((uint16_t)0x0800)            /*!<CAN Rx Signal */
-
-/*******************  Bit definition for CAN_TSR register  ********************/
-#define  CAN_TSR_RQCP0                       ((uint32_t)0x00000001)        /*!<Request Completed Mailbox0 */
-#define  CAN_TSR_TXOK0                       ((uint32_t)0x00000002)        /*!<Transmission OK of Mailbox0 */
-#define  CAN_TSR_ALST0                       ((uint32_t)0x00000004)        /*!<Arbitration Lost for Mailbox0 */
-#define  CAN_TSR_TERR0                       ((uint32_t)0x00000008)        /*!<Transmission Error of Mailbox0 */
-#define  CAN_TSR_ABRQ0                       ((uint32_t)0x00000080)        /*!<Abort Request for Mailbox0 */
-#define  CAN_TSR_RQCP1                       ((uint32_t)0x00000100)        /*!<Request Completed Mailbox1 */
-#define  CAN_TSR_TXOK1                       ((uint32_t)0x00000200)        /*!<Transmission OK of Mailbox1 */
-#define  CAN_TSR_ALST1                       ((uint32_t)0x00000400)        /*!<Arbitration Lost for Mailbox1 */
-#define  CAN_TSR_TERR1                       ((uint32_t)0x00000800)        /*!<Transmission Error of Mailbox1 */
-#define  CAN_TSR_ABRQ1                       ((uint32_t)0x00008000)        /*!<Abort Request for Mailbox 1 */
-#define  CAN_TSR_RQCP2                       ((uint32_t)0x00010000)        /*!<Request Completed Mailbox2 */
-#define  CAN_TSR_TXOK2                       ((uint32_t)0x00020000)        /*!<Transmission OK of Mailbox 2 */
-#define  CAN_TSR_ALST2                       ((uint32_t)0x00040000)        /*!<Arbitration Lost for mailbox 2 */
-#define  CAN_TSR_TERR2                       ((uint32_t)0x00080000)        /*!<Transmission Error of Mailbox 2 */
-#define  CAN_TSR_ABRQ2                       ((uint32_t)0x00800000)        /*!<Abort Request for Mailbox 2 */
-#define  CAN_TSR_CODE                        ((uint32_t)0x03000000)        /*!<Mailbox Code */
-
-#define  CAN_TSR_TME                         ((uint32_t)0x1C000000)        /*!<TME[2:0] bits */
-#define  CAN_TSR_TME0                        ((uint32_t)0x04000000)        /*!<Transmit Mailbox 0 Empty */
-#define  CAN_TSR_TME1                        ((uint32_t)0x08000000)        /*!<Transmit Mailbox 1 Empty */
-#define  CAN_TSR_TME2                        ((uint32_t)0x10000000)        /*!<Transmit Mailbox 2 Empty */
-
-#define  CAN_TSR_LOW                         ((uint32_t)0xE0000000)        /*!<LOW[2:0] bits */
-#define  CAN_TSR_LOW0                        ((uint32_t)0x20000000)        /*!<Lowest Priority Flag for Mailbox 0 */
-#define  CAN_TSR_LOW1                        ((uint32_t)0x40000000)        /*!<Lowest Priority Flag for Mailbox 1 */
-#define  CAN_TSR_LOW2                        ((uint32_t)0x80000000)        /*!<Lowest Priority Flag for Mailbox 2 */
-
-/*******************  Bit definition for CAN_RF0R register  *******************/
-#define  CAN_RF0R_FMP0                       ((uint8_t)0x03)               /*!<FIFO 0 Message Pending */
-#define  CAN_RF0R_FULL0                      ((uint8_t)0x08)               /*!<FIFO 0 Full */
-#define  CAN_RF0R_FOVR0                      ((uint8_t)0x10)               /*!<FIFO 0 Overrun */
-#define  CAN_RF0R_RFOM0                      ((uint8_t)0x20)               /*!<Release FIFO 0 Output Mailbox */
-
-/*******************  Bit definition for CAN_RF1R register  *******************/
-#define  CAN_RF1R_FMP1                       ((uint8_t)0x03)               /*!<FIFO 1 Message Pending */
-#define  CAN_RF1R_FULL1                      ((uint8_t)0x08)               /*!<FIFO 1 Full */
-#define  CAN_RF1R_FOVR1                      ((uint8_t)0x10)               /*!<FIFO 1 Overrun */
-#define  CAN_RF1R_RFOM1                      ((uint8_t)0x20)               /*!<Release FIFO 1 Output Mailbox */
-
-/********************  Bit definition for CAN_IER register  *******************/
-#define  CAN_IER_TMEIE                       ((uint32_t)0x00000001)        /*!<Transmit Mailbox Empty Interrupt Enable */
-#define  CAN_IER_FMPIE0                      ((uint32_t)0x00000002)        /*!<FIFO Message Pending Interrupt Enable */
-#define  CAN_IER_FFIE0                       ((uint32_t)0x00000004)        /*!<FIFO Full Interrupt Enable */
-#define  CAN_IER_FOVIE0                      ((uint32_t)0x00000008)        /*!<FIFO Overrun Interrupt Enable */
-#define  CAN_IER_FMPIE1                      ((uint32_t)0x00000010)        /*!<FIFO Message Pending Interrupt Enable */
-#define  CAN_IER_FFIE1                       ((uint32_t)0x00000020)        /*!<FIFO Full Interrupt Enable */
-#define  CAN_IER_FOVIE1                      ((uint32_t)0x00000040)        /*!<FIFO Overrun Interrupt Enable */
-#define  CAN_IER_EWGIE                       ((uint32_t)0x00000100)        /*!<Error Warning Interrupt Enable */
-#define  CAN_IER_EPVIE                       ((uint32_t)0x00000200)        /*!<Error Passive Interrupt Enable */
-#define  CAN_IER_BOFIE                       ((uint32_t)0x00000400)        /*!<Bus-Off Interrupt Enable */
-#define  CAN_IER_LECIE                       ((uint32_t)0x00000800)        /*!<Last Error Code Interrupt Enable */
-#define  CAN_IER_ERRIE                       ((uint32_t)0x00008000)        /*!<Error Interrupt Enable */
-#define  CAN_IER_WKUIE                       ((uint32_t)0x00010000)        /*!<Wakeup Interrupt Enable */
-#define  CAN_IER_SLKIE                       ((uint32_t)0x00020000)        /*!<Sleep Interrupt Enable */
-
-/********************  Bit definition for CAN_ESR register  *******************/
-#define  CAN_ESR_EWGF                        ((uint32_t)0x00000001)        /*!<Error Warning Flag */
-#define  CAN_ESR_EPVF                        ((uint32_t)0x00000002)        /*!<Error Passive Flag */
-#define  CAN_ESR_BOFF                        ((uint32_t)0x00000004)        /*!<Bus-Off Flag */
-
-#define  CAN_ESR_LEC                         ((uint32_t)0x00000070)        /*!<LEC[2:0] bits (Last Error Code) */
-#define  CAN_ESR_LEC_0                       ((uint32_t)0x00000010)        /*!<Bit 0 */
-#define  CAN_ESR_LEC_1                       ((uint32_t)0x00000020)        /*!<Bit 1 */
-#define  CAN_ESR_LEC_2                       ((uint32_t)0x00000040)        /*!<Bit 2 */
-
-#define  CAN_ESR_TEC                         ((uint32_t)0x00FF0000)        /*!<Least significant byte of the 9-bit Transmit Error Counter */
-#define  CAN_ESR_REC                         ((uint32_t)0xFF000000)        /*!<Receive Error Counter */
-
-/*******************  Bit definition for CAN_BTR register  ********************/
-#define  CAN_BTR_BRP                         ((uint32_t)0x000003FF)        /*!<Baud Rate Prescaler */
-#define  CAN_BTR_TS1                         ((uint32_t)0x000F0000)        /*!<Time Segment 1 */
-#define  CAN_BTR_TS2                         ((uint32_t)0x00700000)        /*!<Time Segment 2 */
-#define  CAN_BTR_SJW                         ((uint32_t)0x03000000)        /*!<Resynchronization Jump Width */
-#define  CAN_BTR_LBKM                        ((uint32_t)0x40000000)        /*!<Loop Back Mode (Debug) */
-#define  CAN_BTR_SILM                        ((uint32_t)0x80000000)        /*!<Silent Mode */
-
-/*!<Mailbox registers */
-/******************  Bit definition for CAN_TI0R register  ********************/
-#define  CAN_TI0R_TXRQ                       ((uint32_t)0x00000001)        /*!<Transmit Mailbox Request */
-#define  CAN_TI0R_RTR                        ((uint32_t)0x00000002)        /*!<Remote Transmission Request */
-#define  CAN_TI0R_IDE                        ((uint32_t)0x00000004)        /*!<Identifier Extension */
-#define  CAN_TI0R_EXID                       ((uint32_t)0x001FFFF8)        /*!<Extended Identifier */
-#define  CAN_TI0R_STID                       ((uint32_t)0xFFE00000)        /*!<Standard Identifier or Extended Identifier */
-
-/******************  Bit definition for CAN_TDT0R register  *******************/
-#define  CAN_TDT0R_DLC                       ((uint32_t)0x0000000F)        /*!<Data Length Code */
-#define  CAN_TDT0R_TGT                       ((uint32_t)0x00000100)        /*!<Transmit Global Time */
-#define  CAN_TDT0R_TIME                      ((uint32_t)0xFFFF0000)        /*!<Message Time Stamp */
-
-/******************  Bit definition for CAN_TDL0R register  *******************/
-#define  CAN_TDL0R_DATA0                     ((uint32_t)0x000000FF)        /*!<Data byte 0 */
-#define  CAN_TDL0R_DATA1                     ((uint32_t)0x0000FF00)        /*!<Data byte 1 */
-#define  CAN_TDL0R_DATA2                     ((uint32_t)0x00FF0000)        /*!<Data byte 2 */
-#define  CAN_TDL0R_DATA3                     ((uint32_t)0xFF000000)        /*!<Data byte 3 */
-
-/******************  Bit definition for CAN_TDH0R register  *******************/
-#define  CAN_TDH0R_DATA4                     ((uint32_t)0x000000FF)        /*!<Data byte 4 */
-#define  CAN_TDH0R_DATA5                     ((uint32_t)0x0000FF00)        /*!<Data byte 5 */
-#define  CAN_TDH0R_DATA6                     ((uint32_t)0x00FF0000)        /*!<Data byte 6 */
-#define  CAN_TDH0R_DATA7                     ((uint32_t)0xFF000000)        /*!<Data byte 7 */
-
-/*******************  Bit definition for CAN_TI1R register  *******************/
-#define  CAN_TI1R_TXRQ                       ((uint32_t)0x00000001)        /*!<Transmit Mailbox Request */
-#define  CAN_TI1R_RTR                        ((uint32_t)0x00000002)        /*!<Remote Transmission Request */
-#define  CAN_TI1R_IDE                        ((uint32_t)0x00000004)        /*!<Identifier Extension */
-#define  CAN_TI1R_EXID                       ((uint32_t)0x001FFFF8)        /*!<Extended Identifier */
-#define  CAN_TI1R_STID                       ((uint32_t)0xFFE00000)        /*!<Standard Identifier or Extended Identifier */
-
-/*******************  Bit definition for CAN_TDT1R register  ******************/
-#define  CAN_TDT1R_DLC                       ((uint32_t)0x0000000F)        /*!<Data Length Code */
-#define  CAN_TDT1R_TGT                       ((uint32_t)0x00000100)        /*!<Transmit Global Time */
-#define  CAN_TDT1R_TIME                      ((uint32_t)0xFFFF0000)        /*!<Message Time Stamp */
-
-/*******************  Bit definition for CAN_TDL1R register  ******************/
-#define  CAN_TDL1R_DATA0                     ((uint32_t)0x000000FF)        /*!<Data byte 0 */
-#define  CAN_TDL1R_DATA1                     ((uint32_t)0x0000FF00)        /*!<Data byte 1 */
-#define  CAN_TDL1R_DATA2                     ((uint32_t)0x00FF0000)        /*!<Data byte 2 */
-#define  CAN_TDL1R_DATA3                     ((uint32_t)0xFF000000)        /*!<Data byte 3 */
-
-/*******************  Bit definition for CAN_TDH1R register  ******************/
-#define  CAN_TDH1R_DATA4                     ((uint32_t)0x000000FF)        /*!<Data byte 4 */
-#define  CAN_TDH1R_DATA5                     ((uint32_t)0x0000FF00)        /*!<Data byte 5 */
-#define  CAN_TDH1R_DATA6                     ((uint32_t)0x00FF0000)        /*!<Data byte 6 */
-#define  CAN_TDH1R_DATA7                     ((uint32_t)0xFF000000)        /*!<Data byte 7 */
-
-/*******************  Bit definition for CAN_TI2R register  *******************/
-#define  CAN_TI2R_TXRQ                       ((uint32_t)0x00000001)        /*!<Transmit Mailbox Request */
-#define  CAN_TI2R_RTR                        ((uint32_t)0x00000002)        /*!<Remote Transmission Request */
-#define  CAN_TI2R_IDE                        ((uint32_t)0x00000004)        /*!<Identifier Extension */
-#define  CAN_TI2R_EXID                       ((uint32_t)0x001FFFF8)        /*!<Extended identifier */
-#define  CAN_TI2R_STID                       ((uint32_t)0xFFE00000)        /*!<Standard Identifier or Extended Identifier */
-
-/*******************  Bit definition for CAN_TDT2R register  ******************/  
-#define  CAN_TDT2R_DLC                       ((uint32_t)0x0000000F)        /*!<Data Length Code */
-#define  CAN_TDT2R_TGT                       ((uint32_t)0x00000100)        /*!<Transmit Global Time */
-#define  CAN_TDT2R_TIME                      ((uint32_t)0xFFFF0000)        /*!<Message Time Stamp */
-
-/*******************  Bit definition for CAN_TDL2R register  ******************/
-#define  CAN_TDL2R_DATA0                     ((uint32_t)0x000000FF)        /*!<Data byte 0 */
-#define  CAN_TDL2R_DATA1                     ((uint32_t)0x0000FF00)        /*!<Data byte 1 */
-#define  CAN_TDL2R_DATA2                     ((uint32_t)0x00FF0000)        /*!<Data byte 2 */
-#define  CAN_TDL2R_DATA3                     ((uint32_t)0xFF000000)        /*!<Data byte 3 */
-
-/*******************  Bit definition for CAN_TDH2R register  ******************/
-#define  CAN_TDH2R_DATA4                     ((uint32_t)0x000000FF)        /*!<Data byte 4 */
-#define  CAN_TDH2R_DATA5                     ((uint32_t)0x0000FF00)        /*!<Data byte 5 */
-#define  CAN_TDH2R_DATA6                     ((uint32_t)0x00FF0000)        /*!<Data byte 6 */
-#define  CAN_TDH2R_DATA7                     ((uint32_t)0xFF000000)        /*!<Data byte 7 */
-
-/*******************  Bit definition for CAN_RI0R register  *******************/
-#define  CAN_RI0R_RTR                        ((uint32_t)0x00000002)        /*!<Remote Transmission Request */
-#define  CAN_RI0R_IDE                        ((uint32_t)0x00000004)        /*!<Identifier Extension */
-#define  CAN_RI0R_EXID                       ((uint32_t)0x001FFFF8)        /*!<Extended Identifier */
-#define  CAN_RI0R_STID                       ((uint32_t)0xFFE00000)        /*!<Standard Identifier or Extended Identifier */
-
-/*******************  Bit definition for CAN_RDT0R register  ******************/
-#define  CAN_RDT0R_DLC                       ((uint32_t)0x0000000F)        /*!<Data Length Code */
-#define  CAN_RDT0R_FMI                       ((uint32_t)0x0000FF00)        /*!<Filter Match Index */
-#define  CAN_RDT0R_TIME                      ((uint32_t)0xFFFF0000)        /*!<Message Time Stamp */
-
-/*******************  Bit definition for CAN_RDL0R register  ******************/
-#define  CAN_RDL0R_DATA0                     ((uint32_t)0x000000FF)        /*!<Data byte 0 */
-#define  CAN_RDL0R_DATA1                     ((uint32_t)0x0000FF00)        /*!<Data byte 1 */
-#define  CAN_RDL0R_DATA2                     ((uint32_t)0x00FF0000)        /*!<Data byte 2 */
-#define  CAN_RDL0R_DATA3                     ((uint32_t)0xFF000000)        /*!<Data byte 3 */
-
-/*******************  Bit definition for CAN_RDH0R register  ******************/
-#define  CAN_RDH0R_DATA4                     ((uint32_t)0x000000FF)        /*!<Data byte 4 */
-#define  CAN_RDH0R_DATA5                     ((uint32_t)0x0000FF00)        /*!<Data byte 5 */
-#define  CAN_RDH0R_DATA6                     ((uint32_t)0x00FF0000)        /*!<Data byte 6 */
-#define  CAN_RDH0R_DATA7                     ((uint32_t)0xFF000000)        /*!<Data byte 7 */
-
-/*******************  Bit definition for CAN_RI1R register  *******************/
-#define  CAN_RI1R_RTR                        ((uint32_t)0x00000002)        /*!<Remote Transmission Request */
-#define  CAN_RI1R_IDE                        ((uint32_t)0x00000004)        /*!<Identifier Extension */
-#define  CAN_RI1R_EXID                       ((uint32_t)0x001FFFF8)        /*!<Extended identifier */
-#define  CAN_RI1R_STID                       ((uint32_t)0xFFE00000)        /*!<Standard Identifier or Extended Identifier */
-
-/*******************  Bit definition for CAN_RDT1R register  ******************/
-#define  CAN_RDT1R_DLC                       ((uint32_t)0x0000000F)        /*!<Data Length Code */
-#define  CAN_RDT1R_FMI                       ((uint32_t)0x0000FF00)        /*!<Filter Match Index */
-#define  CAN_RDT1R_TIME                      ((uint32_t)0xFFFF0000)        /*!<Message Time Stamp */
-
-/*******************  Bit definition for CAN_RDL1R register  ******************/
-#define  CAN_RDL1R_DATA0                     ((uint32_t)0x000000FF)        /*!<Data byte 0 */
-#define  CAN_RDL1R_DATA1                     ((uint32_t)0x0000FF00)        /*!<Data byte 1 */
-#define  CAN_RDL1R_DATA2                     ((uint32_t)0x00FF0000)        /*!<Data byte 2 */
-#define  CAN_RDL1R_DATA3                     ((uint32_t)0xFF000000)        /*!<Data byte 3 */
-
-/*******************  Bit definition for CAN_RDH1R register  ******************/
-#define  CAN_RDH1R_DATA4                     ((uint32_t)0x000000FF)        /*!<Data byte 4 */
-#define  CAN_RDH1R_DATA5                     ((uint32_t)0x0000FF00)        /*!<Data byte 5 */
-#define  CAN_RDH1R_DATA6                     ((uint32_t)0x00FF0000)        /*!<Data byte 6 */
-#define  CAN_RDH1R_DATA7                     ((uint32_t)0xFF000000)        /*!<Data byte 7 */
-
-/*!<CAN filter registers */
-/*******************  Bit definition for CAN_FMR register  ********************/
-#define  CAN_FMR_FINIT                       ((uint8_t)0x01)               /*!<Filter Init Mode */
-
-/*******************  Bit definition for CAN_FM1R register  *******************/
-#define  CAN_FM1R_FBM                        ((uint16_t)0x3FFF)            /*!<Filter Mode */
-#define  CAN_FM1R_FBM0                       ((uint16_t)0x0001)            /*!<Filter Init Mode bit 0 */
-#define  CAN_FM1R_FBM1                       ((uint16_t)0x0002)            /*!<Filter Init Mode bit 1 */
-#define  CAN_FM1R_FBM2                       ((uint16_t)0x0004)            /*!<Filter Init Mode bit 2 */
-#define  CAN_FM1R_FBM3                       ((uint16_t)0x0008)            /*!<Filter Init Mode bit 3 */
-#define  CAN_FM1R_FBM4                       ((uint16_t)0x0010)            /*!<Filter Init Mode bit 4 */
-#define  CAN_FM1R_FBM5                       ((uint16_t)0x0020)            /*!<Filter Init Mode bit 5 */
-#define  CAN_FM1R_FBM6                       ((uint16_t)0x0040)            /*!<Filter Init Mode bit 6 */
-#define  CAN_FM1R_FBM7                       ((uint16_t)0x0080)            /*!<Filter Init Mode bit 7 */
-#define  CAN_FM1R_FBM8                       ((uint16_t)0x0100)            /*!<Filter Init Mode bit 8 */
-#define  CAN_FM1R_FBM9                       ((uint16_t)0x0200)            /*!<Filter Init Mode bit 9 */
-#define  CAN_FM1R_FBM10                      ((uint16_t)0x0400)            /*!<Filter Init Mode bit 10 */
-#define  CAN_FM1R_FBM11                      ((uint16_t)0x0800)            /*!<Filter Init Mode bit 11 */
-#define  CAN_FM1R_FBM12                      ((uint16_t)0x1000)            /*!<Filter Init Mode bit 12 */
-#define  CAN_FM1R_FBM13                      ((uint16_t)0x2000)            /*!<Filter Init Mode bit 13 */
-
-/*******************  Bit definition for CAN_FS1R register  *******************/
-#define  CAN_FS1R_FSC                        ((uint16_t)0x3FFF)            /*!<Filter Scale Configuration */
-#define  CAN_FS1R_FSC0                       ((uint16_t)0x0001)            /*!<Filter Scale Configuration bit 0 */
-#define  CAN_FS1R_FSC1                       ((uint16_t)0x0002)            /*!<Filter Scale Configuration bit 1 */
-#define  CAN_FS1R_FSC2                       ((uint16_t)0x0004)            /*!<Filter Scale Configuration bit 2 */
-#define  CAN_FS1R_FSC3                       ((uint16_t)0x0008)            /*!<Filter Scale Configuration bit 3 */
-#define  CAN_FS1R_FSC4                       ((uint16_t)0x0010)            /*!<Filter Scale Configuration bit 4 */
-#define  CAN_FS1R_FSC5                       ((uint16_t)0x0020)            /*!<Filter Scale Configuration bit 5 */
-#define  CAN_FS1R_FSC6                       ((uint16_t)0x0040)            /*!<Filter Scale Configuration bit 6 */
-#define  CAN_FS1R_FSC7                       ((uint16_t)0x0080)            /*!<Filter Scale Configuration bit 7 */
-#define  CAN_FS1R_FSC8                       ((uint16_t)0x0100)            /*!<Filter Scale Configuration bit 8 */
-#define  CAN_FS1R_FSC9                       ((uint16_t)0x0200)            /*!<Filter Scale Configuration bit 9 */
-#define  CAN_FS1R_FSC10                      ((uint16_t)0x0400)            /*!<Filter Scale Configuration bit 10 */
-#define  CAN_FS1R_FSC11                      ((uint16_t)0x0800)            /*!<Filter Scale Configuration bit 11 */
-#define  CAN_FS1R_FSC12                      ((uint16_t)0x1000)            /*!<Filter Scale Configuration bit 12 */
-#define  CAN_FS1R_FSC13                      ((uint16_t)0x2000)            /*!<Filter Scale Configuration bit 13 */
-
-/******************  Bit definition for CAN_FFA1R register  *******************/
-#define  CAN_FFA1R_FFA                       ((uint16_t)0x3FFF)            /*!<Filter FIFO Assignment */
-#define  CAN_FFA1R_FFA0                      ((uint16_t)0x0001)            /*!<Filter FIFO Assignment for Filter 0 */
-#define  CAN_FFA1R_FFA1                      ((uint16_t)0x0002)            /*!<Filter FIFO Assignment for Filter 1 */
-#define  CAN_FFA1R_FFA2                      ((uint16_t)0x0004)            /*!<Filter FIFO Assignment for Filter 2 */
-#define  CAN_FFA1R_FFA3                      ((uint16_t)0x0008)            /*!<Filter FIFO Assignment for Filter 3 */
-#define  CAN_FFA1R_FFA4                      ((uint16_t)0x0010)            /*!<Filter FIFO Assignment for Filter 4 */
-#define  CAN_FFA1R_FFA5                      ((uint16_t)0x0020)            /*!<Filter FIFO Assignment for Filter 5 */
-#define  CAN_FFA1R_FFA6                      ((uint16_t)0x0040)            /*!<Filter FIFO Assignment for Filter 6 */
-#define  CAN_FFA1R_FFA7                      ((uint16_t)0x0080)            /*!<Filter FIFO Assignment for Filter 7 */
-#define  CAN_FFA1R_FFA8                      ((uint16_t)0x0100)            /*!<Filter FIFO Assignment for Filter 8 */
-#define  CAN_FFA1R_FFA9                      ((uint16_t)0x0200)            /*!<Filter FIFO Assignment for Filter 9 */
-#define  CAN_FFA1R_FFA10                     ((uint16_t)0x0400)            /*!<Filter FIFO Assignment for Filter 10 */
-#define  CAN_FFA1R_FFA11                     ((uint16_t)0x0800)            /*!<Filter FIFO Assignment for Filter 11 */
-#define  CAN_FFA1R_FFA12                     ((uint16_t)0x1000)            /*!<Filter FIFO Assignment for Filter 12 */
-#define  CAN_FFA1R_FFA13                     ((uint16_t)0x2000)            /*!<Filter FIFO Assignment for Filter 13 */
-
-/*******************  Bit definition for CAN_FA1R register  *******************/
-#define  CAN_FA1R_FACT                       ((uint16_t)0x3FFF)            /*!<Filter Active */
-#define  CAN_FA1R_FACT0                      ((uint16_t)0x0001)            /*!<Filter 0 Active */
-#define  CAN_FA1R_FACT1                      ((uint16_t)0x0002)            /*!<Filter 1 Active */
-#define  CAN_FA1R_FACT2                      ((uint16_t)0x0004)            /*!<Filter 2 Active */
-#define  CAN_FA1R_FACT3                      ((uint16_t)0x0008)            /*!<Filter 3 Active */
-#define  CAN_FA1R_FACT4                      ((uint16_t)0x0010)            /*!<Filter 4 Active */
-#define  CAN_FA1R_FACT5                      ((uint16_t)0x0020)            /*!<Filter 5 Active */
-#define  CAN_FA1R_FACT6                      ((uint16_t)0x0040)            /*!<Filter 6 Active */
-#define  CAN_FA1R_FACT7                      ((uint16_t)0x0080)            /*!<Filter 7 Active */
-#define  CAN_FA1R_FACT8                      ((uint16_t)0x0100)            /*!<Filter 8 Active */
-#define  CAN_FA1R_FACT9                      ((uint16_t)0x0200)            /*!<Filter 9 Active */
-#define  CAN_FA1R_FACT10                     ((uint16_t)0x0400)            /*!<Filter 10 Active */
-#define  CAN_FA1R_FACT11                     ((uint16_t)0x0800)            /*!<Filter 11 Active */
-#define  CAN_FA1R_FACT12                     ((uint16_t)0x1000)            /*!<Filter 12 Active */
-#define  CAN_FA1R_FACT13                     ((uint16_t)0x2000)            /*!<Filter 13 Active */
-
-/*******************  Bit definition for CAN_F0R1 register  *******************/
-#define  CAN_F0R1_FB0                        ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F0R1_FB1                        ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F0R1_FB2                        ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F0R1_FB3                        ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F0R1_FB4                        ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F0R1_FB5                        ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F0R1_FB6                        ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F0R1_FB7                        ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F0R1_FB8                        ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F0R1_FB9                        ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F0R1_FB10                       ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F0R1_FB11                       ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F0R1_FB12                       ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F0R1_FB13                       ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F0R1_FB14                       ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F0R1_FB15                       ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F0R1_FB16                       ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F0R1_FB17                       ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F0R1_FB18                       ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F0R1_FB19                       ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F0R1_FB20                       ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F0R1_FB21                       ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F0R1_FB22                       ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F0R1_FB23                       ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F0R1_FB24                       ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F0R1_FB25                       ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F0R1_FB26                       ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F0R1_FB27                       ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F0R1_FB28                       ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F0R1_FB29                       ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F0R1_FB30                       ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F0R1_FB31                       ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F1R1 register  *******************/
-#define  CAN_F1R1_FB0                        ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F1R1_FB1                        ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F1R1_FB2                        ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F1R1_FB3                        ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F1R1_FB4                        ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F1R1_FB5                        ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F1R1_FB6                        ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F1R1_FB7                        ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F1R1_FB8                        ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F1R1_FB9                        ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F1R1_FB10                       ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F1R1_FB11                       ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F1R1_FB12                       ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F1R1_FB13                       ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F1R1_FB14                       ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F1R1_FB15                       ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F1R1_FB16                       ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F1R1_FB17                       ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F1R1_FB18                       ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F1R1_FB19                       ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F1R1_FB20                       ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F1R1_FB21                       ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F1R1_FB22                       ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F1R1_FB23                       ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F1R1_FB24                       ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F1R1_FB25                       ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F1R1_FB26                       ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F1R1_FB27                       ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F1R1_FB28                       ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F1R1_FB29                       ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F1R1_FB30                       ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F1R1_FB31                       ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F2R1 register  *******************/
-#define  CAN_F2R1_FB0                        ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F2R1_FB1                        ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F2R1_FB2                        ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F2R1_FB3                        ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F2R1_FB4                        ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F2R1_FB5                        ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F2R1_FB6                        ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F2R1_FB7                        ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F2R1_FB8                        ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F2R1_FB9                        ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F2R1_FB10                       ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F2R1_FB11                       ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F2R1_FB12                       ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F2R1_FB13                       ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F2R1_FB14                       ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F2R1_FB15                       ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F2R1_FB16                       ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F2R1_FB17                       ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F2R1_FB18                       ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F2R1_FB19                       ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F2R1_FB20                       ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F2R1_FB21                       ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F2R1_FB22                       ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F2R1_FB23                       ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F2R1_FB24                       ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F2R1_FB25                       ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F2R1_FB26                       ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F2R1_FB27                       ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F2R1_FB28                       ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F2R1_FB29                       ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F2R1_FB30                       ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F2R1_FB31                       ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F3R1 register  *******************/
-#define  CAN_F3R1_FB0                        ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F3R1_FB1                        ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F3R1_FB2                        ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F3R1_FB3                        ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F3R1_FB4                        ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F3R1_FB5                        ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F3R1_FB6                        ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F3R1_FB7                        ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F3R1_FB8                        ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F3R1_FB9                        ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F3R1_FB10                       ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F3R1_FB11                       ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F3R1_FB12                       ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F3R1_FB13                       ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F3R1_FB14                       ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F3R1_FB15                       ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F3R1_FB16                       ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F3R1_FB17                       ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F3R1_FB18                       ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F3R1_FB19                       ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F3R1_FB20                       ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F3R1_FB21                       ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F3R1_FB22                       ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F3R1_FB23                       ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F3R1_FB24                       ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F3R1_FB25                       ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F3R1_FB26                       ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F3R1_FB27                       ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F3R1_FB28                       ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F3R1_FB29                       ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F3R1_FB30                       ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F3R1_FB31                       ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F4R1 register  *******************/
-#define  CAN_F4R1_FB0                        ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F4R1_FB1                        ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F4R1_FB2                        ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F4R1_FB3                        ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F4R1_FB4                        ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F4R1_FB5                        ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F4R1_FB6                        ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F4R1_FB7                        ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F4R1_FB8                        ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F4R1_FB9                        ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F4R1_FB10                       ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F4R1_FB11                       ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F4R1_FB12                       ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F4R1_FB13                       ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F4R1_FB14                       ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F4R1_FB15                       ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F4R1_FB16                       ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F4R1_FB17                       ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F4R1_FB18                       ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F4R1_FB19                       ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F4R1_FB20                       ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F4R1_FB21                       ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F4R1_FB22                       ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F4R1_FB23                       ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F4R1_FB24                       ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F4R1_FB25                       ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F4R1_FB26                       ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F4R1_FB27                       ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F4R1_FB28                       ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F4R1_FB29                       ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F4R1_FB30                       ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F4R1_FB31                       ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F5R1 register  *******************/
-#define  CAN_F5R1_FB0                        ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F5R1_FB1                        ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F5R1_FB2                        ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F5R1_FB3                        ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F5R1_FB4                        ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F5R1_FB5                        ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F5R1_FB6                        ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F5R1_FB7                        ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F5R1_FB8                        ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F5R1_FB9                        ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F5R1_FB10                       ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F5R1_FB11                       ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F5R1_FB12                       ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F5R1_FB13                       ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F5R1_FB14                       ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F5R1_FB15                       ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F5R1_FB16                       ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F5R1_FB17                       ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F5R1_FB18                       ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F5R1_FB19                       ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F5R1_FB20                       ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F5R1_FB21                       ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F5R1_FB22                       ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F5R1_FB23                       ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F5R1_FB24                       ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F5R1_FB25                       ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F5R1_FB26                       ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F5R1_FB27                       ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F5R1_FB28                       ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F5R1_FB29                       ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F5R1_FB30                       ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F5R1_FB31                       ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F6R1 register  *******************/
-#define  CAN_F6R1_FB0                        ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F6R1_FB1                        ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F6R1_FB2                        ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F6R1_FB3                        ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F6R1_FB4                        ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F6R1_FB5                        ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F6R1_FB6                        ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F6R1_FB7                        ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F6R1_FB8                        ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F6R1_FB9                        ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F6R1_FB10                       ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F6R1_FB11                       ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F6R1_FB12                       ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F6R1_FB13                       ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F6R1_FB14                       ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F6R1_FB15                       ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F6R1_FB16                       ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F6R1_FB17                       ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F6R1_FB18                       ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F6R1_FB19                       ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F6R1_FB20                       ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F6R1_FB21                       ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F6R1_FB22                       ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F6R1_FB23                       ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F6R1_FB24                       ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F6R1_FB25                       ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F6R1_FB26                       ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F6R1_FB27                       ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F6R1_FB28                       ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F6R1_FB29                       ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F6R1_FB30                       ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F6R1_FB31                       ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F7R1 register  *******************/
-#define  CAN_F7R1_FB0                        ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F7R1_FB1                        ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F7R1_FB2                        ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F7R1_FB3                        ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F7R1_FB4                        ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F7R1_FB5                        ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F7R1_FB6                        ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F7R1_FB7                        ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F7R1_FB8                        ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F7R1_FB9                        ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F7R1_FB10                       ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F7R1_FB11                       ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F7R1_FB12                       ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F7R1_FB13                       ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F7R1_FB14                       ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F7R1_FB15                       ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F7R1_FB16                       ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F7R1_FB17                       ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F7R1_FB18                       ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F7R1_FB19                       ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F7R1_FB20                       ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F7R1_FB21                       ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F7R1_FB22                       ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F7R1_FB23                       ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F7R1_FB24                       ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F7R1_FB25                       ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F7R1_FB26                       ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F7R1_FB27                       ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F7R1_FB28                       ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F7R1_FB29                       ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F7R1_FB30                       ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F7R1_FB31                       ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F8R1 register  *******************/
-#define  CAN_F8R1_FB0                        ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F8R1_FB1                        ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F8R1_FB2                        ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F8R1_FB3                        ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F8R1_FB4                        ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F8R1_FB5                        ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F8R1_FB6                        ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F8R1_FB7                        ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F8R1_FB8                        ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F8R1_FB9                        ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F8R1_FB10                       ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F8R1_FB11                       ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F8R1_FB12                       ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F8R1_FB13                       ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F8R1_FB14                       ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F8R1_FB15                       ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F8R1_FB16                       ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F8R1_FB17                       ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F8R1_FB18                       ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F8R1_FB19                       ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F8R1_FB20                       ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F8R1_FB21                       ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F8R1_FB22                       ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F8R1_FB23                       ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F8R1_FB24                       ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F8R1_FB25                       ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F8R1_FB26                       ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F8R1_FB27                       ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F8R1_FB28                       ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F8R1_FB29                       ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F8R1_FB30                       ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F8R1_FB31                       ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F9R1 register  *******************/
-#define  CAN_F9R1_FB0                        ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F9R1_FB1                        ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F9R1_FB2                        ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F9R1_FB3                        ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F9R1_FB4                        ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F9R1_FB5                        ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F9R1_FB6                        ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F9R1_FB7                        ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F9R1_FB8                        ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F9R1_FB9                        ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F9R1_FB10                       ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F9R1_FB11                       ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F9R1_FB12                       ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F9R1_FB13                       ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F9R1_FB14                       ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F9R1_FB15                       ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F9R1_FB16                       ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F9R1_FB17                       ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F9R1_FB18                       ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F9R1_FB19                       ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F9R1_FB20                       ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F9R1_FB21                       ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F9R1_FB22                       ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F9R1_FB23                       ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F9R1_FB24                       ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F9R1_FB25                       ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F9R1_FB26                       ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F9R1_FB27                       ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F9R1_FB28                       ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F9R1_FB29                       ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F9R1_FB30                       ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F9R1_FB31                       ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F10R1 register  ******************/
-#define  CAN_F10R1_FB0                       ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F10R1_FB1                       ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F10R1_FB2                       ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F10R1_FB3                       ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F10R1_FB4                       ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F10R1_FB5                       ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F10R1_FB6                       ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F10R1_FB7                       ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F10R1_FB8                       ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F10R1_FB9                       ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F10R1_FB10                      ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F10R1_FB11                      ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F10R1_FB12                      ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F10R1_FB13                      ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F10R1_FB14                      ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F10R1_FB15                      ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F10R1_FB16                      ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F10R1_FB17                      ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F10R1_FB18                      ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F10R1_FB19                      ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F10R1_FB20                      ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F10R1_FB21                      ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F10R1_FB22                      ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F10R1_FB23                      ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F10R1_FB24                      ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F10R1_FB25                      ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F10R1_FB26                      ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F10R1_FB27                      ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F10R1_FB28                      ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F10R1_FB29                      ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F10R1_FB30                      ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F10R1_FB31                      ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F11R1 register  ******************/
-#define  CAN_F11R1_FB0                       ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F11R1_FB1                       ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F11R1_FB2                       ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F11R1_FB3                       ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F11R1_FB4                       ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F11R1_FB5                       ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F11R1_FB6                       ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F11R1_FB7                       ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F11R1_FB8                       ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F11R1_FB9                       ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F11R1_FB10                      ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F11R1_FB11                      ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F11R1_FB12                      ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F11R1_FB13                      ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F11R1_FB14                      ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F11R1_FB15                      ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F11R1_FB16                      ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F11R1_FB17                      ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F11R1_FB18                      ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F11R1_FB19                      ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F11R1_FB20                      ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F11R1_FB21                      ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F11R1_FB22                      ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F11R1_FB23                      ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F11R1_FB24                      ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F11R1_FB25                      ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F11R1_FB26                      ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F11R1_FB27                      ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F11R1_FB28                      ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F11R1_FB29                      ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F11R1_FB30                      ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F11R1_FB31                      ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F12R1 register  ******************/
-#define  CAN_F12R1_FB0                       ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F12R1_FB1                       ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F12R1_FB2                       ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F12R1_FB3                       ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F12R1_FB4                       ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F12R1_FB5                       ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F12R1_FB6                       ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F12R1_FB7                       ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F12R1_FB8                       ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F12R1_FB9                       ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F12R1_FB10                      ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F12R1_FB11                      ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F12R1_FB12                      ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F12R1_FB13                      ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F12R1_FB14                      ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F12R1_FB15                      ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F12R1_FB16                      ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F12R1_FB17                      ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F12R1_FB18                      ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F12R1_FB19                      ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F12R1_FB20                      ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F12R1_FB21                      ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F12R1_FB22                      ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F12R1_FB23                      ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F12R1_FB24                      ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F12R1_FB25                      ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F12R1_FB26                      ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F12R1_FB27                      ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F12R1_FB28                      ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F12R1_FB29                      ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F12R1_FB30                      ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F12R1_FB31                      ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F13R1 register  ******************/
-#define  CAN_F13R1_FB0                       ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F13R1_FB1                       ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F13R1_FB2                       ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F13R1_FB3                       ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F13R1_FB4                       ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F13R1_FB5                       ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F13R1_FB6                       ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F13R1_FB7                       ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F13R1_FB8                       ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F13R1_FB9                       ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F13R1_FB10                      ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F13R1_FB11                      ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F13R1_FB12                      ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F13R1_FB13                      ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F13R1_FB14                      ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F13R1_FB15                      ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F13R1_FB16                      ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F13R1_FB17                      ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F13R1_FB18                      ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F13R1_FB19                      ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F13R1_FB20                      ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F13R1_FB21                      ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F13R1_FB22                      ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F13R1_FB23                      ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F13R1_FB24                      ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F13R1_FB25                      ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F13R1_FB26                      ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F13R1_FB27                      ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F13R1_FB28                      ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F13R1_FB29                      ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F13R1_FB30                      ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F13R1_FB31                      ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F0R2 register  *******************/
-#define  CAN_F0R2_FB0                        ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F0R2_FB1                        ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F0R2_FB2                        ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F0R2_FB3                        ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F0R2_FB4                        ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F0R2_FB5                        ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F0R2_FB6                        ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F0R2_FB7                        ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F0R2_FB8                        ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F0R2_FB9                        ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F0R2_FB10                       ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F0R2_FB11                       ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F0R2_FB12                       ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F0R2_FB13                       ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F0R2_FB14                       ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F0R2_FB15                       ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F0R2_FB16                       ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F0R2_FB17                       ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F0R2_FB18                       ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F0R2_FB19                       ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F0R2_FB20                       ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F0R2_FB21                       ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F0R2_FB22                       ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F0R2_FB23                       ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F0R2_FB24                       ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F0R2_FB25                       ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F0R2_FB26                       ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F0R2_FB27                       ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F0R2_FB28                       ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F0R2_FB29                       ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F0R2_FB30                       ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F0R2_FB31                       ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F1R2 register  *******************/
-#define  CAN_F1R2_FB0                        ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F1R2_FB1                        ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F1R2_FB2                        ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F1R2_FB3                        ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F1R2_FB4                        ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F1R2_FB5                        ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F1R2_FB6                        ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F1R2_FB7                        ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F1R2_FB8                        ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F1R2_FB9                        ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F1R2_FB10                       ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F1R2_FB11                       ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F1R2_FB12                       ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F1R2_FB13                       ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F1R2_FB14                       ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F1R2_FB15                       ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F1R2_FB16                       ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F1R2_FB17                       ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F1R2_FB18                       ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F1R2_FB19                       ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F1R2_FB20                       ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F1R2_FB21                       ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F1R2_FB22                       ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F1R2_FB23                       ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F1R2_FB24                       ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F1R2_FB25                       ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F1R2_FB26                       ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F1R2_FB27                       ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F1R2_FB28                       ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F1R2_FB29                       ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F1R2_FB30                       ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F1R2_FB31                       ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F2R2 register  *******************/
-#define  CAN_F2R2_FB0                        ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F2R2_FB1                        ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F2R2_FB2                        ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F2R2_FB3                        ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F2R2_FB4                        ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F2R2_FB5                        ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F2R2_FB6                        ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F2R2_FB7                        ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F2R2_FB8                        ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F2R2_FB9                        ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F2R2_FB10                       ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F2R2_FB11                       ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F2R2_FB12                       ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F2R2_FB13                       ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F2R2_FB14                       ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F2R2_FB15                       ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F2R2_FB16                       ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F2R2_FB17                       ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F2R2_FB18                       ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F2R2_FB19                       ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F2R2_FB20                       ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F2R2_FB21                       ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F2R2_FB22                       ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F2R2_FB23                       ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F2R2_FB24                       ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F2R2_FB25                       ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F2R2_FB26                       ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F2R2_FB27                       ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F2R2_FB28                       ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F2R2_FB29                       ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F2R2_FB30                       ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F2R2_FB31                       ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F3R2 register  *******************/
-#define  CAN_F3R2_FB0                        ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F3R2_FB1                        ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F3R2_FB2                        ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F3R2_FB3                        ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F3R2_FB4                        ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F3R2_FB5                        ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F3R2_FB6                        ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F3R2_FB7                        ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F3R2_FB8                        ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F3R2_FB9                        ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F3R2_FB10                       ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F3R2_FB11                       ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F3R2_FB12                       ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F3R2_FB13                       ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F3R2_FB14                       ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F3R2_FB15                       ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F3R2_FB16                       ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F3R2_FB17                       ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F3R2_FB18                       ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F3R2_FB19                       ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F3R2_FB20                       ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F3R2_FB21                       ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F3R2_FB22                       ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F3R2_FB23                       ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F3R2_FB24                       ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F3R2_FB25                       ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F3R2_FB26                       ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F3R2_FB27                       ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F3R2_FB28                       ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F3R2_FB29                       ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F3R2_FB30                       ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F3R2_FB31                       ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F4R2 register  *******************/
-#define  CAN_F4R2_FB0                        ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F4R2_FB1                        ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F4R2_FB2                        ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F4R2_FB3                        ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F4R2_FB4                        ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F4R2_FB5                        ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F4R2_FB6                        ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F4R2_FB7                        ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F4R2_FB8                        ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F4R2_FB9                        ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F4R2_FB10                       ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F4R2_FB11                       ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F4R2_FB12                       ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F4R2_FB13                       ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F4R2_FB14                       ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F4R2_FB15                       ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F4R2_FB16                       ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F4R2_FB17                       ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F4R2_FB18                       ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F4R2_FB19                       ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F4R2_FB20                       ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F4R2_FB21                       ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F4R2_FB22                       ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F4R2_FB23                       ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F4R2_FB24                       ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F4R2_FB25                       ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F4R2_FB26                       ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F4R2_FB27                       ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F4R2_FB28                       ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F4R2_FB29                       ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F4R2_FB30                       ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F4R2_FB31                       ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F5R2 register  *******************/
-#define  CAN_F5R2_FB0                        ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F5R2_FB1                        ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F5R2_FB2                        ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F5R2_FB3                        ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F5R2_FB4                        ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F5R2_FB5                        ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F5R2_FB6                        ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F5R2_FB7                        ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F5R2_FB8                        ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F5R2_FB9                        ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F5R2_FB10                       ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F5R2_FB11                       ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F5R2_FB12                       ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F5R2_FB13                       ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F5R2_FB14                       ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F5R2_FB15                       ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F5R2_FB16                       ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F5R2_FB17                       ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F5R2_FB18                       ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F5R2_FB19                       ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F5R2_FB20                       ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F5R2_FB21                       ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F5R2_FB22                       ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F5R2_FB23                       ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F5R2_FB24                       ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F5R2_FB25                       ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F5R2_FB26                       ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F5R2_FB27                       ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F5R2_FB28                       ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F5R2_FB29                       ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F5R2_FB30                       ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F5R2_FB31                       ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F6R2 register  *******************/
-#define  CAN_F6R2_FB0                        ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F6R2_FB1                        ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F6R2_FB2                        ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F6R2_FB3                        ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F6R2_FB4                        ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F6R2_FB5                        ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F6R2_FB6                        ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F6R2_FB7                        ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F6R2_FB8                        ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F6R2_FB9                        ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F6R2_FB10                       ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F6R2_FB11                       ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F6R2_FB12                       ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F6R2_FB13                       ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F6R2_FB14                       ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F6R2_FB15                       ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F6R2_FB16                       ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F6R2_FB17                       ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F6R2_FB18                       ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F6R2_FB19                       ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F6R2_FB20                       ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F6R2_FB21                       ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F6R2_FB22                       ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F6R2_FB23                       ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F6R2_FB24                       ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F6R2_FB25                       ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F6R2_FB26                       ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F6R2_FB27                       ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F6R2_FB28                       ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F6R2_FB29                       ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F6R2_FB30                       ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F6R2_FB31                       ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F7R2 register  *******************/
-#define  CAN_F7R2_FB0                        ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F7R2_FB1                        ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F7R2_FB2                        ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F7R2_FB3                        ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F7R2_FB4                        ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F7R2_FB5                        ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F7R2_FB6                        ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F7R2_FB7                        ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F7R2_FB8                        ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F7R2_FB9                        ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F7R2_FB10                       ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F7R2_FB11                       ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F7R2_FB12                       ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F7R2_FB13                       ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F7R2_FB14                       ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F7R2_FB15                       ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F7R2_FB16                       ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F7R2_FB17                       ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F7R2_FB18                       ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F7R2_FB19                       ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F7R2_FB20                       ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F7R2_FB21                       ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F7R2_FB22                       ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F7R2_FB23                       ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F7R2_FB24                       ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F7R2_FB25                       ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F7R2_FB26                       ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F7R2_FB27                       ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F7R2_FB28                       ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F7R2_FB29                       ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F7R2_FB30                       ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F7R2_FB31                       ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F8R2 register  *******************/
-#define  CAN_F8R2_FB0                        ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F8R2_FB1                        ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F8R2_FB2                        ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F8R2_FB3                        ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F8R2_FB4                        ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F8R2_FB5                        ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F8R2_FB6                        ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F8R2_FB7                        ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F8R2_FB8                        ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F8R2_FB9                        ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F8R2_FB10                       ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F8R2_FB11                       ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F8R2_FB12                       ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F8R2_FB13                       ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F8R2_FB14                       ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F8R2_FB15                       ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F8R2_FB16                       ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F8R2_FB17                       ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F8R2_FB18                       ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F8R2_FB19                       ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F8R2_FB20                       ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F8R2_FB21                       ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F8R2_FB22                       ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F8R2_FB23                       ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F8R2_FB24                       ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F8R2_FB25                       ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F8R2_FB26                       ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F8R2_FB27                       ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F8R2_FB28                       ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F8R2_FB29                       ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F8R2_FB30                       ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F8R2_FB31                       ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F9R2 register  *******************/
-#define  CAN_F9R2_FB0                        ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F9R2_FB1                        ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F9R2_FB2                        ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F9R2_FB3                        ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F9R2_FB4                        ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F9R2_FB5                        ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F9R2_FB6                        ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F9R2_FB7                        ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F9R2_FB8                        ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F9R2_FB9                        ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F9R2_FB10                       ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F9R2_FB11                       ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F9R2_FB12                       ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F9R2_FB13                       ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F9R2_FB14                       ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F9R2_FB15                       ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F9R2_FB16                       ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F9R2_FB17                       ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F9R2_FB18                       ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F9R2_FB19                       ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F9R2_FB20                       ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F9R2_FB21                       ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F9R2_FB22                       ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F9R2_FB23                       ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F9R2_FB24                       ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F9R2_FB25                       ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F9R2_FB26                       ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F9R2_FB27                       ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F9R2_FB28                       ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F9R2_FB29                       ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F9R2_FB30                       ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F9R2_FB31                       ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F10R2 register  ******************/
-#define  CAN_F10R2_FB0                       ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F10R2_FB1                       ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F10R2_FB2                       ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F10R2_FB3                       ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F10R2_FB4                       ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F10R2_FB5                       ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F10R2_FB6                       ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F10R2_FB7                       ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F10R2_FB8                       ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F10R2_FB9                       ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F10R2_FB10                      ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F10R2_FB11                      ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F10R2_FB12                      ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F10R2_FB13                      ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F10R2_FB14                      ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F10R2_FB15                      ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F10R2_FB16                      ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F10R2_FB17                      ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F10R2_FB18                      ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F10R2_FB19                      ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F10R2_FB20                      ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F10R2_FB21                      ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F10R2_FB22                      ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F10R2_FB23                      ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F10R2_FB24                      ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F10R2_FB25                      ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F10R2_FB26                      ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F10R2_FB27                      ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F10R2_FB28                      ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F10R2_FB29                      ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F10R2_FB30                      ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F10R2_FB31                      ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F11R2 register  ******************/
-#define  CAN_F11R2_FB0                       ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F11R2_FB1                       ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F11R2_FB2                       ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F11R2_FB3                       ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F11R2_FB4                       ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F11R2_FB5                       ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F11R2_FB6                       ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F11R2_FB7                       ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F11R2_FB8                       ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F11R2_FB9                       ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F11R2_FB10                      ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F11R2_FB11                      ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F11R2_FB12                      ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F11R2_FB13                      ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F11R2_FB14                      ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F11R2_FB15                      ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F11R2_FB16                      ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F11R2_FB17                      ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F11R2_FB18                      ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F11R2_FB19                      ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F11R2_FB20                      ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F11R2_FB21                      ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F11R2_FB22                      ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F11R2_FB23                      ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F11R2_FB24                      ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F11R2_FB25                      ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F11R2_FB26                      ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F11R2_FB27                      ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F11R2_FB28                      ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F11R2_FB29                      ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F11R2_FB30                      ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F11R2_FB31                      ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F12R2 register  ******************/
-#define  CAN_F12R2_FB0                       ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F12R2_FB1                       ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F12R2_FB2                       ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F12R2_FB3                       ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F12R2_FB4                       ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F12R2_FB5                       ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F12R2_FB6                       ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F12R2_FB7                       ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F12R2_FB8                       ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F12R2_FB9                       ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F12R2_FB10                      ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F12R2_FB11                      ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F12R2_FB12                      ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F12R2_FB13                      ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F12R2_FB14                      ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F12R2_FB15                      ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F12R2_FB16                      ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F12R2_FB17                      ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F12R2_FB18                      ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F12R2_FB19                      ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F12R2_FB20                      ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F12R2_FB21                      ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F12R2_FB22                      ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F12R2_FB23                      ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F12R2_FB24                      ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F12R2_FB25                      ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F12R2_FB26                      ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F12R2_FB27                      ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F12R2_FB28                      ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F12R2_FB29                      ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F12R2_FB30                      ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F12R2_FB31                      ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/*******************  Bit definition for CAN_F13R2 register  ******************/
-#define  CAN_F13R2_FB0                       ((uint32_t)0x00000001)        /*!<Filter bit 0 */
-#define  CAN_F13R2_FB1                       ((uint32_t)0x00000002)        /*!<Filter bit 1 */
-#define  CAN_F13R2_FB2                       ((uint32_t)0x00000004)        /*!<Filter bit 2 */
-#define  CAN_F13R2_FB3                       ((uint32_t)0x00000008)        /*!<Filter bit 3 */
-#define  CAN_F13R2_FB4                       ((uint32_t)0x00000010)        /*!<Filter bit 4 */
-#define  CAN_F13R2_FB5                       ((uint32_t)0x00000020)        /*!<Filter bit 5 */
-#define  CAN_F13R2_FB6                       ((uint32_t)0x00000040)        /*!<Filter bit 6 */
-#define  CAN_F13R2_FB7                       ((uint32_t)0x00000080)        /*!<Filter bit 7 */
-#define  CAN_F13R2_FB8                       ((uint32_t)0x00000100)        /*!<Filter bit 8 */
-#define  CAN_F13R2_FB9                       ((uint32_t)0x00000200)        /*!<Filter bit 9 */
-#define  CAN_F13R2_FB10                      ((uint32_t)0x00000400)        /*!<Filter bit 10 */
-#define  CAN_F13R2_FB11                      ((uint32_t)0x00000800)        /*!<Filter bit 11 */
-#define  CAN_F13R2_FB12                      ((uint32_t)0x00001000)        /*!<Filter bit 12 */
-#define  CAN_F13R2_FB13                      ((uint32_t)0x00002000)        /*!<Filter bit 13 */
-#define  CAN_F13R2_FB14                      ((uint32_t)0x00004000)        /*!<Filter bit 14 */
-#define  CAN_F13R2_FB15                      ((uint32_t)0x00008000)        /*!<Filter bit 15 */
-#define  CAN_F13R2_FB16                      ((uint32_t)0x00010000)        /*!<Filter bit 16 */
-#define  CAN_F13R2_FB17                      ((uint32_t)0x00020000)        /*!<Filter bit 17 */
-#define  CAN_F13R2_FB18                      ((uint32_t)0x00040000)        /*!<Filter bit 18 */
-#define  CAN_F13R2_FB19                      ((uint32_t)0x00080000)        /*!<Filter bit 19 */
-#define  CAN_F13R2_FB20                      ((uint32_t)0x00100000)        /*!<Filter bit 20 */
-#define  CAN_F13R2_FB21                      ((uint32_t)0x00200000)        /*!<Filter bit 21 */
-#define  CAN_F13R2_FB22                      ((uint32_t)0x00400000)        /*!<Filter bit 22 */
-#define  CAN_F13R2_FB23                      ((uint32_t)0x00800000)        /*!<Filter bit 23 */
-#define  CAN_F13R2_FB24                      ((uint32_t)0x01000000)        /*!<Filter bit 24 */
-#define  CAN_F13R2_FB25                      ((uint32_t)0x02000000)        /*!<Filter bit 25 */
-#define  CAN_F13R2_FB26                      ((uint32_t)0x04000000)        /*!<Filter bit 26 */
-#define  CAN_F13R2_FB27                      ((uint32_t)0x08000000)        /*!<Filter bit 27 */
-#define  CAN_F13R2_FB28                      ((uint32_t)0x10000000)        /*!<Filter bit 28 */
-#define  CAN_F13R2_FB29                      ((uint32_t)0x20000000)        /*!<Filter bit 29 */
-#define  CAN_F13R2_FB30                      ((uint32_t)0x40000000)        /*!<Filter bit 30 */
-#define  CAN_F13R2_FB31                      ((uint32_t)0x80000000)        /*!<Filter bit 31 */
-
-/******************************************************************************/
-/*                                                                            */
-/*                          CRC calculation unit                              */
-/*                                                                            */
-/******************************************************************************/
-/*******************  Bit definition for CRC_DR register  *********************/
-#define  CRC_DR_DR                           ((uint32_t)0xFFFFFFFF) /*!< Data register bits */
-
-
-/*******************  Bit definition for CRC_IDR register  ********************/
-#define  CRC_IDR_IDR                         ((uint8_t)0xFF)        /*!< General-purpose 8-bit data register bits */
-
-
-/********************  Bit definition for CRC_CR register  ********************/
-#define  CRC_CR_RESET                        ((uint8_t)0x01)        /*!< RESET bit */
-
-/******************************************************************************/
-/*                                                                            */
-/*                            Crypto Processor                                */
-/*                                                                            */
-/******************************************************************************/
-/******************* Bits definition for CRYP_CR register  ********************/
-#define CRYP_CR_ALGODIR                      ((uint32_t)0x00000004)
-
-#define CRYP_CR_ALGOMODE                     ((uint32_t)0x00080038)
-#define CRYP_CR_ALGOMODE_0                   ((uint32_t)0x00000008)
-#define CRYP_CR_ALGOMODE_1                   ((uint32_t)0x00000010)
-#define CRYP_CR_ALGOMODE_2                   ((uint32_t)0x00000020)
-#define CRYP_CR_ALGOMODE_TDES_ECB            ((uint32_t)0x00000000)
-#define CRYP_CR_ALGOMODE_TDES_CBC            ((uint32_t)0x00000008)
-#define CRYP_CR_ALGOMODE_DES_ECB             ((uint32_t)0x00000010)
-#define CRYP_CR_ALGOMODE_DES_CBC             ((uint32_t)0x00000018)
-#define CRYP_CR_ALGOMODE_AES_ECB             ((uint32_t)0x00000020)
-#define CRYP_CR_ALGOMODE_AES_CBC             ((uint32_t)0x00000028)
-#define CRYP_CR_ALGOMODE_AES_CTR             ((uint32_t)0x00000030)
-#define CRYP_CR_ALGOMODE_AES_KEY             ((uint32_t)0x00000038)
-
-#define CRYP_CR_DATATYPE                     ((uint32_t)0x000000C0)
-#define CRYP_CR_DATATYPE_0                   ((uint32_t)0x00000040)
-#define CRYP_CR_DATATYPE_1                   ((uint32_t)0x00000080)
-#define CRYP_CR_KEYSIZE                      ((uint32_t)0x00000300)
-#define CRYP_CR_KEYSIZE_0                    ((uint32_t)0x00000100)
-#define CRYP_CR_KEYSIZE_1                    ((uint32_t)0x00000200)
-#define CRYP_CR_FFLUSH                       ((uint32_t)0x00004000)
-#define CRYP_CR_CRYPEN                       ((uint32_t)0x00008000)
-
-#define CRYP_CR_GCM_CCMPH                    ((uint32_t)0x00030000)
-#define CRYP_CR_GCM_CCMPH_0                  ((uint32_t)0x00010000)
-#define CRYP_CR_GCM_CCMPH_1                  ((uint32_t)0x00020000)
-#define CRYP_CR_ALGOMODE_3                   ((uint32_t)0x00080000) 
-
-/****************** Bits definition for CRYP_SR register  *********************/
-#define CRYP_SR_IFEM                         ((uint32_t)0x00000001)
-#define CRYP_SR_IFNF                         ((uint32_t)0x00000002)
-#define CRYP_SR_OFNE                         ((uint32_t)0x00000004)
-#define CRYP_SR_OFFU                         ((uint32_t)0x00000008)
-#define CRYP_SR_BUSY                         ((uint32_t)0x00000010)
-/****************** Bits definition for CRYP_DMACR register  ******************/
-#define CRYP_DMACR_DIEN                      ((uint32_t)0x00000001)
-#define CRYP_DMACR_DOEN                      ((uint32_t)0x00000002)
-/*****************  Bits definition for CRYP_IMSCR register  ******************/
-#define CRYP_IMSCR_INIM                      ((uint32_t)0x00000001)
-#define CRYP_IMSCR_OUTIM                     ((uint32_t)0x00000002)
-/****************** Bits definition for CRYP_RISR register  *******************/
-#define CRYP_RISR_OUTRIS                     ((uint32_t)0x00000001)
-#define CRYP_RISR_INRIS                      ((uint32_t)0x00000002)
-/****************** Bits definition for CRYP_MISR register  *******************/
-#define CRYP_MISR_INMIS                      ((uint32_t)0x00000001)
-#define CRYP_MISR_OUTMIS                     ((uint32_t)0x00000002)
-
-/******************************************************************************/
-/*                                                                            */
-/*                      Digital to Analog Converter                           */
-/*                                                                            */
-/******************************************************************************/
-/********************  Bit definition for DAC_CR register  ********************/
-#define  DAC_CR_EN1                          ((uint32_t)0x00000001)        /*!<DAC channel1 enable */
-#define  DAC_CR_BOFF1                        ((uint32_t)0x00000002)        /*!<DAC channel1 output buffer disable */
-#define  DAC_CR_TEN1                         ((uint32_t)0x00000004)        /*!<DAC channel1 Trigger enable */
-
-#define  DAC_CR_TSEL1                        ((uint32_t)0x00000038)        /*!<TSEL1[2:0] (DAC channel1 Trigger selection) */
-#define  DAC_CR_TSEL1_0                      ((uint32_t)0x00000008)        /*!<Bit 0 */
-#define  DAC_CR_TSEL1_1                      ((uint32_t)0x00000010)        /*!<Bit 1 */
-#define  DAC_CR_TSEL1_2                      ((uint32_t)0x00000020)        /*!<Bit 2 */
-
-#define  DAC_CR_WAVE1                        ((uint32_t)0x000000C0)        /*!<WAVE1[1:0] (DAC channel1 noise/triangle wave generation enable) */
-#define  DAC_CR_WAVE1_0                      ((uint32_t)0x00000040)        /*!<Bit 0 */
-#define  DAC_CR_WAVE1_1                      ((uint32_t)0x00000080)        /*!<Bit 1 */
-
-#define  DAC_CR_MAMP1                        ((uint32_t)0x00000F00)        /*!<MAMP1[3:0] (DAC channel1 Mask/Amplitude selector) */
-#define  DAC_CR_MAMP1_0                      ((uint32_t)0x00000100)        /*!<Bit 0 */
-#define  DAC_CR_MAMP1_1                      ((uint32_t)0x00000200)        /*!<Bit 1 */
-#define  DAC_CR_MAMP1_2                      ((uint32_t)0x00000400)        /*!<Bit 2 */
-#define  DAC_CR_MAMP1_3                      ((uint32_t)0x00000800)        /*!<Bit 3 */
-
-#define  DAC_CR_DMAEN1                       ((uint32_t)0x00001000)        /*!<DAC channel1 DMA enable */
-#define  DAC_CR_EN2                          ((uint32_t)0x00010000)        /*!<DAC channel2 enable */
-#define  DAC_CR_BOFF2                        ((uint32_t)0x00020000)        /*!<DAC channel2 output buffer disable */
-#define  DAC_CR_TEN2                         ((uint32_t)0x00040000)        /*!<DAC channel2 Trigger enable */
-
-#define  DAC_CR_TSEL2                        ((uint32_t)0x00380000)        /*!<TSEL2[2:0] (DAC channel2 Trigger selection) */
-#define  DAC_CR_TSEL2_0                      ((uint32_t)0x00080000)        /*!<Bit 0 */
-#define  DAC_CR_TSEL2_1                      ((uint32_t)0x00100000)        /*!<Bit 1 */
-#define  DAC_CR_TSEL2_2                      ((uint32_t)0x00200000)        /*!<Bit 2 */
-
-#define  DAC_CR_WAVE2                        ((uint32_t)0x00C00000)        /*!<WAVE2[1:0] (DAC channel2 noise/triangle wave generation enable) */
-#define  DAC_CR_WAVE2_0                      ((uint32_t)0x00400000)        /*!<Bit 0 */
-#define  DAC_CR_WAVE2_1                      ((uint32_t)0x00800000)        /*!<Bit 1 */
-
-#define  DAC_CR_MAMP2                        ((uint32_t)0x0F000000)        /*!<MAMP2[3:0] (DAC channel2 Mask/Amplitude selector) */
-#define  DAC_CR_MAMP2_0                      ((uint32_t)0x01000000)        /*!<Bit 0 */
-#define  DAC_CR_MAMP2_1                      ((uint32_t)0x02000000)        /*!<Bit 1 */
-#define  DAC_CR_MAMP2_2                      ((uint32_t)0x04000000)        /*!<Bit 2 */
-#define  DAC_CR_MAMP2_3                      ((uint32_t)0x08000000)        /*!<Bit 3 */
-
-#define  DAC_CR_DMAEN2                       ((uint32_t)0x10000000)        /*!<DAC channel2 DMA enabled */
-
-/*****************  Bit definition for DAC_SWTRIGR register  ******************/
-#define  DAC_SWTRIGR_SWTRIG1                 ((uint8_t)0x01)               /*!<DAC channel1 software trigger */
-#define  DAC_SWTRIGR_SWTRIG2                 ((uint8_t)0x02)               /*!<DAC channel2 software trigger */
-
-/*****************  Bit definition for DAC_DHR12R1 register  ******************/
-#define  DAC_DHR12R1_DACC1DHR                ((uint16_t)0x0FFF)            /*!<DAC channel1 12-bit Right aligned data */
-
-/*****************  Bit definition for DAC_DHR12L1 register  ******************/
-#define  DAC_DHR12L1_DACC1DHR                ((uint16_t)0xFFF0)            /*!<DAC channel1 12-bit Left aligned data */
-
-/******************  Bit definition for DAC_DHR8R1 register  ******************/
-#define  DAC_DHR8R1_DACC1DHR                 ((uint8_t)0xFF)               /*!<DAC channel1 8-bit Right aligned data */
-
-/*****************  Bit definition for DAC_DHR12R2 register  ******************/
-#define  DAC_DHR12R2_DACC2DHR                ((uint16_t)0x0FFF)            /*!<DAC channel2 12-bit Right aligned data */
-
-/*****************  Bit definition for DAC_DHR12L2 register  ******************/
-#define  DAC_DHR12L2_DACC2DHR                ((uint16_t)0xFFF0)            /*!<DAC channel2 12-bit Left aligned data */
-
-/******************  Bit definition for DAC_DHR8R2 register  ******************/
-#define  DAC_DHR8R2_DACC2DHR                 ((uint8_t)0xFF)               /*!<DAC channel2 8-bit Right aligned data */
-
-/*****************  Bit definition for DAC_DHR12RD register  ******************/
-#define  DAC_DHR12RD_DACC1DHR                ((uint32_t)0x00000FFF)        /*!<DAC channel1 12-bit Right aligned data */
-#define  DAC_DHR12RD_DACC2DHR                ((uint32_t)0x0FFF0000)        /*!<DAC channel2 12-bit Right aligned data */
-
-/*****************  Bit definition for DAC_DHR12LD register  ******************/
-#define  DAC_DHR12LD_DACC1DHR                ((uint32_t)0x0000FFF0)        /*!<DAC channel1 12-bit Left aligned data */
-#define  DAC_DHR12LD_DACC2DHR                ((uint32_t)0xFFF00000)        /*!<DAC channel2 12-bit Left aligned data */
-
-/******************  Bit definition for DAC_DHR8RD register  ******************/
-#define  DAC_DHR8RD_DACC1DHR                 ((uint16_t)0x00FF)            /*!<DAC channel1 8-bit Right aligned data */
-#define  DAC_DHR8RD_DACC2DHR                 ((uint16_t)0xFF00)            /*!<DAC channel2 8-bit Right aligned data */
-
-/*******************  Bit definition for DAC_DOR1 register  *******************/
-#define  DAC_DOR1_DACC1DOR                   ((uint16_t)0x0FFF)            /*!<DAC channel1 data output */
-
-/*******************  Bit definition for DAC_DOR2 register  *******************/
-#define  DAC_DOR2_DACC2DOR                   ((uint16_t)0x0FFF)            /*!<DAC channel2 data output */
-
-/********************  Bit definition for DAC_SR register  ********************/
-#define  DAC_SR_DMAUDR1                      ((uint32_t)0x00002000)        /*!<DAC channel1 DMA underrun flag */
-#define  DAC_SR_DMAUDR2                      ((uint32_t)0x20000000)        /*!<DAC channel2 DMA underrun flag */
-
-/******************************************************************************/
-/*                                                                            */
-/*                                 Debug MCU                                  */
-/*                                                                            */
-/******************************************************************************/
-
-/******************************************************************************/
-/*                                                                            */
-/*                                    DCMI                                    */
-/*                                                                            */
-/******************************************************************************/
-/********************  Bits definition for DCMI_CR register  ******************/
-#define DCMI_CR_CAPTURE                      ((uint32_t)0x00000001)
-#define DCMI_CR_CM                           ((uint32_t)0x00000002)
-#define DCMI_CR_CROP                         ((uint32_t)0x00000004)
-#define DCMI_CR_JPEG                         ((uint32_t)0x00000008)
-#define DCMI_CR_ESS                          ((uint32_t)0x00000010)
-#define DCMI_CR_PCKPOL                       ((uint32_t)0x00000020)
-#define DCMI_CR_HSPOL                        ((uint32_t)0x00000040)
-#define DCMI_CR_VSPOL                        ((uint32_t)0x00000080)
-#define DCMI_CR_FCRC_0                       ((uint32_t)0x00000100)
-#define DCMI_CR_FCRC_1                       ((uint32_t)0x00000200)
-#define DCMI_CR_EDM_0                        ((uint32_t)0x00000400)
-#define DCMI_CR_EDM_1                        ((uint32_t)0x00000800)
-#define DCMI_CR_CRE                          ((uint32_t)0x00001000)
-#define DCMI_CR_ENABLE                       ((uint32_t)0x00004000)
-
-/********************  Bits definition for DCMI_SR register  ******************/
-#define DCMI_SR_HSYNC                        ((uint32_t)0x00000001)
-#define DCMI_SR_VSYNC                        ((uint32_t)0x00000002)
-#define DCMI_SR_FNE                          ((uint32_t)0x00000004)
-
-/********************  Bits definition for DCMI_RISR register  ****************/
-#define DCMI_RISR_FRAME_RIS                  ((uint32_t)0x00000001)
-#define DCMI_RISR_OVF_RIS                    ((uint32_t)0x00000002)
-#define DCMI_RISR_ERR_RIS                    ((uint32_t)0x00000004)
-#define DCMI_RISR_VSYNC_RIS                  ((uint32_t)0x00000008)
-#define DCMI_RISR_LINE_RIS                   ((uint32_t)0x00000010)
-
-/********************  Bits definition for DCMI_IER register  *****************/
-#define DCMI_IER_FRAME_IE                    ((uint32_t)0x00000001)
-#define DCMI_IER_OVF_IE                      ((uint32_t)0x00000002)
-#define DCMI_IER_ERR_IE                      ((uint32_t)0x00000004)
-#define DCMI_IER_VSYNC_IE                    ((uint32_t)0x00000008)
-#define DCMI_IER_LINE_IE                     ((uint32_t)0x00000010)
-
-/********************  Bits definition for DCMI_MISR register  ****************/
-#define DCMI_MISR_FRAME_MIS                  ((uint32_t)0x00000001)
-#define DCMI_MISR_OVF_MIS                    ((uint32_t)0x00000002)
-#define DCMI_MISR_ERR_MIS                    ((uint32_t)0x00000004)
-#define DCMI_MISR_VSYNC_MIS                  ((uint32_t)0x00000008)
-#define DCMI_MISR_LINE_MIS                   ((uint32_t)0x00000010)
-
-/********************  Bits definition for DCMI_ICR register  *****************/
-#define DCMI_ICR_FRAME_ISC                   ((uint32_t)0x00000001)
-#define DCMI_ICR_OVF_ISC                     ((uint32_t)0x00000002)
-#define DCMI_ICR_ERR_ISC                     ((uint32_t)0x00000004)
-#define DCMI_ICR_VSYNC_ISC                   ((uint32_t)0x00000008)
-#define DCMI_ICR_LINE_ISC                    ((uint32_t)0x00000010)
-
-/******************************************************************************/
-/*                                                                            */
-/*                             DMA Controller                                 */
-/*                                                                            */
-/******************************************************************************/
-/********************  Bits definition for DMA_SxCR register  *****************/ 
-#define DMA_SxCR_CHSEL                       ((uint32_t)0x0E000000)
-#define DMA_SxCR_CHSEL_0                     ((uint32_t)0x02000000)
-#define DMA_SxCR_CHSEL_1                     ((uint32_t)0x04000000)
-#define DMA_SxCR_CHSEL_2                     ((uint32_t)0x08000000) 
-#define DMA_SxCR_MBURST                      ((uint32_t)0x01800000)
-#define DMA_SxCR_MBURST_0                    ((uint32_t)0x00800000)
-#define DMA_SxCR_MBURST_1                    ((uint32_t)0x01000000)
-#define DMA_SxCR_PBURST                      ((uint32_t)0x00600000)
-#define DMA_SxCR_PBURST_0                    ((uint32_t)0x00200000)
-#define DMA_SxCR_PBURST_1                    ((uint32_t)0x00400000)
-#define DMA_SxCR_ACK                         ((uint32_t)0x00100000)
-#define DMA_SxCR_CT                          ((uint32_t)0x00080000)  
-#define DMA_SxCR_DBM                         ((uint32_t)0x00040000)
-#define DMA_SxCR_PL                          ((uint32_t)0x00030000)
-#define DMA_SxCR_PL_0                        ((uint32_t)0x00010000)
-#define DMA_SxCR_PL_1                        ((uint32_t)0x00020000)
-#define DMA_SxCR_PINCOS                      ((uint32_t)0x00008000)
-#define DMA_SxCR_MSIZE                       ((uint32_t)0x00006000)
-#define DMA_SxCR_MSIZE_0                     ((uint32_t)0x00002000)
-#define DMA_SxCR_MSIZE_1                     ((uint32_t)0x00004000)
-#define DMA_SxCR_PSIZE                       ((uint32_t)0x00001800)
-#define DMA_SxCR_PSIZE_0                     ((uint32_t)0x00000800)
-#define DMA_SxCR_PSIZE_1                     ((uint32_t)0x00001000)
-#define DMA_SxCR_MINC                        ((uint32_t)0x00000400)
-#define DMA_SxCR_PINC                        ((uint32_t)0x00000200)
-#define DMA_SxCR_CIRC                        ((uint32_t)0x00000100)
-#define DMA_SxCR_DIR                         ((uint32_t)0x000000C0)
-#define DMA_SxCR_DIR_0                       ((uint32_t)0x00000040)
-#define DMA_SxCR_DIR_1                       ((uint32_t)0x00000080)
-#define DMA_SxCR_PFCTRL                      ((uint32_t)0x00000020)
-#define DMA_SxCR_TCIE                        ((uint32_t)0x00000010)
-#define DMA_SxCR_HTIE                        ((uint32_t)0x00000008)
-#define DMA_SxCR_TEIE                        ((uint32_t)0x00000004)
-#define DMA_SxCR_DMEIE                       ((uint32_t)0x00000002)
-#define DMA_SxCR_EN                          ((uint32_t)0x00000001)
-
-/********************  Bits definition for DMA_SxCNDTR register  **************/
-#define DMA_SxNDT                            ((uint32_t)0x0000FFFF)
-#define DMA_SxNDT_0                          ((uint32_t)0x00000001)
-#define DMA_SxNDT_1                          ((uint32_t)0x00000002)
-#define DMA_SxNDT_2                          ((uint32_t)0x00000004)
-#define DMA_SxNDT_3                          ((uint32_t)0x00000008)
-#define DMA_SxNDT_4                          ((uint32_t)0x00000010)
-#define DMA_SxNDT_5                          ((uint32_t)0x00000020)
-#define DMA_SxNDT_6                          ((uint32_t)0x00000040)
-#define DMA_SxNDT_7                          ((uint32_t)0x00000080)
-#define DMA_SxNDT_8                          ((uint32_t)0x00000100)
-#define DMA_SxNDT_9                          ((uint32_t)0x00000200)
-#define DMA_SxNDT_10                         ((uint32_t)0x00000400)
-#define DMA_SxNDT_11                         ((uint32_t)0x00000800)
-#define DMA_SxNDT_12                         ((uint32_t)0x00001000)
-#define DMA_SxNDT_13                         ((uint32_t)0x00002000)
-#define DMA_SxNDT_14                         ((uint32_t)0x00004000)
-#define DMA_SxNDT_15                         ((uint32_t)0x00008000)
-
-/********************  Bits definition for DMA_SxFCR register  ****************/ 
-#define DMA_SxFCR_FEIE                       ((uint32_t)0x00000080)
-#define DMA_SxFCR_FS                         ((uint32_t)0x00000038)
-#define DMA_SxFCR_FS_0                       ((uint32_t)0x00000008)
-#define DMA_SxFCR_FS_1                       ((uint32_t)0x00000010)
-#define DMA_SxFCR_FS_2                       ((uint32_t)0x00000020)
-#define DMA_SxFCR_DMDIS                      ((uint32_t)0x00000004)
-#define DMA_SxFCR_FTH                        ((uint32_t)0x00000003)
-#define DMA_SxFCR_FTH_0                      ((uint32_t)0x00000001)
-#define DMA_SxFCR_FTH_1                      ((uint32_t)0x00000002)
-
-/********************  Bits definition for DMA_LISR register  *****************/ 
-#define DMA_LISR_TCIF3                       ((uint32_t)0x08000000)
-#define DMA_LISR_HTIF3                       ((uint32_t)0x04000000)
-#define DMA_LISR_TEIF3                       ((uint32_t)0x02000000)
-#define DMA_LISR_DMEIF3                      ((uint32_t)0x01000000)
-#define DMA_LISR_FEIF3                       ((uint32_t)0x00400000)
-#define DMA_LISR_TCIF2                       ((uint32_t)0x00200000)
-#define DMA_LISR_HTIF2                       ((uint32_t)0x00100000)
-#define DMA_LISR_TEIF2                       ((uint32_t)0x00080000)
-#define DMA_LISR_DMEIF2                      ((uint32_t)0x00040000)
-#define DMA_LISR_FEIF2                       ((uint32_t)0x00010000)
-#define DMA_LISR_TCIF1                       ((uint32_t)0x00000800)
-#define DMA_LISR_HTIF1                       ((uint32_t)0x00000400)
-#define DMA_LISR_TEIF1                       ((uint32_t)0x00000200)
-#define DMA_LISR_DMEIF1                      ((uint32_t)0x00000100)
-#define DMA_LISR_FEIF1                       ((uint32_t)0x00000040)
-#define DMA_LISR_TCIF0                       ((uint32_t)0x00000020)
-#define DMA_LISR_HTIF0                       ((uint32_t)0x00000010)
-#define DMA_LISR_TEIF0                       ((uint32_t)0x00000008)
-#define DMA_LISR_DMEIF0                      ((uint32_t)0x00000004)
-#define DMA_LISR_FEIF0                       ((uint32_t)0x00000001)
-
-/********************  Bits definition for DMA_HISR register  *****************/ 
-#define DMA_HISR_TCIF7                       ((uint32_t)0x08000000)
-#define DMA_HISR_HTIF7                       ((uint32_t)0x04000000)
-#define DMA_HISR_TEIF7                       ((uint32_t)0x02000000)
-#define DMA_HISR_DMEIF7                      ((uint32_t)0x01000000)
-#define DMA_HISR_FEIF7                       ((uint32_t)0x00400000)
-#define DMA_HISR_TCIF6                       ((uint32_t)0x00200000)
-#define DMA_HISR_HTIF6                       ((uint32_t)0x00100000)
-#define DMA_HISR_TEIF6                       ((uint32_t)0x00080000)
-#define DMA_HISR_DMEIF6                      ((uint32_t)0x00040000)
-#define DMA_HISR_FEIF6                       ((uint32_t)0x00010000)
-#define DMA_HISR_TCIF5                       ((uint32_t)0x00000800)
-#define DMA_HISR_HTIF5                       ((uint32_t)0x00000400)
-#define DMA_HISR_TEIF5                       ((uint32_t)0x00000200)
-#define DMA_HISR_DMEIF5                      ((uint32_t)0x00000100)
-#define DMA_HISR_FEIF5                       ((uint32_t)0x00000040)
-#define DMA_HISR_TCIF4                       ((uint32_t)0x00000020)
-#define DMA_HISR_HTIF4                       ((uint32_t)0x00000010)
-#define DMA_HISR_TEIF4                       ((uint32_t)0x00000008)
-#define DMA_HISR_DMEIF4                      ((uint32_t)0x00000004)
-#define DMA_HISR_FEIF4                       ((uint32_t)0x00000001)
-
-/********************  Bits definition for DMA_LIFCR register  ****************/ 
-#define DMA_LIFCR_CTCIF3                     ((uint32_t)0x08000000)
-#define DMA_LIFCR_CHTIF3                     ((uint32_t)0x04000000)
-#define DMA_LIFCR_CTEIF3                     ((uint32_t)0x02000000)
-#define DMA_LIFCR_CDMEIF3                    ((uint32_t)0x01000000)
-#define DMA_LIFCR_CFEIF3                     ((uint32_t)0x00400000)
-#define DMA_LIFCR_CTCIF2                     ((uint32_t)0x00200000)
-#define DMA_LIFCR_CHTIF2                     ((uint32_t)0x00100000)
-#define DMA_LIFCR_CTEIF2                     ((uint32_t)0x00080000)
-#define DMA_LIFCR_CDMEIF2                    ((uint32_t)0x00040000)
-#define DMA_LIFCR_CFEIF2                     ((uint32_t)0x00010000)
-#define DMA_LIFCR_CTCIF1                     ((uint32_t)0x00000800)
-#define DMA_LIFCR_CHTIF1                     ((uint32_t)0x00000400)
-#define DMA_LIFCR_CTEIF1                     ((uint32_t)0x00000200)
-#define DMA_LIFCR_CDMEIF1                    ((uint32_t)0x00000100)
-#define DMA_LIFCR_CFEIF1                     ((uint32_t)0x00000040)
-#define DMA_LIFCR_CTCIF0                     ((uint32_t)0x00000020)
-#define DMA_LIFCR_CHTIF0                     ((uint32_t)0x00000010)
-#define DMA_LIFCR_CTEIF0                     ((uint32_t)0x00000008)
-#define DMA_LIFCR_CDMEIF0                    ((uint32_t)0x00000004)
-#define DMA_LIFCR_CFEIF0                     ((uint32_t)0x00000001)
-
-/********************  Bits definition for DMA_HIFCR  register  ****************/ 
-#define DMA_HIFCR_CTCIF7                     ((uint32_t)0x08000000)
-#define DMA_HIFCR_CHTIF7                     ((uint32_t)0x04000000)
-#define DMA_HIFCR_CTEIF7                     ((uint32_t)0x02000000)
-#define DMA_HIFCR_CDMEIF7                    ((uint32_t)0x01000000)
-#define DMA_HIFCR_CFEIF7                     ((uint32_t)0x00400000)
-#define DMA_HIFCR_CTCIF6                     ((uint32_t)0x00200000)
-#define DMA_HIFCR_CHTIF6                     ((uint32_t)0x00100000)
-#define DMA_HIFCR_CTEIF6                     ((uint32_t)0x00080000)
-#define DMA_HIFCR_CDMEIF6                    ((uint32_t)0x00040000)
-#define DMA_HIFCR_CFEIF6                     ((uint32_t)0x00010000)
-#define DMA_HIFCR_CTCIF5                     ((uint32_t)0x00000800)
-#define DMA_HIFCR_CHTIF5                     ((uint32_t)0x00000400)
-#define DMA_HIFCR_CTEIF5                     ((uint32_t)0x00000200)
-#define DMA_HIFCR_CDMEIF5                    ((uint32_t)0x00000100)
-#define DMA_HIFCR_CFEIF5                     ((uint32_t)0x00000040)
-#define DMA_HIFCR_CTCIF4                     ((uint32_t)0x00000020)
-#define DMA_HIFCR_CHTIF4                     ((uint32_t)0x00000010)
-#define DMA_HIFCR_CTEIF4                     ((uint32_t)0x00000008)
-#define DMA_HIFCR_CDMEIF4                    ((uint32_t)0x00000004)
-#define DMA_HIFCR_CFEIF4                     ((uint32_t)0x00000001)
-
-
-/******************************************************************************/
-/*                                                                            */
-/*                    External Interrupt/Event Controller                     */
-/*                                                                            */
-/******************************************************************************/
-/*******************  Bit definition for EXTI_IMR register  *******************/
-#define  EXTI_IMR_MR0                        ((uint32_t)0x00000001)        /*!< Interrupt Mask on line 0 */
-#define  EXTI_IMR_MR1                        ((uint32_t)0x00000002)        /*!< Interrupt Mask on line 1 */
-#define  EXTI_IMR_MR2                        ((uint32_t)0x00000004)        /*!< Interrupt Mask on line 2 */
-#define  EXTI_IMR_MR3                        ((uint32_t)0x00000008)        /*!< Interrupt Mask on line 3 */
-#define  EXTI_IMR_MR4                        ((uint32_t)0x00000010)        /*!< Interrupt Mask on line 4 */
-#define  EXTI_IMR_MR5                        ((uint32_t)0x00000020)        /*!< Interrupt Mask on line 5 */
-#define  EXTI_IMR_MR6                        ((uint32_t)0x00000040)        /*!< Interrupt Mask on line 6 */
-#define  EXTI_IMR_MR7                        ((uint32_t)0x00000080)        /*!< Interrupt Mask on line 7 */
-#define  EXTI_IMR_MR8                        ((uint32_t)0x00000100)        /*!< Interrupt Mask on line 8 */
-#define  EXTI_IMR_MR9                        ((uint32_t)0x00000200)        /*!< Interrupt Mask on line 9 */
-#define  EXTI_IMR_MR10                       ((uint32_t)0x00000400)        /*!< Interrupt Mask on line 10 */
-#define  EXTI_IMR_MR11                       ((uint32_t)0x00000800)        /*!< Interrupt Mask on line 11 */
-#define  EXTI_IMR_MR12                       ((uint32_t)0x00001000)        /*!< Interrupt Mask on line 12 */
-#define  EXTI_IMR_MR13                       ((uint32_t)0x00002000)        /*!< Interrupt Mask on line 13 */
-#define  EXTI_IMR_MR14                       ((uint32_t)0x00004000)        /*!< Interrupt Mask on line 14 */
-#define  EXTI_IMR_MR15                       ((uint32_t)0x00008000)        /*!< Interrupt Mask on line 15 */
-#define  EXTI_IMR_MR16                       ((uint32_t)0x00010000)        /*!< Interrupt Mask on line 16 */
-#define  EXTI_IMR_MR17                       ((uint32_t)0x00020000)        /*!< Interrupt Mask on line 17 */
-#define  EXTI_IMR_MR18                       ((uint32_t)0x00040000)        /*!< Interrupt Mask on line 18 */
-#define  EXTI_IMR_MR19                       ((uint32_t)0x00080000)        /*!< Interrupt Mask on line 19 */
-
-/*******************  Bit definition for EXTI_EMR register  *******************/
-#define  EXTI_EMR_MR0                        ((uint32_t)0x00000001)        /*!< Event Mask on line 0 */
-#define  EXTI_EMR_MR1                        ((uint32_t)0x00000002)        /*!< Event Mask on line 1 */
-#define  EXTI_EMR_MR2                        ((uint32_t)0x00000004)        /*!< Event Mask on line 2 */
-#define  EXTI_EMR_MR3                        ((uint32_t)0x00000008)        /*!< Event Mask on line 3 */
-#define  EXTI_EMR_MR4                        ((uint32_t)0x00000010)        /*!< Event Mask on line 4 */
-#define  EXTI_EMR_MR5                        ((uint32_t)0x00000020)        /*!< Event Mask on line 5 */
-#define  EXTI_EMR_MR6                        ((uint32_t)0x00000040)        /*!< Event Mask on line 6 */
-#define  EXTI_EMR_MR7                        ((uint32_t)0x00000080)        /*!< Event Mask on line 7 */
-#define  EXTI_EMR_MR8                        ((uint32_t)0x00000100)        /*!< Event Mask on line 8 */
-#define  EXTI_EMR_MR9                        ((uint32_t)0x00000200)        /*!< Event Mask on line 9 */
-#define  EXTI_EMR_MR10                       ((uint32_t)0x00000400)        /*!< Event Mask on line 10 */
-#define  EXTI_EMR_MR11                       ((uint32_t)0x00000800)        /*!< Event Mask on line 11 */
-#define  EXTI_EMR_MR12                       ((uint32_t)0x00001000)        /*!< Event Mask on line 12 */
-#define  EXTI_EMR_MR13                       ((uint32_t)0x00002000)        /*!< Event Mask on line 13 */
-#define  EXTI_EMR_MR14                       ((uint32_t)0x00004000)        /*!< Event Mask on line 14 */
-#define  EXTI_EMR_MR15                       ((uint32_t)0x00008000)        /*!< Event Mask on line 15 */
-#define  EXTI_EMR_MR16                       ((uint32_t)0x00010000)        /*!< Event Mask on line 16 */
-#define  EXTI_EMR_MR17                       ((uint32_t)0x00020000)        /*!< Event Mask on line 17 */
-#define  EXTI_EMR_MR18                       ((uint32_t)0x00040000)        /*!< Event Mask on line 18 */
-#define  EXTI_EMR_MR19                       ((uint32_t)0x00080000)        /*!< Event Mask on line 19 */
-
-/******************  Bit definition for EXTI_RTSR register  *******************/
-#define  EXTI_RTSR_TR0                       ((uint32_t)0x00000001)        /*!< Rising trigger event configuration bit of line 0 */
-#define  EXTI_RTSR_TR1                       ((uint32_t)0x00000002)        /*!< Rising trigger event configuration bit of line 1 */
-#define  EXTI_RTSR_TR2                       ((uint32_t)0x00000004)        /*!< Rising trigger event configuration bit of line 2 */
-#define  EXTI_RTSR_TR3                       ((uint32_t)0x00000008)        /*!< Rising trigger event configuration bit of line 3 */
-#define  EXTI_RTSR_TR4                       ((uint32_t)0x00000010)        /*!< Rising trigger event configuration bit of line 4 */
-#define  EXTI_RTSR_TR5                       ((uint32_t)0x00000020)        /*!< Rising trigger event configuration bit of line 5 */
-#define  EXTI_RTSR_TR6                       ((uint32_t)0x00000040)        /*!< Rising trigger event configuration bit of line 6 */
-#define  EXTI_RTSR_TR7                       ((uint32_t)0x00000080)        /*!< Rising trigger event configuration bit of line 7 */
-#define  EXTI_RTSR_TR8                       ((uint32_t)0x00000100)        /*!< Rising trigger event configuration bit of line 8 */
-#define  EXTI_RTSR_TR9                       ((uint32_t)0x00000200)        /*!< Rising trigger event configuration bit of line 9 */
-#define  EXTI_RTSR_TR10                      ((uint32_t)0x00000400)        /*!< Rising trigger event configuration bit of line 10 */
-#define  EXTI_RTSR_TR11                      ((uint32_t)0x00000800)        /*!< Rising trigger event configuration bit of line 11 */
-#define  EXTI_RTSR_TR12                      ((uint32_t)0x00001000)        /*!< Rising trigger event configuration bit of line 12 */
-#define  EXTI_RTSR_TR13                      ((uint32_t)0x00002000)        /*!< Rising trigger event configuration bit of line 13 */
-#define  EXTI_RTSR_TR14                      ((uint32_t)0x00004000)        /*!< Rising trigger event configuration bit of line 14 */
-#define  EXTI_RTSR_TR15                      ((uint32_t)0x00008000)        /*!< Rising trigger event configuration bit of line 15 */
-#define  EXTI_RTSR_TR16                      ((uint32_t)0x00010000)        /*!< Rising trigger event configuration bit of line 16 */
-#define  EXTI_RTSR_TR17                      ((uint32_t)0x00020000)        /*!< Rising trigger event configuration bit of line 17 */
-#define  EXTI_RTSR_TR18                      ((uint32_t)0x00040000)        /*!< Rising trigger event configuration bit of line 18 */
-#define  EXTI_RTSR_TR19                      ((uint32_t)0x00080000)        /*!< Rising trigger event configuration bit of line 19 */
-
-/******************  Bit definition for EXTI_FTSR register  *******************/
-#define  EXTI_FTSR_TR0                       ((uint32_t)0x00000001)        /*!< Falling trigger event configuration bit of line 0 */
-#define  EXTI_FTSR_TR1                       ((uint32_t)0x00000002)        /*!< Falling trigger event configuration bit of line 1 */
-#define  EXTI_FTSR_TR2                       ((uint32_t)0x00000004)        /*!< Falling trigger event configuration bit of line 2 */
-#define  EXTI_FTSR_TR3                       ((uint32_t)0x00000008)        /*!< Falling trigger event configuration bit of line 3 */
-#define  EXTI_FTSR_TR4                       ((uint32_t)0x00000010)        /*!< Falling trigger event configuration bit of line 4 */
-#define  EXTI_FTSR_TR5                       ((uint32_t)0x00000020)        /*!< Falling trigger event configuration bit of line 5 */
-#define  EXTI_FTSR_TR6                       ((uint32_t)0x00000040)        /*!< Falling trigger event configuration bit of line 6 */
-#define  EXTI_FTSR_TR7                       ((uint32_t)0x00000080)        /*!< Falling trigger event configuration bit of line 7 */
-#define  EXTI_FTSR_TR8                       ((uint32_t)0x00000100)        /*!< Falling trigger event configuration bit of line 8 */
-#define  EXTI_FTSR_TR9                       ((uint32_t)0x00000200)        /*!< Falling trigger event configuration bit of line 9 */
-#define  EXTI_FTSR_TR10                      ((uint32_t)0x00000400)        /*!< Falling trigger event configuration bit of line 10 */
-#define  EXTI_FTSR_TR11                      ((uint32_t)0x00000800)        /*!< Falling trigger event configuration bit of line 11 */
-#define  EXTI_FTSR_TR12                      ((uint32_t)0x00001000)        /*!< Falling trigger event configuration bit of line 12 */
-#define  EXTI_FTSR_TR13                      ((uint32_t)0x00002000)        /*!< Falling trigger event configuration bit of line 13 */
-#define  EXTI_FTSR_TR14                      ((uint32_t)0x00004000)        /*!< Falling trigger event configuration bit of line 14 */
-#define  EXTI_FTSR_TR15                      ((uint32_t)0x00008000)        /*!< Falling trigger event configuration bit of line 15 */
-#define  EXTI_FTSR_TR16                      ((uint32_t)0x00010000)        /*!< Falling trigger event configuration bit of line 16 */
-#define  EXTI_FTSR_TR17                      ((uint32_t)0x00020000)        /*!< Falling trigger event configuration bit of line 17 */
-#define  EXTI_FTSR_TR18                      ((uint32_t)0x00040000)        /*!< Falling trigger event configuration bit of line 18 */
-#define  EXTI_FTSR_TR19                      ((uint32_t)0x00080000)        /*!< Falling trigger event configuration bit of line 19 */
-
-/******************  Bit definition for EXTI_SWIER register  ******************/
-#define  EXTI_SWIER_SWIER0                   ((uint32_t)0x00000001)        /*!< Software Interrupt on line 0 */
-#define  EXTI_SWIER_SWIER1                   ((uint32_t)0x00000002)        /*!< Software Interrupt on line 1 */
-#define  EXTI_SWIER_SWIER2                   ((uint32_t)0x00000004)        /*!< Software Interrupt on line 2 */
-#define  EXTI_SWIER_SWIER3                   ((uint32_t)0x00000008)        /*!< Software Interrupt on line 3 */
-#define  EXTI_SWIER_SWIER4                   ((uint32_t)0x00000010)        /*!< Software Interrupt on line 4 */
-#define  EXTI_SWIER_SWIER5                   ((uint32_t)0x00000020)        /*!< Software Interrupt on line 5 */
-#define  EXTI_SWIER_SWIER6                   ((uint32_t)0x00000040)        /*!< Software Interrupt on line 6 */
-#define  EXTI_SWIER_SWIER7                   ((uint32_t)0x00000080)        /*!< Software Interrupt on line 7 */
-#define  EXTI_SWIER_SWIER8                   ((uint32_t)0x00000100)        /*!< Software Interrupt on line 8 */
-#define  EXTI_SWIER_SWIER9                   ((uint32_t)0x00000200)        /*!< Software Interrupt on line 9 */
-#define  EXTI_SWIER_SWIER10                  ((uint32_t)0x00000400)        /*!< Software Interrupt on line 10 */
-#define  EXTI_SWIER_SWIER11                  ((uint32_t)0x00000800)        /*!< Software Interrupt on line 11 */
-#define  EXTI_SWIER_SWIER12                  ((uint32_t)0x00001000)        /*!< Software Interrupt on line 12 */
-#define  EXTI_SWIER_SWIER13                  ((uint32_t)0x00002000)        /*!< Software Interrupt on line 13 */
-#define  EXTI_SWIER_SWIER14                  ((uint32_t)0x00004000)        /*!< Software Interrupt on line 14 */
-#define  EXTI_SWIER_SWIER15                  ((uint32_t)0x00008000)        /*!< Software Interrupt on line 15 */
-#define  EXTI_SWIER_SWIER16                  ((uint32_t)0x00010000)        /*!< Software Interrupt on line 16 */
-#define  EXTI_SWIER_SWIER17                  ((uint32_t)0x00020000)        /*!< Software Interrupt on line 17 */
-#define  EXTI_SWIER_SWIER18                  ((uint32_t)0x00040000)        /*!< Software Interrupt on line 18 */
-#define  EXTI_SWIER_SWIER19                  ((uint32_t)0x00080000)        /*!< Software Interrupt on line 19 */
-
-/*******************  Bit definition for EXTI_PR register  ********************/
-#define  EXTI_PR_PR0                         ((uint32_t)0x00000001)        /*!< Pending bit for line 0 */
-#define  EXTI_PR_PR1                         ((uint32_t)0x00000002)        /*!< Pending bit for line 1 */
-#define  EXTI_PR_PR2                         ((uint32_t)0x00000004)        /*!< Pending bit for line 2 */
-#define  EXTI_PR_PR3                         ((uint32_t)0x00000008)        /*!< Pending bit for line 3 */
-#define  EXTI_PR_PR4                         ((uint32_t)0x00000010)        /*!< Pending bit for line 4 */
-#define  EXTI_PR_PR5                         ((uint32_t)0x00000020)        /*!< Pending bit for line 5 */
-#define  EXTI_PR_PR6                         ((uint32_t)0x00000040)        /*!< Pending bit for line 6 */
-#define  EXTI_PR_PR7                         ((uint32_t)0x00000080)        /*!< Pending bit for line 7 */
-#define  EXTI_PR_PR8                         ((uint32_t)0x00000100)        /*!< Pending bit for line 8 */
-#define  EXTI_PR_PR9                         ((uint32_t)0x00000200)        /*!< Pending bit for line 9 */
-#define  EXTI_PR_PR10                        ((uint32_t)0x00000400)        /*!< Pending bit for line 10 */
-#define  EXTI_PR_PR11                        ((uint32_t)0x00000800)        /*!< Pending bit for line 11 */
-#define  EXTI_PR_PR12                        ((uint32_t)0x00001000)        /*!< Pending bit for line 12 */
-#define  EXTI_PR_PR13                        ((uint32_t)0x00002000)        /*!< Pending bit for line 13 */
-#define  EXTI_PR_PR14                        ((uint32_t)0x00004000)        /*!< Pending bit for line 14 */
-#define  EXTI_PR_PR15                        ((uint32_t)0x00008000)        /*!< Pending bit for line 15 */
-#define  EXTI_PR_PR16                        ((uint32_t)0x00010000)        /*!< Pending bit for line 16 */
-#define  EXTI_PR_PR17                        ((uint32_t)0x00020000)        /*!< Pending bit for line 17 */
-#define  EXTI_PR_PR18                        ((uint32_t)0x00040000)        /*!< Pending bit for line 18 */
-#define  EXTI_PR_PR19                        ((uint32_t)0x00080000)        /*!< Pending bit for line 19 */
-
-/******************************************************************************/
-/*                                                                            */
-/*                                    FLASH                                   */
-/*                                                                            */
-/******************************************************************************/
-/*******************  Bits definition for FLASH_ACR register  *****************/
-#define FLASH_ACR_LATENCY                    ((uint32_t)0x0000000F)
-#define FLASH_ACR_LATENCY_0WS                ((uint32_t)0x00000000)
-#define FLASH_ACR_LATENCY_1WS                ((uint32_t)0x00000001)
-#define FLASH_ACR_LATENCY_2WS                ((uint32_t)0x00000002)
-#define FLASH_ACR_LATENCY_3WS                ((uint32_t)0x00000003)
-#define FLASH_ACR_LATENCY_4WS                ((uint32_t)0x00000004)
-#define FLASH_ACR_LATENCY_5WS                ((uint32_t)0x00000005)
-#define FLASH_ACR_LATENCY_6WS                ((uint32_t)0x00000006)
-#define FLASH_ACR_LATENCY_7WS                ((uint32_t)0x00000007)
-
-#define FLASH_ACR_PRFTEN                     ((uint32_t)0x00000100)
-#define FLASH_ACR_ICEN                       ((uint32_t)0x00000200)
-#define FLASH_ACR_DCEN                       ((uint32_t)0x00000400)
-#define FLASH_ACR_ICRST                      ((uint32_t)0x00000800)
-#define FLASH_ACR_DCRST                      ((uint32_t)0x00001000)
-#define FLASH_ACR_BYTE0_ADDRESS              ((uint32_t)0x40023C00)
-#define FLASH_ACR_BYTE2_ADDRESS              ((uint32_t)0x40023C03)
-
-/*******************  Bits definition for FLASH_SR register  ******************/
-#define FLASH_SR_EOP                         ((uint32_t)0x00000001)
-#define FLASH_SR_SOP                         ((uint32_t)0x00000002)
-#define FLASH_SR_WRPERR                      ((uint32_t)0x00000010)
-#define FLASH_SR_PGAERR                      ((uint32_t)0x00000020)
-#define FLASH_SR_PGPERR                      ((uint32_t)0x00000040)
-#define FLASH_SR_PGSERR                      ((uint32_t)0x00000080)
-#define FLASH_SR_BSY                         ((uint32_t)0x00010000)
-
-/*******************  Bits definition for FLASH_CR register  ******************/
-#define FLASH_CR_PG                          ((uint32_t)0x00000001)
-#define FLASH_CR_SER                         ((uint32_t)0x00000002)
-#define FLASH_CR_MER                         ((uint32_t)0x00000004)
-#define FLASH_CR_MER1                        FLASH_CR_MER
-#define FLASH_CR_SNB                         ((uint32_t)0x000000F8)
-#define FLASH_CR_SNB_0                       ((uint32_t)0x00000008)
-#define FLASH_CR_SNB_1                       ((uint32_t)0x00000010)
-#define FLASH_CR_SNB_2                       ((uint32_t)0x00000020)
-#define FLASH_CR_SNB_3                       ((uint32_t)0x00000040)
-#define FLASH_CR_SNB_4                       ((uint32_t)0x00000040)
-#define FLASH_CR_PSIZE                       ((uint32_t)0x00000300)
-#define FLASH_CR_PSIZE_0                     ((uint32_t)0x00000100)
-#define FLASH_CR_PSIZE_1                     ((uint32_t)0x00000200)
-#define FLASH_CR_MER2                        ((uint32_t)0x00008000)
-#define FLASH_CR_STRT                        ((uint32_t)0x00010000)
-#define FLASH_CR_EOPIE                       ((uint32_t)0x01000000)
-#define FLASH_CR_LOCK                        ((uint32_t)0x80000000)
-
-/*******************  Bits definition for FLASH_OPTCR register  ***************/
-#define FLASH_OPTCR_OPTLOCK                 ((uint32_t)0x00000001)
-#define FLASH_OPTCR_OPTSTRT                 ((uint32_t)0x00000002)
-#define FLASH_OPTCR_BOR_LEV_0               ((uint32_t)0x00000004)
-#define FLASH_OPTCR_BOR_LEV_1               ((uint32_t)0x00000008)
-#define FLASH_OPTCR_BOR_LEV                 ((uint32_t)0x0000000C)
-#define FLASH_OPTCR_WDG_SW                  ((uint32_t)0x00000020)
-#define FLASH_OPTCR_nRST_STOP               ((uint32_t)0x00000040)
-#define FLASH_OPTCR_nRST_STDBY              ((uint32_t)0x00000080)
-#define FLASH_OPTCR_RDP                     ((uint32_t)0x0000FF00)
-#define FLASH_OPTCR_RDP_0                   ((uint32_t)0x00000100)
-#define FLASH_OPTCR_RDP_1                   ((uint32_t)0x00000200)
-#define FLASH_OPTCR_RDP_2                   ((uint32_t)0x00000400)
-#define FLASH_OPTCR_RDP_3                   ((uint32_t)0x00000800)
-#define FLASH_OPTCR_RDP_4                   ((uint32_t)0x00001000)
-#define FLASH_OPTCR_RDP_5                   ((uint32_t)0x00002000)
-#define FLASH_OPTCR_RDP_6                   ((uint32_t)0x00004000)
-#define FLASH_OPTCR_RDP_7                   ((uint32_t)0x00008000)
-#define FLASH_OPTCR_nWRP                    ((uint32_t)0x0FFF0000)
-#define FLASH_OPTCR_nWRP_0                  ((uint32_t)0x00010000)
-#define FLASH_OPTCR_nWRP_1                  ((uint32_t)0x00020000)
-#define FLASH_OPTCR_nWRP_2                  ((uint32_t)0x00040000)
-#define FLASH_OPTCR_nWRP_3                  ((uint32_t)0x00080000)
-#define FLASH_OPTCR_nWRP_4                  ((uint32_t)0x00100000)
-#define FLASH_OPTCR_nWRP_5                  ((uint32_t)0x00200000)
-#define FLASH_OPTCR_nWRP_6                  ((uint32_t)0x00400000)
-#define FLASH_OPTCR_nWRP_7                  ((uint32_t)0x00800000)
-#define FLASH_OPTCR_nWRP_8                  ((uint32_t)0x01000000)
-#define FLASH_OPTCR_nWRP_9                  ((uint32_t)0x02000000)
-#define FLASH_OPTCR_nWRP_10                 ((uint32_t)0x04000000)
-#define FLASH_OPTCR_nWRP_11                 ((uint32_t)0x08000000)
-                                             
-/******************  Bits definition for FLASH_OPTCR1 register  ***************/
-#define FLASH_OPTCR1_nWRP                    ((uint32_t)0x0FFF0000)
-#define FLASH_OPTCR1_nWRP_0                  ((uint32_t)0x00010000)
-#define FLASH_OPTCR1_nWRP_1                  ((uint32_t)0x00020000)
-#define FLASH_OPTCR1_nWRP_2                  ((uint32_t)0x00040000)
-#define FLASH_OPTCR1_nWRP_3                  ((uint32_t)0x00080000)
-#define FLASH_OPTCR1_nWRP_4                  ((uint32_t)0x00100000)
-#define FLASH_OPTCR1_nWRP_5                  ((uint32_t)0x00200000)
-#define FLASH_OPTCR1_nWRP_6                  ((uint32_t)0x00400000)
-#define FLASH_OPTCR1_nWRP_7                  ((uint32_t)0x00800000)
-#define FLASH_OPTCR1_nWRP_8                  ((uint32_t)0x01000000)
-#define FLASH_OPTCR1_nWRP_9                  ((uint32_t)0x02000000)
-#define FLASH_OPTCR1_nWRP_10                 ((uint32_t)0x04000000)
-#define FLASH_OPTCR1_nWRP_11                 ((uint32_t)0x08000000)
-
-
-/******************************************************************************/
-/*                                                                            */
-/*                       Flexible Static Memory Controller                    */
-/*                                                                            */
-/******************************************************************************/
-/******************  Bit definition for FSMC_BCR1 register  *******************/
-#define  FSMC_BCR1_MBKEN                     ((uint32_t)0x00000001)        /*!<Memory bank enable bit                 */
-#define  FSMC_BCR1_MUXEN                     ((uint32_t)0x00000002)        /*!<Address/data multiplexing enable bit   */
-
-#define  FSMC_BCR1_MTYP                      ((uint32_t)0x0000000C)        /*!<MTYP[1:0] bits (Memory type)           */
-#define  FSMC_BCR1_MTYP_0                    ((uint32_t)0x00000004)        /*!<Bit 0 */
-#define  FSMC_BCR1_MTYP_1                    ((uint32_t)0x00000008)        /*!<Bit 1 */
-
-#define  FSMC_BCR1_MWID                      ((uint32_t)0x00000030)        /*!<MWID[1:0] bits (Memory data bus width) */
-#define  FSMC_BCR1_MWID_0                    ((uint32_t)0x00000010)        /*!<Bit 0 */
-#define  FSMC_BCR1_MWID_1                    ((uint32_t)0x00000020)        /*!<Bit 1 */
-
-#define  FSMC_BCR1_FACCEN                    ((uint32_t)0x00000040)        /*!<Flash access enable                    */
-#define  FSMC_BCR1_BURSTEN                   ((uint32_t)0x00000100)        /*!<Burst enable bit                       */
-#define  FSMC_BCR1_WAITPOL                   ((uint32_t)0x00000200)        /*!<Wait signal polarity bit               */
-#define  FSMC_BCR1_WRAPMOD                   ((uint32_t)0x00000400)        /*!<Wrapped burst mode support             */
-#define  FSMC_BCR1_WAITCFG                   ((uint32_t)0x00000800)        /*!<Wait timing configuration              */
-#define  FSMC_BCR1_WREN                      ((uint32_t)0x00001000)        /*!<Write enable bit                       */
-#define  FSMC_BCR1_WAITEN                    ((uint32_t)0x00002000)        /*!<Wait enable bit                        */
-#define  FSMC_BCR1_EXTMOD                    ((uint32_t)0x00004000)        /*!<Extended mode enable                   */
-#define  FSMC_BCR1_ASYNCWAIT                 ((uint32_t)0x00008000)        /*!<Asynchronous wait                      */
-#define  FSMC_BCR1_CBURSTRW                  ((uint32_t)0x00080000)        /*!<Write burst enable                     */
-
-/******************  Bit definition for FSMC_BCR2 register  *******************/
-#define  FSMC_BCR2_MBKEN                     ((uint32_t)0x00000001)        /*!<Memory bank enable bit                */
-#define  FSMC_BCR2_MUXEN                     ((uint32_t)0x00000002)        /*!<Address/data multiplexing enable bit   */
-
-#define  FSMC_BCR2_MTYP                      ((uint32_t)0x0000000C)        /*!<MTYP[1:0] bits (Memory type)           */
-#define  FSMC_BCR2_MTYP_0                    ((uint32_t)0x00000004)        /*!<Bit 0 */
-#define  FSMC_BCR2_MTYP_1                    ((uint32_t)0x00000008)        /*!<Bit 1 */
-
-#define  FSMC_BCR2_MWID                      ((uint32_t)0x00000030)        /*!<MWID[1:0] bits (Memory data bus width) */
-#define  FSMC_BCR2_MWID_0                    ((uint32_t)0x00000010)        /*!<Bit 0 */
-#define  FSMC_BCR2_MWID_1                    ((uint32_t)0x00000020)        /*!<Bit 1 */
-
-#define  FSMC_BCR2_FACCEN                    ((uint32_t)0x00000040)        /*!<Flash access enable                    */
-#define  FSMC_BCR2_BURSTEN                   ((uint32_t)0x00000100)        /*!<Burst enable bit                       */
-#define  FSMC_BCR2_WAITPOL                   ((uint32_t)0x00000200)        /*!<Wait signal polarity bit               */
-#define  FSMC_BCR2_WRAPMOD                   ((uint32_t)0x00000400)        /*!<Wrapped burst mode support             */
-#define  FSMC_BCR2_WAITCFG                   ((uint32_t)0x00000800)        /*!<Wait timing configuration              */
-#define  FSMC_BCR2_WREN                      ((uint32_t)0x00001000)        /*!<Write enable bit                       */
-#define  FSMC_BCR2_WAITEN                    ((uint32_t)0x00002000)        /*!<Wait enable bit                        */
-#define  FSMC_BCR2_EXTMOD                    ((uint32_t)0x00004000)        /*!<Extended mode enable                   */
-#define  FSMC_BCR2_ASYNCWAIT                 ((uint32_t)0x00008000)        /*!<Asynchronous wait                      */
-#define  FSMC_BCR2_CBURSTRW                  ((uint32_t)0x00080000)        /*!<Write burst enable                     */
-
-/******************  Bit definition for FSMC_BCR3 register  *******************/
-#define  FSMC_BCR3_MBKEN                     ((uint32_t)0x00000001)        /*!<Memory bank enable bit                 */
-#define  FSMC_BCR3_MUXEN                     ((uint32_t)0x00000002)        /*!<Address/data multiplexing enable bit   */
-
-#define  FSMC_BCR3_MTYP                      ((uint32_t)0x0000000C)        /*!<MTYP[1:0] bits (Memory type)           */
-#define  FSMC_BCR3_MTYP_0                    ((uint32_t)0x00000004)        /*!<Bit 0 */
-#define  FSMC_BCR3_MTYP_1                    ((uint32_t)0x00000008)        /*!<Bit 1 */
-
-#define  FSMC_BCR3_MWID                      ((uint32_t)0x00000030)        /*!<MWID[1:0] bits (Memory data bus width) */
-#define  FSMC_BCR3_MWID_0                    ((uint32_t)0x00000010)        /*!<Bit 0 */
-#define  FSMC_BCR3_MWID_1                    ((uint32_t)0x00000020)        /*!<Bit 1 */
-
-#define  FSMC_BCR3_FACCEN                    ((uint32_t)0x00000040)        /*!<Flash access enable                    */
-#define  FSMC_BCR3_BURSTEN                   ((uint32_t)0x00000100)        /*!<Burst enable bit                       */
-#define  FSMC_BCR3_WAITPOL                   ((uint32_t)0x00000200)        /*!<Wait signal polarity bit               */
-#define  FSMC_BCR3_WRAPMOD                   ((uint32_t)0x00000400)        /*!<Wrapped burst mode support             */
-#define  FSMC_BCR3_WAITCFG                   ((uint32_t)0x00000800)        /*!<Wait timing configuration              */
-#define  FSMC_BCR3_WREN                      ((uint32_t)0x00001000)        /*!<Write enable bit                       */
-#define  FSMC_BCR3_WAITEN                    ((uint32_t)0x00002000)        /*!<Wait enable bit                        */
-#define  FSMC_BCR3_EXTMOD                    ((uint32_t)0x00004000)        /*!<Extended mode enable                   */
-#define  FSMC_BCR3_ASYNCWAIT                 ((uint32_t)0x00008000)        /*!<Asynchronous wait                      */
-#define  FSMC_BCR3_CBURSTRW                  ((uint32_t)0x00080000)        /*!<Write burst enable                     */
-
-/******************  Bit definition for FSMC_BCR4 register  *******************/
-#define  FSMC_BCR4_MBKEN                     ((uint32_t)0x00000001)        /*!<Memory bank enable bit */
-#define  FSMC_BCR4_MUXEN                     ((uint32_t)0x00000002)        /*!<Address/data multiplexing enable bit   */
-
-#define  FSMC_BCR4_MTYP                      ((uint32_t)0x0000000C)        /*!<MTYP[1:0] bits (Memory type)           */
-#define  FSMC_BCR4_MTYP_0                    ((uint32_t)0x00000004)        /*!<Bit 0 */
-#define  FSMC_BCR4_MTYP_1                    ((uint32_t)0x00000008)        /*!<Bit 1 */
-
-#define  FSMC_BCR4_MWID                      ((uint32_t)0x00000030)        /*!<MWID[1:0] bits (Memory data bus width) */
-#define  FSMC_BCR4_MWID_0                    ((uint32_t)0x00000010)        /*!<Bit 0 */
-#define  FSMC_BCR4_MWID_1                    ((uint32_t)0x00000020)        /*!<Bit 1 */
-
-#define  FSMC_BCR4_FACCEN                    ((uint32_t)0x00000040)        /*!<Flash access enable                    */
-#define  FSMC_BCR4_BURSTEN                   ((uint32_t)0x00000100)        /*!<Burst enable bit                       */
-#define  FSMC_BCR4_WAITPOL                   ((uint32_t)0x00000200)        /*!<Wait signal polarity bit               */
-#define  FSMC_BCR4_WRAPMOD                   ((uint32_t)0x00000400)        /*!<Wrapped burst mode support             */
-#define  FSMC_BCR4_WAITCFG                   ((uint32_t)0x00000800)        /*!<Wait timing configuration              */
-#define  FSMC_BCR4_WREN                      ((uint32_t)0x00001000)        /*!<Write enable bit                       */
-#define  FSMC_BCR4_WAITEN                    ((uint32_t)0x00002000)        /*!<Wait enable bit                        */
-#define  FSMC_BCR4_EXTMOD                    ((uint32_t)0x00004000)        /*!<Extended mode enable                   */
-#define  FSMC_BCR4_ASYNCWAIT                 ((uint32_t)0x00008000)        /*!<Asynchronous wait                      */
-#define  FSMC_BCR4_CBURSTRW                  ((uint32_t)0x00080000)        /*!<Write burst enable                     */
-
-/******************  Bit definition for FSMC_BTR1 register  ******************/
-#define  FSMC_BTR1_ADDSET                    ((uint32_t)0x0000000F)        /*!<ADDSET[3:0] bits (Address setup phase duration) */
-#define  FSMC_BTR1_ADDSET_0                  ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  FSMC_BTR1_ADDSET_1                  ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  FSMC_BTR1_ADDSET_2                  ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  FSMC_BTR1_ADDSET_3                  ((uint32_t)0x00000008)        /*!<Bit 3 */
-
-#define  FSMC_BTR1_ADDHLD                    ((uint32_t)0x000000F0)        /*!<ADDHLD[3:0] bits (Address-hold phase duration) */
-#define  FSMC_BTR1_ADDHLD_0                  ((uint32_t)0x00000010)        /*!<Bit 0 */
-#define  FSMC_BTR1_ADDHLD_1                  ((uint32_t)0x00000020)        /*!<Bit 1 */
-#define  FSMC_BTR1_ADDHLD_2                  ((uint32_t)0x00000040)        /*!<Bit 2 */
-#define  FSMC_BTR1_ADDHLD_3                  ((uint32_t)0x00000080)        /*!<Bit 3 */
-
-#define  FSMC_BTR1_DATAST                    ((uint32_t)0x0000FF00)        /*!<DATAST [3:0] bits (Data-phase duration) */
-#define  FSMC_BTR1_DATAST_0                  ((uint32_t)0x00000100)        /*!<Bit 0 */
-#define  FSMC_BTR1_DATAST_1                  ((uint32_t)0x00000200)        /*!<Bit 1 */
-#define  FSMC_BTR1_DATAST_2                  ((uint32_t)0x00000400)        /*!<Bit 2 */
-#define  FSMC_BTR1_DATAST_3                  ((uint32_t)0x00000800)        /*!<Bit 3 */
-
-#define  FSMC_BTR1_BUSTURN                   ((uint32_t)0x000F0000)        /*!<BUSTURN[3:0] bits (Bus turnaround phase duration) */
-#define  FSMC_BTR1_BUSTURN_0                 ((uint32_t)0x00010000)        /*!<Bit 0 */
-#define  FSMC_BTR1_BUSTURN_1                 ((uint32_t)0x00020000)        /*!<Bit 1 */
-#define  FSMC_BTR1_BUSTURN_2                 ((uint32_t)0x00040000)        /*!<Bit 2 */
-#define  FSMC_BTR1_BUSTURN_3                 ((uint32_t)0x00080000)        /*!<Bit 3 */
-
-#define  FSMC_BTR1_CLKDIV                    ((uint32_t)0x00F00000)        /*!<CLKDIV[3:0] bits (Clock divide ratio) */
-#define  FSMC_BTR1_CLKDIV_0                  ((uint32_t)0x00100000)        /*!<Bit 0 */
-#define  FSMC_BTR1_CLKDIV_1                  ((uint32_t)0x00200000)        /*!<Bit 1 */
-#define  FSMC_BTR1_CLKDIV_2                  ((uint32_t)0x00400000)        /*!<Bit 2 */
-#define  FSMC_BTR1_CLKDIV_3                  ((uint32_t)0x00800000)        /*!<Bit 3 */
-
-#define  FSMC_BTR1_DATLAT                    ((uint32_t)0x0F000000)        /*!<DATLA[3:0] bits (Data latency) */
-#define  FSMC_BTR1_DATLAT_0                  ((uint32_t)0x01000000)        /*!<Bit 0 */
-#define  FSMC_BTR1_DATLAT_1                  ((uint32_t)0x02000000)        /*!<Bit 1 */
-#define  FSMC_BTR1_DATLAT_2                  ((uint32_t)0x04000000)        /*!<Bit 2 */
-#define  FSMC_BTR1_DATLAT_3                  ((uint32_t)0x08000000)        /*!<Bit 3 */
-
-#define  FSMC_BTR1_ACCMOD                    ((uint32_t)0x30000000)        /*!<ACCMOD[1:0] bits (Access mode) */
-#define  FSMC_BTR1_ACCMOD_0                  ((uint32_t)0x10000000)        /*!<Bit 0 */
-#define  FSMC_BTR1_ACCMOD_1                  ((uint32_t)0x20000000)        /*!<Bit 1 */
-
-/******************  Bit definition for FSMC_BTR2 register  *******************/
-#define  FSMC_BTR2_ADDSET                    ((uint32_t)0x0000000F)        /*!<ADDSET[3:0] bits (Address setup phase duration) */
-#define  FSMC_BTR2_ADDSET_0                  ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  FSMC_BTR2_ADDSET_1                  ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  FSMC_BTR2_ADDSET_2                  ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  FSMC_BTR2_ADDSET_3                  ((uint32_t)0x00000008)        /*!<Bit 3 */
-
-#define  FSMC_BTR2_ADDHLD                    ((uint32_t)0x000000F0)        /*!<ADDHLD[3:0] bits (Address-hold phase duration) */
-#define  FSMC_BTR2_ADDHLD_0                  ((uint32_t)0x00000010)        /*!<Bit 0 */
-#define  FSMC_BTR2_ADDHLD_1                  ((uint32_t)0x00000020)        /*!<Bit 1 */
-#define  FSMC_BTR2_ADDHLD_2                  ((uint32_t)0x00000040)        /*!<Bit 2 */
-#define  FSMC_BTR2_ADDHLD_3                  ((uint32_t)0x00000080)        /*!<Bit 3 */
-
-#define  FSMC_BTR2_DATAST                    ((uint32_t)0x0000FF00)        /*!<DATAST [3:0] bits (Data-phase duration) */
-#define  FSMC_BTR2_DATAST_0                  ((uint32_t)0x00000100)        /*!<Bit 0 */
-#define  FSMC_BTR2_DATAST_1                  ((uint32_t)0x00000200)        /*!<Bit 1 */
-#define  FSMC_BTR2_DATAST_2                  ((uint32_t)0x00000400)        /*!<Bit 2 */
-#define  FSMC_BTR2_DATAST_3                  ((uint32_t)0x00000800)        /*!<Bit 3 */
-
-#define  FSMC_BTR2_BUSTURN                   ((uint32_t)0x000F0000)        /*!<BUSTURN[3:0] bits (Bus turnaround phase duration) */
-#define  FSMC_BTR2_BUSTURN_0                 ((uint32_t)0x00010000)        /*!<Bit 0 */
-#define  FSMC_BTR2_BUSTURN_1                 ((uint32_t)0x00020000)        /*!<Bit 1 */
-#define  FSMC_BTR2_BUSTURN_2                 ((uint32_t)0x00040000)        /*!<Bit 2 */
-#define  FSMC_BTR2_BUSTURN_3                 ((uint32_t)0x00080000)        /*!<Bit 3 */
-
-#define  FSMC_BTR2_CLKDIV                    ((uint32_t)0x00F00000)        /*!<CLKDIV[3:0] bits (Clock divide ratio) */
-#define  FSMC_BTR2_CLKDIV_0                  ((uint32_t)0x00100000)        /*!<Bit 0 */
-#define  FSMC_BTR2_CLKDIV_1                  ((uint32_t)0x00200000)        /*!<Bit 1 */
-#define  FSMC_BTR2_CLKDIV_2                  ((uint32_t)0x00400000)        /*!<Bit 2 */
-#define  FSMC_BTR2_CLKDIV_3                  ((uint32_t)0x00800000)        /*!<Bit 3 */
-
-#define  FSMC_BTR2_DATLAT                    ((uint32_t)0x0F000000)        /*!<DATLA[3:0] bits (Data latency) */
-#define  FSMC_BTR2_DATLAT_0                  ((uint32_t)0x01000000)        /*!<Bit 0 */
-#define  FSMC_BTR2_DATLAT_1                  ((uint32_t)0x02000000)        /*!<Bit 1 */
-#define  FSMC_BTR2_DATLAT_2                  ((uint32_t)0x04000000)        /*!<Bit 2 */
-#define  FSMC_BTR2_DATLAT_3                  ((uint32_t)0x08000000)        /*!<Bit 3 */
-
-#define  FSMC_BTR2_ACCMOD                    ((uint32_t)0x30000000)        /*!<ACCMOD[1:0] bits (Access mode) */
-#define  FSMC_BTR2_ACCMOD_0                  ((uint32_t)0x10000000)        /*!<Bit 0 */
-#define  FSMC_BTR2_ACCMOD_1                  ((uint32_t)0x20000000)        /*!<Bit 1 */
-
-/*******************  Bit definition for FSMC_BTR3 register  *******************/
-#define  FSMC_BTR3_ADDSET                    ((uint32_t)0x0000000F)        /*!<ADDSET[3:0] bits (Address setup phase duration) */
-#define  FSMC_BTR3_ADDSET_0                  ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  FSMC_BTR3_ADDSET_1                  ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  FSMC_BTR3_ADDSET_2                  ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  FSMC_BTR3_ADDSET_3                  ((uint32_t)0x00000008)        /*!<Bit 3 */
-
-#define  FSMC_BTR3_ADDHLD                    ((uint32_t)0x000000F0)        /*!<ADDHLD[3:0] bits (Address-hold phase duration) */
-#define  FSMC_BTR3_ADDHLD_0                  ((uint32_t)0x00000010)        /*!<Bit 0 */
-#define  FSMC_BTR3_ADDHLD_1                  ((uint32_t)0x00000020)        /*!<Bit 1 */
-#define  FSMC_BTR3_ADDHLD_2                  ((uint32_t)0x00000040)        /*!<Bit 2 */
-#define  FSMC_BTR3_ADDHLD_3                  ((uint32_t)0x00000080)        /*!<Bit 3 */
-
-#define  FSMC_BTR3_DATAST                    ((uint32_t)0x0000FF00)        /*!<DATAST [3:0] bits (Data-phase duration) */
-#define  FSMC_BTR3_DATAST_0                  ((uint32_t)0x00000100)        /*!<Bit 0 */
-#define  FSMC_BTR3_DATAST_1                  ((uint32_t)0x00000200)        /*!<Bit 1 */
-#define  FSMC_BTR3_DATAST_2                  ((uint32_t)0x00000400)        /*!<Bit 2 */
-#define  FSMC_BTR3_DATAST_3                  ((uint32_t)0x00000800)        /*!<Bit 3 */
-
-#define  FSMC_BTR3_BUSTURN                   ((uint32_t)0x000F0000)        /*!<BUSTURN[3:0] bits (Bus turnaround phase duration) */
-#define  FSMC_BTR3_BUSTURN_0                 ((uint32_t)0x00010000)        /*!<Bit 0 */
-#define  FSMC_BTR3_BUSTURN_1                 ((uint32_t)0x00020000)        /*!<Bit 1 */
-#define  FSMC_BTR3_BUSTURN_2                 ((uint32_t)0x00040000)        /*!<Bit 2 */
-#define  FSMC_BTR3_BUSTURN_3                 ((uint32_t)0x00080000)        /*!<Bit 3 */
-
-#define  FSMC_BTR3_CLKDIV                    ((uint32_t)0x00F00000)        /*!<CLKDIV[3:0] bits (Clock divide ratio) */
-#define  FSMC_BTR3_CLKDIV_0                  ((uint32_t)0x00100000)        /*!<Bit 0 */
-#define  FSMC_BTR3_CLKDIV_1                  ((uint32_t)0x00200000)        /*!<Bit 1 */
-#define  FSMC_BTR3_CLKDIV_2                  ((uint32_t)0x00400000)        /*!<Bit 2 */
-#define  FSMC_BTR3_CLKDIV_3                  ((uint32_t)0x00800000)        /*!<Bit 3 */
-
-#define  FSMC_BTR3_DATLAT                    ((uint32_t)0x0F000000)        /*!<DATLA[3:0] bits (Data latency) */
-#define  FSMC_BTR3_DATLAT_0                  ((uint32_t)0x01000000)        /*!<Bit 0 */
-#define  FSMC_BTR3_DATLAT_1                  ((uint32_t)0x02000000)        /*!<Bit 1 */
-#define  FSMC_BTR3_DATLAT_2                  ((uint32_t)0x04000000)        /*!<Bit 2 */
-#define  FSMC_BTR3_DATLAT_3                  ((uint32_t)0x08000000)        /*!<Bit 3 */
-
-#define  FSMC_BTR3_ACCMOD                    ((uint32_t)0x30000000)        /*!<ACCMOD[1:0] bits (Access mode) */
-#define  FSMC_BTR3_ACCMOD_0                  ((uint32_t)0x10000000)        /*!<Bit 0 */
-#define  FSMC_BTR3_ACCMOD_1                  ((uint32_t)0x20000000)        /*!<Bit 1 */
-
-/******************  Bit definition for FSMC_BTR4 register  *******************/
-#define  FSMC_BTR4_ADDSET                    ((uint32_t)0x0000000F)        /*!<ADDSET[3:0] bits (Address setup phase duration) */
-#define  FSMC_BTR4_ADDSET_0                  ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  FSMC_BTR4_ADDSET_1                  ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  FSMC_BTR4_ADDSET_2                  ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  FSMC_BTR4_ADDSET_3                  ((uint32_t)0x00000008)        /*!<Bit 3 */
-
-#define  FSMC_BTR4_ADDHLD                    ((uint32_t)0x000000F0)        /*!<ADDHLD[3:0] bits (Address-hold phase duration) */
-#define  FSMC_BTR4_ADDHLD_0                  ((uint32_t)0x00000010)        /*!<Bit 0 */
-#define  FSMC_BTR4_ADDHLD_1                  ((uint32_t)0x00000020)        /*!<Bit 1 */
-#define  FSMC_BTR4_ADDHLD_2                  ((uint32_t)0x00000040)        /*!<Bit 2 */
-#define  FSMC_BTR4_ADDHLD_3                  ((uint32_t)0x00000080)        /*!<Bit 3 */
-
-#define  FSMC_BTR4_DATAST                    ((uint32_t)0x0000FF00)        /*!<DATAST [3:0] bits (Data-phase duration) */
-#define  FSMC_BTR4_DATAST_0                  ((uint32_t)0x00000100)        /*!<Bit 0 */
-#define  FSMC_BTR4_DATAST_1                  ((uint32_t)0x00000200)        /*!<Bit 1 */
-#define  FSMC_BTR4_DATAST_2                  ((uint32_t)0x00000400)        /*!<Bit 2 */
-#define  FSMC_BTR4_DATAST_3                  ((uint32_t)0x00000800)        /*!<Bit 3 */
-
-#define  FSMC_BTR4_BUSTURN                   ((uint32_t)0x000F0000)        /*!<BUSTURN[3:0] bits (Bus turnaround phase duration) */
-#define  FSMC_BTR4_BUSTURN_0                 ((uint32_t)0x00010000)        /*!<Bit 0 */
-#define  FSMC_BTR4_BUSTURN_1                 ((uint32_t)0x00020000)        /*!<Bit 1 */
-#define  FSMC_BTR4_BUSTURN_2                 ((uint32_t)0x00040000)        /*!<Bit 2 */
-#define  FSMC_BTR4_BUSTURN_3                 ((uint32_t)0x00080000)        /*!<Bit 3 */
-
-#define  FSMC_BTR4_CLKDIV                    ((uint32_t)0x00F00000)        /*!<CLKDIV[3:0] bits (Clock divide ratio) */
-#define  FSMC_BTR4_CLKDIV_0                  ((uint32_t)0x00100000)        /*!<Bit 0 */
-#define  FSMC_BTR4_CLKDIV_1                  ((uint32_t)0x00200000)        /*!<Bit 1 */
-#define  FSMC_BTR4_CLKDIV_2                  ((uint32_t)0x00400000)        /*!<Bit 2 */
-#define  FSMC_BTR4_CLKDIV_3                  ((uint32_t)0x00800000)        /*!<Bit 3 */
-
-#define  FSMC_BTR4_DATLAT                    ((uint32_t)0x0F000000)        /*!<DATLA[3:0] bits (Data latency) */
-#define  FSMC_BTR4_DATLAT_0                  ((uint32_t)0x01000000)        /*!<Bit 0 */
-#define  FSMC_BTR4_DATLAT_1                  ((uint32_t)0x02000000)        /*!<Bit 1 */
-#define  FSMC_BTR4_DATLAT_2                  ((uint32_t)0x04000000)        /*!<Bit 2 */
-#define  FSMC_BTR4_DATLAT_3                  ((uint32_t)0x08000000)        /*!<Bit 3 */
-
-#define  FSMC_BTR4_ACCMOD                    ((uint32_t)0x30000000)        /*!<ACCMOD[1:0] bits (Access mode) */
-#define  FSMC_BTR4_ACCMOD_0                  ((uint32_t)0x10000000)        /*!<Bit 0 */
-#define  FSMC_BTR4_ACCMOD_1                  ((uint32_t)0x20000000)        /*!<Bit 1 */
-
-/******************  Bit definition for FSMC_BWTR1 register  ******************/
-#define  FSMC_BWTR1_ADDSET                   ((uint32_t)0x0000000F)        /*!<ADDSET[3:0] bits (Address setup phase duration) */
-#define  FSMC_BWTR1_ADDSET_0                 ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  FSMC_BWTR1_ADDSET_1                 ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  FSMC_BWTR1_ADDSET_2                 ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  FSMC_BWTR1_ADDSET_3                 ((uint32_t)0x00000008)        /*!<Bit 3 */
-
-#define  FSMC_BWTR1_ADDHLD                   ((uint32_t)0x000000F0)        /*!<ADDHLD[3:0] bits (Address-hold phase duration) */
-#define  FSMC_BWTR1_ADDHLD_0                 ((uint32_t)0x00000010)        /*!<Bit 0 */
-#define  FSMC_BWTR1_ADDHLD_1                 ((uint32_t)0x00000020)        /*!<Bit 1 */
-#define  FSMC_BWTR1_ADDHLD_2                 ((uint32_t)0x00000040)        /*!<Bit 2 */
-#define  FSMC_BWTR1_ADDHLD_3                 ((uint32_t)0x00000080)        /*!<Bit 3 */
-
-#define  FSMC_BWTR1_DATAST                   ((uint32_t)0x0000FF00)        /*!<DATAST [3:0] bits (Data-phase duration) */
-#define  FSMC_BWTR1_DATAST_0                 ((uint32_t)0x00000100)        /*!<Bit 0 */
-#define  FSMC_BWTR1_DATAST_1                 ((uint32_t)0x00000200)        /*!<Bit 1 */
-#define  FSMC_BWTR1_DATAST_2                 ((uint32_t)0x00000400)        /*!<Bit 2 */
-#define  FSMC_BWTR1_DATAST_3                 ((uint32_t)0x00000800)        /*!<Bit 3 */
-
-#define  FSMC_BWTR1_CLKDIV                   ((uint32_t)0x00F00000)        /*!<CLKDIV[3:0] bits (Clock divide ratio) */
-#define  FSMC_BWTR1_CLKDIV_0                 ((uint32_t)0x00100000)        /*!<Bit 0 */
-#define  FSMC_BWTR1_CLKDIV_1                 ((uint32_t)0x00200000)        /*!<Bit 1 */
-#define  FSMC_BWTR1_CLKDIV_2                 ((uint32_t)0x00400000)        /*!<Bit 2 */
-#define  FSMC_BWTR1_CLKDIV_3                 ((uint32_t)0x00800000)        /*!<Bit 3 */
-
-#define  FSMC_BWTR1_DATLAT                   ((uint32_t)0x0F000000)        /*!<DATLA[3:0] bits (Data latency) */
-#define  FSMC_BWTR1_DATLAT_0                 ((uint32_t)0x01000000)        /*!<Bit 0 */
-#define  FSMC_BWTR1_DATLAT_1                 ((uint32_t)0x02000000)        /*!<Bit 1 */
-#define  FSMC_BWTR1_DATLAT_2                 ((uint32_t)0x04000000)        /*!<Bit 2 */
-#define  FSMC_BWTR1_DATLAT_3                 ((uint32_t)0x08000000)        /*!<Bit 3 */
-
-#define  FSMC_BWTR1_ACCMOD                   ((uint32_t)0x30000000)        /*!<ACCMOD[1:0] bits (Access mode) */
-#define  FSMC_BWTR1_ACCMOD_0                 ((uint32_t)0x10000000)        /*!<Bit 0 */
-#define  FSMC_BWTR1_ACCMOD_1                 ((uint32_t)0x20000000)        /*!<Bit 1 */
-
-/******************  Bit definition for FSMC_BWTR2 register  ******************/
-#define  FSMC_BWTR2_ADDSET                   ((uint32_t)0x0000000F)        /*!<ADDSET[3:0] bits (Address setup phase duration) */
-#define  FSMC_BWTR2_ADDSET_0                 ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  FSMC_BWTR2_ADDSET_1                 ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  FSMC_BWTR2_ADDSET_2                 ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  FSMC_BWTR2_ADDSET_3                 ((uint32_t)0x00000008)        /*!<Bit 3 */
-
-#define  FSMC_BWTR2_ADDHLD                   ((uint32_t)0x000000F0)        /*!<ADDHLD[3:0] bits (Address-hold phase duration) */
-#define  FSMC_BWTR2_ADDHLD_0                 ((uint32_t)0x00000010)        /*!<Bit 0 */
-#define  FSMC_BWTR2_ADDHLD_1                 ((uint32_t)0x00000020)        /*!<Bit 1 */
-#define  FSMC_BWTR2_ADDHLD_2                 ((uint32_t)0x00000040)        /*!<Bit 2 */
-#define  FSMC_BWTR2_ADDHLD_3                 ((uint32_t)0x00000080)        /*!<Bit 3 */
-
-#define  FSMC_BWTR2_DATAST                   ((uint32_t)0x0000FF00)        /*!<DATAST [3:0] bits (Data-phase duration) */
-#define  FSMC_BWTR2_DATAST_0                 ((uint32_t)0x00000100)        /*!<Bit 0 */
-#define  FSMC_BWTR2_DATAST_1                 ((uint32_t)0x00000200)        /*!<Bit 1 */
-#define  FSMC_BWTR2_DATAST_2                 ((uint32_t)0x00000400)        /*!<Bit 2 */
-#define  FSMC_BWTR2_DATAST_3                 ((uint32_t)0x00000800)        /*!<Bit 3 */
-
-#define  FSMC_BWTR2_CLKDIV                   ((uint32_t)0x00F00000)        /*!<CLKDIV[3:0] bits (Clock divide ratio) */
-#define  FSMC_BWTR2_CLKDIV_0                 ((uint32_t)0x00100000)        /*!<Bit 0 */
-#define  FSMC_BWTR2_CLKDIV_1                 ((uint32_t)0x00200000)        /*!<Bit 1*/
-#define  FSMC_BWTR2_CLKDIV_2                 ((uint32_t)0x00400000)        /*!<Bit 2 */
-#define  FSMC_BWTR2_CLKDIV_3                 ((uint32_t)0x00800000)        /*!<Bit 3 */
-
-#define  FSMC_BWTR2_DATLAT                   ((uint32_t)0x0F000000)        /*!<DATLA[3:0] bits (Data latency) */
-#define  FSMC_BWTR2_DATLAT_0                 ((uint32_t)0x01000000)        /*!<Bit 0 */
-#define  FSMC_BWTR2_DATLAT_1                 ((uint32_t)0x02000000)        /*!<Bit 1 */
-#define  FSMC_BWTR2_DATLAT_2                 ((uint32_t)0x04000000)        /*!<Bit 2 */
-#define  FSMC_BWTR2_DATLAT_3                 ((uint32_t)0x08000000)        /*!<Bit 3 */
-
-#define  FSMC_BWTR2_ACCMOD                   ((uint32_t)0x30000000)        /*!<ACCMOD[1:0] bits (Access mode) */
-#define  FSMC_BWTR2_ACCMOD_0                 ((uint32_t)0x10000000)        /*!<Bit 0 */
-#define  FSMC_BWTR2_ACCMOD_1                 ((uint32_t)0x20000000)        /*!<Bit 1 */
-
-/******************  Bit definition for FSMC_BWTR3 register  ******************/
-#define  FSMC_BWTR3_ADDSET                   ((uint32_t)0x0000000F)        /*!<ADDSET[3:0] bits (Address setup phase duration) */
-#define  FSMC_BWTR3_ADDSET_0                 ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  FSMC_BWTR3_ADDSET_1                 ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  FSMC_BWTR3_ADDSET_2                 ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  FSMC_BWTR3_ADDSET_3                 ((uint32_t)0x00000008)        /*!<Bit 3 */
-
-#define  FSMC_BWTR3_ADDHLD                   ((uint32_t)0x000000F0)        /*!<ADDHLD[3:0] bits (Address-hold phase duration) */
-#define  FSMC_BWTR3_ADDHLD_0                 ((uint32_t)0x00000010)        /*!<Bit 0 */
-#define  FSMC_BWTR3_ADDHLD_1                 ((uint32_t)0x00000020)        /*!<Bit 1 */
-#define  FSMC_BWTR3_ADDHLD_2                 ((uint32_t)0x00000040)        /*!<Bit 2 */
-#define  FSMC_BWTR3_ADDHLD_3                 ((uint32_t)0x00000080)        /*!<Bit 3 */
-
-#define  FSMC_BWTR3_DATAST                   ((uint32_t)0x0000FF00)        /*!<DATAST [3:0] bits (Data-phase duration) */
-#define  FSMC_BWTR3_DATAST_0                 ((uint32_t)0x00000100)        /*!<Bit 0 */
-#define  FSMC_BWTR3_DATAST_1                 ((uint32_t)0x00000200)        /*!<Bit 1 */
-#define  FSMC_BWTR3_DATAST_2                 ((uint32_t)0x00000400)        /*!<Bit 2 */
-#define  FSMC_BWTR3_DATAST_3                 ((uint32_t)0x00000800)        /*!<Bit 3 */
-
-#define  FSMC_BWTR3_CLKDIV                   ((uint32_t)0x00F00000)        /*!<CLKDIV[3:0] bits (Clock divide ratio) */
-#define  FSMC_BWTR3_CLKDIV_0                 ((uint32_t)0x00100000)        /*!<Bit 0 */
-#define  FSMC_BWTR3_CLKDIV_1                 ((uint32_t)0x00200000)        /*!<Bit 1 */
-#define  FSMC_BWTR3_CLKDIV_2                 ((uint32_t)0x00400000)        /*!<Bit 2 */
-#define  FSMC_BWTR3_CLKDIV_3                 ((uint32_t)0x00800000)        /*!<Bit 3 */
-
-#define  FSMC_BWTR3_DATLAT                   ((uint32_t)0x0F000000)        /*!<DATLA[3:0] bits (Data latency) */
-#define  FSMC_BWTR3_DATLAT_0                 ((uint32_t)0x01000000)        /*!<Bit 0 */
-#define  FSMC_BWTR3_DATLAT_1                 ((uint32_t)0x02000000)        /*!<Bit 1 */
-#define  FSMC_BWTR3_DATLAT_2                 ((uint32_t)0x04000000)        /*!<Bit 2 */
-#define  FSMC_BWTR3_DATLAT_3                 ((uint32_t)0x08000000)        /*!<Bit 3 */
-
-#define  FSMC_BWTR3_ACCMOD                   ((uint32_t)0x30000000)        /*!<ACCMOD[1:0] bits (Access mode) */
-#define  FSMC_BWTR3_ACCMOD_0                 ((uint32_t)0x10000000)        /*!<Bit 0 */
-#define  FSMC_BWTR3_ACCMOD_1                 ((uint32_t)0x20000000)        /*!<Bit 1 */
-
-/******************  Bit definition for FSMC_BWTR4 register  ******************/
-#define  FSMC_BWTR4_ADDSET                   ((uint32_t)0x0000000F)        /*!<ADDSET[3:0] bits (Address setup phase duration) */
-#define  FSMC_BWTR4_ADDSET_0                 ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  FSMC_BWTR4_ADDSET_1                 ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  FSMC_BWTR4_ADDSET_2                 ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  FSMC_BWTR4_ADDSET_3                 ((uint32_t)0x00000008)        /*!<Bit 3 */
-
-#define  FSMC_BWTR4_ADDHLD                   ((uint32_t)0x000000F0)        /*!<ADDHLD[3:0] bits (Address-hold phase duration) */
-#define  FSMC_BWTR4_ADDHLD_0                 ((uint32_t)0x00000010)        /*!<Bit 0 */
-#define  FSMC_BWTR4_ADDHLD_1                 ((uint32_t)0x00000020)        /*!<Bit 1 */
-#define  FSMC_BWTR4_ADDHLD_2                 ((uint32_t)0x00000040)        /*!<Bit 2 */
-#define  FSMC_BWTR4_ADDHLD_3                 ((uint32_t)0x00000080)        /*!<Bit 3 */
-
-#define  FSMC_BWTR4_DATAST                   ((uint32_t)0x0000FF00)        /*!<DATAST [3:0] bits (Data-phase duration) */
-#define  FSMC_BWTR4_DATAST_0                 ((uint32_t)0x00000100)        /*!<Bit 0 */
-#define  FSMC_BWTR4_DATAST_1                 ((uint32_t)0x00000200)        /*!<Bit 1 */
-#define  FSMC_BWTR4_DATAST_2                 ((uint32_t)0x00000400)        /*!<Bit 2 */
-#define  FSMC_BWTR4_DATAST_3                 ((uint32_t)0x00000800)        /*!<Bit 3 */
-
-#define  FSMC_BWTR4_CLKDIV                   ((uint32_t)0x00F00000)        /*!<CLKDIV[3:0] bits (Clock divide ratio) */
-#define  FSMC_BWTR4_CLKDIV_0                 ((uint32_t)0x00100000)        /*!<Bit 0 */
-#define  FSMC_BWTR4_CLKDIV_1                 ((uint32_t)0x00200000)        /*!<Bit 1 */
-#define  FSMC_BWTR4_CLKDIV_2                 ((uint32_t)0x00400000)        /*!<Bit 2 */
-#define  FSMC_BWTR4_CLKDIV_3                 ((uint32_t)0x00800000)        /*!<Bit 3 */
-
-#define  FSMC_BWTR4_DATLAT                   ((uint32_t)0x0F000000)        /*!<DATLA[3:0] bits (Data latency) */
-#define  FSMC_BWTR4_DATLAT_0                 ((uint32_t)0x01000000)        /*!<Bit 0 */
-#define  FSMC_BWTR4_DATLAT_1                 ((uint32_t)0x02000000)        /*!<Bit 1 */
-#define  FSMC_BWTR4_DATLAT_2                 ((uint32_t)0x04000000)        /*!<Bit 2 */
-#define  FSMC_BWTR4_DATLAT_3                 ((uint32_t)0x08000000)        /*!<Bit 3 */
-
-#define  FSMC_BWTR4_ACCMOD                   ((uint32_t)0x30000000)        /*!<ACCMOD[1:0] bits (Access mode) */
-#define  FSMC_BWTR4_ACCMOD_0                 ((uint32_t)0x10000000)        /*!<Bit 0 */
-#define  FSMC_BWTR4_ACCMOD_1                 ((uint32_t)0x20000000)        /*!<Bit 1 */
-
-/******************  Bit definition for FSMC_PCR2 register  *******************/
-#define  FSMC_PCR2_PWAITEN                   ((uint32_t)0x00000002)        /*!<Wait feature enable bit */
-#define  FSMC_PCR2_PBKEN                     ((uint32_t)0x00000004)        /*!<PC Card/NAND Flash memory bank enable bit */
-#define  FSMC_PCR2_PTYP                      ((uint32_t)0x00000008)        /*!<Memory type */
-
-#define  FSMC_PCR2_PWID                      ((uint32_t)0x00000030)        /*!<PWID[1:0] bits (NAND Flash databus width) */
-#define  FSMC_PCR2_PWID_0                    ((uint32_t)0x00000010)        /*!<Bit 0 */
-#define  FSMC_PCR2_PWID_1                    ((uint32_t)0x00000020)        /*!<Bit 1 */
-
-#define  FSMC_PCR2_ECCEN                     ((uint32_t)0x00000040)        /*!<ECC computation logic enable bit */
-
-#define  FSMC_PCR2_TCLR                      ((uint32_t)0x00001E00)        /*!<TCLR[3:0] bits (CLE to RE delay) */
-#define  FSMC_PCR2_TCLR_0                    ((uint32_t)0x00000200)        /*!<Bit 0 */
-#define  FSMC_PCR2_TCLR_1                    ((uint32_t)0x00000400)        /*!<Bit 1 */
-#define  FSMC_PCR2_TCLR_2                    ((uint32_t)0x00000800)        /*!<Bit 2 */
-#define  FSMC_PCR2_TCLR_3                    ((uint32_t)0x00001000)        /*!<Bit 3 */
-
-#define  FSMC_PCR2_TAR                       ((uint32_t)0x0001E000)        /*!<TAR[3:0] bits (ALE to RE delay) */
-#define  FSMC_PCR2_TAR_0                     ((uint32_t)0x00002000)        /*!<Bit 0 */
-#define  FSMC_PCR2_TAR_1                     ((uint32_t)0x00004000)        /*!<Bit 1 */
-#define  FSMC_PCR2_TAR_2                     ((uint32_t)0x00008000)        /*!<Bit 2 */
-#define  FSMC_PCR2_TAR_3                     ((uint32_t)0x00010000)        /*!<Bit 3 */
-
-#define  FSMC_PCR2_ECCPS                     ((uint32_t)0x000E0000)        /*!<ECCPS[1:0] bits (ECC page size) */
-#define  FSMC_PCR2_ECCPS_0                   ((uint32_t)0x00020000)        /*!<Bit 0 */
-#define  FSMC_PCR2_ECCPS_1                   ((uint32_t)0x00040000)        /*!<Bit 1 */
-#define  FSMC_PCR2_ECCPS_2                   ((uint32_t)0x00080000)        /*!<Bit 2 */
-
-/******************  Bit definition for FSMC_PCR3 register  *******************/
-#define  FSMC_PCR3_PWAITEN                   ((uint32_t)0x00000002)        /*!<Wait feature enable bit */
-#define  FSMC_PCR3_PBKEN                     ((uint32_t)0x00000004)        /*!<PC Card/NAND Flash memory bank enable bit */
-#define  FSMC_PCR3_PTYP                      ((uint32_t)0x00000008)        /*!<Memory type */
-
-#define  FSMC_PCR3_PWID                      ((uint32_t)0x00000030)        /*!<PWID[1:0] bits (NAND Flash databus width) */
-#define  FSMC_PCR3_PWID_0                    ((uint32_t)0x00000010)        /*!<Bit 0 */
-#define  FSMC_PCR3_PWID_1                    ((uint32_t)0x00000020)        /*!<Bit 1 */
-
-#define  FSMC_PCR3_ECCEN                     ((uint32_t)0x00000040)        /*!<ECC computation logic enable bit */
-
-#define  FSMC_PCR3_TCLR                      ((uint32_t)0x00001E00)        /*!<TCLR[3:0] bits (CLE to RE delay) */
-#define  FSMC_PCR3_TCLR_0                    ((uint32_t)0x00000200)        /*!<Bit 0 */
-#define  FSMC_PCR3_TCLR_1                    ((uint32_t)0x00000400)        /*!<Bit 1 */
-#define  FSMC_PCR3_TCLR_2                    ((uint32_t)0x00000800)        /*!<Bit 2 */
-#define  FSMC_PCR3_TCLR_3                    ((uint32_t)0x00001000)        /*!<Bit 3 */
-
-#define  FSMC_PCR3_TAR                       ((uint32_t)0x0001E000)        /*!<TAR[3:0] bits (ALE to RE delay) */
-#define  FSMC_PCR3_TAR_0                     ((uint32_t)0x00002000)        /*!<Bit 0 */
-#define  FSMC_PCR3_TAR_1                     ((uint32_t)0x00004000)        /*!<Bit 1 */
-#define  FSMC_PCR3_TAR_2                     ((uint32_t)0x00008000)        /*!<Bit 2 */
-#define  FSMC_PCR3_TAR_3                     ((uint32_t)0x00010000)        /*!<Bit 3 */
-
-#define  FSMC_PCR3_ECCPS                     ((uint32_t)0x000E0000)        /*!<ECCPS[2:0] bits (ECC page size) */
-#define  FSMC_PCR3_ECCPS_0                   ((uint32_t)0x00020000)        /*!<Bit 0 */
-#define  FSMC_PCR3_ECCPS_1                   ((uint32_t)0x00040000)        /*!<Bit 1 */
-#define  FSMC_PCR3_ECCPS_2                   ((uint32_t)0x00080000)        /*!<Bit 2 */
-
-/******************  Bit definition for FSMC_PCR4 register  *******************/
-#define  FSMC_PCR4_PWAITEN                   ((uint32_t)0x00000002)        /*!<Wait feature enable bit */
-#define  FSMC_PCR4_PBKEN                     ((uint32_t)0x00000004)        /*!<PC Card/NAND Flash memory bank enable bit */
-#define  FSMC_PCR4_PTYP                      ((uint32_t)0x00000008)        /*!<Memory type */
-
-#define  FSMC_PCR4_PWID                      ((uint32_t)0x00000030)        /*!<PWID[1:0] bits (NAND Flash databus width) */
-#define  FSMC_PCR4_PWID_0                    ((uint32_t)0x00000010)        /*!<Bit 0 */
-#define  FSMC_PCR4_PWID_1                    ((uint32_t)0x00000020)        /*!<Bit 1 */
-
-#define  FSMC_PCR4_ECCEN                     ((uint32_t)0x00000040)        /*!<ECC computation logic enable bit */
-
-#define  FSMC_PCR4_TCLR                      ((uint32_t)0x00001E00)        /*!<TCLR[3:0] bits (CLE to RE delay) */
-#define  FSMC_PCR4_TCLR_0                    ((uint32_t)0x00000200)        /*!<Bit 0 */
-#define  FSMC_PCR4_TCLR_1                    ((uint32_t)0x00000400)        /*!<Bit 1 */
-#define  FSMC_PCR4_TCLR_2                    ((uint32_t)0x00000800)        /*!<Bit 2 */
-#define  FSMC_PCR4_TCLR_3                    ((uint32_t)0x00001000)        /*!<Bit 3 */
-
-#define  FSMC_PCR4_TAR                       ((uint32_t)0x0001E000)        /*!<TAR[3:0] bits (ALE to RE delay) */
-#define  FSMC_PCR4_TAR_0                     ((uint32_t)0x00002000)        /*!<Bit 0 */
-#define  FSMC_PCR4_TAR_1                     ((uint32_t)0x00004000)        /*!<Bit 1 */
-#define  FSMC_PCR4_TAR_2                     ((uint32_t)0x00008000)        /*!<Bit 2 */
-#define  FSMC_PCR4_TAR_3                     ((uint32_t)0x00010000)        /*!<Bit 3 */
-
-#define  FSMC_PCR4_ECCPS                     ((uint32_t)0x000E0000)        /*!<ECCPS[2:0] bits (ECC page size) */
-#define  FSMC_PCR4_ECCPS_0                   ((uint32_t)0x00020000)        /*!<Bit 0 */
-#define  FSMC_PCR4_ECCPS_1                   ((uint32_t)0x00040000)        /*!<Bit 1 */
-#define  FSMC_PCR4_ECCPS_2                   ((uint32_t)0x00080000)        /*!<Bit 2 */
-
-/*******************  Bit definition for FSMC_SR2 register  *******************/
-#define  FSMC_SR2_IRS                        ((uint8_t)0x01)               /*!<Interrupt Rising Edge status                */
-#define  FSMC_SR2_ILS                        ((uint8_t)0x02)               /*!<Interrupt Level status                      */
-#define  FSMC_SR2_IFS                        ((uint8_t)0x04)               /*!<Interrupt Falling Edge status               */
-#define  FSMC_SR2_IREN                       ((uint8_t)0x08)               /*!<Interrupt Rising Edge detection Enable bit  */
-#define  FSMC_SR2_ILEN                       ((uint8_t)0x10)               /*!<Interrupt Level detection Enable bit        */
-#define  FSMC_SR2_IFEN                       ((uint8_t)0x20)               /*!<Interrupt Falling Edge detection Enable bit */
-#define  FSMC_SR2_FEMPT                      ((uint8_t)0x40)               /*!<FIFO empty */
-
-/*******************  Bit definition for FSMC_SR3 register  *******************/
-#define  FSMC_SR3_IRS                        ((uint8_t)0x01)               /*!<Interrupt Rising Edge status                */
-#define  FSMC_SR3_ILS                        ((uint8_t)0x02)               /*!<Interrupt Level status                      */
-#define  FSMC_SR3_IFS                        ((uint8_t)0x04)               /*!<Interrupt Falling Edge status               */
-#define  FSMC_SR3_IREN                       ((uint8_t)0x08)               /*!<Interrupt Rising Edge detection Enable bit  */
-#define  FSMC_SR3_ILEN                       ((uint8_t)0x10)               /*!<Interrupt Level detection Enable bit        */
-#define  FSMC_SR3_IFEN                       ((uint8_t)0x20)               /*!<Interrupt Falling Edge detection Enable bit */
-#define  FSMC_SR3_FEMPT                      ((uint8_t)0x40)               /*!<FIFO empty */
-
-/*******************  Bit definition for FSMC_SR4 register  *******************/
-#define  FSMC_SR4_IRS                        ((uint8_t)0x01)               /*!<Interrupt Rising Edge status                 */
-#define  FSMC_SR4_ILS                        ((uint8_t)0x02)               /*!<Interrupt Level status                       */
-#define  FSMC_SR4_IFS                        ((uint8_t)0x04)               /*!<Interrupt Falling Edge status                */
-#define  FSMC_SR4_IREN                       ((uint8_t)0x08)               /*!<Interrupt Rising Edge detection Enable bit   */
-#define  FSMC_SR4_ILEN                       ((uint8_t)0x10)               /*!<Interrupt Level detection Enable bit         */
-#define  FSMC_SR4_IFEN                       ((uint8_t)0x20)               /*!<Interrupt Falling Edge detection Enable bit  */
-#define  FSMC_SR4_FEMPT                      ((uint8_t)0x40)               /*!<FIFO empty */
-
-/******************  Bit definition for FSMC_PMEM2 register  ******************/
-#define  FSMC_PMEM2_MEMSET2                  ((uint32_t)0x000000FF)        /*!<MEMSET2[7:0] bits (Common memory 2 setup time) */
-#define  FSMC_PMEM2_MEMSET2_0                ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  FSMC_PMEM2_MEMSET2_1                ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  FSMC_PMEM2_MEMSET2_2                ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  FSMC_PMEM2_MEMSET2_3                ((uint32_t)0x00000008)        /*!<Bit 3 */
-#define  FSMC_PMEM2_MEMSET2_4                ((uint32_t)0x00000010)        /*!<Bit 4 */
-#define  FSMC_PMEM2_MEMSET2_5                ((uint32_t)0x00000020)        /*!<Bit 5 */
-#define  FSMC_PMEM2_MEMSET2_6                ((uint32_t)0x00000040)        /*!<Bit 6 */
-#define  FSMC_PMEM2_MEMSET2_7                ((uint32_t)0x00000080)        /*!<Bit 7 */
-
-#define  FSMC_PMEM2_MEMWAIT2                 ((uint32_t)0x0000FF00)        /*!<MEMWAIT2[7:0] bits (Common memory 2 wait time) */
-#define  FSMC_PMEM2_MEMWAIT2_0               ((uint32_t)0x00000100)        /*!<Bit 0 */
-#define  FSMC_PMEM2_MEMWAIT2_1               ((uint32_t)0x00000200)        /*!<Bit 1 */
-#define  FSMC_PMEM2_MEMWAIT2_2               ((uint32_t)0x00000400)        /*!<Bit 2 */
-#define  FSMC_PMEM2_MEMWAIT2_3               ((uint32_t)0x00000800)        /*!<Bit 3 */
-#define  FSMC_PMEM2_MEMWAIT2_4               ((uint32_t)0x00001000)        /*!<Bit 4 */
-#define  FSMC_PMEM2_MEMWAIT2_5               ((uint32_t)0x00002000)        /*!<Bit 5 */
-#define  FSMC_PMEM2_MEMWAIT2_6               ((uint32_t)0x00004000)        /*!<Bit 6 */
-#define  FSMC_PMEM2_MEMWAIT2_7               ((uint32_t)0x00008000)        /*!<Bit 7 */
-
-#define  FSMC_PMEM2_MEMHOLD2                 ((uint32_t)0x00FF0000)        /*!<MEMHOLD2[7:0] bits (Common memory 2 hold time) */
-#define  FSMC_PMEM2_MEMHOLD2_0               ((uint32_t)0x00010000)        /*!<Bit 0 */
-#define  FSMC_PMEM2_MEMHOLD2_1               ((uint32_t)0x00020000)        /*!<Bit 1 */
-#define  FSMC_PMEM2_MEMHOLD2_2               ((uint32_t)0x00040000)        /*!<Bit 2 */
-#define  FSMC_PMEM2_MEMHOLD2_3               ((uint32_t)0x00080000)        /*!<Bit 3 */
-#define  FSMC_PMEM2_MEMHOLD2_4               ((uint32_t)0x00100000)        /*!<Bit 4 */
-#define  FSMC_PMEM2_MEMHOLD2_5               ((uint32_t)0x00200000)        /*!<Bit 5 */
-#define  FSMC_PMEM2_MEMHOLD2_6               ((uint32_t)0x00400000)        /*!<Bit 6 */
-#define  FSMC_PMEM2_MEMHOLD2_7               ((uint32_t)0x00800000)        /*!<Bit 7 */
-
-#define  FSMC_PMEM2_MEMHIZ2                  ((uint32_t)0xFF000000)        /*!<MEMHIZ2[7:0] bits (Common memory 2 databus HiZ time) */
-#define  FSMC_PMEM2_MEMHIZ2_0                ((uint32_t)0x01000000)        /*!<Bit 0 */
-#define  FSMC_PMEM2_MEMHIZ2_1                ((uint32_t)0x02000000)        /*!<Bit 1 */
-#define  FSMC_PMEM2_MEMHIZ2_2                ((uint32_t)0x04000000)        /*!<Bit 2 */
-#define  FSMC_PMEM2_MEMHIZ2_3                ((uint32_t)0x08000000)        /*!<Bit 3 */
-#define  FSMC_PMEM2_MEMHIZ2_4                ((uint32_t)0x10000000)        /*!<Bit 4 */
-#define  FSMC_PMEM2_MEMHIZ2_5                ((uint32_t)0x20000000)        /*!<Bit 5 */
-#define  FSMC_PMEM2_MEMHIZ2_6                ((uint32_t)0x40000000)        /*!<Bit 6 */
-#define  FSMC_PMEM2_MEMHIZ2_7                ((uint32_t)0x80000000)        /*!<Bit 7 */
-
-/******************  Bit definition for FSMC_PMEM3 register  ******************/
-#define  FSMC_PMEM3_MEMSET3                  ((uint32_t)0x000000FF)        /*!<MEMSET3[7:0] bits (Common memory 3 setup time) */
-#define  FSMC_PMEM3_MEMSET3_0                ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  FSMC_PMEM3_MEMSET3_1                ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  FSMC_PMEM3_MEMSET3_2                ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  FSMC_PMEM3_MEMSET3_3                ((uint32_t)0x00000008)        /*!<Bit 3 */
-#define  FSMC_PMEM3_MEMSET3_4                ((uint32_t)0x00000010)        /*!<Bit 4 */
-#define  FSMC_PMEM3_MEMSET3_5                ((uint32_t)0x00000020)        /*!<Bit 5 */
-#define  FSMC_PMEM3_MEMSET3_6                ((uint32_t)0x00000040)        /*!<Bit 6 */
-#define  FSMC_PMEM3_MEMSET3_7                ((uint32_t)0x00000080)        /*!<Bit 7 */
-
-#define  FSMC_PMEM3_MEMWAIT3                 ((uint32_t)0x0000FF00)        /*!<MEMWAIT3[7:0] bits (Common memory 3 wait time) */
-#define  FSMC_PMEM3_MEMWAIT3_0               ((uint32_t)0x00000100)        /*!<Bit 0 */
-#define  FSMC_PMEM3_MEMWAIT3_1               ((uint32_t)0x00000200)        /*!<Bit 1 */
-#define  FSMC_PMEM3_MEMWAIT3_2               ((uint32_t)0x00000400)        /*!<Bit 2 */
-#define  FSMC_PMEM3_MEMWAIT3_3               ((uint32_t)0x00000800)        /*!<Bit 3 */
-#define  FSMC_PMEM3_MEMWAIT3_4               ((uint32_t)0x00001000)        /*!<Bit 4 */
-#define  FSMC_PMEM3_MEMWAIT3_5               ((uint32_t)0x00002000)        /*!<Bit 5 */
-#define  FSMC_PMEM3_MEMWAIT3_6               ((uint32_t)0x00004000)        /*!<Bit 6 */
-#define  FSMC_PMEM3_MEMWAIT3_7               ((uint32_t)0x00008000)        /*!<Bit 7 */
-
-#define  FSMC_PMEM3_MEMHOLD3                 ((uint32_t)0x00FF0000)        /*!<MEMHOLD3[7:0] bits (Common memory 3 hold time) */
-#define  FSMC_PMEM3_MEMHOLD3_0               ((uint32_t)0x00010000)        /*!<Bit 0 */
-#define  FSMC_PMEM3_MEMHOLD3_1               ((uint32_t)0x00020000)        /*!<Bit 1 */
-#define  FSMC_PMEM3_MEMHOLD3_2               ((uint32_t)0x00040000)        /*!<Bit 2 */
-#define  FSMC_PMEM3_MEMHOLD3_3               ((uint32_t)0x00080000)        /*!<Bit 3 */
-#define  FSMC_PMEM3_MEMHOLD3_4               ((uint32_t)0x00100000)        /*!<Bit 4 */
-#define  FSMC_PMEM3_MEMHOLD3_5               ((uint32_t)0x00200000)        /*!<Bit 5 */
-#define  FSMC_PMEM3_MEMHOLD3_6               ((uint32_t)0x00400000)        /*!<Bit 6 */
-#define  FSMC_PMEM3_MEMHOLD3_7               ((uint32_t)0x00800000)        /*!<Bit 7 */
-
-#define  FSMC_PMEM3_MEMHIZ3                  ((uint32_t)0xFF000000)        /*!<MEMHIZ3[7:0] bits (Common memory 3 databus HiZ time) */
-#define  FSMC_PMEM3_MEMHIZ3_0                ((uint32_t)0x01000000)        /*!<Bit 0 */
-#define  FSMC_PMEM3_MEMHIZ3_1                ((uint32_t)0x02000000)        /*!<Bit 1 */
-#define  FSMC_PMEM3_MEMHIZ3_2                ((uint32_t)0x04000000)        /*!<Bit 2 */
-#define  FSMC_PMEM3_MEMHIZ3_3                ((uint32_t)0x08000000)        /*!<Bit 3 */
-#define  FSMC_PMEM3_MEMHIZ3_4                ((uint32_t)0x10000000)        /*!<Bit 4 */
-#define  FSMC_PMEM3_MEMHIZ3_5                ((uint32_t)0x20000000)        /*!<Bit 5 */
-#define  FSMC_PMEM3_MEMHIZ3_6                ((uint32_t)0x40000000)        /*!<Bit 6 */
-#define  FSMC_PMEM3_MEMHIZ3_7                ((uint32_t)0x80000000)        /*!<Bit 7 */
-
-/******************  Bit definition for FSMC_PMEM4 register  ******************/
-#define  FSMC_PMEM4_MEMSET4                  ((uint32_t)0x000000FF)        /*!<MEMSET4[7:0] bits (Common memory 4 setup time) */
-#define  FSMC_PMEM4_MEMSET4_0                ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  FSMC_PMEM4_MEMSET4_1                ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  FSMC_PMEM4_MEMSET4_2                ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  FSMC_PMEM4_MEMSET4_3                ((uint32_t)0x00000008)        /*!<Bit 3 */
-#define  FSMC_PMEM4_MEMSET4_4                ((uint32_t)0x00000010)        /*!<Bit 4 */
-#define  FSMC_PMEM4_MEMSET4_5                ((uint32_t)0x00000020)        /*!<Bit 5 */
-#define  FSMC_PMEM4_MEMSET4_6                ((uint32_t)0x00000040)        /*!<Bit 6 */
-#define  FSMC_PMEM4_MEMSET4_7                ((uint32_t)0x00000080)        /*!<Bit 7 */
-
-#define  FSMC_PMEM4_MEMWAIT4                 ((uint32_t)0x0000FF00)        /*!<MEMWAIT4[7:0] bits (Common memory 4 wait time) */
-#define  FSMC_PMEM4_MEMWAIT4_0               ((uint32_t)0x00000100)        /*!<Bit 0 */
-#define  FSMC_PMEM4_MEMWAIT4_1               ((uint32_t)0x00000200)        /*!<Bit 1 */
-#define  FSMC_PMEM4_MEMWAIT4_2               ((uint32_t)0x00000400)        /*!<Bit 2 */
-#define  FSMC_PMEM4_MEMWAIT4_3               ((uint32_t)0x00000800)        /*!<Bit 3 */
-#define  FSMC_PMEM4_MEMWAIT4_4               ((uint32_t)0x00001000)        /*!<Bit 4 */
-#define  FSMC_PMEM4_MEMWAIT4_5               ((uint32_t)0x00002000)        /*!<Bit 5 */
-#define  FSMC_PMEM4_MEMWAIT4_6               ((uint32_t)0x00004000)        /*!<Bit 6 */
-#define  FSMC_PMEM4_MEMWAIT4_7               ((uint32_t)0x00008000)        /*!<Bit 7 */
-
-#define  FSMC_PMEM4_MEMHOLD4                 ((uint32_t)0x00FF0000)        /*!<MEMHOLD4[7:0] bits (Common memory 4 hold time) */
-#define  FSMC_PMEM4_MEMHOLD4_0               ((uint32_t)0x00010000)        /*!<Bit 0 */
-#define  FSMC_PMEM4_MEMHOLD4_1               ((uint32_t)0x00020000)        /*!<Bit 1 */
-#define  FSMC_PMEM4_MEMHOLD4_2               ((uint32_t)0x00040000)        /*!<Bit 2 */
-#define  FSMC_PMEM4_MEMHOLD4_3               ((uint32_t)0x00080000)        /*!<Bit 3 */
-#define  FSMC_PMEM4_MEMHOLD4_4               ((uint32_t)0x00100000)        /*!<Bit 4 */
-#define  FSMC_PMEM4_MEMHOLD4_5               ((uint32_t)0x00200000)        /*!<Bit 5 */
-#define  FSMC_PMEM4_MEMHOLD4_6               ((uint32_t)0x00400000)        /*!<Bit 6 */
-#define  FSMC_PMEM4_MEMHOLD4_7               ((uint32_t)0x00800000)        /*!<Bit 7 */
-
-#define  FSMC_PMEM4_MEMHIZ4                  ((uint32_t)0xFF000000)        /*!<MEMHIZ4[7:0] bits (Common memory 4 databus HiZ time) */
-#define  FSMC_PMEM4_MEMHIZ4_0                ((uint32_t)0x01000000)        /*!<Bit 0 */
-#define  FSMC_PMEM4_MEMHIZ4_1                ((uint32_t)0x02000000)        /*!<Bit 1 */
-#define  FSMC_PMEM4_MEMHIZ4_2                ((uint32_t)0x04000000)        /*!<Bit 2 */
-#define  FSMC_PMEM4_MEMHIZ4_3                ((uint32_t)0x08000000)        /*!<Bit 3 */
-#define  FSMC_PMEM4_MEMHIZ4_4                ((uint32_t)0x10000000)        /*!<Bit 4 */
-#define  FSMC_PMEM4_MEMHIZ4_5                ((uint32_t)0x20000000)        /*!<Bit 5 */
-#define  FSMC_PMEM4_MEMHIZ4_6                ((uint32_t)0x40000000)        /*!<Bit 6 */
-#define  FSMC_PMEM4_MEMHIZ4_7                ((uint32_t)0x80000000)        /*!<Bit 7 */
-
-/******************  Bit definition for FSMC_PATT2 register  ******************/
-#define  FSMC_PATT2_ATTSET2                  ((uint32_t)0x000000FF)        /*!<ATTSET2[7:0] bits (Attribute memory 2 setup time) */
-#define  FSMC_PATT2_ATTSET2_0                ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  FSMC_PATT2_ATTSET2_1                ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  FSMC_PATT2_ATTSET2_2                ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  FSMC_PATT2_ATTSET2_3                ((uint32_t)0x00000008)        /*!<Bit 3 */
-#define  FSMC_PATT2_ATTSET2_4                ((uint32_t)0x00000010)        /*!<Bit 4 */
-#define  FSMC_PATT2_ATTSET2_5                ((uint32_t)0x00000020)        /*!<Bit 5 */
-#define  FSMC_PATT2_ATTSET2_6                ((uint32_t)0x00000040)        /*!<Bit 6 */
-#define  FSMC_PATT2_ATTSET2_7                ((uint32_t)0x00000080)        /*!<Bit 7 */
-
-#define  FSMC_PATT2_ATTWAIT2                 ((uint32_t)0x0000FF00)        /*!<ATTWAIT2[7:0] bits (Attribute memory 2 wait time) */
-#define  FSMC_PATT2_ATTWAIT2_0               ((uint32_t)0x00000100)        /*!<Bit 0 */
-#define  FSMC_PATT2_ATTWAIT2_1               ((uint32_t)0x00000200)        /*!<Bit 1 */
-#define  FSMC_PATT2_ATTWAIT2_2               ((uint32_t)0x00000400)        /*!<Bit 2 */
-#define  FSMC_PATT2_ATTWAIT2_3               ((uint32_t)0x00000800)        /*!<Bit 3 */
-#define  FSMC_PATT2_ATTWAIT2_4               ((uint32_t)0x00001000)        /*!<Bit 4 */
-#define  FSMC_PATT2_ATTWAIT2_5               ((uint32_t)0x00002000)        /*!<Bit 5 */
-#define  FSMC_PATT2_ATTWAIT2_6               ((uint32_t)0x00004000)        /*!<Bit 6 */
-#define  FSMC_PATT2_ATTWAIT2_7               ((uint32_t)0x00008000)        /*!<Bit 7 */
-
-#define  FSMC_PATT2_ATTHOLD2                 ((uint32_t)0x00FF0000)        /*!<ATTHOLD2[7:0] bits (Attribute memory 2 hold time) */
-#define  FSMC_PATT2_ATTHOLD2_0               ((uint32_t)0x00010000)        /*!<Bit 0 */
-#define  FSMC_PATT2_ATTHOLD2_1               ((uint32_t)0x00020000)        /*!<Bit 1 */
-#define  FSMC_PATT2_ATTHOLD2_2               ((uint32_t)0x00040000)        /*!<Bit 2 */
-#define  FSMC_PATT2_ATTHOLD2_3               ((uint32_t)0x00080000)        /*!<Bit 3 */
-#define  FSMC_PATT2_ATTHOLD2_4               ((uint32_t)0x00100000)        /*!<Bit 4 */
-#define  FSMC_PATT2_ATTHOLD2_5               ((uint32_t)0x00200000)        /*!<Bit 5 */
-#define  FSMC_PATT2_ATTHOLD2_6               ((uint32_t)0x00400000)        /*!<Bit 6 */
-#define  FSMC_PATT2_ATTHOLD2_7               ((uint32_t)0x00800000)        /*!<Bit 7 */
-
-#define  FSMC_PATT2_ATTHIZ2                  ((uint32_t)0xFF000000)        /*!<ATTHIZ2[7:0] bits (Attribute memory 2 databus HiZ time) */
-#define  FSMC_PATT2_ATTHIZ2_0                ((uint32_t)0x01000000)        /*!<Bit 0 */
-#define  FSMC_PATT2_ATTHIZ2_1                ((uint32_t)0x02000000)        /*!<Bit 1 */
-#define  FSMC_PATT2_ATTHIZ2_2                ((uint32_t)0x04000000)        /*!<Bit 2 */
-#define  FSMC_PATT2_ATTHIZ2_3                ((uint32_t)0x08000000)        /*!<Bit 3 */
-#define  FSMC_PATT2_ATTHIZ2_4                ((uint32_t)0x10000000)        /*!<Bit 4 */
-#define  FSMC_PATT2_ATTHIZ2_5                ((uint32_t)0x20000000)        /*!<Bit 5 */
-#define  FSMC_PATT2_ATTHIZ2_6                ((uint32_t)0x40000000)        /*!<Bit 6 */
-#define  FSMC_PATT2_ATTHIZ2_7                ((uint32_t)0x80000000)        /*!<Bit 7 */
-
-/******************  Bit definition for FSMC_PATT3 register  ******************/
-#define  FSMC_PATT3_ATTSET3                  ((uint32_t)0x000000FF)        /*!<ATTSET3[7:0] bits (Attribute memory 3 setup time) */
-#define  FSMC_PATT3_ATTSET3_0                ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  FSMC_PATT3_ATTSET3_1                ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  FSMC_PATT3_ATTSET3_2                ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  FSMC_PATT3_ATTSET3_3                ((uint32_t)0x00000008)        /*!<Bit 3 */
-#define  FSMC_PATT3_ATTSET3_4                ((uint32_t)0x00000010)        /*!<Bit 4 */
-#define  FSMC_PATT3_ATTSET3_5                ((uint32_t)0x00000020)        /*!<Bit 5 */
-#define  FSMC_PATT3_ATTSET3_6                ((uint32_t)0x00000040)        /*!<Bit 6 */
-#define  FSMC_PATT3_ATTSET3_7                ((uint32_t)0x00000080)        /*!<Bit 7 */
-
-#define  FSMC_PATT3_ATTWAIT3                 ((uint32_t)0x0000FF00)        /*!<ATTWAIT3[7:0] bits (Attribute memory 3 wait time) */
-#define  FSMC_PATT3_ATTWAIT3_0               ((uint32_t)0x00000100)        /*!<Bit 0 */
-#define  FSMC_PATT3_ATTWAIT3_1               ((uint32_t)0x00000200)        /*!<Bit 1 */
-#define  FSMC_PATT3_ATTWAIT3_2               ((uint32_t)0x00000400)        /*!<Bit 2 */
-#define  FSMC_PATT3_ATTWAIT3_3               ((uint32_t)0x00000800)        /*!<Bit 3 */
-#define  FSMC_PATT3_ATTWAIT3_4               ((uint32_t)0x00001000)        /*!<Bit 4 */
-#define  FSMC_PATT3_ATTWAIT3_5               ((uint32_t)0x00002000)        /*!<Bit 5 */
-#define  FSMC_PATT3_ATTWAIT3_6               ((uint32_t)0x00004000)        /*!<Bit 6 */
-#define  FSMC_PATT3_ATTWAIT3_7               ((uint32_t)0x00008000)        /*!<Bit 7 */
-
-#define  FSMC_PATT3_ATTHOLD3                 ((uint32_t)0x00FF0000)        /*!<ATTHOLD3[7:0] bits (Attribute memory 3 hold time) */
-#define  FSMC_PATT3_ATTHOLD3_0               ((uint32_t)0x00010000)        /*!<Bit 0 */
-#define  FSMC_PATT3_ATTHOLD3_1               ((uint32_t)0x00020000)        /*!<Bit 1 */
-#define  FSMC_PATT3_ATTHOLD3_2               ((uint32_t)0x00040000)        /*!<Bit 2 */
-#define  FSMC_PATT3_ATTHOLD3_3               ((uint32_t)0x00080000)        /*!<Bit 3 */
-#define  FSMC_PATT3_ATTHOLD3_4               ((uint32_t)0x00100000)        /*!<Bit 4 */
-#define  FSMC_PATT3_ATTHOLD3_5               ((uint32_t)0x00200000)        /*!<Bit 5 */
-#define  FSMC_PATT3_ATTHOLD3_6               ((uint32_t)0x00400000)        /*!<Bit 6 */
-#define  FSMC_PATT3_ATTHOLD3_7               ((uint32_t)0x00800000)        /*!<Bit 7 */
-
-#define  FSMC_PATT3_ATTHIZ3                  ((uint32_t)0xFF000000)        /*!<ATTHIZ3[7:0] bits (Attribute memory 3 databus HiZ time) */
-#define  FSMC_PATT3_ATTHIZ3_0                ((uint32_t)0x01000000)        /*!<Bit 0 */
-#define  FSMC_PATT3_ATTHIZ3_1                ((uint32_t)0x02000000)        /*!<Bit 1 */
-#define  FSMC_PATT3_ATTHIZ3_2                ((uint32_t)0x04000000)        /*!<Bit 2 */
-#define  FSMC_PATT3_ATTHIZ3_3                ((uint32_t)0x08000000)        /*!<Bit 3 */
-#define  FSMC_PATT3_ATTHIZ3_4                ((uint32_t)0x10000000)        /*!<Bit 4 */
-#define  FSMC_PATT3_ATTHIZ3_5                ((uint32_t)0x20000000)        /*!<Bit 5 */
-#define  FSMC_PATT3_ATTHIZ3_6                ((uint32_t)0x40000000)        /*!<Bit 6 */
-#define  FSMC_PATT3_ATTHIZ3_7                ((uint32_t)0x80000000)        /*!<Bit 7 */
-
-/******************  Bit definition for FSMC_PATT4 register  ******************/
-#define  FSMC_PATT4_ATTSET4                  ((uint32_t)0x000000FF)        /*!<ATTSET4[7:0] bits (Attribute memory 4 setup time) */
-#define  FSMC_PATT4_ATTSET4_0                ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  FSMC_PATT4_ATTSET4_1                ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  FSMC_PATT4_ATTSET4_2                ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  FSMC_PATT4_ATTSET4_3                ((uint32_t)0x00000008)        /*!<Bit 3 */
-#define  FSMC_PATT4_ATTSET4_4                ((uint32_t)0x00000010)        /*!<Bit 4 */
-#define  FSMC_PATT4_ATTSET4_5                ((uint32_t)0x00000020)        /*!<Bit 5 */
-#define  FSMC_PATT4_ATTSET4_6                ((uint32_t)0x00000040)        /*!<Bit 6 */
-#define  FSMC_PATT4_ATTSET4_7                ((uint32_t)0x00000080)        /*!<Bit 7 */
-
-#define  FSMC_PATT4_ATTWAIT4                 ((uint32_t)0x0000FF00)        /*!<ATTWAIT4[7:0] bits (Attribute memory 4 wait time) */
-#define  FSMC_PATT4_ATTWAIT4_0               ((uint32_t)0x00000100)        /*!<Bit 0 */
-#define  FSMC_PATT4_ATTWAIT4_1               ((uint32_t)0x00000200)        /*!<Bit 1 */
-#define  FSMC_PATT4_ATTWAIT4_2               ((uint32_t)0x00000400)        /*!<Bit 2 */
-#define  FSMC_PATT4_ATTWAIT4_3               ((uint32_t)0x00000800)        /*!<Bit 3 */
-#define  FSMC_PATT4_ATTWAIT4_4               ((uint32_t)0x00001000)        /*!<Bit 4 */
-#define  FSMC_PATT4_ATTWAIT4_5               ((uint32_t)0x00002000)        /*!<Bit 5 */
-#define  FSMC_PATT4_ATTWAIT4_6               ((uint32_t)0x00004000)        /*!<Bit 6 */
-#define  FSMC_PATT4_ATTWAIT4_7               ((uint32_t)0x00008000)        /*!<Bit 7 */
-
-#define  FSMC_PATT4_ATTHOLD4                 ((uint32_t)0x00FF0000)        /*!<ATTHOLD4[7:0] bits (Attribute memory 4 hold time) */
-#define  FSMC_PATT4_ATTHOLD4_0               ((uint32_t)0x00010000)        /*!<Bit 0 */
-#define  FSMC_PATT4_ATTHOLD4_1               ((uint32_t)0x00020000)        /*!<Bit 1 */
-#define  FSMC_PATT4_ATTHOLD4_2               ((uint32_t)0x00040000)        /*!<Bit 2 */
-#define  FSMC_PATT4_ATTHOLD4_3               ((uint32_t)0x00080000)        /*!<Bit 3 */
-#define  FSMC_PATT4_ATTHOLD4_4               ((uint32_t)0x00100000)        /*!<Bit 4 */
-#define  FSMC_PATT4_ATTHOLD4_5               ((uint32_t)0x00200000)        /*!<Bit 5 */
-#define  FSMC_PATT4_ATTHOLD4_6               ((uint32_t)0x00400000)        /*!<Bit 6 */
-#define  FSMC_PATT4_ATTHOLD4_7               ((uint32_t)0x00800000)        /*!<Bit 7 */
-
-#define  FSMC_PATT4_ATTHIZ4                  ((uint32_t)0xFF000000)        /*!<ATTHIZ4[7:0] bits (Attribute memory 4 databus HiZ time) */
-#define  FSMC_PATT4_ATTHIZ4_0                ((uint32_t)0x01000000)        /*!<Bit 0 */
-#define  FSMC_PATT4_ATTHIZ4_1                ((uint32_t)0x02000000)        /*!<Bit 1 */
-#define  FSMC_PATT4_ATTHIZ4_2                ((uint32_t)0x04000000)        /*!<Bit 2 */
-#define  FSMC_PATT4_ATTHIZ4_3                ((uint32_t)0x08000000)        /*!<Bit 3 */
-#define  FSMC_PATT4_ATTHIZ4_4                ((uint32_t)0x10000000)        /*!<Bit 4 */
-#define  FSMC_PATT4_ATTHIZ4_5                ((uint32_t)0x20000000)        /*!<Bit 5 */
-#define  FSMC_PATT4_ATTHIZ4_6                ((uint32_t)0x40000000)        /*!<Bit 6 */
-#define  FSMC_PATT4_ATTHIZ4_7                ((uint32_t)0x80000000)        /*!<Bit 7 */
-
-/******************  Bit definition for FSMC_PIO4 register  *******************/
-#define  FSMC_PIO4_IOSET4                    ((uint32_t)0x000000FF)        /*!<IOSET4[7:0] bits (I/O 4 setup time) */
-#define  FSMC_PIO4_IOSET4_0                  ((uint32_t)0x00000001)        /*!<Bit 0 */
-#define  FSMC_PIO4_IOSET4_1                  ((uint32_t)0x00000002)        /*!<Bit 1 */
-#define  FSMC_PIO4_IOSET4_2                  ((uint32_t)0x00000004)        /*!<Bit 2 */
-#define  FSMC_PIO4_IOSET4_3                  ((uint32_t)0x00000008)        /*!<Bit 3 */
-#define  FSMC_PIO4_IOSET4_4                  ((uint32_t)0x00000010)        /*!<Bit 4 */
-#define  FSMC_PIO4_IOSET4_5                  ((uint32_t)0x00000020)        /*!<Bit 5 */
-#define  FSMC_PIO4_IOSET4_6                  ((uint32_t)0x00000040)        /*!<Bit 6 */
-#define  FSMC_PIO4_IOSET4_7                  ((uint32_t)0x00000080)        /*!<Bit 7 */
-
-#define  FSMC_PIO4_IOWAIT4                   ((uint32_t)0x0000FF00)        /*!<IOWAIT4[7:0] bits (I/O 4 wait time) */
-#define  FSMC_PIO4_IOWAIT4_0                 ((uint32_t)0x00000100)        /*!<Bit 0 */
-#define  FSMC_PIO4_IOWAIT4_1                 ((uint32_t)0x00000200)        /*!<Bit 1 */
-#define  FSMC_PIO4_IOWAIT4_2                 ((uint32_t)0x00000400)        /*!<Bit 2 */
-#define  FSMC_PIO4_IOWAIT4_3                 ((uint32_t)0x00000800)        /*!<Bit 3 */
-#define  FSMC_PIO4_IOWAIT4_4                 ((uint32_t)0x00001000)        /*!<Bit 4 */
-#define  FSMC_PIO4_IOWAIT4_5                 ((uint32_t)0x00002000)        /*!<Bit 5 */
-#define  FSMC_PIO4_IOWAIT4_6                 ((uint32_t)0x00004000)        /*!<Bit 6 */
-#define  FSMC_PIO4_IOWAIT4_7                 ((uint32_t)0x00008000)        /*!<Bit 7 */
-
-#define  FSMC_PIO4_IOHOLD4                   ((uint32_t)0x00FF0000)        /*!<IOHOLD4[7:0] bits (I/O 4 hold time) */
-#define  FSMC_PIO4_IOHOLD4_0                 ((uint32_t)0x00010000)        /*!<Bit 0 */
-#define  FSMC_PIO4_IOHOLD4_1                 ((uint32_t)0x00020000)        /*!<Bit 1 */
-#define  FSMC_PIO4_IOHOLD4_2                 ((uint32_t)0x00040000)        /*!<Bit 2 */
-#define  FSMC_PIO4_IOHOLD4_3                 ((uint32_t)0x00080000)        /*!<Bit 3 */
-#define  FSMC_PIO4_IOHOLD4_4                 ((uint32_t)0x00100000)        /*!<Bit 4 */
-#define  FSMC_PIO4_IOHOLD4_5                 ((uint32_t)0x00200000)        /*!<Bit 5 */
-#define  FSMC_PIO4_IOHOLD4_6                 ((uint32_t)0x00400000)        /*!<Bit 6 */
-#define  FSMC_PIO4_IOHOLD4_7                 ((uint32_t)0x00800000)        /*!<Bit 7 */
-
-#define  FSMC_PIO4_IOHIZ4                    ((uint32_t)0xFF000000)        /*!<IOHIZ4[7:0] bits (I/O 4 databus HiZ time) */
-#define  FSMC_PIO4_IOHIZ4_0                  ((uint32_t)0x01000000)        /*!<Bit 0 */
-#define  FSMC_PIO4_IOHIZ4_1                  ((uint32_t)0x02000000)        /*!<Bit 1 */
-#define  FSMC_PIO4_IOHIZ4_2                  ((uint32_t)0x04000000)        /*!<Bit 2 */
-#define  FSMC_PIO4_IOHIZ4_3                  ((uint32_t)0x08000000)        /*!<Bit 3 */
-#define  FSMC_PIO4_IOHIZ4_4                  ((uint32_t)0x10000000)        /*!<Bit 4 */
-#define  FSMC_PIO4_IOHIZ4_5                  ((uint32_t)0x20000000)        /*!<Bit 5 */
-#define  FSMC_PIO4_IOHIZ4_6                  ((uint32_t)0x40000000)        /*!<Bit 6 */
-#define  FSMC_PIO4_IOHIZ4_7                  ((uint32_t)0x80000000)        /*!<Bit 7 */
-
-/******************  Bit definition for FSMC_ECCR2 register  ******************/
-#define  FSMC_ECCR2_ECC2                     ((uint32_t)0xFFFFFFFF)        /*!<ECC result */
-
-/******************  Bit definition for FSMC_ECCR3 register  ******************/
-#define  FSMC_ECCR3_ECC3                     ((uint32_t)0xFFFFFFFF)        /*!<ECC result */
-
-
-/******************************************************************************/
-/*                                                                            */
-/*                            General Purpose I/O                             */
-/*                                                                            */
-/******************************************************************************/
-/******************  Bits definition for GPIO_MODER register  *****************/
-#define GPIO_MODER_MODER0                    ((uint32_t)0x00000003)
-#define GPIO_MODER_MODER0_0                  ((uint32_t)0x00000001)
-#define GPIO_MODER_MODER0_1                  ((uint32_t)0x00000002)
-
-#define GPIO_MODER_MODER1                    ((uint32_t)0x0000000C)
-#define GPIO_MODER_MODER1_0                  ((uint32_t)0x00000004)
-#define GPIO_MODER_MODER1_1                  ((uint32_t)0x00000008)
-
-#define GPIO_MODER_MODER2                    ((uint32_t)0x00000030)
-#define GPIO_MODER_MODER2_0                  ((uint32_t)0x00000010)
-#define GPIO_MODER_MODER2_1                  ((uint32_t)0x00000020)
-
-#define GPIO_MODER_MODER3                    ((uint32_t)0x000000C0)
-#define GPIO_MODER_MODER3_0                  ((uint32_t)0x00000040)
-#define GPIO_MODER_MODER3_1                  ((uint32_t)0x00000080)
-
-#define GPIO_MODER_MODER4                    ((uint32_t)0x00000300)
-#define GPIO_MODER_MODER4_0                  ((uint32_t)0x00000100)
-#define GPIO_MODER_MODER4_1                  ((uint32_t)0x00000200)
-
-#define GPIO_MODER_MODER5                    ((uint32_t)0x00000C00)
-#define GPIO_MODER_MODER5_0                  ((uint32_t)0x00000400)
-#define GPIO_MODER_MODER5_1                  ((uint32_t)0x00000800)
-
-#define GPIO_MODER_MODER6                    ((uint32_t)0x00003000)
-#define GPIO_MODER_MODER6_0                  ((uint32_t)0x00001000)
-#define GPIO_MODER_MODER6_1                  ((uint32_t)0x00002000)
-
-#define GPIO_MODER_MODER7                    ((uint32_t)0x0000C000)
-#define GPIO_MODER_MODER7_0                  ((uint32_t)0x00004000)
-#define GPIO_MODER_MODER7_1                  ((uint32_t)0x00008000)
-
-#define GPIO_MODER_MODER8                    ((uint32_t)0x00030000)
-#define GPIO_MODER_MODER8_0                  ((uint32_t)0x00010000)
-#define GPIO_MODER_MODER8_1                  ((uint32_t)0x00020000)
-
-#define GPIO_MODER_MODER9                    ((uint32_t)0x000C0000)
-#define GPIO_MODER_MODER9_0                  ((uint32_t)0x00040000)
-#define GPIO_MODER_MODER9_1                  ((uint32_t)0x00080000)
-
-#define GPIO_MODER_MODER10                   ((uint32_t)0x00300000)
-#define GPIO_MODER_MODER10_0                 ((uint32_t)0x00100000)
-#define GPIO_MODER_MODER10_1                 ((uint32_t)0x00200000)
-
-#define GPIO_MODER_MODER11                   ((uint32_t)0x00C00000)
-#define GPIO_MODER_MODER11_0                 ((uint32_t)0x00400000)
-#define GPIO_MODER_MODER11_1                 ((uint32_t)0x00800000)
-
-#define GPIO_MODER_MODER12                   ((uint32_t)0x03000000)
-#define GPIO_MODER_MODER12_0                 ((uint32_t)0x01000000)
-#define GPIO_MODER_MODER12_1                 ((uint32_t)0x02000000)
-
-#define GPIO_MODER_MODER13                   ((uint32_t)0x0C000000)
-#define GPIO_MODER_MODER13_0                 ((uint32_t)0x04000000)
-#define GPIO_MODER_MODER13_1                 ((uint32_t)0x08000000)
-
-#define GPIO_MODER_MODER14                   ((uint32_t)0x30000000)
-#define GPIO_MODER_MODER14_0                 ((uint32_t)0x10000000)
-#define GPIO_MODER_MODER14_1                 ((uint32_t)0x20000000)
-
-#define GPIO_MODER_MODER15                   ((uint32_t)0xC0000000)
-#define GPIO_MODER_MODER15_0                 ((uint32_t)0x40000000)
-#define GPIO_MODER_MODER15_1                 ((uint32_t)0x80000000)
-
-/******************  Bits definition for GPIO_OTYPER register  ****************/
-#define GPIO_OTYPER_OT_0                     ((uint32_t)0x00000001)
-#define GPIO_OTYPER_OT_1                     ((uint32_t)0x00000002)
-#define GPIO_OTYPER_OT_2                     ((uint32_t)0x00000004)
-#define GPIO_OTYPER_OT_3                     ((uint32_t)0x00000008)
-#define GPIO_OTYPER_OT_4                     ((uint32_t)0x00000010)
-#define GPIO_OTYPER_OT_5                     ((uint32_t)0x00000020)
-#define GPIO_OTYPER_OT_6                     ((uint32_t)0x00000040)
-#define GPIO_OTYPER_OT_7                     ((uint32_t)0x00000080)
-#define GPIO_OTYPER_OT_8                     ((uint32_t)0x00000100)
-#define GPIO_OTYPER_OT_9                     ((uint32_t)0x00000200)
-#define GPIO_OTYPER_OT_10                    ((uint32_t)0x00000400)
-#define GPIO_OTYPER_OT_11                    ((uint32_t)0x00000800)
-#define GPIO_OTYPER_OT_12                    ((uint32_t)0x00001000)
-#define GPIO_OTYPER_OT_13                    ((uint32_t)0x00002000)
-#define GPIO_OTYPER_OT_14                    ((uint32_t)0x00004000)
-#define GPIO_OTYPER_OT_15                    ((uint32_t)0x00008000)
-
-/******************  Bits definition for GPIO_OSPEEDR register  ***************/
-#define GPIO_OSPEEDER_OSPEEDR0               ((uint32_t)0x00000003)
-#define GPIO_OSPEEDER_OSPEEDR0_0             ((uint32_t)0x00000001)
-#define GPIO_OSPEEDER_OSPEEDR0_1             ((uint32_t)0x00000002)
-
-#define GPIO_OSPEEDER_OSPEEDR1               ((uint32_t)0x0000000C)
-#define GPIO_OSPEEDER_OSPEEDR1_0             ((uint32_t)0x00000004)
-#define GPIO_OSPEEDER_OSPEEDR1_1             ((uint32_t)0x00000008)
-
-#define GPIO_OSPEEDER_OSPEEDR2               ((uint32_t)0x00000030)
-#define GPIO_OSPEEDER_OSPEEDR2_0             ((uint32_t)0x00000010)
-#define GPIO_OSPEEDER_OSPEEDR2_1             ((uint32_t)0x00000020)
-
-#define GPIO_OSPEEDER_OSPEEDR3               ((uint32_t)0x000000C0)
-#define GPIO_OSPEEDER_OSPEEDR3_0             ((uint32_t)0x00000040)
-#define GPIO_OSPEEDER_OSPEEDR3_1             ((uint32_t)0x00000080)
-
-#define GPIO_OSPEEDER_OSPEEDR4               ((uint32_t)0x00000300)
-#define GPIO_OSPEEDER_OSPEEDR4_0             ((uint32_t)0x00000100)
-#define GPIO_OSPEEDER_OSPEEDR4_1             ((uint32_t)0x00000200)
-
-#define GPIO_OSPEEDER_OSPEEDR5               ((uint32_t)0x00000C00)
-#define GPIO_OSPEEDER_OSPEEDR5_0             ((uint32_t)0x00000400)
-#define GPIO_OSPEEDER_OSPEEDR5_1             ((uint32_t)0x00000800)
-
-#define GPIO_OSPEEDER_OSPEEDR6               ((uint32_t)0x00003000)
-#define GPIO_OSPEEDER_OSPEEDR6_0             ((uint32_t)0x00001000)
-#define GPIO_OSPEEDER_OSPEEDR6_1             ((uint32_t)0x00002000)
-
-#define GPIO_OSPEEDER_OSPEEDR7               ((uint32_t)0x0000C000)
-#define GPIO_OSPEEDER_OSPEEDR7_0             ((uint32_t)0x00004000)
-#define GPIO_OSPEEDER_OSPEEDR7_1             ((uint32_t)0x00008000)
-
-#define GPIO_OSPEEDER_OSPEEDR8               ((uint32_t)0x00030000)
-#define GPIO_OSPEEDER_OSPEEDR8_0             ((uint32_t)0x00010000)
-#define GPIO_OSPEEDER_OSPEEDR8_1             ((uint32_t)0x00020000)
-
-#define GPIO_OSPEEDER_OSPEEDR9               ((uint32_t)0x000C0000)
-#define GPIO_OSPEEDER_OSPEEDR9_0             ((uint32_t)0x00040000)
-#define GPIO_OSPEEDER_OSPEEDR9_1             ((uint32_t)0x00080000)
-
-#define GPIO_OSPEEDER_OSPEEDR10              ((uint32_t)0x00300000)
-#define GPIO_OSPEEDER_OSPEEDR10_0            ((uint32_t)0x00100000)
-#define GPIO_OSPEEDER_OSPEEDR10_1            ((uint32_t)0x00200000)
-
-#define GPIO_OSPEEDER_OSPEEDR11              ((uint32_t)0x00C00000)
-#define GPIO_OSPEEDER_OSPEEDR11_0            ((uint32_t)0x00400000)
-#define GPIO_OSPEEDER_OSPEEDR11_1            ((uint32_t)0x00800000)
-
-#define GPIO_OSPEEDER_OSPEEDR12              ((uint32_t)0x03000000)
-#define GPIO_OSPEEDER_OSPEEDR12_0            ((uint32_t)0x01000000)
-#define GPIO_OSPEEDER_OSPEEDR12_1            ((uint32_t)0x02000000)
-
-#define GPIO_OSPEEDER_OSPEEDR13              ((uint32_t)0x0C000000)
-#define GPIO_OSPEEDER_OSPEEDR13_0            ((uint32_t)0x04000000)
-#define GPIO_OSPEEDER_OSPEEDR13_1            ((uint32_t)0x08000000)
-
-#define GPIO_OSPEEDER_OSPEEDR14              ((uint32_t)0x30000000)
-#define GPIO_OSPEEDER_OSPEEDR14_0            ((uint32_t)0x10000000)
-#define GPIO_OSPEEDER_OSPEEDR14_1            ((uint32_t)0x20000000)
-
-#define GPIO_OSPEEDER_OSPEEDR15              ((uint32_t)0xC0000000)
-#define GPIO_OSPEEDER_OSPEEDR15_0            ((uint32_t)0x40000000)
-#define GPIO_OSPEEDER_OSPEEDR15_1            ((uint32_t)0x80000000)
-
-/******************  Bits definition for GPIO_PUPDR register  *****************/
-#define GPIO_PUPDR_PUPDR0                    ((uint32_t)0x00000003)
-#define GPIO_PUPDR_PUPDR0_0                  ((uint32_t)0x00000001)
-#define GPIO_PUPDR_PUPDR0_1                  ((uint32_t)0x00000002)
-
-#define GPIO_PUPDR_PUPDR1                    ((uint32_t)0x0000000C)
-#define GPIO_PUPDR_PUPDR1_0                  ((uint32_t)0x00000004)
-#define GPIO_PUPDR_PUPDR1_1                  ((uint32_t)0x00000008)
-
-#define GPIO_PUPDR_PUPDR2                    ((uint32_t)0x00000030)
-#define GPIO_PUPDR_PUPDR2_0                  ((uint32_t)0x00000010)
-#define GPIO_PUPDR_PUPDR2_1                  ((uint32_t)0x00000020)
-
-#define GPIO_PUPDR_PUPDR3                    ((uint32_t)0x000000C0)
-#define GPIO_PUPDR_PUPDR3_0                  ((uint32_t)0x00000040)
-#define GPIO_PUPDR_PUPDR3_1                  ((uint32_t)0x00000080)
-
-#define GPIO_PUPDR_PUPDR4                    ((uint32_t)0x00000300)
-#define GPIO_PUPDR_PUPDR4_0                  ((uint32_t)0x00000100)
-#define GPIO_PUPDR_PUPDR4_1                  ((uint32_t)0x00000200)
-
-#define GPIO_PUPDR_PUPDR5                    ((uint32_t)0x00000C00)
-#define GPIO_PUPDR_PUPDR5_0                  ((uint32_t)0x00000400)
-#define GPIO_PUPDR_PUPDR5_1                  ((uint32_t)0x00000800)
-
-#define GPIO_PUPDR_PUPDR6                    ((uint32_t)0x00003000)
-#define GPIO_PUPDR_PUPDR6_0                  ((uint32_t)0x00001000)
-#define GPIO_PUPDR_PUPDR6_1                  ((uint32_t)0x00002000)
-
-#define GPIO_PUPDR_PUPDR7                    ((uint32_t)0x0000C000)
-#define GPIO_PUPDR_PUPDR7_0                  ((uint32_t)0x00004000)
-#define GPIO_PUPDR_PUPDR7_1                  ((uint32_t)0x00008000)
-
-#define GPIO_PUPDR_PUPDR8                    ((uint32_t)0x00030000)
-#define GPIO_PUPDR_PUPDR8_0                  ((uint32_t)0x00010000)
-#define GPIO_PUPDR_PUPDR8_1                  ((uint32_t)0x00020000)
-
-#define GPIO_PUPDR_PUPDR9                    ((uint32_t)0x000C0000)
-#define GPIO_PUPDR_PUPDR9_0                  ((uint32_t)0x00040000)
-#define GPIO_PUPDR_PUPDR9_1                  ((uint32_t)0x00080000)
-
-#define GPIO_PUPDR_PUPDR10                   ((uint32_t)0x00300000)
-#define GPIO_PUPDR_PUPDR10_0                 ((uint32_t)0x00100000)
-#define GPIO_PUPDR_PUPDR10_1                 ((uint32_t)0x00200000)
-
-#define GPIO_PUPDR_PUPDR11                   ((uint32_t)0x00C00000)
-#define GPIO_PUPDR_PUPDR11_0                 ((uint32_t)0x00400000)
-#define GPIO_PUPDR_PUPDR11_1                 ((uint32_t)0x00800000)
-
-#define GPIO_PUPDR_PUPDR12                   ((uint32_t)0x03000000)
-#define GPIO_PUPDR_PUPDR12_0                 ((uint32_t)0x01000000)
-#define GPIO_PUPDR_PUPDR12_1                 ((uint32_t)0x02000000)
-
-#define GPIO_PUPDR_PUPDR13                   ((uint32_t)0x0C000000)
-#define GPIO_PUPDR_PUPDR13_0                 ((uint32_t)0x04000000)
-#define GPIO_PUPDR_PUPDR13_1                 ((uint32_t)0x08000000)
-
-#define GPIO_PUPDR_PUPDR14                   ((uint32_t)0x30000000)
-#define GPIO_PUPDR_PUPDR14_0                 ((uint32_t)0x10000000)
-#define GPIO_PUPDR_PUPDR14_1                 ((uint32_t)0x20000000)
-
-#define GPIO_PUPDR_PUPDR15                   ((uint32_t)0xC0000000)
-#define GPIO_PUPDR_PUPDR15_0                 ((uint32_t)0x40000000)
-#define GPIO_PUPDR_PUPDR15_1                 ((uint32_t)0x80000000)
-
-/******************  Bits definition for GPIO_IDR register  *******************/
-#define GPIO_IDR_IDR_0                       ((uint32_t)0x00000001)
-#define GPIO_IDR_IDR_1                       ((uint32_t)0x00000002)
-#define GPIO_IDR_IDR_2                       ((uint32_t)0x00000004)
-#define GPIO_IDR_IDR_3                       ((uint32_t)0x00000008)
-#define GPIO_IDR_IDR_4                       ((uint32_t)0x00000010)
-#define GPIO_IDR_IDR_5                       ((uint32_t)0x00000020)
-#define GPIO_IDR_IDR_6                       ((uint32_t)0x00000040)
-#define GPIO_IDR_IDR_7                       ((uint32_t)0x00000080)
-#define GPIO_IDR_IDR_8                       ((uint32_t)0x00000100)
-#define GPIO_IDR_IDR_9                       ((uint32_t)0x00000200)
-#define GPIO_IDR_IDR_10                      ((uint32_t)0x00000400)
-#define GPIO_IDR_IDR_11                      ((uint32_t)0x00000800)
-#define GPIO_IDR_IDR_12                      ((uint32_t)0x00001000)
-#define GPIO_IDR_IDR_13                      ((uint32_t)0x00002000)
-#define GPIO_IDR_IDR_14                      ((uint32_t)0x00004000)
-#define GPIO_IDR_IDR_15                      ((uint32_t)0x00008000)
-/* Old GPIO_IDR register bits definition, maintained for legacy purpose */
-#define GPIO_OTYPER_IDR_0                    GPIO_IDR_IDR_0
-#define GPIO_OTYPER_IDR_1                    GPIO_IDR_IDR_1
-#define GPIO_OTYPER_IDR_2                    GPIO_IDR_IDR_2
-#define GPIO_OTYPER_IDR_3                    GPIO_IDR_IDR_3
-#define GPIO_OTYPER_IDR_4                    GPIO_IDR_IDR_4
-#define GPIO_OTYPER_IDR_5                    GPIO_IDR_IDR_5
-#define GPIO_OTYPER_IDR_6                    GPIO_IDR_IDR_6
-#define GPIO_OTYPER_IDR_7                    GPIO_IDR_IDR_7
-#define GPIO_OTYPER_IDR_8                    GPIO_IDR_IDR_8
-#define GPIO_OTYPER_IDR_9                    GPIO_IDR_IDR_9
-#define GPIO_OTYPER_IDR_10                   GPIO_IDR_IDR_10
-#define GPIO_OTYPER_IDR_11                   GPIO_IDR_IDR_11
-#define GPIO_OTYPER_IDR_12                   GPIO_IDR_IDR_12
-#define GPIO_OTYPER_IDR_13                   GPIO_IDR_IDR_13
-#define GPIO_OTYPER_IDR_14                   GPIO_IDR_IDR_14
-#define GPIO_OTYPER_IDR_15                   GPIO_IDR_IDR_15
-
-/******************  Bits definition for GPIO_ODR register  *******************/
-#define GPIO_ODR_ODR_0                       ((uint32_t)0x00000001)
-#define GPIO_ODR_ODR_1                       ((uint32_t)0x00000002)
-#define GPIO_ODR_ODR_2                       ((uint32_t)0x00000004)
-#define GPIO_ODR_ODR_3                       ((uint32_t)0x00000008)
-#define GPIO_ODR_ODR_4                       ((uint32_t)0x00000010)
-#define GPIO_ODR_ODR_5                       ((uint32_t)0x00000020)
-#define GPIO_ODR_ODR_6                       ((uint32_t)0x00000040)
-#define GPIO_ODR_ODR_7                       ((uint32_t)0x00000080)
-#define GPIO_ODR_ODR_8                       ((uint32_t)0x00000100)
-#define GPIO_ODR_ODR_9                       ((uint32_t)0x00000200)
-#define GPIO_ODR_ODR_10                      ((uint32_t)0x00000400)
-#define GPIO_ODR_ODR_11                      ((uint32_t)0x00000800)
-#define GPIO_ODR_ODR_12                      ((uint32_t)0x00001000)
-#define GPIO_ODR_ODR_13                      ((uint32_t)0x00002000)
-#define GPIO_ODR_ODR_14                      ((uint32_t)0x00004000)
-#define GPIO_ODR_ODR_15                      ((uint32_t)0x00008000)
-/* Old GPIO_ODR register bits definition, maintained for legacy purpose */
-#define GPIO_OTYPER_ODR_0                    GPIO_ODR_ODR_0
-#define GPIO_OTYPER_ODR_1                    GPIO_ODR_ODR_1
-#define GPIO_OTYPER_ODR_2                    GPIO_ODR_ODR_2
-#define GPIO_OTYPER_ODR_3                    GPIO_ODR_ODR_3
-#define GPIO_OTYPER_ODR_4                    GPIO_ODR_ODR_4
-#define GPIO_OTYPER_ODR_5                    GPIO_ODR_ODR_5
-#define GPIO_OTYPER_ODR_6                    GPIO_ODR_ODR_6
-#define GPIO_OTYPER_ODR_7                    GPIO_ODR_ODR_7
-#define GPIO_OTYPER_ODR_8                    GPIO_ODR_ODR_8
-#define GPIO_OTYPER_ODR_9                    GPIO_ODR_ODR_9
-#define GPIO_OTYPER_ODR_10                   GPIO_ODR_ODR_10
-#define GPIO_OTYPER_ODR_11                   GPIO_ODR_ODR_11
-#define GPIO_OTYPER_ODR_12                   GPIO_ODR_ODR_12
-#define GPIO_OTYPER_ODR_13                   GPIO_ODR_ODR_13
-#define GPIO_OTYPER_ODR_14                   GPIO_ODR_ODR_14
-#define GPIO_OTYPER_ODR_15                   GPIO_ODR_ODR_15
-
-/******************  Bits definition for GPIO_BSRR register  ******************/
-#define GPIO_BSRR_BS_0                       ((uint32_t)0x00000001)
-#define GPIO_BSRR_BS_1                       ((uint32_t)0x00000002)
-#define GPIO_BSRR_BS_2                       ((uint32_t)0x00000004)
-#define GPIO_BSRR_BS_3                       ((uint32_t)0x00000008)
-#define GPIO_BSRR_BS_4                       ((uint32_t)0x00000010)
-#define GPIO_BSRR_BS_5                       ((uint32_t)0x00000020)
-#define GPIO_BSRR_BS_6                       ((uint32_t)0x00000040)
-#define GPIO_BSRR_BS_7                       ((uint32_t)0x00000080)
-#define GPIO_BSRR_BS_8                       ((uint32_t)0x00000100)
-#define GPIO_BSRR_BS_9                       ((uint32_t)0x00000200)
-#define GPIO_BSRR_BS_10                      ((uint32_t)0x00000400)
-#define GPIO_BSRR_BS_11                      ((uint32_t)0x00000800)
-#define GPIO_BSRR_BS_12                      ((uint32_t)0x00001000)
-#define GPIO_BSRR_BS_13                      ((uint32_t)0x00002000)
-#define GPIO_BSRR_BS_14                      ((uint32_t)0x00004000)
-#define GPIO_BSRR_BS_15                      ((uint32_t)0x00008000)
-#define GPIO_BSRR_BR_0                       ((uint32_t)0x00010000)
-#define GPIO_BSRR_BR_1                       ((uint32_t)0x00020000)
-#define GPIO_BSRR_BR_2                       ((uint32_t)0x00040000)
-#define GPIO_BSRR_BR_3                       ((uint32_t)0x00080000)
-#define GPIO_BSRR_BR_4                       ((uint32_t)0x00100000)
-#define GPIO_BSRR_BR_5                       ((uint32_t)0x00200000)
-#define GPIO_BSRR_BR_6                       ((uint32_t)0x00400000)
-#define GPIO_BSRR_BR_7                       ((uint32_t)0x00800000)
-#define GPIO_BSRR_BR_8                       ((uint32_t)0x01000000)
-#define GPIO_BSRR_BR_9                       ((uint32_t)0x02000000)
-#define GPIO_BSRR_BR_10                      ((uint32_t)0x04000000)
-#define GPIO_BSRR_BR_11                      ((uint32_t)0x08000000)
-#define GPIO_BSRR_BR_12                      ((uint32_t)0x10000000)
-#define GPIO_BSRR_BR_13                      ((uint32_t)0x20000000)
-#define GPIO_BSRR_BR_14                      ((uint32_t)0x40000000)
-#define GPIO_BSRR_BR_15                      ((uint32_t)0x80000000)
-
-/******************************************************************************/
-/*                                                                            */
-/*                                    HASH                                    */
-/*                                                                            */
-/******************************************************************************/
-/******************  Bits definition for HASH_CR register  ********************/
-#define HASH_CR_INIT                         ((uint32_t)0x00000004)
-#define HASH_CR_DMAE                         ((uint32_t)0x00000008)
-#define HASH_CR_DATATYPE                     ((uint32_t)0x00000030)
-#define HASH_CR_DATATYPE_0                   ((uint32_t)0x00000010)
-#define HASH_CR_DATATYPE_1                   ((uint32_t)0x00000020)
-#define HASH_CR_MODE                         ((uint32_t)0x00000040)
-#define HASH_CR_ALGO                         ((uint32_t)0x00040080)
-#define HASH_CR_ALGO_0                       ((uint32_t)0x00000080)
-#define HASH_CR_ALGO_1                       ((uint32_t)0x00040000)
-#define HASH_CR_NBW                          ((uint32_t)0x00000F00)
-#define HASH_CR_NBW_0                        ((uint32_t)0x00000100)
-#define HASH_CR_NBW_1                        ((uint32_t)0x00000200)
-#define HASH_CR_NBW_2                        ((uint32_t)0x00000400)
-#define HASH_CR_NBW_3                        ((uint32_t)0x00000800)
-#define HASH_CR_DINNE                        ((uint32_t)0x00001000)
-#define HASH_CR_MDMAT                        ((uint32_t)0x00002000)
-#define HASH_CR_LKEY                         ((uint32_t)0x00010000)
-
-/******************  Bits definition for HASH_STR register  *******************/
-#define HASH_STR_NBW                         ((uint32_t)0x0000001F)
-#define HASH_STR_NBW_0                       ((uint32_t)0x00000001)
-#define HASH_STR_NBW_1                       ((uint32_t)0x00000002)
-#define HASH_STR_NBW_2                       ((uint32_t)0x00000004)
-#define HASH_STR_NBW_3                       ((uint32_t)0x00000008)
-#define HASH_STR_NBW_4                       ((uint32_t)0x00000010)
-#define HASH_STR_DCAL                        ((uint32_t)0x00000100)
-
-/******************  Bits definition for HASH_IMR register  *******************/
-#define HASH_IMR_DINIM                       ((uint32_t)0x00000001)
-#define HASH_IMR_DCIM                        ((uint32_t)0x00000002)
-
-/******************  Bits definition for HASH_SR register  ********************/
-#define HASH_SR_DINIS                        ((uint32_t)0x00000001)
-#define HASH_SR_DCIS                         ((uint32_t)0x00000002)
-#define HASH_SR_DMAS                         ((uint32_t)0x00000004)
-#define HASH_SR_BUSY                         ((uint32_t)0x00000008)
-
-/******************************************************************************/
-/*                                                                            */
-/*                      Inter-integrated Circuit Interface                    */
-/*                                                                            */
-/******************************************************************************/
-/*******************  Bit definition for I2C_CR1 register  ********************/
-#define  I2C_CR1_PE                          ((uint16_t)0x0001)            /*!<Peripheral Enable                             */
-#define  I2C_CR1_SMBUS                       ((uint16_t)0x0002)            /*!<SMBus Mode                                    */
-#define  I2C_CR1_SMBTYPE                     ((uint16_t)0x0008)            /*!<SMBus Type                                    */
-#define  I2C_CR1_ENARP                       ((uint16_t)0x0010)            /*!<ARP Enable                                    */
-#define  I2C_CR1_ENPEC                       ((uint16_t)0x0020)            /*!<PEC Enable                                    */
-#define  I2C_CR1_ENGC                        ((uint16_t)0x0040)            /*!<General Call Enable                           */
-#define  I2C_CR1_NOSTRETCH                   ((uint16_t)0x0080)            /*!<Clock Stretching Disable (Slave mode)         */
-#define  I2C_CR1_START                       ((uint16_t)0x0100)            /*!<Start Generation                              */
-#define  I2C_CR1_STOP                        ((uint16_t)0x0200)            /*!<Stop Generation                               */
-#define  I2C_CR1_ACK                         ((uint16_t)0x0400)            /*!<Acknowledge Enable                            */
-#define  I2C_CR1_POS                         ((uint16_t)0x0800)            /*!<Acknowledge/PEC Position (for data reception) */
-#define  I2C_CR1_PEC                         ((uint16_t)0x1000)            /*!<Packet Error Checking                         */
-#define  I2C_CR1_ALERT                       ((uint16_t)0x2000)            /*!<SMBus Alert                                   */
-#define  I2C_CR1_SWRST                       ((uint16_t)0x8000)            /*!<Software Reset                                */
-
-/*******************  Bit definition for I2C_CR2 register  ********************/
-#define  I2C_CR2_FREQ                        ((uint16_t)0x003F)            /*!<FREQ[5:0] bits (Peripheral Clock Frequency)   */
-#define  I2C_CR2_FREQ_0                      ((uint16_t)0x0001)            /*!<Bit 0 */
-#define  I2C_CR2_FREQ_1                      ((uint16_t)0x0002)            /*!<Bit 1 */
-#define  I2C_CR2_FREQ_2                      ((uint16_t)0x0004)            /*!<Bit 2 */
-#define  I2C_CR2_FREQ_3                      ((uint16_t)0x0008)            /*!<Bit 3 */
-#define  I2C_CR2_FREQ_4                      ((uint16_t)0x0010)            /*!<Bit 4 */
-#define  I2C_CR2_FREQ_5                      ((uint16_t)0x0020)            /*!<Bit 5 */
-
-#define  I2C_CR2_ITERREN                     ((uint16_t)0x0100)            /*!<Error Interrupt Enable  */
-#define  I2C_CR2_ITEVTEN                     ((uint16_t)0x0200)            /*!<Event Interrupt Enable  */
-#define  I2C_CR2_ITBUFEN                     ((uint16_t)0x0400)            /*!<Buffer Interrupt Enable */
-#define  I2C_CR2_DMAEN                       ((uint16_t)0x0800)            /*!<DMA Requests Enable     */
-#define  I2C_CR2_LAST                        ((uint16_t)0x1000)            /*!<DMA Last Transfer       */
-
-/*******************  Bit definition for I2C_OAR1 register  *******************/
-#define  I2C_OAR1_ADD1_7                     ((uint16_t)0x00FE)            /*!<Interface Address */
-#define  I2C_OAR1_ADD8_9                     ((uint16_t)0x0300)            /*!<Interface Address */
-
-#define  I2C_OAR1_ADD0                       ((uint16_t)0x0001)            /*!<Bit 0 */
-#define  I2C_OAR1_ADD1                       ((uint16_t)0x0002)            /*!<Bit 1 */
-#define  I2C_OAR1_ADD2                       ((uint16_t)0x0004)            /*!<Bit 2 */
-#define  I2C_OAR1_ADD3                       ((uint16_t)0x0008)            /*!<Bit 3 */
-#define  I2C_OAR1_ADD4                       ((uint16_t)0x0010)            /*!<Bit 4 */
-#define  I2C_OAR1_ADD5                       ((uint16_t)0x0020)            /*!<Bit 5 */
-#define  I2C_OAR1_ADD6                       ((uint16_t)0x0040)            /*!<Bit 6 */
-#define  I2C_OAR1_ADD7                       ((uint16_t)0x0080)            /*!<Bit 7 */
-#define  I2C_OAR1_ADD8                       ((uint16_t)0x0100)            /*!<Bit 8 */
-#define  I2C_OAR1_ADD9                       ((uint16_t)0x0200)            /*!<Bit 9 */
-
-#define  I2C_OAR1_ADDMODE                    ((uint16_t)0x8000)            /*!<Addressing Mode (Slave mode) */
-
-/*******************  Bit definition for I2C_OAR2 register  *******************/
-#define  I2C_OAR2_ENDUAL                     ((uint8_t)0x01)               /*!<Dual addressing mode enable */
-#define  I2C_OAR2_ADD2                       ((uint8_t)0xFE)               /*!<Interface address           */
-
-/********************  Bit definition for I2C_DR register  ********************/
-#define  I2C_DR_DR                           ((uint8_t)0xFF)               /*!<8-bit Data Register         */
-
-/*******************  Bit definition for I2C_SR1 register  ********************/
-#define  I2C_SR1_SB                          ((uint16_t)0x0001)            /*!<Start Bit (Master mode)                         */
-#define  I2C_SR1_ADDR                        ((uint16_t)0x0002)            /*!<Address sent (master mode)/matched (slave mode) */
-#define  I2C_SR1_BTF                         ((uint16_t)0x0004)            /*!<Byte Transfer Finished                          */
-#define  I2C_SR1_ADD10                       ((uint16_t)0x0008)            /*!<10-bit header sent (Master mode)                */
-#define  I2C_SR1_STOPF                       ((uint16_t)0x0010)            /*!<Stop detection (Slave mode)                     */
-#define  I2C_SR1_RXNE                        ((uint16_t)0x0040)            /*!<Data Register not Empty (receivers)             */
-#define  I2C_SR1_TXE                         ((uint16_t)0x0080)            /*!<Data Register Empty (transmitters)              */
-#define  I2C_SR1_BERR                        ((uint16_t)0x0100)            /*!<Bus Error                                       */
-#define  I2C_SR1_ARLO                        ((uint16_t)0x0200)            /*!<Arbitration Lost (master mode)                  */
-#define  I2C_SR1_AF                          ((uint16_t)0x0400)            /*!<Acknowledge Failure                             */
-#define  I2C_SR1_OVR                         ((uint16_t)0x0800)            /*!<Overrun/Underrun                                */
-#define  I2C_SR1_PECERR                      ((uint16_t)0x1000)            /*!<PEC Error in reception                          */
-#define  I2C_SR1_TIMEOUT                     ((uint16_t)0x4000)            /*!<Timeout or Tlow Error                           */
-#define  I2C_SR1_SMBALERT                    ((uint16_t)0x8000)            /*!<SMBus Alert                                     */
-
-/*******************  Bit definition for I2C_SR2 register  ********************/
-#define  I2C_SR2_MSL                         ((uint16_t)0x0001)            /*!<Master/Slave                              */
-#define  I2C_SR2_BUSY                        ((uint16_t)0x0002)            /*!<Bus Busy                                  */
-#define  I2C_SR2_TRA                         ((uint16_t)0x0004)            /*!<Transmitter/Receiver                      */
-#define  I2C_SR2_GENCALL                     ((uint16_t)0x0010)            /*!<General Call Address (Slave mode)         */
-#define  I2C_SR2_SMBDEFAULT                  ((uint16_t)0x0020)            /*!<SMBus Device Default Address (Slave mode) */
-#define  I2C_SR2_SMBHOST                     ((uint16_t)0x0040)            /*!<SMBus Host Header (Slave mode)            */
-#define  I2C_SR2_DUALF                       ((uint16_t)0x0080)            /*!<Dual Flag (Slave mode)                    */
-#define  I2C_SR2_PEC                         ((uint16_t)0xFF00)            /*!<Packet Error Checking Register            */
-
-/*******************  Bit definition for I2C_CCR register  ********************/
-#define  I2C_CCR_CCR                         ((uint16_t)0x0FFF)            /*!<Clock Control Register in Fast/Standard mode (Master mode) */
-#define  I2C_CCR_DUTY                        ((uint16_t)0x4000)            /*!<Fast Mode Duty Cycle                                       */
-#define  I2C_CCR_FS                          ((uint16_t)0x8000)            /*!<I2C Master Mode Selection                                  */
-
-/******************  Bit definition for I2C_TRISE register  *******************/
-#define  I2C_TRISE_TRISE                     ((uint8_t)0x3F)               /*!<Maximum Rise Time in Fast/Standard mode (Master mode) */
-
-/******************  Bit definition for I2C_FLTR register  *******************/
-#define  I2C_FLTR_DNF                     ((uint8_t)0x0F)                  /*!<Digital Noise Filter */
-#define  I2C_FLTR_ANOFF                   ((uint8_t)0x10)                  /*!<Analog Noise Filter OFF */
-
-/******************************************************************************/
-/*                                                                            */
-/*                           Independent WATCHDOG                             */
-/*                                                                            */
-/******************************************************************************/
-/*******************  Bit definition for IWDG_KR register  ********************/
-#define  IWDG_KR_KEY                         ((uint16_t)0xFFFF)            /*!<Key value (write only, read 0000h)  */
-
-/*******************  Bit definition for IWDG_PR register  ********************/
-#define  IWDG_PR_PR                          ((uint8_t)0x07)               /*!<PR[2:0] (Prescaler divider)         */
-#define  IWDG_PR_PR_0                        ((uint8_t)0x01)               /*!<Bit 0 */
-#define  IWDG_PR_PR_1                        ((uint8_t)0x02)               /*!<Bit 1 */
-#define  IWDG_PR_PR_2                        ((uint8_t)0x04)               /*!<Bit 2 */
-
-/*******************  Bit definition for IWDG_RLR register  *******************/
-#define  IWDG_RLR_RL                         ((uint16_t)0x0FFF)            /*!<Watchdog counter reload value        */
-
-/*******************  Bit definition for IWDG_SR register  ********************/
-#define  IWDG_SR_PVU                         ((uint8_t)0x01)               /*!<Watchdog prescaler value update      */
-#define  IWDG_SR_RVU                         ((uint8_t)0x02)               /*!<Watchdog counter reload value update */
-
-
-/******************************************************************************/
-/*                                                                            */
-/*                             Power Control                                  */
-/*                                                                            */
-/******************************************************************************/
-/********************  Bit definition for PWR_CR register  ********************/
-#define  PWR_CR_LPDS                         ((uint32_t)0x00000001)     /*!< Low-Power Deepsleep                 */
-#define  PWR_CR_PDDS                         ((uint32_t)0x00000002)     /*!< Power Down Deepsleep                */
-#define  PWR_CR_CWUF                         ((uint32_t)0x00000004)     /*!< Clear Wakeup Flag                   */
-#define  PWR_CR_CSBF                         ((uint32_t)0x00000008)     /*!< Clear Standby Flag                  */
-#define  PWR_CR_PVDE                         ((uint32_t)0x00000010)     /*!< Power Voltage Detector Enable       */
-
-#define  PWR_CR_PLS                          ((uint32_t)0x000000E0)     /*!< PLS[2:0] bits (PVD Level Selection) */
-#define  PWR_CR_PLS_0                        ((uint32_t)0x00000020)     /*!< Bit 0 */
-#define  PWR_CR_PLS_1                        ((uint32_t)0x00000040)     /*!< Bit 1 */
-#define  PWR_CR_PLS_2                        ((uint32_t)0x00000080)     /*!< Bit 2 */
-
-/*!< PVD level configuration */
-#define  PWR_CR_PLS_LEV0                     ((uint32_t)0x00000000)     /*!< PVD level 0 */
-#define  PWR_CR_PLS_LEV1                     ((uint32_t)0x00000020)     /*!< PVD level 1 */
-#define  PWR_CR_PLS_LEV2                     ((uint32_t)0x00000040)     /*!< PVD level 2 */
-#define  PWR_CR_PLS_LEV3                     ((uint32_t)0x00000060)     /*!< PVD level 3 */
-#define  PWR_CR_PLS_LEV4                     ((uint32_t)0x00000080)     /*!< PVD level 4 */
-#define  PWR_CR_PLS_LEV5                     ((uint32_t)0x000000A0)     /*!< PVD level 5 */
-#define  PWR_CR_PLS_LEV6                     ((uint32_t)0x000000C0)     /*!< PVD level 6 */
-#define  PWR_CR_PLS_LEV7                     ((uint32_t)0x000000E0)     /*!< PVD level 7 */
-
-#define  PWR_CR_DBP                          ((uint32_t)0x00000100)     /*!< Disable Backup Domain write protection                     */
-#define  PWR_CR_FPDS                         ((uint32_t)0x00000200)     /*!< Flash power down in Stop mode                              */
-#define  PWR_CR_LPLVDS                       ((uint32_t)0x00000400)     /*!< Low-Power Regulator Low Voltage Scaling in Stop mode       */
-#define  PWR_CR_MRLVDS                       ((uint32_t)0x00000800)     /*!< Main regulator Low Voltage Scaling in Stop mode            */
-
-#define  PWR_CR_VOS                          ((uint32_t)0x0000C000)     /*!< VOS[1:0] bits (Regulator voltage scaling output selection) */
-#define  PWR_CR_VOS_0                        ((uint32_t)0x00004000)     /*!< Bit 0 */
-#define  PWR_CR_VOS_1                        ((uint32_t)0x00008000)     /*!< Bit 1 */
-
-/* Legacy define */
-#define  PWR_CR_PMODE                        PWR_CR_VOS
-
-/*******************  Bit definition for PWR_CSR register  ********************/
-#define  PWR_CSR_WUF                         ((uint32_t)0x00000001)     /*!< Wakeup Flag                                      */
-#define  PWR_CSR_SBF                         ((uint32_t)0x00000002)     /*!< Standby Flag                                     */
-#define  PWR_CSR_PVDO                        ((uint32_t)0x00000004)     /*!< PVD Output                                       */
-#define  PWR_CSR_BRR                         ((uint32_t)0x00000008)     /*!< Backup regulator ready                           */
-#define  PWR_CSR_EWUP                        ((uint32_t)0x00000100)     /*!< Enable WKUP pin                                  */
-#define  PWR_CSR_BRE                         ((uint32_t)0x00000200)     /*!< Backup regulator enable                          */
-#define  PWR_CSR_VOSRDY                      ((uint32_t)0x00004000)     /*!< Regulator voltage scaling output selection ready */
-
-/* Legacy define */
-#define  PWR_CSR_REGRDY                      PWR_CSR_VOSRDY
-
-/******************************************************************************/
-/*                                                                            */
-/*                         Reset and Clock Control                            */
-/*                                                                            */
-/******************************************************************************/
-/********************  Bit definition for RCC_CR register  ********************/
-#define  RCC_CR_HSION                        ((uint32_t)0x00000001)
-#define  RCC_CR_HSIRDY                       ((uint32_t)0x00000002)
-
-#define  RCC_CR_HSITRIM                      ((uint32_t)0x000000F8)
-#define  RCC_CR_HSITRIM_0                    ((uint32_t)0x00000008)/*!<Bit 0 */
-#define  RCC_CR_HSITRIM_1                    ((uint32_t)0x00000010)/*!<Bit 1 */
-#define  RCC_CR_HSITRIM_2                    ((uint32_t)0x00000020)/*!<Bit 2 */
-#define  RCC_CR_HSITRIM_3                    ((uint32_t)0x00000040)/*!<Bit 3 */
-#define  RCC_CR_HSITRIM_4                    ((uint32_t)0x00000080)/*!<Bit 4 */
-
-#define  RCC_CR_HSICAL                       ((uint32_t)0x0000FF00)
-#define  RCC_CR_HSICAL_0                     ((uint32_t)0x00000100)/*!<Bit 0 */
-#define  RCC_CR_HSICAL_1                     ((uint32_t)0x00000200)/*!<Bit 1 */
-#define  RCC_CR_HSICAL_2                     ((uint32_t)0x00000400)/*!<Bit 2 */
-#define  RCC_CR_HSICAL_3                     ((uint32_t)0x00000800)/*!<Bit 3 */
-#define  RCC_CR_HSICAL_4                     ((uint32_t)0x00001000)/*!<Bit 4 */
-#define  RCC_CR_HSICAL_5                     ((uint32_t)0x00002000)/*!<Bit 5 */
-#define  RCC_CR_HSICAL_6                     ((uint32_t)0x00004000)/*!<Bit 6 */
-#define  RCC_CR_HSICAL_7                     ((uint32_t)0x00008000)/*!<Bit 7 */
-
-#define  RCC_CR_HSEON                        ((uint32_t)0x00010000)
-#define  RCC_CR_HSERDY                       ((uint32_t)0x00020000)
-#define  RCC_CR_HSEBYP                       ((uint32_t)0x00040000)
-#define  RCC_CR_CSSON                        ((uint32_t)0x00080000)
-#define  RCC_CR_PLLON                        ((uint32_t)0x01000000)
-#define  RCC_CR_PLLRDY                       ((uint32_t)0x02000000)
-#define  RCC_CR_PLLI2SON                     ((uint32_t)0x04000000)
-#define  RCC_CR_PLLI2SRDY                    ((uint32_t)0x08000000)
-
-
-/********************  Bit definition for RCC_PLLCFGR register  ***************/
-#define  RCC_PLLCFGR_PLLM                    ((uint32_t)0x0000003F)
-#define  RCC_PLLCFGR_PLLM_0                  ((uint32_t)0x00000001)
-#define  RCC_PLLCFGR_PLLM_1                  ((uint32_t)0x00000002)
-#define  RCC_PLLCFGR_PLLM_2                  ((uint32_t)0x00000004)
-#define  RCC_PLLCFGR_PLLM_3                  ((uint32_t)0x00000008)
-#define  RCC_PLLCFGR_PLLM_4                  ((uint32_t)0x00000010)
-#define  RCC_PLLCFGR_PLLM_5                  ((uint32_t)0x00000020)
-
-#define  RCC_PLLCFGR_PLLN                     ((uint32_t)0x00007FC0)
-#define  RCC_PLLCFGR_PLLN_0                   ((uint32_t)0x00000040)
-#define  RCC_PLLCFGR_PLLN_1                   ((uint32_t)0x00000080)
-#define  RCC_PLLCFGR_PLLN_2                   ((uint32_t)0x00000100)
-#define  RCC_PLLCFGR_PLLN_3                   ((uint32_t)0x00000200)
-#define  RCC_PLLCFGR_PLLN_4                   ((uint32_t)0x00000400)
-#define  RCC_PLLCFGR_PLLN_5                   ((uint32_t)0x00000800)
-#define  RCC_PLLCFGR_PLLN_6                   ((uint32_t)0x00001000)
-#define  RCC_PLLCFGR_PLLN_7                   ((uint32_t)0x00002000)
-#define  RCC_PLLCFGR_PLLN_8                   ((uint32_t)0x00004000)
-
-#define  RCC_PLLCFGR_PLLP                    ((uint32_t)0x00030000)
-#define  RCC_PLLCFGR_PLLP_0                  ((uint32_t)0x00010000)
-#define  RCC_PLLCFGR_PLLP_1                  ((uint32_t)0x00020000)
-
-#define  RCC_PLLCFGR_PLLSRC                  ((uint32_t)0x00400000)
-#define  RCC_PLLCFGR_PLLSRC_HSE              ((uint32_t)0x00400000)
-#define  RCC_PLLCFGR_PLLSRC_HSI              ((uint32_t)0x00000000)
-
-#define  RCC_PLLCFGR_PLLQ                    ((uint32_t)0x0F000000)
-#define  RCC_PLLCFGR_PLLQ_0                  ((uint32_t)0x01000000)
-#define  RCC_PLLCFGR_PLLQ_1                  ((uint32_t)0x02000000)
-#define  RCC_PLLCFGR_PLLQ_2                  ((uint32_t)0x04000000)
-#define  RCC_PLLCFGR_PLLQ_3                  ((uint32_t)0x08000000)
-
-/********************  Bit definition for RCC_CFGR register  ******************/
-/*!< SW configuration */
-#define  RCC_CFGR_SW                         ((uint32_t)0x00000003)        /*!< SW[1:0] bits (System clock Switch) */
-#define  RCC_CFGR_SW_0                       ((uint32_t)0x00000001)        /*!< Bit 0 */
-#define  RCC_CFGR_SW_1                       ((uint32_t)0x00000002)        /*!< Bit 1 */
-
-#define  RCC_CFGR_SW_HSI                     ((uint32_t)0x00000000)        /*!< HSI selected as system clock */
-#define  RCC_CFGR_SW_HSE                     ((uint32_t)0x00000001)        /*!< HSE selected as system clock */
-#define  RCC_CFGR_SW_PLL                     ((uint32_t)0x00000002)        /*!< PLL selected as system clock */
-
-/*!< SWS configuration */
-#define  RCC_CFGR_SWS                        ((uint32_t)0x0000000C)        /*!< SWS[1:0] bits (System Clock Switch Status) */
-#define  RCC_CFGR_SWS_0                      ((uint32_t)0x00000004)        /*!< Bit 0 */
-#define  RCC_CFGR_SWS_1                      ((uint32_t)0x00000008)        /*!< Bit 1 */
-
-#define  RCC_CFGR_SWS_HSI                    ((uint32_t)0x00000000)        /*!< HSI oscillator used as system clock */
-#define  RCC_CFGR_SWS_HSE                    ((uint32_t)0x00000004)        /*!< HSE oscillator used as system clock */
-#define  RCC_CFGR_SWS_PLL                    ((uint32_t)0x00000008)        /*!< PLL used as system clock */
-
-/*!< HPRE configuration */
-#define  RCC_CFGR_HPRE                       ((uint32_t)0x000000F0)        /*!< HPRE[3:0] bits (AHB prescaler) */
-#define  RCC_CFGR_HPRE_0                     ((uint32_t)0x00000010)        /*!< Bit 0 */
-#define  RCC_CFGR_HPRE_1                     ((uint32_t)0x00000020)        /*!< Bit 1 */
-#define  RCC_CFGR_HPRE_2                     ((uint32_t)0x00000040)        /*!< Bit 2 */
-#define  RCC_CFGR_HPRE_3                     ((uint32_t)0x00000080)        /*!< Bit 3 */
-
-#define  RCC_CFGR_HPRE_DIV1                  ((uint32_t)0x00000000)        /*!< SYSCLK not divided */
-#define  RCC_CFGR_HPRE_DIV2                  ((uint32_t)0x00000080)        /*!< SYSCLK divided by 2 */
-#define  RCC_CFGR_HPRE_DIV4                  ((uint32_t)0x00000090)        /*!< SYSCLK divided by 4 */
-#define  RCC_CFGR_HPRE_DIV8                  ((uint32_t)0x000000A0)        /*!< SYSCLK divided by 8 */
-#define  RCC_CFGR_HPRE_DIV16                 ((uint32_t)0x000000B0)        /*!< SYSCLK divided by 16 */
-#define  RCC_CFGR_HPRE_DIV64                 ((uint32_t)0x000000C0)        /*!< SYSCLK divided by 64 */
-#define  RCC_CFGR_HPRE_DIV128                ((uint32_t)0x000000D0)        /*!< SYSCLK divided by 128 */
-#define  RCC_CFGR_HPRE_DIV256                ((uint32_t)0x000000E0)        /*!< SYSCLK divided by 256 */
-#define  RCC_CFGR_HPRE_DIV512                ((uint32_t)0x000000F0)        /*!< SYSCLK divided by 512 */
-
-/*!< PPRE1 configuration */
-#define  RCC_CFGR_PPRE1                      ((uint32_t)0x00001C00)        /*!< PRE1[2:0] bits (APB1 prescaler) */
-#define  RCC_CFGR_PPRE1_0                    ((uint32_t)0x00000400)        /*!< Bit 0 */
-#define  RCC_CFGR_PPRE1_1                    ((uint32_t)0x00000800)        /*!< Bit 1 */
-#define  RCC_CFGR_PPRE1_2                    ((uint32_t)0x00001000)        /*!< Bit 2 */
-
-#define  RCC_CFGR_PPRE1_DIV1                 ((uint32_t)0x00000000)        /*!< HCLK not divided */
-#define  RCC_CFGR_PPRE1_DIV2                 ((uint32_t)0x00001000)        /*!< HCLK divided by 2 */
-#define  RCC_CFGR_PPRE1_DIV4                 ((uint32_t)0x00001400)        /*!< HCLK divided by 4 */
-#define  RCC_CFGR_PPRE1_DIV8                 ((uint32_t)0x00001800)        /*!< HCLK divided by 8 */
-#define  RCC_CFGR_PPRE1_DIV16                ((uint32_t)0x00001C00)        /*!< HCLK divided by 16 */
-
-/*!< PPRE2 configuration */
-#define  RCC_CFGR_PPRE2                      ((uint32_t)0x0000E000)        /*!< PRE2[2:0] bits (APB2 prescaler) */
-#define  RCC_CFGR_PPRE2_0                    ((uint32_t)0x00002000)        /*!< Bit 0 */
-#define  RCC_CFGR_PPRE2_1                    ((uint32_t)0x00004000)        /*!< Bit 1 */
-#define  RCC_CFGR_PPRE2_2                    ((uint32_t)0x00008000)        /*!< Bit 2 */
-
-#define  RCC_CFGR_PPRE2_DIV1                 ((uint32_t)0x00000000)        /*!< HCLK not divided */
-#define  RCC_CFGR_PPRE2_DIV2                 ((uint32_t)0x00008000)        /*!< HCLK divided by 2 */
-#define  RCC_CFGR_PPRE2_DIV4                 ((uint32_t)0x0000A000)        /*!< HCLK divided by 4 */
-#define  RCC_CFGR_PPRE2_DIV8                 ((uint32_t)0x0000C000)        /*!< HCLK divided by 8 */
-#define  RCC_CFGR_PPRE2_DIV16                ((uint32_t)0x0000E000)        /*!< HCLK divided by 16 */
-
-/*!< RTCPRE configuration */
-#define  RCC_CFGR_RTCPRE                     ((uint32_t)0x001F0000)
-#define  RCC_CFGR_RTCPRE_0                   ((uint32_t)0x00010000)
-#define  RCC_CFGR_RTCPRE_1                   ((uint32_t)0x00020000)
-#define  RCC_CFGR_RTCPRE_2                   ((uint32_t)0x00040000)
-#define  RCC_CFGR_RTCPRE_3                   ((uint32_t)0x00080000)
-#define  RCC_CFGR_RTCPRE_4                   ((uint32_t)0x00100000)
-
-/*!< MCO1 configuration */
-#define  RCC_CFGR_MCO1                       ((uint32_t)0x00600000)
-#define  RCC_CFGR_MCO1_0                     ((uint32_t)0x00200000)
-#define  RCC_CFGR_MCO1_1                     ((uint32_t)0x00400000)
-
-#define  RCC_CFGR_I2SSRC                     ((uint32_t)0x00800000)
-
-#define  RCC_CFGR_MCO1PRE                    ((uint32_t)0x07000000)
-#define  RCC_CFGR_MCO1PRE_0                  ((uint32_t)0x01000000)
-#define  RCC_CFGR_MCO1PRE_1                  ((uint32_t)0x02000000)
-#define  RCC_CFGR_MCO1PRE_2                  ((uint32_t)0x04000000)
-
-#define  RCC_CFGR_MCO2PRE                    ((uint32_t)0x38000000)
-#define  RCC_CFGR_MCO2PRE_0                  ((uint32_t)0x08000000)
-#define  RCC_CFGR_MCO2PRE_1                  ((uint32_t)0x10000000)
-#define  RCC_CFGR_MCO2PRE_2                  ((uint32_t)0x20000000)
-
-#define  RCC_CFGR_MCO2                       ((uint32_t)0xC0000000)
-#define  RCC_CFGR_MCO2_0                     ((uint32_t)0x40000000)
-#define  RCC_CFGR_MCO2_1                     ((uint32_t)0x80000000)
-
-/********************  Bit definition for RCC_CIR register  *******************/
-#define  RCC_CIR_LSIRDYF                     ((uint32_t)0x00000001)
-#define  RCC_CIR_LSERDYF                     ((uint32_t)0x00000002)
-#define  RCC_CIR_HSIRDYF                     ((uint32_t)0x00000004)
-#define  RCC_CIR_HSERDYF                     ((uint32_t)0x00000008)
-#define  RCC_CIR_PLLRDYF                     ((uint32_t)0x00000010)
-#define  RCC_CIR_PLLI2SRDYF                  ((uint32_t)0x00000020)
-#define  RCC_CIR_CSSF                        ((uint32_t)0x00000080)
-#define  RCC_CIR_LSIRDYIE                    ((uint32_t)0x00000100)
-#define  RCC_CIR_LSERDYIE                    ((uint32_t)0x00000200)
-#define  RCC_CIR_HSIRDYIE                    ((uint32_t)0x00000400)
-#define  RCC_CIR_HSERDYIE                    ((uint32_t)0x00000800)
-#define  RCC_CIR_PLLRDYIE                    ((uint32_t)0x00001000)
-#define  RCC_CIR_PLLI2SRDYIE                 ((uint32_t)0x00002000)
-#define  RCC_CIR_LSIRDYC                     ((uint32_t)0x00010000)
-#define  RCC_CIR_LSERDYC                     ((uint32_t)0x00020000)
-#define  RCC_CIR_HSIRDYC                     ((uint32_t)0x00040000)
-#define  RCC_CIR_HSERDYC                     ((uint32_t)0x00080000)
-#define  RCC_CIR_PLLRDYC                     ((uint32_t)0x00100000)
-#define  RCC_CIR_PLLI2SRDYC                  ((uint32_t)0x00200000)
-#define  RCC_CIR_CSSC                        ((uint32_t)0x00800000)
-
-/********************  Bit definition for RCC_AHB1RSTR register  **************/
-#define  RCC_AHB1RSTR_GPIOARST               ((uint32_t)0x00000001)
-#define  RCC_AHB1RSTR_GPIOBRST               ((uint32_t)0x00000002)
-#define  RCC_AHB1RSTR_GPIOCRST               ((uint32_t)0x00000004)
-#define  RCC_AHB1RSTR_GPIODRST               ((uint32_t)0x00000008)
-#define  RCC_AHB1RSTR_GPIOERST               ((uint32_t)0x00000010)
-#define  RCC_AHB1RSTR_GPIOFRST               ((uint32_t)0x00000020)
-#define  RCC_AHB1RSTR_GPIOGRST               ((uint32_t)0x00000040)
-#define  RCC_AHB1RSTR_GPIOHRST               ((uint32_t)0x00000080)
-#define  RCC_AHB1RSTR_GPIOIRST               ((uint32_t)0x00000100)
-#define  RCC_AHB1RSTR_CRCRST                 ((uint32_t)0x00001000)
-#define  RCC_AHB1RSTR_DMA1RST                ((uint32_t)0x00200000)
-#define  RCC_AHB1RSTR_DMA2RST                ((uint32_t)0x00400000)
-#define  RCC_AHB1RSTR_ETHMACRST              ((uint32_t)0x02000000)
-#define  RCC_AHB1RSTR_OTGHRST                ((uint32_t)0x10000000)
-
-/********************  Bit definition for RCC_AHB2RSTR register  **************/
-#define  RCC_AHB2RSTR_DCMIRST                ((uint32_t)0x00000001)
-#define  RCC_AHB2RSTR_CRYPRST                ((uint32_t)0x00000010)
-#define  RCC_AHB2RSTR_HASHRST                ((uint32_t)0x00000020)
- /* maintained for legacy purpose */
- #define  RCC_AHB2RSTR_HSAHRST                RCC_AHB2RSTR_HASHRST
-#define  RCC_AHB2RSTR_RNGRST                 ((uint32_t)0x00000040)
-#define  RCC_AHB2RSTR_OTGFSRST               ((uint32_t)0x00000080)
-
-/********************  Bit definition for RCC_AHB3RSTR register  **************/
-#define  RCC_AHB3RSTR_FSMCRST                ((uint32_t)0x00000001)
-
-/********************  Bit definition for RCC_APB1RSTR register  **************/
-#define  RCC_APB1RSTR_TIM2RST                ((uint32_t)0x00000001)
-#define  RCC_APB1RSTR_TIM3RST                ((uint32_t)0x00000002)
-#define  RCC_APB1RSTR_TIM4RST                ((uint32_t)0x00000004)
-#define  RCC_APB1RSTR_TIM5RST                ((uint32_t)0x00000008)
-#define  RCC_APB1RSTR_TIM6RST                ((uint32_t)0x00000010)
-#define  RCC_APB1RSTR_TIM7RST                ((uint32_t)0x00000020)
-#define  RCC_APB1RSTR_TIM12RST               ((uint32_t)0x00000040)
-#define  RCC_APB1RSTR_TIM13RST               ((uint32_t)0x00000080)
-#define  RCC_APB1RSTR_TIM14RST               ((uint32_t)0x00000100)
-#define  RCC_APB1RSTR_WWDGRST                ((uint32_t)0x00000800)
-#define  RCC_APB1RSTR_SPI2RST                ((uint32_t)0x00004000)
-#define  RCC_APB1RSTR_SPI3RST                ((uint32_t)0x00008000)
-#define  RCC_APB1RSTR_USART2RST              ((uint32_t)0x00020000)
-#define  RCC_APB1RSTR_USART3RST              ((uint32_t)0x00040000)
-#define  RCC_APB1RSTR_UART4RST               ((uint32_t)0x00080000)
-#define  RCC_APB1RSTR_UART5RST               ((uint32_t)0x00100000)
-#define  RCC_APB1RSTR_I2C1RST                ((uint32_t)0x00200000)
-#define  RCC_APB1RSTR_I2C2RST                ((uint32_t)0x00400000)
-#define  RCC_APB1RSTR_I2C3RST                ((uint32_t)0x00800000)
-#define  RCC_APB1RSTR_CAN1RST                ((uint32_t)0x02000000)
-#define  RCC_APB1RSTR_CAN2RST                ((uint32_t)0x04000000)
-#define  RCC_APB1RSTR_PWRRST                 ((uint32_t)0x10000000)
-#define  RCC_APB1RSTR_DACRST                 ((uint32_t)0x20000000)
-#define  RCC_APB1RSTR_UART7RST               ((uint32_t)0x40000000)
-#define  RCC_APB1RSTR_UART8RST               ((uint32_t)0x80000000)
-
-/********************  Bit definition for RCC_APB2RSTR register  **************/
-#define  RCC_APB2RSTR_TIM1RST                ((uint32_t)0x00000001)
-#define  RCC_APB2RSTR_TIM8RST                ((uint32_t)0x00000002)
-#define  RCC_APB2RSTR_USART1RST              ((uint32_t)0x00000010)
-#define  RCC_APB2RSTR_USART6RST              ((uint32_t)0x00000020)
-#define  RCC_APB2RSTR_ADCRST                 ((uint32_t)0x00000100)
-#define  RCC_APB2RSTR_SDIORST                ((uint32_t)0x00000800)
-#define  RCC_APB2RSTR_SPI1RST                ((uint32_t)0x00001000)
-#define  RCC_APB2RSTR_SPI4RST                ((uint32_t)0x00002000)
-#define  RCC_APB2RSTR_SYSCFGRST              ((uint32_t)0x00004000)
-#define  RCC_APB2RSTR_TIM9RST                ((uint32_t)0x00010000)
-#define  RCC_APB2RSTR_TIM10RST               ((uint32_t)0x00020000)
-#define  RCC_APB2RSTR_TIM11RST               ((uint32_t)0x00040000)
-#define  RCC_APB2RSTR_SPI5RST                ((uint32_t)0x00100000)
-#define  RCC_APB2RSTR_SPI6RST                ((uint32_t)0x00200000)
-
-/* Old SPI1RST bit definition, maintained for legacy purpose */
-#define  RCC_APB2RSTR_SPI1                   RCC_APB2RSTR_SPI1RST
-
-/********************  Bit definition for RCC_AHB1ENR register  ***************/
-#define  RCC_AHB1ENR_GPIOAEN                 ((uint32_t)0x00000001)
-#define  RCC_AHB1ENR_GPIOBEN                 ((uint32_t)0x00000002)
-#define  RCC_AHB1ENR_GPIOCEN                 ((uint32_t)0x00000004)
-#define  RCC_AHB1ENR_GPIODEN                 ((uint32_t)0x00000008)
-#define  RCC_AHB1ENR_GPIOEEN                 ((uint32_t)0x00000010)
-#define  RCC_AHB1ENR_GPIOFEN                 ((uint32_t)0x00000020)
-#define  RCC_AHB1ENR_GPIOGEN                 ((uint32_t)0x00000040)
-#define  RCC_AHB1ENR_GPIOHEN                 ((uint32_t)0x00000080)
-#define  RCC_AHB1ENR_GPIOIEN                 ((uint32_t)0x00000100)
-#define  RCC_AHB1ENR_CRCEN                   ((uint32_t)0x00001000)
-#define  RCC_AHB1ENR_BKPSRAMEN               ((uint32_t)0x00040000)
-#define  RCC_AHB1ENR_CCMDATARAMEN            ((uint32_t)0x00100000)
-#define  RCC_AHB1ENR_DMA1EN                  ((uint32_t)0x00200000)
-#define  RCC_AHB1ENR_DMA2EN                  ((uint32_t)0x00400000)
-#define  RCC_AHB1ENR_ETHMACEN                ((uint32_t)0x02000000)
-#define  RCC_AHB1ENR_ETHMACTXEN              ((uint32_t)0x04000000)
-#define  RCC_AHB1ENR_ETHMACRXEN              ((uint32_t)0x08000000)
-#define  RCC_AHB1ENR_ETHMACPTPEN             ((uint32_t)0x10000000)
-#define  RCC_AHB1ENR_OTGHSEN                 ((uint32_t)0x20000000)
-#define  RCC_AHB1ENR_OTGHSULPIEN             ((uint32_t)0x40000000)
-
-/********************  Bit definition for RCC_AHB2ENR register  ***************/
-#define  RCC_AHB2ENR_DCMIEN                  ((uint32_t)0x00000001)
-#define  RCC_AHB2ENR_CRYPEN                  ((uint32_t)0x00000010)
-#define  RCC_AHB2ENR_HASHEN                  ((uint32_t)0x00000020)
-#define  RCC_AHB2ENR_RNGEN                   ((uint32_t)0x00000040)
-#define  RCC_AHB2ENR_OTGFSEN                 ((uint32_t)0x00000080)
-
-/********************  Bit definition for RCC_AHB3ENR register  ***************/
-#define  RCC_AHB3ENR_FSMCEN                  ((uint32_t)0x00000001)
-
-/********************  Bit definition for RCC_APB1ENR register  ***************/
-#define  RCC_APB1ENR_TIM2EN                  ((uint32_t)0x00000001)
-#define  RCC_APB1ENR_TIM3EN                  ((uint32_t)0x00000002)
-#define  RCC_APB1ENR_TIM4EN                  ((uint32_t)0x00000004)
-#define  RCC_APB1ENR_TIM5EN                  ((uint32_t)0x00000008)
-#define  RCC_APB1ENR_TIM6EN                  ((uint32_t)0x00000010)
-#define  RCC_APB1ENR_TIM7EN                  ((uint32_t)0x00000020)
-#define  RCC_APB1ENR_TIM12EN                 ((uint32_t)0x00000040)
-#define  RCC_APB1ENR_TIM13EN                 ((uint32_t)0x00000080)
-#define  RCC_APB1ENR_TIM14EN                 ((uint32_t)0x00000100)
-#define  RCC_APB1ENR_WWDGEN                  ((uint32_t)0x00000800)
-#define  RCC_APB1ENR_SPI2EN                  ((uint32_t)0x00004000)
-#define  RCC_APB1ENR_SPI3EN                  ((uint32_t)0x00008000)
-#define  RCC_APB1ENR_USART2EN                ((uint32_t)0x00020000)
-#define  RCC_APB1ENR_USART3EN                ((uint32_t)0x00040000)
-#define  RCC_APB1ENR_UART4EN                 ((uint32_t)0x00080000)
-#define  RCC_APB1ENR_UART5EN                 ((uint32_t)0x00100000)
-#define  RCC_APB1ENR_I2C1EN                  ((uint32_t)0x00200000)
-#define  RCC_APB1ENR_I2C2EN                  ((uint32_t)0x00400000)
-#define  RCC_APB1ENR_I2C3EN                  ((uint32_t)0x00800000)
-#define  RCC_APB1ENR_CAN1EN                  ((uint32_t)0x02000000)
-#define  RCC_APB1ENR_CAN2EN                  ((uint32_t)0x04000000)
-#define  RCC_APB1ENR_PWREN                   ((uint32_t)0x10000000)
-#define  RCC_APB1ENR_DACEN                   ((uint32_t)0x20000000)
-#define  RCC_APB1ENR_UART7EN                 ((uint32_t)0x40000000)
-#define  RCC_APB1ENR_UART8EN                 ((uint32_t)0x80000000)
-
-/********************  Bit definition for RCC_APB2ENR register  ***************/
-#define  RCC_APB2ENR_TIM1EN                  ((uint32_t)0x00000001)
-#define  RCC_APB2ENR_TIM8EN                  ((uint32_t)0x00000002)
-#define  RCC_APB2ENR_USART1EN                ((uint32_t)0x00000010)
-#define  RCC_APB2ENR_USART6EN                ((uint32_t)0x00000020)
-#define  RCC_APB2ENR_ADC1EN                  ((uint32_t)0x00000100)
-#define  RCC_APB2ENR_ADC2EN                  ((uint32_t)0x00000200)
-#define  RCC_APB2ENR_ADC3EN                  ((uint32_t)0x00000400)
-#define  RCC_APB2ENR_SDIOEN                  ((uint32_t)0x00000800)
-#define  RCC_APB2ENR_SPI1EN                  ((uint32_t)0x00001000)
-#define  RCC_APB2ENR_SPI4EN                  ((uint32_t)0x00002000)
-#define  RCC_APB2ENR_SYSCFGEN                ((uint32_t)0x00004000)
-#define  RCC_APB2ENR_TIM9EN                  ((uint32_t)0x00010000)
-#define  RCC_APB2ENR_TIM10EN                 ((uint32_t)0x00020000)
-#define  RCC_APB2ENR_TIM11EN                 ((uint32_t)0x00040000)
-#define  RCC_APB2ENR_SPI5EN                  ((uint32_t)0x00100000)
-#define  RCC_APB2ENR_SPI6EN                  ((uint32_t)0x00200000)
-
-/********************  Bit definition for RCC_AHB1LPENR register  *************/
-#define  RCC_AHB1LPENR_GPIOALPEN             ((uint32_t)0x00000001)
-#define  RCC_AHB1LPENR_GPIOBLPEN             ((uint32_t)0x00000002)
-#define  RCC_AHB1LPENR_GPIOCLPEN             ((uint32_t)0x00000004)
-#define  RCC_AHB1LPENR_GPIODLPEN             ((uint32_t)0x00000008)
-#define  RCC_AHB1LPENR_GPIOELPEN             ((uint32_t)0x00000010)
-#define  RCC_AHB1LPENR_GPIOFLPEN             ((uint32_t)0x00000020)
-#define  RCC_AHB1LPENR_GPIOGLPEN             ((uint32_t)0x00000040)
-#define  RCC_AHB1LPENR_GPIOHLPEN             ((uint32_t)0x00000080)
-#define  RCC_AHB1LPENR_GPIOILPEN             ((uint32_t)0x00000100)
-#define  RCC_AHB1LPENR_CRCLPEN               ((uint32_t)0x00001000)
-#define  RCC_AHB1LPENR_FLITFLPEN             ((uint32_t)0x00008000)
-#define  RCC_AHB1LPENR_SRAM1LPEN             ((uint32_t)0x00010000)
-#define  RCC_AHB1LPENR_SRAM2LPEN             ((uint32_t)0x00020000)
-#define  RCC_AHB1LPENR_BKPSRAMLPEN           ((uint32_t)0x00040000)
-#define  RCC_AHB1LPENR_SRAM3LPEN             ((uint32_t)0x00080000)
-#define  RCC_AHB1LPENR_DMA1LPEN              ((uint32_t)0x00200000)
-#define  RCC_AHB1LPENR_DMA2LPEN              ((uint32_t)0x00400000)
-#define  RCC_AHB1LPENR_ETHMACLPEN            ((uint32_t)0x02000000)
-#define  RCC_AHB1LPENR_ETHMACTXLPEN          ((uint32_t)0x04000000)
-#define  RCC_AHB1LPENR_ETHMACRXLPEN          ((uint32_t)0x08000000)
-#define  RCC_AHB1LPENR_ETHMACPTPLPEN         ((uint32_t)0x10000000)
-#define  RCC_AHB1LPENR_OTGHSLPEN             ((uint32_t)0x20000000)
-#define  RCC_AHB1LPENR_OTGHSULPILPEN         ((uint32_t)0x40000000)
-
-/********************  Bit definition for RCC_AHB2LPENR register  *************/
-#define  RCC_AHB2LPENR_DCMILPEN              ((uint32_t)0x00000001)
-#define  RCC_AHB2LPENR_CRYPLPEN              ((uint32_t)0x00000010)
-#define  RCC_AHB2LPENR_HASHLPEN              ((uint32_t)0x00000020)
-#define  RCC_AHB2LPENR_RNGLPEN               ((uint32_t)0x00000040)
-#define  RCC_AHB2LPENR_OTGFSLPEN             ((uint32_t)0x00000080)
-
-/********************  Bit definition for RCC_AHB3LPENR register  *************/
-#define  RCC_AHB3LPENR_FSMCLPEN              ((uint32_t)0x00000001)
-
-/********************  Bit definition for RCC_APB1LPENR register  *************/
-#define  RCC_APB1LPENR_TIM2LPEN              ((uint32_t)0x00000001)
-#define  RCC_APB1LPENR_TIM3LPEN              ((uint32_t)0x00000002)
-#define  RCC_APB1LPENR_TIM4LPEN              ((uint32_t)0x00000004)
-#define  RCC_APB1LPENR_TIM5LPEN              ((uint32_t)0x00000008)
-#define  RCC_APB1LPENR_TIM6LPEN              ((uint32_t)0x00000010)
-#define  RCC_APB1LPENR_TIM7LPEN              ((uint32_t)0x00000020)
-#define  RCC_APB1LPENR_TIM12LPEN             ((uint32_t)0x00000040)
-#define  RCC_APB1LPENR_TIM13LPEN             ((uint32_t)0x00000080)
-#define  RCC_APB1LPENR_TIM14LPEN             ((uint32_t)0x00000100)
-#define  RCC_APB1LPENR_WWDGLPEN              ((uint32_t)0x00000800)
-#define  RCC_APB1LPENR_SPI2LPEN              ((uint32_t)0x00004000)
-#define  RCC_APB1LPENR_SPI3LPEN              ((uint32_t)0x00008000)
-#define  RCC_APB1LPENR_USART2LPEN            ((uint32_t)0x00020000)
-#define  RCC_APB1LPENR_USART3LPEN            ((uint32_t)0x00040000)
-#define  RCC_APB1LPENR_UART4LPEN             ((uint32_t)0x00080000)
-#define  RCC_APB1LPENR_UART5LPEN             ((uint32_t)0x00100000)
-#define  RCC_APB1LPENR_I2C1LPEN              ((uint32_t)0x00200000)
-#define  RCC_APB1LPENR_I2C2LPEN              ((uint32_t)0x00400000)
-#define  RCC_APB1LPENR_I2C3LPEN              ((uint32_t)0x00800000)
-#define  RCC_APB1LPENR_CAN1LPEN              ((uint32_t)0x02000000)
-#define  RCC_APB1LPENR_CAN2LPEN              ((uint32_t)0x04000000)
-#define  RCC_APB1LPENR_PWRLPEN               ((uint32_t)0x10000000)
-#define  RCC_APB1LPENR_DACLPEN               ((uint32_t)0x20000000)
-#define  RCC_APB1LPENR_UART7LPEN             ((uint32_t)0x40000000)
-#define  RCC_APB1LPENR_UART8LPEN             ((uint32_t)0x80000000)
-
-/********************  Bit definition for RCC_APB2LPENR register  *************/
-#define  RCC_APB2LPENR_TIM1LPEN              ((uint32_t)0x00000001)
-#define  RCC_APB2LPENR_TIM8LPEN              ((uint32_t)0x00000002)
-#define  RCC_APB2LPENR_USART1LPEN            ((uint32_t)0x00000010)
-#define  RCC_APB2LPENR_USART6LPEN            ((uint32_t)0x00000020)
-#define  RCC_APB2LPENR_ADC1LPEN              ((uint32_t)0x00000100)
-#define  RCC_APB2LPENR_ADC2PEN               ((uint32_t)0x00000200)
-#define  RCC_APB2LPENR_ADC3LPEN              ((uint32_t)0x00000400)
-#define  RCC_APB2LPENR_SDIOLPEN              ((uint32_t)0x00000800)
-#define  RCC_APB2LPENR_SPI1LPEN              ((uint32_t)0x00001000)
-#define  RCC_APB2LPENR_SPI4LPEN              ((uint32_t)0x00002000)
-#define  RCC_APB2LPENR_SYSCFGLPEN            ((uint32_t)0x00004000)
-#define  RCC_APB2LPENR_TIM9LPEN              ((uint32_t)0x00010000)
-#define  RCC_APB2LPENR_TIM10LPEN             ((uint32_t)0x00020000)
-#define  RCC_APB2LPENR_TIM11LPEN             ((uint32_t)0x00040000)
-#define  RCC_APB2LPENR_SPI5LPEN              ((uint32_t)0x00100000)
-#define  RCC_APB2LPENR_SPI6LPEN              ((uint32_t)0x00200000)
-
-/********************  Bit definition for RCC_BDCR register  ******************/
-#define  RCC_BDCR_LSEON                      ((uint32_t)0x00000001)
-#define  RCC_BDCR_LSERDY                     ((uint32_t)0x00000002)
-#define  RCC_BDCR_LSEBYP                     ((uint32_t)0x00000004)
-
-#define  RCC_BDCR_RTCSEL                    ((uint32_t)0x00000300)
-#define  RCC_BDCR_RTCSEL_0                  ((uint32_t)0x00000100)
-#define  RCC_BDCR_RTCSEL_1                  ((uint32_t)0x00000200)
-
-#define  RCC_BDCR_RTCEN                      ((uint32_t)0x00008000)
-#define  RCC_BDCR_BDRST                      ((uint32_t)0x00010000)
-
-/********************  Bit definition for RCC_CSR register  *******************/
-#define  RCC_CSR_LSION                       ((uint32_t)0x00000001)
-#define  RCC_CSR_LSIRDY                      ((uint32_t)0x00000002)
-#define  RCC_CSR_RMVF                        ((uint32_t)0x01000000)
-#define  RCC_CSR_BORRSTF                     ((uint32_t)0x02000000)
-#define  RCC_CSR_PADRSTF                     ((uint32_t)0x04000000)
-#define  RCC_CSR_PORRSTF                     ((uint32_t)0x08000000)
-#define  RCC_CSR_SFTRSTF                     ((uint32_t)0x10000000)
-#define  RCC_CSR_WDGRSTF                     ((uint32_t)0x20000000)
-#define  RCC_CSR_WWDGRSTF                    ((uint32_t)0x40000000)
-#define  RCC_CSR_LPWRRSTF                    ((uint32_t)0x80000000)
-
-/********************  Bit definition for RCC_SSCGR register  *****************/
-#define  RCC_SSCGR_MODPER                    ((uint32_t)0x00001FFF)
-#define  RCC_SSCGR_INCSTEP                   ((uint32_t)0x0FFFE000)
-#define  RCC_SSCGR_SPREADSEL                 ((uint32_t)0x40000000)
-#define  RCC_SSCGR_SSCGEN                    ((uint32_t)0x80000000)
-
-/********************  Bit definition for RCC_PLLI2SCFGR register  ************/
-#define  RCC_PLLI2SCFGR_PLLI2SN              ((uint32_t)0x00007FC0)
-#define  RCC_PLLI2SCFGR_PLLI2SR              ((uint32_t)0x70000000)
-
-/********************  Bit definition for RCC_DCKCFGR register  ***************/
-#define  RCC_DCKCFGR_TIMPRE                  ((uint32_t)0x01000000)
-
-
-/******************************************************************************/
-/*                                                                            */
-/*                                    RNG                                     */
-/*                                                                            */
-/******************************************************************************/
-/********************  Bits definition for RNG_CR register  *******************/
-#define RNG_CR_RNGEN                         ((uint32_t)0x00000004)
-#define RNG_CR_IE                            ((uint32_t)0x00000008)
-
-/********************  Bits definition for RNG_SR register  *******************/
-#define RNG_SR_DRDY                          ((uint32_t)0x00000001)
-#define RNG_SR_CECS                          ((uint32_t)0x00000002)
-#define RNG_SR_SECS                          ((uint32_t)0x00000004)
-#define RNG_SR_CEIS                          ((uint32_t)0x00000020)
-#define RNG_SR_SEIS                          ((uint32_t)0x00000040)
-
-/******************************************************************************/
-/*                                                                            */
-/*                           Real-Time Clock (RTC)                            */
-/*                                                                            */
-/******************************************************************************/
-/********************  Bits definition for RTC_TR register  *******************/
-#define RTC_TR_PM                            ((uint32_t)0x00400000)
-#define RTC_TR_HT                            ((uint32_t)0x00300000)
-#define RTC_TR_HT_0                          ((uint32_t)0x00100000)
-#define RTC_TR_HT_1                          ((uint32_t)0x00200000)
-#define RTC_TR_HU                            ((uint32_t)0x000F0000)
-#define RTC_TR_HU_0                          ((uint32_t)0x00010000)
-#define RTC_TR_HU_1                          ((uint32_t)0x00020000)
-#define RTC_TR_HU_2                          ((uint32_t)0x00040000)
-#define RTC_TR_HU_3                          ((uint32_t)0x00080000)
-#define RTC_TR_MNT                           ((uint32_t)0x00007000)
-#define RTC_TR_MNT_0                         ((uint32_t)0x00001000)
-#define RTC_TR_MNT_1                         ((uint32_t)0x00002000)
-#define RTC_TR_MNT_2                         ((uint32_t)0x00004000)
-#define RTC_TR_MNU                           ((uint32_t)0x00000F00)
-#define RTC_TR_MNU_0                         ((uint32_t)0x00000100)
-#define RTC_TR_MNU_1                         ((uint32_t)0x00000200)
-#define RTC_TR_MNU_2                         ((uint32_t)0x00000400)
-#define RTC_TR_MNU_3                         ((uint32_t)0x00000800)
-#define RTC_TR_ST                            ((uint32_t)0x00000070)
-#define RTC_TR_ST_0                          ((uint32_t)0x00000010)
-#define RTC_TR_ST_1                          ((uint32_t)0x00000020)
-#define RTC_TR_ST_2                          ((uint32_t)0x00000040)
-#define RTC_TR_SU                            ((uint32_t)0x0000000F)
-#define RTC_TR_SU_0                          ((uint32_t)0x00000001)
-#define RTC_TR_SU_1                          ((uint32_t)0x00000002)
-#define RTC_TR_SU_2                          ((uint32_t)0x00000004)
-#define RTC_TR_SU_3                          ((uint32_t)0x00000008)
-
-/********************  Bits definition for RTC_DR register  *******************/
-#define RTC_DR_YT                            ((uint32_t)0x00F00000)
-#define RTC_DR_YT_0                          ((uint32_t)0x00100000)
-#define RTC_DR_YT_1                          ((uint32_t)0x00200000)
-#define RTC_DR_YT_2                          ((uint32_t)0x00400000)
-#define RTC_DR_YT_3                          ((uint32_t)0x00800000)
-#define RTC_DR_YU                            ((uint32_t)0x000F0000)
-#define RTC_DR_YU_0                          ((uint32_t)0x00010000)
-#define RTC_DR_YU_1                          ((uint32_t)0x00020000)
-#define RTC_DR_YU_2                          ((uint32_t)0x00040000)
-#define RTC_DR_YU_3                          ((uint32_t)0x00080000)
-#define RTC_DR_WDU                           ((uint32_t)0x0000E000)
-#define RTC_DR_WDU_0                         ((uint32_t)0x00002000)
-#define RTC_DR_WDU_1                         ((uint32_t)0x00004000)
-#define RTC_DR_WDU_2                         ((uint32_t)0x00008000)
-#define RTC_DR_MT                            ((uint32_t)0x00001000)
-#define RTC_DR_MU                            ((uint32_t)0x00000F00)
-#define RTC_DR_MU_0                          ((uint32_t)0x00000100)
-#define RTC_DR_MU_1                          ((uint32_t)0x00000200)
-#define RTC_DR_MU_2                          ((uint32_t)0x00000400)
-#define RTC_DR_MU_3                          ((uint32_t)0x00000800)
-#define RTC_DR_DT                            ((uint32_t)0x00000030)
-#define RTC_DR_DT_0                          ((uint32_t)0x00000010)
-#define RTC_DR_DT_1                          ((uint32_t)0x00000020)
-#define RTC_DR_DU                            ((uint32_t)0x0000000F)
-#define RTC_DR_DU_0                          ((uint32_t)0x00000001)
-#define RTC_DR_DU_1                          ((uint32_t)0x00000002)
-#define RTC_DR_DU_2                          ((uint32_t)0x00000004)
-#define RTC_DR_DU_3                          ((uint32_t)0x00000008)
-
-/********************  Bits definition for RTC_CR register  *******************/
-#define RTC_CR_COE                           ((uint32_t)0x00800000)
-#define RTC_CR_OSEL                          ((uint32_t)0x00600000)
-#define RTC_CR_OSEL_0                        ((uint32_t)0x00200000)
-#define RTC_CR_OSEL_1                        ((uint32_t)0x00400000)
-#define RTC_CR_POL                           ((uint32_t)0x00100000)
-#define RTC_CR_COSEL                         ((uint32_t)0x00080000)
-#define RTC_CR_BCK                           ((uint32_t)0x00040000)
-#define RTC_CR_SUB1H                         ((uint32_t)0x00020000)
-#define RTC_CR_ADD1H                         ((uint32_t)0x00010000)
-#define RTC_CR_TSIE                          ((uint32_t)0x00008000)
-#define RTC_CR_WUTIE                         ((uint32_t)0x00004000)
-#define RTC_CR_ALRBIE                        ((uint32_t)0x00002000)
-#define RTC_CR_ALRAIE                        ((uint32_t)0x00001000)
-#define RTC_CR_TSE                           ((uint32_t)0x00000800)
-#define RTC_CR_WUTE                          ((uint32_t)0x00000400)
-#define RTC_CR_ALRBE                         ((uint32_t)0x00000200)
-#define RTC_CR_ALRAE                         ((uint32_t)0x00000100)
-#define RTC_CR_DCE                           ((uint32_t)0x00000080)
-#define RTC_CR_FMT                           ((uint32_t)0x00000040)
-#define RTC_CR_BYPSHAD                       ((uint32_t)0x00000020)
-#define RTC_CR_REFCKON                       ((uint32_t)0x00000010)
-#define RTC_CR_TSEDGE                        ((uint32_t)0x00000008)
-#define RTC_CR_WUCKSEL                       ((uint32_t)0x00000007)
-#define RTC_CR_WUCKSEL_0                     ((uint32_t)0x00000001)
-#define RTC_CR_WUCKSEL_1                     ((uint32_t)0x00000002)
-#define RTC_CR_WUCKSEL_2                     ((uint32_t)0x00000004)
-
-/********************  Bits definition for RTC_ISR register  ******************/
-#define RTC_ISR_RECALPF                      ((uint32_t)0x00010000)
-#define RTC_ISR_TAMP1F                       ((uint32_t)0x00002000)
-#define RTC_ISR_TSOVF                        ((uint32_t)0x00001000)
-#define RTC_ISR_TSF                          ((uint32_t)0x00000800)
-#define RTC_ISR_WUTF                         ((uint32_t)0x00000400)
-#define RTC_ISR_ALRBF                        ((uint32_t)0x00000200)
-#define RTC_ISR_ALRAF                        ((uint32_t)0x00000100)
-#define RTC_ISR_INIT                         ((uint32_t)0x00000080)
-#define RTC_ISR_INITF                        ((uint32_t)0x00000040)
-#define RTC_ISR_RSF                          ((uint32_t)0x00000020)
-#define RTC_ISR_INITS                        ((uint32_t)0x00000010)
-#define RTC_ISR_SHPF                         ((uint32_t)0x00000008)
-#define RTC_ISR_WUTWF                        ((uint32_t)0x00000004)
-#define RTC_ISR_ALRBWF                       ((uint32_t)0x00000002)
-#define RTC_ISR_ALRAWF                       ((uint32_t)0x00000001)
-
-/********************  Bits definition for RTC_PRER register  *****************/
-#define RTC_PRER_PREDIV_A                    ((uint32_t)0x007F0000)
-#define RTC_PRER_PREDIV_S                    ((uint32_t)0x00001FFF)
-
-/********************  Bits definition for RTC_WUTR register  *****************/
-#define RTC_WUTR_WUT                         ((uint32_t)0x0000FFFF)
-
-/********************  Bits definition for RTC_CALIBR register  ***************/
-#define RTC_CALIBR_DCS                       ((uint32_t)0x00000080)
-#define RTC_CALIBR_DC                        ((uint32_t)0x0000001F)
-
-/********************  Bits definition for RTC_ALRMAR register  ***************/
-#define RTC_ALRMAR_MSK4                      ((uint32_t)0x80000000)
-#define RTC_ALRMAR_WDSEL                     ((uint32_t)0x40000000)
-#define RTC_ALRMAR_DT                        ((uint32_t)0x30000000)
-#define RTC_ALRMAR_DT_0                      ((uint32_t)0x10000000)
-#define RTC_ALRMAR_DT_1                      ((uint32_t)0x20000000)
-#define RTC_ALRMAR_DU                        ((uint32_t)0x0F000000)
-#define RTC_ALRMAR_DU_0                      ((uint32_t)0x01000000)
-#define RTC_ALRMAR_DU_1                      ((uint32_t)0x02000000)
-#define RTC_ALRMAR_DU_2                      ((uint32_t)0x04000000)
-#define RTC_ALRMAR_DU_3                      ((uint32_t)0x08000000)
-#define RTC_ALRMAR_MSK3                      ((uint32_t)0x00800000)
-#define RTC_ALRMAR_PM                        ((uint32_t)0x00400000)
-#define RTC_ALRMAR_HT                        ((uint32_t)0x00300000)
-#define RTC_ALRMAR_HT_0                      ((uint32_t)0x00100000)
-#define RTC_ALRMAR_HT_1                      ((uint32_t)0x00200000)
-#define RTC_ALRMAR_HU                        ((uint32_t)0x000F0000)
-#define RTC_ALRMAR_HU_0                      ((uint32_t)0x00010000)
-#define RTC_ALRMAR_HU_1                      ((uint32_t)0x00020000)
-#define RTC_ALRMAR_HU_2                      ((uint32_t)0x00040000)
-#define RTC_ALRMAR_HU_3                      ((uint32_t)0x00080000)
-#define RTC_ALRMAR_MSK2                      ((uint32_t)0x00008000)
-#define RTC_ALRMAR_MNT                       ((uint32_t)0x00007000)
-#define RTC_ALRMAR_MNT_0                     ((uint32_t)0x00001000)
-#define RTC_ALRMAR_MNT_1                     ((uint32_t)0x00002000)
-#define RTC_ALRMAR_MNT_2                     ((uint32_t)0x00004000)
-#define RTC_ALRMAR_MNU                       ((uint32_t)0x00000F00)
-#define RTC_ALRMAR_MNU_0                     ((uint32_t)0x00000100)
-#define RTC_ALRMAR_MNU_1                     ((uint32_t)0x00000200)
-#define RTC_ALRMAR_MNU_2                     ((uint32_t)0x00000400)
-#define RTC_ALRMAR_MNU_3                     ((uint32_t)0x00000800)
-#define RTC_ALRMAR_MSK1                      ((uint32_t)0x00000080)
-#define RTC_ALRMAR_ST                        ((uint32_t)0x00000070)
-#define RTC_ALRMAR_ST_0                      ((uint32_t)0x00000010)
-#define RTC_ALRMAR_ST_1                      ((uint32_t)0x00000020)
-#define RTC_ALRMAR_ST_2                      ((uint32_t)0x00000040)
-#define RTC_ALRMAR_SU                        ((uint32_t)0x0000000F)
-#define RTC_ALRMAR_SU_0                      ((uint32_t)0x00000001)
-#define RTC_ALRMAR_SU_1                      ((uint32_t)0x00000002)
-#define RTC_ALRMAR_SU_2                      ((uint32_t)0x00000004)
-#define RTC_ALRMAR_SU_3                      ((uint32_t)0x00000008)
-
-/********************  Bits definition for RTC_ALRMBR register  ***************/
-#define RTC_ALRMBR_MSK4                      ((uint32_t)0x80000000)
-#define RTC_ALRMBR_WDSEL                     ((uint32_t)0x40000000)
-#define RTC_ALRMBR_DT                        ((uint32_t)0x30000000)
-#define RTC_ALRMBR_DT_0                      ((uint32_t)0x10000000)
-#define RTC_ALRMBR_DT_1                      ((uint32_t)0x20000000)
-#define RTC_ALRMBR_DU                        ((uint32_t)0x0F000000)
-#define RTC_ALRMBR_DU_0                      ((uint32_t)0x01000000)
-#define RTC_ALRMBR_DU_1                      ((uint32_t)0x02000000)
-#define RTC_ALRMBR_DU_2                      ((uint32_t)0x04000000)
-#define RTC_ALRMBR_DU_3                      ((uint32_t)0x08000000)
-#define RTC_ALRMBR_MSK3                      ((uint32_t)0x00800000)
-#define RTC_ALRMBR_PM                        ((uint32_t)0x00400000)
-#define RTC_ALRMBR_HT                        ((uint32_t)0x00300000)
-#define RTC_ALRMBR_HT_0                      ((uint32_t)0x00100000)
-#define RTC_ALRMBR_HT_1                      ((uint32_t)0x00200000)
-#define RTC_ALRMBR_HU                        ((uint32_t)0x000F0000)
-#define RTC_ALRMBR_HU_0                      ((uint32_t)0x00010000)
-#define RTC_ALRMBR_HU_1                      ((uint32_t)0x00020000)
-#define RTC_ALRMBR_HU_2                      ((uint32_t)0x00040000)
-#define RTC_ALRMBR_HU_3                      ((uint32_t)0x00080000)
-#define RTC_ALRMBR_MSK2                      ((uint32_t)0x00008000)
-#define RTC_ALRMBR_MNT                       ((uint32_t)0x00007000)
-#define RTC_ALRMBR_MNT_0                     ((uint32_t)0x00001000)
-#define RTC_ALRMBR_MNT_1                     ((uint32_t)0x00002000)
-#define RTC_ALRMBR_MNT_2                     ((uint32_t)0x00004000)
-#define RTC_ALRMBR_MNU                       ((uint32_t)0x00000F00)
-#define RTC_ALRMBR_MNU_0                     ((uint32_t)0x00000100)
-#define RTC_ALRMBR_MNU_1                     ((uint32_t)0x00000200)
-#define RTC_ALRMBR_MNU_2                     ((uint32_t)0x00000400)
-#define RTC_ALRMBR_MNU_3                     ((uint32_t)0x00000800)
-#define RTC_ALRMBR_MSK1                      ((uint32_t)0x00000080)
-#define RTC_ALRMBR_ST                        ((uint32_t)0x00000070)
-#define RTC_ALRMBR_ST_0                      ((uint32_t)0x00000010)
-#define RTC_ALRMBR_ST_1                      ((uint32_t)0x00000020)
-#define RTC_ALRMBR_ST_2                      ((uint32_t)0x00000040)
-#define RTC_ALRMBR_SU                        ((uint32_t)0x0000000F)
-#define RTC_ALRMBR_SU_0                      ((uint32_t)0x00000001)
-#define RTC_ALRMBR_SU_1                      ((uint32_t)0x00000002)
-#define RTC_ALRMBR_SU_2                      ((uint32_t)0x00000004)
-#define RTC_ALRMBR_SU_3                      ((uint32_t)0x00000008)
-
-/********************  Bits definition for RTC_WPR register  ******************/
-#define RTC_WPR_KEY                          ((uint32_t)0x000000FF)
-
-/********************  Bits definition for RTC_SSR register  ******************/
-#define RTC_SSR_SS                           ((uint32_t)0x0000FFFF)
-
-/********************  Bits definition for RTC_SHIFTR register  ***************/
-#define RTC_SHIFTR_SUBFS                     ((uint32_t)0x00007FFF)
-#define RTC_SHIFTR_ADD1S                     ((uint32_t)0x80000000)
-
-/********************  Bits definition for RTC_TSTR register  *****************/
-#define RTC_TSTR_PM                          ((uint32_t)0x00400000)
-#define RTC_TSTR_HT                          ((uint32_t)0x00300000)
-#define RTC_TSTR_HT_0                        ((uint32_t)0x00100000)
-#define RTC_TSTR_HT_1                        ((uint32_t)0x00200000)
-#define RTC_TSTR_HU                          ((uint32_t)0x000F0000)
-#define RTC_TSTR_HU_0                        ((uint32_t)0x00010000)
-#define RTC_TSTR_HU_1                        ((uint32_t)0x00020000)
-#define RTC_TSTR_HU_2                        ((uint32_t)0x00040000)
-#define RTC_TSTR_HU_3                        ((uint32_t)0x00080000)
-#define RTC_TSTR_MNT                         ((uint32_t)0x00007000)
-#define RTC_TSTR_MNT_0                       ((uint32_t)0x00001000)
-#define RTC_TSTR_MNT_1                       ((uint32_t)0x00002000)
-#define RTC_TSTR_MNT_2                       ((uint32_t)0x00004000)
-#define RTC_TSTR_MNU                         ((uint32_t)0x00000F00)
-#define RTC_TSTR_MNU_0                       ((uint32_t)0x00000100)
-#define RTC_TSTR_MNU_1                       ((uint32_t)0x00000200)
-#define RTC_TSTR_MNU_2                       ((uint32_t)0x00000400)
-#define RTC_TSTR_MNU_3                       ((uint32_t)0x00000800)
-#define RTC_TSTR_ST                          ((uint32_t)0x00000070)
-#define RTC_TSTR_ST_0                        ((uint32_t)0x00000010)
-#define RTC_TSTR_ST_1                        ((uint32_t)0x00000020)
-#define RTC_TSTR_ST_2                        ((uint32_t)0x00000040)
-#define RTC_TSTR_SU                          ((uint32_t)0x0000000F)
-#define RTC_TSTR_SU_0                        ((uint32_t)0x00000001)
-#define RTC_TSTR_SU_1                        ((uint32_t)0x00000002)
-#define RTC_TSTR_SU_2                        ((uint32_t)0x00000004)
-#define RTC_TSTR_SU_3                        ((uint32_t)0x00000008)
-
-/********************  Bits definition for RTC_TSDR register  *****************/
-#define RTC_TSDR_WDU                         ((uint32_t)0x0000E000)
-#define RTC_TSDR_WDU_0                       ((uint32_t)0x00002000)
-#define RTC_TSDR_WDU_1                       ((uint32_t)0x00004000)
-#define RTC_TSDR_WDU_2                       ((uint32_t)0x00008000)
-#define RTC_TSDR_MT                          ((uint32_t)0x00001000)
-#define RTC_TSDR_MU                          ((uint32_t)0x00000F00)
-#define RTC_TSDR_MU_0                        ((uint32_t)0x00000100)
-#define RTC_TSDR_MU_1                        ((uint32_t)0x00000200)
-#define RTC_TSDR_MU_2                        ((uint32_t)0x00000400)
-#define RTC_TSDR_MU_3                        ((uint32_t)0x00000800)
-#define RTC_TSDR_DT                          ((uint32_t)0x00000030)
-#define RTC_TSDR_DT_0                        ((uint32_t)0x00000010)
-#define RTC_TSDR_DT_1                        ((uint32_t)0x00000020)
-#define RTC_TSDR_DU                          ((uint32_t)0x0000000F)
-#define RTC_TSDR_DU_0                        ((uint32_t)0x00000001)
-#define RTC_TSDR_DU_1                        ((uint32_t)0x00000002)
-#define RTC_TSDR_DU_2                        ((uint32_t)0x00000004)
-#define RTC_TSDR_DU_3                        ((uint32_t)0x00000008)
-
-/********************  Bits definition for RTC_TSSSR register  ****************/
-#define RTC_TSSSR_SS                         ((uint32_t)0x0000FFFF)
-
-/********************  Bits definition for RTC_CAL register  *****************/
-#define RTC_CALR_CALP                        ((uint32_t)0x00008000)
-#define RTC_CALR_CALW8                       ((uint32_t)0x00004000)
-#define RTC_CALR_CALW16                      ((uint32_t)0x00002000)
-#define RTC_CALR_CALM                        ((uint32_t)0x000001FF)
-#define RTC_CALR_CALM_0                      ((uint32_t)0x00000001)
-#define RTC_CALR_CALM_1                      ((uint32_t)0x00000002)
-#define RTC_CALR_CALM_2                      ((uint32_t)0x00000004)
-#define RTC_CALR_CALM_3                      ((uint32_t)0x00000008)
-#define RTC_CALR_CALM_4                      ((uint32_t)0x00000010)
-#define RTC_CALR_CALM_5                      ((uint32_t)0x00000020)
-#define RTC_CALR_CALM_6                      ((uint32_t)0x00000040)
-#define RTC_CALR_CALM_7                      ((uint32_t)0x00000080)
-#define RTC_CALR_CALM_8                      ((uint32_t)0x00000100)
-
-/********************  Bits definition for RTC_TAFCR register  ****************/
-#define RTC_TAFCR_ALARMOUTTYPE               ((uint32_t)0x00040000)
-#define RTC_TAFCR_TSINSEL                    ((uint32_t)0x00020000)
-#define RTC_TAFCR_TAMPINSEL                  ((uint32_t)0x00010000)
-#define RTC_TAFCR_TAMPPUDIS                  ((uint32_t)0x00008000)
-#define RTC_TAFCR_TAMPPRCH                   ((uint32_t)0x00006000)
-#define RTC_TAFCR_TAMPPRCH_0                 ((uint32_t)0x00002000)
-#define RTC_TAFCR_TAMPPRCH_1                 ((uint32_t)0x00004000)
-#define RTC_TAFCR_TAMPFLT                    ((uint32_t)0x00001800)
-#define RTC_TAFCR_TAMPFLT_0                  ((uint32_t)0x00000800)
-#define RTC_TAFCR_TAMPFLT_1                  ((uint32_t)0x00001000)
-#define RTC_TAFCR_TAMPFREQ                   ((uint32_t)0x00000700)
-#define RTC_TAFCR_TAMPFREQ_0                 ((uint32_t)0x00000100)
-#define RTC_TAFCR_TAMPFREQ_1                 ((uint32_t)0x00000200)
-#define RTC_TAFCR_TAMPFREQ_2                 ((uint32_t)0x00000400)
-#define RTC_TAFCR_TAMPTS                     ((uint32_t)0x00000080)
-#define RTC_TAFCR_TAMPIE                     ((uint32_t)0x00000004)
-#define RTC_TAFCR_TAMP1TRG                   ((uint32_t)0x00000002)
-#define RTC_TAFCR_TAMP1E                     ((uint32_t)0x00000001)
-
-/********************  Bits definition for RTC_ALRMASSR register  *************/
-#define RTC_ALRMASSR_MASKSS                  ((uint32_t)0x0F000000)
-#define RTC_ALRMASSR_MASKSS_0                ((uint32_t)0x01000000)
-#define RTC_ALRMASSR_MASKSS_1                ((uint32_t)0x02000000)
-#define RTC_ALRMASSR_MASKSS_2                ((uint32_t)0x04000000)
-#define RTC_ALRMASSR_MASKSS_3                ((uint32_t)0x08000000)
-#define RTC_ALRMASSR_SS                      ((uint32_t)0x00007FFF)
-
-/********************  Bits definition for RTC_ALRMBSSR register  *************/
-#define RTC_ALRMBSSR_MASKSS                  ((uint32_t)0x0F000000)
-#define RTC_ALRMBSSR_MASKSS_0                ((uint32_t)0x01000000)
-#define RTC_ALRMBSSR_MASKSS_1                ((uint32_t)0x02000000)
-#define RTC_ALRMBSSR_MASKSS_2                ((uint32_t)0x04000000)
-#define RTC_ALRMBSSR_MASKSS_3                ((uint32_t)0x08000000)
-#define RTC_ALRMBSSR_SS                      ((uint32_t)0x00007FFF)
-
-/********************  Bits definition for RTC_BKP0R register  ****************/
-#define RTC_BKP0R                            ((uint32_t)0xFFFFFFFF)
-
-/********************  Bits definition for RTC_BKP1R register  ****************/
-#define RTC_BKP1R                            ((uint32_t)0xFFFFFFFF)
-
-/********************  Bits definition for RTC_BKP2R register  ****************/
-#define RTC_BKP2R                            ((uint32_t)0xFFFFFFFF)
-
-/********************  Bits definition for RTC_BKP3R register  ****************/
-#define RTC_BKP3R                            ((uint32_t)0xFFFFFFFF)
-
-/********************  Bits definition for RTC_BKP4R register  ****************/
-#define RTC_BKP4R                            ((uint32_t)0xFFFFFFFF)
-
-/********************  Bits definition for RTC_BKP5R register  ****************/
-#define RTC_BKP5R                            ((uint32_t)0xFFFFFFFF)
-
-/********************  Bits definition for RTC_BKP6R register  ****************/
-#define RTC_BKP6R                            ((uint32_t)0xFFFFFFFF)
-
-/********************  Bits definition for RTC_BKP7R register  ****************/
-#define RTC_BKP7R                            ((uint32_t)0xFFFFFFFF)
-
-/********************  Bits definition for RTC_BKP8R register  ****************/
-#define RTC_BKP8R                            ((uint32_t)0xFFFFFFFF)
-
-/********************  Bits definition for RTC_BKP9R register  ****************/
-#define RTC_BKP9R                            ((uint32_t)0xFFFFFFFF)
-
-/********************  Bits definition for RTC_BKP10R register  ***************/
-#define RTC_BKP10R                           ((uint32_t)0xFFFFFFFF)
-
-/********************  Bits definition for RTC_BKP11R register  ***************/
-#define RTC_BKP11R                           ((uint32_t)0xFFFFFFFF)
-
-/********************  Bits definition for RTC_BKP12R register  ***************/
-#define RTC_BKP12R                           ((uint32_t)0xFFFFFFFF)
-
-/********************  Bits definition for RTC_BKP13R register  ***************/
-#define RTC_BKP13R                           ((uint32_t)0xFFFFFFFF)
-
-/********************  Bits definition for RTC_BKP14R register  ***************/
-#define RTC_BKP14R                           ((uint32_t)0xFFFFFFFF)
-
-/********************  Bits definition for RTC_BKP15R register  ***************/
-#define RTC_BKP15R                           ((uint32_t)0xFFFFFFFF)
-
-/********************  Bits definition for RTC_BKP16R register  ***************/
-#define RTC_BKP16R                           ((uint32_t)0xFFFFFFFF)
-
-/********************  Bits definition for RTC_BKP17R register  ***************/
-#define RTC_BKP17R                           ((uint32_t)0xFFFFFFFF)
-
-/********************  Bits definition for RTC_BKP18R register  ***************/
-#define RTC_BKP18R                           ((uint32_t)0xFFFFFFFF)
-
-/********************  Bits definition for RTC_BKP19R register  ***************/
-#define RTC_BKP19R                           ((uint32_t)0xFFFFFFFF)
-
-
-/******************************************************************************/
-/*                                                                            */
-/*                          SD host Interface                                 */
-/*                                                                            */
-/******************************************************************************/
-/******************  Bit definition for SDIO_POWER register  ******************/
-#define  SDIO_POWER_PWRCTRL                  ((uint8_t)0x03)               /*!<PWRCTRL[1:0] bits (Power supply control bits) */
-#define  SDIO_POWER_PWRCTRL_0                ((uint8_t)0x01)               /*!<Bit 0 */
-#define  SDIO_POWER_PWRCTRL_1                ((uint8_t)0x02)               /*!<Bit 1 */
-
-/******************  Bit definition for SDIO_CLKCR register  ******************/
-#define  SDIO_CLKCR_CLKDIV                   ((uint16_t)0x00FF)            /*!<Clock divide factor             */
-#define  SDIO_CLKCR_CLKEN                    ((uint16_t)0x0100)            /*!<Clock enable bit                */
-#define  SDIO_CLKCR_PWRSAV                   ((uint16_t)0x0200)            /*!<Power saving configuration bit  */
-#define  SDIO_CLKCR_BYPASS                   ((uint16_t)0x0400)            /*!<Clock divider bypass enable bit */
-
-#define  SDIO_CLKCR_WIDBUS                   ((uint16_t)0x1800)            /*!<WIDBUS[1:0] bits (Wide bus mode enable bit) */
-#define  SDIO_CLKCR_WIDBUS_0                 ((uint16_t)0x0800)            /*!<Bit 0 */
-#define  SDIO_CLKCR_WIDBUS_1                 ((uint16_t)0x1000)            /*!<Bit 1 */
-
-#define  SDIO_CLKCR_NEGEDGE                  ((uint16_t)0x2000)            /*!<SDIO_CK dephasing selection bit */
-#define  SDIO_CLKCR_HWFC_EN                  ((uint16_t)0x4000)            /*!<HW Flow Control enable          */
-
-/*******************  Bit definition for SDIO_ARG register  *******************/
-#define  SDIO_ARG_CMDARG                     ((uint32_t)0xFFFFFFFF)            /*!<Command argument */
-
-/*******************  Bit definition for SDIO_CMD register  *******************/
-#define  SDIO_CMD_CMDINDEX                   ((uint16_t)0x003F)            /*!<Command Index                               */
-
-#define  SDIO_CMD_WAITRESP                   ((uint16_t)0x00C0)            /*!<WAITRESP[1:0] bits (Wait for response bits) */
-#define  SDIO_CMD_WAITRESP_0                 ((uint16_t)0x0040)            /*!< Bit 0 */
-#define  SDIO_CMD_WAITRESP_1                 ((uint16_t)0x0080)            /*!< Bit 1 */
-
-#define  SDIO_CMD_WAITINT                    ((uint16_t)0x0100)            /*!<CPSM Waits for Interrupt Request                               */
-#define  SDIO_CMD_WAITPEND                   ((uint16_t)0x0200)            /*!<CPSM Waits for ends of data transfer (CmdPend internal signal) */
-#define  SDIO_CMD_CPSMEN                     ((uint16_t)0x0400)            /*!<Command path state machine (CPSM) Enable bit                   */
-#define  SDIO_CMD_SDIOSUSPEND                ((uint16_t)0x0800)            /*!<SD I/O suspend command                                         */
-#define  SDIO_CMD_ENCMDCOMPL                 ((uint16_t)0x1000)            /*!<Enable CMD completion                                          */
-#define  SDIO_CMD_NIEN                       ((uint16_t)0x2000)            /*!<Not Interrupt Enable */
-#define  SDIO_CMD_CEATACMD                   ((uint16_t)0x4000)            /*!<CE-ATA command       */
-
-/*****************  Bit definition for SDIO_RESPCMD register  *****************/
-#define  SDIO_RESPCMD_RESPCMD                ((uint8_t)0x3F)               /*!<Response command index */
-
-/******************  Bit definition for SDIO_RESP0 register  ******************/
-#define  SDIO_RESP0_CARDSTATUS0              ((uint32_t)0xFFFFFFFF)        /*!<Card Status */
-
-/******************  Bit definition for SDIO_RESP1 register  ******************/
-#define  SDIO_RESP1_CARDSTATUS1              ((uint32_t)0xFFFFFFFF)        /*!<Card Status */
-
-/******************  Bit definition for SDIO_RESP2 register  ******************/
-#define  SDIO_RESP2_CARDSTATUS2              ((uint32_t)0xFFFFFFFF)        /*!<Card Status */
-
-/******************  Bit definition for SDIO_RESP3 register  ******************/
-#define  SDIO_RESP3_CARDSTATUS3              ((uint32_t)0xFFFFFFFF)        /*!<Card Status */
-
-/******************  Bit definition for SDIO_RESP4 register  ******************/
-#define  SDIO_RESP4_CARDSTATUS4              ((uint32_t)0xFFFFFFFF)        /*!<Card Status */
-
-/******************  Bit definition for SDIO_DTIMER register  *****************/
-#define  SDIO_DTIMER_DATATIME                ((uint32_t)0xFFFFFFFF)        /*!<Data timeout period. */
-
-/******************  Bit definition for SDIO_DLEN register  *******************/
-#define  SDIO_DLEN_DATALENGTH                ((uint32_t)0x01FFFFFF)        /*!<Data length value    */
-
-/******************  Bit definition for SDIO_DCTRL register  ******************/
-#define  SDIO_DCTRL_DTEN                     ((uint16_t)0x0001)            /*!<Data transfer enabled bit         */
-#define  SDIO_DCTRL_DTDIR                    ((uint16_t)0x0002)            /*!<Data transfer direction selection */
-#define  SDIO_DCTRL_DTMODE                   ((uint16_t)0x0004)            /*!<Data transfer mode selection      */
-#define  SDIO_DCTRL_DMAEN                    ((uint16_t)0x0008)            /*!<DMA enabled bit                   */
-
-#define  SDIO_DCTRL_DBLOCKSIZE               ((uint16_t)0x00F0)            /*!<DBLOCKSIZE[3:0] bits (Data block size) */
-#define  SDIO_DCTRL_DBLOCKSIZE_0             ((uint16_t)0x0010)            /*!<Bit 0 */
-#define  SDIO_DCTRL_DBLOCKSIZE_1             ((uint16_t)0x0020)            /*!<Bit 1 */
-#define  SDIO_DCTRL_DBLOCKSIZE_2             ((uint16_t)0x0040)            /*!<Bit 2 */
-#define  SDIO_DCTRL_DBLOCKSIZE_3             ((uint16_t)0x0080)            /*!<Bit 3 */
-
-#define  SDIO_DCTRL_RWSTART                  ((uint16_t)0x0100)            /*!<Read wait start         */
-#define  SDIO_DCTRL_RWSTOP                   ((uint16_t)0x0200)            /*!<Read wait stop          */
-#define  SDIO_DCTRL_RWMOD                    ((uint16_t)0x0400)            /*!<Read wait mode          */
-#define  SDIO_DCTRL_SDIOEN                   ((uint16_t)0x0800)            /*!<SD I/O enable functions */
-
-/******************  Bit definition for SDIO_DCOUNT register  *****************/
-#define  SDIO_DCOUNT_DATACOUNT               ((uint32_t)0x01FFFFFF)        /*!<Data count value */
-
-/******************  Bit definition for SDIO_STA register  ********************/
-#define  SDIO_STA_CCRCFAIL                   ((uint32_t)0x00000001)        /*!<Command response received (CRC check failed)  */
-#define  SDIO_STA_DCRCFAIL                   ((uint32_t)0x00000002)        /*!<Data block sent/received (CRC check failed)   */
-#define  SDIO_STA_CTIMEOUT                   ((uint32_t)0x00000004)        /*!<Command response timeout                      */
-#define  SDIO_STA_DTIMEOUT                   ((uint32_t)0x00000008)        /*!<Data timeout                                  */
-#define  SDIO_STA_TXUNDERR                   ((uint32_t)0x00000010)        /*!<Transmit FIFO underrun error                  */
-#define  SDIO_STA_RXOVERR                    ((uint32_t)0x00000020)        /*!<Received FIFO overrun error                   */
-#define  SDIO_STA_CMDREND                    ((uint32_t)0x00000040)        /*!<Command response received (CRC check passed)  */
-#define  SDIO_STA_CMDSENT                    ((uint32_t)0x00000080)        /*!<Command sent (no response required)           */
-#define  SDIO_STA_DATAEND                    ((uint32_t)0x00000100)        /*!<Data end (data counter, SDIDCOUNT, is zero)   */
-#define  SDIO_STA_STBITERR                   ((uint32_t)0x00000200)        /*!<Start bit not detected on all data signals in wide bus mode */
-#define  SDIO_STA_DBCKEND                    ((uint32_t)0x00000400)        /*!<Data block sent/received (CRC check passed)   */
-#define  SDIO_STA_CMDACT                     ((uint32_t)0x00000800)        /*!<Command transfer in progress                  */
-#define  SDIO_STA_TXACT                      ((uint32_t)0x00001000)        /*!<Data transmit in progress                     */
-#define  SDIO_STA_RXACT                      ((uint32_t)0x00002000)        /*!<Data receive in progress                      */
-#define  SDIO_STA_TXFIFOHE                   ((uint32_t)0x00004000)        /*!<Transmit FIFO Half Empty: at least 8 words can be written into the FIFO */
-#define  SDIO_STA_RXFIFOHF                   ((uint32_t)0x00008000)        /*!<Receive FIFO Half Full: there are at least 8 words in the FIFO */
-#define  SDIO_STA_TXFIFOF                    ((uint32_t)0x00010000)        /*!<Transmit FIFO full                            */
-#define  SDIO_STA_RXFIFOF                    ((uint32_t)0x00020000)        /*!<Receive FIFO full                             */
-#define  SDIO_STA_TXFIFOE                    ((uint32_t)0x00040000)        /*!<Transmit FIFO empty                           */
-#define  SDIO_STA_RXFIFOE                    ((uint32_t)0x00080000)        /*!<Receive FIFO empty                            */
-#define  SDIO_STA_TXDAVL                     ((uint32_t)0x00100000)        /*!<Data available in transmit FIFO               */
-#define  SDIO_STA_RXDAVL                     ((uint32_t)0x00200000)        /*!<Data available in receive FIFO                */
-#define  SDIO_STA_SDIOIT                     ((uint32_t)0x00400000)        /*!<SDIO interrupt received                       */
-#define  SDIO_STA_CEATAEND                   ((uint32_t)0x00800000)        /*!<CE-ATA command completion signal received for CMD61 */
-
-/*******************  Bit definition for SDIO_ICR register  *******************/
-#define  SDIO_ICR_CCRCFAILC                  ((uint32_t)0x00000001)        /*!<CCRCFAIL flag clear bit */
-#define  SDIO_ICR_DCRCFAILC                  ((uint32_t)0x00000002)        /*!<DCRCFAIL flag clear bit */
-#define  SDIO_ICR_CTIMEOUTC                  ((uint32_t)0x00000004)        /*!<CTIMEOUT flag clear bit */
-#define  SDIO_ICR_DTIMEOUTC                  ((uint32_t)0x00000008)        /*!<DTIMEOUT flag clear bit */
-#define  SDIO_ICR_TXUNDERRC                  ((uint32_t)0x00000010)        /*!<TXUNDERR flag clear bit */
-#define  SDIO_ICR_RXOVERRC                   ((uint32_t)0x00000020)        /*!<RXOVERR flag clear bit  */
-#define  SDIO_ICR_CMDRENDC                   ((uint32_t)0x00000040)        /*!<CMDREND flag clear bit  */
-#define  SDIO_ICR_CMDSENTC                   ((uint32_t)0x00000080)        /*!<CMDSENT flag clear bit  */
-#define  SDIO_ICR_DATAENDC                   ((uint32_t)0x00000100)        /*!<DATAEND flag clear bit  */
-#define  SDIO_ICR_STBITERRC                  ((uint32_t)0x00000200)        /*!<STBITERR flag clear bit */
-#define  SDIO_ICR_DBCKENDC                   ((uint32_t)0x00000400)        /*!<DBCKEND flag clear bit  */
-#define  SDIO_ICR_SDIOITC                    ((uint32_t)0x00400000)        /*!<SDIOIT flag clear bit   */
-#define  SDIO_ICR_CEATAENDC                  ((uint32_t)0x00800000)        /*!<CEATAEND flag clear bit */
-
-/******************  Bit definition for SDIO_MASK register  *******************/
-#define  SDIO_MASK_CCRCFAILIE                ((uint32_t)0x00000001)        /*!<Command CRC Fail Interrupt Enable          */
-#define  SDIO_MASK_DCRCFAILIE                ((uint32_t)0x00000002)        /*!<Data CRC Fail Interrupt Enable             */
-#define  SDIO_MASK_CTIMEOUTIE                ((uint32_t)0x00000004)        /*!<Command TimeOut Interrupt Enable           */
-#define  SDIO_MASK_DTIMEOUTIE                ((uint32_t)0x00000008)        /*!<Data TimeOut Interrupt Enable              */
-#define  SDIO_MASK_TXUNDERRIE                ((uint32_t)0x00000010)        /*!<Tx FIFO UnderRun Error Interrupt Enable    */
-#define  SDIO_MASK_RXOVERRIE                 ((uint32_t)0x00000020)        /*!<Rx FIFO OverRun Error Interrupt Enable     */
-#define  SDIO_MASK_CMDRENDIE                 ((uint32_t)0x00000040)        /*!<Command Response Received Interrupt Enable */
-#define  SDIO_MASK_CMDSENTIE                 ((uint32_t)0x00000080)        /*!<Command Sent Interrupt Enable              */
-#define  SDIO_MASK_DATAENDIE                 ((uint32_t)0x00000100)        /*!<Data End Interrupt Enable                  */
-#define  SDIO_MASK_STBITERRIE                ((uint32_t)0x00000200)        /*!<Start Bit Error Interrupt Enable           */
-#define  SDIO_MASK_DBCKENDIE                 ((uint32_t)0x00000400)        /*!<Data Block End Interrupt Enable            */
-#define  SDIO_MASK_CMDACTIE                  ((uint32_t)0x00000800)        /*!<CCommand Acting Interrupt Enable           */
-#define  SDIO_MASK_TXACTIE                   ((uint32_t)0x00001000)        /*!<Data Transmit Acting Interrupt Enable      */
-#define  SDIO_MASK_RXACTIE                   ((uint32_t)0x00002000)        /*!<Data receive acting interrupt enabled      */
-#define  SDIO_MASK_TXFIFOHEIE                ((uint32_t)0x00004000)        /*!<Tx FIFO Half Empty interrupt Enable        */
-#define  SDIO_MASK_RXFIFOHFIE                ((uint32_t)0x00008000)        /*!<Rx FIFO Half Full interrupt Enable         */
-#define  SDIO_MASK_TXFIFOFIE                 ((uint32_t)0x00010000)        /*!<Tx FIFO Full interrupt Enable              */
-#define  SDIO_MASK_RXFIFOFIE                 ((uint32_t)0x00020000)        /*!<Rx FIFO Full interrupt Enable              */
-#define  SDIO_MASK_TXFIFOEIE                 ((uint32_t)0x00040000)        /*!<Tx FIFO Empty interrupt Enable             */
-#define  SDIO_MASK_RXFIFOEIE                 ((uint32_t)0x00080000)        /*!<Rx FIFO Empty interrupt Enable             */
-#define  SDIO_MASK_TXDAVLIE                  ((uint32_t)0x00100000)        /*!<Data available in Tx FIFO interrupt Enable */
-#define  SDIO_MASK_RXDAVLIE                  ((uint32_t)0x00200000)        /*!<Data available in Rx FIFO interrupt Enable */
-#define  SDIO_MASK_SDIOITIE                  ((uint32_t)0x00400000)        /*!<SDIO Mode Interrupt Received interrupt Enable */
-#define  SDIO_MASK_CEATAENDIE                ((uint32_t)0x00800000)        /*!<CE-ATA command completion signal received Interrupt Enable */
-
-/*****************  Bit definition for SDIO_FIFOCNT register  *****************/
-#define  SDIO_FIFOCNT_FIFOCOUNT              ((uint32_t)0x00FFFFFF)        /*!<Remaining number of words to be written to or read from the FIFO */
-
-/******************  Bit definition for SDIO_FIFO register  *******************/
-#define  SDIO_FIFO_FIFODATA                  ((uint32_t)0xFFFFFFFF)        /*!<Receive and transmit FIFO data */
-
-/******************************************************************************/
-/*                                                                            */
-/*                        Serial Peripheral Interface                         */
-/*                                                                            */
-/******************************************************************************/
-/*******************  Bit definition for SPI_CR1 register  ********************/
-#define  SPI_CR1_CPHA                        ((uint16_t)0x0001)            /*!<Clock Phase      */
-#define  SPI_CR1_CPOL                        ((uint16_t)0x0002)            /*!<Clock Polarity   */
-#define  SPI_CR1_MSTR                        ((uint16_t)0x0004)            /*!<Master Selection */
-
-#define  SPI_CR1_BR                          ((uint16_t)0x0038)            /*!<BR[2:0] bits (Baud Rate Control) */
-#define  SPI_CR1_BR_0                        ((uint16_t)0x0008)            /*!<Bit 0 */
-#define  SPI_CR1_BR_1                        ((uint16_t)0x0010)            /*!<Bit 1 */
-#define  SPI_CR1_BR_2                        ((uint16_t)0x0020)            /*!<Bit 2 */
-
-#define  SPI_CR1_SPE                         ((uint16_t)0x0040)            /*!<SPI Enable                          */
-#define  SPI_CR1_LSBFIRST                    ((uint16_t)0x0080)            /*!<Frame Format                        */
-#define  SPI_CR1_SSI                         ((uint16_t)0x0100)            /*!<Internal slave select               */
-#define  SPI_CR1_SSM                         ((uint16_t)0x0200)            /*!<Software slave management           */
-#define  SPI_CR1_RXONLY                      ((uint16_t)0x0400)            /*!<Receive only                        */
-#define  SPI_CR1_DFF                         ((uint16_t)0x0800)            /*!<Data Frame Format                   */
-#define  SPI_CR1_CRCNEXT                     ((uint16_t)0x1000)            /*!<Transmit CRC next                   */
-#define  SPI_CR1_CRCEN                       ((uint16_t)0x2000)            /*!<Hardware CRC calculation enable     */
-#define  SPI_CR1_BIDIOE                      ((uint16_t)0x4000)            /*!<Output enable in bidirectional mode */
-#define  SPI_CR1_BIDIMODE                    ((uint16_t)0x8000)            /*!<Bidirectional data mode enable      */
-
-/*******************  Bit definition for SPI_CR2 register  ********************/
-#define  SPI_CR2_RXDMAEN                     ((uint8_t)0x01)               /*!<Rx Buffer DMA Enable                 */
-#define  SPI_CR2_TXDMAEN                     ((uint8_t)0x02)               /*!<Tx Buffer DMA Enable                 */
-#define  SPI_CR2_SSOE                        ((uint8_t)0x04)               /*!<SS Output Enable                     */
-#define  SPI_CR2_ERRIE                       ((uint8_t)0x20)               /*!<Error Interrupt Enable               */
-#define  SPI_CR2_RXNEIE                      ((uint8_t)0x40)               /*!<RX buffer Not Empty Interrupt Enable */
-#define  SPI_CR2_TXEIE                       ((uint8_t)0x80)               /*!<Tx buffer Empty Interrupt Enable     */
-
-/********************  Bit definition for SPI_SR register  ********************/
-#define  SPI_SR_RXNE                         ((uint8_t)0x01)               /*!<Receive buffer Not Empty */
-#define  SPI_SR_TXE                          ((uint8_t)0x02)               /*!<Transmit buffer Empty    */
-#define  SPI_SR_CHSIDE                       ((uint8_t)0x04)               /*!<Channel side             */
-#define  SPI_SR_UDR                          ((uint8_t)0x08)               /*!<Underrun flag            */
-#define  SPI_SR_CRCERR                       ((uint8_t)0x10)               /*!<CRC Error flag           */
-#define  SPI_SR_MODF                         ((uint8_t)0x20)               /*!<Mode fault               */
-#define  SPI_SR_OVR                          ((uint8_t)0x40)               /*!<Overrun flag             */
-#define  SPI_SR_BSY                          ((uint8_t)0x80)               /*!<Busy flag                */
-
-/********************  Bit definition for SPI_DR register  ********************/
-#define  SPI_DR_DR                           ((uint16_t)0xFFFF)            /*!<Data Register           */
-
-/*******************  Bit definition for SPI_CRCPR register  ******************/
-#define  SPI_CRCPR_CRCPOLY                   ((uint16_t)0xFFFF)            /*!<CRC polynomial register */
-
-/******************  Bit definition for SPI_RXCRCR register  ******************/
-#define  SPI_RXCRCR_RXCRC                    ((uint16_t)0xFFFF)            /*!<Rx CRC Register         */
-
-/******************  Bit definition for SPI_TXCRCR register  ******************/
-#define  SPI_TXCRCR_TXCRC                    ((uint16_t)0xFFFF)            /*!<Tx CRC Register         */
-
-/******************  Bit definition for SPI_I2SCFGR register  *****************/
-#define  SPI_I2SCFGR_CHLEN                   ((uint16_t)0x0001)            /*!<Channel length (number of bits per audio channel) */
-
-#define  SPI_I2SCFGR_DATLEN                  ((uint16_t)0x0006)            /*!<DATLEN[1:0] bits (Data length to be transferred)  */
-#define  SPI_I2SCFGR_DATLEN_0                ((uint16_t)0x0002)            /*!<Bit 0 */
-#define  SPI_I2SCFGR_DATLEN_1                ((uint16_t)0x0004)            /*!<Bit 1 */
-
-#define  SPI_I2SCFGR_CKPOL                   ((uint16_t)0x0008)            /*!<steady state clock polarity               */
-
-#define  SPI_I2SCFGR_I2SSTD                  ((uint16_t)0x0030)            /*!<I2SSTD[1:0] bits (I2S standard selection) */
-#define  SPI_I2SCFGR_I2SSTD_0                ((uint16_t)0x0010)            /*!<Bit 0 */
-#define  SPI_I2SCFGR_I2SSTD_1                ((uint16_t)0x0020)            /*!<Bit 1 */
-
-#define  SPI_I2SCFGR_PCMSYNC                 ((uint16_t)0x0080)            /*!<PCM frame synchronization                 */
-
-#define  SPI_I2SCFGR_I2SCFG                  ((uint16_t)0x0300)            /*!<I2SCFG[1:0] bits (I2S configuration mode) */
-#define  SPI_I2SCFGR_I2SCFG_0                ((uint16_t)0x0100)            /*!<Bit 0 */
-#define  SPI_I2SCFGR_I2SCFG_1                ((uint16_t)0x0200)            /*!<Bit 1 */
-
-#define  SPI_I2SCFGR_I2SE                    ((uint16_t)0x0400)            /*!<I2S Enable         */
-#define  SPI_I2SCFGR_I2SMOD                  ((uint16_t)0x0800)            /*!<I2S mode selection */
-
-/******************  Bit definition for SPI_I2SPR register  *******************/
-#define  SPI_I2SPR_I2SDIV                    ((uint16_t)0x00FF)            /*!<I2S Linear prescaler         */
-#define  SPI_I2SPR_ODD                       ((uint16_t)0x0100)            /*!<Odd factor for the prescaler */
-#define  SPI_I2SPR_MCKOE                     ((uint16_t)0x0200)            /*!<Master Clock Output Enable   */
-
-/******************************************************************************/
-/*                                                                            */
-/*                                 SYSCFG                                     */
-/*                                                                            */
-/******************************************************************************/
-/******************  Bit definition for SYSCFG_MEMRMP register  ***************/  
-#define SYSCFG_MEMRMP_MEM_MODE          ((uint32_t)0x00000007) /*!< SYSCFG_Memory Remap Config */
-#define SYSCFG_MEMRMP_MEM_MODE_0        ((uint32_t)0x00000001)
-#define SYSCFG_MEMRMP_MEM_MODE_1        ((uint32_t)0x00000002)
-#define SYSCFG_MEMRMP_MEM_MODE_2        ((uint32_t)0x00000004)
-
-#define SYSCFG_MEMRMP_UFB_MODE          ((uint32_t)0x00000100) /*!< User Flash Bank mode */
-
-/******************  Bit definition for SYSCFG_PMC register  ******************/
-#define SYSCFG_PMC_MII_RMII_SEL         ((uint32_t)0x00800000) /*!<Ethernet PHY interface selection */
-/* Old MII_RMII_SEL bit definition, maintained for legacy purpose */
-#define SYSCFG_PMC_MII_RMII             SYSCFG_PMC_MII_RMII_SEL
-
-/*****************  Bit definition for SYSCFG_EXTICR1 register  ***************/
-#define SYSCFG_EXTICR1_EXTI0            ((uint16_t)0x000F) /*!<EXTI 0 configuration */
-#define SYSCFG_EXTICR1_EXTI1            ((uint16_t)0x00F0) /*!<EXTI 1 configuration */
-#define SYSCFG_EXTICR1_EXTI2            ((uint16_t)0x0F00) /*!<EXTI 2 configuration */
-#define SYSCFG_EXTICR1_EXTI3            ((uint16_t)0xF000) /*!<EXTI 3 configuration */
-/** 
-  * @brief   EXTI0 configuration  
-  */ 
-#define SYSCFG_EXTICR1_EXTI0_PA         ((uint16_t)0x0000) /*!<PA[0] pin */
-#define SYSCFG_EXTICR1_EXTI0_PB         ((uint16_t)0x0001) /*!<PB[0] pin */
-#define SYSCFG_EXTICR1_EXTI0_PC         ((uint16_t)0x0002) /*!<PC[0] pin */
-#define SYSCFG_EXTICR1_EXTI0_PD         ((uint16_t)0x0003) /*!<PD[0] pin */
-#define SYSCFG_EXTICR1_EXTI0_PE         ((uint16_t)0x0004) /*!<PE[0] pin */
-#define SYSCFG_EXTICR1_EXTI0_PF         ((uint16_t)0x0005) /*!<PF[0] pin */
-#define SYSCFG_EXTICR1_EXTI0_PG         ((uint16_t)0x0006) /*!<PG[0] pin */
-#define SYSCFG_EXTICR1_EXTI0_PH         ((uint16_t)0x0007) /*!<PH[0] pin */
-#define SYSCFG_EXTICR1_EXTI0_PI         ((uint16_t)0x0008) /*!<PI[0] pin */
-
-/** 
-  * @brief   EXTI1 configuration  
-  */ 
-#define SYSCFG_EXTICR1_EXTI1_PA         ((uint16_t)0x0000) /*!<PA[1] pin */
-#define SYSCFG_EXTICR1_EXTI1_PB         ((uint16_t)0x0010) /*!<PB[1] pin */
-#define SYSCFG_EXTICR1_EXTI1_PC         ((uint16_t)0x0020) /*!<PC[1] pin */
-#define SYSCFG_EXTICR1_EXTI1_PD         ((uint16_t)0x0030) /*!<PD[1] pin */
-#define SYSCFG_EXTICR1_EXTI1_PE         ((uint16_t)0x0040) /*!<PE[1] pin */
-#define SYSCFG_EXTICR1_EXTI1_PF         ((uint16_t)0x0050) /*!<PF[1] pin */
-#define SYSCFG_EXTICR1_EXTI1_PG         ((uint16_t)0x0060) /*!<PG[1] pin */
-#define SYSCFG_EXTICR1_EXTI1_PH         ((uint16_t)0x0070) /*!<PH[1] pin */
-#define SYSCFG_EXTICR1_EXTI1_PI         ((uint16_t)0x0080) /*!<PI[1] pin */
-
-/** 
-  * @brief   EXTI2 configuration  
-  */ 
-#define SYSCFG_EXTICR1_EXTI2_PA         ((uint16_t)0x0000) /*!<PA[2] pin */
-#define SYSCFG_EXTICR1_EXTI2_PB         ((uint16_t)0x0100) /*!<PB[2] pin */
-#define SYSCFG_EXTICR1_EXTI2_PC         ((uint16_t)0x0200) /*!<PC[2] pin */
-#define SYSCFG_EXTICR1_EXTI2_PD         ((uint16_t)0x0300) /*!<PD[2] pin */
-#define SYSCFG_EXTICR1_EXTI2_PE         ((uint16_t)0x0400) /*!<PE[2] pin */
-#define SYSCFG_EXTICR1_EXTI2_PF         ((uint16_t)0x0500) /*!<PF[2] pin */
-#define SYSCFG_EXTICR1_EXTI2_PG         ((uint16_t)0x0600) /*!<PG[2] pin */
-#define SYSCFG_EXTICR1_EXTI2_PH         ((uint16_t)0x0700) /*!<PH[2] pin */
-#define SYSCFG_EXTICR1_EXTI2_PI         ((uint16_t)0x0800) /*!<PI[2] pin */
-
-/** 
-  * @brief   EXTI3 configuration  
-  */ 
-#define SYSCFG_EXTICR1_EXTI3_PA         ((uint16_t)0x0000) /*!<PA[3] pin */
-#define SYSCFG_EXTICR1_EXTI3_PB         ((uint16_t)0x1000) /*!<PB[3] pin */
-#define SYSCFG_EXTICR1_EXTI3_PC         ((uint16_t)0x2000) /*!<PC[3] pin */
-#define SYSCFG_EXTICR1_EXTI3_PD         ((uint16_t)0x3000) /*!<PD[3] pin */
-#define SYSCFG_EXTICR1_EXTI3_PE         ((uint16_t)0x4000) /*!<PE[3] pin */
-#define SYSCFG_EXTICR1_EXTI3_PF         ((uint16_t)0x5000) /*!<PF[3] pin */
-#define SYSCFG_EXTICR1_EXTI3_PG         ((uint16_t)0x6000) /*!<PG[3] pin */
-#define SYSCFG_EXTICR1_EXTI3_PH         ((uint16_t)0x7000) /*!<PH[3] pin */
-#define SYSCFG_EXTICR1_EXTI3_PI         ((uint16_t)0x8000) /*!<PI[3] pin */
-
-/*****************  Bit definition for SYSCFG_EXTICR2 register  ***************/
-#define SYSCFG_EXTICR2_EXTI4            ((uint16_t)0x000F) /*!<EXTI 4 configuration */
-#define SYSCFG_EXTICR2_EXTI5            ((uint16_t)0x00F0) /*!<EXTI 5 configuration */
-#define SYSCFG_EXTICR2_EXTI6            ((uint16_t)0x0F00) /*!<EXTI 6 configuration */
-#define SYSCFG_EXTICR2_EXTI7            ((uint16_t)0xF000) /*!<EXTI 7 configuration */
-/** 
-  * @brief   EXTI4 configuration  
-  */ 
-#define SYSCFG_EXTICR2_EXTI4_PA         ((uint16_t)0x0000) /*!<PA[4] pin */
-#define SYSCFG_EXTICR2_EXTI4_PB         ((uint16_t)0x0001) /*!<PB[4] pin */
-#define SYSCFG_EXTICR2_EXTI4_PC         ((uint16_t)0x0002) /*!<PC[4] pin */
-#define SYSCFG_EXTICR2_EXTI4_PD         ((uint16_t)0x0003) /*!<PD[4] pin */
-#define SYSCFG_EXTICR2_EXTI4_PE         ((uint16_t)0x0004) /*!<PE[4] pin */
-#define SYSCFG_EXTICR2_EXTI4_PF         ((uint16_t)0x0005) /*!<PF[4] pin */
-#define SYSCFG_EXTICR2_EXTI4_PG         ((uint16_t)0x0006) /*!<PG[4] pin */
-#define SYSCFG_EXTICR2_EXTI4_PH         ((uint16_t)0x0007) /*!<PH[4] pin */
-#define SYSCFG_EXTICR2_EXTI4_PI         ((uint16_t)0x0008) /*!<PI[4] pin */
-
-/** 
-  * @brief   EXTI5 configuration  
-  */ 
-#define SYSCFG_EXTICR2_EXTI5_PA         ((uint16_t)0x0000) /*!<PA[5] pin */
-#define SYSCFG_EXTICR2_EXTI5_PB         ((uint16_t)0x0010) /*!<PB[5] pin */
-#define SYSCFG_EXTICR2_EXTI5_PC         ((uint16_t)0x0020) /*!<PC[5] pin */
-#define SYSCFG_EXTICR2_EXTI5_PD         ((uint16_t)0x0030) /*!<PD[5] pin */
-#define SYSCFG_EXTICR2_EXTI5_PE         ((uint16_t)0x0040) /*!<PE[5] pin */
-#define SYSCFG_EXTICR2_EXTI5_PF         ((uint16_t)0x0050) /*!<PF[5] pin */
-#define SYSCFG_EXTICR2_EXTI5_PG         ((uint16_t)0x0060) /*!<PG[5] pin */
-#define SYSCFG_EXTICR2_EXTI5_PH         ((uint16_t)0x0070) /*!<PH[5] pin */
-#define SYSCFG_EXTICR2_EXTI5_PI         ((uint16_t)0x0080) /*!<PI[5] pin */
-
-/** 
-  * @brief   EXTI6 configuration  
-  */ 
-#define SYSCFG_EXTICR2_EXTI6_PA         ((uint16_t)0x0000) /*!<PA[6] pin */
-#define SYSCFG_EXTICR2_EXTI6_PB         ((uint16_t)0x0100) /*!<PB[6] pin */
-#define SYSCFG_EXTICR2_EXTI6_PC         ((uint16_t)0x0200) /*!<PC[6] pin */
-#define SYSCFG_EXTICR2_EXTI6_PD         ((uint16_t)0x0300) /*!<PD[6] pin */
-#define SYSCFG_EXTICR2_EXTI6_PE         ((uint16_t)0x0400) /*!<PE[6] pin */
-#define SYSCFG_EXTICR2_EXTI6_PF         ((uint16_t)0x0500) /*!<PF[6] pin */
-#define SYSCFG_EXTICR2_EXTI6_PG         ((uint16_t)0x0600) /*!<PG[6] pin */
-#define SYSCFG_EXTICR2_EXTI6_PH         ((uint16_t)0x0700) /*!<PH[6] pin */
-#define SYSCFG_EXTICR2_EXTI6_PI         ((uint16_t)0x0800) /*!<PI[6] pin */
-
-/** 
-  * @brief   EXTI7 configuration  
-  */ 
-#define SYSCFG_EXTICR2_EXTI7_PA         ((uint16_t)0x0000) /*!<PA[7] pin */
-#define SYSCFG_EXTICR2_EXTI7_PB         ((uint16_t)0x1000) /*!<PB[7] pin */
-#define SYSCFG_EXTICR2_EXTI7_PC         ((uint16_t)0x2000) /*!<PC[7] pin */
-#define SYSCFG_EXTICR2_EXTI7_PD         ((uint16_t)0x3000) /*!<PD[7] pin */
-#define SYSCFG_EXTICR2_EXTI7_PE         ((uint16_t)0x4000) /*!<PE[7] pin */
-#define SYSCFG_EXTICR2_EXTI7_PF         ((uint16_t)0x5000) /*!<PF[7] pin */
-#define SYSCFG_EXTICR2_EXTI7_PG         ((uint16_t)0x6000) /*!<PG[7] pin */
-#define SYSCFG_EXTICR2_EXTI7_PH         ((uint16_t)0x7000) /*!<PH[7] pin */
-#define SYSCFG_EXTICR2_EXTI7_PI         ((uint16_t)0x8000) /*!<PI[7] pin */
-
-/*****************  Bit definition for SYSCFG_EXTICR3 register  ***************/
-#define SYSCFG_EXTICR3_EXTI8            ((uint16_t)0x000F) /*!<EXTI 8 configuration */
-#define SYSCFG_EXTICR3_EXTI9            ((uint16_t)0x00F0) /*!<EXTI 9 configuration */
-#define SYSCFG_EXTICR3_EXTI10           ((uint16_t)0x0F00) /*!<EXTI 10 configuration */
-#define SYSCFG_EXTICR3_EXTI11           ((uint16_t)0xF000) /*!<EXTI 11 configuration */
-           
-/** 
-  * @brief   EXTI8 configuration  
-  */ 
-#define SYSCFG_EXTICR3_EXTI8_PA         ((uint16_t)0x0000) /*!<PA[8] pin */
-#define SYSCFG_EXTICR3_EXTI8_PB         ((uint16_t)0x0001) /*!<PB[8] pin */
-#define SYSCFG_EXTICR3_EXTI8_PC         ((uint16_t)0x0002) /*!<PC[8] pin */
-#define SYSCFG_EXTICR3_EXTI8_PD         ((uint16_t)0x0003) /*!<PD[8] pin */
-#define SYSCFG_EXTICR3_EXTI8_PE         ((uint16_t)0x0004) /*!<PE[8] pin */
-#define SYSCFG_EXTICR3_EXTI8_PF         ((uint16_t)0x0005) /*!<PF[8] pin */
-#define SYSCFG_EXTICR3_EXTI8_PG         ((uint16_t)0x0006) /*!<PG[8] pin */
-#define SYSCFG_EXTICR3_EXTI8_PH         ((uint16_t)0x0007) /*!<PH[8] pin */
-#define SYSCFG_EXTICR3_EXTI8_PI         ((uint16_t)0x0008) /*!<PI[8] pin */
-
-/** 
-  * @brief   EXTI9 configuration  
-  */ 
-#define SYSCFG_EXTICR3_EXTI9_PA         ((uint16_t)0x0000) /*!<PA[9] pin */
-#define SYSCFG_EXTICR3_EXTI9_PB         ((uint16_t)0x0010) /*!<PB[9] pin */
-#define SYSCFG_EXTICR3_EXTI9_PC         ((uint16_t)0x0020) /*!<PC[9] pin */
-#define SYSCFG_EXTICR3_EXTI9_PD         ((uint16_t)0x0030) /*!<PD[9] pin */
-#define SYSCFG_EXTICR3_EXTI9_PE         ((uint16_t)0x0040) /*!<PE[9] pin */
-#define SYSCFG_EXTICR3_EXTI9_PF         ((uint16_t)0x0050) /*!<PF[9] pin */
-#define SYSCFG_EXTICR3_EXTI9_PG         ((uint16_t)0x0060) /*!<PG[9] pin */
-#define SYSCFG_EXTICR3_EXTI9_PH         ((uint16_t)0x0070) /*!<PH[9] pin */
-#define SYSCFG_EXTICR3_EXTI9_PI         ((uint16_t)0x0080) /*!<PI[9] pin */
-
-/** 
-  * @brief   EXTI10 configuration  
-  */ 
-#define SYSCFG_EXTICR3_EXTI10_PA        ((uint16_t)0x0000) /*!<PA[10] pin */
-#define SYSCFG_EXTICR3_EXTI10_PB        ((uint16_t)0x0100) /*!<PB[10] pin */
-#define SYSCFG_EXTICR3_EXTI10_PC        ((uint16_t)0x0200) /*!<PC[10] pin */
-#define SYSCFG_EXTICR3_EXTI10_PD        ((uint16_t)0x0300) /*!<PD[10] pin */
-#define SYSCFG_EXTICR3_EXTI10_PE        ((uint16_t)0x0400) /*!<PE[10] pin */
-#define SYSCFG_EXTICR3_EXTI10_PF        ((uint16_t)0x0500) /*!<PF[10] pin */
-#define SYSCFG_EXTICR3_EXTI10_PG        ((uint16_t)0x0600) /*!<PG[10] pin */
-#define SYSCFG_EXTICR3_EXTI10_PH        ((uint16_t)0x0700) /*!<PH[10] pin */
-#define SYSCFG_EXTICR3_EXTI10_PI        ((uint16_t)0x0800) /*!<PI[10] pin */
-
-/** 
-  * @brief   EXTI11 configuration  
-  */ 
-#define SYSCFG_EXTICR3_EXTI11_PA        ((uint16_t)0x0000) /*!<PA[11] pin */
-#define SYSCFG_EXTICR3_EXTI11_PB        ((uint16_t)0x1000) /*!<PB[11] pin */
-#define SYSCFG_EXTICR3_EXTI11_PC        ((uint16_t)0x2000) /*!<PC[11] pin */
-#define SYSCFG_EXTICR3_EXTI11_PD        ((uint16_t)0x3000) /*!<PD[11] pin */
-#define SYSCFG_EXTICR3_EXTI11_PE        ((uint16_t)0x4000) /*!<PE[11] pin */
-#define SYSCFG_EXTICR3_EXTI11_PF        ((uint16_t)0x5000) /*!<PF[11] pin */
-#define SYSCFG_EXTICR3_EXTI11_PG        ((uint16_t)0x6000) /*!<PG[11] pin */
-#define SYSCFG_EXTICR3_EXTI11_PH        ((uint16_t)0x7000) /*!<PH[11] pin */
-#define SYSCFG_EXTICR3_EXTI11_PI        ((uint16_t)0x8000) /*!<PI[11] pin */
-
-/*****************  Bit definition for SYSCFG_EXTICR4 register  ***************/
-#define SYSCFG_EXTICR4_EXTI12           ((uint16_t)0x000F) /*!<EXTI 12 configuration */
-#define SYSCFG_EXTICR4_EXTI13           ((uint16_t)0x00F0) /*!<EXTI 13 configuration */
-#define SYSCFG_EXTICR4_EXTI14           ((uint16_t)0x0F00) /*!<EXTI 14 configuration */
-#define SYSCFG_EXTICR4_EXTI15           ((uint16_t)0xF000) /*!<EXTI 15 configuration */
-/** 
-  * @brief   EXTI12 configuration  
-  */ 
-#define SYSCFG_EXTICR4_EXTI12_PA        ((uint16_t)0x0000) /*!<PA[12] pin */
-#define SYSCFG_EXTICR4_EXTI12_PB        ((uint16_t)0x0001) /*!<PB[12] pin */
-#define SYSCFG_EXTICR4_EXTI12_PC        ((uint16_t)0x0002) /*!<PC[12] pin */
-#define SYSCFG_EXTICR4_EXTI12_PD        ((uint16_t)0x0003) /*!<PD[12] pin */
-#define SYSCFG_EXTICR4_EXTI12_PE        ((uint16_t)0x0004) /*!<PE[12] pin */
-#define SYSCFG_EXTICR4_EXTI12_PF        ((uint16_t)0x0005) /*!<PF[12] pin */
-#define SYSCFG_EXTICR4_EXTI12_PG        ((uint16_t)0x0006) /*!<PG[12] pin */
-#define SYSCFG_EXTICR4_EXTI12_PH        ((uint16_t)0x0007) /*!<PH[12] pin */
-
-/** 
-  * @brief   EXTI13 configuration  
-  */ 
-#define SYSCFG_EXTICR4_EXTI13_PA        ((uint16_t)0x0000) /*!<PA[13] pin */
-#define SYSCFG_EXTICR4_EXTI13_PB        ((uint16_t)0x0010) /*!<PB[13] pin */
-#define SYSCFG_EXTICR4_EXTI13_PC        ((uint16_t)0x0020) /*!<PC[13] pin */
-#define SYSCFG_EXTICR4_EXTI13_PD        ((uint16_t)0x0030) /*!<PD[13] pin */
-#define SYSCFG_EXTICR4_EXTI13_PE        ((uint16_t)0x0040) /*!<PE[13] pin */
-#define SYSCFG_EXTICR4_EXTI13_PF        ((uint16_t)0x0050) /*!<PF[13] pin */
-#define SYSCFG_EXTICR4_EXTI13_PG        ((uint16_t)0x0060) /*!<PG[13] pin */
-#define SYSCFG_EXTICR4_EXTI13_PH        ((uint16_t)0x0070) /*!<PH[13] pin */
-
-/** 
-  * @brief   EXTI14 configuration  
-  */ 
-#define SYSCFG_EXTICR4_EXTI14_PA        ((uint16_t)0x0000) /*!<PA[14] pin */
-#define SYSCFG_EXTICR4_EXTI14_PB        ((uint16_t)0x0100) /*!<PB[14] pin */
-#define SYSCFG_EXTICR4_EXTI14_PC        ((uint16_t)0x0200) /*!<PC[14] pin */
-#define SYSCFG_EXTICR4_EXTI14_PD        ((uint16_t)0x0300) /*!<PD[14] pin */
-#define SYSCFG_EXTICR4_EXTI14_PE        ((uint16_t)0x0400) /*!<PE[14] pin */
-#define SYSCFG_EXTICR4_EXTI14_PF        ((uint16_t)0x0500) /*!<PF[14] pin */
-#define SYSCFG_EXTICR4_EXTI14_PG        ((uint16_t)0x0600) /*!<PG[14] pin */
-#define SYSCFG_EXTICR4_EXTI14_PH        ((uint16_t)0x0700) /*!<PH[14] pin */
-
-/** 
-  * @brief   EXTI15 configuration  
-  */ 
-#define SYSCFG_EXTICR4_EXTI15_PA        ((uint16_t)0x0000) /*!<PA[15] pin */
-#define SYSCFG_EXTICR4_EXTI15_PB        ((uint16_t)0x1000) /*!<PB[15] pin */
-#define SYSCFG_EXTICR4_EXTI15_PC        ((uint16_t)0x2000) /*!<PC[15] pin */
-#define SYSCFG_EXTICR4_EXTI15_PD        ((uint16_t)0x3000) /*!<PD[15] pin */
-#define SYSCFG_EXTICR4_EXTI15_PE        ((uint16_t)0x4000) /*!<PE[15] pin */
-#define SYSCFG_EXTICR4_EXTI15_PF        ((uint16_t)0x5000) /*!<PF[15] pin */
-#define SYSCFG_EXTICR4_EXTI15_PG        ((uint16_t)0x6000) /*!<PG[15] pin */
-#define SYSCFG_EXTICR4_EXTI15_PH        ((uint16_t)0x7000) /*!<PH[15] pin */
-
-/******************  Bit definition for SYSCFG_CMPCR register  ****************/  
-#define SYSCFG_CMPCR_CMP_PD             ((uint32_t)0x00000001) /*!<Compensation cell ready flag */
-#define SYSCFG_CMPCR_READY              ((uint32_t)0x00000100) /*!<Compensation cell power-down */
-
-/******************************************************************************/
-/*                                                                            */
-/*                                    TIM                                     */
-/*                                                                            */
-/******************************************************************************/
-/*******************  Bit definition for TIM_CR1 register  ********************/
-#define  TIM_CR1_CEN                         ((uint16_t)0x0001)            /*!<Counter enable        */
-#define  TIM_CR1_UDIS                        ((uint16_t)0x0002)            /*!<Update disable        */
-#define  TIM_CR1_URS                         ((uint16_t)0x0004)            /*!<Update request source */
-#define  TIM_CR1_OPM                         ((uint16_t)0x0008)            /*!<One pulse mode        */
-#define  TIM_CR1_DIR                         ((uint16_t)0x0010)            /*!<Direction             */
-
-#define  TIM_CR1_CMS                         ((uint16_t)0x0060)            /*!<CMS[1:0] bits (Center-aligned mode selection) */
-#define  TIM_CR1_CMS_0                       ((uint16_t)0x0020)            /*!<Bit 0 */
-#define  TIM_CR1_CMS_1                       ((uint16_t)0x0040)            /*!<Bit 1 */
-
-#define  TIM_CR1_ARPE                        ((uint16_t)0x0080)            /*!<Auto-reload preload enable     */
-
-#define  TIM_CR1_CKD                         ((uint16_t)0x0300)            /*!<CKD[1:0] bits (clock division) */
-#define  TIM_CR1_CKD_0                       ((uint16_t)0x0100)            /*!<Bit 0 */
-#define  TIM_CR1_CKD_1                       ((uint16_t)0x0200)            /*!<Bit 1 */
-
-/*******************  Bit definition for TIM_CR2 register  ********************/
-#define  TIM_CR2_CCPC                        ((uint16_t)0x0001)            /*!<Capture/Compare Preloaded Control        */
-#define  TIM_CR2_CCUS                        ((uint16_t)0x0004)            /*!<Capture/Compare Control Update Selection */
-#define  TIM_CR2_CCDS                        ((uint16_t)0x0008)            /*!<Capture/Compare DMA Selection            */
-
-#define  TIM_CR2_MMS                         ((uint16_t)0x0070)            /*!<MMS[2:0] bits (Master Mode Selection) */
-#define  TIM_CR2_MMS_0                       ((uint16_t)0x0010)            /*!<Bit 0 */
-#define  TIM_CR2_MMS_1                       ((uint16_t)0x0020)            /*!<Bit 1 */
-#define  TIM_CR2_MMS_2                       ((uint16_t)0x0040)            /*!<Bit 2 */
-
-#define  TIM_CR2_TI1S                        ((uint16_t)0x0080)            /*!<TI1 Selection */
-#define  TIM_CR2_OIS1                        ((uint16_t)0x0100)            /*!<Output Idle state 1 (OC1 output)  */
-#define  TIM_CR2_OIS1N                       ((uint16_t)0x0200)            /*!<Output Idle state 1 (OC1N output) */
-#define  TIM_CR2_OIS2                        ((uint16_t)0x0400)            /*!<Output Idle state 2 (OC2 output)  */
-#define  TIM_CR2_OIS2N                       ((uint16_t)0x0800)            /*!<Output Idle state 2 (OC2N output) */
-#define  TIM_CR2_OIS3                        ((uint16_t)0x1000)            /*!<Output Idle state 3 (OC3 output)  */
-#define  TIM_CR2_OIS3N                       ((uint16_t)0x2000)            /*!<Output Idle state 3 (OC3N output) */
-#define  TIM_CR2_OIS4                        ((uint16_t)0x4000)            /*!<Output Idle state 4 (OC4 output)  */
-
-/*******************  Bit definition for TIM_SMCR register  *******************/
-#define  TIM_SMCR_SMS                        ((uint16_t)0x0007)            /*!<SMS[2:0] bits (Slave mode selection)    */
-#define  TIM_SMCR_SMS_0                      ((uint16_t)0x0001)            /*!<Bit 0 */
-#define  TIM_SMCR_SMS_1                      ((uint16_t)0x0002)            /*!<Bit 1 */
-#define  TIM_SMCR_SMS_2                      ((uint16_t)0x0004)            /*!<Bit 2 */
-
-#define  TIM_SMCR_TS                         ((uint16_t)0x0070)            /*!<TS[2:0] bits (Trigger selection)        */
-#define  TIM_SMCR_TS_0                       ((uint16_t)0x0010)            /*!<Bit 0 */
-#define  TIM_SMCR_TS_1                       ((uint16_t)0x0020)            /*!<Bit 1 */
-#define  TIM_SMCR_TS_2                       ((uint16_t)0x0040)            /*!<Bit 2 */
-
-#define  TIM_SMCR_MSM                        ((uint16_t)0x0080)            /*!<Master/slave mode                       */
-
-#define  TIM_SMCR_ETF                        ((uint16_t)0x0F00)            /*!<ETF[3:0] bits (External trigger filter) */
-#define  TIM_SMCR_ETF_0                      ((uint16_t)0x0100)            /*!<Bit 0 */
-#define  TIM_SMCR_ETF_1                      ((uint16_t)0x0200)            /*!<Bit 1 */
-#define  TIM_SMCR_ETF_2                      ((uint16_t)0x0400)            /*!<Bit 2 */
-#define  TIM_SMCR_ETF_3                      ((uint16_t)0x0800)            /*!<Bit 3 */
-
-#define  TIM_SMCR_ETPS                       ((uint16_t)0x3000)            /*!<ETPS[1:0] bits (External trigger prescaler) */
-#define  TIM_SMCR_ETPS_0                     ((uint16_t)0x1000)            /*!<Bit 0 */
-#define  TIM_SMCR_ETPS_1                     ((uint16_t)0x2000)            /*!<Bit 1 */
-
-#define  TIM_SMCR_ECE                        ((uint16_t)0x4000)            /*!<External clock enable     */
-#define  TIM_SMCR_ETP                        ((uint16_t)0x8000)            /*!<External trigger polarity */
-
-/*******************  Bit definition for TIM_DIER register  *******************/
-#define  TIM_DIER_UIE                        ((uint16_t)0x0001)            /*!<Update interrupt enable */
-#define  TIM_DIER_CC1IE                      ((uint16_t)0x0002)            /*!<Capture/Compare 1 interrupt enable   */
-#define  TIM_DIER_CC2IE                      ((uint16_t)0x0004)            /*!<Capture/Compare 2 interrupt enable   */
-#define  TIM_DIER_CC3IE                      ((uint16_t)0x0008)            /*!<Capture/Compare 3 interrupt enable   */
-#define  TIM_DIER_CC4IE                      ((uint16_t)0x0010)            /*!<Capture/Compare 4 interrupt enable   */
-#define  TIM_DIER_COMIE                      ((uint16_t)0x0020)            /*!<COM interrupt enable                 */
-#define  TIM_DIER_TIE                        ((uint16_t)0x0040)            /*!<Trigger interrupt enable             */
-#define  TIM_DIER_BIE                        ((uint16_t)0x0080)            /*!<Break interrupt enable               */
-#define  TIM_DIER_UDE                        ((uint16_t)0x0100)            /*!<Update DMA request enable            */
-#define  TIM_DIER_CC1DE                      ((uint16_t)0x0200)            /*!<Capture/Compare 1 DMA request enable */
-#define  TIM_DIER_CC2DE                      ((uint16_t)0x0400)            /*!<Capture/Compare 2 DMA request enable */
-#define  TIM_DIER_CC3DE                      ((uint16_t)0x0800)            /*!<Capture/Compare 3 DMA request enable */
-#define  TIM_DIER_CC4DE                      ((uint16_t)0x1000)            /*!<Capture/Compare 4 DMA request enable */
-#define  TIM_DIER_COMDE                      ((uint16_t)0x2000)            /*!<COM DMA request enable               */
-#define  TIM_DIER_TDE                        ((uint16_t)0x4000)            /*!<Trigger DMA request enable           */
-
-/********************  Bit definition for TIM_SR register  ********************/
-#define  TIM_SR_UIF                          ((uint16_t)0x0001)            /*!<Update interrupt Flag              */
-#define  TIM_SR_CC1IF                        ((uint16_t)0x0002)            /*!<Capture/Compare 1 interrupt Flag   */
-#define  TIM_SR_CC2IF                        ((uint16_t)0x0004)            /*!<Capture/Compare 2 interrupt Flag   */
-#define  TIM_SR_CC3IF                        ((uint16_t)0x0008)            /*!<Capture/Compare 3 interrupt Flag   */
-#define  TIM_SR_CC4IF                        ((uint16_t)0x0010)            /*!<Capture/Compare 4 interrupt Flag   */
-#define  TIM_SR_COMIF                        ((uint16_t)0x0020)            /*!<COM interrupt Flag                 */
-#define  TIM_SR_TIF                          ((uint16_t)0x0040)            /*!<Trigger interrupt Flag             */
-#define  TIM_SR_BIF                          ((uint16_t)0x0080)            /*!<Break interrupt Flag               */
-#define  TIM_SR_CC1OF                        ((uint16_t)0x0200)            /*!<Capture/Compare 1 Overcapture Flag */
-#define  TIM_SR_CC2OF                        ((uint16_t)0x0400)            /*!<Capture/Compare 2 Overcapture Flag */
-#define  TIM_SR_CC3OF                        ((uint16_t)0x0800)            /*!<Capture/Compare 3 Overcapture Flag */
-#define  TIM_SR_CC4OF                        ((uint16_t)0x1000)            /*!<Capture/Compare 4 Overcapture Flag */
-
-/*******************  Bit definition for TIM_EGR register  ********************/
-#define  TIM_EGR_UG                          ((uint8_t)0x01)               /*!<Update Generation                         */
-#define  TIM_EGR_CC1G                        ((uint8_t)0x02)               /*!<Capture/Compare 1 Generation              */
-#define  TIM_EGR_CC2G                        ((uint8_t)0x04)               /*!<Capture/Compare 2 Generation              */
-#define  TIM_EGR_CC3G                        ((uint8_t)0x08)               /*!<Capture/Compare 3 Generation              */
-#define  TIM_EGR_CC4G                        ((uint8_t)0x10)               /*!<Capture/Compare 4 Generation              */
-#define  TIM_EGR_COMG                        ((uint8_t)0x20)               /*!<Capture/Compare Control Update Generation */
-#define  TIM_EGR_TG                          ((uint8_t)0x40)               /*!<Trigger Generation                        */
-#define  TIM_EGR_BG                          ((uint8_t)0x80)               /*!<Break Generation                          */
-
-/******************  Bit definition for TIM_CCMR1 register  *******************/
-#define  TIM_CCMR1_CC1S                      ((uint16_t)0x0003)            /*!<CC1S[1:0] bits (Capture/Compare 1 Selection) */
-#define  TIM_CCMR1_CC1S_0                    ((uint16_t)0x0001)            /*!<Bit 0 */
-#define  TIM_CCMR1_CC1S_1                    ((uint16_t)0x0002)            /*!<Bit 1 */
-
-#define  TIM_CCMR1_OC1FE                     ((uint16_t)0x0004)            /*!<Output Compare 1 Fast enable                 */
-#define  TIM_CCMR1_OC1PE                     ((uint16_t)0x0008)            /*!<Output Compare 1 Preload enable              */
-
-#define  TIM_CCMR1_OC1M                      ((uint16_t)0x0070)            /*!<OC1M[2:0] bits (Output Compare 1 Mode)       */
-#define  TIM_CCMR1_OC1M_0                    ((uint16_t)0x0010)            /*!<Bit 0 */
-#define  TIM_CCMR1_OC1M_1                    ((uint16_t)0x0020)            /*!<Bit 1 */
-#define  TIM_CCMR1_OC1M_2                    ((uint16_t)0x0040)            /*!<Bit 2 */
-
-#define  TIM_CCMR1_OC1CE                     ((uint16_t)0x0080)            /*!<Output Compare 1Clear Enable                 */
-
-#define  TIM_CCMR1_CC2S                      ((uint16_t)0x0300)            /*!<CC2S[1:0] bits (Capture/Compare 2 Selection) */
-#define  TIM_CCMR1_CC2S_0                    ((uint16_t)0x0100)            /*!<Bit 0 */
-#define  TIM_CCMR1_CC2S_1                    ((uint16_t)0x0200)            /*!<Bit 1 */
-
-#define  TIM_CCMR1_OC2FE                     ((uint16_t)0x0400)            /*!<Output Compare 2 Fast enable                 */
-#define  TIM_CCMR1_OC2PE                     ((uint16_t)0x0800)            /*!<Output Compare 2 Preload enable              */
-
-#define  TIM_CCMR1_OC2M                      ((uint16_t)0x7000)            /*!<OC2M[2:0] bits (Output Compare 2 Mode)       */
-#define  TIM_CCMR1_OC2M_0                    ((uint16_t)0x1000)            /*!<Bit 0 */
-#define  TIM_CCMR1_OC2M_1                    ((uint16_t)0x2000)            /*!<Bit 1 */
-#define  TIM_CCMR1_OC2M_2                    ((uint16_t)0x4000)            /*!<Bit 2 */
-
-#define  TIM_CCMR1_OC2CE                     ((uint16_t)0x8000)            /*!<Output Compare 2 Clear Enable */
-
-/*----------------------------------------------------------------------------*/
-
-#define  TIM_CCMR1_IC1PSC                    ((uint16_t)0x000C)            /*!<IC1PSC[1:0] bits (Input Capture 1 Prescaler) */
-#define  TIM_CCMR1_IC1PSC_0                  ((uint16_t)0x0004)            /*!<Bit 0 */
-#define  TIM_CCMR1_IC1PSC_1                  ((uint16_t)0x0008)            /*!<Bit 1 */
-
-#define  TIM_CCMR1_IC1F                      ((uint16_t)0x00F0)            /*!<IC1F[3:0] bits (Input Capture 1 Filter)      */
-#define  TIM_CCMR1_IC1F_0                    ((uint16_t)0x0010)            /*!<Bit 0 */
-#define  TIM_CCMR1_IC1F_1                    ((uint16_t)0x0020)            /*!<Bit 1 */
-#define  TIM_CCMR1_IC1F_2                    ((uint16_t)0x0040)            /*!<Bit 2 */
-#define  TIM_CCMR1_IC1F_3                    ((uint16_t)0x0080)            /*!<Bit 3 */
-
-#define  TIM_CCMR1_IC2PSC                    ((uint16_t)0x0C00)            /*!<IC2PSC[1:0] bits (Input Capture 2 Prescaler)  */
-#define  TIM_CCMR1_IC2PSC_0                  ((uint16_t)0x0400)            /*!<Bit 0 */
-#define  TIM_CCMR1_IC2PSC_1                  ((uint16_t)0x0800)            /*!<Bit 1 */
-
-#define  TIM_CCMR1_IC2F                      ((uint16_t)0xF000)            /*!<IC2F[3:0] bits (Input Capture 2 Filter)       */
-#define  TIM_CCMR1_IC2F_0                    ((uint16_t)0x1000)            /*!<Bit 0 */
-#define  TIM_CCMR1_IC2F_1                    ((uint16_t)0x2000)            /*!<Bit 1 */
-#define  TIM_CCMR1_IC2F_2                    ((uint16_t)0x4000)            /*!<Bit 2 */
-#define  TIM_CCMR1_IC2F_3                    ((uint16_t)0x8000)            /*!<Bit 3 */
-
-/******************  Bit definition for TIM_CCMR2 register  *******************/
-#define  TIM_CCMR2_CC3S                      ((uint16_t)0x0003)            /*!<CC3S[1:0] bits (Capture/Compare 3 Selection)  */
-#define  TIM_CCMR2_CC3S_0                    ((uint16_t)0x0001)            /*!<Bit 0 */
-#define  TIM_CCMR2_CC3S_1                    ((uint16_t)0x0002)            /*!<Bit 1 */
-
-#define  TIM_CCMR2_OC3FE                     ((uint16_t)0x0004)            /*!<Output Compare 3 Fast enable           */
-#define  TIM_CCMR2_OC3PE                     ((uint16_t)0x0008)            /*!<Output Compare 3 Preload enable        */
-
-#define  TIM_CCMR2_OC3M                      ((uint16_t)0x0070)            /*!<OC3M[2:0] bits (Output Compare 3 Mode) */
-#define  TIM_CCMR2_OC3M_0                    ((uint16_t)0x0010)            /*!<Bit 0 */
-#define  TIM_CCMR2_OC3M_1                    ((uint16_t)0x0020)            /*!<Bit 1 */
-#define  TIM_CCMR2_OC3M_2                    ((uint16_t)0x0040)            /*!<Bit 2 */
-
-#define  TIM_CCMR2_OC3CE                     ((uint16_t)0x0080)            /*!<Output Compare 3 Clear Enable */
-
-#define  TIM_CCMR2_CC4S                      ((uint16_t)0x0300)            /*!<CC4S[1:0] bits (Capture/Compare 4 Selection) */
-#define  TIM_CCMR2_CC4S_0                    ((uint16_t)0x0100)            /*!<Bit 0 */
-#define  TIM_CCMR2_CC4S_1                    ((uint16_t)0x0200)            /*!<Bit 1 */
-
-#define  TIM_CCMR2_OC4FE                     ((uint16_t)0x0400)            /*!<Output Compare 4 Fast enable    */
-#define  TIM_CCMR2_OC4PE                     ((uint16_t)0x0800)            /*!<Output Compare 4 Preload enable */
-
-#define  TIM_CCMR2_OC4M                      ((uint16_t)0x7000)            /*!<OC4M[2:0] bits (Output Compare 4 Mode) */
-#define  TIM_CCMR2_OC4M_0                    ((uint16_t)0x1000)            /*!<Bit 0 */
-#define  TIM_CCMR2_OC4M_1                    ((uint16_t)0x2000)            /*!<Bit 1 */
-#define  TIM_CCMR2_OC4M_2                    ((uint16_t)0x4000)            /*!<Bit 2 */
-
-#define  TIM_CCMR2_OC4CE                     ((uint16_t)0x8000)            /*!<Output Compare 4 Clear Enable */
-
-/*----------------------------------------------------------------------------*/
-
-#define  TIM_CCMR2_IC3PSC                    ((uint16_t)0x000C)            /*!<IC3PSC[1:0] bits (Input Capture 3 Prescaler) */
-#define  TIM_CCMR2_IC3PSC_0                  ((uint16_t)0x0004)            /*!<Bit 0 */
-#define  TIM_CCMR2_IC3PSC_1                  ((uint16_t)0x0008)            /*!<Bit 1 */
-
-#define  TIM_CCMR2_IC3F                      ((uint16_t)0x00F0)            /*!<IC3F[3:0] bits (Input Capture 3 Filter) */
-#define  TIM_CCMR2_IC3F_0                    ((uint16_t)0x0010)            /*!<Bit 0 */
-#define  TIM_CCMR2_IC3F_1                    ((uint16_t)0x0020)            /*!<Bit 1 */
-#define  TIM_CCMR2_IC3F_2                    ((uint16_t)0x0040)            /*!<Bit 2 */
-#define  TIM_CCMR2_IC3F_3                    ((uint16_t)0x0080)            /*!<Bit 3 */
-
-#define  TIM_CCMR2_IC4PSC                    ((uint16_t)0x0C00)            /*!<IC4PSC[1:0] bits (Input Capture 4 Prescaler) */
-#define  TIM_CCMR2_IC4PSC_0                  ((uint16_t)0x0400)            /*!<Bit 0 */
-#define  TIM_CCMR2_IC4PSC_1                  ((uint16_t)0x0800)            /*!<Bit 1 */
-
-#define  TIM_CCMR2_IC4F                      ((uint16_t)0xF000)            /*!<IC4F[3:0] bits (Input Capture 4 Filter) */
-#define  TIM_CCMR2_IC4F_0                    ((uint16_t)0x1000)            /*!<Bit 0 */
-#define  TIM_CCMR2_IC4F_1                    ((uint16_t)0x2000)            /*!<Bit 1 */
-#define  TIM_CCMR2_IC4F_2                    ((uint16_t)0x4000)            /*!<Bit 2 */
-#define  TIM_CCMR2_IC4F_3                    ((uint16_t)0x8000)            /*!<Bit 3 */
-
-/*******************  Bit definition for TIM_CCER register  *******************/
-#define  TIM_CCER_CC1E                       ((uint16_t)0x0001)            /*!<Capture/Compare 1 output enable                 */
-#define  TIM_CCER_CC1P                       ((uint16_t)0x0002)            /*!<Capture/Compare 1 output Polarity               */
-#define  TIM_CCER_CC1NE                      ((uint16_t)0x0004)            /*!<Capture/Compare 1 Complementary output enable   */
-#define  TIM_CCER_CC1NP                      ((uint16_t)0x0008)            /*!<Capture/Compare 1 Complementary output Polarity */
-#define  TIM_CCER_CC2E                       ((uint16_t)0x0010)            /*!<Capture/Compare 2 output enable                 */
-#define  TIM_CCER_CC2P                       ((uint16_t)0x0020)            /*!<Capture/Compare 2 output Polarity               */
-#define  TIM_CCER_CC2NE                      ((uint16_t)0x0040)            /*!<Capture/Compare 2 Complementary output enable   */
-#define  TIM_CCER_CC2NP                      ((uint16_t)0x0080)            /*!<Capture/Compare 2 Complementary output Polarity */
-#define  TIM_CCER_CC3E                       ((uint16_t)0x0100)            /*!<Capture/Compare 3 output enable                 */
-#define  TIM_CCER_CC3P                       ((uint16_t)0x0200)            /*!<Capture/Compare 3 output Polarity               */
-#define  TIM_CCER_CC3NE                      ((uint16_t)0x0400)            /*!<Capture/Compare 3 Complementary output enable   */
-#define  TIM_CCER_CC3NP                      ((uint16_t)0x0800)            /*!<Capture/Compare 3 Complementary output Polarity */
-#define  TIM_CCER_CC4E                       ((uint16_t)0x1000)            /*!<Capture/Compare 4 output enable                 */
-#define  TIM_CCER_CC4P                       ((uint16_t)0x2000)            /*!<Capture/Compare 4 output Polarity               */
-#define  TIM_CCER_CC4NP                      ((uint16_t)0x8000)            /*!<Capture/Compare 4 Complementary output Polarity */
-
-/*******************  Bit definition for TIM_CNT register  ********************/
-#define  TIM_CNT_CNT                         ((uint16_t)0xFFFF)            /*!<Counter Value            */
-
-/*******************  Bit definition for TIM_PSC register  ********************/
-#define  TIM_PSC_PSC                         ((uint16_t)0xFFFF)            /*!<Prescaler Value          */
-
-/*******************  Bit definition for TIM_ARR register  ********************/
-#define  TIM_ARR_ARR                         ((uint16_t)0xFFFF)            /*!<actual auto-reload Value */
-
-/*******************  Bit definition for TIM_RCR register  ********************/
-#define  TIM_RCR_REP                         ((uint8_t)0xFF)               /*!<Repetition Counter Value */
-
-/*******************  Bit definition for TIM_CCR1 register  *******************/
-#define  TIM_CCR1_CCR1                       ((uint16_t)0xFFFF)            /*!<Capture/Compare 1 Value  */
-
-/*******************  Bit definition for TIM_CCR2 register  *******************/
-#define  TIM_CCR2_CCR2                       ((uint16_t)0xFFFF)            /*!<Capture/Compare 2 Value  */
-
-/*******************  Bit definition for TIM_CCR3 register  *******************/
-#define  TIM_CCR3_CCR3                       ((uint16_t)0xFFFF)            /*!<Capture/Compare 3 Value  */
-
-/*******************  Bit definition for TIM_CCR4 register  *******************/
-#define  TIM_CCR4_CCR4                       ((uint16_t)0xFFFF)            /*!<Capture/Compare 4 Value  */
-
-/*******************  Bit definition for TIM_BDTR register  *******************/
-#define  TIM_BDTR_DTG                        ((uint16_t)0x00FF)            /*!<DTG[0:7] bits (Dead-Time Generator set-up) */
-#define  TIM_BDTR_DTG_0                      ((uint16_t)0x0001)            /*!<Bit 0 */
-#define  TIM_BDTR_DTG_1                      ((uint16_t)0x0002)            /*!<Bit 1 */
-#define  TIM_BDTR_DTG_2                      ((uint16_t)0x0004)            /*!<Bit 2 */
-#define  TIM_BDTR_DTG_3                      ((uint16_t)0x0008)            /*!<Bit 3 */
-#define  TIM_BDTR_DTG_4                      ((uint16_t)0x0010)            /*!<Bit 4 */
-#define  TIM_BDTR_DTG_5                      ((uint16_t)0x0020)            /*!<Bit 5 */
-#define  TIM_BDTR_DTG_6                      ((uint16_t)0x0040)            /*!<Bit 6 */
-#define  TIM_BDTR_DTG_7                      ((uint16_t)0x0080)            /*!<Bit 7 */
-
-#define  TIM_BDTR_LOCK                       ((uint16_t)0x0300)            /*!<LOCK[1:0] bits (Lock Configuration) */
-#define  TIM_BDTR_LOCK_0                     ((uint16_t)0x0100)            /*!<Bit 0 */
-#define  TIM_BDTR_LOCK_1                     ((uint16_t)0x0200)            /*!<Bit 1 */
-
-#define  TIM_BDTR_OSSI                       ((uint16_t)0x0400)            /*!<Off-State Selection for Idle mode */
-#define  TIM_BDTR_OSSR                       ((uint16_t)0x0800)            /*!<Off-State Selection for Run mode  */
-#define  TIM_BDTR_BKE                        ((uint16_t)0x1000)            /*!<Break enable                      */
-#define  TIM_BDTR_BKP                        ((uint16_t)0x2000)            /*!<Break Polarity                    */
-#define  TIM_BDTR_AOE                        ((uint16_t)0x4000)            /*!<Automatic Output enable           */
-#define  TIM_BDTR_MOE                        ((uint16_t)0x8000)            /*!<Main Output enable                */
-
-/*******************  Bit definition for TIM_DCR register  ********************/
-#define  TIM_DCR_DBA                         ((uint16_t)0x001F)            /*!<DBA[4:0] bits (DMA Base Address) */
-#define  TIM_DCR_DBA_0                       ((uint16_t)0x0001)            /*!<Bit 0 */
-#define  TIM_DCR_DBA_1                       ((uint16_t)0x0002)            /*!<Bit 1 */
-#define  TIM_DCR_DBA_2                       ((uint16_t)0x0004)            /*!<Bit 2 */
-#define  TIM_DCR_DBA_3                       ((uint16_t)0x0008)            /*!<Bit 3 */
-#define  TIM_DCR_DBA_4                       ((uint16_t)0x0010)            /*!<Bit 4 */
-
-#define  TIM_DCR_DBL                         ((uint16_t)0x1F00)            /*!<DBL[4:0] bits (DMA Burst Length) */
-#define  TIM_DCR_DBL_0                       ((uint16_t)0x0100)            /*!<Bit 0 */
-#define  TIM_DCR_DBL_1                       ((uint16_t)0x0200)            /*!<Bit 1 */
-#define  TIM_DCR_DBL_2                       ((uint16_t)0x0400)            /*!<Bit 2 */
-#define  TIM_DCR_DBL_3                       ((uint16_t)0x0800)            /*!<Bit 3 */
-#define  TIM_DCR_DBL_4                       ((uint16_t)0x1000)            /*!<Bit 4 */
-
-/*******************  Bit definition for TIM_DMAR register  *******************/
-#define  TIM_DMAR_DMAB                       ((uint16_t)0xFFFF)            /*!<DMA register for burst accesses                    */
-
-/*******************  Bit definition for TIM_OR register  *********************/
-#define TIM_OR_TI4_RMP                       ((uint16_t)0x00C0)            /*!<TI4_RMP[1:0] bits (TIM5 Input 4 remap)             */
-#define TIM_OR_TI4_RMP_0                     ((uint16_t)0x0040)            /*!<Bit 0 */
-#define TIM_OR_TI4_RMP_1                     ((uint16_t)0x0080)            /*!<Bit 1 */
-#define TIM_OR_ITR1_RMP                      ((uint16_t)0x0C00)            /*!<ITR1_RMP[1:0] bits (TIM2 Internal trigger 1 remap) */
-#define TIM_OR_ITR1_RMP_0                    ((uint16_t)0x0400)            /*!<Bit 0 */
-#define TIM_OR_ITR1_RMP_1                    ((uint16_t)0x0800)            /*!<Bit 1 */
-
-
-/******************************************************************************/
-/*                                                                            */
-/*         Universal Synchronous Asynchronous Receiver Transmitter            */
-/*                                                                            */
-/******************************************************************************/
-/*******************  Bit definition for USART_SR register  *******************/
-#define  USART_SR_PE                         ((uint16_t)0x0001)            /*!<Parity Error                 */
-#define  USART_SR_FE                         ((uint16_t)0x0002)            /*!<Framing Error                */
-#define  USART_SR_NE                         ((uint16_t)0x0004)            /*!<Noise Error Flag             */
-#define  USART_SR_ORE                        ((uint16_t)0x0008)            /*!<OverRun Error                */
-#define  USART_SR_IDLE                       ((uint16_t)0x0010)            /*!<IDLE line detected           */
-#define  USART_SR_RXNE                       ((uint16_t)0x0020)            /*!<Read Data Register Not Empty */
-#define  USART_SR_TC                         ((uint16_t)0x0040)            /*!<Transmission Complete        */
-#define  USART_SR_TXE                        ((uint16_t)0x0080)            /*!<Transmit Data Register Empty */
-#define  USART_SR_LBD                        ((uint16_t)0x0100)            /*!<LIN Break Detection Flag     */
-#define  USART_SR_CTS                        ((uint16_t)0x0200)            /*!<CTS Flag                     */
-
-/*******************  Bit definition for USART_DR register  *******************/
-#define  USART_DR_DR                         ((uint16_t)0x01FF)            /*!<Data value */
-
-/******************  Bit definition for USART_BRR register  *******************/
-#define  USART_BRR_DIV_Fraction              ((uint16_t)0x000F)            /*!<Fraction of USARTDIV */
-#define  USART_BRR_DIV_Mantissa              ((uint16_t)0xFFF0)            /*!<Mantissa of USARTDIV */
-
-/******************  Bit definition for USART_CR1 register  *******************/
-#define  USART_CR1_SBK                       ((uint16_t)0x0001)            /*!<Send Break                             */
-#define  USART_CR1_RWU                       ((uint16_t)0x0002)            /*!<Receiver wakeup                        */
-#define  USART_CR1_RE                        ((uint16_t)0x0004)            /*!<Receiver Enable                        */
-#define  USART_CR1_TE                        ((uint16_t)0x0008)            /*!<Transmitter Enable                     */
-#define  USART_CR1_IDLEIE                    ((uint16_t)0x0010)            /*!<IDLE Interrupt Enable                  */
-#define  USART_CR1_RXNEIE                    ((uint16_t)0x0020)            /*!<RXNE Interrupt Enable                  */
-#define  USART_CR1_TCIE                      ((uint16_t)0x0040)            /*!<Transmission Complete Interrupt Enable */
-#define  USART_CR1_TXEIE                     ((uint16_t)0x0080)            /*!<PE Interrupt Enable                    */
-#define  USART_CR1_PEIE                      ((uint16_t)0x0100)            /*!<PE Interrupt Enable                    */
-#define  USART_CR1_PS                        ((uint16_t)0x0200)            /*!<Parity Selection                       */
-#define  USART_CR1_PCE                       ((uint16_t)0x0400)            /*!<Parity Control Enable                  */
-#define  USART_CR1_WAKE                      ((uint16_t)0x0800)            /*!<Wakeup method                          */
-#define  USART_CR1_M                         ((uint16_t)0x1000)            /*!<Word length                            */
-#define  USART_CR1_UE                        ((uint16_t)0x2000)            /*!<USART Enable                           */
-#define  USART_CR1_OVER8                     ((uint16_t)0x8000)            /*!<USART Oversampling by 8 enable         */
-
-/******************  Bit definition for USART_CR2 register  *******************/
-#define  USART_CR2_ADD                       ((uint16_t)0x000F)            /*!<Address of the USART node            */
-#define  USART_CR2_LBDL                      ((uint16_t)0x0020)            /*!<LIN Break Detection Length           */
-#define  USART_CR2_LBDIE                     ((uint16_t)0x0040)            /*!<LIN Break Detection Interrupt Enable */
-#define  USART_CR2_LBCL                      ((uint16_t)0x0100)            /*!<Last Bit Clock pulse                 */
-#define  USART_CR2_CPHA                      ((uint16_t)0x0200)            /*!<Clock Phase                          */
-#define  USART_CR2_CPOL                      ((uint16_t)0x0400)            /*!<Clock Polarity                       */
-#define  USART_CR2_CLKEN                     ((uint16_t)0x0800)            /*!<Clock Enable                         */
-
-#define  USART_CR2_STOP                      ((uint16_t)0x3000)            /*!<STOP[1:0] bits (STOP bits) */
-#define  USART_CR2_STOP_0                    ((uint16_t)0x1000)            /*!<Bit 0 */
-#define  USART_CR2_STOP_1                    ((uint16_t)0x2000)            /*!<Bit 1 */
-
-#define  USART_CR2_LINEN                     ((uint16_t)0x4000)            /*!<LIN mode enable */
-
-/******************  Bit definition for USART_CR3 register  *******************/
-#define  USART_CR3_EIE                       ((uint16_t)0x0001)            /*!<Error Interrupt Enable      */
-#define  USART_CR3_IREN                      ((uint16_t)0x0002)            /*!<IrDA mode Enable            */
-#define  USART_CR3_IRLP                      ((uint16_t)0x0004)            /*!<IrDA Low-Power              */
-#define  USART_CR3_HDSEL                     ((uint16_t)0x0008)            /*!<Half-Duplex Selection       */
-#define  USART_CR3_NACK                      ((uint16_t)0x0010)            /*!<Smartcard NACK enable       */
-#define  USART_CR3_SCEN                      ((uint16_t)0x0020)            /*!<Smartcard mode enable       */
-#define  USART_CR3_DMAR                      ((uint16_t)0x0040)            /*!<DMA Enable Receiver         */
-#define  USART_CR3_DMAT                      ((uint16_t)0x0080)            /*!<DMA Enable Transmitter      */
-#define  USART_CR3_RTSE                      ((uint16_t)0x0100)            /*!<RTS Enable                  */
-#define  USART_CR3_CTSE                      ((uint16_t)0x0200)            /*!<CTS Enable                  */
-#define  USART_CR3_CTSIE                     ((uint16_t)0x0400)            /*!<CTS Interrupt Enable        */
-#define  USART_CR3_ONEBIT                    ((uint16_t)0x0800)            /*!<USART One bit method enable */
-
-/******************  Bit definition for USART_GTPR register  ******************/
-#define  USART_GTPR_PSC                      ((uint16_t)0x00FF)            /*!<PSC[7:0] bits (Prescaler value) */
-#define  USART_GTPR_PSC_0                    ((uint16_t)0x0001)            /*!<Bit 0 */
-#define  USART_GTPR_PSC_1                    ((uint16_t)0x0002)            /*!<Bit 1 */
-#define  USART_GTPR_PSC_2                    ((uint16_t)0x0004)            /*!<Bit 2 */
-#define  USART_GTPR_PSC_3                    ((uint16_t)0x0008)            /*!<Bit 3 */
-#define  USART_GTPR_PSC_4                    ((uint16_t)0x0010)            /*!<Bit 4 */
-#define  USART_GTPR_PSC_5                    ((uint16_t)0x0020)            /*!<Bit 5 */
-#define  USART_GTPR_PSC_6                    ((uint16_t)0x0040)            /*!<Bit 6 */
-#define  USART_GTPR_PSC_7                    ((uint16_t)0x0080)            /*!<Bit 7 */
-
-#define  USART_GTPR_GT                       ((uint16_t)0xFF00)            /*!<Guard time value */
-
-/******************************************************************************/
-/*                                                                            */
-/*                            Window WATCHDOG                                 */
-/*                                                                            */
-/******************************************************************************/
-/*******************  Bit definition for WWDG_CR register  ********************/
-#define  WWDG_CR_T                           ((uint8_t)0x7F)               /*!<T[6:0] bits (7-Bit counter (MSB to LSB)) */
-#define  WWDG_CR_T0                          ((uint8_t)0x01)               /*!<Bit 0 */
-#define  WWDG_CR_T1                          ((uint8_t)0x02)               /*!<Bit 1 */
-#define  WWDG_CR_T2                          ((uint8_t)0x04)               /*!<Bit 2 */
-#define  WWDG_CR_T3                          ((uint8_t)0x08)               /*!<Bit 3 */
-#define  WWDG_CR_T4                          ((uint8_t)0x10)               /*!<Bit 4 */
-#define  WWDG_CR_T5                          ((uint8_t)0x20)               /*!<Bit 5 */
-#define  WWDG_CR_T6                          ((uint8_t)0x40)               /*!<Bit 6 */
-
-#define  WWDG_CR_WDGA                        ((uint8_t)0x80)               /*!<Activation bit */
-
-/*******************  Bit definition for WWDG_CFR register  *******************/
-#define  WWDG_CFR_W                          ((uint16_t)0x007F)            /*!<W[6:0] bits (7-bit window value) */
-#define  WWDG_CFR_W0                         ((uint16_t)0x0001)            /*!<Bit 0 */
-#define  WWDG_CFR_W1                         ((uint16_t)0x0002)            /*!<Bit 1 */
-#define  WWDG_CFR_W2                         ((uint16_t)0x0004)            /*!<Bit 2 */
-#define  WWDG_CFR_W3                         ((uint16_t)0x0008)            /*!<Bit 3 */
-#define  WWDG_CFR_W4                         ((uint16_t)0x0010)            /*!<Bit 4 */
-#define  WWDG_CFR_W5                         ((uint16_t)0x0020)            /*!<Bit 5 */
-#define  WWDG_CFR_W6                         ((uint16_t)0x0040)            /*!<Bit 6 */
-
-#define  WWDG_CFR_WDGTB                      ((uint16_t)0x0180)            /*!<WDGTB[1:0] bits (Timer Base) */
-#define  WWDG_CFR_WDGTB0                     ((uint16_t)0x0080)            /*!<Bit 0 */
-#define  WWDG_CFR_WDGTB1                     ((uint16_t)0x0100)            /*!<Bit 1 */
-
-#define  WWDG_CFR_EWI                        ((uint16_t)0x0200)            /*!<Early Wakeup Interrupt */
-
-/*******************  Bit definition for WWDG_SR register  ********************/
-#define  WWDG_SR_EWIF                        ((uint8_t)0x01)               /*!<Early Wakeup Interrupt Flag */
-
-
-/******************************************************************************/
-/*                                                                            */
-/*                                DBG                                         */
-/*                                                                            */
-/******************************************************************************/
-/********************  Bit definition for DBGMCU_IDCODE register  *************/
-#define  DBGMCU_IDCODE_DEV_ID                ((uint32_t)0x00000FFF)
-#define  DBGMCU_IDCODE_REV_ID                ((uint32_t)0xFFFF0000)
-
-/********************  Bit definition for DBGMCU_CR register  *****************/
-#define  DBGMCU_CR_DBG_SLEEP                 ((uint32_t)0x00000001)
-#define  DBGMCU_CR_DBG_STOP                  ((uint32_t)0x00000002)
-#define  DBGMCU_CR_DBG_STANDBY               ((uint32_t)0x00000004)
-#define  DBGMCU_CR_TRACE_IOEN                ((uint32_t)0x00000020)
-
-#define  DBGMCU_CR_TRACE_MODE                ((uint32_t)0x000000C0)
-#define  DBGMCU_CR_TRACE_MODE_0              ((uint32_t)0x00000040)/*!<Bit 0 */
-#define  DBGMCU_CR_TRACE_MODE_1              ((uint32_t)0x00000080)/*!<Bit 1 */
-
-/********************  Bit definition for DBGMCU_APB1_FZ register  ************/
-#define  DBGMCU_APB1_FZ_DBG_TIM2_STOP            ((uint32_t)0x00000001)
-#define  DBGMCU_APB1_FZ_DBG_TIM3_STOP            ((uint32_t)0x00000002)
-#define  DBGMCU_APB1_FZ_DBG_TIM4_STOP            ((uint32_t)0x00000004)
-#define  DBGMCU_APB1_FZ_DBG_TIM5_STOP            ((uint32_t)0x00000008)
-#define  DBGMCU_APB1_FZ_DBG_TIM6_STOP            ((uint32_t)0x00000010)
-#define  DBGMCU_APB1_FZ_DBG_TIM7_STOP            ((uint32_t)0x00000020)
-#define  DBGMCU_APB1_FZ_DBG_TIM12_STOP           ((uint32_t)0x00000040)
-#define  DBGMCU_APB1_FZ_DBG_TIM13_STOP           ((uint32_t)0x00000080)
-#define  DBGMCU_APB1_FZ_DBG_TIM14_STOP           ((uint32_t)0x00000100)
-#define  DBGMCU_APB1_FZ_DBG_RTC_STOP             ((uint32_t)0x00000400)
-#define  DBGMCU_APB1_FZ_DBG_WWDG_STOP            ((uint32_t)0x00000800)
-#define  DBGMCU_APB1_FZ_DBG_IWDG_STOP            ((uint32_t)0x00001000)
-#define  DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT   ((uint32_t)0x00200000)
-#define  DBGMCU_APB1_FZ_DBG_I2C2_SMBUS_TIMEOUT   ((uint32_t)0x00400000)
-#define  DBGMCU_APB1_FZ_DBG_I2C3_SMBUS_TIMEOUT   ((uint32_t)0x00800000)
-#define  DBGMCU_APB1_FZ_DBG_CAN1_STOP            ((uint32_t)0x02000000)
-#define  DBGMCU_APB1_FZ_DBG_CAN2_STOP            ((uint32_t)0x04000000)
-/* Old IWDGSTOP bit definition, maintained for legacy purpose */
-#define  DBGMCU_APB1_FZ_DBG_IWDEG_STOP           DBGMCU_APB1_FZ_DBG_IWDG_STOP
-
-/********************  Bit definition for DBGMCU_APB2_FZ register  ************/
-#define  DBGMCU_APB1_FZ_DBG_TIM1_STOP        ((uint32_t)0x00000001)
-#define  DBGMCU_APB1_FZ_DBG_TIM8_STOP        ((uint32_t)0x00000002)
-#define  DBGMCU_APB1_FZ_DBG_TIM9_STOP        ((uint32_t)0x00010000)
-#define  DBGMCU_APB1_FZ_DBG_TIM10_STOP       ((uint32_t)0x00020000)
-#define  DBGMCU_APB1_FZ_DBG_TIM11_STOP       ((uint32_t)0x00040000)
-
-/******************************************************************************/
-/*                                                                            */
-/*                Ethernet MAC Registers bits definitions                     */
-/*                                                                            */
-/******************************************************************************/
-/* Bit definition for Ethernet MAC Control Register register */
-#define ETH_MACCR_WD      ((uint32_t)0x00800000)  /* Watchdog disable */
-#define ETH_MACCR_JD      ((uint32_t)0x00400000)  /* Jabber disable */
-#define ETH_MACCR_IFG     ((uint32_t)0x000E0000)  /* Inter-frame gap */
-#define ETH_MACCR_IFG_96Bit     ((uint32_t)0x00000000)  /* Minimum IFG between frames during transmission is 96Bit */
-  #define ETH_MACCR_IFG_88Bit     ((uint32_t)0x00020000)  /* Minimum IFG between frames during transmission is 88Bit */
-  #define ETH_MACCR_IFG_80Bit     ((uint32_t)0x00040000)  /* Minimum IFG between frames during transmission is 80Bit */
-  #define ETH_MACCR_IFG_72Bit     ((uint32_t)0x00060000)  /* Minimum IFG between frames during transmission is 72Bit */
-  #define ETH_MACCR_IFG_64Bit     ((uint32_t)0x00080000)  /* Minimum IFG between frames during transmission is 64Bit */        
-  #define ETH_MACCR_IFG_56Bit     ((uint32_t)0x000A0000)  /* Minimum IFG between frames during transmission is 56Bit */
-  #define ETH_MACCR_IFG_48Bit     ((uint32_t)0x000C0000)  /* Minimum IFG between frames during transmission is 48Bit */
-  #define ETH_MACCR_IFG_40Bit     ((uint32_t)0x000E0000)  /* Minimum IFG between frames during transmission is 40Bit */              
-#define ETH_MACCR_CSD     ((uint32_t)0x00010000)  /* Carrier sense disable (during transmission) */
-#define ETH_MACCR_FES     ((uint32_t)0x00004000)  /* Fast ethernet speed */
-#define ETH_MACCR_ROD     ((uint32_t)0x00002000)  /* Receive own disable */
-#define ETH_MACCR_LM      ((uint32_t)0x00001000)  /* loopback mode */
-#define ETH_MACCR_DM      ((uint32_t)0x00000800)  /* Duplex mode */
-#define ETH_MACCR_IPCO    ((uint32_t)0x00000400)  /* IP Checksum offload */
-#define ETH_MACCR_RD      ((uint32_t)0x00000200)  /* Retry disable */
-#define ETH_MACCR_APCS    ((uint32_t)0x00000080)  /* Automatic Pad/CRC stripping */
-#define ETH_MACCR_BL      ((uint32_t)0x00000060)  /* Back-off limit: random integer number (r) of slot time delays before rescheduling
-                                                       a transmission attempt during retries after a collision: 0 =< r <2^k */
-  #define ETH_MACCR_BL_10    ((uint32_t)0x00000000)  /* k = min (n, 10) */
-  #define ETH_MACCR_BL_8     ((uint32_t)0x00000020)  /* k = min (n, 8) */
-  #define ETH_MACCR_BL_4     ((uint32_t)0x00000040)  /* k = min (n, 4) */
-  #define ETH_MACCR_BL_1     ((uint32_t)0x00000060)  /* k = min (n, 1) */ 
-#define ETH_MACCR_DC      ((uint32_t)0x00000010)  /* Defferal check */
-#define ETH_MACCR_TE      ((uint32_t)0x00000008)  /* Transmitter enable */
-#define ETH_MACCR_RE      ((uint32_t)0x00000004)  /* Receiver enable */
-
-/* Bit definition for Ethernet MAC Frame Filter Register */
-#define ETH_MACFFR_RA     ((uint32_t)0x80000000)  /* Receive all */ 
-#define ETH_MACFFR_HPF    ((uint32_t)0x00000400)  /* Hash or perfect filter */ 
-#define ETH_MACFFR_SAF    ((uint32_t)0x00000200)  /* Source address filter enable */ 
-#define ETH_MACFFR_SAIF   ((uint32_t)0x00000100)  /* SA inverse filtering */ 
-#define ETH_MACFFR_PCF    ((uint32_t)0x000000C0)  /* Pass control frames: 3 cases */
-  #define ETH_MACFFR_PCF_BlockAll                ((uint32_t)0x00000040)  /* MAC filters all control frames from reaching the application */
-  #define ETH_MACFFR_PCF_ForwardAll              ((uint32_t)0x00000080)  /* MAC forwards all control frames to application even if they fail the Address Filter */
-  #define ETH_MACFFR_PCF_ForwardPassedAddrFilter ((uint32_t)0x000000C0)  /* MAC forwards control frames that pass the Address Filter. */ 
-#define ETH_MACFFR_BFD    ((uint32_t)0x00000020)  /* Broadcast frame disable */ 
-#define ETH_MACFFR_PAM    ((uint32_t)0x00000010)  /* Pass all mutlicast */ 
-#define ETH_MACFFR_DAIF   ((uint32_t)0x00000008)  /* DA Inverse filtering */ 
-#define ETH_MACFFR_HM     ((uint32_t)0x00000004)  /* Hash multicast */ 
-#define ETH_MACFFR_HU     ((uint32_t)0x00000002)  /* Hash unicast */
-#define ETH_MACFFR_PM     ((uint32_t)0x00000001)  /* Promiscuous mode */
-
-/* Bit definition for Ethernet MAC Hash Table High Register */
-#define ETH_MACHTHR_HTH   ((uint32_t)0xFFFFFFFF)  /* Hash table high */
-
-/* Bit definition for Ethernet MAC Hash Table Low Register */
-#define ETH_MACHTLR_HTL   ((uint32_t)0xFFFFFFFF)  /* Hash table low */
-
-/* Bit definition for Ethernet MAC MII Address Register */
-#define ETH_MACMIIAR_PA   ((uint32_t)0x0000F800)  /* Physical layer address */ 
-#define ETH_MACMIIAR_MR   ((uint32_t)0x000007C0)  /* MII register in the selected PHY */ 
-#define ETH_MACMIIAR_CR   ((uint32_t)0x0000001C)  /* CR clock range: 6 cases */ 
-  #define ETH_MACMIIAR_CR_Div42   ((uint32_t)0x00000000)  /* HCLK:60-100 MHz; MDC clock= HCLK/42 */
-  #define ETH_MACMIIAR_CR_Div62   ((uint32_t)0x00000004)  /* HCLK:100-150 MHz; MDC clock= HCLK/62 */
-  #define ETH_MACMIIAR_CR_Div16   ((uint32_t)0x00000008)  /* HCLK:20-35 MHz; MDC clock= HCLK/16 */
-  #define ETH_MACMIIAR_CR_Div26   ((uint32_t)0x0000000C)  /* HCLK:35-60 MHz; MDC clock= HCLK/26 */
-  #define ETH_MACMIIAR_CR_Div102  ((uint32_t)0x00000010)  /* HCLK:150-168 MHz; MDC clock= HCLK/102 */  
-#define ETH_MACMIIAR_MW   ((uint32_t)0x00000002)  /* MII write */ 
-#define ETH_MACMIIAR_MB   ((uint32_t)0x00000001)  /* MII busy */ 
-  
-/* Bit definition for Ethernet MAC MII Data Register */
-#define ETH_MACMIIDR_MD   ((uint32_t)0x0000FFFF)  /* MII data: read/write data from/to PHY */
-
-/* Bit definition for Ethernet MAC Flow Control Register */
-#define ETH_MACFCR_PT     ((uint32_t)0xFFFF0000)  /* Pause time */
-#define ETH_MACFCR_ZQPD   ((uint32_t)0x00000080)  /* Zero-quanta pause disable */
-#define ETH_MACFCR_PLT    ((uint32_t)0x00000030)  /* Pause low threshold: 4 cases */
-  #define ETH_MACFCR_PLT_Minus4   ((uint32_t)0x00000000)  /* Pause time minus 4 slot times */
-  #define ETH_MACFCR_PLT_Minus28  ((uint32_t)0x00000010)  /* Pause time minus 28 slot times */
-  #define ETH_MACFCR_PLT_Minus144 ((uint32_t)0x00000020)  /* Pause time minus 144 slot times */
-  #define ETH_MACFCR_PLT_Minus256 ((uint32_t)0x00000030)  /* Pause time minus 256 slot times */      
-#define ETH_MACFCR_UPFD   ((uint32_t)0x00000008)  /* Unicast pause frame detect */
-#define ETH_MACFCR_RFCE   ((uint32_t)0x00000004)  /* Receive flow control enable */
-#define ETH_MACFCR_TFCE   ((uint32_t)0x00000002)  /* Transmit flow control enable */
-#define ETH_MACFCR_FCBBPA ((uint32_t)0x00000001)  /* Flow control busy/backpressure activate */
-
-/* Bit definition for Ethernet MAC VLAN Tag Register */
-#define ETH_MACVLANTR_VLANTC ((uint32_t)0x00010000)  /* 12-bit VLAN tag comparison */
-#define ETH_MACVLANTR_VLANTI ((uint32_t)0x0000FFFF)  /* VLAN tag identifier (for receive frames) */
-
-/* Bit definition for Ethernet MAC Remote Wake-UpFrame Filter Register */ 
-#define ETH_MACRWUFFR_D   ((uint32_t)0xFFFFFFFF)  /* Wake-up frame filter register data */
-/* Eight sequential Writes to this address (offset 0x28) will write all Wake-UpFrame Filter Registers.
-   Eight sequential Reads from this address (offset 0x28) will read all Wake-UpFrame Filter Registers. */
-/* Wake-UpFrame Filter Reg0 : Filter 0 Byte Mask
-   Wake-UpFrame Filter Reg1 : Filter 1 Byte Mask
-   Wake-UpFrame Filter Reg2 : Filter 2 Byte Mask
-   Wake-UpFrame Filter Reg3 : Filter 3 Byte Mask
-   Wake-UpFrame Filter Reg4 : RSVD - Filter3 Command - RSVD - Filter2 Command - 
-                              RSVD - Filter1 Command - RSVD - Filter0 Command
-   Wake-UpFrame Filter Re5 : Filter3 Offset - Filter2 Offset - Filter1 Offset - Filter0 Offset
-   Wake-UpFrame Filter Re6 : Filter1 CRC16 - Filter0 CRC16
-   Wake-UpFrame Filter Re7 : Filter3 CRC16 - Filter2 CRC16 */
-
-/* Bit definition for Ethernet MAC PMT Control and Status Register */ 
-#define ETH_MACPMTCSR_WFFRPR ((uint32_t)0x80000000)  /* Wake-Up Frame Filter Register Pointer Reset */
-#define ETH_MACPMTCSR_GU     ((uint32_t)0x00000200)  /* Global Unicast */
-#define ETH_MACPMTCSR_WFR    ((uint32_t)0x00000040)  /* Wake-Up Frame Received */
-#define ETH_MACPMTCSR_MPR    ((uint32_t)0x00000020)  /* Magic Packet Received */
-#define ETH_MACPMTCSR_WFE    ((uint32_t)0x00000004)  /* Wake-Up Frame Enable */
-#define ETH_MACPMTCSR_MPE    ((uint32_t)0x00000002)  /* Magic Packet Enable */
-#define ETH_MACPMTCSR_PD     ((uint32_t)0x00000001)  /* Power Down */
-
-/* Bit definition for Ethernet MAC Status Register */
-#define ETH_MACSR_TSTS      ((uint32_t)0x00000200)  /* Time stamp trigger status */
-#define ETH_MACSR_MMCTS     ((uint32_t)0x00000040)  /* MMC transmit status */
-#define ETH_MACSR_MMMCRS    ((uint32_t)0x00000020)  /* MMC receive status */
-#define ETH_MACSR_MMCS      ((uint32_t)0x00000010)  /* MMC status */
-#define ETH_MACSR_PMTS      ((uint32_t)0x00000008)  /* PMT status */
-
-/* Bit definition for Ethernet MAC Interrupt Mask Register */
-#define ETH_MACIMR_TSTIM     ((uint32_t)0x00000200)  /* Time stamp trigger interrupt mask */
-#define ETH_MACIMR_PMTIM     ((uint32_t)0x00000008)  /* PMT interrupt mask */
-
-/* Bit definition for Ethernet MAC Address0 High Register */
-#define ETH_MACA0HR_MACA0H   ((uint32_t)0x0000FFFF)  /* MAC address0 high */
-
-/* Bit definition for Ethernet MAC Address0 Low Register */
-#define ETH_MACA0LR_MACA0L   ((uint32_t)0xFFFFFFFF)  /* MAC address0 low */
-
-/* Bit definition for Ethernet MAC Address1 High Register */
-#define ETH_MACA1HR_AE       ((uint32_t)0x80000000)  /* Address enable */
-#define ETH_MACA1HR_SA       ((uint32_t)0x40000000)  /* Source address */
-#define ETH_MACA1HR_MBC      ((uint32_t)0x3F000000)  /* Mask byte control: bits to mask for comparison of the MAC Address bytes */
-  #define ETH_MACA1HR_MBC_HBits15_8    ((uint32_t)0x20000000)  /* Mask MAC Address high reg bits [15:8] */
-  #define ETH_MACA1HR_MBC_HBits7_0     ((uint32_t)0x10000000)  /* Mask MAC Address high reg bits [7:0] */
-  #define ETH_MACA1HR_MBC_LBits31_24   ((uint32_t)0x08000000)  /* Mask MAC Address low reg bits [31:24] */
-  #define ETH_MACA1HR_MBC_LBits23_16   ((uint32_t)0x04000000)  /* Mask MAC Address low reg bits [23:16] */
-  #define ETH_MACA1HR_MBC_LBits15_8    ((uint32_t)0x02000000)  /* Mask MAC Address low reg bits [15:8] */
-  #define ETH_MACA1HR_MBC_LBits7_0     ((uint32_t)0x01000000)  /* Mask MAC Address low reg bits [7:0] */ 
-#define ETH_MACA1HR_MACA1H   ((uint32_t)0x0000FFFF)  /* MAC address1 high */
-
-/* Bit definition for Ethernet MAC Address1 Low Register */
-#define ETH_MACA1LR_MACA1L   ((uint32_t)0xFFFFFFFF)  /* MAC address1 low */
-
-/* Bit definition for Ethernet MAC Address2 High Register */
-#define ETH_MACA2HR_AE       ((uint32_t)0x80000000)  /* Address enable */
-#define ETH_MACA2HR_SA       ((uint32_t)0x40000000)  /* Source address */
-#define ETH_MACA2HR_MBC      ((uint32_t)0x3F000000)  /* Mask byte control */
-  #define ETH_MACA2HR_MBC_HBits15_8    ((uint32_t)0x20000000)  /* Mask MAC Address high reg bits [15:8] */
-  #define ETH_MACA2HR_MBC_HBits7_0     ((uint32_t)0x10000000)  /* Mask MAC Address high reg bits [7:0] */
-  #define ETH_MACA2HR_MBC_LBits31_24   ((uint32_t)0x08000000)  /* Mask MAC Address low reg bits [31:24] */
-  #define ETH_MACA2HR_MBC_LBits23_16   ((uint32_t)0x04000000)  /* Mask MAC Address low reg bits [23:16] */
-  #define ETH_MACA2HR_MBC_LBits15_8    ((uint32_t)0x02000000)  /* Mask MAC Address low reg bits [15:8] */
-  #define ETH_MACA2HR_MBC_LBits7_0     ((uint32_t)0x01000000)  /* Mask MAC Address low reg bits [70] */
-#define ETH_MACA2HR_MACA2H   ((uint32_t)0x0000FFFF)  /* MAC address1 high */
-
-/* Bit definition for Ethernet MAC Address2 Low Register */
-#define ETH_MACA2LR_MACA2L   ((uint32_t)0xFFFFFFFF)  /* MAC address2 low */
-
-/* Bit definition for Ethernet MAC Address3 High Register */
-#define ETH_MACA3HR_AE       ((uint32_t)0x80000000)  /* Address enable */
-#define ETH_MACA3HR_SA       ((uint32_t)0x40000000)  /* Source address */
-#define ETH_MACA3HR_MBC      ((uint32_t)0x3F000000)  /* Mask byte control */
-  #define ETH_MACA3HR_MBC_HBits15_8    ((uint32_t)0x20000000)  /* Mask MAC Address high reg bits [15:8] */
-  #define ETH_MACA3HR_MBC_HBits7_0     ((uint32_t)0x10000000)  /* Mask MAC Address high reg bits [7:0] */
-  #define ETH_MACA3HR_MBC_LBits31_24   ((uint32_t)0x08000000)  /* Mask MAC Address low reg bits [31:24] */
-  #define ETH_MACA3HR_MBC_LBits23_16   ((uint32_t)0x04000000)  /* Mask MAC Address low reg bits [23:16] */
-  #define ETH_MACA3HR_MBC_LBits15_8    ((uint32_t)0x02000000)  /* Mask MAC Address low reg bits [15:8] */
-  #define ETH_MACA3HR_MBC_LBits7_0     ((uint32_t)0x01000000)  /* Mask MAC Address low reg bits [70] */
-#define ETH_MACA3HR_MACA3H   ((uint32_t)0x0000FFFF)  /* MAC address3 high */
-
-/* Bit definition for Ethernet MAC Address3 Low Register */
-#define ETH_MACA3LR_MACA3L   ((uint32_t)0xFFFFFFFF)  /* MAC address3 low */
-
-/******************************************************************************/
-/*                Ethernet MMC Registers bits definition                      */
-/******************************************************************************/
-
-/* Bit definition for Ethernet MMC Contol Register */
-#define ETH_MMCCR_MCFHP      ((uint32_t)0x00000020)  /* MMC counter Full-Half preset */
-#define ETH_MMCCR_MCP        ((uint32_t)0x00000010)  /* MMC counter preset */
-#define ETH_MMCCR_MCF        ((uint32_t)0x00000008)  /* MMC Counter Freeze */
-#define ETH_MMCCR_ROR        ((uint32_t)0x00000004)  /* Reset on Read */
-#define ETH_MMCCR_CSR        ((uint32_t)0x00000002)  /* Counter Stop Rollover */
-#define ETH_MMCCR_CR         ((uint32_t)0x00000001)  /* Counters Reset */
-
-/* Bit definition for Ethernet MMC Receive Interrupt Register */
-#define ETH_MMCRIR_RGUFS     ((uint32_t)0x00020000)  /* Set when Rx good unicast frames counter reaches half the maximum value */
-#define ETH_MMCRIR_RFAES     ((uint32_t)0x00000040)  /* Set when Rx alignment error counter reaches half the maximum value */
-#define ETH_MMCRIR_RFCES     ((uint32_t)0x00000020)  /* Set when Rx crc error counter reaches half the maximum value */
-
-/* Bit definition for Ethernet MMC Transmit Interrupt Register */
-#define ETH_MMCTIR_TGFS      ((uint32_t)0x00200000)  /* Set when Tx good frame count counter reaches half the maximum value */
-#define ETH_MMCTIR_TGFMSCS   ((uint32_t)0x00008000)  /* Set when Tx good multi col counter reaches half the maximum value */
-#define ETH_MMCTIR_TGFSCS    ((uint32_t)0x00004000)  /* Set when Tx good single col counter reaches half the maximum value */
-
-/* Bit definition for Ethernet MMC Receive Interrupt Mask Register */
-#define ETH_MMCRIMR_RGUFM    ((uint32_t)0x00020000)  /* Mask the interrupt when Rx good unicast frames counter reaches half the maximum value */
-#define ETH_MMCRIMR_RFAEM    ((uint32_t)0x00000040)  /* Mask the interrupt when when Rx alignment error counter reaches half the maximum value */
-#define ETH_MMCRIMR_RFCEM    ((uint32_t)0x00000020)  /* Mask the interrupt when Rx crc error counter reaches half the maximum value */
-
-/* Bit definition for Ethernet MMC Transmit Interrupt Mask Register */
-#define ETH_MMCTIMR_TGFM     ((uint32_t)0x00200000)  /* Mask the interrupt when Tx good frame count counter reaches half the maximum value */
-#define ETH_MMCTIMR_TGFMSCM  ((uint32_t)0x00008000)  /* Mask the interrupt when Tx good multi col counter reaches half the maximum value */
-#define ETH_MMCTIMR_TGFSCM   ((uint32_t)0x00004000)  /* Mask the interrupt when Tx good single col counter reaches half the maximum value */
-
-/* Bit definition for Ethernet MMC Transmitted Good Frames after Single Collision Counter Register */
-#define ETH_MMCTGFSCCR_TGFSCC     ((uint32_t)0xFFFFFFFF)  /* Number of successfully transmitted frames after a single collision in Half-duplex mode. */
-
-/* Bit definition for Ethernet MMC Transmitted Good Frames after More than a Single Collision Counter Register */
-#define ETH_MMCTGFMSCCR_TGFMSCC   ((uint32_t)0xFFFFFFFF)  /* Number of successfully transmitted frames after more than a single collision in Half-duplex mode. */
-
-/* Bit definition for Ethernet MMC Transmitted Good Frames Counter Register */
-#define ETH_MMCTGFCR_TGFC    ((uint32_t)0xFFFFFFFF)  /* Number of good frames transmitted. */
-
-/* Bit definition for Ethernet MMC Received Frames with CRC Error Counter Register */
-#define ETH_MMCRFCECR_RFCEC  ((uint32_t)0xFFFFFFFF)  /* Number of frames received with CRC error. */
-
-/* Bit definition for Ethernet MMC Received Frames with Alignement Error Counter Register */
-#define ETH_MMCRFAECR_RFAEC  ((uint32_t)0xFFFFFFFF)  /* Number of frames received with alignment (dribble) error */
-
-/* Bit definition for Ethernet MMC Received Good Unicast Frames Counter Register */
-#define ETH_MMCRGUFCR_RGUFC  ((uint32_t)0xFFFFFFFF)  /* Number of good unicast frames received. */
-
-/******************************************************************************/
-/*               Ethernet PTP Registers bits definition                       */
-/******************************************************************************/
-
-/* Bit definition for Ethernet PTP Time Stamp Contol Register */
-#define ETH_PTPTSCR_TSCNT       ((uint32_t)0x00030000)  /* Time stamp clock node type */
-#define ETH_PTPTSSR_TSSMRME     ((uint32_t)0x00008000)  /* Time stamp snapshot for message relevant to master enable */
-#define ETH_PTPTSSR_TSSEME      ((uint32_t)0x00004000)  /* Time stamp snapshot for event message enable */
-#define ETH_PTPTSSR_TSSIPV4FE   ((uint32_t)0x00002000)  /* Time stamp snapshot for IPv4 frames enable */
-#define ETH_PTPTSSR_TSSIPV6FE   ((uint32_t)0x00001000)  /* Time stamp snapshot for IPv6 frames enable */
-#define ETH_PTPTSSR_TSSPTPOEFE  ((uint32_t)0x00000800)  /* Time stamp snapshot for PTP over ethernet frames enable */
-#define ETH_PTPTSSR_TSPTPPSV2E  ((uint32_t)0x00000400)  /* Time stamp PTP packet snooping for version2 format enable */
-#define ETH_PTPTSSR_TSSSR       ((uint32_t)0x00000200)  /* Time stamp Sub-seconds rollover */
-#define ETH_PTPTSSR_TSSARFE     ((uint32_t)0x00000100)  /* Time stamp snapshot for all received frames enable */
-
-#define ETH_PTPTSCR_TSARU    ((uint32_t)0x00000020)  /* Addend register update */
-#define ETH_PTPTSCR_TSITE    ((uint32_t)0x00000010)  /* Time stamp interrupt trigger enable */
-#define ETH_PTPTSCR_TSSTU    ((uint32_t)0x00000008)  /* Time stamp update */
-#define ETH_PTPTSCR_TSSTI    ((uint32_t)0x00000004)  /* Time stamp initialize */
-#define ETH_PTPTSCR_TSFCU    ((uint32_t)0x00000002)  /* Time stamp fine or coarse update */
-#define ETH_PTPTSCR_TSE      ((uint32_t)0x00000001)  /* Time stamp enable */
-
-/* Bit definition for Ethernet PTP Sub-Second Increment Register */
-#define ETH_PTPSSIR_STSSI    ((uint32_t)0x000000FF)  /* System time Sub-second increment value */
-
-/* Bit definition for Ethernet PTP Time Stamp High Register */
-#define ETH_PTPTSHR_STS      ((uint32_t)0xFFFFFFFF)  /* System Time second */
-
-/* Bit definition for Ethernet PTP Time Stamp Low Register */
-#define ETH_PTPTSLR_STPNS    ((uint32_t)0x80000000)  /* System Time Positive or negative time */
-#define ETH_PTPTSLR_STSS     ((uint32_t)0x7FFFFFFF)  /* System Time sub-seconds */
-
-/* Bit definition for Ethernet PTP Time Stamp High Update Register */
-#define ETH_PTPTSHUR_TSUS    ((uint32_t)0xFFFFFFFF)  /* Time stamp update seconds */
-
-/* Bit definition for Ethernet PTP Time Stamp Low Update Register */
-#define ETH_PTPTSLUR_TSUPNS  ((uint32_t)0x80000000)  /* Time stamp update Positive or negative time */
-#define ETH_PTPTSLUR_TSUSS   ((uint32_t)0x7FFFFFFF)  /* Time stamp update sub-seconds */
-
-/* Bit definition for Ethernet PTP Time Stamp Addend Register */
-#define ETH_PTPTSAR_TSA      ((uint32_t)0xFFFFFFFF)  /* Time stamp addend */
-
-/* Bit definition for Ethernet PTP Target Time High Register */
-#define ETH_PTPTTHR_TTSH     ((uint32_t)0xFFFFFFFF)  /* Target time stamp high */
-
-/* Bit definition for Ethernet PTP Target Time Low Register */
-#define ETH_PTPTTLR_TTSL     ((uint32_t)0xFFFFFFFF)  /* Target time stamp low */
-
-/* Bit definition for Ethernet PTP Time Stamp Status Register */
-#define ETH_PTPTSSR_TSTTR    ((uint32_t)0x00000020)  /* Time stamp target time reached */
-#define ETH_PTPTSSR_TSSO     ((uint32_t)0x00000010)  /* Time stamp seconds overflow */
-
-/******************************************************************************/
-/*                 Ethernet DMA Registers bits definition                     */
-/******************************************************************************/
-
-/* Bit definition for Ethernet DMA Bus Mode Register */
-#define ETH_DMABMR_AAB       ((uint32_t)0x02000000)  /* Address-Aligned beats */
-#define ETH_DMABMR_FPM        ((uint32_t)0x01000000)  /* 4xPBL mode */
-#define ETH_DMABMR_USP       ((uint32_t)0x00800000)  /* Use separate PBL */
-#define ETH_DMABMR_RDP       ((uint32_t)0x007E0000)  /* RxDMA PBL */
-  #define ETH_DMABMR_RDP_1Beat    ((uint32_t)0x00020000)  /* maximum number of beats to be transferred in one RxDMA transaction is 1 */
-  #define ETH_DMABMR_RDP_2Beat    ((uint32_t)0x00040000)  /* maximum number of beats to be transferred in one RxDMA transaction is 2 */
-  #define ETH_DMABMR_RDP_4Beat    ((uint32_t)0x00080000)  /* maximum number of beats to be transferred in one RxDMA transaction is 4 */
-  #define ETH_DMABMR_RDP_8Beat    ((uint32_t)0x00100000)  /* maximum number of beats to be transferred in one RxDMA transaction is 8 */
-  #define ETH_DMABMR_RDP_16Beat   ((uint32_t)0x00200000)  /* maximum number of beats to be transferred in one RxDMA transaction is 16 */
-  #define ETH_DMABMR_RDP_32Beat   ((uint32_t)0x00400000)  /* maximum number of beats to be transferred in one RxDMA transaction is 32 */                
-  #define ETH_DMABMR_RDP_4xPBL_4Beat   ((uint32_t)0x01020000)  /* maximum number of beats to be transferred in one RxDMA transaction is 4 */
-  #define ETH_DMABMR_RDP_4xPBL_8Beat   ((uint32_t)0x01040000)  /* maximum number of beats to be transferred in one RxDMA transaction is 8 */
-  #define ETH_DMABMR_RDP_4xPBL_16Beat  ((uint32_t)0x01080000)  /* maximum number of beats to be transferred in one RxDMA transaction is 16 */
-  #define ETH_DMABMR_RDP_4xPBL_32Beat  ((uint32_t)0x01100000)  /* maximum number of beats to be transferred in one RxDMA transaction is 32 */
-  #define ETH_DMABMR_RDP_4xPBL_64Beat  ((uint32_t)0x01200000)  /* maximum number of beats to be transferred in one RxDMA transaction is 64 */
-  #define ETH_DMABMR_RDP_4xPBL_128Beat ((uint32_t)0x01400000)  /* maximum number of beats to be transferred in one RxDMA transaction is 128 */  
-#define ETH_DMABMR_FB        ((uint32_t)0x00010000)  /* Fixed Burst */
-#define ETH_DMABMR_RTPR      ((uint32_t)0x0000C000)  /* Rx Tx priority ratio */
-  #define ETH_DMABMR_RTPR_1_1     ((uint32_t)0x00000000)  /* Rx Tx priority ratio */
-  #define ETH_DMABMR_RTPR_2_1     ((uint32_t)0x00004000)  /* Rx Tx priority ratio */
-  #define ETH_DMABMR_RTPR_3_1     ((uint32_t)0x00008000)  /* Rx Tx priority ratio */
-  #define ETH_DMABMR_RTPR_4_1     ((uint32_t)0x0000C000)  /* Rx Tx priority ratio */  
-#define ETH_DMABMR_PBL    ((uint32_t)0x00003F00)  /* Programmable burst length */
-  #define ETH_DMABMR_PBL_1Beat    ((uint32_t)0x00000100)  /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 1 */
-  #define ETH_DMABMR_PBL_2Beat    ((uint32_t)0x00000200)  /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 2 */
-  #define ETH_DMABMR_PBL_4Beat    ((uint32_t)0x00000400)  /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 4 */
-  #define ETH_DMABMR_PBL_8Beat    ((uint32_t)0x00000800)  /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 8 */
-  #define ETH_DMABMR_PBL_16Beat   ((uint32_t)0x00001000)  /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 16 */
-  #define ETH_DMABMR_PBL_32Beat   ((uint32_t)0x00002000)  /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 32 */                
-  #define ETH_DMABMR_PBL_4xPBL_4Beat   ((uint32_t)0x01000100)  /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 4 */
-  #define ETH_DMABMR_PBL_4xPBL_8Beat   ((uint32_t)0x01000200)  /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 8 */
-  #define ETH_DMABMR_PBL_4xPBL_16Beat  ((uint32_t)0x01000400)  /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 16 */
-  #define ETH_DMABMR_PBL_4xPBL_32Beat  ((uint32_t)0x01000800)  /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 32 */
-  #define ETH_DMABMR_PBL_4xPBL_64Beat  ((uint32_t)0x01001000)  /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 64 */
-  #define ETH_DMABMR_PBL_4xPBL_128Beat ((uint32_t)0x01002000)  /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 128 */
-#define ETH_DMABMR_EDE       ((uint32_t)0x00000080)  /* Enhanced Descriptor Enable */
-#define ETH_DMABMR_DSL       ((uint32_t)0x0000007C)  /* Descriptor Skip Length */
-#define ETH_DMABMR_DA        ((uint32_t)0x00000002)  /* DMA arbitration scheme */
-#define ETH_DMABMR_SR        ((uint32_t)0x00000001)  /* Software reset */
-
-/* Bit definition for Ethernet DMA Transmit Poll Demand Register */
-#define ETH_DMATPDR_TPD      ((uint32_t)0xFFFFFFFF)  /* Transmit poll demand */
-
-/* Bit definition for Ethernet DMA Receive Poll Demand Register */
-#define ETH_DMARPDR_RPD      ((uint32_t)0xFFFFFFFF)  /* Receive poll demand  */
-
-/* Bit definition for Ethernet DMA Receive Descriptor List Address Register */
-#define ETH_DMARDLAR_SRL     ((uint32_t)0xFFFFFFFF)  /* Start of receive list */
-
-/* Bit definition for Ethernet DMA Transmit Descriptor List Address Register */
-#define ETH_DMATDLAR_STL     ((uint32_t)0xFFFFFFFF)  /* Start of transmit list */
-
-/* Bit definition for Ethernet DMA Status Register */
-#define ETH_DMASR_TSTS       ((uint32_t)0x20000000)  /* Time-stamp trigger status */
-#define ETH_DMASR_PMTS       ((uint32_t)0x10000000)  /* PMT status */
-#define ETH_DMASR_MMCS       ((uint32_t)0x08000000)  /* MMC status */
-#define ETH_DMASR_EBS        ((uint32_t)0x03800000)  /* Error bits status */
-  /* combination with EBS[2:0] for GetFlagStatus function */
-  #define ETH_DMASR_EBS_DescAccess      ((uint32_t)0x02000000)  /* Error bits 0-data buffer, 1-desc. access */
-  #define ETH_DMASR_EBS_ReadTransf      ((uint32_t)0x01000000)  /* Error bits 0-write trnsf, 1-read transfr */
-  #define ETH_DMASR_EBS_DataTransfTx    ((uint32_t)0x00800000)  /* Error bits 0-Rx DMA, 1-Tx DMA */
-#define ETH_DMASR_TPS         ((uint32_t)0x00700000)  /* Transmit process state */
-  #define ETH_DMASR_TPS_Stopped         ((uint32_t)0x00000000)  /* Stopped - Reset or Stop Tx Command issued  */
-  #define ETH_DMASR_TPS_Fetching        ((uint32_t)0x00100000)  /* Running - fetching the Tx descriptor */
-  #define ETH_DMASR_TPS_Waiting         ((uint32_t)0x00200000)  /* Running - waiting for status */
-  #define ETH_DMASR_TPS_Reading         ((uint32_t)0x00300000)  /* Running - reading the data from host memory */
-  #define ETH_DMASR_TPS_Suspended       ((uint32_t)0x00600000)  /* Suspended - Tx Descriptor unavailabe */
-  #define ETH_DMASR_TPS_Closing         ((uint32_t)0x00700000)  /* Running - closing Rx descriptor */
-#define ETH_DMASR_RPS         ((uint32_t)0x000E0000)  /* Receive process state */
-  #define ETH_DMASR_RPS_Stopped         ((uint32_t)0x00000000)  /* Stopped - Reset or Stop Rx Command issued */
-  #define ETH_DMASR_RPS_Fetching        ((uint32_t)0x00020000)  /* Running - fetching the Rx descriptor */
-  #define ETH_DMASR_RPS_Waiting         ((uint32_t)0x00060000)  /* Running - waiting for packet */
-  #define ETH_DMASR_RPS_Suspended       ((uint32_t)0x00080000)  /* Suspended - Rx Descriptor unavailable */
-  #define ETH_DMASR_RPS_Closing         ((uint32_t)0x000A0000)  /* Running - closing descriptor */
-  #define ETH_DMASR_RPS_Queuing         ((uint32_t)0x000E0000)  /* Running - queuing the recieve frame into host memory */
-#define ETH_DMASR_NIS        ((uint32_t)0x00010000)  /* Normal interrupt summary */
-#define ETH_DMASR_AIS        ((uint32_t)0x00008000)  /* Abnormal interrupt summary */
-#define ETH_DMASR_ERS        ((uint32_t)0x00004000)  /* Early receive status */
-#define ETH_DMASR_FBES       ((uint32_t)0x00002000)  /* Fatal bus error status */
-#define ETH_DMASR_ETS        ((uint32_t)0x00000400)  /* Early transmit status */
-#define ETH_DMASR_RWTS       ((uint32_t)0x00000200)  /* Receive watchdog timeout status */
-#define ETH_DMASR_RPSS       ((uint32_t)0x00000100)  /* Receive process stopped status */
-#define ETH_DMASR_RBUS       ((uint32_t)0x00000080)  /* Receive buffer unavailable status */
-#define ETH_DMASR_RS         ((uint32_t)0x00000040)  /* Receive status */
-#define ETH_DMASR_TUS        ((uint32_t)0x00000020)  /* Transmit underflow status */
-#define ETH_DMASR_ROS        ((uint32_t)0x00000010)  /* Receive overflow status */
-#define ETH_DMASR_TJTS       ((uint32_t)0x00000008)  /* Transmit jabber timeout status */
-#define ETH_DMASR_TBUS       ((uint32_t)0x00000004)  /* Transmit buffer unavailable status */
-#define ETH_DMASR_TPSS       ((uint32_t)0x00000002)  /* Transmit process stopped status */
-#define ETH_DMASR_TS         ((uint32_t)0x00000001)  /* Transmit status */
-
-/* Bit definition for Ethernet DMA Operation Mode Register */
-#define ETH_DMAOMR_DTCEFD    ((uint32_t)0x04000000)  /* Disable Dropping of TCP/IP checksum error frames */
-#define ETH_DMAOMR_RSF       ((uint32_t)0x02000000)  /* Receive store and forward */
-#define ETH_DMAOMR_DFRF      ((uint32_t)0x01000000)  /* Disable flushing of received frames */
-#define ETH_DMAOMR_TSF       ((uint32_t)0x00200000)  /* Transmit store and forward */
-#define ETH_DMAOMR_FTF       ((uint32_t)0x00100000)  /* Flush transmit FIFO */
-#define ETH_DMAOMR_TTC       ((uint32_t)0x0001C000)  /* Transmit threshold control */
-  #define ETH_DMAOMR_TTC_64Bytes       ((uint32_t)0x00000000)  /* threshold level of the MTL Transmit FIFO is 64 Bytes */
-  #define ETH_DMAOMR_TTC_128Bytes      ((uint32_t)0x00004000)  /* threshold level of the MTL Transmit FIFO is 128 Bytes */
-  #define ETH_DMAOMR_TTC_192Bytes      ((uint32_t)0x00008000)  /* threshold level of the MTL Transmit FIFO is 192 Bytes */
-  #define ETH_DMAOMR_TTC_256Bytes      ((uint32_t)0x0000C000)  /* threshold level of the MTL Transmit FIFO is 256 Bytes */
-  #define ETH_DMAOMR_TTC_40Bytes       ((uint32_t)0x00010000)  /* threshold level of the MTL Transmit FIFO is 40 Bytes */
-  #define ETH_DMAOMR_TTC_32Bytes       ((uint32_t)0x00014000)  /* threshold level of the MTL Transmit FIFO is 32 Bytes */
-  #define ETH_DMAOMR_TTC_24Bytes       ((uint32_t)0x00018000)  /* threshold level of the MTL Transmit FIFO is 24 Bytes */
-  #define ETH_DMAOMR_TTC_16Bytes       ((uint32_t)0x0001C000)  /* threshold level of the MTL Transmit FIFO is 16 Bytes */
-#define ETH_DMAOMR_ST        ((uint32_t)0x00002000)  /* Start/stop transmission command */
-#define ETH_DMAOMR_FEF       ((uint32_t)0x00000080)  /* Forward error frames */
-#define ETH_DMAOMR_FUGF      ((uint32_t)0x00000040)  /* Forward undersized good frames */
-#define ETH_DMAOMR_RTC       ((uint32_t)0x00000018)  /* receive threshold control */
-  #define ETH_DMAOMR_RTC_64Bytes       ((uint32_t)0x00000000)  /* threshold level of the MTL Receive FIFO is 64 Bytes */
-  #define ETH_DMAOMR_RTC_32Bytes       ((uint32_t)0x00000008)  /* threshold level of the MTL Receive FIFO is 32 Bytes */
-  #define ETH_DMAOMR_RTC_96Bytes       ((uint32_t)0x00000010)  /* threshold level of the MTL Receive FIFO is 96 Bytes */
-  #define ETH_DMAOMR_RTC_128Bytes      ((uint32_t)0x00000018)  /* threshold level of the MTL Receive FIFO is 128 Bytes */
-#define ETH_DMAOMR_OSF       ((uint32_t)0x00000004)  /* operate on second frame */
-#define ETH_DMAOMR_SR        ((uint32_t)0x00000002)  /* Start/stop receive */
-
-/* Bit definition for Ethernet DMA Interrupt Enable Register */
-#define ETH_DMAIER_NISE      ((uint32_t)0x00010000)  /* Normal interrupt summary enable */
-#define ETH_DMAIER_AISE      ((uint32_t)0x00008000)  /* Abnormal interrupt summary enable */
-#define ETH_DMAIER_ERIE      ((uint32_t)0x00004000)  /* Early receive interrupt enable */
-#define ETH_DMAIER_FBEIE     ((uint32_t)0x00002000)  /* Fatal bus error interrupt enable */
-#define ETH_DMAIER_ETIE      ((uint32_t)0x00000400)  /* Early transmit interrupt enable */
-#define ETH_DMAIER_RWTIE     ((uint32_t)0x00000200)  /* Receive watchdog timeout interrupt enable */
-#define ETH_DMAIER_RPSIE     ((uint32_t)0x00000100)  /* Receive process stopped interrupt enable */
-#define ETH_DMAIER_RBUIE     ((uint32_t)0x00000080)  /* Receive buffer unavailable interrupt enable */
-#define ETH_DMAIER_RIE       ((uint32_t)0x00000040)  /* Receive interrupt enable */
-#define ETH_DMAIER_TUIE      ((uint32_t)0x00000020)  /* Transmit Underflow interrupt enable */
-#define ETH_DMAIER_ROIE      ((uint32_t)0x00000010)  /* Receive Overflow interrupt enable */
-#define ETH_DMAIER_TJTIE     ((uint32_t)0x00000008)  /* Transmit jabber timeout interrupt enable */
-#define ETH_DMAIER_TBUIE     ((uint32_t)0x00000004)  /* Transmit buffer unavailable interrupt enable */
-#define ETH_DMAIER_TPSIE     ((uint32_t)0x00000002)  /* Transmit process stopped interrupt enable */
-#define ETH_DMAIER_TIE       ((uint32_t)0x00000001)  /* Transmit interrupt enable */
-
-/* Bit definition for Ethernet DMA Missed Frame and Buffer Overflow Counter Register */
-#define ETH_DMAMFBOCR_OFOC   ((uint32_t)0x10000000)  /* Overflow bit for FIFO overflow counter */
-#define ETH_DMAMFBOCR_MFA    ((uint32_t)0x0FFE0000)  /* Number of frames missed by the application */
-#define ETH_DMAMFBOCR_OMFC   ((uint32_t)0x00010000)  /* Overflow bit for missed frame counter */
-#define ETH_DMAMFBOCR_MFC    ((uint32_t)0x0000FFFF)  /* Number of frames missed by the controller */
-
-/* Bit definition for Ethernet DMA Current Host Transmit Descriptor Register */
-#define ETH_DMACHTDR_HTDAP   ((uint32_t)0xFFFFFFFF)  /* Host transmit descriptor address pointer */
-
-/* Bit definition for Ethernet DMA Current Host Receive Descriptor Register */
-#define ETH_DMACHRDR_HRDAP   ((uint32_t)0xFFFFFFFF)  /* Host receive descriptor address pointer */
-
-/* Bit definition for Ethernet DMA Current Host Transmit Buffer Address Register */
-#define ETH_DMACHTBAR_HTBAP  ((uint32_t)0xFFFFFFFF)  /* Host transmit buffer address pointer */
-
-/* Bit definition for Ethernet DMA Current Host Receive Buffer Address Register */
-#define ETH_DMACHRBAR_HRBAP  ((uint32_t)0xFFFFFFFF)  /* Host receive buffer address pointer */
-
-/**
-  *
-  */
-
- /**
-  * @}
-  */ 
-
-#ifdef USE_STDPERIPH_DRIVER
-  #include "stm32f4xx_conf.h"
-#endif /* USE_STDPERIPH_DRIVER */
-
-/** @addtogroup Exported_macro
-  * @{
-  */
-
-#define SET_BIT(REG, BIT)     ((REG) |= (BIT))
-
-#define CLEAR_BIT(REG, BIT)   ((REG) &= ~(BIT))
-
-#define READ_BIT(REG, BIT)    ((REG) & (BIT))
-
-#define CLEAR_REG(REG)        ((REG) = (0x0))
-
-#define WRITE_REG(REG, VAL)   ((REG) = (VAL))
-
-#define READ_REG(REG)         ((REG))
-
-#define MODIFY_REG(REG, CLEARMASK, SETMASK)  WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
-
-/**
-  * @}
-  */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __STM32F4xx_H */
-
-/**
-  * @}
-  */
-
-  /**
-  * @}
-  */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/targets/cmsis/TARGET_STM/TARGET_STM32F4XX/system_stm32f4xx.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,573 +0,0 @@
-/**
-  ******************************************************************************
-  * @file    system_stm32f4xx.c
-  * @author  MCD Application Team
-  * @version V1.1.0
-  * @date    11-January-2013
-  * @brief   CMSIS Cortex-M4 Device Peripheral Access Layer System Source File.
-  *          This file contains the system clock configuration for STM32F4xx devices,
-  *          and is generated by the clock configuration tool
-  *          stm32f4xx_Clock_Configuration_V1.1.0.xls
-  *             
-  * 1.  This file provides two functions and one global variable to be called from 
-  *     user application:
-  *      - SystemInit(): Setups the system clock (System clock source, PLL Multiplier
-  *                      and Divider factors, AHB/APBx prescalers and Flash settings),
-  *                      depending on the configuration made in the clock xls tool. 
-  *                      This function is called at startup just after reset and 
-  *                      before branch to main program. This call is made inside
-  *                      the "startup_stm32f4xx.s" file.
-  *
-  *      - SystemCoreClock variable: Contains the core clock (HCLK), it can be used
-  *                                  by the user application to setup the SysTick 
-  *                                  timer or configure other parameters.
-  *                                     
-  *      - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
-  *                                 be called whenever the core clock is changed
-  *                                 during program execution.
-  *
-  * 2. After each device reset the HSI (16 MHz) is used as system clock source.
-  *    Then SystemInit() function is called, in "startup_stm32f4xx.s" file, to
-  *    configure the system clock before to branch to main program.
-  *
-  * 3. If the system clock source selected by user fails to startup, the SystemInit()
-  *    function will do nothing and HSI still used as system clock source. User can 
-  *    add some code to deal with this issue inside the SetSysClock() function.
-  *
-  * 4. The default value of HSE crystal is set to 25MHz, refer to "HSE_VALUE" define
-  *    in "stm32f4xx.h" file. When HSE is used as system clock source, directly or
-  *    through PLL, and you are using different crystal you have to adapt the HSE
-  *    value to your own configuration.
-  *
-  * 5. This file configures the system clock as follows:
-  *=============================================================================
-  *=============================================================================
-  *               Supported STM32F40xx/41xx/427x/437x devices
-  *-----------------------------------------------------------------------------
-  *        System Clock source                    | PLL (HSE)
-  *-----------------------------------------------------------------------------
-  *        SYSCLK(Hz)                             | 168000000
-  *-----------------------------------------------------------------------------
-  *        HCLK(Hz)                               | 168000000
-  *-----------------------------------------------------------------------------
-  *        AHB Prescaler                          | 1
-  *-----------------------------------------------------------------------------
-  *        APB1 Prescaler                         | 4
-  *-----------------------------------------------------------------------------
-  *        APB2 Prescaler                         | 2
-  *-----------------------------------------------------------------------------
-  *        HSE Frequency(Hz)                      | 8000000
-  *-----------------------------------------------------------------------------
-  *        PLL_M                                  | 8
-  *-----------------------------------------------------------------------------
-  *        PLL_N                                  | 336
-  *-----------------------------------------------------------------------------
-  *        PLL_P                                  | 2
-  *-----------------------------------------------------------------------------
-  *        PLL_Q                                  | 7
-  *-----------------------------------------------------------------------------
-  *        PLLI2S_N                               | 271
-  *-----------------------------------------------------------------------------
-  *        PLLI2S_R                               | 2
-  *-----------------------------------------------------------------------------
-  *        I2S input clock                        | NA
-  *-----------------------------------------------------------------------------
-  *        VDD(V)                                 | 3.3
-  *-----------------------------------------------------------------------------
-  *        Main regulator output voltage          | Scale1 mode
-  *-----------------------------------------------------------------------------
-  *        Flash Latency(WS)                      | 5
-  *-----------------------------------------------------------------------------
-  *        Prefetch Buffer                        | ON
-  *-----------------------------------------------------------------------------
-  *        Instruction cache                      | ON
-  *-----------------------------------------------------------------------------
-  *        Data cache                             | ON
-  *-----------------------------------------------------------------------------
-  *        Require 48MHz for USB OTG FS,          | Disabled
-  *        SDIO and RNG clock                     |
-  *-----------------------------------------------------------------------------
-  *=============================================================================
-  ****************************************************************************** 
-  * @attention
-  *
-  * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2>
-  *
-  * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
-  * You may not use this file except in compliance with the License.
-  * You may obtain a copy of the License at:
-  *
-  *        http://www.st.com/software_license_agreement_liberty_v2
-  *
-  * Unless required by applicable law or agreed to in writing, software 
-  * distributed under the License is distributed on an "AS IS" BASIS, 
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  *
-  ******************************************************************************
-  */
-
-/** @addtogroup CMSIS
-  * @{
-  */
-
-/** @addtogroup stm32f4xx_system
-  * @{
-  */  
-  
-/** @addtogroup STM32F4xx_System_Private_Includes
-  * @{
-  */
-
-#include "stm32f4xx.h"
-
-/**
-  * @}
-  */
-
-/** @addtogroup STM32F4xx_System_Private_TypesDefinitions
-  * @{
-  */
-
-/**
-  * @}
-  */
-
-/** @addtogroup STM32F4xx_System_Private_Defines
-  * @{
-  */
-
-/************************* Miscellaneous Configuration ************************/
-/*!< Uncomment the following line if you need to use external SRAM mounted
-     on STM324xG_EVAL/STM324x7I_EVAL boards as data memory  */
-/* #define DATA_IN_ExtSRAM */
-
-/*!< Uncomment the following line if you need to relocate your vector Table in
-     Internal SRAM. */
-/* #define VECT_TAB_SRAM */
-#define VECT_TAB_OFFSET  0x00 /*!< Vector Table base offset field. 
-                                   This value must be a multiple of 0x200. */
-/******************************************************************************/
-
-/************************* PLL Parameters *************************************/
-/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */
-#define PLL_M      8
-#define PLL_N      336
-
-/* SYSCLK = PLL_VCO / PLL_P */
-#define PLL_P      2
-
-/* USB OTG FS, SDIO and RNG Clock =  PLL_VCO / PLLQ */
-#define PLL_Q      7
-
-#define PLLI2S_N  271
-#define PLLI2S_R  2
-
-/******************************************************************************/
-
-/**
-  * @}
-  */
-
-/** @addtogroup STM32F4xx_System_Private_Macros
-  * @{
-  */
-
-/**
-  * @}
-  */
-
-/** @addtogroup STM32F4xx_System_Private_Variables
-  * @{
-  */
-
-  uint32_t SystemCoreClock = 168000000;
-
-  __I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
-
-/**
-  * @}
-  */
-
-/** @addtogroup STM32F4xx_System_Private_FunctionPrototypes
-  * @{
-  */
-
-static void SetSysClock(void);
-#ifdef DATA_IN_ExtSRAM
-  static void SystemInit_ExtMemCtl(void); 
-#endif /* DATA_IN_ExtSRAM */
-
-/**
-  * @}
-  */
-
-/** @addtogroup STM32F4xx_System_Private_Functions
-  * @{
-  */
-
-/**
-  * @brief  Setup the microcontroller system
-  *         Initialize the Embedded Flash Interface, the PLL and update the 
-  *         SystemFrequency variable.
-  * @param  None
-  * @retval None
-  */
-void SystemInit(void)
-{
-  /* FPU settings ------------------------------------------------------------*/
-  #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
-    SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2));  /* set CP10 and CP11 Full Access */
-  #endif
-  /* Reset the RCC clock configuration to the default reset state ------------*/
-  /* Set HSION bit */
-  RCC->CR |= (uint32_t)0x00000001;
-
-  /* Reset CFGR register */
-  RCC->CFGR = 0x00000000;
-
-  /* Reset HSEON, CSSON and PLLON bits */
-  RCC->CR &= (uint32_t)0xFEF6FFFF;
-
-  /* Reset PLLCFGR register */
-  RCC->PLLCFGR = 0x24003010;
-
-  /* Reset HSEBYP bit */
-  RCC->CR &= (uint32_t)0xFFFBFFFF;
-
-  /* Disable all interrupts */
-  RCC->CIR = 0x00000000;
-
-#ifdef DATA_IN_ExtSRAM
-  SystemInit_ExtMemCtl(); 
-#endif /* DATA_IN_ExtSRAM */
-         
-  /* Configure the System clock source, PLL Multiplier and Divider factors, 
-     AHB/APBx prescalers and Flash settings ----------------------------------*/
-  SetSysClock();
-
-  /* Configure the Vector Table location add offset address ------------------*/
-#ifdef VECT_TAB_SRAM
-  SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
-#else
-  SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
-#endif
-}
-
-/**
-   * @brief  Update SystemCoreClock variable according to Clock Register Values.
-  *         The SystemCoreClock variable contains the core clock (HCLK), it can
-  *         be used by the user application to setup the SysTick timer or configure
-  *         other parameters.
-  *           
-  * @note   Each time the core clock (HCLK) changes, this function must be called
-  *         to update SystemCoreClock variable value. Otherwise, any configuration
-  *         based on this variable will be incorrect.         
-  *     
-  * @note   - The system frequency computed by this function is not the real 
-  *           frequency in the chip. It is calculated based on the predefined 
-  *           constant and the selected clock source:
-  *             
-  *           - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
-  *                                              
-  *           - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**)
-  *                          
-  *           - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**) 
-  *             or HSI_VALUE(*) multiplied/divided by the PLL factors.
-  *         
-  *         (*) HSI_VALUE is a constant defined in stm32f4xx.h file (default value
-  *             16 MHz) but the real value may vary depending on the variations
-  *             in voltage and temperature.   
-  *    
-  *         (**) HSE_VALUE is a constant defined in stm32f4xx.h file (default value
-  *              25 MHz), user has to ensure that HSE_VALUE is same as the real
-  *              frequency of the crystal used. Otherwise, this function may
-  *              have wrong result.
-  *                
-  *         - The result of this function could be not correct when using fractional
-  *           value for HSE crystal.
-  *     
-  * @param  None
-  * @retval None
-  */
-void SystemCoreClockUpdate(void)
-{
-  uint32_t tmp = 0, pllvco = 0, pllp = 2, pllsource = 0, pllm = 2;
-  
-  /* Get SYSCLK source -------------------------------------------------------*/
-  tmp = RCC->CFGR & RCC_CFGR_SWS;
-
-  switch (tmp)
-  {
-    case 0x00:  /* HSI used as system clock source */
-      SystemCoreClock = HSI_VALUE;
-      break;
-    case 0x04:  /* HSE used as system clock source */
-      SystemCoreClock = HSE_VALUE;
-      break;
-    case 0x08:  /* PLL used as system clock source */
-
-      /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N
-         SYSCLK = PLL_VCO / PLL_P
-         */    
-      pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) >> 22;
-      pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM;
-      
-      if (pllsource != 0)
-      {
-        /* HSE used as PLL clock source */
-        pllvco = (HSE_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);
-      }
-      else
-      {
-        /* HSI used as PLL clock source */
-        pllvco = (HSI_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);      
-      }
-
-      pllp = (((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) >>16) + 1 ) *2;
-      SystemCoreClock = pllvco/pllp;
-      break;
-    default:
-      SystemCoreClock = HSI_VALUE;
-      break;
-  }
-  /* Compute HCLK frequency --------------------------------------------------*/
-  /* Get HCLK prescaler */
-  tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)];
-  /* HCLK frequency */
-  SystemCoreClock >>= tmp;
-}
-
-/**
-  * @brief  Configures the System clock source, PLL Multiplier and Divider factors, 
-  *         AHB/APBx prescalers and Flash settings
-  * @Note   This function should be called only once the RCC clock configuration  
-  *         is reset to the default reset state (done in SystemInit() function).   
-  * @param  None
-  * @retval None
-  */
-static void SetSysClock(void)
-{
-/******************************************************************************/
-/*            PLL (clocked by HSE) used as System clock source                */
-/******************************************************************************/
-  __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
-  
-  /* Enable HSE */
-  RCC->CR |= ((uint32_t)RCC_CR_HSEON);
- 
-  /* Wait till HSE is ready and if Time out is reached exit */
-  do
-  {
-    HSEStatus = RCC->CR & RCC_CR_HSERDY;
-    StartUpCounter++;
-  } while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
-
-  if ((RCC->CR & RCC_CR_HSERDY) != RESET)
-  {
-    HSEStatus = (uint32_t)0x01;
-  }
-  else
-  {
-    HSEStatus = (uint32_t)0x00;
-  }
-
-  if (HSEStatus == (uint32_t)0x01)
-  {
-    /* Select regulator voltage output Scale 1 mode, System frequency up to 168 MHz */
-    RCC->APB1ENR |= RCC_APB1ENR_PWREN;
-    PWR->CR |= PWR_CR_VOS;
-
-    /* HCLK = SYSCLK / 1*/
-    RCC->CFGR |= RCC_CFGR_HPRE_DIV1;
-      
-    /* PCLK2 = HCLK / 2*/
-    RCC->CFGR |= RCC_CFGR_PPRE2_DIV2;
-    
-    /* PCLK1 = HCLK / 4*/
-    RCC->CFGR |= RCC_CFGR_PPRE1_DIV4;
-
-    /* Configure the main PLL */
-    RCC->PLLCFGR = PLL_M | (PLL_N << 6) | (((PLL_P >> 1) -1) << 16) |
-                   (RCC_PLLCFGR_PLLSRC_HSE) | (PLL_Q << 24);
-
-    /* Enable the main PLL */
-    RCC->CR |= RCC_CR_PLLON;
-
-    /* Wait till the main PLL is ready */
-    while((RCC->CR & RCC_CR_PLLRDY) == 0)
-    {
-    }
-
-    /* Configure the I2S PLL */
-    RCC->PLLI2SCFGR = (PLLI2S_N << 6) | (PLLI2S_R << 28);
-
-    /* Enable the I2S PLL */
-    RCC->CR |= RCC_CR_PLLI2SON;
-
-    /* Wait until the I2S PLL is ready */
-    while (!(RCC->CR & RCC_CR_PLLI2SRDY));
-   
-    /* Configure Flash prefetch, Instruction cache, Data cache and wait state */
-    FLASH->ACR = FLASH_ACR_PRFTEN |FLASH_ACR_ICEN |FLASH_ACR_DCEN |FLASH_ACR_LATENCY_5WS;
-
-    /* Select the main PLL as system clock source */
-    RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));
-    RCC->CFGR |= RCC_CFGR_SW_PLL;
-
-    /* Wait till the main PLL is used as system clock source */
-    while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL);
-    {
-    }
-  }
-  else
-  { /* If HSE fails to start-up, the application will have wrong clock
-         configuration. User can add here some code to deal with this error */
-  }
-
-}
-
-/**
-  * @brief  Setup the external memory controller. Called in startup_stm32f4xx.s 
-  *          before jump to __main
-  * @param  None
-  * @retval None
-  */ 
-#ifdef DATA_IN_ExtSRAM
-/**
-  * @brief  Setup the external memory controller.
-  *         Called in startup_stm32f4xx.s before jump to main.
-  *         This function configures the external SRAM mounted on STM324xG_EVAL/STM324x7I boards
-  *         This SRAM will be used as program data memory (including heap and stack).
-  * @param  None
-  * @retval None
-  */
-void SystemInit_ExtMemCtl(void)
-{
-/*-- GPIOs Configuration -----------------------------------------------------*/
-/*
- +-------------------+--------------------+------------------+------------------+
- +                       SRAM pins assignment                                   +
- +-------------------+--------------------+------------------+------------------+
- | PD0  <-> FSMC_D2  | PE0  <-> FSMC_NBL0 | PF0 <-> FSMC_A0  | PG0 <-> FSMC_A10 |
- | PD1  <-> FSMC_D3  | PE1  <-> FSMC_NBL1 | PF1 <-> FSMC_A1  | PG1 <-> FSMC_A11 |
- | PD4  <-> FSMC_NOE | PE2  <-> FSMC_A23  | PF2 <-> FSMC_A2  | PG2 <-> FSMC_A12 |
- | PD5  <-> FSMC_NWE | PE3  <-> FSMC_A19  | PF3 <-> FSMC_A3  | PG3 <-> FSMC_A13 |
- | PD8  <-> FSMC_D13 | PE4  <-> FSMC_A20  | PF4 <-> FSMC_A4  | PG4 <-> FSMC_A14 |
- | PD9  <-> FSMC_D14 | PE5  <-> FSMC_A21  | PF5 <-> FSMC_A5  | PG5 <-> FSMC_A15 |
- | PD10 <-> FSMC_D15 | PE6  <-> FSMC_A22  | PF12 <-> FSMC_A6 | PG9 <-> FSMC_NE2 |
- | PD11 <-> FSMC_A16 | PE7  <-> FSMC_D4   | PF13 <-> FSMC_A7 |------------------+
- | PD12 <-> FSMC_A17 | PE8  <-> FSMC_D5   | PF14 <-> FSMC_A8 |
- | PD13 <-> FSMC_A18 | PE9  <-> FSMC_D6   | PF15 <-> FSMC_A9 |
- | PD14 <-> FSMC_D0  | PE10 <-> FSMC_D7   |------------------+
- | PD15 <-> FSMC_D1  | PE11 <-> FSMC_D8   |
- +-------------------| PE12 <-> FSMC_D9   |
-                     | PE13 <-> FSMC_D10  |
-                     | PE14 <-> FSMC_D11  |
-                     | PE15 <-> FSMC_D12  |
-                     +--------------------+
-*/
-   /* Enable GPIOD, GPIOE, GPIOF and GPIOG interface clock */
-  RCC->AHB1ENR   |= 0x00000078;
-  
-  /* Connect PDx pins to FSMC Alternate function */
-  GPIOD->AFR[0]  = 0x00cc00cc;
-  GPIOD->AFR[1]  = 0xcccccccc;
-  /* Configure PDx pins in Alternate function mode */  
-  GPIOD->MODER   = 0xaaaa0a0a;
-  /* Configure PDx pins speed to 100 MHz */  
-  GPIOD->OSPEEDR = 0xffff0f0f;
-  /* Configure PDx pins Output type to push-pull */  
-  GPIOD->OTYPER  = 0x00000000;
-  /* No pull-up, pull-down for PDx pins */ 
-  GPIOD->PUPDR   = 0x00000000;
-
-  /* Connect PEx pins to FSMC Alternate function */
-  GPIOE->AFR[0]  = 0xcccccccc;
-  GPIOE->AFR[1]  = 0xcccccccc;
-  /* Configure PEx pins in Alternate function mode */ 
-  GPIOE->MODER   = 0xaaaaaaaa;
-  /* Configure PEx pins speed to 100 MHz */ 
-  GPIOE->OSPEEDR = 0xffffffff;
-  /* Configure PEx pins Output type to push-pull */  
-  GPIOE->OTYPER  = 0x00000000;
-  /* No pull-up, pull-down for PEx pins */ 
-  GPIOE->PUPDR   = 0x00000000;
-
-  /* Connect PFx pins to FSMC Alternate function */
-  GPIOF->AFR[0]  = 0x00cccccc;
-  GPIOF->AFR[1]  = 0xcccc0000;
-  /* Configure PFx pins in Alternate function mode */   
-  GPIOF->MODER   = 0xaa000aaa;
-  /* Configure PFx pins speed to 100 MHz */ 
-  GPIOF->OSPEEDR = 0xff000fff;
-  /* Configure PFx pins Output type to push-pull */  
-  GPIOF->OTYPER  = 0x00000000;
-  /* No pull-up, pull-down for PFx pins */ 
-  GPIOF->PUPDR   = 0x00000000;
-
-  /* Connect PGx pins to FSMC Alternate function */
-  GPIOG->AFR[0]  = 0x00cccccc;
-  GPIOG->AFR[1]  = 0x000000c0;
-  /* Configure PGx pins in Alternate function mode */ 
-  GPIOG->MODER   = 0x00080aaa;
-  /* Configure PGx pins speed to 100 MHz */ 
-  GPIOG->OSPEEDR = 0x000c0fff;
-  /* Configure PGx pins Output type to push-pull */  
-  GPIOG->OTYPER  = 0x00000000;
-  /* No pull-up, pull-down for PGx pins */ 
-  GPIOG->PUPDR   = 0x00000000;
-  
-/*-- FSMC Configuration ------------------------------------------------------*/
-  /* Enable the FSMC interface clock */
-  RCC->AHB3ENR         |= 0x00000001;
-
-  /* Configure and enable Bank1_SRAM2 */
-  FSMC_Bank1->BTCR[2]  = 0x00001011;
-  FSMC_Bank1->BTCR[3]  = 0x00000201;
-  FSMC_Bank1E->BWTR[2] = 0x0fffffff;
-/*
-  Bank1_SRAM2 is configured as follow:
-
-  p.FSMC_AddressSetupTime = 1;
-  p.FSMC_AddressHoldTime = 0;
-  p.FSMC_DataSetupTime = 2;
-  p.FSMC_BusTurnAroundDuration = 0;
-  p.FSMC_CLKDivision = 0;
-  p.FSMC_DataLatency = 0;
-  p.FSMC_AccessMode = FSMC_AccessMode_A;
-
-  FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM2;
-  FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
-  FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM;
-  FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;
-  FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
-  FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;  
-  FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
-  FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
-  FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
-  FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
-  FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
-  FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;
-  FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
-  FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p;
-  FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;
-*/
-}
-#endif /* DATA_IN_ExtSRAM */
-
-
-/**
-  * @}
-  */
-
-/**
-  * @}
-  */
-  
-/**
-  * @}
-  */    
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
--- a/targets/cmsis/TARGET_STM/TARGET_STM32F4XX/system_stm32f4xx.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/**
-  ******************************************************************************
-  * @file    system_stm32f4xx.h
-  * @author  MCD Application Team
-  * @version V1.1.0
-  * @date    11-January-2013
-  * @brief   CMSIS Cortex-M4 Device System Source File for STM32F4xx devices.       
-  ******************************************************************************  
-  * @attention
-  *
-  * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2>
-  *
-  * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
-  * You may not use this file except in compliance with the License.
-  * You may obtain a copy of the License at:
-  *
-  *        http://www.st.com/software_license_agreement_liberty_v2
-  *
-  * Unless required by applicable law or agreed to in writing, software 
-  * distributed under the License is distributed on an "AS IS" BASIS, 
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  *
-  ******************************************************************************  
-  */ 
-
-/** @addtogroup CMSIS
-  * @{
-  */
-
-/** @addtogroup stm32f4xx_system
-  * @{
-  */  
-  
-/**
-  * @brief Define to prevent recursive inclusion
-  */
-#ifndef __SYSTEM_STM32F4XX_H
-#define __SYSTEM_STM32F4XX_H
-
-#ifdef __cplusplus
- extern "C" {
-#endif 
-
-/** @addtogroup STM32F4xx_System_Includes
-  * @{
-  */
-
-/**
-  * @}
-  */
-
-
-/** @addtogroup STM32F4xx_System_Exported_types
-  * @{
-  */
-
-extern uint32_t SystemCoreClock;          /*!< System Clock Frequency (Core Clock) */
-
-
-/**
-  * @}
-  */
-
-/** @addtogroup STM32F4xx_System_Exported_Constants
-  * @{
-  */
-
-/**
-  * @}
-  */
-
-/** @addtogroup STM32F4xx_System_Exported_Macros
-  * @{
-  */
-
-/**
-  * @}
-  */
-
-/** @addtogroup STM32F4xx_System_Exported_Functions
-  * @{
-  */
-  
-extern void SystemInit(void);
-extern void SystemCoreClockUpdate(void);
-/**
-  * @}
-  */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*__SYSTEM_STM32F4XX_H */
-
-/**
-  * @}
-  */
-  
-/**
-  * @}
-  */  
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/targets/hal/TARGET_Freescale/TARGET_KL05Z/PeripheralNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    UART_0 = (int)UART0_BASE
-} UARTName;
-
-#define STDIO_UART_TX     USBTX
-#define STDIO_UART_RX     USBRX
-#define STDIO_UART        UART_0
-
-typedef enum {
-    I2C_0 = (int)I2C0_BASE
-} I2CName;
-
-typedef enum {
-    ADC0_SE0  =  0,
-    ADC0_SE1  =  1,
-    ADC0_SE2  =  2,
-    ADC0_SE3  =  3,
-    ADC0_SE4  =  4,
-    ADC0_SE5  =  5,
-    ADC0_SE6  =  6,
-    ADC0_SE7  =  7,
-    ADC0_SE8  =  8,
-    ADC0_SE9  =  9,
-    ADC0_SE10 =  10,
-    ADC0_SE11 =  11,
-    ADC0_SE12 =  12,
-    ADC0_SE13 =  13
-} ADCName;
-
-typedef enum {
-    DAC_0 = 0
-} DACName;
-
-typedef enum {
-    SPI_0 = (int)SPI0_BASE
-} SPIName;
-
-#define TPM_SHIFT   8
-typedef enum {
-    PWM_1  = (0 << TPM_SHIFT) | (0),  // TPM0 CH0
-    PWM_2  = (0 << TPM_SHIFT) | (1),  // TPM0 CH1
-    PWM_3  = (0 << TPM_SHIFT) | (2),  // TPM0 CH2
-    PWM_4  = (0 << TPM_SHIFT) | (3),  // TPM0 CH3
-    PWM_5  = (0 << TPM_SHIFT) | (4),  // TPM0 CH4
-    PWM_6  = (0 << TPM_SHIFT) | (5),  // TPM0 CH5
-
-    PWM_7  = (1 << TPM_SHIFT) | (0),  // TPM1 CH0
-    PWM_8  = (1 << TPM_SHIFT) | (1),  // TPM1 CH1
-} PWMName;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_Freescale/TARGET_KL05Z/PinNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PINNAMES_H
-#define MBED_PINNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    PIN_INPUT,
-    PIN_OUTPUT
-} PinDirection;
-
-/* PCR - 0x1000 */
-#define PORT_SHIFT  12
-
-typedef enum {
-    PTA0 = 0x0,
-    PTA1 = 0x4,
-    PTA2 = 0x8,
-    PTA3 = 0xc,
-    PTA4 = 0x10,
-    PTA5 = 0x14,
-    PTA6 = 0x18,
-    PTA7 = 0x1c,
-    PTA8 = 0x20,
-    PTA9 = 0x24,
-    PTA10 = 0x28,
-    PTA11 = 0x2c,
-    PTA12 = 0x30,
-    PTA13 = 0x34,
-    PTA14 = 0x38,
-    PTA15 = 0x3c,
-    PTA16 = 0x40,
-    PTA17 = 0x44,
-    PTA18 = 0x48,
-    PTA19 = 0x4c,
-    PTB0 = 0x1000,
-    PTB1 = 0x1004,
-    PTB2 = 0x1008,
-    PTB3 = 0x100c,
-    PTB4 = 0x1010,
-    PTB5 = 0x1014,
-    PTB6 = 0x1018,
-    PTB7 = 0x101c,
-    PTB8 = 0x1020,
-    PTB9 = 0x1024,
-    PTB10 = 0x1028,
-    PTB11 = 0x102c,
-    PTB12 = 0x1030,
-    PTB13 = 0x1034,
-    PTB14 = 0x1038,
-    PTB15 = 0x103c,
-    PTB16 = 0x1040,
-    PTB17 = 0x1044,
-    PTB18 = 0x1048,
-    PTB19 = 0x104c,
-    PTB20 = 0x1050,
-
-    LED_RED   = PTB8,
-    LED_GREEN = PTB9,
-    LED_BLUE  = PTB10,
-
-    // mbed original LED naming
-    LED1 = LED_BLUE,
-    LED2 = LED_GREEN,
-    LED3 = LED_RED,
-    LED4 = LED_RED,
-
-    // USB Pins
-    USBTX = PTB1,
-    USBRX = PTB2,
-
-    // Arduino Headers
-    D0 = PTB2,
-    D1 = PTB1,
-    D2 = PTA11,
-    D3 = PTB5,
-    D4 = PTA10,
-    D5 = PTA12,
-    D6 = PTB6,
-    D7 = PTB7,
-    D8 = PTA10,
-    D9 = PTB11,
-    D10 = PTA5,
-    D11 = PTA7,
-    D12 = PTA6,
-    D13 = PTB0,
-    D14 = PTB4,
-    D15 = PTB3,
-
-    A0 = PTB8,
-    A1 = PTB9,
-    A2 = PTA8,
-    A3 = PTA0,
-    A4 = PTA9,
-    A5 = PTB13,
-
-    // Not connected
-    NC = (int)0xFFFFFFFF
-} PinName;
-
-/* PullDown not available for KL05 */
-typedef enum {
-    PullNone = 0,
-    PullUp   = 2,
-} PinMode;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_Freescale/TARGET_KL05Z/PortNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PORTNAMES_H
-#define MBED_PORTNAMES_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    PortA = 0,
-    PortB = 1
-} PortName;
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/targets/hal/TARGET_Freescale/TARGET_KL05Z/analogin_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "analogin_api.h"
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_ADC[] = {
-    /* A0-A5 pins */
-    {PTA0,  ADC0_SE12, 0},
-    {PTA8,  ADC0_SE3,  0},
-    {PTA9,  ADC0_SE2,  0},
-    {PTB8,  ADC0_SE11, 0},
-    {PTB9,  ADC0_SE10, 0},
-    {PTB13, ADC0_SE13, 0},
-    /* Rest of pins ADC Mux */
-    {PTB2, ADC0_SE4,  0},
-    {PTB1, ADC0_SE5,  0},
-    {PTB5, ADC0_SE1,  0},
-    {PTA12, ADC0_SE0, 0},
-    {PTB10, ADC0_SE9, 0},
-    {PTB11, ADC0_SE8, 0},
-    {PTB7, ADC0_SE7, 0},
-    {PTB0, ADC0_SE6,  0},
-    {NC,    NC,       0}
-};
-
-void analogin_init(analogin_t *obj, PinName pin) {
-    obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
-    if (obj->adc == (uint32_t)NC) {
-        error("ADC pin mapping failed");
-    }
-
-    SIM->SCGC6 |= SIM_SCGC6_ADC0_MASK;
-
-    uint32_t port = (uint32_t)pin >> PORT_SHIFT;
-    SIM->SCGC5 |= 1 << (SIM_SCGC5_PORTA_SHIFT + port);
-
-    ADC0->SC1[1] = ADC_SC1_ADCH(obj->adc);
-
-    ADC0->CFG1 = ADC_CFG1_ADLPC_MASK    // Low-Power Configuration
-               | ADC_CFG1_ADIV(3)       // Clock Divide Select: (Input Clock)/8
-               | ADC_CFG1_ADLSMP_MASK   // Long Sample Time
-               | ADC_CFG1_MODE(1)       // (12)bits Resolution
-               | ADC_CFG1_ADICLK(1);    // Input Clock: (Bus Clock)/2
-
-    ADC0->CFG2 = ADC_CFG2_MUXSEL_MASK   // ADxxb channels are selected
-               | ADC_CFG2_ADACKEN_MASK  // Asynchronous Clock Output Enable
-               | ADC_CFG2_ADHSC_MASK    // High-Speed Configuration
-               | ADC_CFG2_ADLSTS(0);    // Long Sample Time Select
-
-    ADC0->SC2 = ADC_SC2_REFSEL(0);      // Default Voltage Reference
-
-    ADC0->SC3 = ADC_SC3_AVGE_MASK       // Hardware Average Enable
-              | ADC_SC3_AVGS(0);        // 4 Samples Averaged
-
-    pinmap_pinout(pin, PinMap_ADC);
-}
-
-uint16_t analogin_read_u16(analogin_t *obj) {
-    // start conversion
-    ADC0->SC1[0] = ADC_SC1_ADCH(obj->adc);
-
-    // Wait Conversion Complete
-    while ((ADC0->SC1[0] & ADC_SC1_COCO_MASK) != ADC_SC1_COCO_MASK);
-
-    // Return value (12bit)
-    return (uint16_t)ADC0->R[0];
-}
-
-float analogin_read(analogin_t *obj) {
-    uint16_t value = analogin_read_u16(obj);
-    return (float)value * (1.0f / (float)0xFFFF);
-}
-
--- a/targets/hal/TARGET_Freescale/TARGET_KL05Z/analogout_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "analogout_api.h"
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-#define RANGE_12BIT     0xFFF
-
-static const PinMap PinMap_DAC[] = {
-    {PTB1, DAC_0, 0},
-    {NC  , NC   , 0}
-};
-
-void analogout_init(dac_t *obj, PinName pin) {
-    obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
-    if (obj->dac == (uint32_t)NC) {
-        error("DAC pin mapping failed");
-    }
-
-    SIM->SCGC6 |= SIM_SCGC6_DAC0_MASK;
-
-    uint32_t port = (uint32_t)pin >> PORT_SHIFT;
-    SIM->SCGC5 |= 1 << (SIM_SCGC5_PORTA_SHIFT + port);
-
-    DAC0->DAT[obj->dac].DATH = 0;
-    DAC0->DAT[obj->dac].DATL = 0;
-
-    DAC0->C1 = DAC_C1_DACBFMD_MASK;     // One-Time Scan Mode
-
-    DAC0->C0 = DAC_C0_DACEN_MASK        // Enable
-             | DAC_C0_DACSWTRG_MASK;    // Software Trigger
-
-    pinmap_pinout(pin, PinMap_DAC);
-
-    analogout_write_u16(obj, 0);
-}
-
-void analogout_free(dac_t *obj) {
-
-}
-
-static inline void dac_write(dac_t *obj, int value) {
-    DAC0->DAT[obj->dac].DATL = (uint8_t)( value       & 0xFF);
-    DAC0->DAT[obj->dac].DATH = (uint8_t)((value >> 8) & 0xFF);
-}
-
-static inline int dac_read(dac_t *obj) {
-    return ((DAC0->DAT[obj->dac].DATH << 8) | DAC0->DAT[obj->dac].DATL);
-}
-
-void analogout_write(dac_t *obj, float value) {
-    if (value < 0.0) {
-        dac_write(obj, 0);
-    } else if (value > 1.0) {
-        dac_write(obj, RANGE_12BIT);
-    } else {
-        dac_write(obj, value * (float)RANGE_12BIT);
-    }
-}
-
-void analogout_write_u16(dac_t *obj, uint16_t value) {
-    dac_write(obj, value >> 4); // 12-bit
-}
-
-float analogout_read(dac_t *obj) {
-    uint32_t value = dac_read(obj);
-    return (float)value * (1.0f / (float)RANGE_12BIT);
-}
-
-uint16_t analogout_read_u16(dac_t *obj) {
-    uint32_t value = dac_read(obj); // 12-bit
-    return (value << 4) | ((value >> 8) & 0x003F);
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL05Z/device.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_DEVICE_H
-#define MBED_DEVICE_H
-
-#define DEVICE_PORTIN           1
-#define DEVICE_PORTOUT          1
-#define DEVICE_PORTINOUT        1
-
-#define DEVICE_INTERRUPTIN      1
-
-#define DEVICE_ANALOGIN         1
-#define DEVICE_ANALOGOUT        1
-
-#define DEVICE_SERIAL           1
-
-#define DEVICE_I2C              1
-#define DEVICE_I2CSLAVE         1
-
-#define DEVICE_SPI              1
-#define DEVICE_SPISLAVE         1
-
-#define DEVICE_CAN              0
-
-#define DEVICE_RTC              1
-
-#define DEVICE_ETHERNET         0
-
-#define DEVICE_PWMOUT           1
-
-#define DEVICE_SEMIHOST         1
-#define DEVICE_LOCALFILESYSTEM  0
-#define DEVICE_ID_LENGTH       24
-
-#define DEVICE_SLEEP            0
-
-#define DEVICE_DEBUG_AWARENESS  0
-
-#define DEVICE_STDIO_MESSAGES   1
-
-#define DEVICE_ERROR_RED        1
-
-#include "objects.h"
-
-#endif
--- a/targets/hal/TARGET_Freescale/TARGET_KL05Z/gpio_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "gpio_api.h"
-#include "pinmap.h"
-
-uint32_t gpio_set(PinName pin) {
-    pin_function(pin, 1);
-    return 1 << ((pin & 0x7F) >> 2); // 1 << pin number
-}
-
-void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) {
-    if (pin == (uint32_t)NC) {
-        return;
-    }
-
-    obj->pin = pin;
-    obj->mask = gpio_set(pin);
-
-    uint32_t port = (uint32_t)pin >> PORT_SHIFT;
-
-    FGPIO_Type *reg = (FGPIO_Type *)(FPTA_BASE + port * 0x40);
-    obj->reg_set = &reg->PSOR;
-    obj->reg_clr = &reg->PCOR;
-    obj->reg_in  = &reg->PDIR;
-    obj->reg_dir = &reg->PDDR;
-
-    gpio_dir(obj, direction);
-    switch (direction) {
-        case PIN_OUTPUT:
-            pin_mode(pin, PullNone);
-            break;
-        case PIN_INPUT :
-            pin_mode(pin, PullUp);  //down not avail
-            break;
-    }
-}
-
-void gpio_mode(gpio_t *obj, PinMode mode) {
-    pin_mode(obj->pin, mode);
-}
-
-void gpio_dir(gpio_t *obj, PinDirection direction) {
-    switch (direction) {
-        case PIN_INPUT :
-            *obj->reg_dir &= ~obj->mask;
-            break;
-        case PIN_OUTPUT:
-            *obj->reg_dir |=  obj->mask;
-            break;
-    }
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL05Z/gpio_irq_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stddef.h>
-#include "cmsis.h"
-
-#include "gpio_irq_api.h"
-#include "error.h"
-
-#define CHANNEL_NUM    64   // 31 pins on 2 ports
-
-static uint32_t channel_ids[CHANNEL_NUM] = {0};
-static gpio_irq_handler irq_handler;
-
-#define IRQ_DISABLED        (0)
-#define IRQ_RAISING_EDGE    PORT_PCR_IRQC(9)
-#define IRQ_FALLING_EDGE    PORT_PCR_IRQC(10)
-#define IRQ_EITHER_EDGE     PORT_PCR_IRQC(11)
-
-static void handle_interrupt_in(PORT_Type *port, int ch_base) {
-    uint32_t mask = 0, i;
-
-    for (i = 0; i < 32; i++) {
-        uint32_t pmask = (1 << i);
-        if (port->ISFR & pmask) {
-            mask |= pmask;
-            uint32_t id = channel_ids[ch_base + i];
-            if (id == 0) continue;
-
-            FGPIO_Type *gpio;
-            gpio_irq_event event = IRQ_NONE;
-            switch (port->PCR[i] & PORT_PCR_IRQC_MASK) {
-                case IRQ_RAISING_EDGE:
-                    event = IRQ_RISE;
-                    break;
-
-                case IRQ_FALLING_EDGE:
-                    event = IRQ_FALL;
-                    break;
-
-                case IRQ_EITHER_EDGE:
-                    gpio = (port == PORTA) ? (FPTA) : (FPTB);
-                    event = (gpio->PDIR & pmask) ? (IRQ_RISE) : (IRQ_FALL);
-                    break;
-            }
-            if (event != IRQ_NONE) {
-                irq_handler(id, event);
-            }
-        }
-    }
-    port->ISFR = mask;
-}
-
-/* IRQ only on PORTA and PORTB */
-void gpio_irqA(void) {
-    handle_interrupt_in(PORTA, 0);
-}
-
-void gpio_irqB(void) {
-    handle_interrupt_in(PORTB, 32);
-}
-
-int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id) {
-    if (pin == NC) return -1;
-
-    irq_handler = handler;
-
-    obj->port = pin >> PORT_SHIFT;
-    obj->pin = (pin & 0x7F) >> 2;
-
-    uint32_t ch_base, vector;
-    IRQn_Type irq_n;
-    switch (obj->port) {
-      case PortA:
-          ch_base = 0;
-          irq_n = PORTA_IRQn;
-          vector = (uint32_t)gpio_irqA;
-          break;
-
-      case PortB:
-          ch_base = 32;
-          irq_n = PORTB_IRQn;
-          vector = (uint32_t)gpio_irqB;
-          break;
-
-      default:
-          error("gpio_irq only supported on Port A and B\n");
-          break;
-    }
-    NVIC_SetVector(irq_n, vector);
-    NVIC_EnableIRQ(irq_n);
-
-    obj->ch = ch_base + obj->pin;
-    channel_ids[obj->ch] = id;
-
-    return 0;
-}
-
-void gpio_irq_free(gpio_irq_t *obj) {
-    channel_ids[obj->ch] = 0;
-}
-
-void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
-    PORT_Type *port = (PORT_Type *)(PORTA_BASE + 0x1000 * obj->port);
-
-    uint32_t irq_settings = IRQ_DISABLED;
-
-    switch (port->PCR[obj->pin] & PORT_PCR_IRQC_MASK) {
-        case IRQ_DISABLED:
-            if (enable) {
-                irq_settings = (event == IRQ_RISE) ? (IRQ_RAISING_EDGE) : (IRQ_FALLING_EDGE);
-            }
-            break;
-
-        case IRQ_RAISING_EDGE:
-            if (enable) {
-                irq_settings = (event == IRQ_RISE) ? (IRQ_RAISING_EDGE) : (IRQ_EITHER_EDGE);
-            } else {
-                if (event == IRQ_FALL)
-                    irq_settings = IRQ_RAISING_EDGE;
-            }
-            break;
-
-        case IRQ_FALLING_EDGE:
-            if (enable) {
-                irq_settings = (event == IRQ_FALL) ? (IRQ_FALLING_EDGE) : (IRQ_EITHER_EDGE);
-            } else {
-                if (event == IRQ_RISE)
-                    irq_settings = IRQ_FALLING_EDGE;
-            }
-            break;
-
-        case IRQ_EITHER_EDGE:
-            if (enable) {
-                irq_settings = IRQ_EITHER_EDGE;
-            } else {
-                irq_settings = (event == IRQ_RISE) ? (IRQ_FALLING_EDGE) : (IRQ_RAISING_EDGE);
-            }
-            break;
-    }
-
-    // Interrupt configuration and clear interrupt
-    port->PCR[obj->pin] = (port->PCR[obj->pin] & ~PORT_PCR_IRQC_MASK) | irq_settings | PORT_PCR_ISF_MASK;
-}
-
-void gpio_irq_enable(gpio_irq_t *obj) {
-    if (obj->port == PortA) {
-        NVIC_EnableIRQ(PORTA_IRQn);
-    } else if (obj->port == PortB) {
-        NVIC_EnableIRQ(PORTB_IRQn);
-    }
-}
-
-void gpio_irq_disable(gpio_irq_t *obj) {
-    if (obj->port == PortA) {
-        NVIC_DisableIRQ(PORTA_IRQn);
-    } else if (obj->port == PortB) {
-        NVIC_DisableIRQ(PORTB_IRQn);
-    }
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL05Z/gpio_object.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_GPIO_OBJECT_H
-#define MBED_GPIO_OBJECT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
-    PinName  pin;
-    uint32_t mask;
-
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_set;
-    __IO uint32_t *reg_clr;
-    __I  uint32_t *reg_in;
-} gpio_t;
-
-static inline void gpio_write(gpio_t *obj, int value) {
-    if (value) {
-        *obj->reg_set = obj->mask;
-    } else {
-        *obj->reg_clr = obj->mask;
-    }
-}
-
-static inline int gpio_read(gpio_t *obj) {
-    return ((*obj->reg_in & obj->mask) ? 1 : 0);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_Freescale/TARGET_KL05Z/i2c_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,400 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "i2c_api.h"
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_I2C_SDA[] = {
-    {PTB4, I2C_0, 2},
-    {NC  , NC   , 0}
-};
-
-static const PinMap PinMap_I2C_SCL[] = {
-    {PTB3, I2C_0, 2},
-    {NC  , NC   , 0}
-};
-
-static const uint16_t ICR[0x40] = {
-      20,   22,   24,   26,   28,
-      30,   34,   40,   28,   32,
-      36,   40,   44,   48,   56,
-      68,   48,   56,   64,   72,
-      80,   88,  104,  128,   80,
-      96,  112,  128,  144,  160,
-      192,  240,  160,  192,  224,
-      256,  288,  320,  384,  480,
-      320,  384,  448,  512,  576,
-      640,  768,  960,  640,  768,
-      896, 1024, 1152, 1280, 1536,
-      1920, 1280, 1536, 1792, 2048,
-      2304, 2560, 3072, 3840
-};
-
-static uint8_t first_read;
-
-void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
-    // determine the I2C to use
-    I2CName i2c_sda = (I2CName)pinmap_peripheral(sda, PinMap_I2C_SDA);
-    I2CName i2c_scl = (I2CName)pinmap_peripheral(scl, PinMap_I2C_SCL);
-    obj->i2c = (I2C_Type*)pinmap_merge(i2c_sda, i2c_scl);
-    if ((int)obj->i2c == NC) {
-        error("I2C pin mapping failed");
-    }
-
-    // enable clocks
-    switch ((int)obj->i2c) {
-        case I2C_0:
-            SIM->SCGC5 |= SIM_SCGC5_PORTB_MASK;
-            SIM->SCGC4 |= SIM_SCGC4_I2C0_MASK;
-            break;
-    }
-
-    // set default frequency at 100k
-    i2c_frequency(obj, 100000);
-
-    // enable I2C interface
-    obj->i2c->C1 |= 0x80;
-
-    pinmap_pinout(sda, PinMap_I2C_SDA);
-    pinmap_pinout(scl, PinMap_I2C_SCL);
-
-    first_read = 1;
-}
-
-int i2c_start(i2c_t *obj) {
-    // if we are in the middle of a transaction
-    // activate the repeat_start flag
-    if (obj->i2c->S & I2C_S_BUSY_MASK) {
-        obj->i2c->C1 |= 0x04;
-    } else {
-        obj->i2c->C1 |= I2C_C1_MST_MASK;
-        obj->i2c->C1 |= I2C_C1_TX_MASK;
-    }
-    first_read = 1;
-    return 0;
-}
-
-int i2c_stop(i2c_t *obj) {
-    volatile uint32_t n = 0;
-    obj->i2c->C1 &= ~I2C_C1_MST_MASK;
-    obj->i2c->C1 &= ~I2C_C1_TX_MASK;
-
-    // It seems that there are timing problems
-    // when there is no waiting time after a STOP.
-    // This wait is also included on the samples
-    // code provided with the freedom board
-    for (n = 0; n < 100; n++) __NOP();
-    first_read = 1;
-    return 0;
-}
-
-static int timeout_status_poll(i2c_t *obj, uint32_t mask) {
-    uint32_t i, timeout = 1000;
-
-    for (i = 0; i < timeout; i++) {
-        if (obj->i2c->S & mask) {
-            return 0;
-        }
-    }
-
-    return 1;
-}
-
-// this function waits the end of a tx transfer and return the status of the transaction:
-//    0: OK ack received
-//    1: OK ack not received
-//    2: failure
-static int i2c_wait_end_tx_transfer(i2c_t *obj) {
-
-    // wait for the interrupt flag
-    if (timeout_status_poll(obj, I2C_S_IICIF_MASK)) {
-        return 2;
-    }
-
-    obj->i2c->S |= I2C_S_IICIF_MASK;
-
-    // wait transfer complete
-    if (timeout_status_poll(obj, I2C_S_TCF_MASK)) {
-        return 2;
-    }
-
-    // check if we received the ACK or not
-    return obj->i2c->S & I2C_S_RXAK_MASK ? 1 : 0;
-}
-
-// this function waits the end of a rx transfer and return the status of the transaction:
-//    0: OK
-//    1: failure
-static int i2c_wait_end_rx_transfer(i2c_t *obj) {
-    // wait for the end of the rx transfer
-    if (timeout_status_poll(obj, I2C_S_IICIF_MASK)) {
-        return 1;
-    }
-
-    obj->i2c->S |= I2C_S_IICIF_MASK;
-
-    return 0;
-}
-
-static void i2c_send_nack(i2c_t *obj) {
-    obj->i2c->C1 |= I2C_C1_TXAK_MASK; // NACK
-}
-
-static void i2c_send_ack(i2c_t *obj) {
-    obj->i2c->C1 &= ~I2C_C1_TXAK_MASK; // ACK
-}
-
-static int i2c_do_write(i2c_t *obj, int value) {
-    // write the data
-    obj->i2c->D = value;
-
-    // init and wait the end of the transfer
-    return i2c_wait_end_tx_transfer(obj);
-}
-
-static int i2c_do_read(i2c_t *obj, char * data, int last) {
-    if (last) {
-        i2c_send_nack(obj);
-    } else {
-        i2c_send_ack(obj);
-    }
-
-    *data = (obj->i2c->D & 0xFF);
-
-    // start rx transfer and wait the end of the transfer
-    return i2c_wait_end_rx_transfer(obj);
-}
-
-void i2c_frequency(i2c_t *obj, int hz) {
-    uint8_t icr = 0;
-    uint8_t mult = 0;
-    uint32_t error = 0;
-    uint32_t p_error = 0xffffffff;
-    uint32_t ref = 0;
-    uint8_t i, j;
-    // bus clk
-    uint32_t PCLK = 23986176u;
-    uint32_t pulse;
-
-    // we look for the values that minimize the error
-
-    // test all the MULT values
-    for (i = 1; i < 5; i*=2) {
-        for (j = 0; j < 0x40; j++) {
-            ref = PCLK / (i*ICR[j]);
-            error = (ref > hz) ? ref - hz : hz - ref;
-            if (error < p_error) {
-                icr = j;
-                mult = i/2;
-                p_error = error;
-            }
-        }
-    }
-    pulse = icr | (mult << 6);
-
-    // I2C Rate
-    obj->i2c->F = pulse;
-}
-
-int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) {
-    uint8_t count;
-    char dummy_read, *ptr;
-
-    if (i2c_start(obj)) {
-        i2c_stop(obj);
-        return 1;
-    }
-
-    if (i2c_do_write(obj, (address | 0x01))) {
-        i2c_stop(obj);
-        return 1;
-    }
-
-    // set rx mode
-    obj->i2c->C1 &= ~I2C_C1_TX_MASK;
-
-    // Read in bytes
-    for (count = 0; count < (length); count++) {
-        ptr = (count == 0) ? &dummy_read : &data[count - 1];
-        uint8_t stop_ = (count == (length - 1)) ? 1 : 0;
-        if (i2c_do_read(obj, ptr, stop_)) {
-            i2c_stop(obj);
-            return 1;
-        }
-    }
-
-    // If not repeated start, send stop.
-    if (stop) {
-        i2c_stop(obj);
-    }
-
-    // last read
-    data[count-1] = obj->i2c->D;
-
-    return 0;
-}
-int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) {
-    int i;
-
-    if (i2c_start(obj)) {
-        i2c_stop(obj);
-        return 1;
-    }
-
-    if (i2c_do_write(obj, (address & 0xFE))) {
-        i2c_stop(obj);
-        return 1;
-    }
-
-    for (i = 0; i < length; i++) {
-        if(i2c_do_write(obj, data[i])) {
-            i2c_stop(obj);
-            return 1;
-        }
-    }
-
-    if (stop) {
-        i2c_stop(obj);
-    }
-
-    return 0;
-}
-
-void i2c_reset(i2c_t *obj) {
-    i2c_stop(obj);
-}
-
-int i2c_byte_read(i2c_t *obj, int last) {
-    char data;
-
-    // set rx mode
-    obj->i2c->C1 &= ~I2C_C1_TX_MASK;
-
-    if(first_read) {
-        // first dummy read
-        i2c_do_read(obj, &data, 0);
-        first_read = 0;
-    }
-
-    if (last) {
-        // set tx mode
-        obj->i2c->C1 |= I2C_C1_TX_MASK;
-        return obj->i2c->D;
-    }
-
-    i2c_do_read(obj, &data, last);
-
-    return data;
-}
-
-int i2c_byte_write(i2c_t *obj, int data) {
-    first_read = 1;
-
-    // set tx mode
-    obj->i2c->C1 |= I2C_C1_TX_MASK;
-
-    return !i2c_do_write(obj, (data & 0xFF));
-}
-
-
-void i2c_slave_mode(i2c_t *obj, int enable_slave) {
-    if (enable_slave) {
-        // set slave mode
-        obj->i2c->C1 &= ~I2C_C1_MST_MASK;
-        obj->i2c->C1 |= I2C_C1_IICIE_MASK;
-    } else {
-        // set master mode
-        obj->i2c->C1 |= I2C_C1_MST_MASK;
-    }
-}
-
-int i2c_slave_receive(i2c_t *obj) {
-    switch(obj->i2c->S) {
-        // read addressed
-        case 0xE6:
-            return 1;
-        // write addressed
-        case 0xE2:
-            return 3;
-        default:
-            return 0;
-    }
-}
-
-int i2c_slave_read(i2c_t *obj, char *data, int length) {
-    uint8_t dummy_read, count;
-    uint8_t *ptr;
-
-    // set rx mode
-    obj->i2c->C1 &= ~I2C_C1_TX_MASK;
-
-    // first dummy read
-    dummy_read = obj->i2c->D;
-    if(i2c_wait_end_rx_transfer(obj)) {
-        return 0;
-    }
-
-    // read address
-    dummy_read = obj->i2c->D;
-    if(i2c_wait_end_rx_transfer(obj)) {
-        return 0;
-    }
-
-    // read (length - 1) bytes
-    for (count = 0; count < (length - 1); count++) {
-        data[count] = obj->i2c->D;
-        if(i2c_wait_end_rx_transfer(obj)) {
-            return 0;
-        }
-    }
-
-    // read last byte
-    ptr = (length == 0) ? &dummy_read : (uint8_t *)&data[count];
-    *ptr = obj->i2c->D;
-
-    return (length) ? (count + 1) : 0;
-}
-
-int i2c_slave_write(i2c_t *obj, const char *data, int length) {
-    uint32_t i, count = 0;
-
-    // set tx mode
-    obj->i2c->C1 |= I2C_C1_TX_MASK;
-
-    for (i = 0; i < length; i++) {
-        if(i2c_do_write(obj, data[count++]) == 2) {
-            return 0;
-        }
-    }
-
-    // set rx mode
-    obj->i2c->C1 &= ~I2C_C1_TX_MASK;
-
-    // dummy rx transfer needed
-    // otherwise the master cannot generate a stop bit
-    obj->i2c->D;
-    if(i2c_wait_end_rx_transfer(obj) == 2) {
-        return 0;
-    }
-
-    return count;
-}
-
-void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask) {
-    obj->i2c->A1 = address & 0xfe;
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL05Z/objects.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_OBJECTS_H
-#define MBED_OBJECTS_H
-
-#include "cmsis.h"
-#include "PortNames.h"
-#include "PeripheralNames.h"
-#include "PinNames.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct gpio_irq_s {
-    uint32_t port;
-    uint32_t pin;
-    uint32_t ch;
-};
-
-struct port_s {
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_out;
-    __I  uint32_t *reg_in;
-    PortName port;
-    uint32_t mask;
-};
-
-struct pwmout_s {
-    __IO uint32_t *MOD;
-    __IO uint32_t *CNT;
-    __IO uint32_t *CnV;
-};
-
-struct serial_s {
-    UARTLP_Type *uart;
-    int index;
-};
-
-struct analogin_s {
-    ADCName adc;
-};
-
-struct dac_s {
-    DACName dac;
-};
-
-struct i2c_s {
-    I2C_Type *i2c;
-};
-
-struct spi_s {
-    SPI_Type *spi;
-};
-
-#include "gpio_object.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_Freescale/TARGET_KL05Z/pinmap.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "pinmap.h"
-#include "error.h"
-
-void pin_function(PinName pin, int function) {
-    if (pin == (uint32_t)NC) {
-        return;
-    }
-
-    uint32_t port_n = (uint32_t)pin >> PORT_SHIFT;
-    uint32_t pin_n  = (uint32_t)(pin & 0x7C) >> 2;
-
-    SIM->SCGC5 |= 1 << (SIM_SCGC5_PORTA_SHIFT + port_n);
-    __IO uint32_t* pin_pcr = &(((PORT_Type *)(PORTA_BASE + (1 << PORT_SHIFT) * port_n)))->PCR[pin_n];
-
-    // pin mux bits: [10:8] -> 11100000000 = (0x700)
-    *pin_pcr = (*pin_pcr & ~0x700) | (function << 8);
-}
-
-void pin_mode(PinName pin, PinMode mode) {
-    if (pin == (uint32_t)NC) {
-        return;
-    }
-
-    __IO uint32_t* pin_pcr = (__IO uint32_t*)(PORTA_BASE + pin);
-
-    // pin pullup bits: [1:0] -> 11 = (0x3)
-    *pin_pcr = (*pin_pcr & ~0x3) | mode;
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL05Z/port_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "port_api.h"
-#include "pinmap.h"
-#include "gpio_api.h"
-
-PinName port_pin(PortName port, int pin_n) {
-    return (PinName)((port << PORT_SHIFT) | (pin_n << 2));
-}
-
-void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
-    obj->port = port;
-    obj->mask = mask;
-
-    FGPIO_Type *reg = (FGPIO_Type *)(FPTA_BASE + port * 0x40);
-
-    obj->reg_out = &reg->PDOR;
-    obj->reg_in  = &reg->PDIR;
-    obj->reg_dir = &reg->PDDR;
-
-    uint32_t i;
-    // The function is set per pin: reuse gpio logic
-    for (i=0; i<32; i++) {
-        if (obj->mask & (1<<i)) {
-            gpio_set(port_pin(obj->port, i));
-        }
-    }
-
-    port_dir(obj, dir);
-}
-
-void port_mode(port_t *obj, PinMode mode) {
-    uint32_t i;
-    // The mode is set per pin: reuse pinmap logic
-    for (i=0; i<32; i++) {
-        if (obj->mask & (1<<i)) {
-            pin_mode(port_pin(obj->port, i), mode);
-        }
-    }
-}
-
-void port_dir(port_t *obj, PinDirection dir) {
-    switch (dir) {
-        case PIN_INPUT:
-            *obj->reg_dir &= ~obj->mask;
-            break;
-        case PIN_OUTPUT:
-            *obj->reg_dir |=  obj->mask;
-            break;
-    }
-}
-
-void port_write(port_t *obj, int value) {
-    *obj->reg_out = (*obj->reg_in & ~obj->mask) | (value & obj->mask);
-}
-
-int port_read(port_t *obj) {
-    return (*obj->reg_in & obj->mask);
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL05Z/pwmout_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "pwmout_api.h"
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_PWM[] = {
-    // LEDs
-    {LED_RED  , PWM_4 , 2}, // PTB8 , TPM0 CH3
-    {LED_GREEN, PWM_3,  2}, // PTB9 , TPM0 CH2
-    {LED_BLUE , PWM_2 , 2}, // PTB10, TPM0 CH1
-
-    // Arduino digital pinout
-    {D3,  PWM_8 , 2}, // PTB5 , TPM1 CH1
-    {D5,  PWM_7 , 2}, // PTA12, TPM1 CH0
-    {D6,  PWM_4 , 2}, // PTB6 , TPM0 CH3
-    {D7,  PWM_3 , 2}, // PTB7 , TPM0 CH2
-    {D8,  PWM_2 , 2}, // PTB10, TPM0 CH1
-    {D9,  PWM_1 , 2}, // PTB11, TPM0 CH0
-    {D10, PWM_6 , 2}, // PTA5 , TPM0 CH5
-    {D12, PWM_5 , 2}, // PTA6 , TPM0 CH4
-    {NC , NC    , 0}
-};
-
-#define PWM_CLOCK_MHZ       (0.75) // (48)MHz / 64 = (0.75)MHz
-
-void pwmout_init(pwmout_t* obj, PinName pin) {
-    // determine the channel
-    PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM);
-    if (pwm == (uint32_t)NC) {
-        error("PwmOut pin mapping failed");
-    }
-
-    unsigned int port = (unsigned int)pin >> PORT_SHIFT;
-    unsigned int tpm_n = (pwm >> TPM_SHIFT);
-    unsigned int ch_n = (pwm & 0xFF);
-
-    SIM->SCGC5 |= 1 << (SIM_SCGC5_PORTA_SHIFT + port);
-    SIM->SCGC6 |= 1 << (SIM_SCGC6_TPM0_SHIFT + tpm_n);
-    SIM->SOPT2 |= SIM_SOPT2_TPMSRC(1); // Clock source: MCGFLLCLK or MCGPLLCLK
-
-    TPM_Type *tpm = (TPM_Type *)(TPM0_BASE + 0x1000 * tpm_n);
-    tpm->SC = TPM_SC_CMOD(1) | TPM_SC_PS(6); // (48)MHz / 64 = (0.75)MHz
-    tpm->CONTROLS[ch_n].CnSC = (TPM_CnSC_MSB_MASK | TPM_CnSC_ELSB_MASK); // No Interrupts; High True pulses on Edge Aligned PWM
-
-    obj->CnV = &tpm->CONTROLS[ch_n].CnV;
-    obj->MOD = &tpm->MOD;
-    obj->CNT = &tpm->CNT;
-
-    // default to 20ms: standard for servos, and fine for e.g. brightness control
-    pwmout_period_ms(obj, 20);
-    pwmout_write(obj, 0);
-
-    // Wire pinout
-    pinmap_pinout(pin, PinMap_PWM);
-}
-
-void pwmout_free(pwmout_t* obj) {
-
-}
-
-void pwmout_write(pwmout_t* obj, float value) {
-    if (value < 0.0) {
-        value = 0.0;
-    } else if (value > 1.0) {
-        value = 1.0;
-    }
-
-    *obj->CnV = (uint32_t)((float)(*obj->MOD) * value);
-    *obj->CNT = 0;
-}
-
-float pwmout_read(pwmout_t* obj) {
-    float v = (float)(*obj->CnV) / (float)(*obj->MOD);
-    return (v > 1.0) ? (1.0) : (v);
-}
-
-void pwmout_period(pwmout_t* obj, float seconds) {
-    pwmout_period_us(obj, seconds * 1000000.0f);
-}
-
-void pwmout_period_ms(pwmout_t* obj, int ms) {
-    pwmout_period_us(obj, ms * 1000);
-}
-
-// Set the PWM period, keeping the duty cycle the same.
-void pwmout_period_us(pwmout_t* obj, int us) {
-    float dc = pwmout_read(obj);
-    *obj->MOD = PWM_CLOCK_MHZ * us;
-    pwmout_write(obj, dc);
-}
-
-void pwmout_pulsewidth(pwmout_t* obj, float seconds) {
-    pwmout_pulsewidth_us(obj, seconds * 1000000.0f);
-}
-
-void pwmout_pulsewidth_ms(pwmout_t* obj, int ms) {
-    pwmout_pulsewidth_us(obj, ms * 1000);
-}
-
-void pwmout_pulsewidth_us(pwmout_t* obj, int us) {
-    *obj->CnV = PWM_CLOCK_MHZ * us;
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL05Z/rtc_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "rtc_api.h"
-
-static void init(void) {
-    // enable RTC clock
-    SIM->SCGC6 |= SIM_SCGC6_RTC_MASK;
-
-    // select OSC32 as RTC clock source
-    SIM->SOPT1 &= ~SIM_SOPT1_OSC32KSEL_MASK;
-
-}
-
-void rtc_init(void) {
-    uint32_t i;
-    init();
-
-    //Configure the TSR. default value: 1
-    RTC->TSR = 1;
-
-    RTC->CR |= RTC_CR_OSCE_MASK;
-
-    //delay for OSCE stabilization
-    for(i=0; i<0x1000; i++) __NOP();
-
-    // enable counter
-    RTC->SR |= RTC_SR_TCE_MASK;
-}
-
-void rtc_free(void) {
-    // [TODO]
-}
-
-
-int rtc_isenabled(void) {
-    // even if the RTC module is enabled,
-    // as we use RTC_CLKIN and an external clock,
-    // we need to reconfigure the pins. That is why we
-    // call init() if the rtc is enabled
-
-    // if RTC not enabled return 0
-    SIM->SCGC5 |= SIM_SCGC5_PORTA_MASK;
-    SIM->SCGC6 |= SIM_SCGC6_RTC_MASK;
-    if ((RTC->SR & RTC_SR_TCE_MASK) == 0) {
-        return 0;
-    }
-
-    init();
-    return 1;
-}
-
-time_t rtc_read(void) {
-    return RTC->TSR;
-}
-
-void rtc_write(time_t t) {
-    // disable counter
-    RTC->SR &= ~RTC_SR_TCE_MASK;
-
-    // we do not write 0 into TSR
-    // to avoid invalid time
-    if (t == 0) {
-        t = 1;
-    }
-
-    // write seconds
-    RTC->TSR = t;
-
-    // re-enable counter
-    RTC->SR |= RTC_SR_TCE_MASK;
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL05Z/serial_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,288 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "serial_api.h"
-
-// math.h required for floating point operations for baud rate calculation
-#include <math.h>
-
-#include <string.h>
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-#define UART_CLOCK_HZ 47972352u
-#define UART_NUM    1
-
-static const PinMap PinMap_UART_TX[] = {
-    {PTB1, UART_0, 2},
-    {NC  , NC    , 0}
-};
-
-static const PinMap PinMap_UART_RX[] = {
-    {PTB2, UART_0, 2},
-    {NC  , NC    , 0}
-};
-
-static uint32_t serial_irq_ids[UART_NUM] = {0};
-static uart_irq_handler irq_handler;
-
-int stdio_uart_inited = 0;
-serial_t stdio_uart;
-
-void serial_init(serial_t *obj, PinName tx, PinName rx) {
-    // determine the UART to use
-    UARTName uart_tx = (UARTName)pinmap_peripheral(tx, PinMap_UART_TX);
-    UARTName uart_rx = (UARTName)pinmap_peripheral(rx, PinMap_UART_RX);
-    UARTName uart = (UARTName)pinmap_merge(uart_tx, uart_rx);
-    if ((int)uart == NC) {
-        error("Serial pinout mapping failed");
-    }
-
-    obj->uart = (UARTLP_Type *)uart;
-    // enable clk
-    switch (uart) {
-        case UART_0:
-            SIM->SOPT2 |= 1 << SIM_SOPT2_UART0SRC_SHIFT;
-            SIM->SCGC5 |= SIM_SCGC5_PORTB_MASK;
-            SIM->SCGC4 |= SIM_SCGC4_UART0_MASK;
-            break;
-    }
-    // Disable UART before changing registers
-    obj->uart->C2 &= ~(UART0_C2_RE_MASK | UART0_C2_TE_MASK);
-
-    switch (uart) {
-        case UART_0:
-            obj->index = 0;
-            break;
-    }
-
-    // set default baud rate and format
-    serial_baud  (obj, 9600);
-    serial_format(obj, 8, ParityNone, 1);
-
-    // pinout the chosen uart
-    pinmap_pinout(tx, PinMap_UART_TX);
-    pinmap_pinout(rx, PinMap_UART_RX);
-
-    // set rx/tx pins in PullUp mode
-    pin_mode(tx, PullUp);
-    pin_mode(rx, PullUp);
-
-    obj->uart->C2 |= (UART0_C2_RE_MASK | UART0_C2_TE_MASK);
-
-    if (uart == STDIO_UART) {
-        stdio_uart_inited = 1;
-        memcpy(&stdio_uart, obj, sizeof(serial_t));
-    }
-}
-
-void serial_free(serial_t *obj) {
-    serial_irq_ids[obj->index] = 0;
-}
-
-void serial_baud(serial_t *obj, int baudrate) {
-    // save C2 state
-    uint8_t c2_state = (obj->uart->C2 & (UART0_C2_RE_MASK | UART0_C2_TE_MASK));
-
-    // Disable UART before changing registers
-    obj->uart->C2 &= ~(UART0_C2_RE_MASK | UART0_C2_TE_MASK);
-
-    // First we check to see if the basic divide with no DivAddVal/MulVal
-    // ratio gives us an integer result. If it does, we set DivAddVal = 0,
-    // MulVal = 1. Otherwise, we search the valid ratio value range to find
-    // the closest match. This could be more elegant, using search methods
-    // and/or lookup tables, but the brute force method is not that much
-    // slower, and is more maintainable.
-    uint16_t DL = UART_CLOCK_HZ / (16 * baudrate);
-
-    // set BDH and BDL
-    obj->uart->BDH = (obj->uart->BDH & ~(0x1f)) | ((DL >> 8) & 0x1f);
-    obj->uart->BDL = (obj->uart->BDL & ~(0xff)) | ((DL >> 0) & 0xff);
-
-    // restore C2 state
-    obj->uart->C2 |= c2_state;
-}
-
-void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits) {
-    uint8_t m10 = 0;
-
-    // save C2 state
-    uint8_t c2_state = (obj->uart->C2 & (UART0_C2_RE_MASK | UART0_C2_TE_MASK));
-
-    // Disable UART before changing registers
-    obj->uart->C2 &= ~(UART0_C2_RE_MASK | UART0_C2_TE_MASK);
-
-    // 8 data bits = 0 ... 9 data bits = 1
-    if ((data_bits < 8) || (data_bits > 9)) {
-        error("Invalid number of bits (%d) in serial format, should be 8..9\r\n", data_bits);
-    }
-    data_bits -= 8;
-
-    uint8_t parity_enable, parity_select;
-    switch (parity) {
-        case ParityNone: parity_enable = 0; parity_select = 0; break;
-        case ParityOdd : parity_enable = 1; parity_select = 1; data_bits++; break;
-        case ParityEven: parity_enable = 1; parity_select = 0; data_bits++; break;
-        default:
-            error("Invalid serial parity setting\r\n");
-            return;
-    }
-
-    // 1 stop bits = 0, 2 stop bits = 1
-    if ((stop_bits != 1) && (stop_bits != 2)) {
-        error("Invalid stop bits specified\r\n");
-    }
-    stop_bits -= 1;
-
-    // 9 data bits + parity
-    if (data_bits == 2) {
-        // only uart0 supports 10 bit communication
-        if (obj->index != 0) {
-            error("Invalid number of bits (9) to be used with parity\r\n");
-        }
-        data_bits = 0;
-        m10 = 1;
-    }
-
-    // data bits, parity and parity mode
-    obj->uart->C1 = ((data_bits << 4)
-                  |  (parity_enable << 1)
-                  |  (parity_select << 0));
-
-    // enable 10bit mode if needed
-    if (obj->index == 0) {
-        obj->uart->C4 &= ~UARTLP_C4_M10_MASK;
-        obj->uart->C4 |= (m10 << UARTLP_C4_M10_SHIFT);
-    }
-
-    // stop bits
-    obj->uart->BDH &= ~UART0_BDH_SBNS_MASK;
-    obj->uart->BDH |= (stop_bits << UART0_BDH_SBNS_SHIFT);
-
-    // restore C2 state
-    obj->uart->C2 |= c2_state;
-}
-
-static inline void uart_irq(uint8_t status, uint32_t index) {
-    if (serial_irq_ids[index] != 0) {
-        if (status & UART0_S1_TDRE_MASK)
-            irq_handler(serial_irq_ids[index], TxIrq);
-
-        if (status & UART0_S1_RDRF_MASK)
-            irq_handler(serial_irq_ids[index], RxIrq);
-    }
-}
-
-void uart0_irq() {
-    uart_irq(UART0->S1, 0);
-    if (UART0->S1 & UART0_S1_OR_MASK)
-        UART0->S1 |= UART0_S1_OR_MASK;
-}
-
-void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id) {
-    irq_handler = handler;
-    serial_irq_ids[obj->index] = id;
-}
-
-void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) {
-    IRQn_Type irq_n = (IRQn_Type)0;
-    uint32_t vector = 0;
-    switch ((int)obj->uart) {
-        case UART_0:
-            irq_n=UART0_IRQn;
-            vector = (uint32_t)&uart0_irq;
-            break;
-    }
-
-    if (enable) {
-        switch (irq) {
-            case RxIrq:
-                obj->uart->C2 |= (UART0_C2_RIE_MASK);
-                break;
-            case TxIrq:
-                obj->uart->C2 |= (UART0_C2_TIE_MASK);
-                break;
-        }
-        NVIC_SetVector(irq_n, vector);
-        NVIC_EnableIRQ(irq_n);
-
-    } else { // disable
-        int all_disabled = 0;
-        SerialIrq other_irq = (irq == RxIrq) ? (TxIrq) : (RxIrq);
-        switch (irq) {
-            case RxIrq:
-                obj->uart->C2 &= ~(UART0_C2_RIE_MASK);
-                break;
-            case TxIrq:
-                obj->uart->C2 &= ~(UART0_C2_TIE_MASK);
-                break;
-        }
-        switch (other_irq) {
-            case RxIrq:
-                all_disabled = (obj->uart->C2 & (UART0_C2_RIE_MASK)) == 0;
-                break;
-            case TxIrq:
-                all_disabled = (obj->uart->C2 & (UART0_C2_TIE_MASK)) == 0;
-                break;
-        }
-        if (all_disabled)
-            NVIC_DisableIRQ(irq_n);
-    }
-}
-
-int serial_getc(serial_t *obj) {
-    while (!serial_readable(obj));
-    return obj->uart->D;
-}
-
-void serial_putc(serial_t *obj, int c) {
-    while (!serial_writable(obj));
-    obj->uart->D = c;
-}
-
-int serial_readable(serial_t *obj) {
-    // check overrun
-    if (obj->uart->S1 &  UART0_S1_OR_MASK) {
-        obj->uart->S1 |= UART0_S1_OR_MASK;
-    }
-    return (obj->uart->S1 & UART0_S1_RDRF_MASK);
-}
-
-int serial_writable(serial_t *obj) {
-    // check overrun
-    if (obj->uart->S1 &  UART0_S1_OR_MASK) {
-        obj->uart->S1 |= UART0_S1_OR_MASK;
-    }
-    return (obj->uart->S1 & UART0_S1_TDRE_MASK);
-}
-
-void serial_clear(serial_t *obj) {
-
-}
-
-void serial_pinout_tx(PinName tx) {
-    pinmap_pinout(tx, PinMap_UART_TX);
-}
-
-void serial_break_set(serial_t *obj) {
-    obj->uart->C2 |= UART0_C2_SBK_MASK; 
-}
-
-void serial_break_clear(serial_t *obj) {
-    obj->uart->C2 &= ~UART0_C2_SBK_MASK;
-}
-
--- a/targets/hal/TARGET_Freescale/TARGET_KL05Z/spi_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "spi_api.h"
-
-#include <math.h>
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_SPI_SCLK[] = {
-    {PTB0, SPI_0, 3},
-    {NC  , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_MOSI[] = {
-    {PTA7, SPI_0, 3},
-    {NC  , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_MISO[] = {
-    {PTA6, SPI_0, 3},
-    {NC  , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_SSEL[] = {
-    {PTA5, SPI_0, 3},
-    {NC  , NC   , 0}
-};
-
-void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel) {
-    // determine the SPI to use
-    SPIName spi_mosi = (SPIName)pinmap_peripheral(mosi, PinMap_SPI_MOSI);
-    SPIName spi_miso = (SPIName)pinmap_peripheral(miso, PinMap_SPI_MISO);
-    SPIName spi_sclk = (SPIName)pinmap_peripheral(sclk, PinMap_SPI_SCLK);
-    SPIName spi_ssel = (SPIName)pinmap_peripheral(ssel, PinMap_SPI_SSEL);
-    SPIName spi_data = (SPIName)pinmap_merge(spi_mosi, spi_miso);
-    SPIName spi_cntl = (SPIName)pinmap_merge(spi_sclk, spi_ssel);
-
-    obj->spi = (SPI_Type*)pinmap_merge(spi_data, spi_cntl);
-    if ((int)obj->spi == NC) {
-        error("SPI pinout mapping failed");
-    }
-
-    // enable power and clocking
-    switch ((int)obj->spi) {
-        case SPI_0:
-          SIM->SCGC5 |= (SIM_SCGC5_PORTA_MASK | SIM_SCGC5_PORTB_MASK);
-          SIM->SCGC4 |= SIM_SCGC4_SPI0_MASK;
-          break;
-    }
-
-    // set default format and frequency
-    if (ssel == NC) {
-        spi_format(obj, 8, 0, 0);  // 8 bits, mode 0, master
-    } else {
-        spi_format(obj, 8, 0, 1);  // 8 bits, mode 0, slave
-    }
-    spi_frequency(obj, 1000000);
-
-    // enable SPI
-    obj->spi->C1 |= SPI_C1_SPE_MASK;
-
-    // pin out the spi pins
-    pinmap_pinout(mosi, PinMap_SPI_MOSI);
-    pinmap_pinout(miso, PinMap_SPI_MISO);
-    pinmap_pinout(sclk, PinMap_SPI_SCLK);
-    if (ssel != NC) {
-        pinmap_pinout(ssel, PinMap_SPI_SSEL);
-    }
-}
-
-void spi_free(spi_t *obj) {
-    // [TODO]
-}
-void spi_format(spi_t *obj, int bits, int mode, int slave) {
-    if (bits != 8) {
-        error("Only 8bits SPI supported");
-    }
-
-    if ((mode < 0) || (mode > 3)) {
-        error("SPI mode unsupported");
-    }
-
-    uint8_t polarity = (mode & 0x2) ? 1 : 0;
-    uint8_t phase = (mode & 0x1) ? 1 : 0;
-    uint8_t c1_data = ((!slave) << 4) | (polarity << 3) | (phase << 2);
-
-    // clear MSTR, CPOL and CPHA bits
-    obj->spi->C1 &= ~(0x7 << 2);
-
-    // write new value
-    obj->spi->C1 |= c1_data;
-}
-
-void spi_frequency(spi_t *obj, int hz) {
-    uint32_t error = 0;
-    uint32_t p_error = 0xffffffff;
-    uint32_t ref = 0;
-    uint8_t  spr = 0;
-    uint8_t  ref_spr = 0;
-    uint8_t  ref_prescaler = 0;
-
-    // bus clk
-    uint32_t PCLK = 23986176u;
-    uint8_t prescaler = 1;
-    uint8_t divisor = 2;
-
-    for (prescaler = 1; prescaler <= 8; prescaler++) {
-        divisor = 2;
-        for (spr = 0; spr <= 8; spr++) {
-            ref = PCLK / (prescaler*divisor);
-            error = (ref > hz) ? ref - hz : hz - ref;
-            if (error < p_error) {
-                ref_spr = spr;
-                ref_prescaler = prescaler - 1;
-                p_error = error;
-            }
-            divisor *= 2;
-        }
-    }
-
-    // set SPPR and SPR
-    obj->spi->BR = ((ref_prescaler & 0x7) << 4) | (ref_spr & 0xf);
-}
-
-static inline int spi_writeable(spi_t * obj) {
-    return (obj->spi->S & SPI_S_SPTEF_MASK) ? 1 : 0;
-}
-
-static inline int spi_readable(spi_t * obj) {
-    return (obj->spi->S & SPI_S_SPRF_MASK) ? 1 : 0;
-}
-
-int spi_master_write(spi_t *obj, int value) {
-    // wait tx buffer empty
-    while(!spi_writeable(obj));
-    obj->spi->D = (value & 0xff);
-
-    // wait rx buffer full
-    while (!spi_readable(obj));
-    return obj->spi->D & 0xff;
-}
-
-int spi_slave_receive(spi_t *obj) {
-    return spi_readable(obj);
-}
-
-int spi_slave_read(spi_t *obj) {
-    return obj->spi->D;
-}
-
-void spi_slave_write(spi_t *obj, int value) {
-    while (!spi_writeable(obj));
-    obj->spi->D = value;
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL05Z/us_ticker.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,134 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stddef.h>
-#include "us_ticker_api.h"
-#include "PeripheralNames.h"
-
-/* Prototypes */
-static void pit_init(void);
-static void lptmr_init(void);
-static void lptmr_isr(void);
-
-/* Global variables */
-static uint32_t us_ticker_inited = 0;
-static uint32_t us_ticker_int_counter = 0;
-static uint16_t us_ticker_int_remainder = 0;
-
-
-void us_ticker_init(void) {
-    if (us_ticker_inited) {
-        return;
-    }
-    us_ticker_inited = 1;
-
-    pit_init();
-    lptmr_init();
-}
-
-static void pit_init(void) {
-    SIM->SCGC6 |= SIM_SCGC6_PIT_MASK;   // Clock PIT
-    PIT->MCR = 0;                       // Enable PIT
-
-    // Channel 1
-    PIT->CHANNEL[1].LDVAL = 0xFFFFFFFF;
-    PIT->CHANNEL[1].TCTRL = PIT_TCTRL_CHN_MASK;    // Chain to timer 0, disable Interrupts
-    PIT->CHANNEL[1].TCTRL |= PIT_TCTRL_TEN_MASK;   // Start timer 1
-
-    // Use channel 0 as a prescaler for channel 1
-    PIT->CHANNEL[0].LDVAL = 23;
-    PIT->CHANNEL[0].TCTRL = PIT_TCTRL_TEN_MASK;    // Start timer 0, disable interrupts
-}
-
-uint32_t us_ticker_read() {
-    if (!us_ticker_inited) {
-        us_ticker_init();
-    }
-
-    // The PIT is a countdown timer
-    return ~(PIT->CHANNEL[1].CVAL);
-}
-
-static void lptmr_init(void) {
-    SIM->SCGC5 |= SIM_SCGC5_LPTMR_MASK;
-
-    LPTMR0->CSR = 0;
-
-    NVIC_SetVector(LPTimer_IRQn, (uint32_t)lptmr_isr);
-    NVIC_EnableIRQ(LPTimer_IRQn);
-
-    // Clock at (1)MHz -> (1)tick/us
-    LPTMR0->PSR = LPTMR_PSR_PCS(0);       // MCGIRCLK -> 2MHz / presc 2 = 1MHz
-}
-
-void us_ticker_disable_interrupt(void) {
-    LPTMR0->CSR &= ~LPTMR_CSR_TIE_MASK;
-}
-
-void us_ticker_clear_interrupt(void) {
-    // we've  already cleared interrupt in lptmr_isr
-}
-
-static void lptmr_set(unsigned short count) {
-    // Reset
-    LPTMR0->CSR = 0;
-
-    // Set the compare register
-    LPTMR0->CMR = count;
-
-    // Enable interrupt
-    LPTMR0->CSR |= LPTMR_CSR_TIE_MASK;
-
-    // Start the timer
-    LPTMR0->CSR |= LPTMR_CSR_TEN_MASK;
-}
-
-static void lptmr_isr(void) {
-    // write 1 to TCF to clear the LPT timer compare flag
-    LPTMR0->CSR |= LPTMR_CSR_TCF_MASK;
-
-    if (us_ticker_int_counter > 0) {
-        lptmr_set(0xFFFF);
-        us_ticker_int_counter--;
-    } else {
-        if (us_ticker_int_remainder > 0) {
-            lptmr_set(us_ticker_int_remainder);
-            us_ticker_int_remainder = 0;
-        } else {
-            // This function is going to disable the interrupts if there are
-            // no other events in the queue
-            us_ticker_irq_handler();
-        }
-    }
-}
-
-void us_ticker_set_interrupt(uint32_t timestamp) {
-    int32_t delta = (int32_t)(timestamp - us_ticker_read());
-    if (delta <= 0) {
-        // This event was in the past:
-        us_ticker_irq_handler();
-        return;
-    }
-
-    us_ticker_int_counter   = (uint32_t)(delta >> 16);
-    us_ticker_int_remainder = (uint16_t)(0xFFFF & delta);
-    if (us_ticker_int_counter > 0) {
-        lptmr_set(0xFFFF);
-        us_ticker_int_counter--;
-    } else {
-        lptmr_set(us_ticker_int_remainder);
-        us_ticker_int_remainder = 0;
-    }
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL25Z/PeripheralNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    UART_0 = (int)UART0_BASE,
-    UART_1 = (int)UART1_BASE,
-    UART_2 = (int)UART2_BASE
-} UARTName;
-#define STDIO_UART_TX     USBTX
-#define STDIO_UART_RX     USBRX
-#define STDIO_UART        UART_0
-
-typedef enum {
-    I2C_0 = (int)I2C0_BASE,
-    I2C_1 = (int)I2C1_BASE,
-} I2CName;
-
-#define TPM_SHIFT   8
-typedef enum {
-    PWM_1  = (0 << TPM_SHIFT) | (0),  // TPM0 CH0
-    PWM_2  = (0 << TPM_SHIFT) | (1),  // TPM0 CH1
-    PWM_3  = (0 << TPM_SHIFT) | (2),  // TPM0 CH2
-    PWM_4  = (0 << TPM_SHIFT) | (3),  // TPM0 CH3
-    PWM_5  = (0 << TPM_SHIFT) | (4),  // TPM0 CH4
-    PWM_6  = (0 << TPM_SHIFT) | (5),  // TPM0 CH5
-
-    PWM_7  = (1 << TPM_SHIFT) | (0),  // TPM1 CH0
-    PWM_8  = (1 << TPM_SHIFT) | (1),  // TPM1 CH1
-
-    PWM_9  = (2 << TPM_SHIFT) | (0),  // TPM2 CH0
-    PWM_10 = (2 << TPM_SHIFT) | (1)   // TPM2 CH1
-} PWMName;
-
-#define CHANNELS_A_SHIFT 5
-typedef enum {
-    ADC0_SE0  =  0,
-    ADC0_SE3  =  3,
-    ADC0_SE4a =  (1 << CHANNELS_A_SHIFT) | (4),
-    ADC0_SE4b =  4,
-    ADC0_SE5b =  5,
-    ADC0_SE6b =  6,
-    ADC0_SE7a =  (1 << CHANNELS_A_SHIFT) | (7),
-    ADC0_SE7b =  7,
-    ADC0_SE8  =  8,
-    ADC0_SE9  =  9,
-    ADC0_SE11 = 11,
-    ADC0_SE12 = 12,
-    ADC0_SE13 = 13,
-    ADC0_SE14 = 14,
-    ADC0_SE15 = 15,
-    ADC0_SE23 = 23
-} ADCName;
-
-typedef enum {
-    DAC_0 = 0
-} DACName;
-
-
-typedef enum {
-    SPI_0 = (int)SPI0_BASE,
-    SPI_1 = (int)SPI1_BASE,
-} SPIName;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_Freescale/TARGET_KL25Z/PinNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,247 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PINNAMES_H
-#define MBED_PINNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    PIN_INPUT,
-    PIN_OUTPUT
-} PinDirection;
-
-#define PORT_SHIFT  12
-
-typedef enum {
-    PTA0 = 0x0,
-    PTA1 = 0x4,
-    PTA2 = 0x8,
-    PTA3 = 0xc,
-    PTA4 = 0x10,
-    PTA5 = 0x14,
-    PTA6 = 0x18,
-    PTA7 = 0x1c,
-    PTA8 = 0x20,
-    PTA9 = 0x24,
-    PTA10 = 0x28,
-    PTA11 = 0x2c,
-    PTA12 = 0x30,
-    PTA13 = 0x34,
-    PTA14 = 0x38,
-    PTA15 = 0x3c,
-    PTA16 = 0x40,
-    PTA17 = 0x44,
-    PTA18 = 0x48,
-    PTA19 = 0x4c,
-    PTA20 = 0x50,
-    PTA21 = 0x54,
-    PTA22 = 0x58,
-    PTA23 = 0x5c,
-    PTA24 = 0x60,
-    PTA25 = 0x64,
-    PTA26 = 0x68,
-    PTA27 = 0x6c,
-    PTA28 = 0x70,
-    PTA29 = 0x74,
-    PTA30 = 0x78,
-    PTA31 = 0x7c,
-    PTB0 = 0x1000,
-    PTB1 = 0x1004,
-    PTB2 = 0x1008,
-    PTB3 = 0x100c,
-    PTB4 = 0x1010,
-    PTB5 = 0x1014,
-    PTB6 = 0x1018,
-    PTB7 = 0x101c,
-    PTB8 = 0x1020,
-    PTB9 = 0x1024,
-    PTB10 = 0x1028,
-    PTB11 = 0x102c,
-    PTB12 = 0x1030,
-    PTB13 = 0x1034,
-    PTB14 = 0x1038,
-    PTB15 = 0x103c,
-    PTB16 = 0x1040,
-    PTB17 = 0x1044,
-    PTB18 = 0x1048,
-    PTB19 = 0x104c,
-    PTB20 = 0x1050,
-    PTB21 = 0x1054,
-    PTB22 = 0x1058,
-    PTB23 = 0x105c,
-    PTB24 = 0x1060,
-    PTB25 = 0x1064,
-    PTB26 = 0x1068,
-    PTB27 = 0x106c,
-    PTB28 = 0x1070,
-    PTB29 = 0x1074,
-    PTB30 = 0x1078,
-    PTB31 = 0x107c,
-    PTC0 = 0x2000,
-    PTC1 = 0x2004,
-    PTC2 = 0x2008,
-    PTC3 = 0x200c,
-    PTC4 = 0x2010,
-    PTC5 = 0x2014,
-    PTC6 = 0x2018,
-    PTC7 = 0x201c,
-    PTC8 = 0x2020,
-    PTC9 = 0x2024,
-    PTC10 = 0x2028,
-    PTC11 = 0x202c,
-    PTC12 = 0x2030,
-    PTC13 = 0x2034,
-    PTC14 = 0x2038,
-    PTC15 = 0x203c,
-    PTC16 = 0x2040,
-    PTC17 = 0x2044,
-    PTC18 = 0x2048,
-    PTC19 = 0x204c,
-    PTC20 = 0x2050,
-    PTC21 = 0x2054,
-    PTC22 = 0x2058,
-    PTC23 = 0x205c,
-    PTC24 = 0x2060,
-    PTC25 = 0x2064,
-    PTC26 = 0x2068,
-    PTC27 = 0x206c,
-    PTC28 = 0x2070,
-    PTC29 = 0x2074,
-    PTC30 = 0x2078,
-    PTC31 = 0x207c,
-    PTD0 = 0x3000,
-    PTD1 = 0x3004,
-    PTD2 = 0x3008,
-    PTD3 = 0x300c,
-    PTD4 = 0x3010,
-    PTD5 = 0x3014,
-    PTD6 = 0x3018,
-    PTD7 = 0x301c,
-    PTD8 = 0x3020,
-    PTD9 = 0x3024,
-    PTD10 = 0x3028,
-    PTD11 = 0x302c,
-    PTD12 = 0x3030,
-    PTD13 = 0x3034,
-    PTD14 = 0x3038,
-    PTD15 = 0x303c,
-    PTD16 = 0x3040,
-    PTD17 = 0x3044,
-    PTD18 = 0x3048,
-    PTD19 = 0x304c,
-    PTD20 = 0x3050,
-    PTD21 = 0x3054,
-    PTD22 = 0x3058,
-    PTD23 = 0x305c,
-    PTD24 = 0x3060,
-    PTD25 = 0x3064,
-    PTD26 = 0x3068,
-    PTD27 = 0x306c,
-    PTD28 = 0x3070,
-    PTD29 = 0x3074,
-    PTD30 = 0x3078,
-    PTD31 = 0x307c,
-    PTE0 = 0x4000,
-    PTE1 = 0x4004,
-    PTE2 = 0x4008,
-    PTE3 = 0x400c,
-    PTE4 = 0x4010,
-    PTE5 = 0x4014,
-    PTE6 = 0x4018,
-    PTE7 = 0x401c,
-    PTE8 = 0x4020,
-    PTE9 = 0x4024,
-    PTE10 = 0x4028,
-    PTE11 = 0x402c,
-    PTE12 = 0x4030,
-    PTE13 = 0x4034,
-    PTE14 = 0x4038,
-    PTE15 = 0x403c,
-    PTE16 = 0x4040,
-    PTE17 = 0x4044,
-    PTE18 = 0x4048,
-    PTE19 = 0x404c,
-    PTE20 = 0x4050,
-    PTE21 = 0x4054,
-    PTE22 = 0x4058,
-    PTE23 = 0x405c,
-    PTE24 = 0x4060,
-    PTE25 = 0x4064,
-    PTE26 = 0x4068,
-    PTE27 = 0x406c,
-    PTE28 = 0x4070,
-    PTE29 = 0x4074,
-    PTE30 = 0x4078,
-    PTE31 = 0x407c,
-
-    LED_RED = PTB18,
-    LED_GREEN = PTB19,
-    LED_BLUE = PTD1,
-
-    // mbed original LED naming
-    LED1 = LED_BLUE,
-    LED2 = LED_GREEN,
-    LED3 = LED_RED,
-    LED4 = LED_RED,
-
-    // USB Pins
-    USBTX = PTA2,
-    USBRX = PTA1,
-
-    // Arduino Headers
-    D0 = PTA1,
-    D1 = PTA2,
-    D2 = PTD4,
-    D3 = PTA12,
-    D4 = PTA4,
-    D5 = PTA5,
-    D6 = PTC8,
-    D7 = PTC9,
-    D8 = PTA13,
-    D9 = PTD5,
-    D10 = PTD0,
-    D11 = PTD2,
-    D12 = PTD3,
-    D13 = PTD1,
-    D14 = PTE0,
-    D15 = PTE1,
-
-    A0 = PTB0,
-    A1 = PTB1,
-    A2 = PTB2,
-    A3 = PTB3,
-    A4 = PTC2,
-    A5 = PTC1,
-
-    // Not connected
-    NC = (int)0xFFFFFFFF
-} PinName;
-
-/* PullDown not available for KL25 */
-typedef enum {
-    PullNone = 0,
-    PullUp = 2,
-} PinMode;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_Freescale/TARGET_KL25Z/PortNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PORTNAMES_H
-#define MBED_PORTNAMES_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    PortA = 0,
-    PortB = 1,
-    PortC = 2,
-    PortD = 3,
-    PortE = 4
-} PortName;
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/targets/hal/TARGET_Freescale/TARGET_KL25Z/analogin_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "analogin_api.h"
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_ADC[] = {
-    {PTE20, ADC0_SE0,  0},
-    {PTE22, ADC0_SE3,  0},
-    {PTE21, ADC0_SE4a, 0},
-    {PTE29, ADC0_SE4b, 0},
-    {PTE30, ADC0_SE23, 0},
-    {PTE23, ADC0_SE7a, 0},
-    {PTB0,  ADC0_SE8,  0},
-    {PTB1,  ADC0_SE9,  0},
-    {PTB2,  ADC0_SE12, 0},
-    {PTB3,  ADC0_SE13, 0},
-    {PTC0,  ADC0_SE14, 0},
-    {PTC1,  ADC0_SE15, 0},
-    {PTC2,  ADC0_SE11, 0},
-    {PTD1,  ADC0_SE5b, 0},
-    {PTD5,  ADC0_SE6b, 0},
-    {PTD6,  ADC0_SE7b, 0},
-    {NC,    NC,        0}
-};
-
-void analogin_init(analogin_t *obj, PinName pin) {
-    obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
-    if (obj->adc == (ADCName)NC) {
-        error("ADC pin mapping failed");
-    }
-
-    SIM->SCGC6 |= SIM_SCGC6_ADC0_MASK;
-
-    uint32_t port = (uint32_t)pin >> PORT_SHIFT;
-    SIM->SCGC5 |= 1 << (SIM_SCGC5_PORTA_SHIFT + port);
-
-    uint32_t cfg2_muxsel = ADC_CFG2_MUXSEL_MASK;
-    if (obj->adc & (1 << CHANNELS_A_SHIFT)) {
-        cfg2_muxsel = 0;
-    }
-
-    ADC0->SC1[1] = ADC_SC1_ADCH(obj->adc & ~(1 << CHANNELS_A_SHIFT));
-
-    ADC0->CFG1 = ADC_CFG1_ADLPC_MASK    // Low-Power Configuration
-               | ADC_CFG1_ADIV(3)       // Clock Divide Select: (Input Clock)/8
-               | ADC_CFG1_ADLSMP_MASK   // Long Sample Time
-               | ADC_CFG1_MODE(3)       // (16)bits Resolution
-               | ADC_CFG1_ADICLK(1);    // Input Clock: (Bus Clock)/2
-
-    ADC0->CFG2 = cfg2_muxsel            // ADxxb or ADxxa channels
-               | ADC_CFG2_ADACKEN_MASK  // Asynchronous Clock Output Enable
-               | ADC_CFG2_ADHSC_MASK    // High-Speed Configuration
-               | ADC_CFG2_ADLSTS(0);    // Long Sample Time Select
-
-    ADC0->SC2 = ADC_SC2_REFSEL(0);      // Default Voltage Reference
-
-    ADC0->SC3 = ADC_SC3_AVGE_MASK       // Hardware Average Enable
-              | ADC_SC3_AVGS(0);        // 4 Samples Averaged
-
-    pinmap_pinout(pin, PinMap_ADC);
-}
-
-uint16_t analogin_read_u16(analogin_t *obj) {
-    // start conversion
-    ADC0->SC1[0] = ADC_SC1_ADCH(obj->adc & ~(1 << CHANNELS_A_SHIFT));
-
-    // Wait Conversion Complete
-    while ((ADC0->SC1[0] & ADC_SC1_COCO_MASK) != ADC_SC1_COCO_MASK);
-
-    // Return value
-    return (uint16_t)ADC0->R[0];
-}
-
-float analogin_read(analogin_t *obj) {
-    uint16_t value = analogin_read_u16(obj);
-    return (float)value * (1.0f / (float)0xFFFF);
-}
-
--- a/targets/hal/TARGET_Freescale/TARGET_KL25Z/analogout_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "analogout_api.h"
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-#define RANGE_12BIT     0xFFF
-
-static const PinMap PinMap_DAC[] = {
-    {PTE30, DAC_0, 0},
-    {NC   , NC   , 0}
-};
-
-void analogout_init(dac_t *obj, PinName pin) {
-    obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
-    if (obj->dac == (DACName)NC) {
-        error("DAC pin mapping failed");
-    }
-
-    SIM->SCGC6 |= SIM_SCGC6_DAC0_MASK;
-
-    uint32_t port = (uint32_t)pin >> PORT_SHIFT;
-    SIM->SCGC5 |= 1 << (SIM_SCGC5_PORTA_SHIFT + port);
-
-    DAC0->DAT[obj->dac].DATH = 0;
-    DAC0->DAT[obj->dac].DATL = 0;
-
-    DAC0->C1 = DAC_C1_DACBFMD_MASK;     // One-Time Scan Mode
-
-    DAC0->C0 = DAC_C0_DACEN_MASK        // Enable
-             | DAC_C0_DACSWTRG_MASK;    // Software Trigger
-
-    pinmap_pinout(pin, PinMap_DAC);
-
-    analogout_write_u16(obj, 0);
-}
-
-void analogout_free(dac_t *obj) {}
-
-static inline void dac_write(dac_t *obj, int value) {
-    DAC0->DAT[obj->dac].DATL = (uint8_t)( value       & 0xFF);
-    DAC0->DAT[obj->dac].DATH = (uint8_t)((value >> 8) & 0xFF);
-}
-
-static inline int dac_read(dac_t *obj) {
-    return ((DAC0->DAT[obj->dac].DATH << 8) | DAC0->DAT[obj->dac].DATL);
-}
-
-void analogout_write(dac_t *obj, float value) {
-    if (value < 0.0) {
-        dac_write(obj, 0);
-    } else if (value > 1.0) {
-        dac_write(obj, RANGE_12BIT);
-    } else {
-        dac_write(obj, value * (float)RANGE_12BIT);
-    }
-}
-
-void analogout_write_u16(dac_t *obj, uint16_t value) {
-    dac_write(obj, value >> 4); // 12-bit
-}
-
-float analogout_read(dac_t *obj) {
-    uint32_t value = dac_read(obj);
-    return (float)value * (1.0f / (float)RANGE_12BIT);
-}
-
-uint16_t analogout_read_u16(dac_t *obj) {
-    uint32_t value = dac_read(obj); // 12-bit
-    return (value << 4) | ((value >> 8) & 0x003F);
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL25Z/device.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_DEVICE_H
-#define MBED_DEVICE_H
-
-#define DEVICE_PORTIN           1
-#define DEVICE_PORTOUT          1
-#define DEVICE_PORTINOUT        1
-
-#define DEVICE_INTERRUPTIN      1
-
-#define DEVICE_ANALOGIN         1
-#define DEVICE_ANALOGOUT        1
-
-#define DEVICE_SERIAL           1
-
-#define DEVICE_I2C              1
-#define DEVICE_I2CSLAVE         1
-
-#define DEVICE_SPI              1
-#define DEVICE_SPISLAVE         1
-
-#define DEVICE_CAN              0
-
-#define DEVICE_RTC              1
-
-#define DEVICE_ETHERNET         0
-
-#define DEVICE_PWMOUT           1
-
-#define DEVICE_SEMIHOST         1
-#define DEVICE_LOCALFILESYSTEM  0
-#define DEVICE_ID_LENGTH       24
-
-#define DEVICE_SLEEP            0
-
-#define DEVICE_DEBUG_AWARENESS  0
-
-#define DEVICE_STDIO_MESSAGES   1
-
-#define DEVICE_ERROR_RED        1
-
-#include "objects.h"
-
-#endif
--- a/targets/hal/TARGET_Freescale/TARGET_KL25Z/gpio_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "gpio_api.h"
-#include "pinmap.h"
-
-uint32_t gpio_set(PinName pin) {
-    pin_function(pin, 1);
-    return 1 << ((pin & 0x7F) >> 2);
-}
-
-void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) {
-    if(pin == NC) return;
-
-    obj->pin = pin;
-    obj->mask = gpio_set(pin);
-
-    unsigned int port = (unsigned int)pin >> PORT_SHIFT;
-
-    FGPIO_Type *reg = (FGPIO_Type *)(FPTA_BASE + port * 0x40);
-    obj->reg_set = &reg->PSOR;
-    obj->reg_clr = &reg->PCOR;
-    obj->reg_in  = &reg->PDIR;
-    obj->reg_dir = &reg->PDDR;
-
-    gpio_dir(obj, direction);
-    switch (direction) {
-        case PIN_OUTPUT: pin_mode(pin, PullNone); break;
-        case PIN_INPUT : pin_mode(pin, PullUp); break;
-    }
-}
-
-void gpio_mode(gpio_t *obj, PinMode mode) {
-    pin_mode(obj->pin, mode);
-}
-
-void gpio_dir(gpio_t *obj, PinDirection direction) {
-    switch (direction) {
-        case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break;
-        case PIN_OUTPUT: *obj->reg_dir |=  obj->mask; break;
-    }
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL25Z/gpio_irq_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stddef.h>
-#include "cmsis.h"
-
-#include "gpio_irq_api.h"
-#include "error.h"
-
-#define CHANNEL_NUM    64
-
-static uint32_t channel_ids[CHANNEL_NUM] = {0};
-static gpio_irq_handler irq_handler;
-
-#define IRQ_DISABLED        (0)
-#define IRQ_RAISING_EDGE    PORT_PCR_IRQC(9)
-#define IRQ_FALLING_EDGE    PORT_PCR_IRQC(10)
-#define IRQ_EITHER_EDGE     PORT_PCR_IRQC(11)
-
-static void handle_interrupt_in(PORT_Type *port, int ch_base) {
-    uint32_t mask = 0, i;
-
-    for (i = 0; i < 32; i++) {
-        uint32_t pmask = (1 << i);
-        if (port->ISFR & pmask) {
-            mask |= pmask;
-            uint32_t id = channel_ids[ch_base + i];
-            if (id == 0) continue;
-
-            FGPIO_Type *gpio;
-            gpio_irq_event event = IRQ_NONE;
-            switch (port->PCR[i] & PORT_PCR_IRQC_MASK) {
-                case IRQ_RAISING_EDGE:
-                    event = IRQ_RISE;
-                    break;
-
-                case IRQ_FALLING_EDGE:
-                    event = IRQ_FALL;
-                    break;
-
-                case IRQ_EITHER_EDGE:
-                    gpio = (port == PORTA) ? (FPTA) : (FPTD);
-                    event = (gpio->PDIR & pmask) ? (IRQ_RISE) : (IRQ_FALL);
-                    break;
-            }
-            if (event != IRQ_NONE)
-                irq_handler(id, event);
-        }
-    }
-    port->ISFR = mask;
-}
-
-void gpio_irqA(void) {handle_interrupt_in(PORTA, 0);}
-void gpio_irqD(void) {handle_interrupt_in(PORTD, 32);}
-
-int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id) {
-    if (pin == NC) return -1;
-
-    irq_handler = handler;
-
-    obj->port = pin >> PORT_SHIFT;
-    obj->pin = (pin & 0x7F) >> 2;
-
-    uint32_t ch_base, vector;
-    IRQn_Type irq_n;
-    switch (obj->port) {
-            case PortA:
-                ch_base = 0;  irq_n = PORTA_IRQn; vector = (uint32_t)gpio_irqA;
-                break;
-
-            case PortD:
-                ch_base = 32; irq_n = PORTD_IRQn; vector = (uint32_t)gpio_irqD;
-                break;
-
-            default:
-                error("gpio_irq only supported on port A and D\n");
-                break;
-    }
-    NVIC_SetVector(irq_n, vector);
-    NVIC_EnableIRQ(irq_n);
-
-    obj->ch = ch_base + obj->pin;
-    channel_ids[obj->ch] = id;
-
-    return 0;
-}
-
-void gpio_irq_free(gpio_irq_t *obj) {
-    channel_ids[obj->ch] = 0;
-}
-
-void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
-    PORT_Type *port = (PORT_Type *)(PORTA_BASE + 0x1000 * obj->port);
-
-    uint32_t irq_settings = IRQ_DISABLED;
-
-    switch (port->PCR[obj->pin] & PORT_PCR_IRQC_MASK) {
-        case IRQ_DISABLED:
-            if (enable) {
-                irq_settings = (event == IRQ_RISE) ? (IRQ_RAISING_EDGE) : (IRQ_FALLING_EDGE);
-            }
-            break;
-
-        case IRQ_RAISING_EDGE:
-            if (enable) {
-                irq_settings = (event == IRQ_RISE) ? (IRQ_RAISING_EDGE) : (IRQ_EITHER_EDGE);
-            } else {
-                if (event == IRQ_FALL)
-                    irq_settings = IRQ_RAISING_EDGE;
-            }
-            break;
-
-        case IRQ_FALLING_EDGE:
-            if (enable) {
-                irq_settings = (event == IRQ_FALL) ? (IRQ_FALLING_EDGE) : (IRQ_EITHER_EDGE);
-            } else {
-                if (event == IRQ_RISE)
-                    irq_settings = IRQ_FALLING_EDGE;
-            }
-            break;
-
-        case IRQ_EITHER_EDGE:
-            if (enable) {
-                irq_settings = IRQ_EITHER_EDGE;
-            } else {
-                irq_settings = (event == IRQ_RISE) ? (IRQ_FALLING_EDGE) : (IRQ_RAISING_EDGE);
-            }
-            break;
-    }
-
-    // Interrupt configuration and clear interrupt
-    port->PCR[obj->pin] = (port->PCR[obj->pin] & ~PORT_PCR_IRQC_MASK) | irq_settings | PORT_PCR_ISF_MASK;
-}
-
-void gpio_irq_enable(gpio_irq_t *obj) {
-    if (obj->port == PortA) {
-        NVIC_EnableIRQ(PORTA_IRQn);
-    } else if (obj->port == PortD) {
-        NVIC_EnableIRQ(PORTD_IRQn);
-    }
-}
-
-void gpio_irq_disable(gpio_irq_t *obj) {
-    if (obj->port == PortA) {
-        NVIC_DisableIRQ(PORTA_IRQn);
-    } else if (obj->port == PortD) {
-        NVIC_DisableIRQ(PORTD_IRQn);
-    }
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL25Z/gpio_object.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_GPIO_OBJECT_H
-#define MBED_GPIO_OBJECT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
-    PinName  pin;
-    uint32_t mask;
-
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_set;
-    __IO uint32_t *reg_clr;
-    __I  uint32_t *reg_in;
-} gpio_t;
-
-static inline void gpio_write(gpio_t *obj, int value) {
-    if (value)
-        *obj->reg_set = obj->mask;
-    else
-        *obj->reg_clr = obj->mask;
-}
-
-static inline int gpio_read(gpio_t *obj) {
-    return ((*obj->reg_in & obj->mask) ? 1 : 0);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_Freescale/TARGET_KL25Z/i2c_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,423 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "i2c_api.h"
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_I2C_SDA[] = {
-    {PTE25, I2C_0, 5},
-    {PTC9,  I2C_0, 2},
-    {PTE0,  I2C_1, 6},
-    {PTB1,  I2C_0, 2},
-    {PTB3,  I2C_0, 2},
-    {PTC11, I2C_1, 2},
-    {PTC2,  I2C_1, 2},
-    {PTA4,  I2C_1, 2},
-    {NC  ,  NC   , 0}
-};
-
-static const PinMap PinMap_I2C_SCL[] = {
-    {PTE24, I2C_0, 5},
-    {PTC8,  I2C_0, 2},
-    {PTE1,  I2C_1, 6},
-    {PTB0,  I2C_0, 2},
-    {PTB2,  I2C_0, 2},
-    {PTC10, I2C_1, 2},
-    {PTC1,  I2C_1, 2},
-    {NC  ,  NC,    0}
-};
-
-static const uint16_t ICR[0x40] = {
-      20,   22,   24,   26,   28,
-      30,   34,   40,   28,   32,
-      36,   40,   44,   48,   56,
-      68,   48,   56,   64,   72,
-      80,   88,  104,  128,   80,
-      96,  112,  128,  144,  160,
-      192,  240,  160,  192,  224,
-      256,  288,  320,  384,  480,
-      320,  384,  448,  512,  576,
-      640,  768,  960,  640,  768,
-      896, 1024, 1152, 1280, 1536,
-      1920, 1280, 1536, 1792, 2048,
-      2304, 2560, 3072, 3840
-};
-
-static uint8_t first_read;
-
-
-void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
-    // determine the I2C to use
-    I2CName i2c_sda = (I2CName)pinmap_peripheral(sda, PinMap_I2C_SDA);
-    I2CName i2c_scl = (I2CName)pinmap_peripheral(scl, PinMap_I2C_SCL);
-    obj->i2c = (I2C_Type*)pinmap_merge(i2c_sda, i2c_scl);
-    if ((int)obj->i2c == NC) {
-        error("I2C pin mapping failed");
-    }
-
-    // enable power
-    switch ((int)obj->i2c) {
-        case I2C_0: SIM->SCGC5 |= 1 << 13; SIM->SCGC4 |= 1 << 6; break;
-        case I2C_1: SIM->SCGC5 |= 1 << 11; SIM->SCGC4 |= 1 << 7; break;
-    }
-
-    // set default frequency at 100k
-    i2c_frequency(obj, 100000);
-
-    // enable I2C interface
-    obj->i2c->C1 |= 0x80;
-
-    pinmap_pinout(sda, PinMap_I2C_SDA);
-    pinmap_pinout(scl, PinMap_I2C_SCL);
-    
-    first_read = 1;
-}
-
-int i2c_start(i2c_t *obj) {
-    uint8_t temp;
-    volatile int i;
-    // if we are in the middle of a transaction
-    // activate the repeat_start flag
-    if (obj->i2c->S & I2C_S_BUSY_MASK) {
-        // KL25Z errata sheet: repeat start cannot be generated if the
-        // I2Cx_F[MULT] field is set to a non-zero value
-        temp = obj->i2c->F >> 6;
-        obj->i2c->F &= 0x3F;
-        obj->i2c->C1 |= 0x04;
-        for (i = 0; i < 100; i ++) __NOP();
-        obj->i2c->F |= temp << 6;
-    } else {
-        obj->i2c->C1 |= I2C_C1_MST_MASK;
-        obj->i2c->C1 |= I2C_C1_TX_MASK;
-    }
-    first_read = 1;
-    return 0;
-}
-
-int i2c_stop(i2c_t *obj) {
-    volatile uint32_t n = 0;
-    obj->i2c->C1 &= ~I2C_C1_MST_MASK;
-    obj->i2c->C1 &= ~I2C_C1_TX_MASK;
-
-    // It seems that there are timing problems
-    // when there is no waiting time after a STOP.
-    // This wait is also included on the samples
-    // code provided with the freedom board
-    for (n = 0; n < 100; n++) __NOP();
-    first_read = 1;
-    return 0;
-}
-
-static int timeout_status_poll(i2c_t *obj, uint32_t mask) {
-    uint32_t i, timeout = 1000;
-    
-    for (i = 0; i < timeout; i++) {
-        if (obj->i2c->S & mask)
-            return 0;
-    }
-    
-    return 1;
-}
-
-// this function waits the end of a tx transfer and return the status of the transaction:
-//    0: OK ack received
-//    1: OK ack not received
-//    2: failure
-static int i2c_wait_end_tx_transfer(i2c_t *obj) {
-    
-    // wait for the interrupt flag
-    if (timeout_status_poll(obj, I2C_S_IICIF_MASK)) {
-        return 2;
-    }
-    
-    obj->i2c->S |= I2C_S_IICIF_MASK;
-    
-    // wait transfer complete
-    if (timeout_status_poll(obj, I2C_S_TCF_MASK)) {
-        return 2;
-    }
-
-    // check if we received the ACK or not
-    return obj->i2c->S & I2C_S_RXAK_MASK ? 1 : 0;
-}
-
-// this function waits the end of a rx transfer and return the status of the transaction:
-//    0: OK
-//    1: failure
-static int i2c_wait_end_rx_transfer(i2c_t *obj) {
-    // wait for the end of the rx transfer
-    if (timeout_status_poll(obj, I2C_S_IICIF_MASK)) {
-        return 1;
-    }
-    
-    obj->i2c->S |= I2C_S_IICIF_MASK;
-    
-    return 0;
-}
-
-static void i2c_send_nack(i2c_t *obj) {
-    obj->i2c->C1 |= I2C_C1_TXAK_MASK; // NACK
-}
-
-static void i2c_send_ack(i2c_t *obj) {
-    obj->i2c->C1 &= ~I2C_C1_TXAK_MASK; // ACK
-}
-
-static int i2c_do_write(i2c_t *obj, int value) {
-    // write the data
-    obj->i2c->D = value;
-
-    // init and wait the end of the transfer
-    return i2c_wait_end_tx_transfer(obj);
-}
-
-static int i2c_do_read(i2c_t *obj, char * data, int last) {
-    if (last)
-        i2c_send_nack(obj);
-    else
-        i2c_send_ack(obj);
-
-    *data = (obj->i2c->D & 0xFF);
-
-    // start rx transfer and wait the end of the transfer
-    return i2c_wait_end_rx_transfer(obj);
-}
-
-void i2c_frequency(i2c_t *obj, int hz) {
-    uint8_t icr = 0;
-    uint8_t mult = 0;
-    uint32_t error = 0;
-    uint32_t p_error = 0xffffffff;
-    uint32_t ref = 0;
-    uint8_t i, j;
-    // bus clk
-    uint32_t PCLK = 24000000u;
-    uint32_t pulse = PCLK / (hz * 2);
-
-    // we look for the values that minimize the error
-
-    // test all the MULT values
-    for (i = 1; i < 5; i*=2) {
-        for (j = 0; j < 0x40; j++) {
-            ref = PCLK / (i*ICR[j]);
-            if (ref > (uint32_t)hz)
-                continue;
-            error = hz - ref;
-            if (error < p_error) {
-                icr = j;
-                mult = i/2;
-                p_error = error;
-            }
-        }
-    }
-    pulse = icr | (mult << 6);
-
-    // I2C Rate
-    obj->i2c->F = pulse;
-}
-
-int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) {
-    int count;
-    char dummy_read, *ptr;
-
-    if (i2c_start(obj)) {
-        i2c_stop(obj);
-        return I2C_ERROR_BUS_BUSY;
-    }
-
-    if (i2c_do_write(obj, (address | 0x01))) {
-        i2c_stop(obj);
-        return I2C_ERROR_NO_SLAVE;
-    }
-
-    // set rx mode
-    obj->i2c->C1 &= ~I2C_C1_TX_MASK;
-
-    // Read in bytes
-    for (count = 0; count < (length); count++) {
-        ptr = (count == 0) ? &dummy_read : &data[count - 1];
-        uint8_t stop_ = (count == (length - 1)) ? 1 : 0;
-        if (i2c_do_read(obj, ptr, stop_)) {
-            i2c_stop(obj);
-            return count;
-        }
-    }
-
-    // If not repeated start, send stop.
-    if (stop) {
-        i2c_stop(obj);
-    }
-
-    // last read
-    data[count-1] = obj->i2c->D;
-
-    return length;
-}
-int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) {
-    int i;
-
-    if (i2c_start(obj)) {
-        i2c_stop(obj);
-        return I2C_ERROR_BUS_BUSY;
-    }
-
-    if (i2c_do_write(obj, (address & 0xFE))) {
-        i2c_stop(obj);
-        return I2C_ERROR_NO_SLAVE;
-    }
-
-    for (i = 0; i < length; i++) {
-        if(i2c_do_write(obj, data[i])) {
-            i2c_stop(obj);
-            return i;
-        }
-    }
-
-    if (stop) {
-        i2c_stop(obj);
-    }
-
-    return length;
-}
-
-void i2c_reset(i2c_t *obj) {
-    i2c_stop(obj);
-}
-
-int i2c_byte_read(i2c_t *obj, int last) {
-    char data;
-    
-    // set rx mode
-    obj->i2c->C1 &= ~I2C_C1_TX_MASK;
-    
-    if(first_read) {
-        // first dummy read
-        i2c_do_read(obj, &data, 0);
-        first_read = 0;
-    }
-    
-    if (last) {
-        // set tx mode
-        obj->i2c->C1 |= I2C_C1_TX_MASK;
-        return obj->i2c->D;
-    }
-        
-    i2c_do_read(obj, &data, last);
-    
-    return data;
-}
-
-int i2c_byte_write(i2c_t *obj, int data) {
-    first_read = 1;
-    
-    // set tx mode
-    obj->i2c->C1 |= I2C_C1_TX_MASK;
-    
-    return !i2c_do_write(obj, (data & 0xFF));
-}
-
-
-#if DEVICE_I2CSLAVE
-void i2c_slave_mode(i2c_t *obj, int enable_slave) {
-    if (enable_slave) {
-        // set slave mode
-        obj->i2c->C1 &= ~I2C_C1_MST_MASK;
-        obj->i2c->C1 |= I2C_C1_IICIE_MASK;
-    } else {
-        // set master mode
-        obj->i2c->C1 |= I2C_C1_MST_MASK;
-    }
-}
-
-int i2c_slave_receive(i2c_t *obj) {
-    switch(obj->i2c->S) {
-        // read addressed
-        case 0xE6: return 1;
-        
-        // write addressed
-        case 0xE2: return 3;
-        
-        default: return 0;
-    }
-}
-
-int i2c_slave_read(i2c_t *obj, char *data, int length) {
-    uint8_t dummy_read;
-    uint8_t * ptr;
-    int count;
-    
-    // set rx mode
-    obj->i2c->C1 &= ~I2C_C1_TX_MASK;
-    
-    // first dummy read
-    dummy_read = obj->i2c->D;
-    if(i2c_wait_end_rx_transfer(obj)) {
-        return 0;
-    }
-    
-    // read address
-    dummy_read = obj->i2c->D;
-    if(i2c_wait_end_rx_transfer(obj)) {
-        return 0;
-    }
-    
-    // read (length - 1) bytes
-    for (count = 0; count < (length - 1); count++) {
-        data[count] = obj->i2c->D;
-        if(i2c_wait_end_rx_transfer(obj)) {
-            return count;
-        }
-    }
-
-    // read last byte
-    ptr = (length == 0) ? &dummy_read : (uint8_t *)&data[count];
-    *ptr = obj->i2c->D;
-    
-    return (length) ? (count + 1) : 0;
-}
-
-int i2c_slave_write(i2c_t *obj, const char *data, int length) {
-    int i, count = 0;
-    
-    // set tx mode
-    obj->i2c->C1 |= I2C_C1_TX_MASK;
-    
-    for (i = 0; i < length; i++) {
-        if(i2c_do_write(obj, data[count++]) == 2) {
-            return i;
-        }
-    }
-    
-    // set rx mode
-    obj->i2c->C1 &= ~I2C_C1_TX_MASK;
-    
-    // dummy rx transfer needed
-    // otherwise the master cannot generate a stop bit
-    obj->i2c->D;
-    if(i2c_wait_end_rx_transfer(obj) == 2) {
-        return count;
-    }
-    
-    return count;
-}
-
-void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask) {
-    obj->i2c->A1 = address & 0xfe;
-}
-#endif
-
--- a/targets/hal/TARGET_Freescale/TARGET_KL25Z/objects.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_OBJECTS_H
-#define MBED_OBJECTS_H
-
-#include "cmsis.h"
-#include "PortNames.h"
-#include "PeripheralNames.h"
-#include "PinNames.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct gpio_irq_s {
-    uint32_t port;
-    uint32_t pin;
-    uint32_t ch;
-};
-
-struct port_s {
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_out;
-    __I  uint32_t *reg_in;
-    PortName port;
-    uint32_t mask;
-};
-
-struct pwmout_s {
-    __IO uint32_t *MOD;
-    __IO uint32_t *CNT;
-    __IO uint32_t *CnV;
-};
-
-struct serial_s {
-    UARTLP_Type *uart;
-    int index;
-};
-
-struct analogin_s {
-    ADCName adc;
-};
-
-struct dac_s {
-    DACName dac;
-};
-
-struct i2c_s {
-    I2C_Type *i2c;
-};
-
-struct spi_s {
-    SPI_Type *spi;
-};
-
-#include "gpio_object.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_Freescale/TARGET_KL25Z/pinmap.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "pinmap.h"
-#include "error.h"
-
-void pin_function(PinName pin, int function) {
-    if (pin == (PinName)NC) return;
-
-    uint32_t port_n = (uint32_t)pin >> PORT_SHIFT;
-    uint32_t pin_n  = (uint32_t)(pin & 0x7C) >> 2;
-
-    SIM->SCGC5 |= 1 << (SIM_SCGC5_PORTA_SHIFT + port_n);
-    __IO uint32_t* pin_pcr = &(((PORT_Type *)(PORTA_BASE + 0x1000 * port_n)))->PCR[pin_n];
-
-    // pin mux bits: [10:8] -> 11100000000 = (0x700)
-    *pin_pcr = (*pin_pcr & ~0x700) | (function << 8);
-}
-
-void pin_mode(PinName pin, PinMode mode) {
-    if (pin == (PinName)NC) { return; }
-
-    __IO uint32_t* pin_pcr = (__IO uint32_t*)(PORTA_BASE + pin);
-
-    // pin pullup bits: [1:0] -> 11 = (0x3)
-    *pin_pcr = (*pin_pcr & ~0x3) | mode;
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL25Z/port_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "port_api.h"
-#include "pinmap.h"
-#include "gpio_api.h"
-
-PinName port_pin(PortName port, int pin_n) {
-    return (PinName)((port << PORT_SHIFT) | (pin_n << 2));
-}
-
-void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
-    obj->port = port;
-    obj->mask = mask;
-
-    FGPIO_Type *reg = (FGPIO_Type *)(FPTA_BASE + port * 0x40);
-
-    obj->reg_out = &reg->PDOR;
-    obj->reg_in  = &reg->PDIR;
-    obj->reg_dir = &reg->PDDR;
-
-    uint32_t i;
-    // The function is set per pin: reuse gpio logic
-    for (i=0; i<32; i++) {
-        if (obj->mask & (1<<i)) {
-            gpio_set(port_pin(obj->port, i));
-        }
-    }
-
-    port_dir(obj, dir);
-}
-
-void port_mode(port_t *obj, PinMode mode) {
-    uint32_t i;
-    // The mode is set per pin: reuse pinmap logic
-    for (i=0; i<32; i++) {
-        if (obj->mask & (1<<i)) {
-            pin_mode(port_pin(obj->port, i), mode);
-        }
-    }
-}
-
-void port_dir(port_t *obj, PinDirection dir) {
-    switch (dir) {
-        case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break;
-        case PIN_OUTPUT: *obj->reg_dir |=  obj->mask; break;
-    }
-}
-
-void port_write(port_t *obj, int value) {
-    *obj->reg_out = (*obj->reg_in & ~obj->mask) | (value & obj->mask);
-}
-
-int port_read(port_t *obj) {
-    return (*obj->reg_in & obj->mask);
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL25Z/pwmout_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "pwmout_api.h"
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_PWM[] = {
-    // LEDs
-    {LED_RED  , PWM_9 , 3}, // PTB18, TPM2 CH0
-    {LED_GREEN, PWM_10, 3}, // PTB19, TPM2 CH1
-    {LED_BLUE , PWM_2 , 4}, // PTD1 , TPM0 CH1
-
-    // Arduino digital pinout
-    {D0,  PWM_9 , 3}, // PTA1 , TPM2 CH0
-    {D1,  PWM_10, 3}, // PTA2 , TPM2 CH1
-    {D2,  PWM_5 , 4}, // PTD4 , TPM0 CH4
-    {D3,  PWM_7 , 3}, // PTA12, TPM1 CH0
-    {D4,  PWM_2 , 3}, // PTA4 , TPM0 CH1
-    {D5,  PWM_3 , 3}, // PTA5 , TPM0 CH2
-    {D6,  PWM_5 , 3}, // PTC8 , TPM0 CH4
-    {D7,  PWM_6 , 3}, // PTC9 , TPM0 CH5
-    {D8,  PWM_8 , 3}, // PTA13, TPM1 CH1
-    {D9,  PWM_6 , 4}, // PTD5 , TPM0 CH5
-    {D10, PWM_1 , 4}, // PTD0 , TPM0 CH0
-    {D11, PWM_3 , 4}, // PTD2 , TPM0 CH2
-    {D12, PWM_4 , 4}, // PTD3 , TPM0 CH3
-    {D13, PWM_2 , 4}, // PTD1 , TPM0 CH1,
-
-    {PTA0, PWM_6, 3},
-    {PTA3, PWM_1, 3},
-    {PTB0, PWM_7, 3},
-    {PTB1, PWM_8, 3},
-    {PTB2, PWM_9, 3},
-    {PTB3, PWM_10, 3},
-    {PTC1, PWM_1, 4},
-    {PTC2, PWM_2, 4},
-    {PTC3, PWM_3, 4},
-    {PTC4, PWM_4, 4},
-    {PTE20, PWM_7, 3},
-    {PTE21, PWM_8, 3},
-    {PTE22, PWM_9, 3},
-    {PTE23, PWM_10, 3},
-    {PTE24, PWM_1, 3},
-    {PTE25, PWM_2, 3},
-    {PTE29, PWM_3, 3},
-    {PTE30, PWM_4, 3},
-    {PTE31, PWM_5, 3},
-
-    {NC , NC    , 0}
-};
-
-#define PWM_CLOCK_MHZ       (0.75) // (48)MHz / 64 = (0.75)MHz
-
-void pwmout_init(pwmout_t* obj, PinName pin) {
-    // determine the channel
-    PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM);
-    if (pwm == (PWMName)NC)
-        error("PwmOut pin mapping failed");
-
-    unsigned int port = (unsigned int)pin >> PORT_SHIFT;
-    unsigned int tpm_n = (pwm >> TPM_SHIFT);
-    unsigned int ch_n = (pwm & 0xFF);
-
-    SIM->SCGC5 |= 1 << (SIM_SCGC5_PORTA_SHIFT + port);
-    SIM->SCGC6 |= 1 << (SIM_SCGC6_TPM0_SHIFT + tpm_n);
-    SIM->SOPT2 |= SIM_SOPT2_TPMSRC(1); // Clock source: MCGFLLCLK or MCGPLLCLK
-
-    TPM_Type *tpm = (TPM_Type *)(TPM0_BASE + 0x1000 * tpm_n);
-    tpm->SC = TPM_SC_CMOD(1) | TPM_SC_PS(6); // (48)MHz / 64 = (0.75)MHz
-    tpm->CONTROLS[ch_n].CnSC = (TPM_CnSC_MSB_MASK | TPM_CnSC_ELSB_MASK); /* No Interrupts; High True pulses on Edge Aligned PWM */
-
-    obj->CnV = &tpm->CONTROLS[ch_n].CnV;
-    obj->MOD = &tpm->MOD;
-    obj->CNT = &tpm->CNT;
-
-    // default to 20ms: standard for servos, and fine for e.g. brightness control
-    pwmout_period_ms(obj, 20);
-    pwmout_write    (obj, 0);
-
-    // Wire pinout
-    pinmap_pinout(pin, PinMap_PWM);
-}
-
-void pwmout_free(pwmout_t* obj) {}
-
-void pwmout_write(pwmout_t* obj, float value) {
-    if (value < 0.0) {
-        value = 0.0;
-    } else if (value > 1.0) {
-        value = 1.0;
-    }
-
-    *obj->CnV = (uint32_t)((float)(*obj->MOD) * value);
-    *obj->CNT = 0;
-}
-
-float pwmout_read(pwmout_t* obj) {
-    float v = (float)(*obj->CnV) / (float)(*obj->MOD);
-    return (v > 1.0) ? (1.0) : (v);
-}
-
-void pwmout_period(pwmout_t* obj, float seconds) {
-    pwmout_period_us(obj, seconds * 1000000.0f);
-}
-
-void pwmout_period_ms(pwmout_t* obj, int ms) {
-    pwmout_period_us(obj, ms * 1000);
-}
-
-// Set the PWM period, keeping the duty cycle the same.
-void pwmout_period_us(pwmout_t* obj, int us) {
-    float dc = pwmout_read(obj);
-    *obj->MOD = PWM_CLOCK_MHZ * us;
-    pwmout_write(obj, dc);
-}
-
-void pwmout_pulsewidth(pwmout_t* obj, float seconds) {
-    pwmout_pulsewidth_us(obj, seconds * 1000000.0f);
-}
-
-void pwmout_pulsewidth_ms(pwmout_t* obj, int ms) {
-    pwmout_pulsewidth_us(obj, ms * 1000);
-}
-
-void pwmout_pulsewidth_us(pwmout_t* obj, int us) {
-    *obj->CnV = PWM_CLOCK_MHZ * us;
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL25Z/rtc_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "rtc_api.h"
-
-static void init(void) {
-    // enable PORTC clock
-    SIM->SCGC5 |= SIM_SCGC5_PORTC_MASK;
-
-    // enable RTC clock
-    SIM->SCGC6 |= SIM_SCGC6_RTC_MASK;
-
-    /*
-    * configure PTC1 with alternate function 1: RTC_CLKIN
-    * As the kl25z board does not have a 32kHz osc,
-    * we use an external clock generated by the
-    * interface chip
-    */
-    PORTC->PCR[1] &= ~PORT_PCR_MUX_MASK;
-    PORTC->PCR[1] = PORT_PCR_MUX(1);
-
-    // select RTC_CLKIN as RTC clock source
-    SIM->SOPT1 &= ~SIM_SOPT1_OSC32KSEL_MASK;
-    SIM->SOPT1 |= SIM_SOPT1_OSC32KSEL(2);
-}
-
-void rtc_init(void) {
-    init();
-
-    //Configure the TSR. default value: 1
-    RTC->TSR = 1;
-
-    // enable counter
-    RTC->SR |= RTC_SR_TCE_MASK;
-}
-
-void rtc_free(void) {
-    // [TODO]
-}
-
-/*
- * Little check routine to see if the RTC has been enabled
- * 0 = Disabled, 1 = Enabled
- */
-int rtc_isenabled(void) {
-    // even if the RTC module is enabled,
-    // as we use RTC_CLKIN and an external clock,
-    // we need to reconfigure the pins. That is why we
-    // call init() if the rtc is enabled
-
-    // if RTC not enabled return 0
-    SIM->SCGC5 |= SIM_SCGC5_PORTC_MASK;
-    SIM->SCGC6 |= SIM_SCGC6_RTC_MASK;
-    if ((RTC->SR & RTC_SR_TCE_MASK) == 0)
-        return 0;
-
-    init();
-    return 1;
-}
-
-time_t rtc_read(void) {
-    return RTC->TSR;
-}
-
-void rtc_write(time_t t) {
-    // disable counter
-    RTC->SR &= ~RTC_SR_TCE_MASK;
-
-    // we do not write 0 into TSR
-    // to avoid invalid time
-    if (t == 0)
-        t = 1;
-
-    // write seconds
-    RTC->TSR = t;
-
-    // re-enable counter
-    RTC->SR |= RTC_SR_TCE_MASK;
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL25Z/serial_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,313 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "serial_api.h"
-
-// math.h required for floating point operations for baud rate calculation
-#include <math.h>
-
-#include <string.h>
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-/******************************************************************************
- * INITIALIZATION
- ******************************************************************************/
-static const PinMap PinMap_UART_TX[] = {
-    {PTC4,  UART_1, 3},
-    {PTA2,  UART_0, 2},
-    {PTD5,  UART_2, 3},
-    {PTD3,  UART_2, 3},
-    {PTD7,  UART_0, 3},
-    {PTE20, UART_0, 4},
-    {PTE22, UART_2, 4},
-    {PTE0,  UART_1, 3},
-    {NC  ,  NC    , 0}
-};
-
-static const PinMap PinMap_UART_RX[] = {
-    {PTC3,  UART_1, 3},
-    {PTA1,  UART_0, 2},
-    {PTD4,  UART_2, 3},
-    {PTD2,  UART_2, 3},
-    {PTD6,  UART_0, 3},
-    {PTE23, UART_2, 4},
-    {PTE21, UART_0, 4},
-    {PTE1,  UART_1, 3},
-    {NC  ,  NC    , 0}
-};
-
-#define UART_NUM    3
-static uint32_t serial_irq_ids[UART_NUM] = {0};
-static uart_irq_handler irq_handler;
-
-int stdio_uart_inited = 0;
-serial_t stdio_uart;
-
-void serial_init(serial_t *obj, PinName tx, PinName rx) {
-    // determine the UART to use
-    UARTName uart_tx = (UARTName)pinmap_peripheral(tx, PinMap_UART_TX);
-    UARTName uart_rx = (UARTName)pinmap_peripheral(rx, PinMap_UART_RX);
-    UARTName uart = (UARTName)pinmap_merge(uart_tx, uart_rx);
-    if ((int)uart == NC) {
-        error("Serial pinout mapping failed");
-    }
-
-    obj->uart = (UARTLP_Type *)uart;
-    // enable clk
-    switch (uart) {
-        case UART_0: SIM->SOPT2 |= SIM_SOPT2_PLLFLLSEL_MASK | (1<<SIM_SOPT2_UART0SRC_SHIFT);
-                     SIM->SCGC5 |= SIM_SCGC5_PORTA_MASK; SIM->SCGC4 |= SIM_SCGC4_UART0_MASK; break;
-        case UART_1: SIM->SCGC5 |= SIM_SCGC5_PORTC_MASK; SIM->SCGC4 |= SIM_SCGC4_UART1_MASK; break;
-        case UART_2: SIM->SCGC5 |= SIM_SCGC5_PORTD_MASK; SIM->SCGC4 |= SIM_SCGC4_UART2_MASK; break;
-    }
-    // Disable UART before changing registers
-    obj->uart->C2 &= ~(UART_C2_RE_MASK | UART_C2_TE_MASK);
-    
-    switch (uart) {
-        case UART_0: obj->index = 0; break;
-        case UART_1: obj->index = 1; break;
-        case UART_2: obj->index = 2; break;
-    }
-
-    // set default baud rate and format
-    serial_baud  (obj, 9600);
-    serial_format(obj, 8, ParityNone, 1);
-
-    // pinout the chosen uart
-    pinmap_pinout(tx, PinMap_UART_TX);
-    pinmap_pinout(rx, PinMap_UART_RX);
-
-    // set rx/tx pins in PullUp mode
-    pin_mode(tx, PullUp);
-    pin_mode(rx, PullUp);
-
-    obj->uart->C2 |= (UART_C2_RE_MASK | UART_C2_TE_MASK);
-
-    if (uart == STDIO_UART) {
-        stdio_uart_inited = 1;
-        memcpy(&stdio_uart, obj, sizeof(serial_t));
-    }
-}
-
-void serial_free(serial_t *obj) {
-    serial_irq_ids[obj->index] = 0;
-}
-
-// serial_baud
-//
-// set the baud rate, taking in to account the current SystemFrequency
-//
-// The LPC2300 and LPC1700 have a divider and a fractional divider to control the
-// baud rate. The formula is:
-//
-// Baudrate = (1 / PCLK) * 16 * DL * (1 + DivAddVal / MulVal)
-//   where:
-//     1 < MulVal <= 15
-//     0 <= DivAddVal < 14
-//     DivAddVal < MulVal
-//
-void serial_baud(serial_t *obj, int baudrate) {
-    
-    // save C2 state
-    uint8_t c2_state = (obj->uart->C2 & (UART_C2_RE_MASK | UART_C2_TE_MASK));
-    
-    // Disable UART before changing registers
-    obj->uart->C2 &= ~(UART_C2_RE_MASK | UART_C2_TE_MASK);
-    
-    // [TODO] not hardcode this value
-    uint32_t PCLK = (obj->uart == UART0) ? 48000000u : 24000000u;
-
-    // First we check to see if the basic divide with no DivAddVal/MulVal
-    // ratio gives us an integer result. If it does, we set DivAddVal = 0,
-    // MulVal = 1. Otherwise, we search the valid ratio value range to find
-    // the closest match. This could be more elegant, using search methods
-    // and/or lookup tables, but the brute force method is not that much
-    // slower, and is more maintainable.
-    uint16_t DL = PCLK / (16 * baudrate);
-
-    // set BDH and BDL
-    obj->uart->BDH = (obj->uart->BDH & ~(0x1f)) | ((DL >> 8) & 0x1f);
-    obj->uart->BDL = (obj->uart->BDL & ~(0xff)) | ((DL >> 0) & 0xff);
-    
-    // restore C2 state
-    obj->uart->C2 |= c2_state;
-}
-
-void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits) {
-    uint8_t m10 = 0;
-    
-    // save C2 state
-    uint8_t c2_state = (obj->uart->C2 & (UART_C2_RE_MASK | UART_C2_TE_MASK));
-    
-    // Disable UART before changing registers
-    obj->uart->C2 &= ~(UART_C2_RE_MASK | UART_C2_TE_MASK);
-    
-    // 8 data bits = 0 ... 9 data bits = 1
-    if ((data_bits < 8) || (data_bits > 9)) {
-        error("Invalid number of bits (%d) in serial format, should be 8..9\r\n", data_bits);
-    }
-    data_bits -= 8;
-
-    uint8_t parity_enable, parity_select;
-    switch (parity) {
-        case ParityNone: parity_enable = 0; parity_select = 0; break;
-        case ParityOdd : parity_enable = 1; parity_select = 1; data_bits++; break;
-        case ParityEven: parity_enable = 1; parity_select = 0; data_bits++; break;
-        default:
-            error("Invalid serial parity setting\r\n");
-            return;
-    }
-
-    // 1 stop bits = 0, 2 stop bits = 1
-    if ((stop_bits != 1) && (stop_bits != 2)) {
-        error("Invalid stop bits specified\r\n");
-    }
-    stop_bits -= 1;
-    
-    // 9 data bits + parity
-    if (data_bits == 2) {
-        // only uart0 supports 10 bit communication
-        if (obj->index != 0) {
-            error("Invalid number of bits (9) to be used with parity\r\n");
-        }
-        data_bits = 0;
-        m10 = 1;
-    }
-
-    // data bits, parity and parity mode
-    obj->uart->C1 = ((data_bits << 4)
-                  |  (parity_enable << 1)
-                  |  (parity_select << 0));
-    
-    // enable 10bit mode if needed
-    if (obj->index == 0) {
-        obj->uart->C4 &= ~UARTLP_C4_M10_MASK;
-        obj->uart->C4 |= (m10 << UARTLP_C4_M10_SHIFT);
-    }
-    
-    // stop bits
-    obj->uart->BDH &= ~UART_BDH_SBNS_MASK;
-    obj->uart->BDH |= (stop_bits << UART_BDH_SBNS_SHIFT);
-    
-    // restore C2 state
-    obj->uart->C2 |= c2_state;
-}
-
-/******************************************************************************
- * INTERRUPTS HANDLING
- ******************************************************************************/
-static inline void uart_irq(uint8_t status, uint32_t index) {
-    if (serial_irq_ids[index] != 0) {
-        if (status & UART_S1_TDRE_MASK)
-            irq_handler(serial_irq_ids[index], TxIrq);
-
-        if (status & UART_S1_RDRF_MASK)
-            irq_handler(serial_irq_ids[index], RxIrq);
-    }
-}
-
-void uart0_irq() {
-    uart_irq(UART0->S1, 0);
-    if (UART0->S1 & UART_S1_OR_MASK)
-        UART0->S1 |= UART_S1_OR_MASK;
-}
-void uart1_irq() {uart_irq(UART1->S1, 1);}
-void uart2_irq() {uart_irq(UART2->S1, 2);}
-
-void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id) {
-    irq_handler = handler;
-    serial_irq_ids[obj->index] = id;
-}
-
-void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) {
-    IRQn_Type irq_n = (IRQn_Type)0;
-    uint32_t vector = 0;
-    switch ((int)obj->uart) {
-        case UART_0: irq_n=UART0_IRQn; vector = (uint32_t)&uart0_irq; break;
-        case UART_1: irq_n=UART1_IRQn; vector = (uint32_t)&uart1_irq; break;
-        case UART_2: irq_n=UART2_IRQn; vector = (uint32_t)&uart2_irq; break;
-    }
-
-    if (enable) {
-        switch (irq) {
-            case RxIrq: obj->uart->C2 |= (UART_C2_RIE_MASK); break;
-            case TxIrq: obj->uart->C2 |= (UART_C2_TIE_MASK); break;
-        }
-        NVIC_SetVector(irq_n, vector);
-        NVIC_EnableIRQ(irq_n);
-
-    } else { // disable
-        int all_disabled = 0;
-        SerialIrq other_irq = (irq == RxIrq) ? (TxIrq) : (RxIrq);
-        switch (irq) {
-            case RxIrq: obj->uart->C2 &= ~(UART_C2_RIE_MASK); break;
-            case TxIrq: obj->uart->C2 &= ~(UART_C2_TIE_MASK); break;
-        }
-        switch (other_irq) {
-            case RxIrq: all_disabled = (obj->uart->C2 & (UART_C2_RIE_MASK)) == 0; break;
-            case TxIrq: all_disabled = (obj->uart->C2 & (UART_C2_TIE_MASK)) == 0; break;
-        }
-        if (all_disabled)
-            NVIC_DisableIRQ(irq_n);
-    }
-}
-
-/******************************************************************************
- * READ/WRITE
- ******************************************************************************/
-int serial_getc(serial_t *obj) {
-    while (!serial_readable(obj));
-    return obj->uart->D;
-}
-
-void serial_putc(serial_t *obj, int c) {
-    while (!serial_writable(obj));
-    obj->uart->D = c;
-}
-
-int serial_readable(serial_t *obj) {
-    // check overrun
-    if (obj->uart->S1 &  UART_S1_OR_MASK) {
-        obj->uart->S1 |= UART_S1_OR_MASK;
-    }
-    return (obj->uart->S1 & UART_S1_RDRF_MASK);
-}
-
-int serial_writable(serial_t *obj) {
-    // check overrun
-    if (obj->uart->S1 &  UART_S1_OR_MASK) {
-        obj->uart->S1 |= UART_S1_OR_MASK;
-    }
-    return (obj->uart->S1 & UART_S1_TDRE_MASK);
-}
-
-void serial_clear(serial_t *obj) {
-}
-
-void serial_pinout_tx(PinName tx) {
-    pinmap_pinout(tx, PinMap_UART_TX);
-}
-
-void serial_break_set(serial_t *obj) {
-    obj->uart->C2 |= UART_C2_SBK_MASK; 
-}
-
-void serial_break_clear(serial_t *obj) {
-    obj->uart->C2 &= ~UART_C2_SBK_MASK;
-}
-
--- a/targets/hal/TARGET_Freescale/TARGET_KL25Z/spi_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,200 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "spi_api.h"
-
-#include <math.h>
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_SPI_SCLK[] = {
-    {PTA15, SPI_0, 2},
-    {PTB11, SPI_1, 2},
-    {PTC5,  SPI_0, 2},
-    {PTD1,  SPI_0, 2},
-    {PTD5,  SPI_1, 2},
-    {PTE2,  SPI_1, 2},
-    {NC  ,  NC   , 0}
-};
-
-static const PinMap PinMap_SPI_MOSI[] = {
-    {PTA16, SPI_0, 2},
-    {PTA17, SPI_0, 5},
-    {PTB16, SPI_1, 2},
-    {PTB17, SPI_1, 5},
-    {PTC6,  SPI_0, 2},
-    {PTC7,  SPI_0, 5},
-    {PTD2,  SPI_0, 2},
-    {PTD3,  SPI_0, 5},
-    {PTD6,  SPI_1, 2},
-    {PTD7,  SPI_1, 5},
-    {PTE1,  SPI_1, 2},
-    {PTE3,  SPI_1, 5},
-    {NC  ,  NC   , 0}
-};
-
-static const PinMap PinMap_SPI_MISO[] = {
-    {PTA16, SPI_0, 5},
-    {PTA17, SPI_0, 2},
-    {PTB16, SPI_1, 5},
-    {PTB17, SPI_1, 2},
-    {PTC6,  SPI_0, 5},
-    {PTC7,  SPI_0, 2},
-    {PTD2,  SPI_0, 5},
-    {PTD3,  SPI_0, 2},
-    {PTD6,  SPI_1, 5},
-    {PTD7,  SPI_1, 2},
-    {PTE1,  SPI_1, 5},
-    {PTE3,  SPI_1, 2},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_SSEL[] = {
-    {PTA14, SPI_0, 2},
-    {PTB10, SPI_1, 2},
-    {PTC4,  SPI_0, 2},
-    {PTD0,  SPI_0, 2},
-    {PTD4,  SPI_1, 2},
-    {PTE4,  SPI_1, 2},
-    {NC  ,  NC   , 0}
-};
-
-void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel) {
-    // determine the SPI to use
-    SPIName spi_mosi = (SPIName)pinmap_peripheral(mosi, PinMap_SPI_MOSI);
-    SPIName spi_miso = (SPIName)pinmap_peripheral(miso, PinMap_SPI_MISO);
-    SPIName spi_sclk = (SPIName)pinmap_peripheral(sclk, PinMap_SPI_SCLK);
-    SPIName spi_ssel = (SPIName)pinmap_peripheral(ssel, PinMap_SPI_SSEL);
-    SPIName spi_data = (SPIName)pinmap_merge(spi_mosi, spi_miso);
-    SPIName spi_cntl = (SPIName)pinmap_merge(spi_sclk, spi_ssel);
-
-    obj->spi = (SPI_Type*)pinmap_merge(spi_data, spi_cntl);
-    if ((int)obj->spi == NC) {
-        error("SPI pinout mapping failed");
-    }
-
-    // enable power and clocking
-    switch ((int)obj->spi) {
-        case SPI_0: SIM->SCGC5 |= 1 << 11; SIM->SCGC4 |= 1 << 22; break;
-        case SPI_1: SIM->SCGC5 |= 1 << 13; SIM->SCGC4 |= 1 << 23; break;
-    }
-
-    // set default format and frequency
-    if (ssel == NC) {
-        spi_format(obj, 8, 0, 0);  // 8 bits, mode 0, master
-    } else {
-        spi_format(obj, 8, 0, 1);  // 8 bits, mode 0, slave
-    }
-    spi_frequency(obj, 1000000);
-
-    // enable SPI
-    obj->spi->C1 |= SPI_C1_SPE_MASK;
-
-    // pin out the spi pins
-    pinmap_pinout(mosi, PinMap_SPI_MOSI);
-    pinmap_pinout(miso, PinMap_SPI_MISO);
-    pinmap_pinout(sclk, PinMap_SPI_SCLK);
-    if (ssel != NC) {
-        pinmap_pinout(ssel, PinMap_SPI_SSEL);
-    }
-}
-
-void spi_free(spi_t *obj) {
-    // [TODO]
-}
-void spi_format(spi_t *obj, int bits, int mode, int slave) {
-    if (bits != 8) {
-        error("Only 8bits SPI supported");
-    }
-
-    if ((mode < 0) || (mode > 3)) {
-        error("SPI mode unsupported");
-    }
-
-    uint8_t polarity = (mode & 0x2) ? 1 : 0;
-    uint8_t phase = (mode & 0x1) ? 1 : 0;
-    uint8_t c1_data = ((!slave) << 4) | (polarity << 3) | (phase << 2);
-
-    // clear MSTR, CPOL and CPHA bits
-    obj->spi->C1 &= ~(0x7 << 2);
-
-    // write new value
-    obj->spi->C1 |= c1_data;
-}
-
-void spi_frequency(spi_t *obj, int hz) {
-    uint32_t error = 0;
-    uint32_t p_error = 0xffffffff;
-    uint32_t ref = 0;
-    uint8_t  spr = 0;
-    uint8_t  ref_spr = 0;
-    uint8_t  ref_prescaler = 0;
-
-    // bus clk
-    uint32_t PCLK = 48000000u;
-    uint8_t prescaler = 1;
-    uint8_t divisor = 2;
-
-    for (prescaler = 1; prescaler <= 8; prescaler++) {
-        divisor = 2;
-        for (spr = 0; spr <= 8; spr++, divisor *= 2) {
-            ref = PCLK / (prescaler*divisor);
-            if (ref > (uint32_t)hz)
-                continue;
-            error = hz - ref;
-            if (error < p_error) {
-                ref_spr = spr;
-                ref_prescaler = prescaler - 1;
-                p_error = error;
-            }
-        }
-    }
-
-    // set SPPR and SPR
-    obj->spi->BR = ((ref_prescaler & 0x7) << 4) | (ref_spr & 0xf);
-}
-
-static inline int spi_writeable(spi_t * obj) {
-    return (obj->spi->S & SPI_S_SPTEF_MASK) ? 1 : 0;
-}
-
-static inline int spi_readable(spi_t * obj) {
-    return (obj->spi->S & SPI_S_SPRF_MASK) ? 1 : 0;
-}
-
-int spi_master_write(spi_t *obj, int value) {
-    // wait tx buffer empty
-    while(!spi_writeable(obj));
-    obj->spi->D = (value & 0xff);
-
-    // wait rx buffer full
-    while (!spi_readable(obj));
-    return obj->spi->D & 0xff;
-}
-
-int spi_slave_receive(spi_t *obj) {
-    return spi_readable(obj);
-}
-
-int spi_slave_read(spi_t *obj) {
-    return obj->spi->D;
-}
-
-void spi_slave_write(spi_t *obj, int value) {
-    while (!spi_writeable(obj));
-    obj->spi->D = value;
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL25Z/us_ticker.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stddef.h>
-#include "us_ticker_api.h"
-#include "PeripheralNames.h"
-
-static void pit_init(void);
-static void lptmr_init(void);
-
-static int us_ticker_inited = 0;
-
-void us_ticker_init(void) {
-    if (us_ticker_inited) return;
-    us_ticker_inited = 1;
-    
-    pit_init();
-    lptmr_init();
-}
-
-/******************************************************************************
- * Timer for us timing.
- ******************************************************************************/
-static void pit_init(void) {
-    SIM->SCGC6 |= SIM_SCGC6_PIT_MASK;   // Clock PIT
-    PIT->MCR = 0;                       // Enable PIT
-    
-    // Channel 1
-    PIT->CHANNEL[1].LDVAL = 0xFFFFFFFF;
-    PIT->CHANNEL[1].TCTRL = PIT_TCTRL_CHN_MASK;    // Chain to timer 0, disable Interrupts
-    PIT->CHANNEL[1].TCTRL |= PIT_TCTRL_TEN_MASK;   // Start timer 1
-    
-    // Use channel 0 as a prescaler for channel 1
-    PIT->CHANNEL[0].LDVAL = 23;
-    PIT->CHANNEL[0].TCTRL = PIT_TCTRL_TEN_MASK;    // Start timer 0, disable interrupts
-}
-
-uint32_t us_ticker_read() {
-    if (!us_ticker_inited)
-        us_ticker_init();
-    
-    // The PIT is a countdown timer
-    return ~(PIT->CHANNEL[1].CVAL);
-}
-
-/******************************************************************************
- * Timer Event
- * 
- * It schedules interrupts at given (32bit)us interval of time.
- * It is implemented used the 16bit Low Power Timer that remains powered in all
- * power modes.
- ******************************************************************************/
-static void lptmr_isr(void);
-
-static void lptmr_init(void) {
-    /* Clock the timer */
-    SIM->SCGC5 |= SIM_SCGC5_LPTMR_MASK;
-    
-    /* Reset */
-    LPTMR0->CSR = 0;
-    
-    /* Set interrupt handler */
-    NVIC_SetVector(LPTimer_IRQn, (uint32_t)lptmr_isr);
-    NVIC_EnableIRQ(LPTimer_IRQn);
-    
-    /* Clock at (1)MHz -> (1)tick/us */
-    LPTMR0->PSR = LPTMR_PSR_PCS(3);       // OSCERCLK -> 8MHz
-    LPTMR0->PSR |= LPTMR_PSR_PRESCALE(2); // divide by 8
-}
-
-void us_ticker_disable_interrupt(void) {
-    LPTMR0->CSR &= ~LPTMR_CSR_TIE_MASK;
-}
-
-void us_ticker_clear_interrupt(void) {
-    // we already clear interrupt in lptmr_isr
-}
-
-static uint32_t us_ticker_int_counter = 0;
-static uint16_t us_ticker_int_remainder = 0;
-
-static void lptmr_set(unsigned short count) {
-    /* Reset */
-    LPTMR0->CSR = 0;
-    
-    /* Set the compare register */
-    LPTMR0->CMR = count;
-    
-    /* Enable interrupt */
-    LPTMR0->CSR |= LPTMR_CSR_TIE_MASK;
-    
-    /* Start the timer */
-    LPTMR0->CSR |= LPTMR_CSR_TEN_MASK;
-}
-
-static void lptmr_isr(void) {
-    // write 1 to TCF to clear the LPT timer compare flag
-    LPTMR0->CSR |= LPTMR_CSR_TCF_MASK;
-    
-    if (us_ticker_int_counter > 0) {
-        lptmr_set(0xFFFF);
-        us_ticker_int_counter--;
-    
-    } else {
-        if (us_ticker_int_remainder > 0) {
-            lptmr_set(us_ticker_int_remainder);
-            us_ticker_int_remainder = 0;
-        
-        } else {
-            // This function is going to disable the interrupts if there are
-            // no other events in the queue
-            us_ticker_irq_handler();
-        }
-    }
-}
-
-void us_ticker_set_interrupt(unsigned int timestamp) {
-    int delta = (int)(timestamp - us_ticker_read());
-    if (delta <= 0) {
-        // This event was in the past:
-        us_ticker_irq_handler();
-        return;
-    }
-    
-    us_ticker_int_counter   = (uint32_t)(delta >> 16);
-    us_ticker_int_remainder = (uint16_t)(0xFFFF & delta);
-    if (us_ticker_int_counter > 0) {
-        lptmr_set(0xFFFF);
-        us_ticker_int_counter--;
-    } else {
-        lptmr_set(us_ticker_int_remainder);
-        us_ticker_int_remainder = 0;
-    }
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL46Z/PeripheralNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    UART_0 = (int)UART0_BASE,
-    UART_1 = (int)UART1_BASE,
-    UART_2 = (int)UART2_BASE
-} UARTName;
-#define STDIO_UART_TX     USBTX
-#define STDIO_UART_RX     USBRX
-#define STDIO_UART        UART_0
-
-typedef enum {
-    I2C_0 = (int)I2C0_BASE,
-    I2C_1 = (int)I2C1_BASE,
-} I2CName;
-
-#define TPM_SHIFT   8
-typedef enum {
-    PWM_1  = (0 << TPM_SHIFT) | (0),  // TPM0 CH0
-    PWM_2  = (0 << TPM_SHIFT) | (1),  // TPM0 CH1
-    PWM_3  = (0 << TPM_SHIFT) | (2),  // TPM0 CH2
-    PWM_4  = (0 << TPM_SHIFT) | (3),  // TPM0 CH3
-    PWM_5  = (0 << TPM_SHIFT) | (4),  // TPM0 CH4
-    PWM_6  = (0 << TPM_SHIFT) | (5),  // TPM0 CH5
-
-    PWM_7  = (1 << TPM_SHIFT) | (0),  // TPM1 CH0
-    PWM_8  = (1 << TPM_SHIFT) | (1),  // TPM1 CH1
-
-    PWM_9  = (2 << TPM_SHIFT) | (0),  // TPM2 CH0
-    PWM_10 = (2 << TPM_SHIFT) | (1)   // TPM2 CH1
-} PWMName;
-
-#define CHANNELS_A_SHIFT 5
-typedef enum {
-    ADC0_SE0  =  0,
-    ADC0_SE3  =  3,
-    ADC0_SE4a =  (1 << CHANNELS_A_SHIFT) | (4),
-    ADC0_SE4b =  4,
-    ADC0_SE5b =  5,
-    ADC0_SE6b =  6,
-    ADC0_SE7a =  (1 << CHANNELS_A_SHIFT) | (7),
-    ADC0_SE7b =  7,
-    ADC0_SE8  =  8,
-    ADC0_SE9  =  9,
-    ADC0_SE11 = 11,
-    ADC0_SE12 = 12,
-    ADC0_SE13 = 13,
-    ADC0_SE14 = 14,
-    ADC0_SE15 = 15,
-    ADC0_SE23 = 23
-} ADCName;
-
-typedef enum {
-    DAC_0 = 0
-} DACName;
-
-
-typedef enum {
-    SPI_0 = (int)SPI0_BASE,
-    SPI_1 = (int)SPI1_BASE,
-} SPIName;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_Freescale/TARGET_KL46Z/PinNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,244 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PINNAMES_H
-#define MBED_PINNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    PIN_INPUT,
-    PIN_OUTPUT
-} PinDirection;
-
-#define PORT_SHIFT  12
-
-typedef enum {
-    PTA0 = 0x0,
-    PTA1 = 0x4,
-    PTA2 = 0x8,
-    PTA3 = 0xc,
-    PTA4 = 0x10,
-    PTA5 = 0x14,
-    PTA6 = 0x18,
-    PTA7 = 0x1c,
-    PTA8 = 0x20,
-    PTA9 = 0x24,
-    PTA10 = 0x28,
-    PTA11 = 0x2c,
-    PTA12 = 0x30,
-    PTA13 = 0x34,
-    PTA14 = 0x38,
-    PTA15 = 0x3c,
-    PTA16 = 0x40,
-    PTA17 = 0x44,
-    PTA18 = 0x48,
-    PTA19 = 0x4c,
-    PTA20 = 0x50,
-    PTA21 = 0x54,
-    PTA22 = 0x58,
-    PTA23 = 0x5c,
-    PTA24 = 0x60,
-    PTA25 = 0x64,
-    PTA26 = 0x68,
-    PTA27 = 0x6c,
-    PTA28 = 0x70,
-    PTA29 = 0x74,
-    PTA30 = 0x78,
-    PTA31 = 0x7c,
-    PTB0 = 0x1000,
-    PTB1 = 0x1004,
-    PTB2 = 0x1008,
-    PTB3 = 0x100c,
-    PTB4 = 0x1010,
-    PTB5 = 0x1014,
-    PTB6 = 0x1018,
-    PTB7 = 0x101c,
-    PTB8 = 0x1020,
-    PTB9 = 0x1024,
-    PTB10 = 0x1028,
-    PTB11 = 0x102c,
-    PTB12 = 0x1030,
-    PTB13 = 0x1034,
-    PTB14 = 0x1038,
-    PTB15 = 0x103c,
-    PTB16 = 0x1040,
-    PTB17 = 0x1044,
-    PTB18 = 0x1048,
-    PTB19 = 0x104c,
-    PTB20 = 0x1050,
-    PTB21 = 0x1054,
-    PTB22 = 0x1058,
-    PTB23 = 0x105c,
-    PTB24 = 0x1060,
-    PTB25 = 0x1064,
-    PTB26 = 0x1068,
-    PTB27 = 0x106c,
-    PTB28 = 0x1070,
-    PTB29 = 0x1074,
-    PTB30 = 0x1078,
-    PTB31 = 0x107c,
-    PTC0 = 0x2000,
-    PTC1 = 0x2004,
-    PTC2 = 0x2008,
-    PTC3 = 0x200c,
-    PTC4 = 0x2010,
-    PTC5 = 0x2014,
-    PTC6 = 0x2018,
-    PTC7 = 0x201c,
-    PTC8 = 0x2020,
-    PTC9 = 0x2024,
-    PTC10 = 0x2028,
-    PTC11 = 0x202c,
-    PTC12 = 0x2030,
-    PTC13 = 0x2034,
-    PTC14 = 0x2038,
-    PTC15 = 0x203c,
-    PTC16 = 0x2040,
-    PTC17 = 0x2044,
-    PTC18 = 0x2048,
-    PTC19 = 0x204c,
-    PTC20 = 0x2050,
-    PTC21 = 0x2054,
-    PTC22 = 0x2058,
-    PTC23 = 0x205c,
-    PTC24 = 0x2060,
-    PTC25 = 0x2064,
-    PTC26 = 0x2068,
-    PTC27 = 0x206c,
-    PTC28 = 0x2070,
-    PTC29 = 0x2074,
-    PTC30 = 0x2078,
-    PTC31 = 0x207c,
-    PTD0 = 0x3000,
-    PTD1 = 0x3004,
-    PTD2 = 0x3008,
-    PTD3 = 0x300c,
-    PTD4 = 0x3010,
-    PTD5 = 0x3014,
-    PTD6 = 0x3018,
-    PTD7 = 0x301c,
-    PTD8 = 0x3020,
-    PTD9 = 0x3024,
-    PTD10 = 0x3028,
-    PTD11 = 0x302c,
-    PTD12 = 0x3030,
-    PTD13 = 0x3034,
-    PTD14 = 0x3038,
-    PTD15 = 0x303c,
-    PTD16 = 0x3040,
-    PTD17 = 0x3044,
-    PTD18 = 0x3048,
-    PTD19 = 0x304c,
-    PTD20 = 0x3050,
-    PTD21 = 0x3054,
-    PTD22 = 0x3058,
-    PTD23 = 0x305c,
-    PTD24 = 0x3060,
-    PTD25 = 0x3064,
-    PTD26 = 0x3068,
-    PTD27 = 0x306c,
-    PTD28 = 0x3070,
-    PTD29 = 0x3074,
-    PTD30 = 0x3078,
-    PTD31 = 0x307c,
-    PTE0 = 0x4000,
-    PTE1 = 0x4004,
-    PTE2 = 0x4008,
-    PTE3 = 0x400c,
-    PTE4 = 0x4010,
-    PTE5 = 0x4014,
-    PTE6 = 0x4018,
-    PTE7 = 0x401c,
-    PTE8 = 0x4020,
-    PTE9 = 0x4024,
-    PTE10 = 0x4028,
-    PTE11 = 0x402c,
-    PTE12 = 0x4030,
-    PTE13 = 0x4034,
-    PTE14 = 0x4038,
-    PTE15 = 0x403c,
-    PTE16 = 0x4040,
-    PTE17 = 0x4044,
-    PTE18 = 0x4048,
-    PTE19 = 0x404c,
-    PTE20 = 0x4050,
-    PTE21 = 0x4054,
-    PTE22 = 0x4058,
-    PTE23 = 0x405c,
-    PTE24 = 0x4060,
-    PTE25 = 0x4064,
-    PTE26 = 0x4068,
-    PTE27 = 0x406c,
-    PTE28 = 0x4070,
-    PTE29 = 0x4074,
-    PTE30 = 0x4078,
-    PTE31 = 0x407c,
-
-    LED_RED = PTE29,
-    LED_GREEN = PTD5,
-
-    // mbed original LED naming
-    LED1 = LED_GREEN,
-    LED2 = LED_RED,
-
-    // USB Pins
-    USBTX = PTA2,
-    USBRX = PTA1,
-
-    // Arduino Headers
-    D0 = PTA1,
-    D1 = PTA2,
-    D2 = PTD3,
-    D3 = PTA12,
-    D4 = PTA4,
-    D5 = PTA5,
-    D6 = PTC8,
-    D7 = PTC9,
-    D8 = PTA13,
-    D9 = PTD2,
-    D10 = PTD4,
-    D11 = PTD6,
-    D12 = PTD7,
-    D13 = PTD5,
-    D14 = PTE0,
-    D15 = PTE1,
-
-    A0 = PTB0,
-    A1 = PTB1,
-    A2 = PTB2,
-    A3 = PTB3,
-    A4 = PTC2,
-    A5 = PTC1,
-
-    // Not connected
-    NC = (int)0xFFFFFFFF
-} PinName;
-
-/* PullDown not available for KL46 */
-typedef enum {
-    PullNone = 0,
-    PullUp = 2,
-} PinMode;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_Freescale/TARGET_KL46Z/PortNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PORTNAMES_H
-#define MBED_PORTNAMES_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    PortA = 0,
-    PortB = 1,
-    PortC = 2,
-    PortD = 3,
-    PortE = 4
-} PortName;
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/targets/hal/TARGET_Freescale/TARGET_KL46Z/analogin_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "analogin_api.h"
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_ADC[] = {
-    {PTE20, ADC0_SE0,  0},
-    {PTE22, ADC0_SE3,  0},
-    {PTE21, ADC0_SE4a, 0},
-    {PTE29, ADC0_SE4b, 0},
-    {PTE30, ADC0_SE23, 0},
-    {PTE23, ADC0_SE7a, 0},
-    {PTB0,  ADC0_SE8,  0},
-    {PTB1,  ADC0_SE9,  0},
-    {PTB2,  ADC0_SE12, 0},
-    {PTB3,  ADC0_SE13, 0},
-    {PTC0,  ADC0_SE14, 0},
-    {PTC1,  ADC0_SE15, 0},
-    {PTC2,  ADC0_SE11, 0},
-    {PTD1,  ADC0_SE5b, 0},
-    {PTD5,  ADC0_SE6b, 0},
-    {PTD6,  ADC0_SE7b, 0},
-    {NC,    NC,        0}
-};
-
-void analogin_init(analogin_t *obj, PinName pin) {
-    obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
-    if (obj->adc == (ADCName)NC) {
-        error("ADC pin mapping failed");
-    }
-
-    SIM->SCGC6 |= SIM_SCGC6_ADC0_MASK;
-
-    uint32_t port = (uint32_t)pin >> PORT_SHIFT;
-    SIM->SCGC5 |= 1 << (SIM_SCGC5_PORTA_SHIFT + port);
-
-    uint32_t cfg2_muxsel = ADC_CFG2_MUXSEL_MASK;
-    if (obj->adc & (1 << CHANNELS_A_SHIFT)) {
-        cfg2_muxsel = 0;
-    }
-
-    ADC0->SC1[1] = ADC_SC1_ADCH(obj->adc & ~(1 << CHANNELS_A_SHIFT));
-
-    ADC0->CFG1 = ADC_CFG1_ADLPC_MASK    // Low-Power Configuration
-               | ADC_CFG1_ADIV(3)       // Clock Divide Select: (Input Clock)/8
-               | ADC_CFG1_ADLSMP_MASK   // Long Sample Time
-               | ADC_CFG1_MODE(3)       // (16)bits Resolution
-               | ADC_CFG1_ADICLK(1);    // Input Clock: (Bus Clock)/2
-
-    ADC0->CFG2 = cfg2_muxsel            // ADxxb or ADxxa channels
-               | ADC_CFG2_ADACKEN_MASK  // Asynchronous Clock Output Enable
-               | ADC_CFG2_ADHSC_MASK    // High-Speed Configuration
-               | ADC_CFG2_ADLSTS(0);    // Long Sample Time Select
-
-    ADC0->SC2 = ADC_SC2_REFSEL(0);      // Default Voltage Reference
-
-    ADC0->SC3 = ADC_SC3_AVGE_MASK       // Hardware Average Enable
-              | ADC_SC3_AVGS(0);        // 4 Samples Averaged
-
-    pinmap_pinout(pin, PinMap_ADC);
-}
-
-uint16_t analogin_read_u16(analogin_t *obj) {
-    // start conversion
-    ADC0->SC1[0] = ADC_SC1_ADCH(obj->adc & ~(1 << CHANNELS_A_SHIFT));
-
-    // Wait Conversion Complete
-    while ((ADC0->SC1[0] & ADC_SC1_COCO_MASK) != ADC_SC1_COCO_MASK);
-
-    // Return value
-    return (uint16_t)ADC0->R[0];
-}
-
-float analogin_read(analogin_t *obj) {
-    uint16_t value = analogin_read_u16(obj);
-    return (float)value * (1.0f / (float)0xFFFF);
-}
-
--- a/targets/hal/TARGET_Freescale/TARGET_KL46Z/analogout_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "analogout_api.h"
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-#define RANGE_12BIT     0xFFF
-
-static const PinMap PinMap_DAC[] = {
-    {PTE30, DAC_0, 0},
-    {NC   , NC   , 0}
-};
-
-void analogout_init(dac_t *obj, PinName pin) {
-    obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
-    if (obj->dac == (DACName)NC) {
-        error("DAC pin mapping failed");
-    }
-
-    SIM->SCGC6 |= SIM_SCGC6_DAC0_MASK;
-
-    uint32_t port = (uint32_t)pin >> PORT_SHIFT;
-    SIM->SCGC5 |= 1 << (SIM_SCGC5_PORTA_SHIFT + port);
-
-    DAC0->DAT[obj->dac].DATH = 0;
-    DAC0->DAT[obj->dac].DATL = 0;
-
-    DAC0->C1 = DAC_C1_DACBFMD_MASK;     // One-Time Scan Mode
-
-    DAC0->C0 = DAC_C0_DACEN_MASK        // Enable
-             | DAC_C0_DACSWTRG_MASK;    // Software Trigger
-
-    pinmap_pinout(pin, PinMap_DAC);
-
-    analogout_write_u16(obj, 0);
-}
-
-void analogout_free(dac_t *obj) {}
-
-static inline void dac_write(dac_t *obj, int value) {
-    DAC0->DAT[obj->dac].DATL = (uint8_t)( value       & 0xFF);
-    DAC0->DAT[obj->dac].DATH = (uint8_t)((value >> 8) & 0xFF);
-}
-
-static inline int dac_read(dac_t *obj) {
-    return ((DAC0->DAT[obj->dac].DATH << 8) | DAC0->DAT[obj->dac].DATL);
-}
-
-void analogout_write(dac_t *obj, float value) {
-    if (value < 0.0) {
-        dac_write(obj, 0);
-    } else if (value > 1.0) {
-        dac_write(obj, RANGE_12BIT);
-    } else {
-        dac_write(obj, value * (float)RANGE_12BIT);
-    }
-}
-
-void analogout_write_u16(dac_t *obj, uint16_t value) {
-    dac_write(obj, value >> 4); // 12-bit
-}
-
-float analogout_read(dac_t *obj) {
-    uint32_t value = dac_read(obj);
-    return (float)value * (1.0f / (float)RANGE_12BIT);
-}
-
-uint16_t analogout_read_u16(dac_t *obj) {
-    uint32_t value = dac_read(obj); // 12-bit
-    return (value << 4) | ((value >> 8) & 0x003F);
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL46Z/device.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_DEVICE_H
-#define MBED_DEVICE_H
-
-#define DEVICE_PORTIN           1
-#define DEVICE_PORTOUT          1
-#define DEVICE_PORTINOUT        1
-
-#define DEVICE_INTERRUPTIN      1
-
-#define DEVICE_ANALOGIN         1
-#define DEVICE_ANALOGOUT        1
-
-#define DEVICE_SERIAL           1
-
-#define DEVICE_I2C              1
-#define DEVICE_I2CSLAVE         1
-
-#define DEVICE_SPI              1
-#define DEVICE_SPISLAVE         1
-
-#define DEVICE_CAN              0
-
-#define DEVICE_RTC              1
-
-#define DEVICE_ETHERNET         0
-
-#define DEVICE_PWMOUT           1
-
-#define DEVICE_SEMIHOST         1
-#define DEVICE_LOCALFILESYSTEM  0
-#define DEVICE_ID_LENGTH       24
-
-#define DEVICE_SLEEP            0
-
-#define DEVICE_DEBUG_AWARENESS  0
-
-#define DEVICE_STDIO_MESSAGES   1
-
-#define DEVICE_ERROR_RED        1
-
-#include "objects.h"
-
-#endif
--- a/targets/hal/TARGET_Freescale/TARGET_KL46Z/gpio_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "gpio_api.h"
-#include "pinmap.h"
-
-uint32_t gpio_set(PinName pin) {
-    pin_function(pin, 1);
-    return 1 << ((pin & 0x7F) >> 2);
-}
-
-void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) {
-    if(pin == NC) return;
-
-    obj->pin = pin;
-    obj->mask = gpio_set(pin);
-
-    unsigned int port = (unsigned int)pin >> PORT_SHIFT;
-
-    FGPIO_Type *reg = (FGPIO_Type *)(FPTA_BASE + port * 0x40);
-    obj->reg_set = &reg->PSOR;
-    obj->reg_clr = &reg->PCOR;
-    obj->reg_in  = &reg->PDIR;
-    obj->reg_dir = &reg->PDDR;
-
-    gpio_dir(obj, direction);
-    switch (direction) {
-        case PIN_OUTPUT: pin_mode(pin, PullNone); break;
-        case PIN_INPUT : pin_mode(pin, PullUp); break;
-    }
-}
-
-void gpio_mode(gpio_t *obj, PinMode mode) {
-    pin_mode(obj->pin, mode);
-}
-
-void gpio_dir(gpio_t *obj, PinDirection direction) {
-    switch (direction) {
-        case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break;
-        case PIN_OUTPUT: *obj->reg_dir |=  obj->mask; break;
-    }
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL46Z/gpio_irq_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stddef.h>
-#include "cmsis.h"
-
-#include "gpio_irq_api.h"
-#include "error.h"
-
-#define CHANNEL_NUM    64
-
-static uint32_t channel_ids[CHANNEL_NUM] = {0};
-static gpio_irq_handler irq_handler;
-
-#define IRQ_DISABLED        (0)
-#define IRQ_RAISING_EDGE    PORT_PCR_IRQC(9)
-#define IRQ_FALLING_EDGE    PORT_PCR_IRQC(10)
-#define IRQ_EITHER_EDGE     PORT_PCR_IRQC(11)
-
-static void handle_interrupt_in(PORT_Type *port, int ch_base) {
-    uint32_t mask = 0, i;
-
-    for (i = 0; i < 32; i++) {
-        uint32_t pmask = (1 << i);
-        if (port->ISFR & pmask) {
-            mask |= pmask;
-            uint32_t id = channel_ids[ch_base + i];
-            if (id == 0) continue;
-
-            FGPIO_Type *gpio;
-            gpio_irq_event event = IRQ_NONE;
-            switch (port->PCR[i] & PORT_PCR_IRQC_MASK) {
-                case IRQ_RAISING_EDGE:
-                    event = IRQ_RISE;
-                    break;
-
-                case IRQ_FALLING_EDGE:
-                    event = IRQ_FALL;
-                    break;
-
-                case IRQ_EITHER_EDGE:
-                    gpio = (port == PORTA) ? (FPTA) : (FPTD);
-                    event = (gpio->PDIR & pmask) ? (IRQ_RISE) : (IRQ_FALL);
-                    break;
-            }
-            if (event != IRQ_NONE)
-                irq_handler(id, event);
-        }
-    }
-    port->ISFR = mask;
-}
-
-void gpio_irqA(void) {handle_interrupt_in(PORTA, 0);}
-void gpio_irqD(void) {handle_interrupt_in(PORTD, 32);}
-
-int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id) {
-    if (pin == NC) return -1;
-
-    irq_handler = handler;
-
-    obj->port = pin >> PORT_SHIFT;
-    obj->pin = (pin & 0x7F) >> 2;
-
-    uint32_t ch_base, vector;
-    IRQn_Type irq_n;
-    switch (obj->port) {
-            case PortA:
-                ch_base = 0;  irq_n = PORTA_IRQn; vector = (uint32_t)gpio_irqA;
-                break;
-
-            case PortD:
-                ch_base = 32; irq_n = PORTD_IRQn; vector = (uint32_t)gpio_irqD;
-                break;
-
-            default:
-                error("gpio_irq only supported on port A and D\n");
-                break;
-    }
-    NVIC_SetVector(irq_n, vector);
-    NVIC_EnableIRQ(irq_n);
-
-    obj->ch = ch_base + obj->pin;
-    channel_ids[obj->ch] = id;
-
-    return 0;
-}
-
-void gpio_irq_free(gpio_irq_t *obj) {
-    channel_ids[obj->ch] = 0;
-}
-
-void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
-    PORT_Type *port = (PORT_Type *)(PORTA_BASE + 0x1000 * obj->port);
-
-    uint32_t irq_settings = IRQ_DISABLED;
-
-    switch (port->PCR[obj->pin] & PORT_PCR_IRQC_MASK) {
-        case IRQ_DISABLED:
-            if (enable) {
-                irq_settings = (event == IRQ_RISE) ? (IRQ_RAISING_EDGE) : (IRQ_FALLING_EDGE);
-            }
-            break;
-
-        case IRQ_RAISING_EDGE:
-            if (enable) {
-                irq_settings = (event == IRQ_RISE) ? (IRQ_RAISING_EDGE) : (IRQ_EITHER_EDGE);
-            } else {
-                if (event == IRQ_FALL)
-                    irq_settings = IRQ_RAISING_EDGE;
-            }
-            break;
-
-        case IRQ_FALLING_EDGE:
-            if (enable) {
-                irq_settings = (event == IRQ_FALL) ? (IRQ_FALLING_EDGE) : (IRQ_EITHER_EDGE);
-            } else {
-                if (event == IRQ_RISE)
-                    irq_settings = IRQ_FALLING_EDGE;
-            }
-            break;
-
-        case IRQ_EITHER_EDGE:
-            if (enable) {
-                irq_settings = IRQ_EITHER_EDGE;
-            } else {
-                irq_settings = (event == IRQ_RISE) ? (IRQ_FALLING_EDGE) : (IRQ_RAISING_EDGE);
-            }
-            break;
-    }
-
-    // Interrupt configuration and clear interrupt
-    port->PCR[obj->pin] = (port->PCR[obj->pin] & ~PORT_PCR_IRQC_MASK) | irq_settings | PORT_PCR_ISF_MASK;
-}
-
-void gpio_irq_enable(gpio_irq_t *obj) {
-    if (obj->port == PortA) {
-        NVIC_EnableIRQ(PORTA_IRQn);
-    } else if (obj->port == PortD) {
-        NVIC_EnableIRQ(PORTD_IRQn);
-    }
-}
-
-void gpio_irq_disable(gpio_irq_t *obj) {
-    if (obj->port == PortA) {
-        NVIC_DisableIRQ(PORTA_IRQn);
-    } else if (obj->port == PortD) {
-        NVIC_DisableIRQ(PORTD_IRQn);
-    }
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL46Z/gpio_object.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_GPIO_OBJECT_H
-#define MBED_GPIO_OBJECT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
-    PinName  pin;
-    uint32_t mask;
-
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_set;
-    __IO uint32_t *reg_clr;
-    __I  uint32_t *reg_in;
-} gpio_t;
-
-static inline void gpio_write(gpio_t *obj, int value) {
-    if (value)
-        *obj->reg_set = obj->mask;
-    else
-        *obj->reg_clr = obj->mask;
-}
-
-static inline int gpio_read(gpio_t *obj) {
-    return ((*obj->reg_in & obj->mask) ? 1 : 0);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_Freescale/TARGET_KL46Z/i2c_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,423 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "i2c_api.h"
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_I2C_SDA[] = {
-    {PTE25, I2C_0, 5},
-    {PTC9,  I2C_0, 2},
-    {PTE0,  I2C_1, 6},
-    {PTB1,  I2C_0, 2},
-    {PTB3,  I2C_0, 2},
-    {PTC11, I2C_1, 2},
-    {PTC2,  I2C_1, 2},
-    {PTA4,  I2C_1, 2},
-    {NC  ,  NC   , 0}
-};
-
-static const PinMap PinMap_I2C_SCL[] = {
-    {PTE24, I2C_0, 5},
-    {PTC8,  I2C_0, 2},
-    {PTE1,  I2C_1, 6},
-    {PTB0,  I2C_0, 2},
-    {PTB2,  I2C_0, 2},
-    {PTC10, I2C_1, 2},
-    {PTC1,  I2C_1, 2},
-    {NC  ,  NC,    0}
-};
-
-static const uint16_t ICR[0x40] = {
-      20,   22,   24,   26,   28,
-      30,   34,   40,   28,   32,
-      36,   40,   44,   48,   56,
-      68,   48,   56,   64,   72,
-      80,   88,  104,  128,   80,
-      96,  112,  128,  144,  160,
-      192,  240,  160,  192,  224,
-      256,  288,  320,  384,  480,
-      320,  384,  448,  512,  576,
-      640,  768,  960,  640,  768,
-      896, 1024, 1152, 1280, 1536,
-      1920, 1280, 1536, 1792, 2048,
-      2304, 2560, 3072, 3840
-};
-
-static uint8_t first_read;
-
-
-void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
-    // determine the I2C to use
-    I2CName i2c_sda = (I2CName)pinmap_peripheral(sda, PinMap_I2C_SDA);
-    I2CName i2c_scl = (I2CName)pinmap_peripheral(scl, PinMap_I2C_SCL);
-    obj->i2c = (I2C_Type*)pinmap_merge(i2c_sda, i2c_scl);
-    if ((int)obj->i2c == NC) {
-        error("I2C pin mapping failed");
-    }
-
-    // enable power
-    switch ((int)obj->i2c) {
-        case I2C_0: SIM->SCGC5 |= 1 << 13; SIM->SCGC4 |= 1 << 6; break;
-        case I2C_1: SIM->SCGC5 |= 1 << 11; SIM->SCGC4 |= 1 << 7; break;
-    }
-
-    // set default frequency at 100k
-    i2c_frequency(obj, 100000);
-
-    // enable I2C interface
-    obj->i2c->C1 |= 0x80;
-
-    pinmap_pinout(sda, PinMap_I2C_SDA);
-    pinmap_pinout(scl, PinMap_I2C_SCL);
-    
-    first_read = 1;
-}
-
-int i2c_start(i2c_t *obj) {
-    uint8_t temp;
-    volatile int i;
-    // if we are in the middle of a transaction
-    // activate the repeat_start flag
-    if (obj->i2c->S & I2C_S_BUSY_MASK) {
-        // KL25Z errata sheet: repeat start cannot be generated if the
-        // I2Cx_F[MULT] field is set to a non-zero value
-        temp = obj->i2c->F >> 6;
-        obj->i2c->F &= 0x3F;
-        obj->i2c->C1 |= 0x04;
-        for (i = 0; i < 100; i ++) __NOP();
-        obj->i2c->F |= temp << 6;
-    } else {
-        obj->i2c->C1 |= I2C_C1_MST_MASK;
-        obj->i2c->C1 |= I2C_C1_TX_MASK;
-    }
-    first_read = 1;
-    return 0;
-}
-
-int i2c_stop(i2c_t *obj) {
-    volatile uint32_t n = 0;
-    obj->i2c->C1 &= ~I2C_C1_MST_MASK;
-    obj->i2c->C1 &= ~I2C_C1_TX_MASK;
-
-    // It seems that there are timing problems
-    // when there is no waiting time after a STOP.
-    // This wait is also included on the samples
-    // code provided with the freedom board
-    for (n = 0; n < 100; n++) __NOP();
-    first_read = 1;
-    return 0;
-}
-
-static int timeout_status_poll(i2c_t *obj, uint32_t mask) {
-    uint32_t i, timeout = 1000;
-    
-    for (i = 0; i < timeout; i++) {
-        if (obj->i2c->S & mask)
-            return 0;
-    }
-    
-    return 1;
-}
-
-// this function waits the end of a tx transfer and return the status of the transaction:
-//    0: OK ack received
-//    1: OK ack not received
-//    2: failure
-static int i2c_wait_end_tx_transfer(i2c_t *obj) {
-    
-    // wait for the interrupt flag
-    if (timeout_status_poll(obj, I2C_S_IICIF_MASK)) {
-        return 2;
-    }
-    
-    obj->i2c->S |= I2C_S_IICIF_MASK;
-    
-    // wait transfer complete
-    if (timeout_status_poll(obj, I2C_S_TCF_MASK)) {
-        return 2;
-    }
-
-    // check if we received the ACK or not
-    return obj->i2c->S & I2C_S_RXAK_MASK ? 1 : 0;
-}
-
-// this function waits the end of a rx transfer and return the status of the transaction:
-//    0: OK
-//    1: failure
-static int i2c_wait_end_rx_transfer(i2c_t *obj) {
-    // wait for the end of the rx transfer
-    if (timeout_status_poll(obj, I2C_S_IICIF_MASK)) {
-        return 1;
-    }
-    
-    obj->i2c->S |= I2C_S_IICIF_MASK;
-    
-    return 0;
-}
-
-static void i2c_send_nack(i2c_t *obj) {
-    obj->i2c->C1 |= I2C_C1_TXAK_MASK; // NACK
-}
-
-static void i2c_send_ack(i2c_t *obj) {
-    obj->i2c->C1 &= ~I2C_C1_TXAK_MASK; // ACK
-}
-
-static int i2c_do_write(i2c_t *obj, int value) {
-    // write the data
-    obj->i2c->D = value;
-
-    // init and wait the end of the transfer
-    return i2c_wait_end_tx_transfer(obj);
-}
-
-static int i2c_do_read(i2c_t *obj, char * data, int last) {
-    if (last)
-        i2c_send_nack(obj);
-    else
-        i2c_send_ack(obj);
-
-    *data = (obj->i2c->D & 0xFF);
-
-    // start rx transfer and wait the end of the transfer
-    return i2c_wait_end_rx_transfer(obj);
-}
-
-void i2c_frequency(i2c_t *obj, int hz) {
-    uint8_t icr = 0;
-    uint8_t mult = 0;
-    uint32_t error = 0;
-    uint32_t p_error = 0xffffffff;
-    uint32_t ref = 0;
-    uint8_t i, j;
-    // bus clk
-    uint32_t PCLK = 24000000u;
-    uint32_t pulse = PCLK / (hz * 2);
-
-    // we look for the values that minimize the error
-
-    // test all the MULT values
-    for (i = 1; i < 5; i*=2) {
-        for (j = 0; j < 0x40; j++) {
-            ref = PCLK / (i*ICR[j]);
-            if (ref > (uint32_t)hz)
-                continue;
-            error = hz - ref;
-            if (error < p_error) {
-                icr = j;
-                mult = i/2;
-                p_error = error;
-            }
-        }
-    }
-    pulse = icr | (mult << 6);
-
-    // I2C Rate
-    obj->i2c->F = pulse;
-}
-
-int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) {
-    int count;
-    char dummy_read, *ptr;
-
-    if (i2c_start(obj)) {
-        i2c_stop(obj);
-        return I2C_ERROR_BUS_BUSY;
-    }
-
-    if (i2c_do_write(obj, (address | 0x01))) {
-        i2c_stop(obj);
-        return I2C_ERROR_NO_SLAVE;
-    }
-
-    // set rx mode
-    obj->i2c->C1 &= ~I2C_C1_TX_MASK;
-
-    // Read in bytes
-    for (count = 0; count < (length); count++) {
-        ptr = (count == 0) ? &dummy_read : &data[count - 1];
-        uint8_t stop_ = (count == (length - 1)) ? 1 : 0;
-        if (i2c_do_read(obj, ptr, stop_)) {
-            i2c_stop(obj);
-            return count;
-        }
-    }
-
-    // If not repeated start, send stop.
-    if (stop) {
-        i2c_stop(obj);
-    }
-
-    // last read
-    data[count-1] = obj->i2c->D;
-
-    return length;
-}
-int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) {
-    int i;
-
-    if (i2c_start(obj)) {
-        i2c_stop(obj);
-        return I2C_ERROR_BUS_BUSY;
-    }
-
-    if (i2c_do_write(obj, (address & 0xFE))) {
-        i2c_stop(obj);
-        return I2C_ERROR_NO_SLAVE;
-    }
-
-    for (i = 0; i < length; i++) {
-        if(i2c_do_write(obj, data[i])) {
-            i2c_stop(obj);
-            return i;
-        }
-    }
-
-    if (stop) {
-        i2c_stop(obj);
-    }
-
-    return length;
-}
-
-void i2c_reset(i2c_t *obj) {
-    i2c_stop(obj);
-}
-
-int i2c_byte_read(i2c_t *obj, int last) {
-    char data;
-    
-    // set rx mode
-    obj->i2c->C1 &= ~I2C_C1_TX_MASK;
-    
-    if(first_read) {
-        // first dummy read
-        i2c_do_read(obj, &data, 0);
-        first_read = 0;
-    }
-    
-    if (last) {
-        // set tx mode
-        obj->i2c->C1 |= I2C_C1_TX_MASK;
-        return obj->i2c->D;
-    }
-        
-    i2c_do_read(obj, &data, last);
-    
-    return data;
-}
-
-int i2c_byte_write(i2c_t *obj, int data) {
-    first_read = 1;
-    
-    // set tx mode
-    obj->i2c->C1 |= I2C_C1_TX_MASK;
-    
-    return !i2c_do_write(obj, (data & 0xFF));
-}
-
-
-#if DEVICE_I2CSLAVE
-void i2c_slave_mode(i2c_t *obj, int enable_slave) {
-    if (enable_slave) {
-        // set slave mode
-        obj->i2c->C1 &= ~I2C_C1_MST_MASK;
-        obj->i2c->C1 |= I2C_C1_IICIE_MASK;
-    } else {
-        // set master mode
-        obj->i2c->C1 |= I2C_C1_MST_MASK;
-    }
-}
-
-int i2c_slave_receive(i2c_t *obj) {
-    switch(obj->i2c->S) {
-        // read addressed
-        case 0xE6: return 1;
-        
-        // write addressed
-        case 0xE2: return 3;
-        
-        default: return 0;
-    }
-}
-
-int i2c_slave_read(i2c_t *obj, char *data, int length) {
-    uint8_t dummy_read;
-    uint8_t * ptr;
-    int count;
-    
-    // set rx mode
-    obj->i2c->C1 &= ~I2C_C1_TX_MASK;
-    
-    // first dummy read
-    dummy_read = obj->i2c->D;
-    if(i2c_wait_end_rx_transfer(obj)) {
-        return 0;
-    }
-    
-    // read address
-    dummy_read = obj->i2c->D;
-    if(i2c_wait_end_rx_transfer(obj)) {
-        return 0;
-    }
-    
-    // read (length - 1) bytes
-    for (count = 0; count < (length - 1); count++) {
-        data[count] = obj->i2c->D;
-        if(i2c_wait_end_rx_transfer(obj)) {
-            return count;
-        }
-    }
-
-    // read last byte
-    ptr = (length == 0) ? &dummy_read : (uint8_t *)&data[count];
-    *ptr = obj->i2c->D;
-    
-    return (length) ? (count + 1) : 0;
-}
-
-int i2c_slave_write(i2c_t *obj, const char *data, int length) {
-    int i, count = 0;
-    
-    // set tx mode
-    obj->i2c->C1 |= I2C_C1_TX_MASK;
-    
-    for (i = 0; i < length; i++) {
-        if(i2c_do_write(obj, data[count++]) == 2) {
-            return i;
-        }
-    }
-    
-    // set rx mode
-    obj->i2c->C1 &= ~I2C_C1_TX_MASK;
-    
-    // dummy rx transfer needed
-    // otherwise the master cannot generate a stop bit
-    obj->i2c->D;
-    if(i2c_wait_end_rx_transfer(obj) == 2) {
-        return count;
-    }
-    
-    return count;
-}
-
-void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask) {
-    obj->i2c->A1 = address & 0xfe;
-}
-#endif
-
--- a/targets/hal/TARGET_Freescale/TARGET_KL46Z/objects.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_OBJECTS_H
-#define MBED_OBJECTS_H
-
-#include "cmsis.h"
-#include "PortNames.h"
-#include "PeripheralNames.h"
-#include "PinNames.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct gpio_irq_s {
-    uint32_t port;
-    uint32_t pin;
-    uint32_t ch;
-};
-
-struct port_s {
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_out;
-    __I  uint32_t *reg_in;
-    PortName port;
-    uint32_t mask;
-};
-
-struct pwmout_s {
-    __IO uint32_t *MOD;
-    __IO uint32_t *CNT;
-    __IO uint32_t *CnV;
-};
-
-struct serial_s {
-    UARTLP_Type *uart;
-    int index;
-};
-
-struct analogin_s {
-    ADCName adc;
-};
-
-struct dac_s {
-    DACName dac;
-};
-
-struct i2c_s {
-    I2C_Type *i2c;
-};
-
-struct spi_s {
-    SPI_Type *spi;
-};
-
-#include "gpio_object.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_Freescale/TARGET_KL46Z/pinmap.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "pinmap.h"
-#include "error.h"
-
-void pin_function(PinName pin, int function) {
-    if (pin == (PinName)NC) return;
-
-    uint32_t port_n = (uint32_t)pin >> PORT_SHIFT;
-    uint32_t pin_n  = (uint32_t)(pin & 0x7C) >> 2;
-
-    SIM->SCGC5 |= 1 << (SIM_SCGC5_PORTA_SHIFT + port_n);
-    __IO uint32_t* pin_pcr = &(((PORT_Type *)(PORTA_BASE + 0x1000 * port_n)))->PCR[pin_n];
-
-    // pin mux bits: [10:8] -> 11100000000 = (0x700)
-    *pin_pcr = (*pin_pcr & ~0x700) | (function << 8);
-}
-
-void pin_mode(PinName pin, PinMode mode) {
-    if (pin == (PinName)NC) { return; }
-
-    __IO uint32_t* pin_pcr = (__IO uint32_t*)(PORTA_BASE + pin);
-
-    // pin pullup bits: [1:0] -> 11 = (0x3)
-    *pin_pcr = (*pin_pcr & ~0x3) | mode;
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL46Z/port_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "port_api.h"
-#include "pinmap.h"
-#include "gpio_api.h"
-
-PinName port_pin(PortName port, int pin_n) {
-    return (PinName)((port << PORT_SHIFT) | (pin_n << 2));
-}
-
-void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
-    obj->port = port;
-    obj->mask = mask;
-
-    FGPIO_Type *reg = (FGPIO_Type *)(FPTA_BASE + port * 0x40);
-
-    obj->reg_out = &reg->PDOR;
-    obj->reg_in  = &reg->PDIR;
-    obj->reg_dir = &reg->PDDR;
-
-    uint32_t i;
-    // The function is set per pin: reuse gpio logic
-    for (i=0; i<32; i++) {
-        if (obj->mask & (1<<i)) {
-            gpio_set(port_pin(obj->port, i));
-        }
-    }
-
-    port_dir(obj, dir);
-}
-
-void port_mode(port_t *obj, PinMode mode) {
-    uint32_t i;
-    // The mode is set per pin: reuse pinmap logic
-    for (i=0; i<32; i++) {
-        if (obj->mask & (1<<i)) {
-            pin_mode(port_pin(obj->port, i), mode);
-        }
-    }
-}
-
-void port_dir(port_t *obj, PinDirection dir) {
-    switch (dir) {
-        case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break;
-        case PIN_OUTPUT: *obj->reg_dir |=  obj->mask; break;
-    }
-}
-
-void port_write(port_t *obj, int value) {
-    *obj->reg_out = (*obj->reg_in & ~obj->mask) | (value & obj->mask);
-}
-
-int port_read(port_t *obj) {
-    return (*obj->reg_in & obj->mask);
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL46Z/pwmout_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "pwmout_api.h"
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_PWM[] = {
-    // LEDs - only RED pin is PWM capable
-    {LED_RED, PWM_3, 3}, // PTE29, TPM0 CH2
-
-    // Arduino digital pinout
-    {D0,  PWM_9 , 3}, // PTA1 , TPM2 CH0
-    {D1,  PWM_10, 3}, // PTA2 , TPM2 CH1
-    {D2,  PWM_4 , 4}, // PTD3 , TPM0 CH3
-    {D3,  PWM_7 , 3}, // PTA12, TPM1 CH0
-    {D4,  PWM_2 , 3}, // PTA4 , TPM0 CH1
-    {D5,  PWM_3 , 3}, // PTA5 , TPM0 CH2
-    {D6,  PWM_5 , 3}, // PTC8 , TPM0 CH4
-    {D7,  PWM_6 , 3}, // PTC9 , TPM0 CH5
-    {D8,  PWM_8 , 3}, // PTA13, TPM1 CH1
-    {D9,  PWM_3 , 4}, // PTD2 , TPM0 CH2
-    {D10, PWM_5 , 4}, // PTD4 , TPM0 CH4
-    //PWM on D11 not available
-    //PWM on D12 not available
-    {D13, PWM_2 , 4}, // PTD5 , TPM0 CH1,
-
-    {PTA0, PWM_6, 3},
-    {PTA3, PWM_1, 3},
-    {PTA6, PWM_4, 3},
-    {PTA7, PWM_5, 3},
-    {PTB0, PWM_7, 3},
-    {PTB1, PWM_8, 3},
-    {PTB2, PWM_9, 3},
-    {PTB3, PWM_10, 3},
-    {PTC1, PWM_1, 4},
-    {PTC2, PWM_2, 4},
-    {PTC3, PWM_3, 4},
-    {PTC4, PWM_4, 4},
-    {PTE20, PWM_7, 3},
-    {PTE21, PWM_8, 3},
-    {PTE22, PWM_9, 3},
-    {PTE23, PWM_10, 3},
-    {PTE24, PWM_1, 3},
-    {PTE25, PWM_2, 3},
-    {PTE26, PWM_6, 3},
-    {PTE29, PWM_3, 3},
-    {PTE30, PWM_4, 3},
-    {PTE31, PWM_5, 3},
-
-    {NC , NC    , 0}
-};
-
-#define PWM_CLOCK_MHZ       (0.75) // (48)MHz / 64 = (0.75)MHz
-
-void pwmout_init(pwmout_t* obj, PinName pin) {
-    // determine the channel
-    PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM);
-    if (pwm == (PWMName)NC)
-        error("PwmOut pin mapping failed");
-
-    unsigned int port = (unsigned int)pin >> PORT_SHIFT;
-    unsigned int tpm_n = (pwm >> TPM_SHIFT);
-    unsigned int ch_n = (pwm & 0xFF);
-
-    SIM->SCGC5 |= 1 << (SIM_SCGC5_PORTA_SHIFT + port);
-    SIM->SCGC6 |= 1 << (SIM_SCGC6_TPM0_SHIFT + tpm_n);
-    SIM->SOPT2 |= SIM_SOPT2_TPMSRC(1); // Clock source: MCGFLLCLK or MCGPLLCLK
-
-    TPM_Type *tpm = (TPM_Type *)(TPM0_BASE + 0x1000 * tpm_n);
-    tpm->SC = TPM_SC_CMOD(1) | TPM_SC_PS(6); // (48)MHz / 64 = (0.75)MHz
-    tpm->CONTROLS[ch_n].CnSC = (TPM_CnSC_MSB_MASK | TPM_CnSC_ELSB_MASK); /* No Interrupts; High True pulses on Edge Aligned PWM */
-
-    obj->CnV = &tpm->CONTROLS[ch_n].CnV;
-    obj->MOD = &tpm->MOD;
-    obj->CNT = &tpm->CNT;
-
-    // default to 20ms: standard for servos, and fine for e.g. brightness control
-    pwmout_period_ms(obj, 20);
-    pwmout_write    (obj, 0);
-
-    // Wire pinout
-    pinmap_pinout(pin, PinMap_PWM);
-}
-
-void pwmout_free(pwmout_t* obj) {}
-
-void pwmout_write(pwmout_t* obj, float value) {
-    if (value < 0.0) {
-        value = 0.0;
-    } else if (value > 1.0) {
-        value = 1.0;
-    }
-
-    *obj->CnV = (uint32_t)((float)(*obj->MOD) * value);
-    *obj->CNT = 0;
-}
-
-float pwmout_read(pwmout_t* obj) {
-    float v = (float)(*obj->CnV) / (float)(*obj->MOD);
-    return (v > 1.0) ? (1.0) : (v);
-}
-
-void pwmout_period(pwmout_t* obj, float seconds) {
-    pwmout_period_us(obj, seconds * 1000000.0f);
-}
-
-void pwmout_period_ms(pwmout_t* obj, int ms) {
-    pwmout_period_us(obj, ms * 1000);
-}
-
-// Set the PWM period, keeping the duty cycle the same.
-void pwmout_period_us(pwmout_t* obj, int us) {
-    float dc = pwmout_read(obj);
-    *obj->MOD = PWM_CLOCK_MHZ * us;
-    pwmout_write(obj, dc);
-}
-
-void pwmout_pulsewidth(pwmout_t* obj, float seconds) {
-    pwmout_pulsewidth_us(obj, seconds * 1000000.0f);
-}
-
-void pwmout_pulsewidth_ms(pwmout_t* obj, int ms) {
-    pwmout_pulsewidth_us(obj, ms * 1000);
-}
-
-void pwmout_pulsewidth_us(pwmout_t* obj, int us) {
-    *obj->CnV = PWM_CLOCK_MHZ * us;
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL46Z/rtc_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "rtc_api.h"
-
-static void init(void) {
-    // enable PORTC clock
-    SIM->SCGC5 |= SIM_SCGC5_PORTC_MASK;
-
-    // enable RTC clock
-    SIM->SCGC6 |= SIM_SCGC6_RTC_MASK;
-
-    /*
-    * configure PTC1 with alternate function 1: RTC_CLKIN
-    * As the KL46Z board does not have a 32kHz osc,
-    * we use an external clock generated by the
-    * interface chip
-    */
-    PORTC->PCR[1] &= ~PORT_PCR_MUX_MASK;
-    PORTC->PCR[1] = PORT_PCR_MUX(1);
-
-    // select RTC_CLKIN as RTC clock source
-    SIM->SOPT1 &= ~SIM_SOPT1_OSC32KSEL_MASK;
-    SIM->SOPT1 |= SIM_SOPT1_OSC32KSEL(2);
-}
-
-void rtc_init(void) {
-    init();
-
-    //Configure the TSR. default value: 1
-    RTC->TSR = 1;
-
-    // enable counter
-    RTC->SR |= RTC_SR_TCE_MASK;
-}
-
-void rtc_free(void) {
-    // [TODO]
-}
-
-/*
- * Little check routine to see if the RTC has been enabled
- * 0 = Disabled, 1 = Enabled
- */
-int rtc_isenabled(void) {
-    // even if the RTC module is enabled,
-    // as we use RTC_CLKIN and an external clock,
-    // we need to reconfigure the pins. That is why we
-    // call init() if the rtc is enabled
-
-    // if RTC not enabled return 0
-    SIM->SCGC5 |= SIM_SCGC5_PORTC_MASK;
-    SIM->SCGC6 |= SIM_SCGC6_RTC_MASK;
-    if ((RTC->SR & RTC_SR_TCE_MASK) == 0)
-        return 0;
-
-    init();
-    return 1;
-}
-
-time_t rtc_read(void) {
-    return RTC->TSR;
-}
-
-void rtc_write(time_t t) {
-    // disable counter
-    RTC->SR &= ~RTC_SR_TCE_MASK;
-
-    // we do not write 0 into TSR
-    // to avoid invalid time
-    if (t == 0)
-        t = 1;
-
-    // write seconds
-    RTC->TSR = t;
-
-    // re-enable counter
-    RTC->SR |= RTC_SR_TCE_MASK;
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL46Z/serial_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,317 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "serial_api.h"
-
-// math.h required for floating point operations for baud rate calculation
-#include <math.h>
-
-#include <string.h>
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-/******************************************************************************
- * INITIALIZATION
- ******************************************************************************/
-static const PinMap PinMap_UART_TX[] = {
-    {PTA2,  UART_0, 2},
-    {PTA14, UART_0, 3},
-    {PTC4,  UART_1, 3},
-    {PTD3,  UART_2, 3},
-    {PTD5,  UART_2, 3},
-    {PTD7,  UART_0, 3},
-    {PTE0,  UART_1, 3},
-    {PTE16, UART_2, 3},
-    {PTE20, UART_0, 4},
-    {PTE22, UART_2, 4},
-    {NC  ,  NC    , 0}
-};
-
-static const PinMap PinMap_UART_RX[] = {
-    {PTA1,  UART_0, 2},
-    {PTA15,  UART_0, 3},
-    {PTC3,  UART_1, 3},
-    {PTD2,  UART_2, 3},
-    {PTD4,  UART_2, 3},
-    {PTD6,  UART_0, 3},
-    {PTE1,  UART_1, 3},
-    {PTE17, UART_2, 3},
-    {PTE21, UART_0, 4},
-    {PTE23, UART_2, 4},
-    {NC  ,  NC    , 0}
-};
-
-#define UART_NUM    3
-static uint32_t serial_irq_ids[UART_NUM] = {0};
-static uart_irq_handler irq_handler;
-
-int stdio_uart_inited = 0;
-serial_t stdio_uart;
-
-void serial_init(serial_t *obj, PinName tx, PinName rx) {
-    // determine the UART to use
-    UARTName uart_tx = (UARTName)pinmap_peripheral(tx, PinMap_UART_TX);
-    UARTName uart_rx = (UARTName)pinmap_peripheral(rx, PinMap_UART_RX);
-    UARTName uart = (UARTName)pinmap_merge(uart_tx, uart_rx);
-    if ((int)uart == NC) {
-        error("Serial pinout mapping failed");
-    }
-
-    obj->uart = (UARTLP_Type *)uart;
-    // enable clk
-    switch (uart) {
-        case UART_0: SIM->SOPT2 |= SIM_SOPT2_PLLFLLSEL_MASK | (1<<SIM_SOPT2_UART0SRC_SHIFT);
-                     SIM->SCGC5 |= SIM_SCGC5_PORTA_MASK; SIM->SCGC4 |= SIM_SCGC4_UART0_MASK; break;
-        case UART_1: SIM->SCGC5 |= SIM_SCGC5_PORTC_MASK; SIM->SCGC4 |= SIM_SCGC4_UART1_MASK; break;
-        case UART_2: SIM->SCGC5 |= SIM_SCGC5_PORTD_MASK; SIM->SCGC4 |= SIM_SCGC4_UART2_MASK; break;
-    }
-    // Disable UART before changing registers
-    obj->uart->C2 &= ~(UART_C2_RE_MASK | UART_C2_TE_MASK);
-
-    switch (uart) {
-        case UART_0: obj->index = 0; break;
-        case UART_1: obj->index = 1; break;
-        case UART_2: obj->index = 2; break;
-    }
-
-    // set default baud rate and format
-    serial_baud  (obj, 9600);
-    serial_format(obj, 8, ParityNone, 1);
-
-    // pinout the chosen uart
-    pinmap_pinout(tx, PinMap_UART_TX);
-    pinmap_pinout(rx, PinMap_UART_RX);
-
-    // set rx/tx pins in PullUp mode
-    pin_mode(tx, PullUp);
-    pin_mode(rx, PullUp);
-
-    obj->uart->C2 |= (UART_C2_RE_MASK | UART_C2_TE_MASK);
-
-    if (uart == STDIO_UART) {
-        stdio_uart_inited = 1;
-        memcpy(&stdio_uart, obj, sizeof(serial_t));
-    }
-}
-
-void serial_free(serial_t *obj) {
-    serial_irq_ids[obj->index] = 0;
-}
-
-// serial_baud
-//
-// set the baud rate, taking in to account the current SystemFrequency
-//
-// The LPC2300 and LPC1700 have a divider and a fractional divider to control the
-// baud rate. The formula is:
-//
-// Baudrate = (1 / PCLK) * 16 * DL * (1 + DivAddVal / MulVal)
-//   where:
-//     1 < MulVal <= 15
-//     0 <= DivAddVal < 14
-//     DivAddVal < MulVal
-//
-void serial_baud(serial_t *obj, int baudrate) {
-
-    // save C2 state
-    uint8_t c2_state = (obj->uart->C2 & (UART_C2_RE_MASK | UART_C2_TE_MASK));
-
-    // Disable UART before changing registers
-    obj->uart->C2 &= ~(UART_C2_RE_MASK | UART_C2_TE_MASK);
-
-    // [TODO] not hardcode this value
-    uint32_t PCLK = (obj->uart == UART0) ? 48000000u : 24000000u;
-
-    // First we check to see if the basic divide with no DivAddVal/MulVal
-    // ratio gives us an integer result. If it does, we set DivAddVal = 0,
-    // MulVal = 1. Otherwise, we search the valid ratio value range to find
-    // the closest match. This could be more elegant, using search methods
-    // and/or lookup tables, but the brute force method is not that much
-    // slower, and is more maintainable.
-    uint16_t DL = PCLK / (16 * baudrate);
-
-    // set BDH and BDL
-    obj->uart->BDH = (obj->uart->BDH & ~(0x1f)) | ((DL >> 8) & 0x1f);
-    obj->uart->BDL = (obj->uart->BDL & ~(0xff)) | ((DL >> 0) & 0xff);
-
-    // restore C2 state
-    obj->uart->C2 |= c2_state;
-}
-
-void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits) {
-    uint8_t m10 = 0;
-
-    // save C2 state
-    uint8_t c2_state = (obj->uart->C2 & (UART_C2_RE_MASK | UART_C2_TE_MASK));
-
-    // Disable UART before changing registers
-    obj->uart->C2 &= ~(UART_C2_RE_MASK | UART_C2_TE_MASK);
-
-    // 8 data bits = 0 ... 9 data bits = 1
-    if ((data_bits < 8) || (data_bits > 9)) {
-        error("Invalid number of bits (%d) in serial format, should be 8..9\r\n", data_bits);
-    }
-    data_bits -= 8;
-
-    uint8_t parity_enable, parity_select;
-    switch (parity) {
-        case ParityNone: parity_enable = 0; parity_select = 0; break;
-        case ParityOdd : parity_enable = 1; parity_select = 1; data_bits++; break;
-        case ParityEven: parity_enable = 1; parity_select = 0; data_bits++; break;
-        default:
-            error("Invalid serial parity setting\r\n");
-            return;
-    }
-
-    // 1 stop bits = 0, 2 stop bits = 1
-    if ((stop_bits != 1) && (stop_bits != 2)) {
-        error("Invalid stop bits specified\r\n");
-    }
-    stop_bits -= 1;
-
-    // 9 data bits + parity
-    if (data_bits == 2) {
-        // only uart0 supports 10 bit communication
-        if (obj->index != 0) {
-            error("Invalid number of bits (9) to be used with parity\r\n");
-        }
-        data_bits = 0;
-        m10 = 1;
-    }
-
-    // data bits, parity and parity mode
-    obj->uart->C1 = ((data_bits << 4)
-                  |  (parity_enable << 1)
-                  |  (parity_select << 0));
-
-    // enable 10bit mode if needed
-    if (obj->index == 0) {
-        obj->uart->C4 &= ~UARTLP_C4_M10_MASK;
-        obj->uart->C4 |= (m10 << UARTLP_C4_M10_SHIFT);
-    }
-
-    // stop bits
-    obj->uart->BDH &= ~UART_BDH_SBNS_MASK;
-    obj->uart->BDH |= (stop_bits << UART_BDH_SBNS_SHIFT);
-
-    // restore C2 state
-    obj->uart->C2 |= c2_state;
-}
-
-/******************************************************************************
- * INTERRUPTS HANDLING
- ******************************************************************************/
-static inline void uart_irq(uint8_t status, uint32_t index) {
-    if (serial_irq_ids[index] != 0) {
-        if (status & UART_S1_TDRE_MASK)
-            irq_handler(serial_irq_ids[index], TxIrq);
-
-        if (status & UART_S1_RDRF_MASK)
-            irq_handler(serial_irq_ids[index], RxIrq);
-    }
-}
-
-void uart0_irq() {
-    uart_irq(UART0->S1, 0);
-    if (UART0->S1 & UART_S1_OR_MASK)
-        UART0->S1 |= UART_S1_OR_MASK;
-}
-void uart1_irq() {uart_irq(UART1->S1, 1);}
-void uart2_irq() {uart_irq(UART2->S1, 2);}
-
-void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id) {
-    irq_handler = handler;
-    serial_irq_ids[obj->index] = id;
-}
-
-void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) {
-    IRQn_Type irq_n = (IRQn_Type)0;
-    uint32_t vector = 0;
-    switch ((int)obj->uart) {
-        case UART_0: irq_n=UART0_IRQn; vector = (uint32_t)&uart0_irq; break;
-        case UART_1: irq_n=UART1_IRQn; vector = (uint32_t)&uart1_irq; break;
-        case UART_2: irq_n=UART2_IRQn; vector = (uint32_t)&uart2_irq; break;
-    }
-
-    if (enable) {
-        switch (irq) {
-            case RxIrq: obj->uart->C2 |= (UART_C2_RIE_MASK); break;
-            case TxIrq: obj->uart->C2 |= (UART_C2_TIE_MASK); break;
-        }
-        NVIC_SetVector(irq_n, vector);
-        NVIC_EnableIRQ(irq_n);
-
-    } else { // disable
-        int all_disabled = 0;
-        SerialIrq other_irq = (irq == RxIrq) ? (TxIrq) : (RxIrq);
-        switch (irq) {
-            case RxIrq: obj->uart->C2 &= ~(UART_C2_RIE_MASK); break;
-            case TxIrq: obj->uart->C2 &= ~(UART_C2_TIE_MASK); break;
-        }
-        switch (other_irq) {
-            case RxIrq: all_disabled = (obj->uart->C2 & (UART_C2_RIE_MASK)) == 0; break;
-            case TxIrq: all_disabled = (obj->uart->C2 & (UART_C2_TIE_MASK)) == 0; break;
-        }
-        if (all_disabled)
-            NVIC_DisableIRQ(irq_n);
-    }
-}
-
-/******************************************************************************
- * READ/WRITE
- ******************************************************************************/
-int serial_getc(serial_t *obj) {
-    while (!serial_readable(obj));
-    return obj->uart->D;
-}
-
-void serial_putc(serial_t *obj, int c) {
-    while (!serial_writable(obj));
-    obj->uart->D = c;
-}
-
-int serial_readable(serial_t *obj) {
-    // check overrun
-    if (obj->uart->S1 &  UART_S1_OR_MASK) {
-        obj->uart->S1 |= UART_S1_OR_MASK;
-    }
-    return (obj->uart->S1 & UART_S1_RDRF_MASK);
-}
-
-int serial_writable(serial_t *obj) {
-    // check overrun
-    if (obj->uart->S1 &  UART_S1_OR_MASK) {
-        obj->uart->S1 |= UART_S1_OR_MASK;
-    }
-    return (obj->uart->S1 & UART_S1_TDRE_MASK);
-}
-
-void serial_clear(serial_t *obj) {
-}
-
-void serial_pinout_tx(PinName tx) {
-    pinmap_pinout(tx, PinMap_UART_TX);
-}
-
-void serial_break_set(serial_t *obj) {
-    obj->uart->C2 |= UART_C2_SBK_MASK;
-}
-
-void serial_break_clear(serial_t *obj) {
-    obj->uart->C2 &= ~UART_C2_SBK_MASK;
-}
-
--- a/targets/hal/TARGET_Freescale/TARGET_KL46Z/spi_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "spi_api.h"
-
-#include <math.h>
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_SPI_SCLK[] = {
-    {PTA15, SPI_0, 2},
-    {PTB9,  SPI_1, 2},
-    {PTB11, SPI_1, 2},
-    {PTC5,  SPI_0, 2},
-    {PTD1,  SPI_0, 2},
-    {PTD5,  SPI_1, 2},
-    {PTE2,  SPI_1, 2},
-    {PTE17, SPI_0, 2},
-    {NC  ,  NC   , 0}
-};
-
-static const PinMap PinMap_SPI_MOSI[] = {
-    {PTA16, SPI_0, 2},
-    {PTA17, SPI_0, 5},
-    {PTB16, SPI_1, 2},
-    {PTB17, SPI_1, 5},
-    {PTC6,  SPI_0, 2},
-    {PTC7,  SPI_0, 5},
-    {PTD2,  SPI_0, 2},
-    {PTD3,  SPI_0, 5},
-    {PTD6,  SPI_1, 2},
-    {PTD7,  SPI_1, 5},
-    {PTE1,  SPI_1, 2},
-    {PTE3,  SPI_1, 5},
-    {PTE18, SPI_0, 2},
-    {PTE19, SPI_0, 5},
-    {NC  ,  NC   , 0}
-};
-
-static const PinMap PinMap_SPI_MISO[] = {
-    {PTA16, SPI_0, 5},
-    {PTA17, SPI_0, 2},
-    {PTB16, SPI_1, 5},
-    {PTB17, SPI_1, 2},
-    {PTC6,  SPI_0, 5},
-    {PTC7,  SPI_0, 2},
-    {PTD2,  SPI_0, 5},
-    {PTD3,  SPI_0, 2},
-    {PTD6,  SPI_1, 5},
-    {PTD7,  SPI_1, 2},
-    {PTE1,  SPI_1, 5},
-    {PTE3,  SPI_1, 2},
-    {PTE18, SPI_0, 5},
-    {PTE19, SPI_0, 2},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_SSEL[] = {
-    {PTA14, SPI_0, 2},
-    {PTB10, SPI_1, 2},
-    {PTC4,  SPI_0, 2},
-    {PTD0,  SPI_0, 2},
-    {PTD4,  SPI_1, 2},
-    {PTE4,  SPI_1, 2},
-    {PTE16, SPI_0, 2},
-    {NC  ,  NC   , 0}
-};
-
-void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel) {
-    // determine the SPI to use
-    SPIName spi_mosi = (SPIName)pinmap_peripheral(mosi, PinMap_SPI_MOSI);
-    SPIName spi_miso = (SPIName)pinmap_peripheral(miso, PinMap_SPI_MISO);
-    SPIName spi_sclk = (SPIName)pinmap_peripheral(sclk, PinMap_SPI_SCLK);
-    SPIName spi_ssel = (SPIName)pinmap_peripheral(ssel, PinMap_SPI_SSEL);
-    SPIName spi_data = (SPIName)pinmap_merge(spi_mosi, spi_miso);
-    SPIName spi_cntl = (SPIName)pinmap_merge(spi_sclk, spi_ssel);
-
-    obj->spi = (SPI_Type*)pinmap_merge(spi_data, spi_cntl);
-    if ((int)obj->spi == NC) {
-        error("SPI pinout mapping failed");
-    }
-
-    // enable power and clocking
-    switch ((int)obj->spi) {
-        case SPI_0: SIM->SCGC5 |= 1 << 11; SIM->SCGC4 |= 1 << 22; break;
-        case SPI_1: SIM->SCGC5 |= 1 << 13; SIM->SCGC4 |= 1 << 23; break;
-    }
-
-    // set default format and frequency
-    if (ssel == NC) {
-        spi_format(obj, 8, 0, 0);  // 8 bits, mode 0, master
-    } else {
-        spi_format(obj, 8, 0, 1);  // 8 bits, mode 0, slave
-    }
-    spi_frequency(obj, 1000000);
-
-    // enable SPI
-    obj->spi->C1 |= SPI_C1_SPE_MASK;
-
-    // pin out the spi pins
-    pinmap_pinout(mosi, PinMap_SPI_MOSI);
-    pinmap_pinout(miso, PinMap_SPI_MISO);
-    pinmap_pinout(sclk, PinMap_SPI_SCLK);
-    if (ssel != NC) {
-        pinmap_pinout(ssel, PinMap_SPI_SSEL);
-    }
-}
-
-void spi_free(spi_t *obj) {
-    // [TODO]
-}
-void spi_format(spi_t *obj, int bits, int mode, int slave) {
-    if (bits != 8) {
-        error("Only 8bits SPI supported");
-    }
-
-    if ((mode < 0) || (mode > 3)) {
-        error("SPI mode unsupported");
-    }
-
-    uint8_t polarity = (mode & 0x2) ? 1 : 0;
-    uint8_t phase = (mode & 0x1) ? 1 : 0;
-    uint8_t c1_data = ((!slave) << 4) | (polarity << 3) | (phase << 2);
-
-    // clear MSTR, CPOL and CPHA bits
-    obj->spi->C1 &= ~(0x7 << 2);
-
-    // write new value
-    obj->spi->C1 |= c1_data;
-}
-
-void spi_frequency(spi_t *obj, int hz) {
-    uint32_t error = 0;
-    uint32_t p_error = 0xffffffff;
-    uint32_t ref = 0;
-    uint8_t  spr = 0;
-    uint8_t  ref_spr = 0;
-    uint8_t  ref_prescaler = 0;
-
-    // bus clk
-    uint32_t PCLK = 48000000u;
-    uint8_t prescaler = 1;
-    uint8_t divisor = 2;
-
-    for (prescaler = 1; prescaler <= 8; prescaler++) {
-        divisor = 2;
-        for (spr = 0; spr <= 8; spr++, divisor *= 2) {
-            ref = PCLK / (prescaler*divisor);
-            if (ref > (uint32_t)hz)
-                continue;
-            error = hz - ref;
-            if (error < p_error) {
-                ref_spr = spr;
-                ref_prescaler = prescaler - 1;
-                p_error = error;
-            }
-        }
-    }
-
-    // set SPPR and SPR
-    obj->spi->BR = ((ref_prescaler & 0x7) << 4) | (ref_spr & 0xf);
-}
-
-static inline int spi_writeable(spi_t * obj) {
-    return (obj->spi->S & SPI_S_SPTEF_MASK) ? 1 : 0;
-}
-
-static inline int spi_readable(spi_t * obj) {
-    return (obj->spi->S & SPI_S_SPRF_MASK) ? 1 : 0;
-}
-
-int spi_master_write(spi_t *obj, int value) {
-    // wait tx buffer empty
-    while(!spi_writeable(obj));
-    obj->spi->D = (value & 0xff);
-
-    // wait rx buffer full
-    while (!spi_readable(obj));
-    return obj->spi->D & 0xff;
-}
-
-int spi_slave_receive(spi_t *obj) {
-    return spi_readable(obj);
-}
-
-int spi_slave_read(spi_t *obj) {
-    return obj->spi->D;
-}
-
-void spi_slave_write(spi_t *obj, int value) {
-    while (!spi_writeable(obj));
-    obj->spi->D = value;
-}
--- a/targets/hal/TARGET_Freescale/TARGET_KL46Z/us_ticker.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stddef.h>
-#include "us_ticker_api.h"
-#include "PeripheralNames.h"
-
-static void pit_init(void);
-static void lptmr_init(void);
-
-static int us_ticker_inited = 0;
-
-void us_ticker_init(void) {
-    if (us_ticker_inited) return;
-    us_ticker_inited = 1;
-    
-    pit_init();
-    lptmr_init();
-}
-
-/******************************************************************************
- * Timer for us timing.
- ******************************************************************************/
-static void pit_init(void) {
-    SIM->SCGC6 |= SIM_SCGC6_PIT_MASK;   // Clock PIT
-    PIT->MCR = 0;                       // Enable PIT
-    
-    // Channel 1
-    PIT->CHANNEL[1].LDVAL = 0xFFFFFFFF;
-    PIT->CHANNEL[1].TCTRL = PIT_TCTRL_CHN_MASK;    // Chain to timer 0, disable Interrupts
-    PIT->CHANNEL[1].TCTRL |= PIT_TCTRL_TEN_MASK;   // Start timer 1
-    
-    // Use channel 0 as a prescaler for channel 1
-    PIT->CHANNEL[0].LDVAL = 23;
-    PIT->CHANNEL[0].TCTRL = PIT_TCTRL_TEN_MASK;    // Start timer 0, disable interrupts
-}
-
-uint32_t us_ticker_read() {
-    if (!us_ticker_inited)
-        us_ticker_init();
-    
-    // The PIT is a countdown timer
-    return ~(PIT->CHANNEL[1].CVAL);
-}
-
-/******************************************************************************
- * Timer Event
- * 
- * It schedules interrupts at given (32bit)us interval of time.
- * It is implemented used the 16bit Low Power Timer that remains powered in all
- * power modes.
- ******************************************************************************/
-static void lptmr_isr(void);
-
-static void lptmr_init(void) {
-    /* Clock the timer */
-    SIM->SCGC5 |= SIM_SCGC5_LPTMR_MASK;
-    
-    /* Reset */
-    LPTMR0->CSR = 0;
-    
-    /* Set interrupt handler */
-    NVIC_SetVector(LPTimer_IRQn, (uint32_t)lptmr_isr);
-    NVIC_EnableIRQ(LPTimer_IRQn);
-    
-    /* Clock at (1)MHz -> (1)tick/us */
-    LPTMR0->PSR = LPTMR_PSR_PCS(3);       // OSCERCLK -> 8MHz
-    LPTMR0->PSR |= LPTMR_PSR_PRESCALE(2); // divide by 8
-}
-
-void us_ticker_disable_interrupt(void) {
-    LPTMR0->CSR &= ~LPTMR_CSR_TIE_MASK;
-}
-
-void us_ticker_clear_interrupt(void) {
-    // we already clear interrupt in lptmr_isr
-}
-
-static uint32_t us_ticker_int_counter = 0;
-static uint16_t us_ticker_int_remainder = 0;
-
-static void lptmr_set(unsigned short count) {
-    /* Reset */
-    LPTMR0->CSR = 0;
-    
-    /* Set the compare register */
-    LPTMR0->CMR = count;
-    
-    /* Enable interrupt */
-    LPTMR0->CSR |= LPTMR_CSR_TIE_MASK;
-    
-    /* Start the timer */
-    LPTMR0->CSR |= LPTMR_CSR_TEN_MASK;
-}
-
-static void lptmr_isr(void) {
-    // write 1 to TCF to clear the LPT timer compare flag
-    LPTMR0->CSR |= LPTMR_CSR_TCF_MASK;
-    
-    if (us_ticker_int_counter > 0) {
-        lptmr_set(0xFFFF);
-        us_ticker_int_counter--;
-    
-    } else {
-        if (us_ticker_int_remainder > 0) {
-            lptmr_set(us_ticker_int_remainder);
-            us_ticker_int_remainder = 0;
-        
-        } else {
-            // This function is going to disable the interrupts if there are
-            // no other events in the queue
-            us_ticker_irq_handler();
-        }
-    }
-}
-
-void us_ticker_set_interrupt(unsigned int timestamp) {
-    int delta = (int)(timestamp - us_ticker_read());
-    if (delta <= 0) {
-        // This event was in the past:
-        us_ticker_irq_handler();
-        return;
-    }
-    
-    us_ticker_int_counter   = (uint32_t)(delta >> 16);
-    us_ticker_int_remainder = (uint16_t)(0xFFFF & delta);
-    if (us_ticker_int_counter > 0) {
-        lptmr_set(0xFFFF);
-        us_ticker_int_counter--;
-    } else {
-        lptmr_set(us_ticker_int_remainder);
-        us_ticker_int_remainder = 0;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/hal/TARGET_NXP/PeripheralNames.h	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,65 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_PERIPHERALNAMES_H
+#define MBED_PERIPHERALNAMES_H
+
+#include "cmsis.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+    UART_0 = (int)LPC_UART_BASE
+} UARTName;
+
+typedef enum {
+    I2C_0 = (int)LPC_I2C_BASE
+} I2CName;
+
+typedef enum {
+    ADC0_0 = 0,
+    ADC0_1,
+    ADC0_2,
+    ADC0_3,
+    ADC0_4,
+    ADC0_5,
+    ADC0_6,
+    ADC0_7
+} ADCName;
+
+typedef enum {
+    SPI_0 = (int)LPC_SSP0_BASE,
+    SPI_1 = (int)LPC_SSP1_BASE
+} SPIName;
+
+typedef enum {
+    PWM_1 = 0,
+    PWM_2,
+    PWM_3,
+    PWM_4,
+    PWM_5
+} PWMName;
+
+#define STDIO_UART_TX     USBTX
+#define STDIO_UART_RX     USBRX
+#define STDIO_UART        UART_0
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/hal/TARGET_NXP/PinNames.h	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,233 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_PINNAMES_H
+#define MBED_PINNAMES_H
+
+#include "cmsis.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+    PIN_INPUT,
+    PIN_OUTPUT
+} PinDirection;
+
+#define PORT_SHIFT  12
+#define PIN_SHIFT   8
+
+typedef enum {
+    // LPC1114 Pin Names (PORT[15:12] + PIN[11:8] + IOCON offset[7:0])
+
+    P0_0  = (0 << PORT_SHIFT) | (0  << PIN_SHIFT) | 0x0c,
+    P0_1  = (0 << PORT_SHIFT) | (1  << PIN_SHIFT) | 0x10,
+    P0_2  = (0 << PORT_SHIFT) | (2  << PIN_SHIFT) | 0x1c,
+    P0_3  = (0 << PORT_SHIFT) | (3  << PIN_SHIFT) | 0x2c,
+    P0_4  = (0 << PORT_SHIFT) | (4  << PIN_SHIFT) | 0x30,
+    P0_5  = (0 << PORT_SHIFT) | (5  << PIN_SHIFT) | 0x34,
+    P0_6  = (0 << PORT_SHIFT) | (6  << PIN_SHIFT) | 0x4c,
+    P0_7  = (0 << PORT_SHIFT) | (7  << PIN_SHIFT) | 0x50,
+    P0_8  = (0 << PORT_SHIFT) | (8  << PIN_SHIFT) | 0x60,
+    P0_9  = (0 << PORT_SHIFT) | (9  << PIN_SHIFT) | 0x64,
+    P0_11 = (0 << PORT_SHIFT) | (11 << PIN_SHIFT) | 0x74,
+
+    P1_0  = (1 << PORT_SHIFT) | (0  << PIN_SHIFT) | 0x78,
+    P1_1  = (1 << PORT_SHIFT) | (1  << PIN_SHIFT) | 0x7c,
+    P1_2  = (1 << PORT_SHIFT) | (2  << PIN_SHIFT) | 0x80,
+    P1_4  = (1 << PORT_SHIFT) | (4  << PIN_SHIFT) | 0x94,
+    P1_5  = (1 << PORT_SHIFT) | (5  << PIN_SHIFT) | 0xa0,
+    P1_6  = (1 << PORT_SHIFT) | (6  << PIN_SHIFT) | 0xa4,
+    P1_7  = (1 << PORT_SHIFT) | (7  << PIN_SHIFT) | 0xa8,
+    P1_8  = (1 << PORT_SHIFT) | (8  << PIN_SHIFT) | 0x14,
+    P1_9  = (1 << PORT_SHIFT) | (9  << PIN_SHIFT) | 0x38,
+    P1_10 = (1 << PORT_SHIFT) | (10 << PIN_SHIFT) | 0x6c,
+    P1_11 = (1 << PORT_SHIFT) | (11 << PIN_SHIFT) | 0x98,
+
+    P2_0  = (2 << PORT_SHIFT) | (0  << PIN_SHIFT) | 0x08,
+    P2_1  = (2 << PORT_SHIFT) | (1  << PIN_SHIFT) | 0x28,
+    P2_2  = (2 << PORT_SHIFT) | (2  << PIN_SHIFT) | 0x5c,
+    P2_3  = (2 << PORT_SHIFT) | (3  << PIN_SHIFT) | 0x8c,
+    P2_4  = (2 << PORT_SHIFT) | (4  << PIN_SHIFT) | 0x40,
+    P2_5  = (2 << PORT_SHIFT) | (5  << PIN_SHIFT) | 0x44,
+    P2_6  = (2 << PORT_SHIFT) | (6  << PIN_SHIFT) | 0x00,
+    P2_7  = (2 << PORT_SHIFT) | (7  << PIN_SHIFT) | 0x20,
+    P2_8  = (2 << PORT_SHIFT) | (8  << PIN_SHIFT) | 0x24,
+    P2_9  = (2 << PORT_SHIFT) | (9  << PIN_SHIFT) | 0x54,
+    P2_10 = (2 << PORT_SHIFT) | (10 << PIN_SHIFT) | 0x58,
+    P2_11 = (2 << PORT_SHIFT) | (11 << PIN_SHIFT) | 0x70,
+   
+    P3_0  = (3 << PORT_SHIFT) | (0  << PIN_SHIFT) | 0x84,
+    P3_1  = (3 << PORT_SHIFT) | (1  << PIN_SHIFT) | 0x88,
+    P3_2  = (3 << PORT_SHIFT) | (2  << PIN_SHIFT) | 0x9c,
+    P3_3  = (3 << PORT_SHIFT) | (3  << PIN_SHIFT) | 0xac,
+    P3_4  = (3 << PORT_SHIFT) | (4  << PIN_SHIFT) | 0x3c,
+    P3_5  = (3 << PORT_SHIFT) | (5  << PIN_SHIFT) | 0x48,
+
+    // mbed DIP Pin Names (CQ board)
+    p4  = P0_0,
+    p5  = P0_9,
+    p6  = P0_8,
+    p7  = P0_6,
+    p8  = P1_5,
+    p9  = P1_7,
+    p10 = P1_6,
+    p11 = P0_7,
+    p12 = P1_0,
+    p13 = P1_1,
+    p14 = P1_2,
+    p15 = P0_11,
+    p16 = P1_0,
+    p17 = P1_1,
+    p18 = P1_2,
+    p20 = P1_4,
+    p22 = P0_2,
+    p23 = P0_11,
+    p24 = P0_2,
+    p25 = P1_8,
+    p26 = P1_9,
+    p27 = P0_4,
+    p28 = P0_5,
+    p29 = P0_3,
+    p30 = P0_1,
+
+    // Other mbed Pin Names
+    LED1 = P1_5,
+    LED2 = P0_7,
+    LED3 = P1_5,
+    LED4 = P0_7,
+
+    USBTX = P1_7,
+    USBRX = P1_6,
+
+    // mbed DIP Pin Names (LPCXpresso LPC1114)
+    xp4  = P0_0,
+    xp5  = P0_9,
+    xp6  = P0_8,
+    xp7  = P2_11,
+    xp8  = P0_2,
+    xp9  = P1_7,
+    xp10 = P1_6,
+    xp11 = P0_7,
+    xp12 = P2_0,
+    xp13 = P2_1,
+    xp14 = P2_2,
+    xp15 = P0_11,
+    xp16 = P1_0,
+    xp17 = P1_1,
+    xp18 = P1_2,
+    xp20 = P1_4,
+    xp21 = P1_5,
+    xp22 = P1_8,
+    xp23 = P0_6,
+    xp25 = P3_0,
+    xp26 = P3_1,
+    xp27 = P3_2,
+
+    xp29 = P3_3,
+    xp30 = P2_10,
+    xp31 = P2_9,
+    xp32 = P2_8,
+    xp33 = P2_7,
+    xp34 = P2_6,
+    xp35 = P2_5,
+    xp36 = P2_4,
+    xp37 = P2_3,
+    xp38 = P1_11,
+    xp39 = P1_10,
+    xp40 = P1_9,
+    xp41 = P0_4,
+    xp42 = P0_5,
+    xp43 = P0_3,
+    xp44 = P0_1,
+
+    // Other mbed Pin Names
+    xLED1 = P0_7,
+	
+	// DIP Package Names
+	
+	dp1  = P0_8,
+	dp2  = P0_9,
+	dp4  = P0_11,
+	dp5  = P0_5,
+	dp6  = P0_6,
+	dp9  = P1_0,
+	dp10 = P1_1,
+	dp11 = P1_2,
+	dp13 = P1_4,
+	dp14 = P1_5,
+	dp15 = P1_6,
+	dp16 = P1_7,
+	dp17 = P1_8,
+	dp18 = P1_9,
+	dp23 = P0_0,
+	dp24 = P0_1,
+	dp25 = P0_2,
+	dp26 = P0_3,
+	dp27 = P0_4,
+	dp28 = P0_7,
+	
+	dip1  = P0_8,
+	dip2  = P0_9,
+	dip4  = P0_11,
+	dip5  = P0_5,
+	dip6  = P0_6,
+	dip9  = P1_0,
+	dip10 = P1_1,
+	dip11 = P1_2,
+	dip13 = P1_4,
+	dip14 = P1_5,
+	dip15 = P1_6,
+	dip16 = P1_7,
+	dip17 = P1_8,
+	dip18 = P1_9,
+	dip23 = P0_0,
+	dip24 = P0_1,
+	dip25 = P0_2,
+	dip26 = P0_3,
+	dip27 = P0_4,
+	dip28 = P0_7,
+	
+	
+
+    // Not connected
+    NC = (int)0xFFFFFFFF,
+} PinName;
+
+typedef enum {
+    CHANNEL0 = WAKEUP0_IRQn,
+    CHANNEL1 = WAKEUP1_IRQn,
+    CHANNEL2 = WAKEUP2_IRQn,
+    CHANNEL3 = WAKEUP3_IRQn,
+    CHANNEL4 = WAKEUP4_IRQn,
+    CHANNEL5 = WAKEUP5_IRQn,
+    CHANNEL6 = WAKEUP6_IRQn,
+    CHANNEL7 = WAKEUP7_IRQn
+} Channel;
+
+typedef enum {
+    PullUp = 2,
+    PullDown = 1,
+    PullNone = 0,
+    Repeater = 3,
+    OpenDrain = 4
+} PinMode;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/hal/TARGET_NXP/PortNames.h	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,33 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_PORTNAMES_H
+#define MBED_PORTNAMES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+    Port0 = 0,
+    Port1 = 1,
+    Port2 = 2,
+    Port3 = 3
+} PortName;
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC11UXX/PeripheralNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    UART_0 = (int)LPC_USART_BASE
-} UARTName;
-
-typedef enum {
-    I2C_0 = (int)LPC_I2C_BASE
-} I2CName;
-
-typedef enum {
-    ADC0_0 = 0,
-    ADC0_1,
-    ADC0_2,
-    ADC0_3,
-    ADC0_4,
-    ADC0_5,
-    ADC0_6,
-    ADC0_7
-} ADCName;
-
-typedef enum {
-    SPI_0 = (int)LPC_SSP0_BASE,
-    SPI_1 = (int)LPC_SSP1_BASE
-} SPIName;
-
-typedef enum {
-    PWM_1 = 0,
-    PWM_2,
-    PWM_3,
-    PWM_4,
-    PWM_5,
-    PWM_6,
-    PWM_7,
-    PWM_8,
-    PWM_9,
-    PWM_10,
-    PWM_11
-} PWMName;
-
-#define STDIO_UART_TX     USBTX
-#define STDIO_UART_RX     USBRX
-#define STDIO_UART        UART_0
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC11UXX/PinNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PINNAMES_H
-#define MBED_PINNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    PIN_INPUT,
-    PIN_OUTPUT
-} PinDirection;
-
-#define PORT_SHIFT  5
-
-typedef enum {
-    // LPC11U Pin Names
-    P0_0 = 0,
-    P0_1 = 1,
-    P0_2 = 2,
-    P0_3 = 3,
-    P0_4 = 4,
-    P0_5 = 5,
-    P0_6 = 6,
-    P0_7 = 7,
-    P0_8 = 8,
-    P0_9 = 9,
-    P0_10 = 10,
-    P0_11 = 11,
-    P0_12 = 12,
-    P0_13 = 13,
-    P0_14 = 14,
-    P0_15 = 15,
-    P0_16 = 16,
-    P0_17 = 17,
-    P0_18 = 18,
-    P0_19 = 19,
-    P0_20 = 20,
-    P0_21 = 21,
-    P0_22 = 22,
-    P0_23 = 23,
-    P0_24 = 24,
-    P0_25 = 25,
-    P0_26 = 26,
-    P0_27 = 27,
-
-    P1_0 = 32,
-    P1_1 = 33,
-    P1_2 = 34,
-    P1_3 = 35,
-    P1_4 = 36,
-    P1_5 = 37,
-    P1_6 = 38,
-    P1_7 = 39,
-    P1_8 = 40,
-    P1_9 = 41,
-    P1_10 = 42,
-    P1_11 = 43,
-    P1_12 = 44,
-    P1_13 = 45,
-    P1_14 = 46,
-    P1_15 = 47,
-    P1_16 = 48,
-    P1_17 = 49,
-    P1_18 = 50,
-    P1_19 = 51,
-    P1_20 = 52,
-    P1_21 = 53,
-    P1_22 = 54,
-    P1_23 = 55,
-    P1_24 = 56,
-    P1_25 = 57,
-    P1_26 = 58,
-    P1_27 = 59,
-    P1_28 = 60,
-    P1_29 = 61,
-
-    P1_31 = 63,
-
-    // mbed DIP Pin Names
-    p5  = P0_9,
-    p6  = P0_8,
-    p7  = P1_29,
-    p8  = P0_2,
-    p9  = P1_27,
-    p10 = P1_26,
-    p11 = P1_22,
-    p12 = P1_21,
-    p13 = P1_20,
-    p14 = P1_23,
-    p15 = P0_11,
-    p16 = P0_12,
-    p17 = P0_13,
-    p18 = P0_14,
-    p19 = P0_16,
-    p20 = P0_22,
-    p21 = P0_7,
-    p22 = P0_17,
-    p23 = P1_17,
-    p24 = P1_18,
-    p25 = P1_24,
-    p26 = P1_25,
-    p27 = P0_4,
-    p28 = P0_5,
-    p29 = P1_5,
-    p30 = P1_2,
-
-    p33 = P0_3,
-    p34 = P1_15,
-    p35 = P0_20,
-    p36 = P0_21,
-
-    // Other mbed Pin Names
-    LED1 = P1_8,
-    LED2 = P1_9,
-    LED3 = P1_10,
-    LED4 = P1_11,
-
-    USBTX = P0_19,
-    USBRX = P0_18,
-
-    // Not connected
-    NC = (int)0xFFFFFFFF,
-} PinName;
-
-typedef enum {
-    CHANNEL0 = FLEX_INT0_IRQn,
-    CHANNEL1 = FLEX_INT1_IRQn,
-    CHANNEL2 = FLEX_INT2_IRQn,
-    CHANNEL3 = FLEX_INT3_IRQn,
-    CHANNEL4 = FLEX_INT4_IRQn,
-    CHANNEL5 = FLEX_INT5_IRQn,
-    CHANNEL6 = FLEX_INT6_IRQn,
-    CHANNEL7 = FLEX_INT7_IRQn
-} Channel;
-
-typedef enum {
-    PullUp = 2,
-    PullDown = 1,
-    PullNone = 0,
-    Repeater = 3,
-    OpenDrain = 4
-} PinMode;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC11UXX/PortNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PORTNAMES_H
-#define MBED_PORTNAMES_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    Port0 = 0,
-    Port1 = 1
-} PortName;
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC11UXX/analogin_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "analogin_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-#define ANALOGIN_MEDIAN_FILTER      1
-
-#define ADC_10BIT_RANGE             0x3FF
-#define ADC_12BIT_RANGE             0xFFF
-
-static inline int div_round_up(int x, int y) {
-  return (x + (y - 1)) / y;
-}
-
-static const PinMap PinMap_ADC[] = {
-    {P0_11, ADC0_0, 0x02},
-    {P0_12, ADC0_1, 0x02},
-    {P0_13, ADC0_2, 0x02},
-    {P0_14, ADC0_3, 0x02},
-    {P0_15, ADC0_4, 0x02},
-    {P0_16, ADC0_5, 0x01},
-    {P0_22, ADC0_6, 0x01},
-    {P0_23, ADC0_7, 0x01},
-    {NC   , NC    , 0   }
-};
-
-#define LPC_IOCON0_BASE (LPC_IOCON_BASE)
-#define LPC_IOCON1_BASE (LPC_IOCON_BASE + 0x60)
-
-#define ADC_RANGE    ADC_10BIT_RANGE
-
-void analogin_init(analogin_t *obj, PinName pin) {
-    obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
-    if (obj->adc == (ADCName)NC) {
-        error("ADC pin mapping failed");
-    }
-    
-    // Power up ADC
-    LPC_SYSCON->PDRUNCFG &= ~ (1 << 4);
-    LPC_SYSCON->SYSAHBCLKCTRL |= ((uint32_t)1 << 13);
-
-    uint32_t pin_number = (uint32_t)pin;
-    __IO uint32_t *reg = (pin_number < 32) ? (__IO uint32_t*)(LPC_IOCON0_BASE + 4 * pin_number) : (__IO uint32_t*)(LPC_IOCON1_BASE + 4 * (pin_number - 32));
-
-    // set pin to ADC mode
-    *reg &= ~(1 << 7); // set ADMODE = 0 (analog mode)
-
-    uint32_t PCLK = SystemCoreClock;
-    uint32_t MAX_ADC_CLK = 4500000;
-    uint32_t clkdiv = div_round_up(PCLK, MAX_ADC_CLK) - 1;
-
-    LPC_ADC->CR = (0 << 0)      // no channels selected
-                | (clkdiv << 8) // max of 4.5MHz
-                | (0 << 16)     // BURST = 0, software controlled
-                | ( 0 << 17 );  // CLKS = 0, not applicable
-    
-    pinmap_pinout(pin, PinMap_ADC);
-}
-
-static inline uint32_t adc_read(analogin_t *obj) {
-    // Select the appropriate channel and start conversion
-    LPC_ADC->CR &= ~0xFF;
-    LPC_ADC->CR |= 1 << (int)obj->adc;
-    LPC_ADC->CR |= 1 << 24;
-    
-    // Repeatedly get the sample data until DONE bit
-    unsigned int data;
-    do {
-        data = LPC_ADC->GDR;
-    } while ((data & ((unsigned int)1 << 31)) == 0);
-    
-    // Stop conversion
-    LPC_ADC->CR &= ~(1 << 24);
-    
-    return (data >> 6) & ADC_RANGE; // 10 bit
-}
-
-static inline void order(uint32_t *a, uint32_t *b) {
-    if (*a > *b) {
-        uint32_t t = *a;
-        *a = *b;
-        *b = t;
-    }
-}
-
-static inline uint32_t adc_read_u32(analogin_t *obj) {
-    uint32_t value;
-#if ANALOGIN_MEDIAN_FILTER
-    uint32_t v1 = adc_read(obj);
-    uint32_t v2 = adc_read(obj);
-    uint32_t v3 = adc_read(obj);
-    order(&v1, &v2);
-    order(&v2, &v3);
-    order(&v1, &v2);
-    value = v2;
-#else
-    value = adc_read(obj);
-#endif
-    return value;
-}
-
-uint16_t analogin_read_u16(analogin_t *obj) {
-    uint32_t value = adc_read_u32(obj);
-    
-    return (value << 6) | ((value >> 4) & 0x003F); // 10 bit
-}
-
-float analogin_read(analogin_t *obj) {
-    uint32_t value = adc_read_u32(obj);
-    return (float)value * (1.0f / (float)ADC_RANGE);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC11UXX/device.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_DEVICE_H
-#define MBED_DEVICE_H
-
-#define DEVICE_PORTIN           1
-#define DEVICE_PORTOUT          1
-#define DEVICE_PORTINOUT        1
-
-#define DEVICE_INTERRUPTIN      1
-
-#define DEVICE_ANALOGIN         1
-#define DEVICE_ANALOGOUT        0
-
-#define DEVICE_SERIAL           1
-
-#define DEVICE_I2C              1
-#define DEVICE_I2CSLAVE         1
-
-#define DEVICE_SPI              1
-#define DEVICE_SPISLAVE         1
-
-#define DEVICE_CAN              0
-
-#define DEVICE_RTC              0
-
-#define DEVICE_ETHERNET         0
-
-#define DEVICE_PWMOUT           1
-
-#define DEVICE_SEMIHOST         1
-#define DEVICE_LOCALFILESYSTEM  1
-#define DEVICE_ID_LENGTH       32
-#define DEVICE_MAC_OFFSET      20
-
-#define DEVICE_SLEEP            1
-
-#define DEVICE_DEBUG_AWARENESS  0
-
-#define DEVICE_STDIO_MESSAGES   1
-
-#define DEVICE_ERROR_PATTERN    1
-
-#include "objects.h"
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC11UXX/gpio_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "gpio_api.h"
-#include "pinmap.h"
-
-uint32_t gpio_set(PinName pin) {
-    int f = ((pin == P0_11) ||
-             (pin == P0_12) ||
-             (pin == P0_13) ||
-             (pin == P0_14)) ? (1) : (0);
-    
-    pin_function(pin, f);
-    
-    return (1 << ((int)pin & 0x1F));
-}
-
-void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) {
-    if(pin == NC) return;
-
-    obj->pin = pin;
-    obj->mask = gpio_set(pin);
-    
-    unsigned int port = (unsigned int)pin >> PORT_SHIFT;
-    
-    obj->reg_set = &LPC_GPIO->SET[port];
-    obj->reg_clr = &LPC_GPIO->CLR[port];
-    obj->reg_in  = &LPC_GPIO->PIN[port];
-    obj->reg_dir = &LPC_GPIO->DIR[port];
-    
-    gpio_dir(obj, direction);
-    switch (direction) {
-        case PIN_OUTPUT: pin_mode(pin, PullNone); break;
-        case PIN_INPUT : pin_mode(pin, PullDown); break;
-    }
-}
-
-void gpio_mode(gpio_t *obj, PinMode mode) {
-    pin_mode(obj->pin, mode);
-}
-
-void gpio_dir(gpio_t *obj, PinDirection direction) {
-    switch (direction) {
-        case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break;
-        case PIN_OUTPUT: *obj->reg_dir |=  obj->mask; break;
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC11UXX/gpio_irq_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stddef.h>
-#include "cmsis.h"
-#include "gpio_irq_api.h"
-#include "error.h"
-
-#define CHANNEL_NUM    8
-#define LPC_GPIO_X LPC_GPIO_PIN_INT
-#define PININT_IRQ 0
-
-static uint32_t channel_ids[CHANNEL_NUM] = {0};
-static gpio_irq_handler irq_handler;
-
-static inline void handle_interrupt_in(uint32_t channel) {
-    uint32_t ch_bit = (1 << channel);
-    // Return immediately if:
-    //   * The interrupt was already served
-    //   * There is no user handler
-    //   * It is a level interrupt, not an edge interrupt
-    if ( ((LPC_GPIO_X->IST & ch_bit) == 0) ||
-         (channel_ids[channel] == 0      ) ||
-         (LPC_GPIO_X->ISEL & ch_bit      ) ) return;
-
-    if ((LPC_GPIO_X->IENR & ch_bit) && (LPC_GPIO_X->RISE & ch_bit)) {
-        irq_handler(channel_ids[channel], IRQ_RISE);
-        LPC_GPIO_X->RISE = ch_bit;
-    }
-    if ((LPC_GPIO_X->IENF & ch_bit) && (LPC_GPIO_X->FALL & ch_bit)) {
-        irq_handler(channel_ids[channel], IRQ_FALL);
-    }
-    LPC_GPIO_X->IST = ch_bit;
-}
-
-void gpio_irq0(void) {handle_interrupt_in(0);}
-void gpio_irq1(void) {handle_interrupt_in(1);}
-void gpio_irq2(void) {handle_interrupt_in(2);}
-void gpio_irq3(void) {handle_interrupt_in(3);}
-void gpio_irq4(void) {handle_interrupt_in(4);}
-void gpio_irq5(void) {handle_interrupt_in(5);}
-void gpio_irq6(void) {handle_interrupt_in(6);}
-void gpio_irq7(void) {handle_interrupt_in(7);}
-
-int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id) {
-    if (pin == NC) return -1;
-    
-    irq_handler = handler;
-    
-    int found_free_channel = 0;
-    int i = 0;
-    for (i=0; i<CHANNEL_NUM; i++) {
-        if (channel_ids[i] == 0) {
-            channel_ids[i] = id;
-            obj->ch = i;
-            found_free_channel = 1;
-            break;
-        }
-    }
-    if (!found_free_channel) return -1;
-    
-    /* Enable AHB clock to the GPIO domain. */
-    LPC_SYSCON->SYSAHBCLKCTRL |= (1<<6);
-    
-    /* Enable AHB clock to the FlexInt, GroupedInt domain. */
-    LPC_SYSCON->SYSAHBCLKCTRL |= ((1<<19) | (1<<23) | (1<<24));
-    
-    /* To select a pin for any of the eight pin interrupts, write the pin number
-     * as 0 to 23 for pins PIO0_0 to PIO0_23 and 24 to 55.
-     * @see: mbed_capi/PinNames.h
-     */
-    LPC_SYSCON->PINTSEL[obj->ch] = (pin >> 5) ? (pin - 8) : (pin);
-    
-    // Interrupt Wake-Up Enable
-    LPC_SYSCON->STARTERP0 |= 1 << obj->ch;
-    
-    void (*channels_irq)(void) = NULL;
-    switch (obj->ch) {
-        case 0: channels_irq = &gpio_irq0; break;
-        case 1: channels_irq = &gpio_irq1; break;
-        case 2: channels_irq = &gpio_irq2; break;
-        case 3: channels_irq = &gpio_irq3; break;
-        case 4: channels_irq = &gpio_irq4; break;
-        case 5: channels_irq = &gpio_irq5; break;
-        case 6: channels_irq = &gpio_irq6; break;
-        case 7: channels_irq = &gpio_irq7; break;
-    }
-    NVIC_SetVector((IRQn_Type)(PININT_IRQ + obj->ch), (uint32_t)channels_irq);
-    NVIC_EnableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
-    
-    return 0;
-}
-
-void gpio_irq_free(gpio_irq_t *obj) {
-    channel_ids[obj->ch] = 0;
-    LPC_SYSCON->STARTERP0 &= ~(1 << obj->ch);
-}
-
-void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
-    unsigned int ch_bit = (1 << obj->ch);
-    
-    // Clear interrupt
-    if (!(LPC_GPIO_X->ISEL & ch_bit))
-        LPC_GPIO_X->IST = ch_bit;
-    
-    // Edge trigger
-    LPC_GPIO_X->ISEL &= ~ch_bit;
-    if (event == IRQ_RISE) {
-        if (enable) {
-            LPC_GPIO_X->IENR |= ch_bit;
-        } else {
-            LPC_GPIO_X->IENR &= ~ch_bit;
-        }
-    } else {
-        if (enable) {
-            LPC_GPIO_X->IENF |= ch_bit;
-        } else {
-            LPC_GPIO_X->IENF &= ~ch_bit;
-        }
-    }
-}
-
-void gpio_irq_enable(gpio_irq_t *obj) {
-    NVIC_EnableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
-}
-
-void gpio_irq_disable(gpio_irq_t *obj) {
-    NVIC_DisableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC11UXX/gpio_object.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_GPIO_OBJECT_H
-#define MBED_GPIO_OBJECT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
-    PinName  pin;
-    uint32_t mask;
-
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_set;
-    __IO uint32_t *reg_clr;
-    __I  uint32_t *reg_in;
-} gpio_t;
-
-static inline void gpio_write(gpio_t *obj, int value) {
-    if (value)
-        *obj->reg_set = obj->mask;
-    else
-        *obj->reg_clr = obj->mask;
-}
-
-static inline int gpio_read(gpio_t *obj) {
-    return ((*obj->reg_in & obj->mask) ? 1 : 0);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC11UXX/i2c_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,387 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "i2c_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_I2C_SDA[] = {
-    {P0_5, I2C_0, 1},
-    {NC  , NC   , 0}
-};
-
-static const PinMap PinMap_I2C_SCL[] = {
-    {P0_4, I2C_0, 1},
-    {NC  , NC,    0}
-};
-
-#define I2C_CONSET(x)       (x->i2c->CONSET)
-#define I2C_CONCLR(x)       (x->i2c->CONCLR)
-#define I2C_STAT(x)         (x->i2c->STAT)
-#define I2C_DAT(x)          (x->i2c->DAT)
-#define I2C_SCLL(x, val)    (x->i2c->SCLL = val)
-#define I2C_SCLH(x, val)    (x->i2c->SCLH = val)
-
-static const uint32_t I2C_addr_offset[2][4] = {
-    {0x0C, 0x20, 0x24, 0x28},
-    {0x30, 0x34, 0x38, 0x3C}
-};
-
-static inline void i2c_conclr(i2c_t *obj, int start, int stop, int interrupt, int acknowledge) {
-    I2C_CONCLR(obj) = (start << 5)
-                    | (stop << 4)
-                    | (interrupt << 3)
-                    | (acknowledge << 2);
-}
-
-static inline void i2c_conset(i2c_t *obj, int start, int stop, int interrupt, int acknowledge) {
-    I2C_CONSET(obj) = (start << 5)
-                    | (stop << 4)
-                    | (interrupt << 3)
-                    | (acknowledge << 2);
-}
-
-// Clear the Serial Interrupt (SI)
-static inline void i2c_clear_SI(i2c_t *obj) {
-    i2c_conclr(obj, 0, 0, 1, 0);
-}
-
-static inline int i2c_status(i2c_t *obj) {
-    return I2C_STAT(obj);
-}
-
-// Wait until the Serial Interrupt (SI) is set
-static int i2c_wait_SI(i2c_t *obj) {
-    int timeout = 0;
-    while (!(I2C_CONSET(obj) & (1 << 3))) {
-        timeout++;
-        if (timeout > 100000) return -1;
-    }
-    return 0;
-}
-
-static inline void i2c_interface_enable(i2c_t *obj) {
-    I2C_CONSET(obj) = 0x40;
-}
-
-static inline void i2c_power_enable(i2c_t *obj) {
-    LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 5);
-    LPC_SYSCON->PRESETCTRL |= 1 << 1;
-}
-
-void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
-    // determine the SPI to use
-    I2CName i2c_sda = (I2CName)pinmap_peripheral(sda, PinMap_I2C_SDA);
-    I2CName i2c_scl = (I2CName)pinmap_peripheral(scl, PinMap_I2C_SCL);
-    obj->i2c = (LPC_I2C_Type *)pinmap_merge(i2c_sda, i2c_scl);
-    
-    if ((int)obj->i2c == NC) {
-        error("I2C pin mapping failed");
-    }
-    
-    // enable power
-    i2c_power_enable(obj);
-    
-    // set default frequency at 100k
-    i2c_frequency(obj, 100000);
-    i2c_conclr(obj, 1, 1, 1, 1);
-    i2c_interface_enable(obj);
-    
-    pinmap_pinout(sda, PinMap_I2C_SDA);
-    pinmap_pinout(scl, PinMap_I2C_SCL);
-}
-
-inline int i2c_start(i2c_t *obj) {
-    int status = 0;
-    // 8.1 Before master mode can be entered, I2CON must be initialised to:
-    //  - I2EN STA STO SI AA - -
-    //  -  1    0   0   0  x - -
-    // if AA = 0, it can't enter slave mode
-    i2c_conclr(obj, 1, 1, 1, 1);
-    
-    // The master mode may now be entered by setting the STA bit
-    // this will generate a start condition when the bus becomes free
-    i2c_conset(obj, 1, 0, 0, 1);
-    
-    i2c_wait_SI(obj);
-    status = i2c_status(obj);
-    
-    // Clear start bit now transmitted, and interrupt bit
-    i2c_conclr(obj, 1, 0, 0, 0);
-    return status;
-}
-
-inline int i2c_stop(i2c_t *obj) {
-    int timeout = 0;
-
-    // write the stop bit
-    i2c_conset(obj, 0, 1, 0, 0);
-    i2c_clear_SI(obj);
-    
-    // wait for STO bit to reset
-    while(I2C_CONSET(obj) & (1 << 4)) {
-        timeout ++;
-        if (timeout > 100000) return 1;
-    }
-
-    return 0;
-}
-
-
-static inline int i2c_do_write(i2c_t *obj, int value, uint8_t addr) {
-    // write the data
-    I2C_DAT(obj) = value;
-    
-    // clear SI to init a send
-    i2c_clear_SI(obj);
-    
-    // wait and return status
-    i2c_wait_SI(obj);
-    return i2c_status(obj);
-}
-
-static inline int i2c_do_read(i2c_t *obj, int last) {
-    // we are in state 0x40 (SLA+R tx'd) or 0x50 (data rx'd and ack)
-    if (last) {
-        i2c_conclr(obj, 0, 0, 0, 1); // send a NOT ACK
-    } else {
-        i2c_conset(obj, 0, 0, 0, 1); // send a ACK
-    }
-    
-    // accept byte
-    i2c_clear_SI(obj);
-    
-    // wait for it to arrive
-    i2c_wait_SI(obj);
-    
-    // return the data
-    return (I2C_DAT(obj) & 0xFF);
-}
-
-void i2c_frequency(i2c_t *obj, int hz) {
-    // No peripheral clock divider on the M0
-    uint32_t PCLK = SystemCoreClock;
-    
-    uint32_t pulse = PCLK / (hz * 2);
-    
-    // I2C Rate
-    I2C_SCLL(obj, pulse);
-    I2C_SCLH(obj, pulse);
-}
-
-// The I2C does a read or a write as a whole operation
-// There are two types of error conditions it can encounter
-//  1) it can not obtain the bus
-//  2) it gets error responses at part of the transmission
-//
-// We tackle them as follows:
-//  1) we retry until we get the bus. we could have a "timeout" if we can not get it
-//      which basically turns it in to a 2)
-//  2) on error, we use the standard error mechanisms to report/debug
-//
-// Therefore an I2C transaction should always complete. If it doesn't it is usually
-// because something is setup wrong (e.g. wiring), and we don't need to programatically
-// check for that
-
-int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) {
-    int count, status;
-    
-    status = i2c_start(obj);
-    
-    if ((status != 0x10) && (status != 0x08)) {
-        i2c_stop(obj);
-        return I2C_ERROR_BUS_BUSY;
-    }
-    
-    status = i2c_do_write(obj, (address | 0x01), 1);
-    if (status != 0x40) {
-        i2c_stop(obj);
-        return I2C_ERROR_NO_SLAVE;
-    }
-
-    // Read in all except last byte
-    for (count = 0; count < (length - 1); count++) {
-        int value = i2c_do_read(obj, 0);
-        status = i2c_status(obj);
-        if (status != 0x50) {
-            i2c_stop(obj);
-            return count;
-        }
-        data[count] = (char) value;
-    }
-
-    // read in last byte
-    int value = i2c_do_read(obj, 1);
-    status = i2c_status(obj);
-    if (status != 0x58) {
-        i2c_stop(obj);
-        return length - 1;
-    }
-    
-    data[count] = (char) value;
-    
-    // If not repeated start, send stop.
-    if (stop) {
-        i2c_stop(obj);
-    }
-    
-    return length;
-}
-
-int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) {
-    int i, status;
-    
-    status = i2c_start(obj);
-    
-    if ((status != 0x10) && (status != 0x08)) {
-        i2c_stop(obj);
-        return I2C_ERROR_BUS_BUSY;
-    }
-    
-    status = i2c_do_write(obj, (address & 0xFE), 1);
-    if (status != 0x18) {
-        i2c_stop(obj);
-        return I2C_ERROR_NO_SLAVE;
-    }
-    
-    for (i=0; i<length; i++) {
-        status = i2c_do_write(obj, data[i], 0);
-        if(status != 0x28) {
-            i2c_stop(obj);
-            return i;
-        }
-    }
-    
-    // clearing the serial interrupt here might cause an unintended rewrite of the last byte
-    // see also issue report https://mbed.org/users/mbed_official/code/mbed/issues/1
-    // i2c_clear_SI(obj);
-    
-    // If not repeated start, send stop.
-    if (stop) {
-        i2c_stop(obj);
-    }
-    
-    return length;
-}
-
-void i2c_reset(i2c_t *obj) {
-    i2c_stop(obj);
-}
-
-int i2c_byte_read(i2c_t *obj, int last) {
-    return (i2c_do_read(obj, last) & 0xFF);
-}
-
-int i2c_byte_write(i2c_t *obj, int data) {
-    int ack;
-    int status = i2c_do_write(obj, (data & 0xFF), 0);
-    
-    switch(status) {
-        case 0x18: case 0x28:       // Master transmit ACKs
-            ack = 1;
-            break;
-        case 0x40:                  // Master receive address transmitted ACK
-            ack = 1;
-            break;
-        case 0xB8:                  // Slave transmit ACK
-            ack = 1;
-            break;
-        default:
-            ack = 0;
-            break;
-    }
-
-    return ack;
-}
-
-void i2c_slave_mode(i2c_t *obj, int enable_slave) {
-    if (enable_slave != 0) {
-        i2c_conclr(obj, 1, 1, 1, 0);
-        i2c_conset(obj, 0, 0, 0, 1);
-    } else {
-        i2c_conclr(obj, 1, 1, 1, 1);
-    }
-}
-
-int i2c_slave_receive(i2c_t *obj) {
-    int status;
-    int retval;
-    
-    status = i2c_status(obj);
-    switch(status) {
-        case 0x60: retval = 3; break;
-        case 0x70: retval = 2; break;
-        case 0xA8: retval = 1; break;
-        default  : retval = 0; break;
-    }
-    
-    return(retval);
-}
-
-int i2c_slave_read(i2c_t *obj, char *data, int length) {
-    int count = 0;
-    int status;
-    
-    do {
-        i2c_clear_SI(obj);
-        i2c_wait_SI(obj);
-        status = i2c_status(obj);
-        if((status == 0x80) || (status == 0x90)) {
-            data[count] = I2C_DAT(obj) & 0xFF;
-        }
-        count++;
-    } while (((status == 0x80) || (status == 0x90) ||
-            (status == 0x060) || (status == 0x70)) && (count < length));
-    
-    if(status != 0xA0) {
-        i2c_stop(obj);
-    }
-    
-    i2c_clear_SI(obj);
-    
-    return count;
-}
-
-int i2c_slave_write(i2c_t *obj, const char *data, int length) {
-    int count = 0;
-    int status;
-    
-    if(length <= 0) {
-        return(0);
-    }
-    
-    do {
-        status = i2c_do_write(obj, data[count], 0);
-        count++;
-    } while ((count < length) && (status == 0xB8));
-    
-    if((status != 0xC0) && (status != 0xC8)) {
-        i2c_stop(obj);
-    }
-    
-    i2c_clear_SI(obj);
-    
-    return(count);
-}
-
-void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask) {
-    uint32_t addr;
-    
-    if ((idx >= 0) && (idx <= 3)) {
-        addr = ((uint32_t)obj->i2c) + I2C_addr_offset[0][idx];
-        *((uint32_t *) addr) = address & 0xFF;
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC11UXX/objects.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_OBJECTS_H
-#define MBED_OBJECTS_H
-
-#include "cmsis.h"
-#include "PortNames.h"
-#include "PeripheralNames.h"
-#include "PinNames.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct gpio_irq_s {
-    uint32_t ch;
-};
-
-struct port_s {
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_mpin;
-    PortName port;
-    uint32_t mask;
-};
-
-struct pwmout_s {
-    PWMName pwm;
-};
-
-struct serial_s {
-    LPC_USART_Type *uart;
-    int index;
-};
-
-struct analogin_s {
-    ADCName adc;
-};
-
-struct i2c_s {
-    LPC_I2C_Type *i2c;
-};
-
-struct spi_s {
-    LPC_SSPx_Type *spi;
-};
-
-#include "gpio_object.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC11UXX/pinmap.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "pinmap.h"
-#include "error.h"
-
-#define LPC_IOCON0_BASE (LPC_IOCON_BASE)
-#define LPC_IOCON1_BASE (LPC_IOCON_BASE + 0x60)
-
-void pin_function(PinName pin, int function) {
-    if (pin == (PinName)NC) return;
-    
-    uint32_t pin_number = (uint32_t)pin;
-    
-    __IO uint32_t *reg = (pin_number < 32) ?
-            (__IO uint32_t*)(LPC_IOCON0_BASE + 4 * pin_number) :
-            (__IO uint32_t*)(LPC_IOCON1_BASE + 4 * (pin_number - 32));
-    
-    // pin function bits: [2:0] -> 111 = (0x7)
-    *reg = (*reg & ~0x7) | (function & 0x7);
-}
-
-void pin_mode(PinName pin, PinMode mode) {
-    if (pin == (PinName)NC) { return; }
-    
-    uint32_t pin_number = (uint32_t)pin;
-    uint32_t drain = ((uint32_t) mode & (uint32_t) OpenDrain) >> 2;
-    
-    __IO uint32_t *reg = (pin_number < 32) ?
-            (__IO uint32_t*)(LPC_IOCON0_BASE + 4 * pin_number) :
-            (__IO uint32_t*)(LPC_IOCON1_BASE + 4 * (pin_number - 32));
-    uint32_t tmp = *reg;
-    
-    // pin mode bits: [4:3] -> 11000 = (0x3 << 3)
-    tmp &= ~(0x3 << 3);
-    tmp |= (mode & 0x3) << 3;
-    
-    // drain
-    tmp &= ~(0x1 << 10);
-    tmp |= drain << 10;
-    
-    *reg = tmp;
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC11UXX/port_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "port_api.h"
-#include "pinmap.h"
-#include "gpio_api.h"
-
-PinName port_pin(PortName port, int pin_n) {
-    return (PinName)((port << PORT_SHIFT) | pin_n);
-}
-
-void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
-    obj->port = port;
-    obj->mask = mask;
-    
-    LPC_GPIO->MASK[port] = ~mask;
-    
-    obj->reg_mpin = &LPC_GPIO->MPIN[port];
-    obj->reg_dir = &LPC_GPIO->DIR[port];
-    
-    uint32_t i;
-    // The function is set per pin: reuse gpio logic
-    for (i=0; i<32; i++) {
-        if (obj->mask & (1<<i)) {
-            gpio_set(port_pin(obj->port, i));
-        }
-    }
-    
-    port_dir(obj, dir);
-}
-
-void port_mode(port_t *obj, PinMode mode) {
-    uint32_t i;
-    // The mode is set per pin: reuse pinmap logic
-    for (i=0; i<32; i++) {
-        if (obj->mask & (1<<i)) {
-            pin_mode(port_pin(obj->port, i), mode);
-        }
-    }
-}
-
-void port_dir(port_t *obj, PinDirection dir) {
-    switch (dir) {
-        case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break;
-        case PIN_OUTPUT: *obj->reg_dir |=  obj->mask; break;
-    }
-}
-
-void port_write(port_t *obj, int value) {
-    *obj->reg_mpin = value;
-}
-
-int port_read(port_t *obj) {
-    return (*obj->reg_mpin);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC11UXX/pwmout_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "pwmout_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-#define TCR_CNT_EN       0x00000001
-#define TCR_RESET        0x00000002
-
-/* To have a PWM where we can change both the period and the duty cycle,
- * we need an entire timer. With the following conventions:
- *   * MR3 is used for the PWM period
- *   * MR0, MR1, MR2 are used for the duty cycle
- */
-static const PinMap PinMap_PWM[] = {
-    /* CT16B0 */
-    {P0_8 , PWM_1, 2}, {P1_13, PWM_1, 2},    /* MR0 */
-    {P0_9 , PWM_2, 2}, {P1_14, PWM_2, 2},   /* MR1 */
-    {P0_10, PWM_3, 3}, {P1_15, PWM_3, 2},   /* MR2 */
-
-    /* CT16B1 */
-    {P0_21, PWM_4, 1},                      /* MR0 */
-    {P0_22, PWM_5, 2}, {P1_23, PWM_5, 1},   /* MR1 */
-
-    /* CT32B0 */
-    {P0_18, PWM_6, 2}, {P1_24, PWM_6, 1},   /* MR0 */
-    {P0_19, PWM_7, 2}, {P1_25, PWM_7, 1},   /* MR1 */
-    {P0_1 , PWM_8, 2}, {P1_26, PWM_8, 1},   /* MR2 */
-
-    /* CT32B1 */
-    {P0_13, PWM_9 , 3}, {P1_0, PWM_9 , 1},  /* MR0 */
-    {P0_14, PWM_10, 3}, {P1_1, PWM_10, 1},  /* MR1 */
-    {P0_15, PWM_11, 3}, {P1_2, PWM_11, 1},  /* MR2 */
-
-    {NC, NC, 0}
-};
-
-typedef struct {
-    uint8_t timer;
-    uint8_t mr;
-} timer_mr;
-
-static timer_mr pwm_timer_map[11] = {
-    {0, 0}, {0, 1}, {0, 2},
-    {1, 0}, {1, 1},
-    {2, 0}, {2, 1}, {2, 2},
-    {3, 0}, {3, 1}, {3, 2},
-};
-
-static LPC_CTxxBx_Type *Timers[4] = {
-    LPC_CT16B0, LPC_CT16B1,
-    LPC_CT32B0, LPC_CT32B1
-};
-
-static unsigned int pwm_clock_mhz;
-
-void pwmout_init(pwmout_t* obj, PinName pin) {
-    // determine the channel
-    PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM);
-    if (pwm == (PWMName)NC)
-        error("PwmOut pin mapping failed");
-    
-    obj->pwm = pwm;
-    
-    // Timer registers
-    timer_mr tid = pwm_timer_map[pwm];
-    LPC_CTxxBx_Type *timer = Timers[tid.timer];
-    
-    // Disable timer
-    timer->TCR = 0;
-    
-    // Power the correspondent timer
-    LPC_SYSCON->SYSAHBCLKCTRL |= 1 << (tid.timer + 7);
-    
-    /* Enable PWM function */
-    timer->PWMC = (1 << 3)|(1 << 2)|(1 << 1)|(1 << 0);
-    
-    /* Reset Functionality on MR3 controlling the PWM period */
-    timer->MCR = 1 << 10;
-    
-    pwm_clock_mhz = SystemCoreClock / 1000000;
-    
-    // default to 20ms: standard for servos, and fine for e.g. brightness control
-    pwmout_period_ms(obj, 20);
-    pwmout_write    (obj, 0);
-    
-    // Wire pinout
-    pinmap_pinout(pin, PinMap_PWM);
-}
-
-void pwmout_free(pwmout_t* obj) {
-    // [TODO]
-}
-
-void pwmout_write(pwmout_t* obj, float value) {
-    if (value < 0.0f) {
-        value = 0.0;
-    } else if (value > 1.0f) {
-        value = 1.0;
-    }
-    
-    timer_mr tid = pwm_timer_map[obj->pwm];
-    LPC_CTxxBx_Type *timer = Timers[tid.timer];
-    uint32_t t_off = timer->MR3 - (uint32_t)((float)(timer->MR3) * value);
-    
-    timer->TCR = TCR_RESET;
-    timer->MR[tid.mr] = t_off;
-    timer->TCR = TCR_CNT_EN;
-}
-
-float pwmout_read(pwmout_t* obj) {
-    timer_mr tid = pwm_timer_map[obj->pwm];
-    LPC_CTxxBx_Type *timer = Timers[tid.timer];
-    
-    float v = (float)(timer->MR3 - timer->MR[tid.mr]) / (float)(timer->MR3);
-    return (v > 1.0f) ? (1.0f) : (v);
-}
-
-void pwmout_period(pwmout_t* obj, float seconds) {
-    pwmout_period_us(obj, seconds * 1000000.0f);
-}
-
-void pwmout_period_ms(pwmout_t* obj, int ms) {
-    pwmout_period_us(obj, ms * 1000);
-}
-
-// Set the PWM period, keeping the duty cycle the same.
-void pwmout_period_us(pwmout_t* obj, int us) {
-    int i = 0;
-    uint32_t period_ticks = pwm_clock_mhz * us;
-    
-    timer_mr tid = pwm_timer_map[obj->pwm];
-    LPC_CTxxBx_Type *timer = Timers[tid.timer];
-    uint32_t old_period_ticks = timer->MR3;
-    
-    timer->TCR = TCR_RESET;
-    timer->MR3 = period_ticks;
-    
-    // Scale the pulse width to preserve the duty ratio
-    if (old_period_ticks > 0) {
-        for (i=0; i<3; i++) {
-            uint32_t t_off = period_ticks - (uint32_t)(((uint64_t)timer->MR[i] * (uint64_t)period_ticks) / (uint64_t)old_period_ticks);
-            timer->MR[i] = t_off;
-        }
-    }
-    timer->TCR = TCR_CNT_EN;
-}
-
-void pwmout_pulsewidth(pwmout_t* obj, float seconds) {
-    pwmout_pulsewidth_us(obj, seconds * 1000000.0f);
-}
-
-void pwmout_pulsewidth_ms(pwmout_t* obj, int ms) {
-    pwmout_pulsewidth_us(obj, ms * 1000);
-}
-
-void pwmout_pulsewidth_us(pwmout_t* obj, int us) {
-    uint32_t t_on = (uint32_t)(((uint64_t)SystemCoreClock * (uint64_t)us) / (uint64_t)1000000);
-    timer_mr tid = pwm_timer_map[obj->pwm];
-    LPC_CTxxBx_Type *timer = Timers[tid.timer];
-    
-    timer->TCR = TCR_RESET;
-    if (t_on > timer->MR3) {
-        pwmout_period_us(obj, us);
-    }
-    uint32_t t_off = timer->MR3 - t_on;
-    timer->MR[tid.mr] = t_off;
-    timer->TCR = TCR_CNT_EN;
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC11UXX/serial_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,277 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// math.h required for floating point operations for baud rate calculation
-#include <math.h>
-#include <string.h>
-
-#include "serial_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-/******************************************************************************
- * INITIALIZATION
- ******************************************************************************/
-#define UART_NUM    1
-
-static const PinMap PinMap_UART_TX[] = {
-    {P0_19, UART_0, 1},
-    {P1_13, UART_0, 3},
-    {P1_27, UART_0, 2},
-    { NC  , NC    , 0}
-};
-
-static const PinMap PinMap_UART_RX[] = {
-    {P0_18, UART_0, 1},
-    {P1_14, UART_0, 3},
-    {P1_26, UART_0, 2},
-    {NC   , NC    , 0}
-};
-
-static uint32_t serial_irq_ids[UART_NUM] = {0};
-static uart_irq_handler irq_handler;
-
-int stdio_uart_inited = 0;
-serial_t stdio_uart;
-
-void serial_init(serial_t *obj, PinName tx, PinName rx) {
-    int is_stdio_uart = 0;
-    
-    // determine the UART to use
-    UARTName uart_tx = (UARTName)pinmap_peripheral(tx, PinMap_UART_TX);
-    UARTName uart_rx = (UARTName)pinmap_peripheral(rx, PinMap_UART_RX);
-    UARTName uart = (UARTName)pinmap_merge(uart_tx, uart_rx);
-    if ((int)uart == NC) {
-        error("Serial pinout mapping failed");
-    }
-    
-    obj->uart = (LPC_USART_Type *)uart;
-    LPC_SYSCON->SYSAHBCLKCTRL |= (1<<12);
-    
-    // [TODO] Consider more elegant approach
-    // disconnect USBTX/RX mapping mux, for case when switching ports
-    pin_function(USBTX, 0);
-    pin_function(USBRX, 0);
-    
-    // enable fifos and default rx trigger level
-    obj->uart->FCR = 1 << 0  // FIFO Enable - 0 = Disables, 1 = Enabled
-                   | 0 << 1  // Rx Fifo Reset
-                   | 0 << 2  // Tx Fifo Reset
-                   | 0 << 6; // Rx irq trigger level - 0 = 1 char, 1 = 4 chars, 2 = 8 chars, 3 = 14 chars
-    
-    // disable irqs
-    obj->uart->IER = 0 << 0  // Rx Data available irq enable
-                   | 0 << 1  // Tx Fifo empty irq enable
-                   | 0 << 2; // Rx Line Status irq enable
-    
-    // set default baud rate and format
-    serial_baud  (obj, 9600);
-    serial_format(obj, 8, ParityNone, 1);
-    
-    // pinout the chosen uart
-    pinmap_pinout(tx, PinMap_UART_TX);
-    pinmap_pinout(rx, PinMap_UART_RX);
-    
-    // set rx/tx pins in PullUp mode
-    pin_mode(tx, PullUp);
-    pin_mode(rx, PullUp);
-    
-    switch (uart) {
-        case UART_0: obj->index = 0; break;
-    }
-    
-    is_stdio_uart = (uart == STDIO_UART) ? (1) : (0);
-    
-    if (is_stdio_uart) {
-        stdio_uart_inited = 1;
-        memcpy(&stdio_uart, obj, sizeof(serial_t));
-    }
-}
-
-void serial_free(serial_t *obj) {
-    serial_irq_ids[obj->index] = 0;
-}
-
-// serial_baud
-// set the baud rate, taking in to account the current SystemFrequency
-void serial_baud(serial_t *obj, int baudrate) {
-    LPC_SYSCON->UARTCLKDIV = 0x1;
-    uint32_t PCLK = SystemCoreClock;
-    // First we check to see if the basic divide with no DivAddVal/MulVal
-    // ratio gives us an integer result. If it does, we set DivAddVal = 0,
-    // MulVal = 1. Otherwise, we search the valid ratio value range to find
-    // the closest match. This could be more elegant, using search methods
-    // and/or lookup tables, but the brute force method is not that much
-    // slower, and is more maintainable.
-    uint16_t DL = PCLK / (16 * baudrate);
-    
-    uint8_t DivAddVal = 0;
-    uint8_t MulVal = 1;
-    int hit = 0;
-    uint16_t dlv;
-    uint8_t mv, dav;
-    if ((PCLK % (16 * baudrate)) != 0) {     // Checking for zero remainder
-        float err_best = (float) baudrate;
-        uint16_t dlmax = DL;
-        for ( dlv = (dlmax/2); (dlv <= dlmax) && !hit; dlv++) {
-            for ( mv = 1; mv <= 15; mv++) {
-                for ( dav = 1; dav < mv; dav++) {
-                    float ratio = 1.0f + ((float) dav / (float) mv);
-                    float calcbaud = (float)PCLK / (16.0f * (float) dlv * ratio);
-                    float err = fabs(((float) baudrate - calcbaud) / (float) baudrate);
-                    if (err < err_best) {
-                        DL = dlv;
-                        DivAddVal = dav;
-                        MulVal = mv;
-                        err_best = err;
-                        if (err < 0.001f) {
-                            hit = 1;
-                        }
-                    }
-                }
-            }
-        }
-    }
-    
-    // set LCR[DLAB] to enable writing to divider registers
-    obj->uart->LCR |= (1 << 7);
-    
-    // set divider values
-    obj->uart->DLM = (DL >> 8) & 0xFF;
-    obj->uart->DLL = (DL >> 0) & 0xFF;
-    obj->uart->FDR = (uint32_t) DivAddVal << 0
-                   | (uint32_t) MulVal    << 4;
-    
-    // clear LCR[DLAB]
-    obj->uart->LCR &= ~(1 << 7);
-}
-
-void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits) {
-    // 0: 1 stop bits, 1: 2 stop bits
-    if (stop_bits != 1 && stop_bits != 2) {
-        error("Invalid stop bits specified");
-    }
-    stop_bits -= 1;
-    
-    // 0: 5 data bits ... 3: 8 data bits
-    if (data_bits < 5 || data_bits > 8) {
-        error("Invalid number of bits (%d) in serial format, should be 5..8", data_bits);
-    }
-    data_bits -= 5;
-
-    int parity_enable, parity_select;
-    switch (parity) {
-        case ParityNone: parity_enable = 0; parity_select = 0; break;
-        case ParityOdd : parity_enable = 1; parity_select = 0; break;
-        case ParityEven: parity_enable = 1; parity_select = 1; break;
-        case ParityForced1: parity_enable = 1; parity_select = 2; break;
-        case ParityForced0: parity_enable = 1; parity_select = 3; break;
-        default:
-            error("Invalid serial parity setting");
-            return;
-    }
-    
-    obj->uart->LCR = data_bits            << 0
-                   | stop_bits            << 2
-                   | parity_enable        << 3
-                   | parity_select        << 4;
-}
-
-/******************************************************************************
- * INTERRUPTS HANDLING
- ******************************************************************************/
-static inline void uart_irq(uint32_t iir, uint32_t index) {
-    // [Chapter 14] LPC17xx UART0/2/3: UARTn Interrupt Handling
-    SerialIrq irq_type;
-    switch (iir) {
-        case 1: irq_type = TxIrq; break;
-        case 2: irq_type = RxIrq; break;
-        default: return;
-    }
-    
-    if (serial_irq_ids[index] != 0)
-        irq_handler(serial_irq_ids[index], irq_type);
-}
-
-void uart0_irq() {uart_irq((LPC_USART->IIR >> 1) & 0x7, 0);}
-
-void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id) {
-    irq_handler = handler;
-    serial_irq_ids[obj->index] = id;
-}
-
-void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) {
-    IRQn_Type irq_n = (IRQn_Type)0;
-    uint32_t vector = 0;
-    switch ((int)obj->uart) {
-        case UART_0: irq_n=UART_IRQn ; vector = (uint32_t)&uart0_irq; break;
-    }
-    
-    if (enable) {
-        obj->uart->IER |= 1 << irq;
-        NVIC_SetVector(irq_n, vector);
-        NVIC_EnableIRQ(irq_n);
-    } else { // disable
-        int all_disabled = 0;
-        SerialIrq other_irq = (irq == RxIrq) ? (TxIrq) : (RxIrq);
-
-        obj->uart->IER &= ~(1 << irq);
-        all_disabled = (obj->uart->IER & (1 << other_irq)) == 0;
-        
-        if (all_disabled)
-            NVIC_DisableIRQ(irq_n);
-    }
-}
-
-/******************************************************************************
- * READ/WRITE
- ******************************************************************************/
-int serial_getc(serial_t *obj) {
-    while (!serial_readable(obj));
-    return obj->uart->RBR;
-}
-
-void serial_putc(serial_t *obj, int c) {
-    while (!serial_writable(obj));
-    obj->uart->THR = c;
-}
-
-int serial_readable(serial_t *obj) {
-    return obj->uart->LSR & 0x01;
-}
-
-int serial_writable(serial_t *obj) {
-    return obj->uart->LSR & 0x20;
-}
-
-void serial_clear(serial_t *obj) {
-    obj->uart->FCR = 1 << 1  // rx FIFO reset
-                   | 1 << 2  // tx FIFO reset
-                   | 0 << 6; // interrupt depth
-}
-
-void serial_pinout_tx(PinName tx) {
-    pinmap_pinout(tx, PinMap_UART_TX);
-}
-
-void serial_break_set(serial_t *obj) {
-    obj->uart->LCR |= (1 << 6);
-}
-
-void serial_break_clear(serial_t *obj) {
-    obj->uart->LCR &= ~(1 << 6);
-}
-
--- a/targets/hal/TARGET_NXP/TARGET_LPC11UXX/sleep.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "sleep_api.h"
-#include "cmsis.h"
-#include "mbed_interface.h"
-
-void sleep(void) {
-    // ensure debug is disconnected
-    mbed_interface_disconnect();
-    
-    // PCON[PD] set to sleep
-    LPC_PMU->PCON = 0x0;
-    
-    // SRC[SLEEPDEEP] set to 0 = sleep
-    SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk;
-    
-    // wait for interrupt
-    __WFI();
-}
-
-/*
-* The mbed lpc1768 does not support the deepsleep mode
-* as a debugger is connected to it (the mbed interface).
-*
-* As mentionned in an application note from NXP:
-*
-*       http://www.po-star.com/public/uploads/20120319123122_141.pdf
-*
-*       {{{
-*       The user should be aware of certain limitations during debugging.
-*       The most important is that, due to limitations of the Cortex-M3
-*       integration, the LPC17xx cannot wake up in the usual manner from
-*       Deep Sleep and Power-down modes. It is recommended not to use these
-*       modes during debug. Once an application is downloaded via JTAG/SWD
-*       interface, the USB to SWD/JTAG debug adapter (Keil ULINK2 for example)
-*       should be removed from the target board, and thereafter, power cycle
-*       the LPC17xx to allow wake-up from deep sleep and power-down modes
-*       }}}
-*
-*       As the interface firmware does not reset the target when a
-*       mbed_interface_disconnect() semihosting call is made, the
-*       core cannot wake-up from deepsleep.
-*
-*       We treat a deepsleep() as a normal sleep().
-*/
-
-void deepsleep(void) {
-    // ensure debug is disconnected
-    mbed_interface_disconnect();
-    
-    // PCON[PD] set to deepsleep
-    LPC_PMU->PCON = 0x1;
-    
-    // SRC[SLEEPDEEP] set to 1 = deep sleep
-    SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
-    
-    // Power up everything after powerdown
-    LPC_SYSCON->PDAWAKECFG &= 0xFFFFF800;
-    
-    // wait for interrupt
-    __WFI();
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC11UXX/spi_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,218 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <math.h>
-#include "spi_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_SPI_SCLK[] = {
-    {P0_6 , SPI_0, 0x02},
-    {P0_10, SPI_0, 0x02},
-    {P1_29, SPI_0, 0x01},
-    {P1_15, SPI_1, 0x03},
-    {P1_20, SPI_1, 0x02},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_MOSI[] = {
-    {P0_9 , SPI_0, 0x01},
-    {P0_21, SPI_1, 0x02},
-    {P1_22, SPI_1, 0x02},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_MISO[] = {
-    {P0_8 , SPI_0, 0x01},
-    {P0_22, SPI_1, 0x03},
-    {P1_21, SPI_1, 0x02},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_SSEL[] = {
-    {P0_2 , SPI_0, 0x01},
-    {P1_19, SPI_1, 0x02},
-    {P1_23, SPI_1, 0x02},
-    {NC   , NC   , 0}
-};
-
-static inline int ssp_disable(spi_t *obj);
-static inline int ssp_enable(spi_t *obj);
-
-void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel) {
-    // determine the SPI to use
-    SPIName spi_mosi = (SPIName)pinmap_peripheral(mosi, PinMap_SPI_MOSI);
-    SPIName spi_miso = (SPIName)pinmap_peripheral(miso, PinMap_SPI_MISO);
-    SPIName spi_sclk = (SPIName)pinmap_peripheral(sclk, PinMap_SPI_SCLK);
-    SPIName spi_ssel = (SPIName)pinmap_peripheral(ssel, PinMap_SPI_SSEL);
-    SPIName spi_data = (SPIName)pinmap_merge(spi_mosi, spi_miso);
-    SPIName spi_cntl = (SPIName)pinmap_merge(spi_sclk, spi_ssel);
-    
-    obj->spi = (LPC_SSPx_Type*)pinmap_merge(spi_data, spi_cntl);
-    
-    if ((int)obj->spi == NC) {
-        error("SPI pinout mapping failed");
-    }
-    
-    // enable power and clocking
-    switch ((int)obj->spi) {
-        case SPI_0:
-            LPC_SYSCON->SYSAHBCLKCTRL |= 1 << 11;
-            LPC_SYSCON->SSP0CLKDIV = 0x01;
-            LPC_SYSCON->PRESETCTRL |= 1 << 0;
-            break;
-        case SPI_1:
-            LPC_SYSCON->SYSAHBCLKCTRL |= 1 << 18;
-            LPC_SYSCON->SSP1CLKDIV = 0x01;
-            LPC_SYSCON->PRESETCTRL |= 1 << 2;
-            break;
-    }
-    
-    // set default format and frequency
-    if (ssel == NC) {
-        spi_format(obj, 8, 0, 0);  // 8 bits, mode 0, master
-    } else {
-        spi_format(obj, 8, 0, 1);  // 8 bits, mode 0, slave
-    }
-    spi_frequency(obj, 1000000);
-    
-    // enable the ssp channel
-    ssp_enable(obj);
-    
-    // pin out the spi pins
-    pinmap_pinout(mosi, PinMap_SPI_MOSI);
-    pinmap_pinout(miso, PinMap_SPI_MISO);
-    pinmap_pinout(sclk, PinMap_SPI_SCLK);
-    if (ssel != NC) {
-        pinmap_pinout(ssel, PinMap_SPI_SSEL);
-    }
-}
-
-void spi_free(spi_t *obj) {}
-
-void spi_format(spi_t *obj, int bits, int mode, int slave) {
-    ssp_disable(obj);
-    
-    if (!(bits >= 4 && bits <= 16) || !(mode >= 0 && mode <= 3)) {
-        error("SPI format error");
-    }
-    
-    int polarity = (mode & 0x2) ? 1 : 0;
-    int phase = (mode & 0x1) ? 1 : 0;
-    
-    // set it up
-    int DSS = bits - 1;            // DSS (data select size)
-    int SPO = (polarity) ? 1 : 0;  // SPO - clock out polarity
-    int SPH = (phase) ? 1 : 0;     // SPH - clock out phase
-    
-    int FRF = 0;                   // FRF (frame format) = SPI
-    uint32_t tmp = obj->spi->CR0;
-    tmp &= ~(0xFFFF);
-    tmp |= DSS << 0
-        | FRF << 4
-        | SPO << 6
-        | SPH << 7;
-    obj->spi->CR0 = tmp;
-    
-    tmp = obj->spi->CR1;
-    tmp &= ~(0xD);
-    tmp |= 0 << 0                   // LBM - loop back mode - off
-        | ((slave) ? 1 : 0) << 2   // MS - master slave mode, 1 = slave
-        | 0 << 3;                  // SOD - slave output disable - na
-    obj->spi->CR1 = tmp;
-    
-    ssp_enable(obj);
-}
-
-void spi_frequency(spi_t *obj, int hz) {
-    ssp_disable(obj);
-    
-    uint32_t PCLK = SystemCoreClock;
-    
-    int prescaler;
-    
-    for (prescaler = 2; prescaler <= 254; prescaler += 2) {
-        int prescale_hz = PCLK / prescaler;
-        
-        // calculate the divider
-        int divider = floor(((float)prescale_hz / (float)hz) + 0.5f);
-        
-        // check we can support the divider
-        if (divider < 256) {
-            // prescaler
-            obj->spi->CPSR = prescaler;
-            
-            // divider
-            obj->spi->CR0 &= ~(0xFFFF << 8);
-            obj->spi->CR0 |= (divider - 1) << 8;
-            ssp_enable(obj);
-            return;
-        }
-    }
-    error("Couldn't setup requested SPI frequency");
-}
-
-static inline int ssp_disable(spi_t *obj) {
-    return obj->spi->CR1 &= ~(1 << 1);
-}
-
-static inline int ssp_enable(spi_t *obj) {
-    return obj->spi->CR1 |= (1 << 1);
-}
-
-static inline int ssp_readable(spi_t *obj) {
-    return obj->spi->SR & (1 << 2);
-}
-
-static inline int ssp_writeable(spi_t *obj) {
-    return obj->spi->SR & (1 << 1);
-}
-
-static inline void ssp_write(spi_t *obj, int value) {
-    while (!ssp_writeable(obj));
-    obj->spi->DR = value;
-}
-
-static inline int ssp_read(spi_t *obj) {
-    while (!ssp_readable(obj));
-    return obj->spi->DR;
-}
-
-static inline int ssp_busy(spi_t *obj) {
-    return (obj->spi->SR & (1 << 4)) ? (1) : (0);
-}
-
-int spi_master_write(spi_t *obj, int value) {
-    ssp_write(obj, value);
-    return ssp_read(obj);
-}
-
-int spi_slave_receive(spi_t *obj) {
-    return (ssp_readable(obj) && !ssp_busy(obj)) ? (1) : (0);
-};
-
-int spi_slave_read(spi_t *obj) {
-    return obj->spi->DR;
-}
-
-void spi_slave_write(spi_t *obj, int value) {
-    while (ssp_writeable(obj) == 0) ;
-    obj->spi->DR = value;
-}
-
-int spi_busy(spi_t *obj) {
-    return ssp_busy(obj);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC11UXX/us_ticker.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stddef.h>
-#include "us_ticker_api.h"
-#include "PeripheralNames.h"
-
-#define US_TICKER_TIMER          ((LPC_CTxxBx_Type *)LPC_CT32B1_BASE)
-#define US_TICKER_TIMER_IRQn     TIMER_32_1_IRQn
-
-int us_ticker_inited = 0;
-
-void us_ticker_init(void) {
-    if (us_ticker_inited) return;
-    us_ticker_inited = 1;
-    
-    LPC_SYSCON->SYSAHBCLKCTRL |= (1<<10); // Clock TIMER_1
-    uint32_t PCLK = SystemCoreClock;
-    
-    US_TICKER_TIMER->TCR = 0x2;  // reset
-    
-    uint32_t prescale = PCLK / 1000000; // default to 1MHz (1 us ticks)
-    US_TICKER_TIMER->PR = prescale - 1;
-    US_TICKER_TIMER->TCR = 1; // enable = 1, reset = 0
-    
-    NVIC_SetVector(US_TICKER_TIMER_IRQn, (uint32_t)us_ticker_irq_handler);
-    NVIC_EnableIRQ(US_TICKER_TIMER_IRQn);
-}
-
-uint32_t us_ticker_read() {
-    if (!us_ticker_inited)
-        us_ticker_init();
-    
-    return US_TICKER_TIMER->TC;
-}
-
-void us_ticker_set_interrupt(unsigned int timestamp) {
-    // set match value
-    US_TICKER_TIMER->MR0 = timestamp;
-    // enable match interrupt
-    US_TICKER_TIMER->MCR |= 1;
-}
-
-void us_ticker_disable_interrupt(void) {
-    US_TICKER_TIMER->MCR &= ~1;
-}
-
-void us_ticker_clear_interrupt(void) {
-    US_TICKER_TIMER->IR = 1;
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/PeripheralNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    UART_0 = (int)LPC_UART_BASE
-} UARTName;
-
-typedef enum {
-    I2C_0 = (int)LPC_I2C_BASE
-} I2CName;
-
-typedef enum {
-    ADC0_0 = 0,
-    ADC0_1,
-    ADC0_2,
-    ADC0_3,
-    ADC0_4,
-    ADC0_5,
-    ADC0_6,
-    ADC0_7
-} ADCName;
-
-typedef enum {
-    SPI_0 = (int)LPC_SSP0_BASE,
-    SPI_1 = (int)LPC_SSP1_BASE
-} SPIName;
-
-typedef enum {
-    PWM_1 = 0,
-    PWM_2,
-    PWM_3,
-    PWM_4,
-    PWM_5
-} PWMName;
-
-#define STDIO_UART_TX     USBTX
-#define STDIO_UART_RX     USBRX
-#define STDIO_UART        UART_0
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/PortNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PORTNAMES_H
-#define MBED_PORTNAMES_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    Port0 = 0,
-    Port1 = 1,
-    Port2 = 2,
-    Port3 = 3
-} PortName;
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11CXX/PinNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,218 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PINNAMES_H
-#define MBED_PINNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    PIN_INPUT,
-    PIN_OUTPUT
-} PinDirection;
-
-#define PORT_SHIFT  12
-#define PIN_SHIFT   8
-
-typedef enum {
-    // LPC1114 Pin Names (PORT[15:12] + PIN[11:8] + IOCON offset[7:0])
-
-    P0_0  = (0 << PORT_SHIFT) | (0  << PIN_SHIFT) | 0x0c,
-    P0_1  = (0 << PORT_SHIFT) | (1  << PIN_SHIFT) | 0x10,
-    P0_2  = (0 << PORT_SHIFT) | (2  << PIN_SHIFT) | 0x1c,
-    P0_3  = (0 << PORT_SHIFT) | (3  << PIN_SHIFT) | 0x2c,
-    P0_4  = (0 << PORT_SHIFT) | (4  << PIN_SHIFT) | 0x30,
-    P0_5  = (0 << PORT_SHIFT) | (5  << PIN_SHIFT) | 0x34,
-    P0_6  = (0 << PORT_SHIFT) | (6  << PIN_SHIFT) | 0x4c,
-    P0_7  = (0 << PORT_SHIFT) | (7  << PIN_SHIFT) | 0x50,
-    P0_8  = (0 << PORT_SHIFT) | (8  << PIN_SHIFT) | 0x60,
-    P0_9  = (0 << PORT_SHIFT) | (9  << PIN_SHIFT) | 0x64,
-    P0_10 = (0 << PORT_SHIFT) | (10 << PIN_SHIFT) | 0x68,
-    P0_11 = (0 << PORT_SHIFT) | (11 << PIN_SHIFT) | 0x74,
-
-    P1_0  = (1 << PORT_SHIFT) | (0  << PIN_SHIFT) | 0x78,
-    P1_1  = (1 << PORT_SHIFT) | (1  << PIN_SHIFT) | 0x7c,
-    P1_2  = (1 << PORT_SHIFT) | (2  << PIN_SHIFT) | 0x80,
-    P1_3  = (1 << PORT_SHIFT) | (3  << PIN_SHIFT) | 0x90,
-    P1_4  = (1 << PORT_SHIFT) | (4  << PIN_SHIFT) | 0x94,
-    P1_5  = (1 << PORT_SHIFT) | (5  << PIN_SHIFT) | 0xa0,
-    P1_6  = (1 << PORT_SHIFT) | (6  << PIN_SHIFT) | 0xa4,
-    P1_7  = (1 << PORT_SHIFT) | (7  << PIN_SHIFT) | 0xa8,
-    P1_8  = (1 << PORT_SHIFT) | (8  << PIN_SHIFT) | 0x14,
-    P1_9  = (1 << PORT_SHIFT) | (9  << PIN_SHIFT) | 0x38,
-    P1_10 = (1 << PORT_SHIFT) | (10 << PIN_SHIFT) | 0x6c,
-    P1_11 = (1 << PORT_SHIFT) | (11 << PIN_SHIFT) | 0x98,
-
-    P2_0  = (2 << PORT_SHIFT) | (0  << PIN_SHIFT) | 0x08,
-    P2_1  = (2 << PORT_SHIFT) | (1  << PIN_SHIFT) | 0x28,
-    P2_2  = (2 << PORT_SHIFT) | (2  << PIN_SHIFT) | 0x5c,
-    P2_3  = (2 << PORT_SHIFT) | (3  << PIN_SHIFT) | 0x8c,
-    P2_4  = (2 << PORT_SHIFT) | (4  << PIN_SHIFT) | 0x40,
-    P2_5  = (2 << PORT_SHIFT) | (5  << PIN_SHIFT) | 0x44,
-    P2_6  = (2 << PORT_SHIFT) | (6  << PIN_SHIFT) | 0x00,
-    P2_7  = (2 << PORT_SHIFT) | (7  << PIN_SHIFT) | 0x20,
-    P2_8  = (2 << PORT_SHIFT) | (8  << PIN_SHIFT) | 0x24,
-    P2_9  = (2 << PORT_SHIFT) | (9  << PIN_SHIFT) | 0x54,
-    P2_10 = (2 << PORT_SHIFT) | (10 << PIN_SHIFT) | 0x58,
-    P2_11 = (2 << PORT_SHIFT) | (11 << PIN_SHIFT) | 0x70,
-   
-    P3_0  = (3 << PORT_SHIFT) | (0  << PIN_SHIFT) | 0x84,
-    P3_1  = (3 << PORT_SHIFT) | (1  << PIN_SHIFT) | 0x88,
-    P3_2  = (3 << PORT_SHIFT) | (2  << PIN_SHIFT) | 0x9c,
-    P3_3  = (3 << PORT_SHIFT) | (3  << PIN_SHIFT) | 0xac,
-    P3_4  = (3 << PORT_SHIFT) | (4  << PIN_SHIFT) | 0x3c,
-    P3_5  = (3 << PORT_SHIFT) | (5  << PIN_SHIFT) | 0x48,
-
-    // mbed DIP Pin Names (CQ board)
-    p4  = P0_0,
-    p5  = P0_9,
-    p6  = P0_8,
-    p7  = P0_6,
-    p8  = P1_5,
-    p9  = P1_7,
-    p10 = P1_6,
-    p11 = P0_7,
-    p12 = P1_0,
-    p13 = P1_1,
-    p14 = P1_2,
-    p15 = P0_11,
-    p16 = P1_0,
-    p17 = P1_1,
-    p18 = P1_2,
-    p19 = P1_3,
-    p20 = P1_4,
-    p21 = P0_10,
-    p22 = P0_2,
-    p23 = P0_11,
-    p24 = P0_2,
-    p25 = P1_8,
-    p26 = P1_9,
-    p27 = P0_4,
-    p28 = P0_5,
-    p29 = P0_3,
-    p30 = P0_1,
-
-    // Other mbed Pin Names
-    LED1 = P1_5,
-    LED2 = P0_7,
-    LED3 = P1_5,
-    LED4 = P0_7,
-
-    USBTX = P1_7,
-    USBRX = P1_6,
-
-    // mbed DIP Pin Names (LPCXpresso LPC1114)
-    xp4  = P0_0,
-    xp5  = P0_9,
-    xp6  = P0_8,
-    xp7  = P2_11,
-    xp8  = P0_2,
-    xp9  = P1_7,
-    xp10 = P1_6,
-    xp11 = P0_7,
-    xp12 = P2_0,
-    xp13 = P2_1,
-    xp14 = P2_2,
-    xp15 = P0_11,
-    xp16 = P1_0,
-    xp17 = P1_1,
-    xp18 = P1_2,
-    xp19 = P1_3,
-    xp20 = P1_4,
-    xp21 = P1_5,
-    xp22 = P1_8,
-    xp23 = P0_6,
-    xp24 = P0_10,
-    xp25 = P3_0,
-    xp26 = P3_1,
-    xp27 = P3_2,
-
-    xp29 = P3_3,
-    xp30 = P2_10,
-    xp31 = P2_9,
-    xp32 = P2_8,
-    xp33 = P2_7,
-    xp34 = P2_6,
-    xp35 = P2_5,
-    xp36 = P2_4,
-    xp37 = P2_3,
-    xp38 = P1_11,
-    xp39 = P1_10,
-    xp40 = P1_9,
-    xp41 = P0_4,
-    xp42 = P0_5,
-    xp43 = P0_3,
-    xp44 = P0_1,
-
-    // Other mbed Pin Names
-    xLED1 = P0_7,
-	
-	// DIP Package Names
-	
-	dp1  = P0_8,
-	dp2  = P0_9,
-	dp3  = P0_10,
-	dp4  = P0_11,
-	dp5  = P0_5,
-	dp6  = P0_6,
-	dp9  = P1_0,
-	dp10 = P1_1,
-	dp11 = P1_2,
-	dp12 = P1_3,
-	dp13 = P1_4,
-	dp14 = P1_5,
-	dp15 = P1_6,
-	dp16 = P1_7,
-	dp17 = P1_8,
-	dp18 = P1_9,
-	dp23 = P0_0,
-	dp24 = P0_1,
-	dp25 = P0_2,
-	dp26 = P0_3,
-	dp27 = P0_4,
-	dp28 = P0_7,
-
-    // Not connected
-    NC = (int)0xFFFFFFFF,
-} PinName;
-
-typedef enum {
-    CHANNEL0 = WAKEUP0_IRQn,
-    CHANNEL1 = WAKEUP1_IRQn,
-    CHANNEL2 = WAKEUP2_IRQn,
-    CHANNEL3 = WAKEUP3_IRQn,
-    CHANNEL4 = WAKEUP4_IRQn,
-    CHANNEL5 = WAKEUP5_IRQn,
-    CHANNEL6 = WAKEUP6_IRQn,
-    CHANNEL7 = WAKEUP7_IRQn
-} Channel;
-
-typedef enum {
-    PullUp = 2,
-    PullDown = 1,
-    PullNone = 0,
-    Repeater = 3,
-    OpenDrain = 4
-} PinMode;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11CXX/can_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,411 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "can_api.h"
-
-#include "cmsis.h"
-#include "error.h"
-
-#include <math.h>
-#include <string.h>
-
-/* Handy defines */
-#define MSG_OBJ_MAX      32
-#define DLC_MAX          8
-
-#define ID_STD_MASK      0x07FF
-#define ID_EXT_MASK      0x1FFFFFFF
-#define DLC_MASK         0x0F
-
-static uint32_t can_irq_id = 0;
-static can_irq_handler irq_handler;
-
-static uint32_t can_disable(can_t *obj) {
-    uint32_t sm = LPC_CAN->CNTL;
-    LPC_CAN->CNTL |= CANCNTL_INIT;
-    return sm;
-}
-
-static inline void can_enable(can_t *obj) {
-    if (LPC_CAN->CNTL & CANCNTL_INIT) {
-        LPC_CAN->CNTL &= ~CANCNTL_INIT;
-    }
-}
-
-int can_mode(can_t *obj, CanMode mode) {
-    return 0; // not implemented
-}
-
-int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t handle) {
-    uint16_t i;
-
-    // Find first free message object
-    if(handle == 0) {
-        uint32_t msgval = LPC_CAN->MSGV1 | (LPC_CAN->MSGV2 << 16);
-        // Find first free messagebox
-        for(i = 0; i < 32; i++) {
-            if((msgval & (1 << i)) == 0) {
-                handle = i+1;
-                break;
-            }
-        }
-    }
-    
-    if(handle > 0 && handle < 32) {
-        if(format == CANExtended) {
-            // Mark message valid, Direction = TX, Extended Frame, Set Identifier and mask everything
-            LPC_CAN->IF1_ARB1 = BFN_PREP(id, CANIFn_ARB1_ID);
-            LPC_CAN->IF1_ARB2 = CANIFn_ARB2_MSGVAL | CANIFn_ARB2_XTD | BFN_PREP(id >> 16, CANIFn_ARB2_ID);
-            LPC_CAN->IF1_MSK1 = BFN_PREP(mask, CANIFn_MSK1_MSK);
-            LPC_CAN->IF1_MSK2 = CANIFn_MSK2_MXTD | CANIFn_MSK2_MDIR | BFN_PREP(mask >> 16, CANIFn_MSK2_MSK);
-        }
-        else {
-            // Mark message valid, Direction = TX, Set Identifier and mask everything
-            LPC_CAN->IF1_ARB2 = CANIFn_ARB2_MSGVAL | BFN_PREP(id << 2, CANIFn_ARB2_ID);
-            LPC_CAN->IF1_MSK2 = CANIFn_MSK2_MDIR | BFN_PREP(mask << 2, CANIFn_MSK2_MSK);
-        }
-        
-        // Use mask, single message object and set DLC
-        LPC_CAN->IF1_MCTRL = CANIFn_MCTRL_UMASK | CANIFn_MCTRL_EOB | CANIFn_MCTRL_RXIE | BFN_PREP(DLC_MAX, CANIFn_MCTRL_DLC);
-
-        // Transfer all fields to message object
-        LPC_CAN->IF1_CMDMSK = CANIFn_CMDMSK_WR | CANIFn_CMDMSK_MASK | CANIFn_CMDMSK_ARB | CANIFn_CMDMSK_CTRL;
-        
-        // Start Transfer to given message number
-        LPC_CAN->IF1_CMDREQ = BFN_PREP(handle, CANIFn_CMDREQ_MN);
-        
-        // Wait until transfer to message ram complete - TODO: maybe not block??
-        while( LPC_CAN->IF1_CMDREQ & CANIFn_CMDREQ_BUSY );    
-    }
-    
-    return handle;
-}
-
-static inline void can_irq() {
-    irq_handler(can_irq_id, IRQ_RX);
-}
-
-// Register CAN object's irq handler
-void can_irq_init(can_t *obj, can_irq_handler handler, uint32_t id) {
-    irq_handler = handler;
-    can_irq_id = id;    
-}
-
-// Unregister CAN object's irq handler
-void can_irq_free(can_t *obj) {
-        LPC_CAN->CNTL &= ~CANCNTL_IE; // Disable Interrupts :)
-
-    can_irq_id = 0;
-    NVIC_DisableIRQ(CAN_IRQn);
-}
-
-// Clear or set a irq
-void can_irq_set(can_t *obj, CanIrqType type, uint32_t enable) {
-    // Put CAN in Reset Mode and enable interrupt
-    can_disable(obj);
-    if(enable == 0) {
-        LPC_CAN->CNTL &= ~(CANCNTL_IE | CANCNTL_SIE);
-    }
-    else {
-        LPC_CAN->CNTL |= CANCNTL_IE | CANCNTL_SIE;
-    }
-    // Take it out of reset...
-    can_enable(obj);
-    
-    // Enable NVIC if at least 1 interrupt is active
-    NVIC_SetVector(CAN_IRQn, (uint32_t) &can_irq);
-    NVIC_EnableIRQ(CAN_IRQn);
-}
-
-// This table has the sampling points as close to 75% as possible. The first
-// value is TSEG1, the second TSEG2.
-static const int timing_pts[23][2] = {
-    {0x0, 0x0},      // 2,  50%
-    {0x1, 0x0},      // 3,  67%
-    {0x2, 0x0},      // 4,  75%
-    {0x3, 0x0},      // 5,  80%
-    {0x3, 0x1},      // 6,  67%
-    {0x4, 0x1},      // 7,  71%
-    {0x5, 0x1},      // 8,  75%
-    {0x6, 0x1},      // 9,  78%
-    {0x6, 0x2},      // 10, 70%
-    {0x7, 0x2},      // 11, 73%
-    {0x8, 0x2},      // 12, 75%
-    {0x9, 0x2},      // 13, 77%
-    {0x9, 0x3},      // 14, 71%
-    {0xA, 0x3},      // 15, 73%
-    {0xB, 0x3},      // 16, 75%
-    {0xC, 0x3},      // 17, 76%
-    {0xD, 0x3},      // 18, 78%
-    {0xD, 0x4},      // 19, 74%
-    {0xE, 0x4},      // 20, 75%
-    {0xF, 0x4},      // 21, 76%
-    {0xF, 0x5},      // 22, 73%
-    {0xF, 0x6},      // 23, 70%
-    {0xF, 0x7},      // 24, 67%
-};
-
-static unsigned int can_speed(unsigned int sclk, unsigned int cclk, unsigned char psjw) {
-    uint32_t    btr;
-    uint32_t    clkdiv = 1;
-    uint16_t    brp = 0;
-    uint32_t    calcbit;
-    uint32_t    bitwidth;
-    int         hit = 0;
-    int         bits = 0;
-    
-    bitwidth = sclk / cclk;
-    
-    brp = bitwidth / 0x18;
-    while ((!hit) && (brp < bitwidth / 4)) {
-        brp++;
-        for (bits = 22; bits > 0; bits--) {
-            calcbit = (bits + 3) * (brp + 1);
-            if (calcbit == bitwidth) {
-                hit = 1;
-                break;
-            }
-        }
-    }
-    
-    /* This might be funky
-    while(btr > 63 && clkdiv < 16) {
-        btr = btr / 2;
-        clkdiv = clkdiv * 2;
-    }
-    */
-    clkdiv = clkdiv - 1;
-        
-    if (hit) {
-        btr = BFN_PREP(timing_pts[bits][1], CANBT_TSEG2)
-            | BFN_PREP(timing_pts[bits][0], CANBT_TSEG1)
-            | BFN_PREP(psjw, CANBT_SJW)
-            | BFN_PREP(brp, CANBT_BRP);
-        btr = btr | (clkdiv << 16);
-                
-    } else {
-        btr = 0;
-    }
-    
-    return btr;
-}
-
-
-int can_config_rxmsgobj(can_t *obj) {
-    uint16_t i = 0;
-
-    // Make sure the interface is available
-    //while( LPC_CAN->IF1_CMDREQ & CANIFn_CMDREQ_BUSY );
-
-    // Mark message valid, Direction = RX, Don't care about anything else
-    LPC_CAN->IF1_ARB1 = 0;
-    LPC_CAN->IF1_ARB2 = 0;
-    LPC_CAN->IF1_MCTRL = 0;
-
-    for ( i = 0; i < MSG_OBJ_MAX; i++ )
-    {
-        // Transfer arb and control fields to message object
-        LPC_CAN->IF1_CMDMSK = CANIFn_CMDMSK_WR | CANIFn_CMDMSK_ARB | CANIFn_CMDMSK_CTRL | CANIFn_CMDMSK_TXRQST;
-        
-        // Start Transfer to given message number
-        LPC_CAN->IF1_CMDREQ = BFN_PREP(i, CANIFn_CMDREQ_MN);
-        
-        // Wait until transfer to message ram complete - TODO: maybe not block??
-        while( LPC_CAN->IF1_CMDREQ & CANIFn_CMDREQ_BUSY );
-    }
-    
-    // Accept all messages
-    can_filter(obj, 0, 0, CANStandard, 1);
-    
-    return 1;
-}
-
-
-void can_init(can_t *obj, PinName rd, PinName td) {
-    // Enable power and clock
-    LPC_SYSCON->PRESETCTRL |= PRESETCTRL_CAN_RST_N;
-    LPC_SYSCON->SYSAHBCLKCTRL |= SYSAHBCLKCTRL_CAN;
-    
-    // Enable Initialization mode
-    if (!(LPC_CAN->CNTL & CANCNTL_INIT)) {
-        LPC_CAN->CNTL |= CANCNTL_INIT;
-    }
-    
-    can_frequency(obj, 125000);
-    
-    // Resume operation
-    LPC_CAN->CNTL &= ~CANCNTL_INIT;
-    while ( LPC_CAN->CNTL & CANCNTL_INIT );
-    
-    // Initialize RX message object
-    can_config_rxmsgobj(obj);
-}
-
-void can_free(can_t *obj) {
-    LPC_SYSCON->SYSAHBCLKCTRL &= ~(SYSAHBCLKCTRL_CAN);
-    LPC_SYSCON->PRESETCTRL &= ~(PRESETCTRL_CAN_RST_N);
-}
-
-int can_frequency(can_t *obj, int f) {
-    int btr = can_speed(SystemCoreClock, (unsigned int)f, 1);
-    int clkdiv = (btr >> 16) & 0x0F;
-    btr = btr & 0xFFFF;
-    
-    if (btr > 0) {
-        // Set the bit clock
-        LPC_CAN->CNTL |= CANCNTL_CCE;
-        LPC_CAN->CLKDIV = clkdiv;
-        LPC_CAN->BT = btr;
-        LPC_CAN->BRPE = 0x0000;
-        LPC_CAN->CNTL &= ~CANCNTL_CCE;
-        return 1;
-    }
-    return 0;
-}
-
-int can_write(can_t *obj, CAN_Message msg, int cc) {    
-    uint16_t msgnum = 0;
-    
-    // Make sure controller is enabled
-    can_enable(obj);
-    
-    // Make sure the interface is available
-    while( LPC_CAN->IF1_CMDREQ & CANIFn_CMDREQ_BUSY );
-
-    if(msg.format == CANExtended)    {
-        // Mark message valid, Direction = TX, Extended Frame, Set Identifier and mask everything
-        LPC_CAN->IF1_ARB1 = BFN_PREP(msg.id, CANIFn_ARB1_ID);
-        LPC_CAN->IF1_ARB2 = CANIFn_ARB2_MSGVAL | CANIFn_ARB2_XTD | CANIFn_ARB2_DIR | BFN_PREP(msg.id >> 16, CANIFn_ARB2_ID);
-        LPC_CAN->IF1_MSK1 = BFN_PREP(ID_EXT_MASK, CANIFn_MSK1_MSK);
-        LPC_CAN->IF1_MSK2 = CANIFn_MSK2_MXTD | CANIFn_MSK2_MDIR | BFN_PREP(ID_EXT_MASK >> 16, CANIFn_MSK2_MSK);
-    }
-    else {
-        // Mark message valid, Direction = TX, Set Identifier and mask everything
-        LPC_CAN->IF1_ARB2 = CANIFn_ARB2_MSGVAL | CANIFn_ARB2_DIR | BFN_PREP(msg.id << 2, CANIFn_ARB2_ID);
-        LPC_CAN->IF1_MSK2 = CANIFn_MSK2_MDIR | BFN_PREP(ID_STD_MASK << 2, CANIFn_MSK2_MSK);
-    }
-    
-    // Use mask, request transmission, single message object and set DLC
-    LPC_CAN->IF1_MCTRL = CANIFn_MCTRL_UMASK | CANIFn_MCTRL_TXRQST | CANIFn_MCTRL_EOB | BFN_PREP(msg.len, CANIFn_MCTRL_DLC);
-
-    LPC_CAN->IF1_DA1 = BFN_PREP(msg.data[1], CANIFn_DA1_DATA1) | BFN_PREP(msg.data[0], CANIFn_DA1_DATA0);
-    LPC_CAN->IF1_DA2 = BFN_PREP(msg.data[3], CANIFn_DA2_DATA3) | BFN_PREP(msg.data[2], CANIFn_DA2_DATA2);
-    LPC_CAN->IF1_DB1 = BFN_PREP(msg.data[5], CANIFn_DB1_DATA5) | BFN_PREP(msg.data[4], CANIFn_DB1_DATA4);
-    LPC_CAN->IF1_DB2 = BFN_PREP(msg.data[7], CANIFn_DB2_DATA7) | BFN_PREP(msg.data[6], CANIFn_DB2_DATA6);
-
-    // Transfer all fields to message object
-    LPC_CAN->IF1_CMDMSK = CANIFn_CMDMSK_WR | CANIFn_CMDMSK_MASK | CANIFn_CMDMSK_ARB | CANIFn_CMDMSK_CTRL | CANIFn_CMDMSK_TXRQST | CANIFn_CMDMSK_DATA_A | CANIFn_CMDMSK_DATA_B;
-    
-    // Start Transfer to given message number
-    LPC_CAN->IF1_CMDREQ = BFN_PREP(msgnum, CANIFn_CMDREQ_MN);
-    
-    // Wait until transfer to message ram complete - TODO: maybe not block??
-    while( LPC_CAN->IF1_CMDREQ & CANIFn_CMDREQ_BUSY);
-    
-    // Wait until TXOK is set, then clear it - TODO: maybe not block
-    //while( !(LPC_CAN->STAT & CANSTAT_TXOK) );
-    LPC_CAN->STAT &= ~(CANSTAT_TXOK);
-    
-    return 1;
-}
-
-int can_read(can_t *obj, CAN_Message *msg, int handle) {
-    uint16_t i;
-    
-    // Make sure controller is enabled
-    can_enable(obj);
-    
-    // Find first message object with new data
-    if(handle == 0) {
-        uint32_t newdata = LPC_CAN->ND1 | (LPC_CAN->ND2 << 16);
-        // Find first free messagebox
-        for(i = 0; i < 32; i++) {
-            if(newdata & (1 << i)) {
-                handle = i+1;
-                break;
-            }
-        }
-    }
-    
-    if(handle > 0 && handle < 32) {
-        // Wait until message interface is free
-        while( LPC_CAN->IF2_CMDREQ & CANIFn_CMDREQ_BUSY );
-
-        // Transfer all fields to message object
-        LPC_CAN->IF2_CMDMSK = CANIFn_CMDMSK_RD | CANIFn_CMDMSK_MASK | CANIFn_CMDMSK_ARB | CANIFn_CMDMSK_CTRL | CANIFn_CMDMSK_CLRINTPND | CANIFn_CMDMSK_TXRQST | CANIFn_CMDMSK_DATA_A | CANIFn_CMDMSK_DATA_B;
-        
-        // Start Transfer from given message number
-        LPC_CAN->IF2_CMDREQ = BFN_PREP(handle, CANIFn_CMDREQ_MN);
-        
-        // Wait until transfer to message ram complete
-        while( LPC_CAN->IF2_CMDREQ & CANIFn_CMDREQ_BUSY );
-                    
-        if (LPC_CAN->IF2_ARB2 & CANIFn_ARB2_XTD) {  
-            msg->format = CANExtended;    
-            msg->id = (LPC_CAN->IF2_ARB1 & CANIFn_ARB2_ID_MASK) << 16;
-            msg->id |= (LPC_CAN->IF2_ARB2 & CANIFn_ARB2_ID_MASK);
-        }
-        else {
-            msg->format = CANStandard;  
-            msg->id = (LPC_CAN->IF2_ARB2 & CANIFn_ARB2_ID_MASK) >> 2;
-        }
-
-        // TODO: Remote frame support
-        msg->type       = CANData;
-        msg->len        = BFN_GET(LPC_CAN->IF2_MCTRL, CANIFn_MCTRL_DLC); // TODO: If > 8, len = 8
-        msg->data[0]    = BFN_GET(LPC_CAN->IF2_DA1, CANIFn_DA1_DATA0);
-        msg->data[1]    = BFN_GET(LPC_CAN->IF2_DA1, CANIFn_DA1_DATA1);
-        msg->data[2]    = BFN_GET(LPC_CAN->IF2_DA2, CANIFn_DA2_DATA2);
-        msg->data[3]    = BFN_GET(LPC_CAN->IF2_DA2, CANIFn_DA2_DATA3);
-        msg->data[4]    = BFN_GET(LPC_CAN->IF2_DB1, CANIFn_DB1_DATA4);
-        msg->data[5]    = BFN_GET(LPC_CAN->IF2_DB1, CANIFn_DB1_DATA5);
-        msg->data[6]    = BFN_GET(LPC_CAN->IF2_DB2, CANIFn_DB2_DATA6);
-        msg->data[7]    = BFN_GET(LPC_CAN->IF2_DB2, CANIFn_DB2_DATA7);
-        
-        LPC_CAN->STAT &= ~(CANSTAT_RXOK);
-        return 1;
-    }
-
-    return 0;
-}
-
-void can_reset(can_t *obj) {
-    LPC_SYSCON->PRESETCTRL &= ~PRESETCTRL_CAN_RST_N;
-    LPC_CAN->STAT = 0;
-    
-    can_config_rxmsgobj(obj);
-}
-
-unsigned char can_rderror(can_t *obj) {
-    return BFN_GET(LPC_CAN->EC, CANEC_REC);
-}
-
-unsigned char can_tderror(can_t *obj) {
-    return BFN_GET(LPC_CAN->EC, CANEC_TEC);
-}
-
-void can_monitor(can_t *obj, int silent) {
-    if (silent) {
-        LPC_CAN->CNTL |= CANCNTL_TEST;
-        LPC_CAN->TEST |= CANTEST_SILENT;
-    } else {
-        LPC_CAN->CNTL &= ~(CANCNTL_TEST);
-        LPC_CAN->TEST &= ~CANTEST_SILENT;
-    }
-
-    if (!(LPC_CAN->CNTL & CANCNTL_INIT)) {
-        LPC_CAN->CNTL |= CANCNTL_INIT;
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11CXX/device.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_DEVICE_H
-#define MBED_DEVICE_H
-
-#define DEVICE_PORTIN           1
-#define DEVICE_PORTOUT          1
-#define DEVICE_PORTINOUT        1
-
-#define DEVICE_INTERRUPTIN      1
-
-#define DEVICE_ANALOGIN         1
-#define DEVICE_ANALOGOUT        0
-
-#define DEVICE_SERIAL           1
-
-#define DEVICE_I2C              1
-#define DEVICE_I2CSLAVE         1
-
-#define DEVICE_SPI              1
-#define DEVICE_SPISLAVE         1
-
-#define DEVICE_CAN              1
-
-#define DEVICE_RTC              0
-
-#define DEVICE_ETHERNET         0
-
-#define DEVICE_PWMOUT           1
-
-#define DEVICE_SEMIHOST         1
-#define DEVICE_LOCALFILESYSTEM  1
-#define DEVICE_ID_LENGTH       32
-#define DEVICE_MAC_OFFSET      20
-
-#define DEVICE_SLEEP            1
-
-#define DEVICE_DEBUG_AWARENESS  0
-
-#define DEVICE_STDIO_MESSAGES   1
-
-#define DEVICE_ERROR_PATTERN    1
-
-#include "objects.h"
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11CXX/reserved_pins.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-// List of reserved pins for LPC11C24
-
-#ifndef RESERVED_PINS_H
-#define RESERVED_PINS_H
-
-#define TARGET_RESERVED_PINS {P0_0, P0_10, P0_11, P1_0, P1_1, P1_2, P1_3}
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11XX/PinNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,233 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PINNAMES_H
-#define MBED_PINNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    PIN_INPUT,
-    PIN_OUTPUT
-} PinDirection;
-
-#define PORT_SHIFT  12
-#define PIN_SHIFT   8
-
-typedef enum {
-    // LPC1114 Pin Names (PORT[15:12] + PIN[11:8] + IOCON offset[7:0])
-
-    P0_0  = (0 << PORT_SHIFT) | (0  << PIN_SHIFT) | 0x0c,
-    P0_1  = (0 << PORT_SHIFT) | (1  << PIN_SHIFT) | 0x10,
-    P0_2  = (0 << PORT_SHIFT) | (2  << PIN_SHIFT) | 0x1c,
-    P0_3  = (0 << PORT_SHIFT) | (3  << PIN_SHIFT) | 0x2c,
-    P0_4  = (0 << PORT_SHIFT) | (4  << PIN_SHIFT) | 0x30,
-    P0_5  = (0 << PORT_SHIFT) | (5  << PIN_SHIFT) | 0x34,
-    P0_6  = (0 << PORT_SHIFT) | (6  << PIN_SHIFT) | 0x4c,
-    P0_7  = (0 << PORT_SHIFT) | (7  << PIN_SHIFT) | 0x50,
-    P0_8  = (0 << PORT_SHIFT) | (8  << PIN_SHIFT) | 0x60,
-    P0_9  = (0 << PORT_SHIFT) | (9  << PIN_SHIFT) | 0x64,
-    P0_11 = (0 << PORT_SHIFT) | (11 << PIN_SHIFT) | 0x74,
-
-    P1_0  = (1 << PORT_SHIFT) | (0  << PIN_SHIFT) | 0x78,
-    P1_1  = (1 << PORT_SHIFT) | (1  << PIN_SHIFT) | 0x7c,
-    P1_2  = (1 << PORT_SHIFT) | (2  << PIN_SHIFT) | 0x80,
-    P1_4  = (1 << PORT_SHIFT) | (4  << PIN_SHIFT) | 0x94,
-    P1_5  = (1 << PORT_SHIFT) | (5  << PIN_SHIFT) | 0xa0,
-    P1_6  = (1 << PORT_SHIFT) | (6  << PIN_SHIFT) | 0xa4,
-    P1_7  = (1 << PORT_SHIFT) | (7  << PIN_SHIFT) | 0xa8,
-    P1_8  = (1 << PORT_SHIFT) | (8  << PIN_SHIFT) | 0x14,
-    P1_9  = (1 << PORT_SHIFT) | (9  << PIN_SHIFT) | 0x38,
-    P1_10 = (1 << PORT_SHIFT) | (10 << PIN_SHIFT) | 0x6c,
-    P1_11 = (1 << PORT_SHIFT) | (11 << PIN_SHIFT) | 0x98,
-
-    P2_0  = (2 << PORT_SHIFT) | (0  << PIN_SHIFT) | 0x08,
-    P2_1  = (2 << PORT_SHIFT) | (1  << PIN_SHIFT) | 0x28,
-    P2_2  = (2 << PORT_SHIFT) | (2  << PIN_SHIFT) | 0x5c,
-    P2_3  = (2 << PORT_SHIFT) | (3  << PIN_SHIFT) | 0x8c,
-    P2_4  = (2 << PORT_SHIFT) | (4  << PIN_SHIFT) | 0x40,
-    P2_5  = (2 << PORT_SHIFT) | (5  << PIN_SHIFT) | 0x44,
-    P2_6  = (2 << PORT_SHIFT) | (6  << PIN_SHIFT) | 0x00,
-    P2_7  = (2 << PORT_SHIFT) | (7  << PIN_SHIFT) | 0x20,
-    P2_8  = (2 << PORT_SHIFT) | (8  << PIN_SHIFT) | 0x24,
-    P2_9  = (2 << PORT_SHIFT) | (9  << PIN_SHIFT) | 0x54,
-    P2_10 = (2 << PORT_SHIFT) | (10 << PIN_SHIFT) | 0x58,
-    P2_11 = (2 << PORT_SHIFT) | (11 << PIN_SHIFT) | 0x70,
-   
-    P3_0  = (3 << PORT_SHIFT) | (0  << PIN_SHIFT) | 0x84,
-    P3_1  = (3 << PORT_SHIFT) | (1  << PIN_SHIFT) | 0x88,
-    P3_2  = (3 << PORT_SHIFT) | (2  << PIN_SHIFT) | 0x9c,
-    P3_3  = (3 << PORT_SHIFT) | (3  << PIN_SHIFT) | 0xac,
-    P3_4  = (3 << PORT_SHIFT) | (4  << PIN_SHIFT) | 0x3c,
-    P3_5  = (3 << PORT_SHIFT) | (5  << PIN_SHIFT) | 0x48,
-
-    // mbed DIP Pin Names (CQ board)
-    p4  = P0_0,
-    p5  = P0_9,
-    p6  = P0_8,
-    p7  = P0_6,
-    p8  = P1_5,
-    p9  = P1_7,
-    p10 = P1_6,
-    p11 = P0_7,
-    p12 = P1_0,
-    p13 = P1_1,
-    p14 = P1_2,
-    p15 = P0_11,
-    p16 = P1_0,
-    p17 = P1_1,
-    p18 = P1_2,
-    p20 = P1_4,
-    p22 = P0_2,
-    p23 = P0_11,
-    p24 = P0_2,
-    p25 = P1_8,
-    p26 = P1_9,
-    p27 = P0_4,
-    p28 = P0_5,
-    p29 = P0_3,
-    p30 = P0_1,
-
-    // Other mbed Pin Names
-    LED1 = P1_5,
-    LED2 = P0_7,
-    LED3 = P1_5,
-    LED4 = P0_7,
-
-    USBTX = P1_7,
-    USBRX = P1_6,
-
-    // mbed DIP Pin Names (LPCXpresso LPC1114)
-    xp4  = P0_0,
-    xp5  = P0_9,
-    xp6  = P0_8,
-    xp7  = P2_11,
-    xp8  = P0_2,
-    xp9  = P1_7,
-    xp10 = P1_6,
-    xp11 = P0_7,
-    xp12 = P2_0,
-    xp13 = P2_1,
-    xp14 = P2_2,
-    xp15 = P0_11,
-    xp16 = P1_0,
-    xp17 = P1_1,
-    xp18 = P1_2,
-    xp20 = P1_4,
-    xp21 = P1_5,
-    xp22 = P1_8,
-    xp23 = P0_6,
-    xp25 = P3_0,
-    xp26 = P3_1,
-    xp27 = P3_2,
-
-    xp29 = P3_3,
-    xp30 = P2_10,
-    xp31 = P2_9,
-    xp32 = P2_8,
-    xp33 = P2_7,
-    xp34 = P2_6,
-    xp35 = P2_5,
-    xp36 = P2_4,
-    xp37 = P2_3,
-    xp38 = P1_11,
-    xp39 = P1_10,
-    xp40 = P1_9,
-    xp41 = P0_4,
-    xp42 = P0_5,
-    xp43 = P0_3,
-    xp44 = P0_1,
-
-    // Other mbed Pin Names
-    xLED1 = P0_7,
-	
-	// DIP Package Names
-	
-	dp1  = P0_8,
-	dp2  = P0_9,
-	dp4  = P0_11,
-	dp5  = P0_5,
-	dp6  = P0_6,
-	dp9  = P1_0,
-	dp10 = P1_1,
-	dp11 = P1_2,
-	dp13 = P1_4,
-	dp14 = P1_5,
-	dp15 = P1_6,
-	dp16 = P1_7,
-	dp17 = P1_8,
-	dp18 = P1_9,
-	dp23 = P0_0,
-	dp24 = P0_1,
-	dp25 = P0_2,
-	dp26 = P0_3,
-	dp27 = P0_4,
-	dp28 = P0_7,
-	
-	dip1  = P0_8,
-	dip2  = P0_9,
-	dip4  = P0_11,
-	dip5  = P0_5,
-	dip6  = P0_6,
-	dip9  = P1_0,
-	dip10 = P1_1,
-	dip11 = P1_2,
-	dip13 = P1_4,
-	dip14 = P1_5,
-	dip15 = P1_6,
-	dip16 = P1_7,
-	dip17 = P1_8,
-	dip18 = P1_9,
-	dip23 = P0_0,
-	dip24 = P0_1,
-	dip25 = P0_2,
-	dip26 = P0_3,
-	dip27 = P0_4,
-	dip28 = P0_7,
-	
-	
-
-    // Not connected
-    NC = (int)0xFFFFFFFF,
-} PinName;
-
-typedef enum {
-    CHANNEL0 = WAKEUP0_IRQn,
-    CHANNEL1 = WAKEUP1_IRQn,
-    CHANNEL2 = WAKEUP2_IRQn,
-    CHANNEL3 = WAKEUP3_IRQn,
-    CHANNEL4 = WAKEUP4_IRQn,
-    CHANNEL5 = WAKEUP5_IRQn,
-    CHANNEL6 = WAKEUP6_IRQn,
-    CHANNEL7 = WAKEUP7_IRQn
-} Channel;
-
-typedef enum {
-    PullUp = 2,
-    PullDown = 1,
-    PullNone = 0,
-    Repeater = 3,
-    OpenDrain = 4
-} PinMode;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11XX/device.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_DEVICE_H
-#define MBED_DEVICE_H
-
-#define DEVICE_PORTIN           1
-#define DEVICE_PORTOUT          1
-#define DEVICE_PORTINOUT        1
-
-#define DEVICE_INTERRUPTIN      1
-
-#define DEVICE_ANALOGIN         1
-#define DEVICE_ANALOGOUT        0
-
-#define DEVICE_SERIAL           1
-
-#define DEVICE_I2C              1
-#define DEVICE_I2CSLAVE         1
-
-#define DEVICE_SPI              1
-#define DEVICE_SPISLAVE         1
-
-#define DEVICE_CAN              0
-
-#define DEVICE_RTC              0
-
-#define DEVICE_ETHERNET         0
-
-#define DEVICE_PWMOUT           1
-
-#define DEVICE_SEMIHOST         1
-#define DEVICE_LOCALFILESYSTEM  1
-#define DEVICE_ID_LENGTH       32
-#define DEVICE_MAC_OFFSET      20
-
-#define DEVICE_SLEEP            1
-
-#define DEVICE_DEBUG_AWARENESS  0
-
-#define DEVICE_STDIO_MESSAGES   1
-
-#define DEVICE_ERROR_PATTERN    1
-
-#include "objects.h"
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11XX/reserved_pins.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-// List of reserved pins for LPC1114
-
-#ifndef RESERVED_PINS_H
-#define RESERVED_PINS_H
-
-#define TARGET_RESERVED_PINS {P0_0, P0_11, P1_0, P1_1, P1_2}
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/analogin_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "analogin_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_ADC[] = {
-    {P0_11, ADC0_0, 2},
-    {P1_0 , ADC0_1, 2},
-    {P1_1 , ADC0_2, 2},
-    {P1_2 , ADC0_3, 2},
-    // {P1_3 , ADC0_4, 2}, -- should be mapped to SWDIO only
-    {P1_4 , ADC0_5, 1},
-    {P1_10, ADC0_6, 1},
-    {P1_11, ADC0_7, 1},
-    {NC   , NC    , 0}
-};
-
-#define ANALOGIN_MEDIAN_FILTER      1
-
-#define ADC_10BIT_RANGE             0x3FF
-#define ADC_12BIT_RANGE             0xFFF
-
-static inline int div_round_up(int x, int y) {
-  return (x + (y - 1)) / y;
-}
-
-#define ADC_RANGE    ADC_10BIT_RANGE
-
-void analogin_init(analogin_t *obj, PinName pin) {
-    obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
-    if (obj->adc == (uint32_t)NC) {
-        error("ADC pin mapping failed");
-        return;
-    }
-    
-    // Power up ADC
-    LPC_SYSCON->PDRUNCFG &= ~ (1 << 4);
-    LPC_SYSCON->SYSAHBCLKCTRL |= ((uint32_t)1 << 13);
-
-    uint32_t offset = (uint32_t)pin & 0xff;
-    __IO uint32_t *reg = (__IO uint32_t*)(LPC_IOCON_BASE + offset);
-
-    // set pin to ADC mode
-    *reg &= ~(1 << 7); // set ADMODE = 0 (analog mode)
-
-    uint32_t PCLK = SystemCoreClock;
-    uint32_t MAX_ADC_CLK = 4500000;
-    uint32_t clkdiv = div_round_up(PCLK, MAX_ADC_CLK) - 1;
-
-    LPC_ADC->CR = (0 << 0)      // no channels selected
-                | (clkdiv << 8) // max of 4.5MHz
-                | (0 << 16)     // BURST = 0, software controlled
-                | ( 0 << 17 );  // CLKS = 0, not applicable
-    
-    pinmap_pinout(pin, PinMap_ADC);
-}
-
-static inline uint32_t adc_read(analogin_t *obj) {
-    // Select the appropriate channel and start conversion
-    LPC_ADC->CR &= ~0xFF;
-    LPC_ADC->CR |= 1 << (int)obj->adc;
-    LPC_ADC->CR |= 1 << 24;
-    
-    // Repeatedly get the sample data until DONE bit
-    unsigned int data;
-    do {
-        data = LPC_ADC->GDR;
-    } while ((data & ((unsigned int)1 << 31)) == 0);
-    
-    // Stop conversion
-    LPC_ADC->CR &= ~(1 << 24);
-    
-    return (data >> 6) & ADC_RANGE; // 10 bit
-}
-
-static inline void order(uint32_t *a, uint32_t *b) {
-    if (*a > *b) {
-        uint32_t t = *a;
-        *a = *b;
-        *b = t;
-    }
-}
-
-static inline uint32_t adc_read_u32(analogin_t *obj) {
-    uint32_t value;
-#if ANALOGIN_MEDIAN_FILTER
-    uint32_t v1 = adc_read(obj);
-    uint32_t v2 = adc_read(obj);
-    uint32_t v3 = adc_read(obj);
-    order(&v1, &v2);
-    order(&v2, &v3);
-    order(&v1, &v2);
-    value = v2;
-#else
-    value = adc_read(obj);
-#endif
-    return value;
-}
-
-uint16_t analogin_read_u16(analogin_t *obj) {
-    uint32_t value = adc_read_u32(obj);
-    
-    return (value << 6) | ((value >> 4) & 0x003F); // 10 bit
-}
-
-float analogin_read(analogin_t *obj) {
-    uint32_t value = adc_read_u32(obj);
-    return (float)value * (1.0f / (float)ADC_RANGE);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/gpio_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "gpio_api.h"
-#include "pinmap.h"
-#include "reserved_pins.h"
-
-static const PinName reserved_pins[] = TARGET_RESERVED_PINS;
-
-uint32_t gpio_set(PinName pin) {
-    // PIO default value of following ports are not same as others
-    unsigned i;
-    int f = 0;
-
-    for (i = 0; i < sizeof(reserved_pins) / sizeof(int); i ++)
-        if (pin == reserved_pins[i]) {
-            f = 1;
-            break;
-        }
-   
-    pin_function(pin, f);
-    return ((pin & 0x0F00) >> 8);
-}
-
-void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) {
-    if(pin == NC) return;
-
-    obj->pin = pin;
-    LPC_GPIO_TypeDef *port_reg = ((LPC_GPIO_TypeDef *) (LPC_GPIO0_BASE + (((pin & 0xF000) >> PORT_SHIFT) * 0x10000)));
-
-    obj->reg_mask_read = &port_reg->MASKED_ACCESS[1 << gpio_set(pin)];
-    obj->reg_dir       = &port_reg->DIR;
-    obj->reg_write     = &port_reg->DATA;
-    
-    gpio_dir(obj, direction);
-    
-    switch (direction) {
-        case PIN_OUTPUT: pin_mode(pin, PullNone); break;
-        case PIN_INPUT : pin_mode(pin, PullDown); break;
-    }
-}
-
-void gpio_mode(gpio_t *obj, PinMode mode) {
-    pin_mode(obj->pin, mode);
-}
-
-void gpio_dir(gpio_t *obj, PinDirection direction) {
-    int pin_number = ((obj->pin & 0x0F00) >> 8);
-    switch (direction) {
-        case PIN_INPUT : *obj->reg_dir &= ~(1 << pin_number); break;
-        case PIN_OUTPUT: *obj->reg_dir |=  (1 << pin_number); break;
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/gpio_irq_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,216 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stddef.h>
-#include "cmsis.h"
-#include "gpio_irq_api.h"
-#include "error.h"
-#include "gpio_api.h"
-
-// The chip is capable of 42 GPIO interrupts.
-// PIO0_0..PIO0_11, PIO1_0..PIO1_11, PIO2_0..PIO2_11, PIO3_0..PIO3_5
-#define CHANNEL_NUM 42
-
-static uint32_t channel_ids[CHANNEL_NUM] = {0};
-static gpio_irq_handler irq_handler;
-
-static inline int numofbits(uint32_t bits)
-{
-    // Count number of bits
-    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
-    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
-    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
-    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
-    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
-}
-
-static inline void handle_interrupt_in(uint32_t port) {
-    // Find out whether the interrupt has been triggered by a high or low value...
-    // As the LPC1114 doesn't have a specific register for this, we'll just have to read
-    // the level of the pin as if it were just a normal input...
-    
-    uint32_t channel;
-    
-    // Get the number of the pin being used and the port typedef
-    LPC_GPIO_TypeDef *port_reg = ((LPC_GPIO_TypeDef *) (LPC_GPIO0_BASE + (port * 0x10000)));
-    
-    // Get index of function table from Mask Interrupt Status register
-    channel = numofbits(port_reg->MIS - 1);
-    
-    if (port_reg->MIS & port_reg->IBE) {
-        // both edge, read the level of pin
-        if ((port_reg->DATA & port_reg->MIS) != 0)
-            irq_handler(channel_ids[channel], IRQ_RISE);
-        else
-            irq_handler(channel_ids[channel], IRQ_FALL);
-    }
-    else if (port_reg->MIS & port_reg->IEV) {
-        irq_handler(channel_ids[channel], IRQ_RISE);
-    }
-    else {
-        irq_handler(channel_ids[channel], IRQ_FALL);
-    }
-
-    // Clear the interrupt...
-    port_reg->IC = port_reg->MIS;
-}
-
-void gpio_irq0(void) {handle_interrupt_in(0);}
-void gpio_irq1(void) {handle_interrupt_in(1);}
-void gpio_irq2(void) {handle_interrupt_in(2);}
-void gpio_irq3(void) {handle_interrupt_in(3);}
-
-int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id) {
-    int channel;
-    uint32_t port_num;
-    
-    if (pin == NC) return -1;
-    
-    // Firstly, we'll put some data in *obj so we can keep track of stuff.
-    obj->pin = pin;
-    
-    // Set the handler to be the pointer at the top...
-    irq_handler = handler;
-    
-    // Which port are we using?
-    port_num = ((pin & 0xF000) >> PORT_SHIFT);
-    
-    switch (port_num) {
-        case 0:
-            NVIC_SetVector(EINT0_IRQn, (uint32_t)gpio_irq0);
-            NVIC_EnableIRQ(EINT0_IRQn);
-            break;
-        case 1:
-            NVIC_SetVector(EINT1_IRQn, (uint32_t)gpio_irq1);
-            NVIC_EnableIRQ(EINT1_IRQn);
-            break;
-        case 2:
-            NVIC_SetVector(EINT2_IRQn, (uint32_t)gpio_irq2);
-            NVIC_EnableIRQ(EINT2_IRQn);
-            break;
-        case 3:
-            NVIC_SetVector(EINT3_IRQn, (uint32_t)gpio_irq3);
-            NVIC_EnableIRQ(EINT3_IRQn);
-            break;
-        default:
-            return -1;
-    }
-    
-    // Generate index of function pointer table
-    // PIO0_0 - PIO0_11 :  0..11
-    // PIO1_0 - PIO1_11 : 12..23
-    // PIO2_0 - PIO2_11 : 24..35
-    // PIO3_0 - PIO3_5  : 36..41
-    channel = (port_num * 12) + ((pin & 0x0F00) >> PIN_SHIFT);
-    
-    channel_ids[channel] = id;
-    obj->ch = channel;
-    
-    return 0;
-}
-
-void gpio_irq_free(gpio_irq_t *obj) {
-    channel_ids[obj->ch] = 0;
-}
-
-void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
-    // Firstly, check if there is an existing event stored...
-
-    LPC_GPIO_TypeDef *port_reg = ((LPC_GPIO_TypeDef *) (LPC_GPIO0_BASE + (((obj->pin & 0xF000) >> PORT_SHIFT) * 0x10000)));
-
-    // Need to get the pin number of the pin, not the value of the enum
-    uint32_t pin_num = (1 << ((obj->pin & 0x0f00) >> PIN_SHIFT));
-   
-    // Clear
-    port_reg->IC |= pin_num;
-    
-    // Make it edge sensitive.
-    port_reg->IS &= ~pin_num;
-
-    if ( (port_reg->IE & pin_num) != 0) {
-    // We have an event.
-    // Enable both edge interrupts.
-
-        if (enable) {
-            port_reg->IBE |= pin_num;
-            port_reg->IE  |= pin_num;
-        }
-        else {
-            // These all need to be opposite, to reenable the other one.
-            port_reg->IBE &= ~pin_num;
-
-            if (event == IRQ_RISE)
-                port_reg->IEV &= ~pin_num;
-            else 
-                port_reg->IEV |=  pin_num;
-
-            port_reg->IE |= pin_num;
-        }
-    }
-    else {
-        // One edge
-        port_reg->IBE &= ~pin_num;
-        // Rising/falling?
-        if (event == IRQ_RISE)
-            port_reg->IEV |=  pin_num;
-        else
-            port_reg->IEV &= ~pin_num;
-
-        if (enable) {
-            port_reg->IE |= pin_num;
-        }
-    }
-
-}
-
-void gpio_irq_enable(gpio_irq_t *obj) {
-    uint32_t port_num = ((obj->pin & 0xF000) >> PORT_SHIFT);
-    switch (port_num) {
-        case 0:
-            NVIC_EnableIRQ(EINT0_IRQn);
-            break;
-        case 1:
-            NVIC_EnableIRQ(EINT1_IRQn);
-            break;
-        case 2:
-            NVIC_EnableIRQ(EINT2_IRQn);
-            break;
-        case 3:
-            NVIC_EnableIRQ(EINT3_IRQn);
-            break;
-        default:
-            break;
-    }
-}
-
-void gpio_irq_disable(gpio_irq_t *obj) {
-    uint32_t port_num = ((obj->pin & 0xF000) >> PORT_SHIFT);
-    switch (port_num) {
-        case 0:
-            NVIC_DisableIRQ(EINT0_IRQn);
-            break;
-        case 1:
-            NVIC_DisableIRQ(EINT1_IRQn);
-            break;
-        case 2:
-            NVIC_DisableIRQ(EINT2_IRQn);
-            break;
-        case 3:
-            NVIC_DisableIRQ(EINT3_IRQn);
-            break;
-        default:
-            break;
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/gpio_object.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_GPIO_OBJECT_H
-#define MBED_GPIO_OBJECT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
-    PinName  pin;
-    __I  uint32_t *reg_mask_read;
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_write;
-} gpio_t;
-
-static inline void gpio_write(gpio_t *obj, int value) {
-    uint32_t pin_number = ((obj->pin & 0x0F00) >> 8);
-    if (value)
-        *obj->reg_write |= (1 << pin_number);
-    else
-        *obj->reg_write &= ~(1 << pin_number);
-}
-
-static inline int gpio_read(gpio_t *obj) {
-    return ((*obj->reg_mask_read) ? 1 : 0);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/i2c_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,389 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "i2c_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_I2C_SDA[] = {
-    {P0_5, I2C_0, 1},
-    {NC  , NC   , 0}
-};
-
-static const PinMap PinMap_I2C_SCL[] = {
-    {P0_4, I2C_0, 1},
-    {NC  , NC,    0}
-};
-
-#define I2C_CONSET(x)       (x->i2c->CONSET)
-#define I2C_CONCLR(x)       (x->i2c->CONCLR)
-#define I2C_STAT(x)         (x->i2c->STAT)
-#define I2C_DAT(x)          (x->i2c->DAT)
-#define I2C_SCLL(x, val)    (x->i2c->SCLL = val)
-#define I2C_SCLH(x, val)    (x->i2c->SCLH = val)
-
-static const uint32_t I2C_addr_offset[2][4] = {
-    {0x0C, 0x20, 0x24, 0x28},
-    {0x30, 0x34, 0x38, 0x3C}
-};
-
-static inline void i2c_conclr(i2c_t *obj, int start, int stop, int interrupt, int acknowledge) {
-    I2C_CONCLR(obj) = (start << 5)
-                    | (stop << 4)
-                    | (interrupt << 3)
-                    | (acknowledge << 2);
-}
-
-static inline void i2c_conset(i2c_t *obj, int start, int stop, int interrupt, int acknowledge) {
-    I2C_CONSET(obj) = (start << 5)
-                    | (stop << 4)
-                    | (interrupt << 3)
-                    | (acknowledge << 2);
-}
-
-// Clear the Serial Interrupt (SI)
-static inline void i2c_clear_SI(i2c_t *obj) {
-    i2c_conclr(obj, 0, 0, 1, 0);
-}
-
-static inline int i2c_status(i2c_t *obj) {
-    return I2C_STAT(obj);
-}
-
-// Wait until the Serial Interrupt (SI) is set
-static int i2c_wait_SI(i2c_t *obj) {
-    int timeout = 0;
-    while (!(I2C_CONSET(obj) & (1 << 3))) {
-        timeout++;
-        if (timeout > 100000) return -1;
-    }
-    return 0;
-}
-
-static inline void i2c_interface_enable(i2c_t *obj) {
-    I2C_CONSET(obj) = 0x40;
-}
-
-static inline void i2c_power_enable(i2c_t *obj) {
-    LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 5);
-    LPC_SYSCON->PRESETCTRL |= 1 << 1;
-}
-
-void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
-    // determine the SPI to use
-    I2CName i2c_sda = (I2CName)pinmap_peripheral(sda, PinMap_I2C_SDA);
-    I2CName i2c_scl = (I2CName)pinmap_peripheral(scl, PinMap_I2C_SCL);
-    obj->i2c = (LPC_I2C_TypeDef *)pinmap_merge(i2c_sda, i2c_scl);
-    
-    if ((int)obj->i2c == NC) {
-        error("I2C pin mapping failed");
-    }
-    
-    // enable power
-    i2c_power_enable(obj);
-    
-    // set default frequency at 100k
-    i2c_frequency(obj, 100000);
-    i2c_conclr(obj, 1, 1, 1, 1);
-    i2c_interface_enable(obj);
-    
-    pinmap_pinout(sda, PinMap_I2C_SDA);
-    pinmap_pinout(scl, PinMap_I2C_SCL);
-}
-
-inline int i2c_start(i2c_t *obj) {
-    int status = 0;
-    // 8.1 Before master mode can be entered, I2CON must be initialised to:
-    //  - I2EN STA STO SI AA - -
-    //  -  1    0   0   0  x - -
-    // if AA = 0, it can't enter slave mode
-    i2c_conclr(obj, 1, 1, 1, 1);
-    
-    // The master mode may now be entered by setting the STA bit
-    // this will generate a start condition when the bus becomes free
-    i2c_conset(obj, 1, 0, 0, 1);
-    
-    i2c_wait_SI(obj);
-    status = i2c_status(obj);
-    
-    // Clear start bit now transmitted, and interrupt bit
-    i2c_conclr(obj, 1, 0, 0, 0);
-    return status;
-}
-
-inline int i2c_stop(i2c_t *obj) {
-    int timeout = 0;
-
-    // write the stop bit
-    i2c_conset(obj, 0, 1, 0, 0);
-    i2c_clear_SI(obj);
-    
-    // wait for STO bit to reset
-    while(I2C_CONSET(obj) & (1 << 4)) {
-        timeout ++;
-        if (timeout > 100000) return 1;
-    }
-
-    return 0;
-}
-
-
-static inline int i2c_do_write(i2c_t *obj, int value, uint8_t addr) {
-    // write the data
-    I2C_DAT(obj) = value;
-    
-    // clear SI to init a send
-    i2c_clear_SI(obj);
-    
-    // wait and return status
-    i2c_wait_SI(obj);
-    return i2c_status(obj);
-}
-
-static inline int i2c_do_read(i2c_t *obj, int last) {
-    // we are in state 0x40 (SLA+R tx'd) or 0x50 (data rx'd and ack)
-    if (last) {
-        i2c_conclr(obj, 0, 0, 0, 1); // send a NOT ACK
-    } else {
-        i2c_conset(obj, 0, 0, 0, 1); // send a ACK
-    }
-    
-    // accept byte
-    i2c_clear_SI(obj);
-    
-    // wait for it to arrive
-    i2c_wait_SI(obj);
-    
-    // return the data
-    return (I2C_DAT(obj) & 0xFF);
-}
-
-void i2c_frequency(i2c_t *obj, int hz) {
-    // No peripheral clock divider on the M0
-    uint32_t PCLK = SystemCoreClock;
-    
-    uint32_t pulse = PCLK / (hz * 2);
-    
-    // I2C Rate
-    I2C_SCLL(obj, pulse);
-    I2C_SCLH(obj, pulse);
-}
-
-// The I2C does a read or a write as a whole operation
-// There are two types of error conditions it can encounter
-//  1) it can not obtain the bus
-//  2) it gets error responses at part of the transmission
-//
-// We tackle them as follows:
-//  1) we retry until we get the bus. we could have a "timeout" if we can not get it
-//      which basically turns it in to a 2)
-//  2) on error, we use the standard error mechanisms to report/debug
-//
-// Therefore an I2C transaction should always complete. If it doesn't it is usually
-// because something is setup wrong (e.g. wiring), and we don't need to programatically
-// check for that
-
-int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) {
-    int count, status;
-    
-    status = i2c_start(obj);
-    
-    if ((status != 0x10) && (status != 0x08)) {
-        i2c_stop(obj);
-        return I2C_ERROR_BUS_BUSY;
-    }
-    
-    status = i2c_do_write(obj, (address | 0x01), 1);
-    if (status != 0x40) {
-        i2c_stop(obj);
-        return I2C_ERROR_NO_SLAVE;
-    }
-
-    // Read in all except last byte
-    for (count = 0; count < (length - 1); count++) {
-        int value = i2c_do_read(obj, 0);
-        status = i2c_status(obj);
-        if (status != 0x50) {
-            i2c_stop(obj);
-            return count;
-        }
-        data[count] = (char) value;
-    }
-
-    // read in last byte
-    int value = i2c_do_read(obj, 1);
-    status = i2c_status(obj);
-    if (status != 0x58) {
-        i2c_stop(obj);
-        return length - 1;
-    }
-    
-    data[count] = (char) value;
-    
-    // If not repeated start, send stop.
-    if (stop) {
-        i2c_stop(obj);
-    }
-    
-    return length;
-}
-
-int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) {
-    int i, status;
-    
-    status = i2c_start(obj);
-    
-    if ((status != 0x10) && (status != 0x08)) {
-        i2c_stop(obj);
-        return I2C_ERROR_BUS_BUSY;
-    }
-    
-    status = i2c_do_write(obj, (address & 0xFE), 1);
-    if (status != 0x18) {
-        i2c_stop(obj);
-        return I2C_ERROR_NO_SLAVE;
-    }
-    
-    for (i=0; i<length; i++) {
-        status = i2c_do_write(obj, data[i], 0);
-        if(status != 0x28) {
-            i2c_stop(obj);
-            return i;
-        }
-    }
-    
-    // clearing the serial interrupt here might cause an unintended rewrite of the last byte
-    // see also issue report https://mbed.org/users/mbed_official/code/mbed/issues/1
-    // i2c_clear_SI(obj);
-    
-    // If not repeated start, send stop.
-    if (stop) {
-        i2c_stop(obj);
-    }
-    
-    return length;
-}
-
-void i2c_reset(i2c_t *obj) {
-    i2c_stop(obj);
-}
-
-int i2c_byte_read(i2c_t *obj, int last) {
-    return (i2c_do_read(obj, last) & 0xFF);
-}
-
-int i2c_byte_write(i2c_t *obj, int data) {
-    int ack;
-    int status = i2c_do_write(obj, (data & 0xFF), 0);
-    
-    switch(status) {
-        case 0x18: case 0x28:       // Master transmit ACKs
-            ack = 1;
-            break;
-        case 0x40:                  // Master receive address transmitted ACK
-            ack = 1;
-            break;
-        case 0xB8:                  // Slave transmit ACK
-            ack = 1;
-            break;
-        default:
-            ack = 0;
-            break;
-    }
-
-    return ack;
-}
-
-void i2c_slave_mode(i2c_t *obj, int enable_slave) {
-    if (enable_slave != 0) {
-        i2c_conclr(obj, 1, 1, 1, 0);
-        i2c_conset(obj, 0, 0, 0, 1);
-    } else {
-        i2c_conclr(obj, 1, 1, 1, 1);
-    }
-}
-
-int i2c_slave_receive(i2c_t *obj) {
-    int status;
-    int retval;
-    
-    status = i2c_status(obj);
-    switch(status) {
-        case 0x60: retval = 3; break;
-        case 0x70: retval = 2; break;
-        case 0xA8: retval = 1; break;
-        default  : retval = 0; break;
-    }
-    
-    return(retval);
-}
-
-int i2c_slave_read(i2c_t *obj, char *data, int length) {
-    int count = 0;
-    int status;
-    
-    do {
-        i2c_clear_SI(obj);
-        i2c_wait_SI(obj);
-        status = i2c_status(obj);
-        if((status == 0x80) || (status == 0x90)) {
-            data[count] = I2C_DAT(obj) & 0xFF;
-        }
-        count++;
-    } while (((status == 0x80) || (status == 0x90) ||
-            (status == 0x060) || (status == 0x70)) && (count < length));
-    
-    if(status != 0xA0) {
-        i2c_stop(obj);
-    }
-    
-    i2c_clear_SI(obj);
-    
-    return count;
-}
-
-int i2c_slave_write(i2c_t *obj, const char *data, int length) {
-    int count = 0;
-    int status;
-    
-    if(length <= 0) {
-        return(0);
-    }
-    
-    do {
-        status = i2c_do_write(obj, data[count], 0);
-        count++;
-    } while ((count < length) && (status == 0xB8));
-    
-    if((status != 0xC0) && (status != 0xC8)) {
-        i2c_stop(obj);
-    }
-    
-    i2c_clear_SI(obj);
-    
-    return(count);
-}
-
-void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask) {
-    uint32_t addr;
-    
-    if ((idx >= 0) && (idx <= 3)) {
-        addr = ((uint32_t)obj->i2c) + I2C_addr_offset[0][idx];
-        *((uint32_t *) addr) = address & 0xFF;
-        addr = ((uint32_t)obj->i2c) + I2C_addr_offset[1][idx];
-        *((uint32_t *) addr) = mask & 0xFE;
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/objects.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_OBJECTS_H
-#define MBED_OBJECTS_H
-
-#include "cmsis.h"
-#include "PortNames.h"
-#include "PeripheralNames.h"
-#include "PinNames.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct gpio_irq_s {
-    uint32_t ch;
-    PinName pin;
-    __I  uint32_t *reg_mask_read;
-};
-
-struct port_s {
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_data;
-    PortName port;
-    uint32_t mask;
-};
-
-struct pwmout_s {
-    PWMName pwm;
-};
-
-struct serial_s {
-    LPC_UART_TypeDef *uart;
-    int index;
-};
-
-struct analogin_s {
-    ADCName adc;
-};
-
-struct i2c_s {
-    LPC_I2C_TypeDef *i2c;
-};
-
-struct spi_s {
-    LPC_SSP_TypeDef *spi;
-};
-
-#if DEVICE_CAN
-struct can_s {
-    int index;
-};
-#endif
-
-#include "gpio_object.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/pinmap.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "pinmap.h"
-#include "error.h"
-
-void pin_function(PinName pin, int function) {
-    if (pin == (uint32_t)NC) return;
-    
-    uint32_t offset = (uint32_t)pin & 0xff;
-    __IO uint32_t *reg = (__IO uint32_t*)(LPC_IOCON_BASE + offset);
-
-    // pin function bits: [2:0] -> 111 = (0x7)
-    *reg = (*reg & ~0x7) | (function & 0x7);
-}
-
-void pin_mode(PinName pin, PinMode mode) {
-    if (pin == (uint32_t)NC) { return; }
-    
-    uint32_t offset = (uint32_t)pin & 0xff;
-    uint32_t drain = ((uint32_t) mode & (uint32_t) OpenDrain) >> 2;
-    
-    __IO uint32_t *reg = (__IO uint32_t*)(LPC_IOCON_BASE + offset);
-    uint32_t tmp = *reg;
-    
-    // pin mode bits: [4:3] -> 11000 = (0x3 << 3)
-    tmp &= ~(0x3 << 3);
-    tmp |= (mode & 0x3) << 3;
-    
-    // drain
-    tmp &= ~(0x1 << 10);
-    tmp |= drain << 10;
-    
-    *reg = tmp;
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/port_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "port_api.h"
-#include "pinmap.h"
-#include "gpio_api.h"
-
-// LPC114 IOCON offset table [port][pin]
-
-static uint8_t iocon_offset[4][12] = {
-    {0x0c,0x10,0x1c,0x2c,0x30,0x34,0x4c,0x50,0x60,0x64,0x68,0x74}, // PORT 0
-    {0x78,0x7c,0x80,0x90,0x94,0xa0,0xa4,0xa8,0x14,0x38,0x6c,0x98}, // PORT 1
-    {0x08,0x28,0x5c,0x8c,0x40,0x44,0x00,0x20,0x24,0x54,0x58,0x70}, // PORT 2
-    {0x84,0x88,0x9c,0xac,0x3c,0x48}                                // PORT 3
-};
-
-PinName port_pin(PortName port, int pin) {
-    return (PinName)((port << PORT_SHIFT) | (pin << PIN_SHIFT) | (uint32_t)iocon_offset[port][pin]);
-}
-
-void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
-    obj->port = port;
-    obj->mask = mask;
-    
-    LPC_GPIO_TypeDef *port_reg = ((LPC_GPIO_TypeDef *) (LPC_GPIO0_BASE + (port * 0x10000)));
-    
-    obj->reg_data  = &port_reg->DATA;
-    obj->reg_dir = &port_reg->DIR;
-    
-    uint32_t i;
-    // The function is set per pin: reuse gpio logic
-    for (i=0; i<12; i++) {
-        if (obj->mask & (1<<i)) {
-            gpio_set(port_pin(obj->port, i));
-        }
-    }
-    
-    port_dir(obj, dir);
-}
-
-void port_mode(port_t *obj, PinMode mode) {
-    uint32_t i;
-    // The mode is set per pin: reuse pinmap logic
-    for (i=0; i<12; i++) {
-        if (obj->mask & (1<<i)) {
-            pin_mode(port_pin(obj->port, i), mode);
-        }
-    }
-}
-
-void port_dir(port_t *obj, PinDirection dir) {
-    switch (dir) {
-        case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break;
-        case PIN_OUTPUT: *obj->reg_dir |=  obj->mask; break;
-    }
-}
-
-void port_write(port_t *obj, int value) {
-    *obj->reg_data = (value & obj->mask);
-}
-
-int port_read(port_t *obj) {
-    return (*obj->reg_data & obj->mask);
-}
-
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/pwmout_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,182 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "pwmout_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-#define TCR_CNT_EN       0x00000001
-#define TCR_RESET        0x00000002
-
-/* To have a PWM where we can change both the period and the duty cycle,
- * we need an entire timer. With the following conventions:
- *   * MR3 is used for the PWM period
- *   * MR0, MR1, MR2 are used for the duty cycle
- */
-static const PinMap PinMap_PWM[] = {
-    /* CT16B0 */
-    {P0_8 , PWM_1, 0x02},   /* MR0 */
-    {P0_9 , PWM_2, 0x02},   /* MR1 */
-
-    /* CT16B1 */
-    {P1_9 , PWM_3, 0x01},   /* MR0 */
-    {P1_10, PWM_4, 0x02},   /* MR1 */
-
-    /* CT32B0 */
-    {P0_1 , PWM_5, 0x02},   /* MR2 */
-
-    {NC   , NC    ,0x00}
-};
-
-typedef struct {
-    uint8_t timer;
-    uint8_t mr;
-} timer_mr;
-
-static timer_mr pwm_timer_map[5] = {
-    {0, 0}, /* CT16B0, MR0 */
-    {0, 1}, /* CT16B0, MR1 */
-
-    {1, 0}, /* CT16B1, MR0 */
-    {1, 1}, /* CT16B1, MR1 */
-
-    {2, 2}, /* CT32B0, MR2 */
-};
-
-static LPC_TMR_TypeDef *Timers[3] = {
-    LPC_TMR16B0, LPC_TMR16B1,
-    LPC_TMR32B0
-};
-
-void pwmout_init(pwmout_t* obj, PinName pin) {
-    // determine the channel
-    PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM);
-    if (pwm == (uint32_t)NC)
-        error("PwmOut pin mapping failed");
-    
-    obj->pwm = pwm;
-    
-    // Timer registers
-    timer_mr tid = pwm_timer_map[pwm];
-    LPC_TMR_TypeDef *timer = Timers[tid.timer];
-    
-    // Disable timer
-    timer->TCR = 0;
-    
-    // Power the correspondent timer
-    LPC_SYSCON->SYSAHBCLKCTRL |= 1 << (tid.timer + 7);
-    
-    /* Enable PWM function */
-    timer->PWMC = (1 << 3)|(1 << 2)|(1 << 1)|(1 << 0);
-    
-    /* Reset Functionality on MR3 controlling the PWM period */
-    timer->MCR = 1 << 10;
-    
-    if (timer == LPC_TMR16B0 || timer == LPC_TMR16B1) {
-    /* Set 16-bit timer prescaler to avoid timer expire for default 20ms */
-    /* This can be also modified by user application, but the prescaler value */
-    /* might be trade-off to timer accuracy */
-        timer->PR = 30;
-    }
-
-    // default to 20ms: standard for servos, and fine for e.g. brightness control
-    pwmout_period_ms(obj, 20);
-    pwmout_write    (obj, 0);
-    
-    // Wire pinout
-    pinmap_pinout(pin, PinMap_PWM);
-}
-
-void pwmout_free(pwmout_t* obj) {
-    // [TODO]
-}
-
-void pwmout_write(pwmout_t* obj, float value) {
-    if (value < 0.0f) {
-        value = 0.0;
-    } else if (value > 1.0f) {
-        value = 1.0;
-    }
-    
-    timer_mr tid = pwm_timer_map[obj->pwm];
-    LPC_TMR_TypeDef *timer = Timers[tid.timer];
-    uint32_t t_off = timer->MR3 - (uint32_t)((float)(timer->MR3) * value);
-    
-    timer->TCR = TCR_RESET;
-    timer->MR[tid.mr] = t_off;
-    timer->TCR = TCR_CNT_EN;
-}
-
-float pwmout_read(pwmout_t* obj) {
-    timer_mr tid = pwm_timer_map[obj->pwm];
-    LPC_TMR_TypeDef *timer = Timers[tid.timer];
-    
-    float v = (float)(timer->MR3 - timer->MR[tid.mr]) / (float)(timer->MR3);
-    return (v > 1.0f) ? (1.0f) : (v);
-}
-
-void pwmout_period(pwmout_t* obj, float seconds) {
-    pwmout_period_us(obj, seconds * 1000000.0f);
-}
-
-void pwmout_period_ms(pwmout_t* obj, int ms) {
-    pwmout_period_us(obj, ms * 1000);
-}
-
-// Set the PWM period, keeping the duty cycle the same.
-void pwmout_period_us(pwmout_t* obj, int us) {
-    int i = 0;
-    uint32_t period_ticks;
-    
-    timer_mr tid = pwm_timer_map[obj->pwm];
-    LPC_TMR_TypeDef *timer = Timers[tid.timer];
-    uint32_t old_period_ticks = timer->MR3;
-    period_ticks = (SystemCoreClock / 1000000 * us) / (timer->PR + 1);
-
-    timer->TCR = TCR_RESET;
-    timer->MR3 = period_ticks;
-    
-    // Scale the pulse width to preserve the duty ratio
-    if (old_period_ticks > 0) {
-        for (i=0; i<3; i++) {
-            uint32_t t_off = period_ticks - (uint32_t)(((uint64_t)timer->MR[i] * (uint64_t)period_ticks) / (uint64_t)old_period_ticks);
-            timer->MR[i] = t_off;
-        }
-    }
-    timer->TCR = TCR_CNT_EN;
-}
-
-void pwmout_pulsewidth(pwmout_t* obj, float seconds) {
-    pwmout_pulsewidth_us(obj, seconds * 1000000.0f);
-}
-
-void pwmout_pulsewidth_ms(pwmout_t* obj, int ms) {
-    pwmout_pulsewidth_us(obj, ms * 1000);
-}
-
-void pwmout_pulsewidth_us(pwmout_t* obj, int us) {
-    timer_mr tid = pwm_timer_map[obj->pwm];
-    LPC_TMR_TypeDef *timer = Timers[tid.timer];
-    uint32_t t_on = (uint32_t)((((uint64_t)SystemCoreClock * (uint64_t)us) / (uint64_t)1000000) / (timer->PR + 1));
-    
-    timer->TCR = TCR_RESET;
-    if (t_on > timer->MR3) {
-        pwmout_period_us(obj, us);
-    }
-    uint32_t t_off = timer->MR3 - t_on;
-    timer->MR[tid.mr] = t_off;
-    timer->TCR = TCR_CNT_EN;
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/serial_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,278 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// math.h required for floating point operations for baud rate calculation
-#include <math.h>
-#include <string.h>
-
-#include "serial_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-/******************************************************************************
- * INITIALIZATION
- ******************************************************************************/
-#define UART_NUM    1
-
-static const PinMap PinMap_UART_TX[] = {
-    {P2_8 , UART_0, 0x02},
-    {P3_5 , UART_0, 0x02},
-    {P3_0 , UART_0, 0x03},
-    {P1_7 , UART_0, 0x01},
-    {NC   , NC    , 0x00}
-};
-
-static const PinMap PinMap_UART_RX[] = {
-    {P2_7 , UART_0, 0x02},
-    {P3_4 , UART_0, 0x02},
-    {P3_1 , UART_0, 0x03},
-    {P1_6 , UART_0, 0x01},
-    {NC   , NC    , 0x00}
-};
-
-static uint32_t serial_irq_ids[UART_NUM] = {0};
-static uart_irq_handler irq_handler;
-
-int stdio_uart_inited = 0;
-serial_t stdio_uart;
-
-void serial_init(serial_t *obj, PinName tx, PinName rx) {
-    int is_stdio_uart = 0;
-    
-    // determine the UART to use
-    UARTName uart_tx = (UARTName)pinmap_peripheral(tx, PinMap_UART_TX);
-    UARTName uart_rx = (UARTName)pinmap_peripheral(rx, PinMap_UART_RX);
-    UARTName uart = (UARTName)pinmap_merge(uart_tx, uart_rx);
-    if ((int)uart == NC) {
-        error("Serial pinout mapping failed");
-    }
-    
-    obj->uart = (LPC_UART_TypeDef *)uart;
-    LPC_SYSCON->SYSAHBCLKCTRL |= (1<<12);
-    
-    // enable fifos and default rx trigger level
-    obj->uart->FCR = 1 << 0  // FIFO Enable - 0 = Disables, 1 = Enabled
-                   | 0 << 1  // Rx Fifo Reset
-                   | 0 << 2  // Tx Fifo Reset
-                   | 0 << 6; // Rx irq trigger level - 0 = 1 char, 1 = 4 chars, 2 = 8 chars, 3 = 14 chars
-    
-    // disable irqs
-    obj->uart->IER = 0 << 0  // Rx Data available irq enable
-                   | 0 << 1  // Tx Fifo empty irq enable
-                   | 0 << 2; // Rx Line Status irq enable
-    
-    // set default baud rate and format
-    serial_baud  (obj, 9600);
-    serial_format(obj, 8, ParityNone, 1);
-    
-    // pinout the chosen uart
-    pinmap_pinout(tx, PinMap_UART_TX);
-    pinmap_pinout(rx, PinMap_UART_RX);
-    
-    // set rx/tx pins in PullUp mode
-    pin_mode(tx, PullUp);
-    pin_mode(rx, PullUp);
-    
-    switch (uart) {
-        case UART_0: obj->index = 0; break;
-    }
-    
-    is_stdio_uart = (uart == STDIO_UART) ? (1) : (0);
-    
-    if (is_stdio_uart) {
-        stdio_uart_inited = 1;
-        memcpy(&stdio_uart, obj, sizeof(serial_t));
-    }
-}
-
-void serial_free(serial_t *obj) {
-    serial_irq_ids[obj->index] = 0;
-}
-
-// serial_baud
-// set the baud rate, taking in to account the current SystemFrequency
-void serial_baud(serial_t *obj, int baudrate) {
-    LPC_SYSCON->UARTCLKDIV = 0x1;
-    uint32_t PCLK = SystemCoreClock;
-    // First we check to see if the basic divide with no DivAddVal/MulVal
-    // ratio gives us an integer result. If it does, we set DivAddVal = 0,
-    // MulVal = 1. Otherwise, we search the valid ratio value range to find
-    // the closest match. This could be more elegant, using search methods
-    // and/or lookup tables, but the brute force method is not that much
-    // slower, and is more maintainable.
-    uint16_t DL = PCLK / (16 * baudrate);
-    
-    uint8_t DivAddVal = 0;
-    uint8_t MulVal = 1;
-    int hit = 0;
-    uint16_t dlv;
-    uint8_t mv, dav;
-    if ((PCLK % (16 * baudrate)) != 0) {     // Checking for zero remainder
-        float err_best = (float) baudrate;
-        uint16_t dlmax = DL;
-        for ( dlv = (dlmax/2); (dlv <= dlmax) && !hit; dlv++) {
-            for ( mv = 1; mv <= 15; mv++) {
-                for ( dav = 1; dav < mv; dav++) {
-                    float ratio = 1.0f + ((float) dav / (float) mv);
-                    float calcbaud = (float)PCLK / (16.0f * (float) dlv * ratio);
-                    float err = fabs(((float) baudrate - calcbaud) / (float) baudrate);
-                    if (err < err_best) {
-                        DL = dlv;
-                        DivAddVal = dav;
-                        MulVal = mv;
-                        err_best = err;
-                        if (err < 0.001f) {
-                            hit = 1;
-                        }
-                    }
-                }
-            }
-        }
-    }
-    
-    // set LCR[DLAB] to enable writing to divider registers
-    obj->uart->LCR |= (1 << 7);
-    
-    // set divider values
-    obj->uart->DLM = (DL >> 8) & 0xFF;
-    obj->uart->DLL = (DL >> 0) & 0xFF;
-    obj->uart->FDR = (uint32_t) DivAddVal << 0
-                   | (uint32_t) MulVal    << 4;
-    
-    // clear LCR[DLAB]
-    obj->uart->LCR &= ~(1 << 7);
-}
-
-void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits) {
-    // 0: 1 stop bits, 1: 2 stop bits
-    if (stop_bits != 1 && stop_bits != 2) {
-        error("Invalid stop bits specified");
-    }
-    stop_bits -= 1;
-    
-    // 0: 5 data bits ... 3: 8 data bits
-    if (data_bits < 5 || data_bits > 8) {
-        error("Invalid number of bits (%d) in serial format, should be 5..8", data_bits);
-    }
-    data_bits -= 5;
-
-    int parity_enable, parity_select;
-    switch (parity) {
-        case ParityNone: parity_enable = 0; parity_select = 0; break;
-        case ParityOdd : parity_enable = 1; parity_select = 0; break;
-        case ParityEven: parity_enable = 1; parity_select = 1; break;
-        case ParityForced1: parity_enable = 1; parity_select = 2; break;
-        case ParityForced0: parity_enable = 1; parity_select = 3; break;
-        default:
-            error("Invalid serial parity setting");
-            return;
-    }
-    
-    obj->uart->LCR = data_bits            << 0
-                   | stop_bits            << 2
-                   | parity_enable        << 3
-                   | parity_select        << 4;
-}
-
-/******************************************************************************
- * INTERRUPTS HANDLING
- ******************************************************************************/
-static inline void uart_irq(uint32_t iir, uint32_t index) {
-    // [Chapter 14] LPC17xx UART0/2/3: UARTn Interrupt Handling
-    SerialIrq irq_type;
-    switch (iir) {
-        case 1: irq_type = TxIrq; break;
-        case 2: irq_type = RxIrq; break;
-        default: return;
-    }
-    
-    if (serial_irq_ids[index] != 0)
-        irq_handler(serial_irq_ids[index], irq_type);
-}
-
-void uart0_irq() {uart_irq((LPC_UART->IIR >> 1) & 0x7, 0);}
-
-void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id) {
-    irq_handler = handler;
-    serial_irq_ids[obj->index] = id;
-}
-
-void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) {
-    IRQn_Type irq_n = (IRQn_Type)0;
-    uint32_t vector = 0;
-    switch ((int)obj->uart) {
-        case UART_0:
-            irq_n=UART_IRQn;
-            vector = (uint32_t)&uart0_irq;
-            break;
-        default:
-            return;
-    }
-    
-    if (enable) {
-        obj->uart->IER |= 1 << irq;
-        NVIC_SetVector(irq_n, vector);
-        NVIC_EnableIRQ(irq_n);
-    } else { // disable
-        int all_disabled = 0;
-        SerialIrq other_irq = (irq == RxIrq) ? (TxIrq) : (RxIrq);
-
-        obj->uart->IER &= ~(1 << irq);
-        all_disabled = (obj->uart->IER & (1 << other_irq)) == 0;
-        
-        if (all_disabled)
-            NVIC_DisableIRQ(irq_n);
-    }
-}
-
-/******************************************************************************
- * READ/WRITE
- ******************************************************************************/
-int serial_getc(serial_t *obj) {
-    while (!serial_readable(obj));
-    return obj->uart->RBR;
-}
-
-void serial_putc(serial_t *obj, int c) {
-    while (!serial_writable(obj));
-    obj->uart->THR = c;
-}
-
-int serial_readable(serial_t *obj) {
-    return obj->uart->LSR & 0x01;
-}
-
-int serial_writable(serial_t *obj) {
-    return obj->uart->LSR & 0x20;
-}
-
-void serial_clear(serial_t *obj) {
-    obj->uart->FCR = 1 << 1  // rx FIFO reset
-                   | 1 << 2  // tx FIFO reset
-                   | 0 << 6; // interrupt depth
-}
-
-void serial_pinout_tx(PinName tx) {
-    pinmap_pinout(tx, PinMap_UART_TX);
-}
-
-void serial_break_clear(serial_t *obj) {
-    obj->uart->LCR &= ~(1 << 6);
-}
-
-void serial_break_set(serial_t *obj) {
-    obj->uart->LCR |= 1 << 6;
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/sleep.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "sleep_api.h"
-#include "cmsis.h"
-#include "mbed_interface.h"
-
-void sleep(void) {
-#if DEVICE_SEMIHOST
-    // ensure debug is disconnected
-    mbed_interface_disconnect();
-#endif
-    
-    // PCON[DPDEN] set to sleep
-    LPC_PMU->PCON = 0x0;
-    
-    // SRC[SLEEPDEEP] set to 0 = sleep
-    SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk;
-    
-    // wait for interrupt
-    __WFI();
-}
-
-/*
-* The mbed lpc1768 does not support the deepsleep mode
-* as a debugger is connected to it (the mbed interface).
-*
-* As mentionned in an application note from NXP:
-*
-*       http://www.po-star.com/public/uploads/20120319123122_141.pdf
-*
-*       {{{
-*       The user should be aware of certain limitations during debugging.
-*       The most important is that, due to limitations of the Cortex-M3
-*       integration, the LPC17xx cannot wake up in the usual manner from
-*       Deep Sleep and Power-down modes. It is recommended not to use these
-*       modes during debug. Once an application is downloaded via JTAG/SWD
-*       interface, the USB to SWD/JTAG debug adapter (Keil ULINK2 for example)
-*       should be removed from the target board, and thereafter, power cycle
-*       the LPC17xx to allow wake-up from deep sleep and power-down modes
-*       }}}
-*
-*       As the interface firmware does not reset the target when a
-*       mbed_interface_disconnect() semihosting call is made, the
-*       core cannot wake-up from deepsleep.
-*
-*       We treat a deepsleep() as a normal sleep().
-*/
-
-void deepsleep(void) {
-#if DEVICE_SEMIHOST
-    // ensure debug is disconnected
-    mbed_interface_disconnect();
-#endif
-    
-    // PCON[DPDEN] set to deepsleep
-    LPC_PMU->PCON = 0x2;
-    
-    // SRC[SLEEPDEEP] set to 1 = deep sleep
-    SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
-    
-    // Power up everything after powerdown
-    LPC_SYSCON->PDAWAKECFG &= 0xFFFFF800;
-    
-    // wait for interrupt
-    __WFI();
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/spi_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,214 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <math.h>
-#include "spi_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_SPI_SCLK[] = {
-    {P0_6 , SPI_0, 0x02},
-    // {P0_10, SPI_0, 0x02}, -- should be mapped to SWCLK only
-    {P2_11, SPI_0, 0x01},
-    {P2_1 , SPI_1, 0x02},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_MOSI[] = {
-    {P0_9 , SPI_0, 0x01},
-    {P2_3 , SPI_1, 0x02},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_MISO[] = {
-    {P0_8 , SPI_0, 0x01},
-    {P2_2 , SPI_1, 0x02},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_SSEL[] = {
-    {P0_2 , SPI_0, 0x01},
-    {P2_0 , SPI_1, 0x02},
-    {NC   , NC   , 0}
-};
-
-static inline int ssp_disable(spi_t *obj);
-static inline int ssp_enable(spi_t *obj);
-
-void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel) {
-    // determine the SPI to use
-    SPIName spi_mosi = (SPIName)pinmap_peripheral(mosi, PinMap_SPI_MOSI);
-    SPIName spi_miso = (SPIName)pinmap_peripheral(miso, PinMap_SPI_MISO);
-    SPIName spi_sclk = (SPIName)pinmap_peripheral(sclk, PinMap_SPI_SCLK);
-    SPIName spi_ssel = (SPIName)pinmap_peripheral(ssel, PinMap_SPI_SSEL);
-    SPIName spi_data = (SPIName)pinmap_merge(spi_mosi, spi_miso);
-    SPIName spi_cntl = (SPIName)pinmap_merge(spi_sclk, spi_ssel);
-    
-    obj->spi = (LPC_SSP_TypeDef*)pinmap_merge(spi_data, spi_cntl);
-    
-    if ((int)obj->spi == NC) {
-        error("SPI pinout mapping failed");
-    }
-    
-    // enable power and clocking
-    switch ((int)obj->spi) {
-        case SPI_0:
-            LPC_SYSCON->SYSAHBCLKCTRL |= 1 << 11;
-            LPC_SYSCON->SSP0CLKDIV = 0x01;
-            LPC_SYSCON->PRESETCTRL |= 1 << 0;
-            break;
-        case SPI_1:
-            LPC_SYSCON->SYSAHBCLKCTRL |= 1 << 18;
-            LPC_SYSCON->SSP1CLKDIV = 0x01;
-            LPC_SYSCON->PRESETCTRL |= 1 << 2;
-            break;
-    }
-    
-    // set default format and frequency
-    if (ssel == NC) {
-        spi_format(obj, 8, 0, 0);  // 8 bits, mode 0, master
-    } else {
-        spi_format(obj, 8, 0, 1);  // 8 bits, mode 0, slave
-    }
-    spi_frequency(obj, 1000000);
-    
-    // enable the ssp channel
-    ssp_enable(obj);
-    
-    // pin out the spi pins
-    pinmap_pinout(mosi, PinMap_SPI_MOSI);
-    pinmap_pinout(miso, PinMap_SPI_MISO);
-    pinmap_pinout(sclk, PinMap_SPI_SCLK);
-    if (ssel != NC) {
-        pinmap_pinout(ssel, PinMap_SPI_SSEL);
-    }
-}
-
-void spi_free(spi_t *obj) {}
-
-void spi_format(spi_t *obj, int bits, int mode, int slave) {
-    ssp_disable(obj);
-    
-    if (!(bits >= 4 && bits <= 16) || !(mode >= 0 && mode <= 3)) {
-        error("SPI format error");
-    }
-    
-    int polarity = (mode & 0x2) ? 1 : 0;
-    int phase = (mode & 0x1) ? 1 : 0;
-    
-    // set it up
-    int DSS = bits - 1;            // DSS (data select size)
-    int SPO = (polarity) ? 1 : 0;  // SPO - clock out polarity
-    int SPH = (phase) ? 1 : 0;     // SPH - clock out phase
-    
-    int FRF = 0;                   // FRF (frame format) = SPI
-    uint32_t tmp = obj->spi->CR0;
-    tmp &= ~(0xFFFF);
-    tmp |= DSS << 0
-        | FRF << 4
-        | SPO << 6
-        | SPH << 7;
-    obj->spi->CR0 = tmp;
-    
-    tmp = obj->spi->CR1;
-    tmp &= ~(0xD);
-    tmp |= 0 << 0                   // LBM - loop back mode - off
-        | ((slave) ? 1 : 0) << 2   // MS - master slave mode, 1 = slave
-        | 0 << 3;                  // SOD - slave output disable - na
-    obj->spi->CR1 = tmp;
-    
-    ssp_enable(obj);
-}
-
-void spi_frequency(spi_t *obj, int hz) {
-    ssp_disable(obj);
-    
-    uint32_t PCLK = SystemCoreClock;
-    
-    int prescaler;
-    
-    for (prescaler = 2; prescaler <= 254; prescaler += 2) {
-        int prescale_hz = PCLK / prescaler;
-        
-        // calculate the divider
-        int divider = floor(((float)prescale_hz / (float)hz) + 0.5f);
-        
-        // check we can support the divider
-        if (divider < 256) {
-            // prescaler
-            obj->spi->CPSR = prescaler;
-            
-            // divider
-            obj->spi->CR0 &= ~(0xFFFF << 8);
-            obj->spi->CR0 |= (divider - 1) << 8;
-            ssp_enable(obj);
-            return;
-        }
-    }
-    error("Couldn't setup requested SPI frequency");
-}
-
-static inline int ssp_disable(spi_t *obj) {
-    return obj->spi->CR1 &= ~(1 << 1);
-}
-
-static inline int ssp_enable(spi_t *obj) {
-    return obj->spi->CR1 |= (1 << 1);
-}
-
-static inline int ssp_readable(spi_t *obj) {
-    return obj->spi->SR & (1 << 2);
-}
-
-static inline int ssp_writeable(spi_t *obj) {
-    return obj->spi->SR & (1 << 1);
-}
-
-static inline void ssp_write(spi_t *obj, int value) {
-    while (!ssp_writeable(obj));
-    obj->spi->DR = value;
-}
-
-static inline int ssp_read(spi_t *obj) {
-    while (!ssp_readable(obj));
-    return obj->spi->DR;
-}
-
-static inline int ssp_busy(spi_t *obj) {
-    return (obj->spi->SR & (1 << 4)) ? (1) : (0);
-}
-
-int spi_master_write(spi_t *obj, int value) {
-    ssp_write(obj, value);
-    return ssp_read(obj);
-}
-
-int spi_slave_receive(spi_t *obj) {
-    return (ssp_readable(obj) && !ssp_busy(obj)) ? (1) : (0);
-};
-
-int spi_slave_read(spi_t *obj) {
-    return obj->spi->DR;
-}
-
-void spi_slave_write(spi_t *obj, int value) {
-    while (ssp_writeable(obj) == 0) ;
-    obj->spi->DR = value;
-}
-
-int spi_busy(spi_t *obj) {
-    return ssp_busy(obj);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/us_ticker.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stddef.h>
-#include "us_ticker_api.h"
-#include "PeripheralNames.h"
-
-#define US_TICKER_TIMER          ((LPC_TMR_TypeDef *)LPC_CT32B1_BASE)
-#define US_TICKER_TIMER_IRQn     TIMER_32_1_IRQn
-
-int us_ticker_inited = 0;
-
-void us_ticker_init(void) {
-    if (us_ticker_inited) return;
-    us_ticker_inited = 1;
-    
-    LPC_SYSCON->SYSAHBCLKCTRL |= (1<<10); // Clock TIMER_1
-    uint32_t PCLK = SystemCoreClock;
-
-    US_TICKER_TIMER->TCR = 0x2;  // reset
-
-    uint32_t prescale = PCLK / 1000000; // default to 1MHz (1 us ticks)
-    US_TICKER_TIMER->PR = prescale - 1;
-    US_TICKER_TIMER->TCR = 1; // enable = 1, reset = 0
-
-    NVIC_SetVector(US_TICKER_TIMER_IRQn, (uint32_t)us_ticker_irq_handler);
-    NVIC_EnableIRQ(US_TICKER_TIMER_IRQn);
-}
-
-uint32_t us_ticker_read() {
-    if (!us_ticker_inited)
-        us_ticker_init();
-    
-    return US_TICKER_TIMER->TC;
-}
-
-void us_ticker_set_interrupt(unsigned int timestamp) {
-    // set match value
-    US_TICKER_TIMER->MR0 = timestamp;
-    // enable match interrupt
-    US_TICKER_TIMER->MCR |= 1;
-}
-
-void us_ticker_disable_interrupt(void) {
-    US_TICKER_TIMER->MCR &= ~1;
-}
-
-void us_ticker_clear_interrupt(void) {
-    US_TICKER_TIMER->IR = 1;
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC13XX/PeripheralNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    UART_0 = (int)LPC_USART_BASE
-} UARTName;
-
-typedef enum {
-    I2C_0 = (int)LPC_I2C_BASE
-} I2CName;
-
-typedef enum {
-    ADC0_0 = 0,
-    ADC0_1,
-    ADC0_2,
-    ADC0_3,
-    ADC0_4,
-    ADC0_5,
-    ADC0_6,
-    ADC0_7
-} ADCName;
-
-typedef enum {
-    SPI_0 = (int)LPC_SSP0_BASE,
-    SPI_1 = (int)LPC_SSP1_BASE
-} SPIName;
-
-typedef enum {
-    PWM_1 = 0,
-    PWM_2,
-    PWM_3,
-    PWM_4,
-    PWM_5,
-    PWM_6,
-    PWM_7,
-    PWM_8,
-    PWM_9,
-    PWM_10,
-    PWM_11
-} PWMName;
-
-#define STDIO_UART_TX     UART_TX
-#define STDIO_UART_RX     UART_RX
-#define STDIO_UART        UART_0
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC13XX/PinNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PINNAMES_H
-#define MBED_PINNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    PIN_INPUT,
-    PIN_OUTPUT
-} PinDirection;
-
-#define PORT_SHIFT  5
-
-typedef enum {
-    // LPC1347 Pin Names
-    P0_0 = 0,
-    P0_1 = 1,
-    P0_2 = 2,
-    P0_3 = 3,
-    P0_4 = 4,
-    P0_5 = 5,
-    P0_6 = 6,
-    P0_7 = 7,
-    P0_8 = 8,
-    P0_9 = 9,
-    P0_10 = 10,
-    P0_11 = 11,
-    P0_12 = 12,
-    P0_13 = 13,
-    P0_14 = 14,
-    P0_15 = 15,
-    P0_16 = 16,
-    P0_17 = 17,
-    P0_18 = 18,
-    P0_19 = 19,
-    P0_20 = 20,
-    P0_21 = 21,
-    P0_22 = 22,
-    P0_23 = 23,
-
-    P1_13 = 45,
-    P1_14 = 46,
-    P1_15 = 47,
-    P1_16 = 48,
-
-    P1_19 = 51,
-    P1_20 = 52,
-    P1_21 = 53,
-    P1_22 = 54,
-    P1_23 = 55,
-    P1_24 = 56,
-    P1_25 = 57,
-    P1_26 = 58,
-    P1_27 = 59,
-    P1_28 = 60,
-    P1_29 = 61,
-
-    P1_31 = 63,
-
-    // DIP Pin Names
-    p1  = P0_0,
-    p2  = P0_11,
-    p3  = P0_12,
-    p4  = P0_13,
-    p5  = P0_14,
-    p6  = P1_31,
-    p8  = P0_16,
-    p9  = P0_22,
-    p10 = P0_23,
-    p13 = P1_29,
-    p14 = P1_21,
-    p15 = P0_8,
-    p16 = P0_9,
-    p17 = P1_24,
-    p18 = P0_4,
-    p19 = P1_13,
-    p20 = P1_14,
-    p21 = P1_22,
-    p22 = P0_17,
-    p23 = P0_5,
-    p24 = P0_21,
-    p25 = P0_19,
-    p26 = P0_18,
-    p27 = P1_15,
-    p28 = P1_16,
-    p29 = P1_25,
-    p30 = P1_19,
-    p33 = P0_20,
-    p34 = P0_2,
-    p35 = P1_26,
-    p36 = P1_27,
-    p37 = P1_20,
-    p38 = P1_23,
-    p39 = P0_7,
-    p40 = P1_28,
-
-    UART_TX = P0_19,
-    UART_RX = P0_18,
-
-    // Not connected
-    NC = (int)0xFFFFFFFF,
-
-    LED1 = p21,
-    LED2 = p21,
-    LED3 = p21,
-    LED4 = p21
-} PinName;
-
-typedef enum {
-    CHANNEL0 = PIN_INT0_IRQn,
-    CHANNEL1 = PIN_INT1_IRQn,
-    CHANNEL2 = PIN_INT2_IRQn,
-    CHANNEL3 = PIN_INT3_IRQn,
-    CHANNEL4 = PIN_INT4_IRQn,
-    CHANNEL5 = PIN_INT5_IRQn,
-    CHANNEL6 = PIN_INT6_IRQn,
-    CHANNEL7 = PIN_INT7_IRQn
-} Channel;
-
-typedef enum {
-    PullUp = 2,
-    PullDown = 1,
-    PullNone = 0,
-    Repeater = 3,
-    OpenDrain = 4
-} PinMode;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC13XX/PortNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PORTNAMES_H
-#define MBED_PORTNAMES_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    Port0 = 0,
-    Port1 = 1
-} PortName;
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC13XX/analogin_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "analogin_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-#define ANALOGIN_MEDIAN_FILTER      1
-
-#define ADC_10BIT_RANGE             0x3FF
-#define ADC_12BIT_RANGE             0xFFF
-
-static inline int div_round_up(int x, int y) {
-  return (x + (y - 1)) / y;
-}
-
-static const PinMap PinMap_ADC[] = {
-    {P0_11, ADC0_0, 0x02},
-    {P0_12, ADC0_1, 0x02},
-    {P0_13, ADC0_2, 0x02},
-    {P0_14, ADC0_3, 0x02},
-    {P0_15, ADC0_4, 0x02},
-    {P0_16, ADC0_5, 0x01},
-    {P0_22, ADC0_6, 0x01},
-    {P0_23, ADC0_7, 0x01},
-    {NC   , NC    , 0   }
-};
-
-#define LPC_IOCON0_BASE (LPC_IOCON_BASE)
-#define LPC_IOCON1_BASE (LPC_IOCON_BASE + 0x60)
-
-#define ADC_RANGE    ADC_10BIT_RANGE
-
-void analogin_init(analogin_t *obj, PinName pin) {
-    obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
-    if (obj->adc == (uint32_t)NC) {
-        error("ADC pin mapping failed");
-    }
-    
-    // Power up ADC
-    LPC_SYSCON->PDRUNCFG &= ~ (1 << 4);
-    LPC_SYSCON->SYSAHBCLKCTRL |= ((uint32_t)1 << 13);
-
-    uint32_t pin_number = (uint32_t)pin;
-    __IO uint32_t *reg = (pin_number < 32) ? (__IO uint32_t*)(LPC_IOCON0_BASE + 4 * pin_number) : (__IO uint32_t*)(LPC_IOCON1_BASE + 4 * (pin_number - 32));
-
-    // set pin to ADC mode
-    *reg &= ~(1 << 7); // set ADMODE = 0 (analog mode)
-
-    uint32_t PCLK = SystemCoreClock;
-    uint32_t MAX_ADC_CLK = 4500000;
-    uint32_t clkdiv = div_round_up(PCLK, MAX_ADC_CLK) - 1;
-
-    LPC_ADC->CR = (0 << 0)      // no channels selected
-                | (clkdiv << 8) // max of 4.5MHz
-                | (0 << 16)     // BURST = 0, software controlled
-                | ( 0 << 17 );  // CLKS = 0, not applicable
-    
-    pinmap_pinout(pin, PinMap_ADC);
-}
-
-static inline uint32_t adc_read(analogin_t *obj) {
-    // Select the appropriate channel and start conversion
-    LPC_ADC->CR &= ~0xFF;
-    LPC_ADC->CR |= 1 << (int)obj->adc;
-    LPC_ADC->CR |= 1 << 24;
-    
-    // Repeatedly get the sample data until DONE bit
-    unsigned int data;
-    do {
-        data = LPC_ADC->GDR;
-    } while ((data & ((unsigned int)1 << 31)) == 0);
-    
-    // Stop conversion
-    LPC_ADC->CR &= ~(1 << 24);
-    
-    return (data >> 6) & ADC_RANGE; // 10 bit
-}
-
-static inline void order(uint32_t *a, uint32_t *b) {
-    if (*a > *b) {
-        uint32_t t = *a;
-        *a = *b;
-        *b = t;
-    }
-}
-
-static inline uint32_t adc_read_u32(analogin_t *obj) {
-    uint32_t value;
-#if ANALOGIN_MEDIAN_FILTER
-    uint32_t v1 = adc_read(obj);
-    uint32_t v2 = adc_read(obj);
-    uint32_t v3 = adc_read(obj);
-    order(&v1, &v2);
-    order(&v2, &v3);
-    order(&v1, &v2);
-    value = v2;
-#else
-    value = adc_read(obj);
-#endif
-    return value;
-}
-
-uint16_t analogin_read_u16(analogin_t *obj) {
-    uint32_t value = adc_read_u32(obj);
-    
-    return (value << 6) | ((value >> 4) & 0x003F); // 10 bit
-}
-
-float analogin_read(analogin_t *obj) {
-    uint32_t value = adc_read_u32(obj);
-    return (float)value * (1.0f / (float)ADC_RANGE);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC13XX/device.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_DEVICE_H
-#define MBED_DEVICE_H
-
-#define DEVICE_PORTIN           1
-#define DEVICE_PORTOUT          1
-#define DEVICE_PORTINOUT        1
-
-#define DEVICE_INTERRUPTIN      1
-
-#define DEVICE_ANALOGIN         1
-#define DEVICE_ANALOGOUT        0
-
-#define DEVICE_SERIAL           1
-
-#define DEVICE_I2C              1
-#define DEVICE_I2CSLAVE         1
-
-#define DEVICE_SPI              1
-#define DEVICE_SPISLAVE         1
-
-#define DEVICE_CAN              0
-
-#define DEVICE_RTC              0
-
-#define DEVICE_ETHERNET         0
-
-#define DEVICE_PWMOUT           1
-
-#define DEVICE_SEMIHOST         0
-#define DEVICE_LOCALFILESYSTEM  0
-#define DEVICE_ID_LENGTH       32
-#define DEVICE_MAC_OFFSET      20
-
-#define DEVICE_SLEEP            1
-
-#define DEVICE_DEBUG_AWARENESS  0
-
-#define DEVICE_STDIO_MESSAGES   1
-
-#include "objects.h"
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC13XX/gpio_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "gpio_api.h"
-#include "pinmap.h"
-
-uint32_t gpio_set(PinName pin) {
-    int f = ((pin == P0_11) ||
-             (pin == P0_12) ||
-             (pin == P0_13) ||
-             (pin == P0_14)) ? (1) : (0);
-    
-    pin_function(pin, f);
-    
-    return (1 << ((int)pin & 0x1F));
-}
-
-void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) {
-    if(pin == NC) return;
-
-    obj->pin = pin;
-    obj->mask = gpio_set(pin);
-    
-    unsigned int port = (unsigned int)pin >> PORT_SHIFT;
-    
-    obj->reg_set = &LPC_GPIO->SET[port];
-    obj->reg_clr = &LPC_GPIO->CLR[port];
-    obj->reg_in  = &LPC_GPIO->PIN[port];
-    obj->reg_dir = &LPC_GPIO->DIR[port];
-    
-    gpio_dir(obj, direction);
-    switch (direction) {
-        case PIN_OUTPUT: pin_mode(pin, PullNone); break;
-        case PIN_INPUT : pin_mode(pin, PullDown); break;
-    }
-}
-
-void gpio_mode(gpio_t *obj, PinMode mode) {
-    pin_mode(obj->pin, mode);
-}
-
-void gpio_dir(gpio_t *obj, PinDirection direction) {
-    switch (direction) {
-        case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break;
-        case PIN_OUTPUT: *obj->reg_dir |=  obj->mask; break;
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC13XX/gpio_irq_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stddef.h>
-#include "cmsis.h"
-#include "gpio_irq_api.h"
-#include "error.h"
-
-#define CHANNEL_NUM    8
-#define LPC_GPIO_X LPC_GPIO_PIN_INT
-#define PININT_IRQ 0
-
-static uint32_t channel_ids[CHANNEL_NUM] = {0};
-static gpio_irq_handler irq_handler;
-
-static inline void handle_interrupt_in(uint32_t channel) {
-    uint32_t ch_bit = (1 << channel);
-    // Return immediately if:
-    //   * The interrupt was already served
-    //   * There is no user handler
-    //   * It is a level interrupt, not an edge interrupt
-    if ( ((LPC_GPIO_X->IST & ch_bit) == 0) ||
-         (channel_ids[channel] == 0      ) ||
-         (LPC_GPIO_X->ISEL & ch_bit      ) ) return;
-
-    if ((LPC_GPIO_X->IENR & ch_bit) && (LPC_GPIO_X->RISE & ch_bit)) {
-        irq_handler(channel_ids[channel], IRQ_RISE);
-        LPC_GPIO_X->RISE = ch_bit;
-    }
-    if ((LPC_GPIO_X->IENF & ch_bit) && (LPC_GPIO_X->FALL & ch_bit)) {
-        irq_handler(channel_ids[channel], IRQ_FALL);
-    }
-    LPC_GPIO_X->IST = ch_bit;
-}
-
-void gpio_irq0(void) {handle_interrupt_in(0);}
-void gpio_irq1(void) {handle_interrupt_in(1);}
-void gpio_irq2(void) {handle_interrupt_in(2);}
-void gpio_irq3(void) {handle_interrupt_in(3);}
-void gpio_irq4(void) {handle_interrupt_in(4);}
-void gpio_irq5(void) {handle_interrupt_in(5);}
-void gpio_irq6(void) {handle_interrupt_in(6);}
-void gpio_irq7(void) {handle_interrupt_in(7);}
-
-int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id) {
-    if (pin == NC) return -1;
-
-    irq_handler = handler;
-    
-    int found_free_channel = 0;
-    int i = 0;
-    for (i=0; i<CHANNEL_NUM; i++) {
-        if (channel_ids[i] == 0) {
-            channel_ids[i] = id;
-            obj->ch = i;
-            found_free_channel = 1;
-            break;
-        }
-    }
-    if (!found_free_channel) return -1;
-    
-    /* Enable AHB clock to the GPIO domain. */
-    LPC_SYSCON->SYSAHBCLKCTRL |= (1<<6);
-    
-    /* Enable AHB clock to the FlexInt, GroupedInt domain. */
-    LPC_SYSCON->SYSAHBCLKCTRL |= ((1<<19) | (1<<23) | (1<<24));
-    
-    /* To select a pin for any of the eight pin interrupts, write the pin number
-     * as 0 to 23 for pins PIO0_0 to PIO0_23 and 24 to 55.
-     * @see: mbed_capi/PinNames.h
-     */
-    LPC_SYSCON->PINSEL[obj->ch] = (pin >> 5) ? (pin - 8) : (pin);
-    
-    // Interrupt Wake-Up Enable
-    LPC_SYSCON->STARTERP0 |= 1 << obj->ch;
-
-    void (*channels_irq)(void) = NULL;
-    switch (obj->ch) {
-        case 0: channels_irq = &gpio_irq0; break;
-        case 1: channels_irq = &gpio_irq1; break;
-        case 2: channels_irq = &gpio_irq2; break;
-        case 3: channels_irq = &gpio_irq3; break;
-        case 4: channels_irq = &gpio_irq4; break;
-        case 5: channels_irq = &gpio_irq5; break;
-        case 6: channels_irq = &gpio_irq6; break;
-        case 7: channels_irq = &gpio_irq7; break;
-    }
-    NVIC_SetVector((IRQn_Type)(PININT_IRQ + obj->ch), (uint32_t)channels_irq);
-    NVIC_EnableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
-    
-    return 0;
-}
-
-void gpio_irq_free(gpio_irq_t *obj) {
-    channel_ids[obj->ch] = 0;
-    LPC_SYSCON->STARTERP0 &= ~(1 << obj->ch);
-}
-
-void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
-    unsigned int ch_bit = (1 << obj->ch);
-    
-    // Clear interrupt
-    if (!(LPC_GPIO_X->ISEL & ch_bit))
-        LPC_GPIO_X->IST = ch_bit;
-    
-    // Edge trigger
-    LPC_GPIO_X->ISEL &= ~ch_bit;
-    if (event == IRQ_RISE) {
-        if (enable) {
-            LPC_GPIO_X->IENR |= ch_bit;
-        } else {
-            LPC_GPIO_X->IENR &= ~ch_bit;
-        }
-    } else {
-        if (enable) {
-            LPC_GPIO_X->IENF |= ch_bit;
-        } else {
-            LPC_GPIO_X->IENF &= ~ch_bit;
-        }
-    }
-}
-
-void gpio_irq_enable(gpio_irq_t *obj) {
-    NVIC_EnableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
-}
-
-void gpio_irq_disable(gpio_irq_t *obj) {
-    NVIC_DisableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
-}
-
--- a/targets/hal/TARGET_NXP/TARGET_LPC13XX/gpio_object.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_GPIO_OBJECT_H
-#define MBED_GPIO_OBJECT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
-    PinName  pin;
-    uint32_t mask;
-
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_set;
-    __IO uint32_t *reg_clr;
-    __I  uint32_t *reg_in;
-} gpio_t;
-
-static inline void gpio_write(gpio_t *obj, int value) {
-    if (value)
-        *obj->reg_set = obj->mask;
-    else
-        *obj->reg_clr = obj->mask;
-}
-
-static inline int gpio_read(gpio_t *obj) {
-    return ((*obj->reg_in & obj->mask) ? 1 : 0);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC13XX/i2c_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,387 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "i2c_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_I2C_SDA[] = {
-    {P0_5, I2C_0, 1},
-    {NC  , NC   , 0}
-};
-
-static const PinMap PinMap_I2C_SCL[] = {
-    {P0_4, I2C_0, 1},
-    {NC  , NC,    0}
-};
-
-#define I2C_CONSET(x)       (x->i2c->CONSET)
-#define I2C_CONCLR(x)       (x->i2c->CONCLR)
-#define I2C_STAT(x)         (x->i2c->STAT)
-#define I2C_DAT(x)          (x->i2c->DAT)
-#define I2C_SCLL(x, val)    (x->i2c->SCLL = val)
-#define I2C_SCLH(x, val)    (x->i2c->SCLH = val)
-
-static const uint32_t I2C_addr_offset[2][4] = {
-    {0x0C, 0x20, 0x24, 0x28},
-    {0x30, 0x34, 0x38, 0x3C}
-};
-
-static inline void i2c_conclr(i2c_t *obj, int start, int stop, int interrupt, int acknowledge) {
-    I2C_CONCLR(obj) = (start << 5)
-                    | (stop << 4)
-                    | (interrupt << 3)
-                    | (acknowledge << 2);
-}
-
-static inline void i2c_conset(i2c_t *obj, int start, int stop, int interrupt, int acknowledge) {
-    I2C_CONSET(obj) = (start << 5)
-                    | (stop << 4)
-                    | (interrupt << 3)
-                    | (acknowledge << 2);
-}
-
-// Clear the Serial Interrupt (SI)
-static inline void i2c_clear_SI(i2c_t *obj) {
-    i2c_conclr(obj, 0, 0, 1, 0);
-}
-
-static inline int i2c_status(i2c_t *obj) {
-    return I2C_STAT(obj);
-}
-
-// Wait until the Serial Interrupt (SI) is set
-static int i2c_wait_SI(i2c_t *obj) {
-    int timeout = 0;
-    while (!(I2C_CONSET(obj) & (1 << 3))) {
-        timeout++;
-        if (timeout > 100000) return -1;
-    }
-    return 0;
-}
-
-static inline void i2c_interface_enable(i2c_t *obj) {
-    I2C_CONSET(obj) = 0x40;
-}
-
-static inline void i2c_power_enable(i2c_t *obj) {
-    LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 5);
-    LPC_SYSCON->PRESETCTRL |= 1 << 1;
-}
-
-void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
-    // determine the SPI to use
-    I2CName i2c_sda = (I2CName)pinmap_peripheral(sda, PinMap_I2C_SDA);
-    I2CName i2c_scl = (I2CName)pinmap_peripheral(scl, PinMap_I2C_SCL);
-    obj->i2c = (LPC_I2C_Type *)pinmap_merge(i2c_sda, i2c_scl);
-    
-    if ((int)obj->i2c == NC) {
-        error("I2C pin mapping failed");
-    }
-    
-    // enable power
-    i2c_power_enable(obj);
-    
-    // set default frequency at 100k
-    i2c_frequency(obj, 100000);
-    i2c_conclr(obj, 1, 1, 1, 1);
-    i2c_interface_enable(obj);
-    
-    pinmap_pinout(sda, PinMap_I2C_SDA);
-    pinmap_pinout(scl, PinMap_I2C_SCL);
-}
-
-inline int i2c_start(i2c_t *obj) {
-    int status = 0;
-    // 8.1 Before master mode can be entered, I2CON must be initialised to:
-    //  - I2EN STA STO SI AA - -
-    //  -  1    0   0   0  x - -
-    // if AA = 0, it can't enter slave mode
-    i2c_conclr(obj, 1, 1, 1, 1);
-    
-    // The master mode may now be entered by setting the STA bit
-    // this will generate a start condition when the bus becomes free
-    i2c_conset(obj, 1, 0, 0, 1);
-    
-    i2c_wait_SI(obj);
-    status = i2c_status(obj);
-    
-    // Clear start bit now transmitted, and interrupt bit
-    i2c_conclr(obj, 1, 0, 0, 0);
-    return status;
-}
-
-inline int i2c_stop(i2c_t *obj) {
-    int timeout = 0;
-
-    // write the stop bit
-    i2c_conset(obj, 0, 1, 0, 0);
-    i2c_clear_SI(obj);
-    
-    // wait for STO bit to reset
-    while(I2C_CONSET(obj) & (1 << 4)) {
-        timeout ++;
-        if (timeout > 100000) return 1;
-    }
-
-    return 0;
-}
-
-
-static inline int i2c_do_write(i2c_t *obj, int value, uint8_t addr) {
-    // write the data
-    I2C_DAT(obj) = value;
-    
-    // clear SI to init a send
-    i2c_clear_SI(obj);
-    
-    // wait and return status
-    i2c_wait_SI(obj);
-    return i2c_status(obj);
-}
-
-static inline int i2c_do_read(i2c_t *obj, int last) {
-    // we are in state 0x40 (SLA+R tx'd) or 0x50 (data rx'd and ack)
-    if (last) {
-        i2c_conclr(obj, 0, 0, 0, 1); // send a NOT ACK
-    } else {
-        i2c_conset(obj, 0, 0, 0, 1); // send a ACK
-    }
-    
-    // accept byte
-    i2c_clear_SI(obj);
-    
-    // wait for it to arrive
-    i2c_wait_SI(obj);
-    
-    // return the data
-    return (I2C_DAT(obj) & 0xFF);
-}
-
-void i2c_frequency(i2c_t *obj, int hz) {
-    // No peripheral clock divider on the M0
-    uint32_t PCLK = SystemCoreClock;
-    
-    uint32_t pulse = PCLK / (hz * 2);
-    
-    // I2C Rate
-    I2C_SCLL(obj, pulse);
-    I2C_SCLH(obj, pulse);
-}
-
-// The I2C does a read or a write as a whole operation
-// There are two types of error conditions it can encounter
-//  1) it can not obtain the bus
-//  2) it gets error responses at part of the transmission
-//
-// We tackle them as follows:
-//  1) we retry until we get the bus. we could have a "timeout" if we can not get it
-//      which basically turns it in to a 2)
-//  2) on error, we use the standard error mechanisms to report/debug
-//
-// Therefore an I2C transaction should always complete. If it doesn't it is usually
-// because something is setup wrong (e.g. wiring), and we don't need to programatically
-// check for that
-
-int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) {
-    int count, status;
-    
-    status = i2c_start(obj);
-    
-    if ((status != 0x10) && (status != 0x08)) {
-        i2c_stop(obj);
-        return I2C_ERROR_BUS_BUSY;
-    }
-    
-    status = i2c_do_write(obj, (address | 0x01), 1);
-    if (status != 0x40) {
-        i2c_stop(obj);
-        return I2C_ERROR_NO_SLAVE;
-    }
-
-    // Read in all except last byte
-    for (count = 0; count < (length - 1); count++) {
-        int value = i2c_do_read(obj, 0);
-        status = i2c_status(obj);
-        if (status != 0x50) {
-            i2c_stop(obj);
-            return count;
-        }
-        data[count] = (char) value;
-    }
-
-    // read in last byte
-    int value = i2c_do_read(obj, 1);
-    status = i2c_status(obj);
-    if (status != 0x58) {
-        i2c_stop(obj);
-        return length - 1;
-    }
-    
-    data[count] = (char) value;
-    
-    // If not repeated start, send stop.
-    if (stop) {
-        i2c_stop(obj);
-    }
-    
-    return length;
-}
-
-int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) {
-    int i, status;
-    
-    status = i2c_start(obj);
-    
-    if ((status != 0x10) && (status != 0x08)) {
-        i2c_stop(obj);
-        return I2C_ERROR_BUS_BUSY;
-    }
-    
-    status = i2c_do_write(obj, (address & 0xFE), 1);
-    if (status != 0x18) {
-        i2c_stop(obj);
-        return I2C_ERROR_NO_SLAVE;
-    }
-    
-    for (i=0; i<length; i++) {
-        status = i2c_do_write(obj, data[i], 0);
-        if(status != 0x28) {
-            i2c_stop(obj);
-            return i;
-        }
-    }
-    
-    // clearing the serial interrupt here might cause an unintended rewrite of the last byte
-    // see also issue report https://mbed.org/users/mbed_official/code/mbed/issues/1
-    // i2c_clear_SI(obj);
-    
-    // If not repeated start, send stop.
-    if (stop) {
-        i2c_stop(obj);
-    }
-    
-    return length;
-}
-
-void i2c_reset(i2c_t *obj) {
-    i2c_stop(obj);
-}
-
-int i2c_byte_read(i2c_t *obj, int last) {
-    return (i2c_do_read(obj, last) & 0xFF);
-}
-
-int i2c_byte_write(i2c_t *obj, int data) {
-    int ack;
-    int status = i2c_do_write(obj, (data & 0xFF), 0);
-    
-    switch(status) {
-        case 0x18: case 0x28:       // Master transmit ACKs
-            ack = 1;
-            break;
-        case 0x40:                  // Master receive address transmitted ACK
-            ack = 1;
-            break;
-        case 0xB8:                  // Slave transmit ACK
-            ack = 1;
-            break;
-        default:
-            ack = 0;
-            break;
-    }
-
-    return ack;
-}
-
-void i2c_slave_mode(i2c_t *obj, int enable_slave) {
-    if (enable_slave != 0) {
-        i2c_conclr(obj, 1, 1, 1, 0);
-        i2c_conset(obj, 0, 0, 0, 1);
-    } else {
-        i2c_conclr(obj, 1, 1, 1, 1);
-    }
-}
-
-int i2c_slave_receive(i2c_t *obj) {
-    int status;
-    int retval;
-    
-    status = i2c_status(obj);
-    switch(status) {
-        case 0x60: retval = 3; break;
-        case 0x70: retval = 2; break;
-        case 0xA8: retval = 1; break;
-        default  : retval = 0; break;
-    }
-    
-    return(retval);
-}
-
-int i2c_slave_read(i2c_t *obj, char *data, int length) {
-    int count = 0;
-    int status;
-    
-    do {
-        i2c_clear_SI(obj);
-        i2c_wait_SI(obj);
-        status = i2c_status(obj);
-        if((status == 0x80) || (status == 0x90)) {
-            data[count] = I2C_DAT(obj) & 0xFF;
-        }
-        count++;
-    } while (((status == 0x80) || (status == 0x90) ||
-            (status == 0x060) || (status == 0x70)) && (count < length));
-    
-    if(status != 0xA0) {
-        i2c_stop(obj);
-    }
-    
-    i2c_clear_SI(obj);
-    
-    return count;
-}
-
-int i2c_slave_write(i2c_t *obj, const char *data, int length) {
-    int count = 0;
-    int status;
-    
-    if(length <= 0) {
-        return(0);
-    }
-    
-    do {
-        status = i2c_do_write(obj, data[count], 0);
-        count++;
-    } while ((count < length) && (status == 0xB8));
-    
-    if((status != 0xC0) && (status != 0xC8)) {
-        i2c_stop(obj);
-    }
-    
-    i2c_clear_SI(obj);
-    
-    return(count);
-}
-
-void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask) {
-    uint32_t addr;
-    
-    if ((idx >= 0) && (idx <= 3)) {
-        addr = ((uint32_t)obj->i2c) + I2C_addr_offset[0][idx];
-        *((uint32_t *) addr) = address & 0xFF;
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC13XX/objects.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_OBJECTS_H
-#define MBED_OBJECTS_H
-
-#include "cmsis.h"
-#include "PortNames.h"
-#include "PeripheralNames.h"
-#include "PinNames.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct gpio_irq_s {
-    uint32_t ch;
-};
-
-struct port_s {
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_mpin;
-    PortName port;
-    uint32_t mask;
-};
-
-
-struct pwmout_s {
-    PWMName pwm;
-};
-
-
-struct serial_s {
-    LPC_USART_Type *uart;
-    int index;
-};
-
-struct analogin_s {
-    ADCName adc;
-};
-
-
-struct i2c_s {
-    LPC_I2C_Type *i2c;
-};
-
-
-struct spi_s {
-    LPC_SSPx_Type *spi;
-};
-
-#include "gpio_object.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC13XX/pinmap.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "pinmap.h"
-#include "error.h"
-
-#define LPC_IOCON0_BASE (LPC_IOCON_BASE)
-#define LPC_IOCON1_BASE (LPC_IOCON_BASE + 0x60)
-
-void pin_function(PinName pin, int function) {
-    if (pin == (uint32_t)NC) return;
-    
-    uint32_t pin_number = (uint32_t)pin;
-    
-    __IO uint32_t *reg = (pin_number < 32) ?
-            (__IO uint32_t*)(LPC_IOCON0_BASE + 4 * pin_number) :
-            (__IO uint32_t*)(LPC_IOCON1_BASE + 4 * (pin_number - 32));
-    
-    // pin function bits: [2:0] -> 111 = (0x7)
-    *reg = (*reg & ~0x7) | (function & 0x7);
-}
-
-void pin_mode(PinName pin, PinMode mode) {
-    if (pin == (uint32_t)NC) { return; }
-    
-    uint32_t pin_number = (uint32_t)pin;
-    uint32_t drain = ((uint32_t) mode & (uint32_t) OpenDrain) >> 2;
-    
-    __IO uint32_t *reg = (pin_number < 32) ?
-            (__IO uint32_t*)(LPC_IOCON0_BASE + 4 * pin_number) :
-            (__IO uint32_t*)(LPC_IOCON1_BASE + 4 * (pin_number - 32));
-    uint32_t tmp = *reg;
-    
-    // pin mode bits: [4:3] -> 11000 = (0x3 << 3)
-    tmp &= ~(0x3 << 3);
-    tmp |= (mode & 0x3) << 3;
-    
-    // drain
-    tmp &= ~(0x1 << 10);
-    tmp |= drain << 10;
-    
-    *reg = tmp;
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC13XX/port_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "port_api.h"
-#include "pinmap.h"
-#include "gpio_api.h"
-
-PinName port_pin(PortName port, int pin_n) {
-    return (PinName)((port << PORT_SHIFT) | pin_n);
-}
-
-void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
-    obj->port = port;
-    obj->mask = mask;
-    
-    LPC_GPIO->MASK[port] = ~mask;
-    
-    obj->reg_mpin = &LPC_GPIO->MPIN[port];
-    obj->reg_dir = &LPC_GPIO->DIR[port];
-    
-    uint32_t i;
-    // The function is set per pin: reuse gpio logic
-    for (i=0; i<32; i++) {
-        if (obj->mask & (1<<i)) {
-            gpio_set(port_pin(obj->port, i));
-        }
-    }
-    
-    port_dir(obj, dir);
-}
-
-void port_mode(port_t *obj, PinMode mode) {
-    uint32_t i;
-    // The mode is set per pin: reuse pinmap logic
-    for (i=0; i<32; i++) {
-        if (obj->mask & (1<<i)) {
-            pin_mode(port_pin(obj->port, i), mode);
-        }
-    }
-}
-
-void port_dir(port_t *obj, PinDirection dir) {
-    switch (dir) {
-        case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break;
-        case PIN_OUTPUT: *obj->reg_dir |=  obj->mask; break;
-    }
-}
-
-void port_write(port_t *obj, int value) {
-    *obj->reg_mpin = value;
-}
-
-int port_read(port_t *obj) {
-    return (*obj->reg_mpin);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC13XX/pwmout_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,185 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include "pwmout_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-#define TCR_CNT_EN       0x00000001
-#define TCR_RESET        0x00000002
-
-/* To have a PWM where we can change both the period and the duty cycle,
- * we need an entire timer. With the following conventions:
- *   * MR3 is used for the PWM period
- *   * MR0, MR1, MR2 are used for the duty cycle
- */
-static const PinMap PinMap_PWM[] = {
-    /* CT16B0 */
-    {P0_8 , PWM_1, 2}, {P1_13, PWM_1, 2},    /* MR0 */
-    {P0_9 , PWM_2, 2}, {P1_14, PWM_2, 2},   /* MR1 */
-    {P0_10, PWM_3, 3}, {P1_15, PWM_3, 2},   /* MR2 */
-
-    /* CT16B1 */
-    {P0_21, PWM_4, 1},                      /* MR0 */
-    {P0_22, PWM_5, 2}, {P1_23, PWM_5, 1},   /* MR1 */
-
-    /* CT32B0 */
-    {P0_18, PWM_6, 2}, {P1_24, PWM_6, 1},   /* MR0 */
-    {P0_19, PWM_7, 2}, {P1_25, PWM_7, 1},   /* MR1 */
-    {P0_1 , PWM_8, 2}, {P1_26, PWM_8, 1},   /* MR2 */
-
-    /* CT32B1 */
-    {P0_13, PWM_9 , 3}, //{P1_0, PWM_9 , 1},  /* MR0 */
-    {P0_14, PWM_10, 3}, //{P1_1, PWM_10, 1},  /* MR1 */
-    {P0_15, PWM_11, 3}, //{P1_2, PWM_11, 1},  /* MR2 */
-
-    {NC, NC, 0}
-};
-
-typedef struct {
-    uint8_t timer;
-    uint8_t mr;
-} timer_mr;
-
-static timer_mr pwm_timer_map[11] = {
-    {0, 0}, {0, 1}, {0, 2},
-    {1, 0}, {1, 1},
-    {2, 0}, {2, 1}, {2, 2},
-    {3, 0}, {3, 1}, {3, 2},
-};
-
-static LPC_CTxxBx_Type *Timers[4] = {
-    LPC_CT16B0, LPC_CT16B1,
-    LPC_CT32B0, LPC_CT32B1
-};
-
-static unsigned int pwm_clock_mhz;
-
-void pwmout_init(pwmout_t* obj, PinName pin) {
-    // determine the channel
-    PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM);
-    if (pwm == (uint32_t)NC)
-        error("PwmOut pin mapping failed");
-    
-    obj->pwm = pwm;
-    
-    // Timer registers
-    timer_mr tid = pwm_timer_map[pwm];
-    LPC_CTxxBx_Type *timer = Timers[tid.timer];
-    
-    // Disable timer
-    timer->TCR = 0;
-    
-    // Power the correspondent timer
-    LPC_SYSCON->SYSAHBCLKCTRL |= 1 << (tid.timer + 7);
-    
-    /* Enable PWM function */
-    timer->PWMC = (1 << 3)|(1 << 2)|(1 << 1)|(1 << 0);
-    
-    /* Reset Functionality on MR3 controlling the PWM period */
-    timer->MCR = 1 << 10;
-    
-    pwm_clock_mhz = SystemCoreClock / 1000000;
-    
-    // default to 20ms: standard for servos, and fine for e.g. brightness control
-    pwmout_period_ms(obj, 20);
-    pwmout_write    (obj, 0);
-    
-    // Wire pinout
-    pinmap_pinout(pin, PinMap_PWM);
-}
-
-void pwmout_free(pwmout_t* obj) {
-    // [TODO]
-}
-
-void pwmout_write(pwmout_t* obj, float value) {
-    if (value < 0.0f) {
-        value = 0.0;
-    } else if (value > 1.0f) {
-        value = 1.0;
-    }
-    
-    timer_mr tid = pwm_timer_map[obj->pwm];
-    LPC_CTxxBx_Type *timer = Timers[tid.timer];
-    uint32_t t_off = timer->MR3 - (uint32_t)((float)(timer->MR3) * value);
-    
-    timer->TCR = TCR_RESET;
-    timer->MR[tid.mr] = t_off;
-    timer->TCR = TCR_CNT_EN;
-}
-
-float pwmout_read(pwmout_t* obj) {
-    timer_mr tid = pwm_timer_map[obj->pwm];
-    LPC_CTxxBx_Type *timer = Timers[tid.timer];
-    
-    float v = (float)(timer->MR3 - timer->MR[tid.mr]) / (float)(timer->MR3);
-    return (v > 1.0f) ? (1.0f) : (v);
-}
-
-void pwmout_period(pwmout_t* obj, float seconds) {
-    pwmout_period_us(obj, seconds * 1000000.0f);
-}
-
-void pwmout_period_ms(pwmout_t* obj, int ms) {
-    pwmout_period_us(obj, ms * 1000);
-}
-
-// Set the PWM period, keeping the duty cycle the same.
-void pwmout_period_us(pwmout_t* obj, int us) {
-    int i = 0;
-    uint32_t period_ticks = pwm_clock_mhz * us;
-    
-    timer_mr tid = pwm_timer_map[obj->pwm];
-    LPC_CTxxBx_Type *timer = Timers[tid.timer];
-    uint32_t old_period_ticks = timer->MR3;
-    
-    timer->TCR = TCR_RESET;
-    timer->MR3 = period_ticks;
-    
-    // Scale the pulse width to preserve the duty ratio
-    if (old_period_ticks > 0) {
-        for (i=0; i<3; i++) {
-            uint32_t t_off = period_ticks - (uint32_t)(((uint64_t)timer->MR[i] * (uint64_t)period_ticks) / (uint64_t)old_period_ticks);
-            timer->MR[i] = t_off;
-        }
-    }
-    timer->TCR = TCR_CNT_EN;
-}
-
-void pwmout_pulsewidth(pwmout_t* obj, float seconds) {
-    pwmout_pulsewidth_us(obj, seconds * 1000000.0f);
-}
-
-void pwmout_pulsewidth_ms(pwmout_t* obj, int ms) {
-    pwmout_pulsewidth_us(obj, ms * 1000);
-}
-
-void pwmout_pulsewidth_us(pwmout_t* obj, int us) {
-    uint32_t t_on = (uint32_t)(((uint64_t)SystemCoreClock * (uint64_t)us) / (uint64_t)1000000);
-    timer_mr tid = pwm_timer_map[obj->pwm];
-    LPC_CTxxBx_Type *timer = Timers[tid.timer];
-    
-    timer->TCR = TCR_RESET;
-    if (t_on > timer->MR3) {
-        pwmout_period_us(obj, us);
-    }
-    uint32_t t_off = timer->MR3 - t_on;
-    timer->MR[tid.mr] = t_off;
-    timer->TCR = TCR_CNT_EN;
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC13XX/serial_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,277 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// math.h required for floating point operations for baud rate calculation
-#include <math.h>
-#include <string.h>
-
-#include "serial_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-/******************************************************************************
- * INITIALIZATION
- ******************************************************************************/
-#define UART_NUM    1
-
-static const PinMap PinMap_UART_TX[] = {
-    {P0_19, UART_0, 1},
-    {P1_13, UART_0, 3},
-    {P1_27, UART_0, 2},
-    { NC  , NC    , 0}
-};
-
-static const PinMap PinMap_UART_RX[] = {
-    {P0_18, UART_0, 1},
-    {P1_14, UART_0, 3},
-    {P1_26, UART_0, 2},
-    {NC   , NC    , 0}
-};
-
-static uint32_t serial_irq_ids[UART_NUM] = {0};
-static uart_irq_handler irq_handler;
-
-int stdio_uart_inited = 0;
-serial_t stdio_uart;
-
-void serial_init(serial_t *obj, PinName tx, PinName rx) {
-    int is_stdio_uart = 0;
-    
-    // determine the UART to use
-    UARTName uart_tx = (UARTName)pinmap_peripheral(tx, PinMap_UART_TX);
-    UARTName uart_rx = (UARTName)pinmap_peripheral(rx, PinMap_UART_RX);
-    UARTName uart = (UARTName)pinmap_merge(uart_tx, uart_rx);
-    if ((int)uart == NC) {
-        error("Serial pinout mapping failed");
-    }
-    
-    obj->uart = (LPC_USART_Type *)uart;
-    LPC_SYSCON->SYSAHBCLKCTRL |= (1<<12);
-    
-    // [TODO] Consider more elegant approach
-    // disconnect USBTX/RX mapping mux, for case when switching ports
-    //pin_function(USBTX, 0);
-    //pin_function(USBRX, 0);
-    
-    // enable fifos and default rx trigger level
-    obj->uart->FCR = 1 << 0  // FIFO Enable - 0 = Disables, 1 = Enabled
-                   | 0 << 1  // Rx Fifo Reset
-                   | 0 << 2  // Tx Fifo Reset
-                   | 0 << 6; // Rx irq trigger level - 0 = 1 char, 1 = 4 chars, 2 = 8 chars, 3 = 14 chars
-    
-    // disable irqs
-    obj->uart->IER = 0 << 0  // Rx Data available irq enable
-                   | 0 << 1  // Tx Fifo empty irq enable
-                   | 0 << 2; // Rx Line Status irq enable
-    
-    // set default baud rate and format
-    serial_baud  (obj, 9600);
-    serial_format(obj, 8, ParityNone, 1);
-    
-    // pinout the chosen uart
-    pinmap_pinout(tx, PinMap_UART_TX);
-    pinmap_pinout(rx, PinMap_UART_RX);
-    
-    // set rx/tx pins in PullUp mode
-    pin_mode(tx, PullUp);
-    pin_mode(rx, PullUp);
-    
-    switch (uart) {
-        case UART_0: obj->index = 0; break;
-    }
-    
-    is_stdio_uart = (uart == STDIO_UART) ? (1) : (0);
-    
-    if (is_stdio_uart) {
-        stdio_uart_inited = 1;
-        memcpy(&stdio_uart, obj, sizeof(serial_t));
-    }
-}
-
-void serial_free(serial_t *obj) {
-    serial_irq_ids[obj->index] = 0;
-}
-
-// serial_baud
-// set the baud rate, taking in to account the current SystemFrequency
-void serial_baud(serial_t *obj, int baudrate) {
-    LPC_SYSCON->UARTCLKDIV = 0x1;
-    uint32_t PCLK = SystemCoreClock;
-    // First we check to see if the basic divide with no DivAddVal/MulVal
-    // ratio gives us an integer result. If it does, we set DivAddVal = 0,
-    // MulVal = 1. Otherwise, we search the valid ratio value range to find
-    // the closest match. This could be more elegant, using search methods
-    // and/or lookup tables, but the brute force method is not that much
-    // slower, and is more maintainable.
-    uint16_t DL = PCLK / (16 * baudrate);
-    
-    uint8_t DivAddVal = 0;
-    uint8_t MulVal = 1;
-    int hit = 0;
-    uint16_t dlv;
-    uint8_t mv, dav;
-    if ((PCLK % (16 * baudrate)) != 0) {     // Checking for zero remainder
-        float err_best = (float) baudrate;
-        uint16_t dlmax = DL;
-        for ( dlv = (dlmax/2); (dlv <= dlmax) && !hit; dlv++) {
-            for ( mv = 1; mv <= 15; mv++) {
-                for ( dav = 1; dav < mv; dav++) {
-                    float ratio = 1.0f + ((float) dav / (float) mv);
-                    float calcbaud = (float)PCLK / (16.0f * (float) dlv * ratio);
-                    float err = fabs(((float) baudrate - calcbaud) / (float) baudrate);
-                    if (err < err_best) {
-                        DL = dlv;
-                        DivAddVal = dav;
-                        MulVal = mv;
-                        err_best = err;
-                        if (err < 0.001f) {
-                            hit = 1;
-                        }
-                    }
-                }
-            }
-        }
-    }
-    
-    // set LCR[DLAB] to enable writing to divider registers
-    obj->uart->LCR |= (1 << 7);
-    
-    // set divider values
-    obj->uart->DLM = (DL >> 8) & 0xFF;
-    obj->uart->DLL = (DL >> 0) & 0xFF;
-    obj->uart->FDR = (uint32_t) DivAddVal << 0
-                   | (uint32_t) MulVal    << 4;
-    
-    // clear LCR[DLAB]
-    obj->uart->LCR &= ~(1 << 7);
-}
-
-void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits) {
-    // 0: 1 stop bits, 1: 2 stop bits
-    if (stop_bits != 1 && stop_bits != 2) {
-        error("Invalid stop bits specified");
-    }
-    stop_bits -= 1;
-    
-    // 0: 5 data bits ... 3: 8 data bits
-    if (data_bits < 5 || data_bits > 8) {
-        error("Invalid number of bits (%d) in serial format, should be 5..8", data_bits);
-    }
-    data_bits -= 5;
-
-    int parity_enable, parity_select;
-    switch (parity) {
-        case ParityNone: parity_enable = 0; parity_select = 0; break;
-        case ParityOdd : parity_enable = 1; parity_select = 0; break;
-        case ParityEven: parity_enable = 1; parity_select = 1; break;
-        case ParityForced1: parity_enable = 1; parity_select = 2; break;
-        case ParityForced0: parity_enable = 1; parity_select = 3; break;
-        default:
-            error("Invalid serial parity setting");
-            return;
-    }
-    
-    obj->uart->LCR = data_bits            << 0
-                   | stop_bits            << 2
-                   | parity_enable        << 3
-                   | parity_select        << 4;
-}
-
-/******************************************************************************
- * INTERRUPTS HANDLING
- ******************************************************************************/
-static inline void uart_irq(uint32_t iir, uint32_t index) {
-    // [Chapter 14] LPC17xx UART0/2/3: UARTn Interrupt Handling
-    SerialIrq irq_type;
-    switch (iir) {
-        case 1: irq_type = TxIrq; break;
-        case 2: irq_type = RxIrq; break;
-        default: return;
-    }
-    
-    if (serial_irq_ids[index] != 0)
-        irq_handler(serial_irq_ids[index], irq_type);
-}
-
-void uart0_irq() {uart_irq((LPC_USART->IIR >> 1) & 0x7, 0);}
-
-void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id) {
-    irq_handler = handler;
-    serial_irq_ids[obj->index] = id;
-}
-
-void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) {
-    IRQn_Type irq_n = (IRQn_Type)0;
-    uint32_t vector = 0;
-    switch ((int)obj->uart) {
-        case UART_0: irq_n=USART_IRQn ; vector = (uint32_t)&uart0_irq; break;
-    }
-    
-    if (enable) {
-        obj->uart->IER |= 1 << irq;
-        NVIC_SetVector(irq_n, vector);
-        NVIC_EnableIRQ(irq_n);
-    } else { // disable
-        int all_disabled = 0;
-        SerialIrq other_irq = (irq == RxIrq) ? (TxIrq) : (RxIrq);
-
-        obj->uart->IER &= ~(1 << irq);
-        all_disabled = (obj->uart->IER & (1 << other_irq)) == 0;
-        
-        if (all_disabled)
-            NVIC_DisableIRQ(irq_n);
-    }
-}
-
-/******************************************************************************
- * READ/WRITE
- ******************************************************************************/
-int serial_getc(serial_t *obj) {
-    while (!serial_readable(obj));
-    return obj->uart->RBR;
-}
-
-void serial_putc(serial_t *obj, int c) {
-    while (!serial_writable(obj));
-    obj->uart->THR = c;
-}
-
-int serial_readable(serial_t *obj) {
-    return obj->uart->LSR & 0x01;
-}
-
-int serial_writable(serial_t *obj) {
-    return obj->uart->LSR & 0x20;
-}
-
-void serial_clear(serial_t *obj) {
-    obj->uart->FCR = 1 << 1  // rx FIFO reset
-                   | 1 << 2  // tx FIFO reset
-                   | 0 << 6; // interrupt depth
-}
-
-void serial_pinout_tx(PinName tx) {
-    pinmap_pinout(tx, PinMap_UART_TX);
-}
-
-void serial_break_set(serial_t *obj) {
-    obj->uart->LCR |= (1 << 6);
-}
-
-void serial_break_clear(serial_t *obj) {
-    obj->uart->LCR &= ~(1 << 6);
-}
-
--- a/targets/hal/TARGET_NXP/TARGET_LPC13XX/sleep.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "sleep_api.h"
-#include "cmsis.h"
-#include "mbed_interface.h"
-
-void sleep(void) {
-    // PCON[PD] set to sleep
-    LPC_PMU->PCON = 0x0;
-    
-    // SRC[SLEEPDEEP] set to 0 = sleep
-    SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk;
-    
-    // wait for interrupt
-    __WFI();
-}
-
-void deepsleep(void) {
-    // PCON[PD] set to deepsleep
-    LPC_PMU->PCON = 0x1;
-    
-    // SRC[SLEEPDEEP] set to 1 = deep sleep
-    SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
-    
-    // Power up everything after powerdown
-    LPC_SYSCON->PDAWAKECFG &= 0xFFFFF800;
-    
-    // wait for interrupt
-    __WFI();
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC13XX/spi_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,218 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <math.h>
-#include "spi_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_SPI_SCLK[] = {
-    {P0_6 , SPI_0, 0x02},
-    {P0_10, SPI_0, 0x02},
-    {P1_29, SPI_0, 0x01},
-    {P1_15, SPI_1, 0x03},
-    {P1_20, SPI_1, 0x02},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_MOSI[] = {
-    {P0_9 , SPI_0, 0x01},
-    {P0_21, SPI_1, 0x02},
-    {P1_22, SPI_1, 0x02},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_MISO[] = {
-    {P0_8 , SPI_0, 0x01},
-    {P0_22, SPI_1, 0x03},
-    {P1_21, SPI_1, 0x02},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_SSEL[] = {
-    {P0_2 , SPI_0, 0x01},
-    {P1_19, SPI_1, 0x02},
-    {P1_23, SPI_1, 0x02},
-    {NC   , NC   , 0}
-};
-
-static inline int ssp_disable(spi_t *obj);
-static inline int ssp_enable(spi_t *obj);
-
-void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel) {
-    // determine the SPI to use
-    SPIName spi_mosi = (SPIName)pinmap_peripheral(mosi, PinMap_SPI_MOSI);
-    SPIName spi_miso = (SPIName)pinmap_peripheral(miso, PinMap_SPI_MISO);
-    SPIName spi_sclk = (SPIName)pinmap_peripheral(sclk, PinMap_SPI_SCLK);
-    SPIName spi_ssel = (SPIName)pinmap_peripheral(ssel, PinMap_SPI_SSEL);
-    SPIName spi_data = (SPIName)pinmap_merge(spi_mosi, spi_miso);
-    SPIName spi_cntl = (SPIName)pinmap_merge(spi_sclk, spi_ssel);
-    
-    obj->spi = (LPC_SSPx_Type*)pinmap_merge(spi_data, spi_cntl);
-    
-    if ((int)obj->spi == NC) {
-        error("SPI pinout mapping failed");
-    }
-    
-    // enable power and clocking
-    switch ((int)obj->spi) {
-        case SPI_0:
-            LPC_SYSCON->SYSAHBCLKCTRL |= 1 << 11;
-            LPC_SYSCON->SSP0CLKDIV = 0x01;
-            LPC_SYSCON->PRESETCTRL |= 1 << 0;
-            break;
-        case SPI_1:
-            LPC_SYSCON->SYSAHBCLKCTRL |= 1 << 18;
-            LPC_SYSCON->SSP1CLKDIV = 0x01;
-            LPC_SYSCON->PRESETCTRL |= 1 << 2;
-            break;
-    }
-    
-    // set default format and frequency
-    if (ssel == NC) {
-        spi_format(obj, 8, 0, 0);  // 8 bits, mode 0, master
-    } else {
-        spi_format(obj, 8, 0, 1);  // 8 bits, mode 0, slave
-    }
-    spi_frequency(obj, 1000000);
-    
-    // enable the ssp channel
-    ssp_enable(obj);
-    
-    // pin out the spi pins
-    pinmap_pinout(mosi, PinMap_SPI_MOSI);
-    pinmap_pinout(miso, PinMap_SPI_MISO);
-    pinmap_pinout(sclk, PinMap_SPI_SCLK);
-    if (ssel != NC) {
-        pinmap_pinout(ssel, PinMap_SPI_SSEL);
-    }
-}
-
-void spi_free(spi_t *obj) {}
-
-void spi_format(spi_t *obj, int bits, int mode, int slave) {
-    ssp_disable(obj);
-    
-    if (!(bits >= 4 && bits <= 16) || !(mode >= 0 && mode <= 3)) {
-        error("SPI format error");
-    }
-    
-    int polarity = (mode & 0x2) ? 1 : 0;
-    int phase = (mode & 0x1) ? 1 : 0;
-    
-    // set it up
-    int DSS = bits - 1;            // DSS (data select size)
-    int SPO = (polarity) ? 1 : 0;  // SPO - clock out polarity
-    int SPH = (phase) ? 1 : 0;     // SPH - clock out phase
-    
-    int FRF = 0;                   // FRF (frame format) = SPI
-    uint32_t tmp = obj->spi->CR0;
-    tmp &= ~(0xFFFF);
-    tmp |= DSS << 0
-        | FRF << 4
-        | SPO << 6
-        | SPH << 7;
-    obj->spi->CR0 = tmp;
-    
-    tmp = obj->spi->CR1;
-    tmp &= ~(0xD);
-    tmp |= 0 << 0                   // LBM - loop back mode - off
-        | ((slave) ? 1 : 0) << 2   // MS - master slave mode, 1 = slave
-        | 0 << 3;                  // SOD - slave output disable - na
-    obj->spi->CR1 = tmp;
-    
-    ssp_enable(obj);
-}
-
-void spi_frequency(spi_t *obj, int hz) {
-    ssp_disable(obj);
-    
-    uint32_t PCLK = SystemCoreClock;
-    
-    int prescaler;
-    
-    for (prescaler = 2; prescaler <= 254; prescaler += 2) {
-        int prescale_hz = PCLK / prescaler;
-        
-        // calculate the divider
-        int divider = floor(((float)prescale_hz / (float)hz) + 0.5f);
-        
-        // check we can support the divider
-        if (divider < 256) {
-            // prescaler
-            obj->spi->CPSR = prescaler;
-            
-            // divider
-            obj->spi->CR0 &= ~(0xFFFF << 8);
-            obj->spi->CR0 |= (divider - 1) << 8;
-            ssp_enable(obj);
-            return;
-        }
-    }
-    error("Couldn't setup requested SPI frequency");
-}
-
-static inline int ssp_disable(spi_t *obj) {
-    return obj->spi->CR1 &= ~(1 << 1);
-}
-
-static inline int ssp_enable(spi_t *obj) {
-    return obj->spi->CR1 |= (1 << 1);
-}
-
-static inline int ssp_readable(spi_t *obj) {
-    return obj->spi->SR & (1 << 2);
-}
-
-static inline int ssp_writeable(spi_t *obj) {
-    return obj->spi->SR & (1 << 1);
-}
-
-static inline void ssp_write(spi_t *obj, int value) {
-    while (!ssp_writeable(obj));
-    obj->spi->DR = value;
-}
-
-static inline int ssp_read(spi_t *obj) {
-    while (!ssp_readable(obj));
-    return obj->spi->DR;
-}
-
-static inline int ssp_busy(spi_t *obj) {
-    return (obj->spi->SR & (1 << 4)) ? (1) : (0);
-}
-
-int spi_master_write(spi_t *obj, int value) {
-    ssp_write(obj, value);
-    return ssp_read(obj);
-}
-
-int spi_slave_receive(spi_t *obj) {
-    return (ssp_readable(obj) && !ssp_busy(obj)) ? (1) : (0);
-};
-
-int spi_slave_read(spi_t *obj) {
-    return obj->spi->DR;
-}
-
-void spi_slave_write(spi_t *obj, int value) {
-    while (ssp_writeable(obj) == 0) ;
-    obj->spi->DR = value;
-}
-
-int spi_busy(spi_t *obj) {
-    return ssp_busy(obj);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC13XX/us_ticker.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stddef.h>
-#include "us_ticker_api.h"
-#include "PeripheralNames.h"
-
-#define US_TICKER_TIMER          ((LPC_CT32B1_Type *)LPC_CT32B1_BASE)
-#define US_TICKER_TIMER_IRQn     CT32B1_IRQn
-
-int us_ticker_inited = 0;
-
-void us_ticker_init(void) {
-    if (us_ticker_inited) return;
-    us_ticker_inited = 1;
-    
-    LPC_SYSCON->SYSAHBCLKCTRL |= (1<<10); // Clock TIMER_1
-    uint32_t PCLK = SystemCoreClock;
-    
-    US_TICKER_TIMER->TCR = 0x2;  // reset
-    
-    uint32_t prescale = PCLK / 1000000; // default to 1MHz (1 us ticks)
-    US_TICKER_TIMER->PR = prescale - 1;
-    US_TICKER_TIMER->TCR = 1; // enable = 1, reset = 0
-    
-    NVIC_SetVector(US_TICKER_TIMER_IRQn, (uint32_t)us_ticker_irq_handler);
-    NVIC_EnableIRQ(US_TICKER_TIMER_IRQn);
-}
-
-uint32_t us_ticker_read() {
-    if (!us_ticker_inited)
-        us_ticker_init();
-    
-    return US_TICKER_TIMER->TC;
-}
-
-void us_ticker_set_interrupt(unsigned int timestamp) {
-    // set match value
-    US_TICKER_TIMER->MR0 = timestamp;
-    // enable match interrupt
-    US_TICKER_TIMER->MCR |= 1;
-}
-
-void us_ticker_disable_interrupt(void) {
-    US_TICKER_TIMER->MCR &= ~1;
-}
-
-void us_ticker_clear_interrupt(void) {
-    US_TICKER_TIMER->IR = 1;
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/PeripheralNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    UART_0 = (int)LPC_UART0_BASE,
-    UART_1 = (int)LPC_UART1_BASE,
-    UART_2 = (int)LPC_UART2_BASE,
-    UART_3 = (int)LPC_UART3_BASE
-} UARTName;
-
-typedef enum {
-    ADC0_0 = 0,
-    ADC0_1,
-    ADC0_2,
-    ADC0_3,
-    ADC0_4,
-    ADC0_5,
-    ADC0_6,
-    ADC0_7
-} ADCName;
-
-typedef enum {
-    DAC_0 = 0
-} DACName;
-
-typedef enum {
-    SPI_0 = (int)LPC_SSP0_BASE,
-    SPI_1 = (int)LPC_SSP1_BASE
-} SPIName;
-
-typedef enum {
-    I2C_0 = (int)LPC_I2C0_BASE,
-    I2C_1 = (int)LPC_I2C1_BASE,
-    I2C_2 = (int)LPC_I2C2_BASE
-} I2CName;
-
-typedef enum {
-    PWM_1 = 1,
-    PWM_2,
-    PWM_3,
-    PWM_4,
-    PWM_5,
-    PWM_6
-} PWMName;
-
-typedef enum {
-     CAN_1 = (int)LPC_CAN1_BASE,
-     CAN_2 = (int)LPC_CAN2_BASE
-} CANName;
-
-#define STDIO_UART_TX     USBTX
-#define STDIO_UART_RX     USBRX
-#define STDIO_UART        UART_0
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/PinNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PINNAMES_H
-#define MBED_PINNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    PIN_INPUT,
-    PIN_OUTPUT
-} PinDirection;
-
-#define PORT_SHIFT  5
-
-typedef enum {
-    // LPC Pin Names
-    P0_0 = LPC_GPIO0_BASE,
-          P0_1, P0_2, P0_3, P0_4, P0_5, P0_6, P0_7, P0_8, P0_9, P0_10, P0_11, P0_12, P0_13, P0_14, P0_15, P0_16, P0_17, P0_18, P0_19, P0_20, P0_21, P0_22, P0_23, P0_24, P0_25, P0_26, P0_27, P0_28, P0_29, P0_30, P0_31,
-    P1_0, P1_1, P1_2, P1_3, P1_4, P1_5, P1_6, P1_7, P1_8, P1_9, P1_10, P1_11, P1_12, P1_13, P1_14, P1_15, P1_16, P1_17, P1_18, P1_19, P1_20, P1_21, P1_22, P1_23, P1_24, P1_25, P1_26, P1_27, P1_28, P1_29, P1_30, P1_31,
-    P2_0, P2_1, P2_2, P2_3, P2_4, P2_5, P2_6, P2_7, P2_8, P2_9, P2_10, P2_11, P2_12, P2_13, P2_14, P2_15, P2_16, P2_17, P2_18, P2_19, P2_20, P2_21, P2_22, P2_23, P2_24, P2_25, P2_26, P2_27, P2_28, P2_29, P2_30, P2_31,
-    P3_0, P3_1, P3_2, P3_3, P3_4, P3_5, P3_6, P3_7, P3_8, P3_9, P3_10, P3_11, P3_12, P3_13, P3_14, P3_15, P3_16, P3_17, P3_18, P3_19, P3_20, P3_21, P3_22, P3_23, P3_24, P3_25, P3_26, P3_27, P3_28, P3_29, P3_30, P3_31,
-    P4_0, P4_1, P4_2, P4_3, P4_4, P4_5, P4_6, P4_7, P4_8, P4_9, P4_10, P4_11, P4_12, P4_13, P4_14, P4_15, P4_16, P4_17, P4_18, P4_19, P4_20, P4_21, P4_22, P4_23, P4_24, P4_25, P4_26, P4_27, P4_28, P4_29, P4_30, P4_31,
-
-    // mbed DIP Pin Names
-    p5 = P0_9,
-    p6 = P0_8,
-    p7 = P0_7,
-    p8 = P0_6,
-    p9 = P0_0,
-    p10 = P0_1,
-    p11 = P0_18,
-    p12 = P0_17,
-    p13 = P0_15,
-    p14 = P0_16,
-    p15 = P0_23,
-    p16 = P0_24,
-    p17 = P0_25,
-    p18 = P0_26,
-    p19 = P1_30,
-    p20 = P1_31,
-    p21 = P2_5,
-    p22 = P2_4,
-    p23 = P2_3,
-    p24 = P2_2,
-    p25 = P2_1,
-    p26 = P2_0,
-    p27 = P0_11,
-    p28 = P0_10,
-    p29 = P0_5,
-    p30 = P0_4,
-
-    // Other mbed Pin Names
-#ifdef MCB1700
-    LED1 = P1_28,
-    LED2 = P1_29,
-    LED3 = P1_31,
-    LED4 = P2_2,
-#else
-    LED1 = P1_18,
-    LED2 = P1_20,
-    LED3 = P1_21,
-    LED4 = P1_23,
-#endif
-    USBTX = P0_2,
-    USBRX = P0_3,
-
-    // Not connected
-    NC = (int)0xFFFFFFFF
-} PinName;
-
-typedef enum {
-    PullUp = 0,
-    PullDown = 3,
-    PullNone = 2,
-    OpenDrain = 4
-} PinMode;
-
-// version of PINCON_TypeDef using register arrays
-typedef struct {
-  __IO uint32_t PINSEL[11];
-       uint32_t RESERVED0[5];
-  __IO uint32_t PINMODE[10];
-  __IO uint32_t PINMODE_OD[5];
-} PINCONARRAY_TypeDef;
-
-#define PINCONARRAY ((PINCONARRAY_TypeDef *)LPC_PINCON_BASE)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/PortNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PORTNAMES_H
-#define MBED_PORTNAMES_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    Port0 = 0,
-    Port1 = 1,
-    Port2 = 2,
-    Port3 = 3,
-    Port4 = 4
-} PortName;
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/analogin_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "analogin_api.h"
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-#define ANALOGIN_MEDIAN_FILTER      1
-
-#define ADC_10BIT_RANGE             0x3FF
-#define ADC_12BIT_RANGE             0xFFF
-
-static inline int div_round_up(int x, int y) {
-  return (x + (y - 1)) / y;
-}
-
-static const PinMap PinMap_ADC[] = {
-    {P0_23, ADC0_0, 1},
-    {P0_24, ADC0_1, 1},
-    {P0_25, ADC0_2, 1},
-    {P0_26, ADC0_3, 1},
-    {P1_30, ADC0_4, 3},
-    {P1_31, ADC0_5, 3},
-    {P0_2,  ADC0_7, 2},
-    {P0_3,  ADC0_6, 2},
-    {NC,    NC,     0}
-};
-
-#define ADC_RANGE    ADC_12BIT_RANGE
-
-void analogin_init(analogin_t *obj, PinName pin) {
-    obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
-    if (obj->adc == (ADCName)NC) {
-        error("ADC pin mapping failed");
-    }
-    
-    // ensure power is turned on
-    LPC_SC->PCONP |= (1 << 12);
-    
-    // set PCLK of ADC to /1
-    LPC_SC->PCLKSEL0 &= ~(0x3 << 24);
-    LPC_SC->PCLKSEL0 |= (0x1 << 24);
-    uint32_t PCLK = SystemCoreClock;
-    
-    // calculate minimum clock divider
-    //  clkdiv = divider - 1
-    uint32_t MAX_ADC_CLK = 13000000;
-    uint32_t clkdiv = div_round_up(PCLK, MAX_ADC_CLK) - 1;
-    
-    // Set the generic software-controlled ADC settings
-    LPC_ADC->ADCR = (0 << 0)      // SEL: 0 = no channels selected
-                  | (clkdiv << 8) // CLKDIV: PCLK max ~= 25MHz, /25 to give safe 1MHz at fastest
-                  | (0 << 16)     // BURST: 0 = software control
-                  | (0 << 17)     // CLKS: not applicable
-                  | (1 << 21)     // PDN: 1 = operational
-                  | (0 << 24)     // START: 0 = no start
-                  | (0 << 27);    // EDGE: not applicable
-    
-    pinmap_pinout(pin, PinMap_ADC);
-}
-
-static inline uint32_t adc_read(analogin_t *obj) {
-    // Select the appropriate channel and start conversion
-    LPC_ADC->ADCR &= ~0xFF;
-    LPC_ADC->ADCR |= 1 << (int)obj->adc;
-    LPC_ADC->ADCR |= 1 << 24;
-    
-    // Repeatedly get the sample data until DONE bit
-    unsigned int data;
-    do {
-        data = LPC_ADC->ADGDR;
-    } while ((data & ((unsigned int)1 << 31)) == 0);
-    
-    // Stop conversion
-    LPC_ADC->ADCR &= ~(1 << 24);
-    
-    return (data >> 4) & ADC_RANGE; // 12 bit
-}
-
-static inline void order(uint32_t *a, uint32_t *b) {
-    if (*a > *b) {
-        uint32_t t = *a;
-        *a = *b;
-        *b = t;
-    }
-}
-
-static inline uint32_t adc_read_u32(analogin_t *obj) {
-    uint32_t value;
-#if ANALOGIN_MEDIAN_FILTER
-    uint32_t v1 = adc_read(obj);
-    uint32_t v2 = adc_read(obj);
-    uint32_t v3 = adc_read(obj);
-    order(&v1, &v2);
-    order(&v2, &v3);
-    order(&v1, &v2);
-    value = v2;
-#else
-    value = adc_read(obj);
-#endif
-    return value;
-}
-
-uint16_t analogin_read_u16(analogin_t *obj) {
-    uint32_t value = adc_read_u32(obj);
-    
-    return (value << 4) | ((value >> 8) & 0x000F); // 12 bit
-}
-
-float analogin_read(analogin_t *obj) {
-    uint32_t value = adc_read_u32(obj);
-    return (float)value * (1.0f / (float)ADC_RANGE);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/analogout_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "analogout_api.h"
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_DAC[] = {
-    {P0_26, DAC_0, 2},
-    {NC   , NC   , 0}
-};
-
-void analogout_init(dac_t *obj, PinName pin) {
-    obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
-    if (obj->dac == (DACName)NC) {
-        error("DAC pin mapping failed");
-    }
-    
-    // power is on by default, set DAC clk divider is /4
-    LPC_SC->PCLKSEL0 &= ~(0x3 << 22);
-    
-    // map out (must be done before accessing registers)
-    pinmap_pinout(pin, PinMap_DAC);
-    
-    analogout_write_u16(obj, 0);
-}
-
-void analogout_free(dac_t *obj) {}
-
-static inline void dac_write(int value) {
-    value &= 0x3FF; // 10-bit
-    
-    // Set the DAC output
-    LPC_DAC->DACR = (0 << 16)       // bias = 0
-                  | (value << 6);
-}
-
-static inline int dac_read() {
-    return (LPC_DAC->DACR >> 6) & 0x3FF;
-}
-
-void analogout_write(dac_t *obj, float value) {
-    if (value < 0.0f) {
-        dac_write(0);
-    } else if (value > 1.0f) {
-        dac_write(0x3FF);
-    } else {
-        dac_write(value * (float)0x3FF);
-    }
-}
-
-void analogout_write_u16(dac_t *obj, uint16_t value) {
-    dac_write(value >> 6); // 10-bit
-}
-
-float analogout_read(dac_t *obj) {
-    uint32_t value = dac_read();
-    return (float)value * (1.0f / (float)0x3FF);
-}
-
-uint16_t analogout_read_u16(dac_t *obj) {
-    uint32_t value = dac_read(); // 10-bit
-    return (value << 6) | ((value >> 4) & 0x003F);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/can_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,408 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "can_api.h"
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-#include <math.h>
-#include <string.h>
-
-#define CAN_NUM    2
-
-/* Acceptance filter mode in AFMR register */
-#define ACCF_OFF                0x01
-#define ACCF_BYPASS             0x02
-#define ACCF_ON                 0x00
-#define ACCF_FULLCAN            0x04
-
-/* There are several bit timing calculators on the internet.
-http://www.port.de/engl/canprod/sv_req_form.html
-http://www.kvaser.com/can/index.htm
-*/
-
-static const PinMap PinMap_CAN_RD[] = {
-    {P0_0 , CAN_1, 1},
-    {P0_4 , CAN_2, 2},
-    {P0_21, CAN_1, 3},
-    {P2_7 , CAN_2, 1},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_CAN_TD[] = {
-    {P0_1 , CAN_1, 1},
-    {P0_5 , CAN_2, 2},
-    {P0_22, CAN_1, 3},
-    {P2_8 , CAN_2, 1},
-    {NC   , NC   , 0}
-};
-
-// Type definition to hold a CAN message
-struct CANMsg {
-    unsigned int  reserved1 : 16;
-    unsigned int  dlc       :  4; // Bits 16..19: DLC - Data Length Counter
-    unsigned int  reserved0 : 10;
-    unsigned int  rtr       :  1; // Bit 30: Set if this is a RTR message
-    unsigned int  type      :  1; // Bit 31: Set if this is a 29-bit ID message
-    unsigned int  id;             // CAN Message ID (11-bit or 29-bit)
-    unsigned char data[8];        // CAN Message Data Bytes 0-7
-};
-typedef struct CANMsg CANMsg;
-
-static uint32_t can_irq_ids[CAN_NUM] = {0};
-static can_irq_handler irq_handler;
-
-static uint32_t can_disable(can_t *obj) {
-    uint32_t sm = obj->dev->MOD;
-    obj->dev->MOD |= 1;
-    return sm;
-}
-
-static inline void can_enable(can_t *obj) {
-    if (obj->dev->MOD & 1) {
-        obj->dev->MOD &= ~(1);
-    }
-}
-
-int can_mode(can_t *obj, CanMode mode) {
-    return 0; // not implemented
-}
-
-int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t handle) {
-    return 0; // not implemented
-}
-
-static inline void can_irq(uint32_t icr, uint32_t index) {
-    uint32_t i;
-    
-    for(i = 0; i < 8; i++)
-    {
-        if((can_irq_ids[index] != 0) && (icr & (1 << i)))
-        {
-            switch (i) {
-                case 0: irq_handler(can_irq_ids[index], IRQ_RX);      break;
-                case 1: irq_handler(can_irq_ids[index], IRQ_TX);      break;
-                case 2: irq_handler(can_irq_ids[index], IRQ_ERROR);   break;
-                case 3: irq_handler(can_irq_ids[index], IRQ_OVERRUN); break;
-                case 4: irq_handler(can_irq_ids[index], IRQ_WAKEUP);  break;
-                case 5: irq_handler(can_irq_ids[index], IRQ_PASSIVE); break;
-                case 6: irq_handler(can_irq_ids[index], IRQ_ARB);     break;
-                case 7: irq_handler(can_irq_ids[index], IRQ_BUS);     break;
-                case 8: irq_handler(can_irq_ids[index], IRQ_READY);   break;
-            }
-        }
-    }
-}
-
-// Have to check that the CAN block is active before reading the Interrupt
-// Control Register, or the mbed hangs
-void can_irq_n() {
-    uint32_t icr;
-
-    if(LPC_SC->PCONP & (1 << 13)) {
-        icr = LPC_CAN1->ICR & 0x1FF;
-        can_irq(icr, 0);
-    }
-
-    if(LPC_SC->PCONP & (1 << 14)) {
-        icr = LPC_CAN2->ICR & 0x1FF;
-        can_irq(icr, 1);
-    }
-}
-
-// Register CAN object's irq handler
-void can_irq_init(can_t *obj, can_irq_handler handler, uint32_t id) {
-    irq_handler = handler;
-    can_irq_ids[obj->index] = id;
-}
-
-// Unregister CAN object's irq handler
-void can_irq_free(can_t *obj) {
-    obj->dev->IER &= ~(1);
-    can_irq_ids[obj->index] = 0;
-
-    if ((can_irq_ids[0] == 0) && (can_irq_ids[1] == 0)) {
-        NVIC_DisableIRQ(CAN_IRQn);
-    }
-}
-
-// Clear or set a irq
-void can_irq_set(can_t *obj, CanIrqType type, uint32_t enable) {
-    uint32_t ier;
-    
-    switch (type) {
-        case IRQ_RX:      ier = (1 << 0); break;
-        case IRQ_TX:      ier = (1 << 1); break;
-        case IRQ_ERROR:   ier = (1 << 2); break;
-        case IRQ_OVERRUN: ier = (1 << 3); break;
-        case IRQ_WAKEUP:  ier = (1 << 4); break;
-        case IRQ_PASSIVE: ier = (1 << 5); break;
-        case IRQ_ARB:     ier = (1 << 6); break;
-        case IRQ_BUS:     ier = (1 << 7); break;
-        case IRQ_READY:   ier = (1 << 8); break;
-        default: return;
-    }
-    
-    obj->dev->MOD |= 1;
-    if(enable == 0) {
-        obj->dev->IER &= ~ier;
-    }
-    else {
-        obj->dev->IER |= ier;
-    }
-    obj->dev->MOD &= ~(1);
-    
-    // Enable NVIC if at least 1 interrupt is active
-    if(((LPC_SC->PCONP & (1 << 13)) && LPC_CAN1->IER) || ((LPC_SC->PCONP & (1 << 14)) && LPC_CAN2->IER)) {
-        NVIC_SetVector(CAN_IRQn, (uint32_t) &can_irq_n);
-        NVIC_EnableIRQ(CAN_IRQn);
-    }
-    else {
-        NVIC_DisableIRQ(CAN_IRQn);
-    }
-}
-
-static int can_pclk(can_t *obj) {
-    int value = 0;
-    switch ((int)obj->dev) {
-        case CAN_1: value = (LPC_SC->PCLKSEL0 & (0x3 << 26)) >> 26; break;
-        case CAN_2: value = (LPC_SC->PCLKSEL0 & (0x3 << 28)) >> 28; break;
-    }
-
-    switch (value) {
-        case 1: return 1;
-        case 2: return 2;
-        case 3: return 6;
-        default: return 4;
-    }
-}
-
-// This table has the sampling points as close to 75% as possible. The first
-// value is TSEG1, the second TSEG2.
-static const int timing_pts[23][2] = {
-    {0x0, 0x0},      // 2,  50%
-    {0x1, 0x0},      // 3,  67%
-    {0x2, 0x0},      // 4,  75%
-    {0x3, 0x0},      // 5,  80%
-    {0x3, 0x1},      // 6,  67%
-    {0x4, 0x1},      // 7,  71%
-    {0x5, 0x1},      // 8,  75%
-    {0x6, 0x1},      // 9,  78%
-    {0x6, 0x2},      // 10, 70%
-    {0x7, 0x2},      // 11, 73%
-    {0x8, 0x2},      // 12, 75%
-    {0x9, 0x2},      // 13, 77%
-    {0x9, 0x3},      // 14, 71%
-    {0xA, 0x3},      // 15, 73%
-    {0xB, 0x3},      // 16, 75%
-    {0xC, 0x3},      // 17, 76%
-    {0xD, 0x3},      // 18, 78%
-    {0xD, 0x4},      // 19, 74%
-    {0xE, 0x4},      // 20, 75%
-    {0xF, 0x4},      // 21, 76%
-    {0xF, 0x5},      // 22, 73%
-    {0xF, 0x6},      // 23, 70%
-    {0xF, 0x7},      // 24, 67%
-};
-
-static unsigned int can_speed(unsigned int sclk, unsigned int pclk, unsigned int cclk, unsigned char psjw) {
-    uint32_t    btr;
-    uint16_t    brp = 0;
-    uint32_t    calcbit;
-    uint32_t    bitwidth;
-    int         hit = 0;
-    int         bits;
-    
-    bitwidth = sclk / (pclk * cclk);
-    
-    brp = bitwidth / 0x18;
-    while ((!hit) && (brp < bitwidth / 4)) {
-        brp++;
-        for (bits = 22; bits > 0; bits--) {
-            calcbit = (bits + 3) * (brp + 1);
-            if (calcbit == bitwidth) {
-                hit = 1;
-                break;
-            }
-        }
-    }
-    
-    if (hit) {
-        btr = ((timing_pts[bits][1] << 20) & 0x00700000)
-            | ((timing_pts[bits][0] << 16) & 0x000F0000)
-            | ((psjw                << 14) & 0x0000C000)
-            | ((brp                 <<  0) & 0x000003FF);
-    } else {
-        btr = 0xFFFFFFFF;
-    }
-    
-    return btr;
-
-}
-
-void can_init(can_t *obj, PinName rd, PinName td) {
-    CANName can_rd = (CANName)pinmap_peripheral(rd, PinMap_CAN_RD);
-    CANName can_td = (CANName)pinmap_peripheral(td, PinMap_CAN_TD);
-    obj->dev = (LPC_CAN_TypeDef *)pinmap_merge(can_rd, can_td);
-    if ((int)obj->dev == NC) {
-        error("CAN pin mapping failed");
-    }
-
-    switch ((int)obj->dev) {
-        case CAN_1: LPC_SC->PCONP |= 1 << 13; break;
-        case CAN_2: LPC_SC->PCONP |= 1 << 14; break;
-    }
-
-    pinmap_pinout(rd, PinMap_CAN_RD);
-    pinmap_pinout(td, PinMap_CAN_TD);
-    
-    switch ((int)obj->dev) {
-        case CAN_1: obj->index = 0; break;
-        case CAN_2: obj->index = 1; break;
-    }
-    
-    can_reset(obj);
-    obj->dev->IER = 0;             // Disable Interrupts
-    can_frequency(obj, 100000);
-
-    LPC_CANAF->AFMR = ACCF_BYPASS; // Bypass Filter
-}
-
-void can_free(can_t *obj) {
-    switch ((int)obj->dev) {
-        case CAN_1: LPC_SC->PCONP &= ~(1 << 13); break;
-        case CAN_2: LPC_SC->PCONP &= ~(1 << 14); break;
-    }
-}
-
-int can_frequency(can_t *obj, int f) {
-    int pclk = can_pclk(obj);
-    
-    int btr = can_speed(SystemCoreClock, pclk, (unsigned int)f, 1);
-
-    if (btr > 0) {
-        uint32_t modmask = can_disable(obj);
-        obj->dev->BTR = btr;
-        obj->dev->MOD = modmask;
-        return 1;
-    } else {
-        return 0;
-    }
-}
-
-int can_write(can_t *obj, CAN_Message msg, int cc) {
-    unsigned int CANStatus;
-    CANMsg m;
-
-    can_enable(obj);
-
-    m.id   = msg.id ;
-    m.dlc  = msg.len & 0xF;
-    m.rtr  = msg.type;
-    m.type = msg.format;
-    memcpy(m.data, msg.data, msg.len);
-    const unsigned int *buf = (const unsigned int *)&m;
-
-    CANStatus = obj->dev->SR;
-    if (CANStatus & 0x00000004) {
-        obj->dev->TFI1 = buf[0] & 0xC00F0000;
-        obj->dev->TID1 = buf[1];
-        obj->dev->TDA1 = buf[2];
-        obj->dev->TDB1 = buf[3];
-        if(cc) {
-            obj->dev->CMR = 0x30;
-        } else {
-            obj->dev->CMR = 0x21;
-        }
-        return 1;
-
-    } else if (CANStatus & 0x00000400) {
-        obj->dev->TFI2 = buf[0] & 0xC00F0000;
-        obj->dev->TID2 = buf[1];
-        obj->dev->TDA2 = buf[2];
-        obj->dev->TDB2 = buf[3];
-        if (cc) {
-            obj->dev->CMR = 0x50;
-        } else {
-            obj->dev->CMR = 0x41;
-        }
-        return 1;
-
-    } else if (CANStatus & 0x00040000) {
-        obj->dev->TFI3 = buf[0] & 0xC00F0000;
-        obj->dev->TID3 = buf[1];
-        obj->dev->TDA3 = buf[2];
-        obj->dev->TDB3 = buf[3];
-        if (cc) {
-            obj->dev->CMR = 0x90;
-        } else {
-            obj->dev->CMR = 0x81;
-        }
-        return 1;
-    }
-
-    return 0;
-}
-
-int can_read(can_t *obj, CAN_Message *msg, int handle) {
-    CANMsg x;
-    unsigned int *i = (unsigned int *)&x;
-
-    can_enable(obj);
-
-    if (obj->dev->GSR & 0x1) {
-        *i++ = obj->dev->RFS;  // Frame
-        *i++ = obj->dev->RID;  // ID
-        *i++ = obj->dev->RDA;  // Data A
-        *i++ = obj->dev->RDB;  // Data B
-        obj->dev->CMR = 0x04;  // release receive buffer
-
-        msg->id     = x.id;
-        msg->len    = x.dlc;
-        msg->format = (x.type)? CANExtended : CANStandard;
-        msg->type   = (x.rtr)?  CANRemote:    CANData;
-        memcpy(msg->data,x.data,x.dlc);
-        return 1;
-    }
-
-    return 0;
-}
-
-void can_reset(can_t *obj) {
-    can_disable(obj);
-    obj->dev->GSR = 0; // Reset error counter when CAN1MOD is in reset
-}
-
-unsigned char can_rderror(can_t *obj) {
-    return (obj->dev->GSR >> 16) & 0xFF;
-}
-
-unsigned char can_tderror(can_t *obj) {
-    return (obj->dev->GSR >> 24) & 0xFF;
-}
-
-void can_monitor(can_t *obj, int silent) {
-    uint32_t mod_mask = can_disable(obj);
-    if (silent) {
-        obj->dev->MOD |= (1 << 1);
-    } else {
-        obj->dev->MOD &= ~(1 << 1);
-    }
-    if (!(mod_mask & 1)) {
-        can_enable(obj);
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/device.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_DEVICE_H
-#define MBED_DEVICE_H
-
-#define DEVICE_PORTIN           1
-#define DEVICE_PORTOUT          1
-#define DEVICE_PORTINOUT        1
-
-#define DEVICE_INTERRUPTIN      1
-
-#define DEVICE_ANALOGIN         1
-#define DEVICE_ANALOGOUT        1
-
-#define DEVICE_SERIAL           1
-
-#define DEVICE_I2C              1
-#define DEVICE_I2CSLAVE         1
-
-#define DEVICE_SPI              1
-#define DEVICE_SPISLAVE         1
-
-#define DEVICE_CAN              1
-
-#define DEVICE_RTC              1
-
-#define DEVICE_ETHERNET         1
-
-#define DEVICE_PWMOUT           1
-
-#define DEVICE_SEMIHOST         1
-#define DEVICE_LOCALFILESYSTEM  1
-#define DEVICE_ID_LENGTH       32
-#define DEVICE_MAC_OFFSET      20
-
-#define DEVICE_SLEEP            1
-
-#define DEVICE_DEBUG_AWARENESS  1
-
-#define DEVICE_STDIO_MESSAGES   1
-
-#define DEVICE_ERROR_PATTERN    1
-
-#include "objects.h"
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/ethernet_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,948 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "ethernet_api.h"
-
-#include <string.h>
-#include "cmsis.h"
-#include "mbed_interface.h"
-#include "toolchain.h"
-#include "error.h"
-
-#define NEW_LOGIC       0
-#define NEW_ETH_BUFFER  0
-
-#if NEW_ETH_BUFFER
-
-#define NUM_RX_FRAG         4           // Number of Rx Fragments (== packets)
-#define NUM_TX_FRAG         3           // Number of Tx Fragments (== packets)
-
-#define ETH_MAX_FLEN        1536         // Maximum Ethernet Frame Size
-#define ETH_FRAG_SIZE       ETH_MAX_FLEN // Packet Fragment size (same as packet length)
-
-#else
-
-// Memfree calculation:
-// (16 * 1024) - ((2 * 4 * NUM_RX) + (2 * 4 * NUM_RX) + (0x300 * NUM_RX) +
-//                (2 * 4 * NUM_TX) + (1 * 4 * NUM_TX) + (0x300 * NUM_TX)) = 8556
-/* EMAC Memory Buffer configuration for 16K Ethernet RAM. */
-#define NUM_RX_FRAG         4           /* Num.of RX Fragments 4*1536= 6.0kB */
-#define NUM_TX_FRAG         3           /* Num.of TX Fragments 3*1536= 4.6kB */
-//#define ETH_FRAG_SIZE       1536        /* Packet Fragment size 1536 Bytes   */
-
-//#define ETH_MAX_FLEN        1536        /* Max. Ethernet Frame Size          */
-#define ETH_FRAG_SIZE       0x300       /* Packet Fragment size 1536/2 Bytes   */
-#define ETH_MAX_FLEN        0x300       /* Max. Ethernet Frame Size          */
-
-const int ethernet_MTU_SIZE  = 0x300;
-
-#endif
-
-#define ETHERNET_ADDR_SIZE 6
-
-PACKED struct RX_DESC_TypeDef {                        /* RX Descriptor struct              */
-   unsigned int Packet;
-   unsigned int Ctrl;
-};
-typedef struct RX_DESC_TypeDef RX_DESC_TypeDef;
-
-PACKED struct RX_STAT_TypeDef {                        /* RX Status struct                  */
-   unsigned int Info;
-   unsigned int HashCRC;
-};
-typedef struct RX_STAT_TypeDef RX_STAT_TypeDef;
-
-PACKED struct TX_DESC_TypeDef {                        /* TX Descriptor struct              */
-   unsigned int Packet;
-   unsigned int Ctrl;
-};
-typedef struct TX_DESC_TypeDef TX_DESC_TypeDef;
-
-PACKED struct TX_STAT_TypeDef {                        /* TX Status struct                  */
-   unsigned int Info;
-};
-typedef struct TX_STAT_TypeDef TX_STAT_TypeDef;
-
-/* MAC Configuration Register 1 */
-#define MAC1_REC_EN         0x00000001  /* Receive Enable                    */
-#define MAC1_PASS_ALL       0x00000002  /* Pass All Receive Frames           */
-#define MAC1_RX_FLOWC       0x00000004  /* RX Flow Control                   */
-#define MAC1_TX_FLOWC       0x00000008  /* TX Flow Control                   */
-#define MAC1_LOOPB          0x00000010  /* Loop Back Mode                    */
-#define MAC1_RES_TX         0x00000100  /* Reset TX Logic                    */
-#define MAC1_RES_MCS_TX     0x00000200  /* Reset MAC TX Control Sublayer     */
-#define MAC1_RES_RX         0x00000400  /* Reset RX Logic                    */
-#define MAC1_RES_MCS_RX     0x00000800  /* Reset MAC RX Control Sublayer     */
-#define MAC1_SIM_RES        0x00004000  /* Simulation Reset                  */
-#define MAC1_SOFT_RES       0x00008000  /* Soft Reset MAC                    */
-
-/* MAC Configuration Register 2 */
-#define MAC2_FULL_DUP       0x00000001  /* Full Duplex Mode                  */
-#define MAC2_FRM_LEN_CHK    0x00000002  /* Frame Length Checking             */
-#define MAC2_HUGE_FRM_EN    0x00000004  /* Huge Frame Enable                 */
-#define MAC2_DLY_CRC        0x00000008  /* Delayed CRC Mode                  */
-#define MAC2_CRC_EN         0x00000010  /* Append CRC to every Frame         */
-#define MAC2_PAD_EN         0x00000020  /* Pad all Short Frames              */
-#define MAC2_VLAN_PAD_EN    0x00000040  /* VLAN Pad Enable                   */
-#define MAC2_ADET_PAD_EN    0x00000080  /* Auto Detect Pad Enable            */
-#define MAC2_PPREAM_ENF     0x00000100  /* Pure Preamble Enforcement         */
-#define MAC2_LPREAM_ENF     0x00000200  /* Long Preamble Enforcement         */
-#define MAC2_NO_BACKOFF     0x00001000  /* No Backoff Algorithm              */
-#define MAC2_BACK_PRESSURE  0x00002000  /* Backoff Presurre / No Backoff     */
-#define MAC2_EXCESS_DEF     0x00004000  /* Excess Defer                      */
-
-/* Back-to-Back Inter-Packet-Gap Register */
-#define IPGT_FULL_DUP       0x00000015  /* Recommended value for Full Duplex */
-#define IPGT_HALF_DUP       0x00000012  /* Recommended value for Half Duplex */
-
-/* Non Back-to-Back Inter-Packet-Gap Register */
-#define IPGR_DEF            0x00000012  /* Recommended value                 */
-
-/* Collision Window/Retry Register */
-#define CLRT_DEF            0x0000370F  /* Default value                     */
-
-/* PHY Support Register */
-#define SUPP_SPEED          0x00000100  /* Reduced MII Logic Current Speed   */
-//#define SUPP_RES_RMII       0x00000800  /* Reset Reduced MII Logic           */
-#define SUPP_RES_RMII       0x00000000  /* Reset Reduced MII Logic           */
-
-/* Test Register */
-#define TEST_SHCUT_PQUANTA  0x00000001  /* Shortcut Pause Quanta             */
-#define TEST_TST_PAUSE      0x00000002  /* Test Pause                        */
-#define TEST_TST_BACKP      0x00000004  /* Test Back Pressure                */
-
-/* MII Management Configuration Register */
-#define MCFG_SCAN_INC       0x00000001  /* Scan Increment PHY Address        */
-#define MCFG_SUPP_PREAM     0x00000002  /* Suppress Preamble                 */
-#define MCFG_CLK_SEL        0x0000003C  /* Clock Select Mask                 */
-#define MCFG_RES_MII        0x00008000  /* Reset MII Management Hardware     */
-
-/* MII Management Command Register */
-#define MCMD_READ           0x00000001  /* MII Read                          */
-#define MCMD_SCAN           0x00000002  /* MII Scan continuously             */
-
-#define MII_WR_TOUT         0x00050000  /* MII Write timeout count           */
-#define MII_RD_TOUT         0x00050000  /* MII Read timeout count            */
-
-/* MII Management Address Register */
-#define MADR_REG_ADR        0x0000001F  /* MII Register Address Mask         */
-#define MADR_PHY_ADR        0x00001F00  /* PHY Address Mask                  */
-
-/* MII Management Indicators Register */
-#define MIND_BUSY           0x00000001  /* MII is Busy                       */
-#define MIND_SCAN           0x00000002  /* MII Scanning in Progress          */
-#define MIND_NOT_VAL        0x00000004  /* MII Read Data not valid           */
-#define MIND_MII_LINK_FAIL  0x00000008  /* MII Link Failed                   */
-
-/* Command Register */
-#define CR_RX_EN            0x00000001  /* Enable Receive                    */
-#define CR_TX_EN            0x00000002  /* Enable Transmit                   */
-#define CR_REG_RES          0x00000008  /* Reset Host Registers              */
-#define CR_TX_RES           0x00000010  /* Reset Transmit Datapath           */
-#define CR_RX_RES           0x00000020  /* Reset Receive Datapath            */
-#define CR_PASS_RUNT_FRM    0x00000040  /* Pass Runt Frames                  */
-#define CR_PASS_RX_FILT     0x00000080  /* Pass RX Filter                    */
-#define CR_TX_FLOW_CTRL     0x00000100  /* TX Flow Control                   */
-#define CR_RMII             0x00000200  /* Reduced MII Interface             */
-#define CR_FULL_DUP         0x00000400  /* Full Duplex                       */
-
-/* Status Register */
-#define SR_RX_EN            0x00000001  /* Enable Receive                    */
-#define SR_TX_EN            0x00000002  /* Enable Transmit                   */
-
-/* Transmit Status Vector 0 Register */
-#define TSV0_CRC_ERR        0x00000001  /* CRC error                         */
-#define TSV0_LEN_CHKERR     0x00000002  /* Length Check Error                */
-#define TSV0_LEN_OUTRNG     0x00000004  /* Length Out of Range               */
-#define TSV0_DONE           0x00000008  /* Tramsmission Completed            */
-#define TSV0_MCAST          0x00000010  /* Multicast Destination             */
-#define TSV0_BCAST          0x00000020  /* Broadcast Destination             */
-#define TSV0_PKT_DEFER      0x00000040  /* Packet Deferred                   */
-#define TSV0_EXC_DEFER      0x00000080  /* Excessive Packet Deferral         */
-#define TSV0_EXC_COLL       0x00000100  /* Excessive Collision               */
-#define TSV0_LATE_COLL      0x00000200  /* Late Collision Occured            */
-#define TSV0_GIANT          0x00000400  /* Giant Frame                       */
-#define TSV0_UNDERRUN       0x00000800  /* Buffer Underrun                   */
-#define TSV0_BYTES          0x0FFFF000  /* Total Bytes Transferred           */
-#define TSV0_CTRL_FRAME     0x10000000  /* Control Frame                     */
-#define TSV0_PAUSE          0x20000000  /* Pause Frame                       */
-#define TSV0_BACK_PRESS     0x40000000  /* Backpressure Method Applied       */
-#define TSV0_VLAN           0x80000000  /* VLAN Frame                        */
-
-/* Transmit Status Vector 1 Register */
-#define TSV1_BYTE_CNT       0x0000FFFF  /* Transmit Byte Count               */
-#define TSV1_COLL_CNT       0x000F0000  /* Transmit Collision Count          */
-
-/* Receive Status Vector Register */
-#define RSV_BYTE_CNT        0x0000FFFF  /* Receive Byte Count                */
-#define RSV_PKT_IGNORED     0x00010000  /* Packet Previously Ignored         */
-#define RSV_RXDV_SEEN       0x00020000  /* RXDV Event Previously Seen        */
-#define RSV_CARR_SEEN       0x00040000  /* Carrier Event Previously Seen     */
-#define RSV_REC_CODEV       0x00080000  /* Receive Code Violation            */
-#define RSV_CRC_ERR         0x00100000  /* CRC Error                         */
-#define RSV_LEN_CHKERR      0x00200000  /* Length Check Error                */
-#define RSV_LEN_OUTRNG      0x00400000  /* Length Out of Range               */
-#define RSV_REC_OK          0x00800000  /* Frame Received OK                 */
-#define RSV_MCAST           0x01000000  /* Multicast Frame                   */
-#define RSV_BCAST           0x02000000  /* Broadcast Frame                   */
-#define RSV_DRIB_NIBB       0x04000000  /* Dribble Nibble                    */
-#define RSV_CTRL_FRAME      0x08000000  /* Control Frame                     */
-#define RSV_PAUSE           0x10000000  /* Pause Frame                       */
-#define RSV_UNSUPP_OPC      0x20000000  /* Unsupported Opcode                */
-#define RSV_VLAN            0x40000000  /* VLAN Frame                        */
-
-/* Flow Control Counter Register */
-#define FCC_MIRR_CNT        0x0000FFFF  /* Mirror Counter                    */
-#define FCC_PAUSE_TIM       0xFFFF0000  /* Pause Timer                       */
-
-/* Flow Control Status Register */
-#define FCS_MIRR_CNT        0x0000FFFF  /* Mirror Counter Current            */
-
-/* Receive Filter Control Register */
-#define RFC_UCAST_EN        0x00000001  /* Accept Unicast Frames Enable      */
-#define RFC_BCAST_EN        0x00000002  /* Accept Broadcast Frames Enable    */
-#define RFC_MCAST_EN        0x00000004  /* Accept Multicast Frames Enable    */
-#define RFC_UCAST_HASH_EN   0x00000008  /* Accept Unicast Hash Filter Frames */
-#define RFC_MCAST_HASH_EN   0x00000010  /* Accept Multicast Hash Filter Fram.*/
-#define RFC_PERFECT_EN      0x00000020  /* Accept Perfect Match Enable       */
-#define RFC_MAGP_WOL_EN     0x00001000  /* Magic Packet Filter WoL Enable    */
-#define RFC_PFILT_WOL_EN    0x00002000  /* Perfect Filter WoL Enable         */
-
-/* Receive Filter WoL Status/Clear Registers */
-#define WOL_UCAST           0x00000001  /* Unicast Frame caused WoL          */
-#define WOL_BCAST           0x00000002  /* Broadcast Frame caused WoL        */
-#define WOL_MCAST           0x00000004  /* Multicast Frame caused WoL        */
-#define WOL_UCAST_HASH      0x00000008  /* Unicast Hash Filter Frame WoL     */
-#define WOL_MCAST_HASH      0x00000010  /* Multicast Hash Filter Frame WoL   */
-#define WOL_PERFECT         0x00000020  /* Perfect Filter WoL                */
-#define WOL_RX_FILTER       0x00000080  /* RX Filter caused WoL              */
-#define WOL_MAG_PACKET      0x00000100  /* Magic Packet Filter caused WoL    */
-
-/* Interrupt Status/Enable/Clear/Set Registers */
-#define INT_RX_OVERRUN      0x00000001  /* Overrun Error in RX Queue         */
-#define INT_RX_ERR          0x00000002  /* Receive Error                     */
-#define INT_RX_FIN          0x00000004  /* RX Finished Process Descriptors   */
-#define INT_RX_DONE         0x00000008  /* Receive Done                      */
-#define INT_TX_UNDERRUN     0x00000010  /* Transmit Underrun                 */
-#define INT_TX_ERR          0x00000020  /* Transmit Error                    */
-#define INT_TX_FIN          0x00000040  /* TX Finished Process Descriptors   */
-#define INT_TX_DONE         0x00000080  /* Transmit Done                     */
-#define INT_SOFT_INT        0x00001000  /* Software Triggered Interrupt      */
-#define INT_WAKEUP          0x00002000  /* Wakeup Event Interrupt            */
-
-/* Power Down Register */
-#define PD_POWER_DOWN       0x80000000  /* Power Down MAC                    */
-
-/* RX Descriptor Control Word */
-#define RCTRL_SIZE          0x000007FF  /* Buffer size mask                  */
-#define RCTRL_INT           0x80000000  /* Generate RxDone Interrupt         */
-
-/* RX Status Hash CRC Word */
-#define RHASH_SA            0x000001FF  /* Hash CRC for Source Address       */
-#define RHASH_DA            0x001FF000  /* Hash CRC for Destination Address  */
-
-/* RX Status Information Word */
-#define RINFO_SIZE          0x000007FF  /* Data size in bytes                */
-#define RINFO_CTRL_FRAME    0x00040000  /* Control Frame                     */
-#define RINFO_VLAN          0x00080000  /* VLAN Frame                        */
-#define RINFO_FAIL_FILT     0x00100000  /* RX Filter Failed                  */
-#define RINFO_MCAST         0x00200000  /* Multicast Frame                   */
-#define RINFO_BCAST         0x00400000  /* Broadcast Frame                   */
-#define RINFO_CRC_ERR       0x00800000  /* CRC Error in Frame                */
-#define RINFO_SYM_ERR       0x01000000  /* Symbol Error from PHY             */
-#define RINFO_LEN_ERR       0x02000000  /* Length Error                      */
-#define RINFO_RANGE_ERR     0x04000000  /* Range Error (exceeded max. size)  */
-#define RINFO_ALIGN_ERR     0x08000000  /* Alignment Error                   */
-#define RINFO_OVERRUN       0x10000000  /* Receive overrun                   */
-#define RINFO_NO_DESCR      0x20000000  /* No new Descriptor available       */
-#define RINFO_LAST_FLAG     0x40000000  /* Last Fragment in Frame            */
-#define RINFO_ERR           0x80000000  /* Error Occured (OR of all errors)  */
-
-//#define RINFO_ERR_MASK     (RINFO_FAIL_FILT | RINFO_CRC_ERR   | RINFO_SYM_ERR | RINFO_LEN_ERR   | RINFO_ALIGN_ERR | RINFO_OVERRUN)
-#define RINFO_ERR_MASK     (RINFO_FAIL_FILT | RINFO_SYM_ERR | \
-                            RINFO_LEN_ERR   | RINFO_ALIGN_ERR | RINFO_OVERRUN)
-
-
-/* TX Descriptor Control Word */
-#define TCTRL_SIZE          0x000007FF  /* Size of data buffer in bytes      */
-#define TCTRL_OVERRIDE      0x04000000  /* Override Default MAC Registers    */
-#define TCTRL_HUGE          0x08000000  /* Enable Huge Frame                 */
-#define TCTRL_PAD           0x10000000  /* Pad short Frames to 64 bytes      */
-#define TCTRL_CRC           0x20000000  /* Append a hardware CRC to Frame    */
-#define TCTRL_LAST          0x40000000  /* Last Descriptor for TX Frame      */
-#define TCTRL_INT           0x80000000  /* Generate TxDone Interrupt         */
-
-/* TX Status Information Word */
-#define TINFO_COL_CNT       0x01E00000  /* Collision Count                   */
-#define TINFO_DEFER         0x02000000  /* Packet Deferred (not an error)    */
-#define TINFO_EXCESS_DEF    0x04000000  /* Excessive Deferral                */
-#define TINFO_EXCESS_COL    0x08000000  /* Excessive Collision               */
-#define TINFO_LATE_COL      0x10000000  /* Late Collision Occured            */
-#define TINFO_UNDERRUN      0x20000000  /* Transmit Underrun                 */
-#define TINFO_NO_DESCR      0x40000000  /* No new Descriptor available       */
-#define TINFO_ERR           0x80000000  /* Error Occured (OR of all errors)  */
-
-/* ENET Device Revision ID */
-#define OLD_EMAC_MODULE_ID  0x39022000  /* Rev. ID for first rev '-'         */
-
-/* DP83848C PHY Registers */
-#define PHY_REG_BMCR        0x00        /* Basic Mode Control Register       */
-#define PHY_REG_BMSR        0x01        /* Basic Mode Status Register        */
-#define PHY_REG_IDR1        0x02        /* PHY Identifier 1                  */
-#define PHY_REG_IDR2        0x03        /* PHY Identifier 2                  */
-#define PHY_REG_ANAR        0x04        /* Auto-Negotiation Advertisement    */
-#define PHY_REG_ANLPAR      0x05        /* Auto-Neg. Link Partner Abitily    */
-#define PHY_REG_ANER        0x06        /* Auto-Neg. Expansion Register      */
-#define PHY_REG_ANNPTR      0x07        /* Auto-Neg. Next Page TX            */
-
-/* PHY Extended Registers */
-#define PHY_REG_STS         0x10        /* Status Register                   */
-#define PHY_REG_MICR        0x11        /* MII Interrupt Control Register    */
-#define PHY_REG_MISR        0x12        /* MII Interrupt Status Register     */
-#define PHY_REG_FCSCR       0x14        /* False Carrier Sense Counter       */
-#define PHY_REG_RECR        0x15        /* Receive Error Counter             */
-#define PHY_REG_PCSR        0x16        /* PCS Sublayer Config. and Status   */
-#define PHY_REG_RBR         0x17        /* RMII and Bypass Register          */
-#define PHY_REG_LEDCR       0x18        /* LED Direct Control Register       */
-#define PHY_REG_PHYCR       0x19        /* PHY Control Register              */
-#define PHY_REG_10BTSCR     0x1A        /* 10Base-T Status/Control Register  */
-#define PHY_REG_CDCTRL1     0x1B        /* CD Test Control and BIST Extens.  */
-#define PHY_REG_EDCR        0x1D        /* Energy Detect Control Register    */
-
-#define PHY_REG_SCSR        0x1F        /* PHY Special Control/Status Register */
-
-#define PHY_FULLD_100M      0x2100      /* Full Duplex 100Mbit               */
-#define PHY_HALFD_100M      0x2000      /* Half Duplex 100Mbit               */
-#define PHY_FULLD_10M       0x0100      /* Full Duplex 10Mbit                */
-#define PHY_HALFD_10M       0x0000      /* Half Duplex 10MBit                */
-#define PHY_AUTO_NEG        0x3000      /* Select Auto Negotiation           */
-
-#define DP83848C_DEF_ADR    0x0100      /* Default PHY device address        */
-#define DP83848C_ID         0x20005C90  /* PHY Identifier - DP83848C         */
-
-#define LAN8720_ID          0x0007C0F0  /* PHY Identifier - LAN8720          */
-
-#define PHY_STS_LINK        0x0001      /* PHY Status Link Mask              */
-#define PHY_STS_SPEED       0x0002      /* PHY Status Speed Mask             */
-#define PHY_STS_DUPLEX      0x0004      /* PHY Status Duplex Mask            */
-
-#define PHY_BMCR_RESET      0x8000      /* PHY Reset                         */
-
-#define PHY_BMSR_LINK       0x0004      /* PHY BMSR Link valid               */
-
-#define PHY_SCSR_100MBIT    0x0008      /* Speed: 1=100 MBit, 0=10Mbit       */
-#define PHY_SCSR_DUPLEX     0x0010      /* PHY Duplex Mask                   */
-
-
-static int phy_read(unsigned int PhyReg);
-static int phy_write(unsigned int PhyReg, unsigned short Data);
-
-static void txdscr_init(void);
-static void rxdscr_init(void);
-
-#if defined (__ICCARM__)
-#   define AHBSRAM1
-#elif defined(TOOLCHAIN_GCC_CR)
-#   define AHBSRAM1 __attribute__((section(".data.$RamPeriph32")))
-#else
-#   define AHBSRAM1     __attribute__((section("AHBSRAM1"),aligned))
-#endif
-
-AHBSRAM1 volatile uint8_t rxbuf[NUM_RX_FRAG][ETH_FRAG_SIZE];
-AHBSRAM1 volatile uint8_t txbuf[NUM_TX_FRAG][ETH_FRAG_SIZE];
-AHBSRAM1 volatile RX_DESC_TypeDef rxdesc[NUM_RX_FRAG];
-AHBSRAM1 volatile RX_STAT_TypeDef rxstat[NUM_RX_FRAG];
-AHBSRAM1 volatile TX_DESC_TypeDef txdesc[NUM_TX_FRAG];
-AHBSRAM1 volatile TX_STAT_TypeDef txstat[NUM_TX_FRAG];
-
-
-#if NEW_LOGIC
-static int rx_consume_offset = -1;
-static int tx_produce_offset = -1;
-#else
-static int send_doff =  0;
-static int send_idx  = -1;
-static int send_size =  0;
-
-static int receive_soff =  0;
-static int receive_idx  = -1;
-#endif
-
-static uint32_t phy_id = 0;
-
-static inline int rinc(int idx, int mod) {
-  ++idx;
-  idx %= mod;
-  return idx;
-}
-
-//extern unsigned int SystemFrequency;
-static inline unsigned int clockselect() {
-  if(SystemCoreClock < 10000000) {
-    return 1;
-  } else if(SystemCoreClock <  15000000) {
-    return 2;
-  } else if(SystemCoreClock <  20000000) {
-    return 3;
-  } else if(SystemCoreClock <  25000000) {
-    return 4;
-  } else if(SystemCoreClock <  35000000) {
-    return 5;
-  } else if(SystemCoreClock <  50000000) {
-    return 6;
-  } else if(SystemCoreClock <  70000000) {
-    return 7;
-  } else if(SystemCoreClock <  80000000) {
-    return 8;
-  } else if(SystemCoreClock <  90000000) {
-    return 9;
-  } else if(SystemCoreClock < 100000000) {
-    return 10;
-  } else if(SystemCoreClock < 120000000) {
-    return 11;
-  } else if(SystemCoreClock < 130000000) {
-    return 12;
-  } else if(SystemCoreClock < 140000000) {
-    return 13;
-  } else if(SystemCoreClock < 150000000) {
-    return 15;
-  } else if(SystemCoreClock < 160000000) {
-    return 16;
-  } else {
-    return 0;
-  }
-}
-
-#ifndef min
-#define min(x, y) (((x)<(y))?(x):(y))
-#endif
-
-/*----------------------------------------------------------------------------
-  Ethernet Device initialize
- *----------------------------------------------------------------------------*/
-int ethernet_init() {
-  int regv, tout;
-  char mac[ETHERNET_ADDR_SIZE];
-  unsigned int clock = clockselect();
-  
-  LPC_SC->PCONP |= 0x40000000;                       /* Power Up the EMAC controller. */
-  
-  LPC_PINCON->PINSEL2 = 0x50150105;                  /* Enable P1 Ethernet Pins. */
-  LPC_PINCON->PINSEL3 = (LPC_PINCON->PINSEL3 & ~0x0000000F) | 0x00000005;
-
-   /* Reset all EMAC internal modules. */
-  LPC_EMAC->MAC1    = MAC1_RES_TX | MAC1_RES_MCS_TX | MAC1_RES_RX |
-                      MAC1_RES_MCS_RX | MAC1_SIM_RES | MAC1_SOFT_RES;
-  LPC_EMAC->Command = CR_REG_RES | CR_TX_RES | CR_RX_RES | CR_PASS_RUNT_FRM;
-
-  for(tout = 100; tout; tout--) __NOP();             /* A short delay after reset. */
-
-  LPC_EMAC->MAC1 = MAC1_PASS_ALL;                    /* Initialize MAC control registers. */
-  LPC_EMAC->MAC2 = MAC2_CRC_EN | MAC2_PAD_EN;
-  LPC_EMAC->MAXF = ETH_MAX_FLEN;
-  LPC_EMAC->CLRT = CLRT_DEF;
-  LPC_EMAC->IPGR = IPGR_DEF;
-
-  LPC_EMAC->Command = CR_RMII | CR_PASS_RUNT_FRM;    /* Enable Reduced MII interface. */
-
-  LPC_EMAC->MCFG = (clock << 0x2) & MCFG_CLK_SEL;    /* Set clock */
-  LPC_EMAC->MCFG |= MCFG_RES_MII;                    /* and reset */
-
-  for(tout = 100; tout; tout--) __NOP();             /* A short delay */
-
-  LPC_EMAC->MCFG = (clock << 0x2) & MCFG_CLK_SEL;
-  LPC_EMAC->MCMD = 0;
-
-  LPC_EMAC->SUPP = SUPP_RES_RMII;                    /* Reset Reduced MII Logic. */
-
-  for (tout = 100; tout; tout--) __NOP();            /* A short delay */
-
-  LPC_EMAC->SUPP = 0;
-
-  phy_write(PHY_REG_BMCR, PHY_BMCR_RESET);           /* perform PHY reset */
-  for(tout = 0x20000; ; tout--) {                    /* Wait for hardware reset to end. */
-    regv = phy_read(PHY_REG_BMCR);
-    if(regv < 0 || tout == 0) {
-       return -1;                                    /* Error */
-    }
-    if(!(regv & PHY_BMCR_RESET)) {
-       break;                                        /* Reset complete. */
-    }
-  }
-
-  phy_id =  (phy_read(PHY_REG_IDR1) << 16);
-  phy_id |= (phy_read(PHY_REG_IDR2) & 0XFFF0);
-
-  if (phy_id != DP83848C_ID && phy_id != LAN8720_ID) {
-      error("Unknown Ethernet PHY (%x)", (unsigned int)phy_id);
-  }
-
-  ethernet_set_link(-1, 0);
-
-  /* Set the Ethernet MAC Address registers */
-  ethernet_address(mac);
-  LPC_EMAC->SA0 = ((uint32_t)mac[5] << 8) | (uint32_t)mac[4];
-  LPC_EMAC->SA1 = ((uint32_t)mac[3] << 8) | (uint32_t)mac[2];
-  LPC_EMAC->SA2 = ((uint32_t)mac[1] << 8) | (uint32_t)mac[0];
-
-  txdscr_init();                                      /* initialize DMA TX Descriptor */
-  rxdscr_init();                                      /* initialize DMA RX Descriptor */
-
-  LPC_EMAC->RxFilterCtrl = RFC_UCAST_EN | RFC_MCAST_EN | RFC_BCAST_EN | RFC_PERFECT_EN;
-                                                      /* Receive Broadcast, Perfect Match Packets */
-
-  LPC_EMAC->IntEnable = INT_RX_DONE | INT_TX_DONE;    /* Enable EMAC interrupts. */
-  LPC_EMAC->IntClear  = 0xFFFF;                       /* Reset all interrupts */
-
-
-  LPC_EMAC->Command  |= (CR_RX_EN | CR_TX_EN);        /* Enable receive and transmit mode of MAC Ethernet core */
-  LPC_EMAC->MAC1     |= MAC1_REC_EN;
-
-#if NEW_LOGIC
-  rx_consume_offset = -1;
-  tx_produce_offset = -1;
-#else
-  send_doff =  0;
-  send_idx  = -1;
-  send_size =  0;
-
-  receive_soff =  0;
-  receive_idx  = -1;
-#endif
-
-  return 0;
-}
-
-/*----------------------------------------------------------------------------
-  Ethernet Device Uninitialize
- *----------------------------------------------------------------------------*/
-void ethernet_free() {
-    LPC_EMAC->IntEnable &= ~(INT_RX_DONE | INT_TX_DONE);
-    LPC_EMAC->IntClear   =  0xFFFF;
-    
-    LPC_SC->PCONP   &= ~0x40000000;       /* Power down the EMAC controller. */
-    
-    LPC_PINCON->PINSEL2 &= ~0x50150105;   /* Disable P1 ethernet pins. */
-    LPC_PINCON->PINSEL3  = (LPC_PINCON->PINSEL3 & ~0x0000000F) | 0x00000000;
-}
-
-// if(TxProduceIndex == TxConsumeIndex) buffer array is empty
-// if(TxProduceIndex == TxConsumeIndex - 1) buffer is full, should not fill
-// TxProduceIndex - The buffer that will/is being fileld by driver, s/w increment
-// TxConsumeIndex - The buffer that will/is beign sent by hardware
-
-int ethernet_write(const char *data, int slen) {
-
-#if NEW_LOGIC
-
-   if(tx_produce_offset < 0) { // mark as active if not already
-     tx_produce_offset = 0;
-   }
-
-   int index = LPC_EMAC->TxProduceIndex;
-
-   int remaining = ETH_MAX_FLEN - tx_produce_offset - 4; // bytes written plus checksum
-   int requested = slen;
-   int ncopy = min(remaining, requested);
-
-   void *pdst = (void *)(txdesc[index].Packet + tx_produce_offset);
-   void *psrc = (void *)(data);
-
-   if(ncopy > 0 ){
-     if(data != NULL) {
-       memcpy(pdst, psrc, ncopy);
-     } else {
-       memset(pdst, 0, ncopy);
-     }
-   }
-
-   tx_produce_offset += ncopy;
-
-   return ncopy;
-
-#else
-    void       *pdst, *psrc;
-    const int   dlen = ETH_FRAG_SIZE;
-    int         copy = 0;
-    int         soff = 0;
-
-    if(send_idx == -1) {
-        send_idx = LPC_EMAC->TxProduceIndex;
-    }
-
-    if(slen + send_doff > ethernet_MTU_SIZE) {
-       return -1;
-    }
-
-    do {
-        copy = min(slen - soff, dlen - send_doff);
-        pdst = (void *)(txdesc[send_idx].Packet + send_doff);
-        psrc = (void *)(data + soff);
-        if(send_doff + copy > ETH_FRAG_SIZE) {
-            txdesc[send_idx].Ctrl = (send_doff-1) | (TCTRL_INT);
-            send_idx = rinc(send_idx, NUM_TX_FRAG);
-            send_doff = 0;
-        }
-
-        if(data != NULL) {
-            memcpy(pdst, psrc, copy);
-        } else {
-            memset(pdst, 0, copy);
-        }
-
-        soff += copy;
-        send_doff += copy;
-        send_size += copy;
-    } while(soff != slen);
-
-    return soff;
-#endif
-}
-
-int ethernet_send() {
-
-#if NEW_LOGIC
-  if(tx_produce_offset < 0) { // no buffer active
-    return -1;
-  }
-
-  // ensure there is a link
-  if(!ethernet_link()) {
-    return -2;
-  }
-
-  // we have been writing in to a buffer, so finalise it
-  int size = tx_produce_offset;
-  int index = LPC_EMAC->TxProduceIndex;
-  txdesc[index].Ctrl = (tx_produce_offset-1) | (TCTRL_INT | TCTRL_LAST);
-
-  // Increment ProduceIndex to allow it to be sent
-  // We can only do this if the next slot is free
-  int next = rinc(index, NUM_TX_FRAG);
-  while(next == LPC_EMAC->TxConsumeIndex) {
-    for(int i=0; i<1000; i++) { __NOP(); }
-  }
-
-  LPC_EMAC->TxProduceIndex = next;
-  tx_produce_offset = -1;
-  return size;
-
-#else
-    int s = send_size;
-    txdesc[send_idx].Ctrl = (send_doff-1) | (TCTRL_INT | TCTRL_LAST);
-    send_idx  = rinc(send_idx, NUM_TX_FRAG);
-    LPC_EMAC->TxProduceIndex = send_idx;
-    send_doff =  0;
-    send_idx  = -1;
-    send_size =  0;
-    return s;
-#endif
-}
-
-// RxConsmeIndex - The index of buffer the driver will/is reading from. Driver should inc once read
-// RxProduceIndex - The index of buffer that will/is being filled by MAC. H/w will inc once rxd
-//
-// if(RxConsumeIndex == RxProduceIndex) buffer array is empty
-// if(RxConsumeIndex == RxProduceIndex + 1) buffer array is full
-
-// Recevies an arrived ethernet packet.
-// Receiving an ethernet packet will drop the last received ethernet packet
-// and make a new ethernet packet ready to read.
-// Returns size of packet, else 0 if nothing to receive
-
-// We read from RxConsumeIndex from position rx_consume_offset
-// if rx_consume_offset < 0, then we have not recieved the RxConsumeIndex packet for reading
-// rx_consume_offset = -1 // no frame
-// rx_consume_offset = 0  // start of frame
-// Assumption: A fragment should alway be a whole frame
-
-int ethernet_receive() {
-#if NEW_LOGIC
-
-  // if we are currently reading a valid RxConsume buffer, increment to the next one
-  if(rx_consume_offset >= 0) {
-    LPC_EMAC->RxConsumeIndex = rinc(LPC_EMAC->RxConsumeIndex, NUM_RX_FRAG);
-  }
-
-  // if the buffer is empty, mark it as no valid buffer
-  if(LPC_EMAC->RxConsumeIndex == LPC_EMAC->RxProduceIndex) {
-    rx_consume_offset = -1;
-    return 0;
-  }
-
-  uint32_t info = rxstat[LPC_EMAC->RxConsumeIndex].Info;
-  rx_consume_offset = 0;
-
-  // check if it is not marked as last or for errors
-  if(!(info & RINFO_LAST_FLAG) || (info & RINFO_ERR_MASK)) {
-    return -1;
-  }
-
-  int size = (info & RINFO_SIZE) + 1;
-  return size - 4; // don't include checksum bytes
-
-#else
-    if(receive_idx == -1) {
-      receive_idx = LPC_EMAC->RxConsumeIndex;
-    } else {
-        while(!(rxstat[receive_idx].Info & RINFO_LAST_FLAG) && ((uint32_t)receive_idx != LPC_EMAC->RxProduceIndex)) {
-            receive_idx  = rinc(receive_idx, NUM_RX_FRAG);
-        }
-        unsigned int info =   rxstat[receive_idx].Info;
-        int slen =  (info & RINFO_SIZE) + 1;
-
-        if(slen > ethernet_MTU_SIZE || (info & RINFO_ERR_MASK)) {
-            /* Invalid frame, ignore it and free buffer. */
-            receive_idx = rinc(receive_idx, NUM_RX_FRAG);
-        }
-        receive_idx = rinc(receive_idx, NUM_RX_FRAG);
-        receive_soff = 0;
-
-        LPC_EMAC->RxConsumeIndex = receive_idx;
-    }
-
-    if((uint32_t)receive_idx == LPC_EMAC->RxProduceIndex) {
-        receive_idx = -1;
-        return 0;
-    }
-
-    return (rxstat[receive_idx].Info & RINFO_SIZE) - 3;
-#endif
-}
-
-// Read from an recevied ethernet packet.
-// After receive returnd a number bigger than 0 it is
-// possible to read bytes from this packet.
-// Read will write up to size bytes into data.
-// It is possible to use read multible times.
-// Each time read will start reading after the last read byte before.
-
-int ethernet_read(char *data, int dlen) {
-#if NEW_LOGIC
-  // Check we have a valid buffer to read
-  if(rx_consume_offset < 0) {
-    return 0;
-  }
-
-  // Assume 1 fragment block
-  uint32_t info = rxstat[LPC_EMAC->RxConsumeIndex].Info;
-  int size = (info & RINFO_SIZE) + 1 - 4; // exclude checksum
-
-  int remaining = size - rx_consume_offset;
-  int requested = dlen;
-  int ncopy = min(remaining, requested);
-
-  void *psrc = (void *)(rxdesc[LPC_EMAC->RxConsumeIndex].Packet + rx_consume_offset);
-  void *pdst = (void *)(data);
-
-  if(data != NULL && ncopy > 0) {
-    memcpy(pdst, psrc, ncopy);
-  }
-
-  rx_consume_offset += ncopy;
-
-  return ncopy;
-#else
-    int          slen;
-    int          copy   = 0;
-    unsigned int more;
-    unsigned int info;
-    void        *pdst, *psrc;
-    int          doff = 0;
-
-    if((uint32_t)receive_idx == LPC_EMAC->RxProduceIndex || receive_idx == -1) {
-        return 0;
-    }
-
-    do {
-        info =   rxstat[receive_idx].Info;
-        more = !(info & RINFO_LAST_FLAG);
-        slen =  (info & RINFO_SIZE) + 1;
-
-        if(slen > ethernet_MTU_SIZE || (info & RINFO_ERR_MASK)) {
-            /* Invalid frame, ignore it and free buffer. */
-            receive_idx = rinc(receive_idx, NUM_RX_FRAG);
-        } else {
-
-            copy = min(slen - receive_soff, dlen - doff);
-            psrc = (void *)(rxdesc[receive_idx].Packet + receive_soff);
-            pdst = (void *)(data + doff);
-
-            if(data != NULL) {
-                /* check if Buffer available */
-                memcpy(pdst, psrc, copy);
-            }
-
-            receive_soff += copy;
-            doff += copy;
-
-            if((more && (receive_soff == slen))) {
-                receive_idx = rinc(receive_idx, NUM_RX_FRAG);
-                receive_soff = 0;
-            }
-        }
-    } while(more && !(doff == dlen) && !receive_soff);
-
-    return doff;
-#endif
-}
-
-int ethernet_link(void) {
-
-    if (phy_id == DP83848C_ID) {
-      return (phy_read(PHY_REG_STS) & PHY_STS_LINK);
-    }
-    else { // LAN8720_ID
-      return (phy_read(PHY_REG_BMSR) & PHY_BMSR_LINK);
-    }
-}
-
-static int phy_write(unsigned int PhyReg, unsigned short Data) {
-    unsigned int timeOut;
-
-    LPC_EMAC->MADR = DP83848C_DEF_ADR | PhyReg;
-    LPC_EMAC->MWTD = Data;
-
-    for(timeOut = 0; timeOut < MII_WR_TOUT; timeOut++) {     /* Wait until operation completed */
-        if((LPC_EMAC->MIND & MIND_BUSY) == 0) {
-            return 0;
-        }
-    }
-
-    return -1;
-}
-
-
-static int phy_read(unsigned int PhyReg) {
-    unsigned int timeOut;
-
-    LPC_EMAC->MADR = DP83848C_DEF_ADR | PhyReg;
-    LPC_EMAC->MCMD = MCMD_READ;
-
-    for(timeOut = 0; timeOut < MII_RD_TOUT; timeOut++) {     /* Wait until operation completed */
-        if((LPC_EMAC->MIND & MIND_BUSY) == 0) {
-            LPC_EMAC->MCMD = 0;
-            return LPC_EMAC->MRDD;                           /* Return a 16-bit value. */
-        }
-    }
-
-    return -1;
-}
-
-
-static void txdscr_init() {
-    int i;
-
-    for(i = 0; i < NUM_TX_FRAG; i++) {
-        txdesc[i].Packet = (uint32_t)&txbuf[i];
-        txdesc[i].Ctrl   = 0;
-        txstat[i].Info   = 0;
-    }
-
-    LPC_EMAC->TxDescriptor       = (uint32_t)txdesc;         /* Set EMAC Transmit Descriptor Registers. */
-    LPC_EMAC->TxStatus           = (uint32_t)txstat;
-    LPC_EMAC->TxDescriptorNumber = NUM_TX_FRAG-1;
-
-    LPC_EMAC->TxProduceIndex  = 0;                           /* Tx Descriptors Point to 0 */
-}
-
-
-static void rxdscr_init() {
-    int i;
-
-    for(i = 0; i < NUM_RX_FRAG; i++) {
-        rxdesc[i].Packet  = (uint32_t)&rxbuf[i];
-        rxdesc[i].Ctrl    = RCTRL_INT | (ETH_FRAG_SIZE-1);
-        rxstat[i].Info    = 0;
-        rxstat[i].HashCRC = 0;
-    }
-
-    LPC_EMAC->RxDescriptor       = (uint32_t)rxdesc;        /* Set EMAC Receive Descriptor Registers. */
-    LPC_EMAC->RxStatus           = (uint32_t)rxstat;
-    LPC_EMAC->RxDescriptorNumber = NUM_RX_FRAG-1;
-
-    LPC_EMAC->RxConsumeIndex  = 0;                          /* Rx Descriptors Point to 0 */
-}
-
-void ethernet_address(char *mac) {
-    mbed_mac_address(mac);
-}
-
-void ethernet_set_link(int speed, int duplex) {
-    unsigned short phy_data;
-    int tout;
-
-    if((speed < 0) || (speed > 1)) {
-
-        phy_data = PHY_AUTO_NEG;
-
-    } else {
-
-        phy_data = (((unsigned short) speed << 13) |
-                    ((unsigned short) duplex << 8));
-    }
-
-    phy_write(PHY_REG_BMCR, phy_data);
-
-    for(tout = 100; tout; tout--) { __NOP(); }     /* A short delay */
-
-    switch(phy_id) {
-    case DP83848C_ID:
-
-        phy_data = phy_read(PHY_REG_STS);
-
-        if(phy_data & PHY_STS_DUPLEX) {
-            LPC_EMAC->MAC2 |= MAC2_FULL_DUP;
-            LPC_EMAC->Command |= CR_FULL_DUP;
-            LPC_EMAC->IPGT = IPGT_FULL_DUP;
-        } else {
-        LPC_EMAC->MAC2 &= ~MAC2_FULL_DUP;
-            LPC_EMAC->Command &= ~CR_FULL_DUP;
-            LPC_EMAC->IPGT = IPGT_HALF_DUP;
-        }
-
-        if(phy_data & PHY_STS_SPEED) {
-            LPC_EMAC->SUPP &= ~SUPP_SPEED;
-        } else {
-            LPC_EMAC->SUPP |= SUPP_SPEED;
-        }
-
-
-        break;
-    case LAN8720_ID:
-
-        phy_data = phy_read(PHY_REG_SCSR);
-
-        if (phy_data & PHY_SCSR_DUPLEX) {
-            LPC_EMAC->MAC2 |= MAC2_FULL_DUP;
-            LPC_EMAC->Command |= CR_FULL_DUP;
-            LPC_EMAC->IPGT = IPGT_FULL_DUP;
-        } else {
-            LPC_EMAC->Command &= ~CR_FULL_DUP;
-            LPC_EMAC->IPGT = IPGT_HALF_DUP;
-        }
-
-        if(phy_data & PHY_SCSR_100MBIT) {
-            LPC_EMAC->SUPP |= SUPP_SPEED;
-        } else {
-            LPC_EMAC->SUPP &= ~SUPP_SPEED;
-        }
-
-
-        break;
-    }
-
-
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/gpio_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "gpio_api.h"
-#include "pinmap.h"
-
-uint32_t gpio_set(PinName pin) {
-    pin_function(pin, 0);
-    return (1 << ((int)pin & 0x1F));
-}
-
-void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) {
-    if(pin == NC) return;
-    
-    obj->pin = pin;
-    obj->mask = gpio_set(pin);
-    
-    LPC_GPIO_TypeDef *port_reg = (LPC_GPIO_TypeDef *) ((int)pin & ~0x1F);
-    obj->reg_set = &port_reg->FIOSET;
-    obj->reg_clr = &port_reg->FIOCLR;
-    obj->reg_in  = &port_reg->FIOPIN;
-    obj->reg_dir = &port_reg->FIODIR;
-    
-    gpio_dir(obj, direction);
-    switch (direction) {
-        case PIN_OUTPUT: pin_mode(pin, PullNone); break;
-        case PIN_INPUT : pin_mode(pin, PullDown); break;
-    }
-}
-
-void gpio_mode(gpio_t *obj, PinMode mode) {
-    pin_mode(obj->pin, mode);
-}
-
-void gpio_dir(gpio_t *obj, PinDirection direction) {
-    switch (direction) {
-        case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break;
-        case PIN_OUTPUT: *obj->reg_dir |=  obj->mask; break;
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/gpio_irq_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stddef.h>
-
-#include "gpio_irq_api.h"
-#include "error.h"
-#include "cmsis.h"
-
-#define CHANNEL_NUM     48
-
-static uint32_t channel_ids[CHANNEL_NUM] = {0};
-static gpio_irq_handler irq_handler;
-
-static void handle_interrupt_in(void) {
-    // Read in all current interrupt registers. We do this once as the
-    // GPIO interrupt registers are on the APB bus, and this is slow.
-    uint32_t rise0 = LPC_GPIOINT->IO0IntStatR;
-    uint32_t fall0 = LPC_GPIOINT->IO0IntStatF;
-    uint32_t rise2 = LPC_GPIOINT->IO2IntStatR;
-    uint32_t fall2 = LPC_GPIOINT->IO2IntStatF;
-    uint8_t bitloc;
-    
-    while(rise0 > 0) {      //Continue as long as there are interrupts pending
-        bitloc = 31 - __CLZ(rise0); //CLZ returns number of leading zeros, 31 minus that is location of first pending interrupt
-        if (channel_ids[bitloc] != 0)
-            irq_handler(channel_ids[bitloc], IRQ_RISE); //Run that interrupt
-        
-        //Both clear the interrupt with clear register, and remove it from our local copy of the interrupt pending register
-        LPC_GPIOINT->IO0IntClr = 1 << bitloc;
-        rise0 -= 1<<bitloc;
-    }
-    
-    while(fall0 > 0) {      //Continue as long as there are interrupts pending
-        bitloc = 31 - __CLZ(fall0); //CLZ returns number of leading zeros, 31 minus that is location of first pending interrupt
-        if (channel_ids[bitloc] != 0)
-            irq_handler(channel_ids[bitloc], IRQ_FALL); //Run that interrupt
-        
-        //Both clear the interrupt with clear register, and remove it from our local copy of the interrupt pending register
-        LPC_GPIOINT->IO0IntClr = 1 << bitloc;
-        fall0 -= 1<<bitloc;
-    }
-    
-    //Same for port 2, only we need to watch the channel_index
-    while(rise2 > 0) {      //Continue as long as there are interrupts pending
-        bitloc = 31 - __CLZ(rise2); //CLZ returns number of leading zeros, 31 minus that is location of first pending interrupt
-        
-        if (bitloc < 16)            //Not sure if this is actually needed
-            if (channel_ids[bitloc+32] != 0)
-                irq_handler(channel_ids[bitloc+32], IRQ_RISE); //Run that interrupt
-        
-        //Both clear the interrupt with clear register, and remove it from our local copy of the interrupt pending register
-        LPC_GPIOINT->IO2IntClr = 1 << bitloc;
-        rise2 -= 1<<bitloc;
-    }
-    
-    while(fall2 > 0) {      //Continue as long as there are interrupts pending
-        bitloc = 31 - __CLZ(fall2); //CLZ returns number of leading zeros, 31 minus that is location of first pending interrupt
-        
-        if (bitloc < 16)            //Not sure if this is actually needed
-            if (channel_ids[bitloc+32] != 0)
-                irq_handler(channel_ids[bitloc+32], IRQ_FALL); //Run that interrupt
-        
-        //Both clear the interrupt with clear register, and remove it from our local copy of the interrupt pending register
-        LPC_GPIOINT->IO2IntClr = 1 << bitloc;
-        fall2 -= 1<<bitloc;
-    }
-}
-
-int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id) {
-    if (pin == NC) return -1;
-    
-    irq_handler = handler;
-    
-    obj->port = (int)pin & ~0x1F;
-    obj->pin = (int)pin & 0x1F;
-    
-    // Interrupts available only on GPIO0 and GPIO2
-    if (obj->port != LPC_GPIO0_BASE && obj->port != LPC_GPIO2_BASE) {
-        error("pins on this port cannot generate interrupts\n");
-    }
-    
-    // put us in the interrupt table
-    int index = (obj->port == LPC_GPIO0_BASE) ? obj->pin : obj->pin + 32;
-    channel_ids[index] = id;
-    obj->ch = index;
-    
-    NVIC_SetVector(EINT3_IRQn, (uint32_t)handle_interrupt_in);
-    NVIC_EnableIRQ(EINT3_IRQn);
-    return 0;
-}
-
-void gpio_irq_free(gpio_irq_t *obj) {
-    channel_ids[obj->ch] = 0;
-}
-
-void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
-    // ensure nothing is pending
-    switch (obj->port) {
-         case LPC_GPIO0_BASE: LPC_GPIOINT->IO0IntClr = 1 << obj->pin; break;
-         case LPC_GPIO2_BASE: LPC_GPIOINT->IO2IntClr = 1 << obj->pin; break;
-    }
-
-    // enable the pin interrupt
-    if (event == IRQ_RISE) {
-        switch (obj->port) {
-            case LPC_GPIO0_BASE:
-                if (enable) {
-                    LPC_GPIOINT->IO0IntEnR |= 1 << obj->pin;
-                } else {
-                    LPC_GPIOINT->IO0IntEnR &= ~(1 << obj->pin);
-                }
-                break;
-            case LPC_GPIO2_BASE:
-                if (enable) {
-                    LPC_GPIOINT->IO2IntEnR |= 1 << obj->pin;
-                } else {
-                    LPC_GPIOINT->IO2IntEnR &= ~(1 << obj->pin);
-                }
-                break;
-        }
-    } else {
-        switch (obj->port) {
-            case LPC_GPIO0_BASE:
-                if (enable) {
-                    LPC_GPIOINT->IO0IntEnF |= 1 << obj->pin;
-                } else {
-                    LPC_GPIOINT->IO0IntEnF &= ~(1 << obj->pin);
-                }
-                break;
-            case LPC_GPIO2_BASE:
-                if (enable) {
-                    LPC_GPIOINT->IO2IntEnF |= 1 << obj->pin;
-                } else {
-                    LPC_GPIOINT->IO2IntEnF &= ~(1 << obj->pin);
-                }
-                break;
-        }
-    }
-}
-
-void gpio_irq_enable(gpio_irq_t *obj) {
-    NVIC_EnableIRQ(EINT3_IRQn);
-}
-
-void gpio_irq_disable(gpio_irq_t *obj) {
-    NVIC_DisableIRQ(EINT3_IRQn);
-}
-
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/gpio_object.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_GPIO_OBJECT_H
-#define MBED_GPIO_OBJECT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
-    PinName  pin;
-    uint32_t mask;
-
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_set;
-    __IO uint32_t *reg_clr;
-    __I  uint32_t *reg_in;
-} gpio_t;
-
-static inline void gpio_write(gpio_t *obj, int value) {
-    if (value)
-        *obj->reg_set = obj->mask;
-    else
-        *obj->reg_clr = obj->mask;
-}
-
-static inline int gpio_read(gpio_t *obj) {
-    return ((*obj->reg_in & obj->mask) ? 1 : 0);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/i2c_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,397 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "i2c_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_I2C_SDA[] = {
-    {P0_0 , I2C_1, 3},
-    {P0_10, I2C_2, 2},
-    {P0_19, I2C_1, 3},
-    {P0_27, I2C_0, 1},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_I2C_SCL[] = {
-    {P0_1 , I2C_1, 3},
-    {P0_11, I2C_2, 2},
-    {P0_20, I2C_1, 3},
-    {P0_28, I2C_0, 1},
-    {NC   , NC,    0}
-};
-
-#define I2C_CONSET(x)       (x->i2c->I2CONSET)
-#define I2C_CONCLR(x)       (x->i2c->I2CONCLR)
-#define I2C_STAT(x)         (x->i2c->I2STAT)
-#define I2C_DAT(x)          (x->i2c->I2DAT)
-#define I2C_SCLL(x, val)    (x->i2c->I2SCLL = val)
-#define I2C_SCLH(x, val)    (x->i2c->I2SCLH = val)
-
-static const uint32_t I2C_addr_offset[2][4] = {
-    {0x0C, 0x20, 0x24, 0x28},
-    {0x30, 0x34, 0x38, 0x3C}
-};
-
-static inline void i2c_conclr(i2c_t *obj, int start, int stop, int interrupt, int acknowledge) {
-    I2C_CONCLR(obj) = (start << 5)
-                    | (stop << 4)
-                    | (interrupt << 3)
-                    | (acknowledge << 2);
-}
-
-static inline void i2c_conset(i2c_t *obj, int start, int stop, int interrupt, int acknowledge) {
-    I2C_CONSET(obj) = (start << 5)
-                    | (stop << 4)
-                    | (interrupt << 3)
-                    | (acknowledge << 2);
-}
-
-// Clear the Serial Interrupt (SI)
-static inline void i2c_clear_SI(i2c_t *obj) {
-    i2c_conclr(obj, 0, 0, 1, 0);
-}
-
-static inline int i2c_status(i2c_t *obj) {
-    return I2C_STAT(obj);
-}
-
-// Wait until the Serial Interrupt (SI) is set
-static int i2c_wait_SI(i2c_t *obj) {
-    int timeout = 0;
-    while (!(I2C_CONSET(obj) & (1 << 3))) {
-        timeout++;
-        if (timeout > 100000) return -1;
-    }
-    return 0;
-}
-
-static inline void i2c_interface_enable(i2c_t *obj) {
-    I2C_CONSET(obj) = 0x40;
-}
-
-static inline void i2c_power_enable(i2c_t *obj) {
-    switch ((int)obj->i2c) {
-        case I2C_0: LPC_SC->PCONP |= 1 << 7; break;
-        case I2C_1: LPC_SC->PCONP |= 1 << 19; break;
-        case I2C_2: LPC_SC->PCONP |= 1 << 26; break;
-    }
-}
-
-void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
-    // determine the SPI to use
-    I2CName i2c_sda = (I2CName)pinmap_peripheral(sda, PinMap_I2C_SDA);
-    I2CName i2c_scl = (I2CName)pinmap_peripheral(scl, PinMap_I2C_SCL);
-    obj->i2c = (LPC_I2C_TypeDef *)pinmap_merge(i2c_sda, i2c_scl);
-    
-    if ((int)obj->i2c == NC) {
-        error("I2C pin mapping failed");
-    }
-    
-    // enable power
-    i2c_power_enable(obj);
-    
-    // set default frequency at 100k
-    i2c_frequency(obj, 100000);
-    i2c_conclr(obj, 1, 1, 1, 1);
-    i2c_interface_enable(obj);
-    
-    pinmap_pinout(sda, PinMap_I2C_SDA);
-    pinmap_pinout(scl, PinMap_I2C_SCL);
-}
-
-inline int i2c_start(i2c_t *obj) {
-    int status = 0;
-    // 8.1 Before master mode can be entered, I2CON must be initialised to:
-    //  - I2EN STA STO SI AA - -
-    //  -  1    0   0   0  x - -
-    // if AA = 0, it can't enter slave mode
-    i2c_conclr(obj, 1, 1, 1, 1);
-    
-    // The master mode may now be entered by setting the STA bit
-    // this will generate a start condition when the bus becomes free
-    i2c_conset(obj, 1, 0, 0, 1);
-    
-    i2c_wait_SI(obj);
-    status = i2c_status(obj);
-    
-    // Clear start bit now transmitted, and interrupt bit
-    i2c_conclr(obj, 1, 0, 0, 0);
-    return status;
-}
-
-inline int i2c_stop(i2c_t *obj) {
-    int timeout = 0;
-
-    // write the stop bit
-    i2c_conset(obj, 0, 1, 0, 0);
-    i2c_clear_SI(obj);
-    
-    // wait for STO bit to reset
-    while(I2C_CONSET(obj) & (1 << 4)) {
-        timeout ++;
-        if (timeout > 100000) return 1;
-    }
-
-    return 0;
-}
-
-static inline int i2c_do_write(i2c_t *obj, int value, uint8_t addr) {
-    // write the data
-    I2C_DAT(obj) = value;
-    
-    // clear SI to init a send
-    i2c_clear_SI(obj);
-    
-    // wait and return status
-    i2c_wait_SI(obj);
-    return i2c_status(obj);
-}
-
-static inline int i2c_do_read(i2c_t *obj, int last) {
-    // we are in state 0x40 (SLA+R tx'd) or 0x50 (data rx'd and ack)
-    if(last) {
-        i2c_conclr(obj, 0, 0, 0, 1); // send a NOT ACK
-    } else {
-        i2c_conset(obj, 0, 0, 0, 1); // send a ACK
-    }
-    
-    // accept byte
-    i2c_clear_SI(obj);
-    
-    // wait for it to arrive
-    i2c_wait_SI(obj);
-    
-    // return the data
-    return (I2C_DAT(obj) & 0xFF);
-}
-
-void i2c_frequency(i2c_t *obj, int hz) {
-    // [TODO] set pclk to /4
-    uint32_t PCLK = SystemCoreClock / 4;
-    
-    uint32_t pulse = PCLK / (hz * 2);
-    
-    // I2C Rate
-    I2C_SCLL(obj, pulse);
-    I2C_SCLH(obj, pulse);
-}
-
-// The I2C does a read or a write as a whole operation
-// There are two types of error conditions it can encounter
-//  1) it can not obtain the bus
-//  2) it gets error responses at part of the transmission
-//
-// We tackle them as follows:
-//  1) we retry until we get the bus. we could have a "timeout" if we can not get it
-//      which basically turns it in to a 2)
-//  2) on error, we use the standard error mechanisms to report/debug
-//
-// Therefore an I2C transaction should always complete. If it doesn't it is usually
-// because something is setup wrong (e.g. wiring), and we don't need to programatically
-// check for that
-
-int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) {
-    int count, status;
-    
-    status = i2c_start(obj);
-    
-    if ((status != 0x10) && (status != 0x08)) {
-        i2c_stop(obj);
-        return I2C_ERROR_BUS_BUSY;
-    }
-    
-    status = i2c_do_write(obj, (address | 0x01), 1);
-    if (status != 0x40) {
-        i2c_stop(obj);
-        return I2C_ERROR_NO_SLAVE;
-    }
-    
-    // Read in all except last byte
-    for (count = 0; count < (length - 1); count++) {
-        int value = i2c_do_read(obj, 0);
-        status = i2c_status(obj);
-        if (status != 0x50) {
-            i2c_stop(obj);
-            return count;
-        }
-        data[count] = (char) value;
-    }
-    
-    // read in last byte
-    int value = i2c_do_read(obj, 1);
-    status = i2c_status(obj);
-    if (status != 0x58) {
-        i2c_stop(obj);
-        return length - 1;
-    }
-    
-    data[count] = (char) value;
-    
-    // If not repeated start, send stop.
-    if (stop) {
-        i2c_stop(obj);
-    }
-    
-    return length;
-}
-
-int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) {
-    int i, status;
-    
-    status = i2c_start(obj);
-    
-    if ((status != 0x10) && (status != 0x08)) {
-        i2c_stop(obj);
-        return I2C_ERROR_BUS_BUSY;
-    }
-    
-    status = i2c_do_write(obj, (address & 0xFE), 1);
-    if (status != 0x18) {
-        i2c_stop(obj);
-        return I2C_ERROR_NO_SLAVE;
-    }
-    
-    for (i=0; i<length; i++) {
-        status = i2c_do_write(obj, data[i], 0);
-        if(status != 0x28) {
-            i2c_stop(obj);
-            return i;
-        }
-    }
-    
-    // clearing the serial interrupt here might cause an unintended rewrite of the last byte
-    // see also issue report https://mbed.org/users/mbed_official/code/mbed/issues/1
-    // i2c_clear_SI(obj);
-    
-    // If not repeated start, send stop.
-    if (stop) {
-        i2c_stop(obj);
-    }
-    
-    return length;
-}
-
-void i2c_reset(i2c_t *obj) {
-    i2c_stop(obj);
-}
-
-int i2c_byte_read(i2c_t *obj, int last) {
-    return (i2c_do_read(obj, last) & 0xFF);
-}
-
-int i2c_byte_write(i2c_t *obj, int data) {
-    int ack;
-    int status = i2c_do_write(obj, (data & 0xFF), 0);
-    
-    switch(status) {
-        case 0x18: case 0x28:       // Master transmit ACKs
-            ack = 1;
-            break;
-        case 0x40:                  // Master receive address transmitted ACK
-            ack = 1;
-            break;
-        case 0xB8:                  // Slave transmit ACK
-            ack = 1;
-            break;
-        default:
-            ack = 0;
-            break;
-    }
-    
-    return ack;
-}
-
-void i2c_slave_mode(i2c_t *obj, int enable_slave) {
-    if (enable_slave != 0) {
-        i2c_conclr(obj, 1, 1, 1, 0);
-        i2c_conset(obj, 0, 0, 0, 1);
-    } else {
-        i2c_conclr(obj, 1, 1, 1, 1);
-    }
-}
-
-int i2c_slave_receive(i2c_t *obj) {
-    int status;
-    int retval;
-    
-    status = i2c_status(obj);
-    switch(status) {
-        case 0x60: retval = 3; break;
-        case 0x70: retval = 2; break;
-        case 0xA8: retval = 1; break;
-        default  : retval = 0; break;
-    }
-    
-    return(retval);
-}
-
-int i2c_slave_read(i2c_t *obj, char *data, int length) {
-    int count = 0;
-    int status;
-    
-    do {
-        i2c_clear_SI(obj);
-        i2c_wait_SI(obj);
-        status = i2c_status(obj);
-        if((status == 0x80) || (status == 0x90)) {
-            data[count] = I2C_DAT(obj) & 0xFF;
-        }
-        count++;
-    } while (((status == 0x80) || (status == 0x90) ||
-            (status == 0x060) || (status == 0x70)) && (count < length));
-    
-    if(status != 0xA0) {
-        i2c_stop(obj);
-    }
-    
-    i2c_clear_SI(obj);
-    
-    return count;
-}
-
-int i2c_slave_write(i2c_t *obj, const char *data, int length) {
-    int count = 0;
-    int status;
-    
-    if(length <= 0) {
-        return(0);
-    }
-    
-    do {
-        status = i2c_do_write(obj, data[count], 0);
-        count++;
-    } while ((count < length) && (status == 0xB8));
-    
-    if ((status != 0xC0) && (status != 0xC8)) {
-        i2c_stop(obj);
-    }
-    
-    i2c_clear_SI(obj);
-    
-    return(count);
-}
-
-void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask) {
-    uint32_t addr;
-    
-    if ((idx >= 0) && (idx <= 3)) {
-        addr = ((uint32_t)obj->i2c) + I2C_addr_offset[0][idx];
-        *((uint32_t *) addr) = address & 0xFF;
-        addr = ((uint32_t)obj->i2c) + I2C_addr_offset[1][idx];
-        *((uint32_t *) addr) = mask & 0xFE;
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/objects.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_OBJECTS_H
-#define MBED_OBJECTS_H
-
-#include "cmsis.h"
-#include "PortNames.h"
-#include "PeripheralNames.h"
-#include "PinNames.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct gpio_irq_s {
-    uint32_t port;
-    uint32_t pin;
-    uint32_t ch;
-};
-
-struct port_s {
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_out;
-    __I  uint32_t *reg_in;
-    PortName port;
-    uint32_t mask;
-};
-
-struct pwmout_s {
-    __IO uint32_t *MR;
-    PWMName pwm;
-};
-
-struct serial_s {
-    LPC_UART_TypeDef *uart;
-    int index;
-    uint8_t count;
-};
-
-struct analogin_s {
-    ADCName adc;
-};
-
-struct dac_s {
-    DACName dac;
-};
-
-struct can_s {
-    LPC_CAN_TypeDef *dev;
-    int index;
-};
-
-struct i2c_s {
-    LPC_I2C_TypeDef *i2c;
-};
-
-struct spi_s {
-    LPC_SSP_TypeDef *spi;
-};
-
-#include "gpio_object.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/pinmap.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "pinmap.h"
-#include "error.h"
-
-void pin_function(PinName pin, int function) {
-    if (pin == (PinName)NC) return;
-    
-    uint32_t pin_number = (uint32_t)pin - (uint32_t)P0_0;
-    int index = pin_number >> 4;
-    int offset = (pin_number & 0xF) << 1;
-    
-    PINCONARRAY->PINSEL[index] &= ~(0x3 << offset);
-    PINCONARRAY->PINSEL[index] |= function << offset;
-}
-
-void pin_mode(PinName pin, PinMode mode) {
-    if (pin == (PinName)NC) { return; }
-    
-    uint32_t pin_number = (uint32_t)pin - (uint32_t)P0_0;
-    int index = pin_number >> 5;
-    int offset = pin_number & 0x1F;
-    uint32_t drain = ((uint32_t) mode & (uint32_t) OpenDrain) >> 2;
-    
-    PINCONARRAY->PINMODE_OD[index] &= ~(drain << offset);
-    PINCONARRAY->PINMODE_OD[index] |= drain << offset;
-    
-    if (!drain) {
-        index = pin_number >> 4;
-        offset = (pin_number & 0xF) << 1;
-        
-        PINCONARRAY->PINMODE[index] &= ~(0x3 << offset);
-        PINCONARRAY->PINMODE[index] |= (uint32_t)mode << offset;
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/port_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "port_api.h"
-#include "pinmap.h"
-#include "gpio_api.h"
-
-PinName port_pin(PortName port, int pin_n) {
-    return (PinName)(LPC_GPIO0_BASE + ((port << PORT_SHIFT) | pin_n));
-}
-
-void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
-    obj->port = port;
-    obj->mask = mask;
-    
-    LPC_GPIO_TypeDef *port_reg = (LPC_GPIO_TypeDef *)(LPC_GPIO0_BASE + ((int)port * 0x20));
-    
-    // Do not use masking, because it prevents the use of the unmasked pins
-    // port_reg->FIOMASK = ~mask;
-    
-    obj->reg_out = &port_reg->FIOPIN;
-    obj->reg_in  = &port_reg->FIOPIN;
-    obj->reg_dir  = &port_reg->FIODIR;
-    
-    uint32_t i;
-    // The function is set per pin: reuse gpio logic
-    for (i=0; i<32; i++) {
-        if (obj->mask & (1<<i)) {
-            gpio_set(port_pin(obj->port, i));
-        }
-    }
-
-    port_dir(obj, dir);
-}
-
-void port_mode(port_t *obj, PinMode mode) {
-    uint32_t i;
-    // The mode is set per pin: reuse pinmap logic
-    for (i=0; i<32; i++) {
-        if (obj->mask & (1<<i)) {
-            pin_mode(port_pin(obj->port, i), mode);
-        }
-    }
-}
-
-void port_dir(port_t *obj, PinDirection dir) {
-    switch (dir) {
-        case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break;
-        case PIN_OUTPUT: *obj->reg_dir |=  obj->mask; break;
-    }
-}
-
-void port_write(port_t *obj, int value) {
-    *obj->reg_out = (*obj->reg_in & ~obj->mask) | (value & obj->mask);
-}
-
-int port_read(port_t *obj) {
-    return (*obj->reg_in & obj->mask);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/pwmout_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "pwmout_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-#define TCR_CNT_EN       0x00000001
-#define TCR_RESET        0x00000002
-
-//  PORT ID, PWM ID, Pin function
-static const PinMap PinMap_PWM[] = {
-    {P1_18, PWM_1, 2},
-    {P1_20, PWM_2, 2},
-    {P1_21, PWM_3, 2},
-    {P1_23, PWM_4, 2},
-    {P1_24, PWM_5, 2},
-    {P1_26, PWM_6, 2},
-    {P2_0 , PWM_1, 1},
-    {P2_1 , PWM_2, 1},
-    {P2_2 , PWM_3, 1},
-    {P2_3 , PWM_4, 1},
-    {P2_4 , PWM_5, 1},
-    {P2_5 , PWM_6, 1},
-    {P3_25, PWM_2, 3},
-    {P3_26, PWM_3, 3},
-    {NC, NC, 0}
-};
-
-__IO uint32_t *PWM_MATCH[] = {
-    &(LPC_PWM1->MR0),
-    &(LPC_PWM1->MR1),
-    &(LPC_PWM1->MR2),
-    &(LPC_PWM1->MR3),
-    &(LPC_PWM1->MR4),
-    &(LPC_PWM1->MR5),
-    &(LPC_PWM1->MR6)
-};
-
-#define TCR_PWM_EN       0x00000008
-
-static unsigned int pwm_clock_mhz;
-
-void pwmout_init(pwmout_t* obj, PinName pin) {
-    // determine the channel
-    PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM);
-    if (pwm == (PWMName)NC)
-        error("PwmOut pin mapping failed");
-    
-    obj->pwm = pwm;
-    obj->MR = PWM_MATCH[pwm];
-    
-    // ensure the power is on
-    LPC_SC->PCONP |= 1 << 6;
-    
-    // ensure clock to /4
-    LPC_SC->PCLKSEL0 &= ~(0x3 << 12);     // pclk = /4
-    LPC_PWM1->PR = 0;                     // no pre-scale
-    
-    // ensure single PWM mode
-    LPC_PWM1->MCR = 1 << 1; // reset TC on match 0
-    
-    // enable the specific PWM output
-    LPC_PWM1->PCR |= 1 << (8 + pwm);
-    
-    pwm_clock_mhz = SystemCoreClock / 4000000;
-    
-    // default to 20ms: standard for servos, and fine for e.g. brightness control
-    pwmout_period_ms(obj, 20);
-    pwmout_write    (obj, 0);
-    
-    // Wire pinout
-    pinmap_pinout(pin, PinMap_PWM);
-}
-
-void pwmout_free(pwmout_t* obj) {
-    // [TODO]
-}
-
-void pwmout_write(pwmout_t* obj, float value) {
-    if (value < 0.0f) {
-        value = 0.0;
-    } else if (value > 1.0f) {
-        value = 1.0;
-    }
-    
-    // set channel match to percentage
-    uint32_t v = (uint32_t)((float)(LPC_PWM1->MR0) * value);
-    
-    // workaround for PWM1[1] - Never make it equal MR0, else we get 1 cycle dropout
-    if (v == LPC_PWM1->MR0) {
-        v++;
-    }
-    
-    *obj->MR = v;
-    
-    // accept on next period start
-    LPC_PWM1->LER |= 1 << obj->pwm;
-}
-
-float pwmout_read(pwmout_t* obj) {
-    float v = (float)(*obj->MR) / (float)(LPC_PWM1->MR0);
-    return (v > 1.0f) ? (1.0f) : (v);
-}
-
-void pwmout_period(pwmout_t* obj, float seconds) {
-    pwmout_period_us(obj, seconds * 1000000.0f);
-}
-
-void pwmout_period_ms(pwmout_t* obj, int ms) {
-    pwmout_period_us(obj, ms * 1000);
-}
-
-// Set the PWM period, keeping the duty cycle the same.
-void pwmout_period_us(pwmout_t* obj, int us) {
-    // calculate number of ticks
-    uint32_t ticks = pwm_clock_mhz * us;
-
-    // set reset
-    LPC_PWM1->TCR = TCR_RESET;
-
-    // set the global match register
-    LPC_PWM1->MR0 = ticks;
-
-    // Scale the pulse width to preserve the duty ratio
-    if (LPC_PWM1->MR0 > 0) {
-        *obj->MR = (*obj->MR * ticks) / LPC_PWM1->MR0;
-    }
-
-    // set the channel latch to update value at next period start
-    LPC_PWM1->LER |= 1 << 0;
-
-    // enable counter and pwm, clear reset
-    LPC_PWM1->TCR = TCR_CNT_EN | TCR_PWM_EN;
-}
-
-void pwmout_pulsewidth(pwmout_t* obj, float seconds) {
-    pwmout_pulsewidth_us(obj, seconds * 1000000.0f);
-}
-
-void pwmout_pulsewidth_ms(pwmout_t* obj, int ms) {
-    pwmout_pulsewidth_us(obj, ms * 1000);
-}
-
-void pwmout_pulsewidth_us(pwmout_t* obj, int us) {
-    // calculate number of ticks
-    uint32_t v = pwm_clock_mhz * us;
-    
-    // workaround for PWM1[1] - Never make it equal MR0, else we get 1 cycle dropout
-    if (v == LPC_PWM1->MR0) {
-        v++;
-    }
-    
-    // set the match register value
-    *obj->MR = v;
-    
-    // set the channel latch to update value at next period start
-    LPC_PWM1->LER |= 1 << obj->pwm;
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/rtc_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "rtc_api.h"
-
-// ensure rtc is running (unchanged if already running)
-
-/* Setup the RTC based on a time structure, ensuring RTC is enabled
- *
- * Can be clocked by a 32.768KHz oscillator or prescale divider based on the APB clock
- * - We want to use the 32khz clock, allowing for sleep mode
- *
- * Most registers are not changed by a Reset
- * - We must initialize these registers between power-on and setting the RTC into operation
-
- * Clock Control Register
- *  RTC_CCR[0] : Enable - 0 = Disabled, 1 = Enabled
- *  RTC_CCR[1] : Reset - 0 = Normal, 1 = Reset
- *  RTC_CCR[4] : Clock Source - 0 = Prescaler, 1 = 32k Xtal
- *
- * The RTC may already be running, so we should set it up
- * without impacting if it is the case
- */
-void rtc_init(void) {
-    LPC_SC->PCONP |= 0x200; // Ensure power is on
-    LPC_RTC->CCR = 0x00;
-    
-    LPC_RTC->CCR |= 1 << 0; // Ensure the RTC is enabled
-}
-
-void rtc_free(void) {
-    // [TODO]
-}
-
-/*
- * Little check routine to see if the RTC has been enabled
- *
- * Clock Control Register
- *  RTC_CCR[0] : 0 = Disabled, 1 = Enabled
- *
- */
-int rtc_isenabled(void) {
-    return(((LPC_RTC->CCR) & 0x01) != 0);
-}
-
-/*
- * RTC Registers
- *  RTC_SEC        Seconds 0-59
- *  RTC_MIN        Minutes 0-59
- *  RTC_HOUR    Hour 0-23
- *  RTC_DOM        Day of Month 1-28..31
- *  RTC_DOW        Day of Week 0-6
- *  RTC_DOY        Day of Year 1-365
- *  RTC_MONTH    Month 1-12
- *  RTC_YEAR    Year 0-4095
- *
- * struct tm
- *  tm_sec        seconds after the minute 0-61
- *  tm_min        minutes after the hour 0-59
- *  tm_hour        hours since midnight 0-23
- *  tm_mday        day of the month 1-31
- *  tm_mon        months since January 0-11
- *  tm_year        years since 1900
- *  tm_wday        days since Sunday 0-6
- *  tm_yday        days since January 1 0-365
- *  tm_isdst    Daylight Saving Time flag
- */
-time_t rtc_read(void) {
-    // Setup a tm structure based on the RTC
-    struct tm timeinfo;
-    timeinfo.tm_sec = LPC_RTC->SEC;
-    timeinfo.tm_min = LPC_RTC->MIN;
-    timeinfo.tm_hour = LPC_RTC->HOUR;
-    timeinfo.tm_mday = LPC_RTC->DOM;
-    timeinfo.tm_mon = LPC_RTC->MONTH - 1;
-    timeinfo.tm_year = LPC_RTC->YEAR - 1900;
-    
-    // Convert to timestamp
-    time_t t = mktime(&timeinfo);
-    
-    return t;
-}
-
-void rtc_write(time_t t) {
-    // Convert the time in to a tm
-    struct tm *timeinfo = localtime(&t);
-    
-    // Pause clock, and clear counter register (clears us count)
-    LPC_RTC->CCR |= 2;
-    
-    // Set the RTC
-    LPC_RTC->SEC = timeinfo->tm_sec;
-    LPC_RTC->MIN = timeinfo->tm_min;
-    LPC_RTC->HOUR = timeinfo->tm_hour;
-    LPC_RTC->DOM = timeinfo->tm_mday;
-    LPC_RTC->MONTH = timeinfo->tm_mon + 1;
-    LPC_RTC->YEAR = timeinfo->tm_year + 1900;
-    
-    // Restart clock
-    LPC_RTC->CCR &= ~((uint32_t)2);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/serial_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,322 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// math.h required for floating point operations for baud rate calculation
-#include <math.h>
-#include <string.h>
-
-#include "serial_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-/******************************************************************************
- * INITIALIZATION
- ******************************************************************************/
-#define UART_NUM    4
-
-static const PinMap PinMap_UART_TX[] = {
-    {P0_0,  UART_3, 2},
-    {P0_2,  UART_0, 1},
-    {P0_10, UART_2, 1},
-    {P0_15, UART_1, 1},
-    {P0_25, UART_3, 3},
-    {P2_0 , UART_1, 2},
-    {P2_8 , UART_2, 2},
-    {P4_28, UART_3, 3},
-    {NC   , NC    , 0}
-};
-
-static const PinMap PinMap_UART_RX[] = {
-    {P0_1 , UART_3, 2},
-    {P0_3 , UART_0, 1},
-    {P0_11, UART_2, 1},
-    {P0_16, UART_1, 1},
-    {P0_26, UART_3, 3},
-    {P2_1 , UART_1, 2},
-    {P2_9 , UART_2, 2},
-    {P4_29, UART_3, 3},
-    {NC   , NC    , 0}
-};
-
-static uint32_t serial_irq_ids[UART_NUM] = {0};
-static uart_irq_handler irq_handler;
-
-int stdio_uart_inited = 0;
-serial_t stdio_uart;
-
-void serial_init(serial_t *obj, PinName tx, PinName rx) {
-    int is_stdio_uart = 0;
-    
-    // determine the UART to use
-    UARTName uart_tx = (UARTName)pinmap_peripheral(tx, PinMap_UART_TX);
-    UARTName uart_rx = (UARTName)pinmap_peripheral(rx, PinMap_UART_RX);
-    UARTName uart = (UARTName)pinmap_merge(uart_tx, uart_rx);
-    if ((int)uart == NC) {
-        error("Serial pinout mapping failed");
-    }
-    
-    obj->uart = (LPC_UART_TypeDef *)uart;
-    // enable power
-    switch (uart) {
-        case UART_0: LPC_SC->PCONP |= 1 <<  3; break;
-        case UART_1: LPC_SC->PCONP |= 1 <<  4; break;
-        case UART_2: LPC_SC->PCONP |= 1 << 24; break;
-        case UART_3: LPC_SC->PCONP |= 1 << 25; break;
-    }
-    
-    // enable fifos and default rx trigger level
-    obj->uart->FCR = 1 << 0  // FIFO Enable - 0 = Disables, 1 = Enabled
-                   | 0 << 1  // Rx Fifo Reset
-                   | 0 << 2  // Tx Fifo Reset
-                   | 0 << 6; // Rx irq trigger level - 0 = 1 char, 1 = 4 chars, 2 = 8 chars, 3 = 14 chars
-
-    // disable irqs
-    obj->uart->IER = 0 << 0  // Rx Data available irq enable
-                   | 0 << 1  // Tx Fifo empty irq enable
-                   | 0 << 2; // Rx Line Status irq enable
-    
-    // set default baud rate and format
-    serial_baud  (obj, 9600);
-    serial_format(obj, 8, ParityNone, 1);
-    
-    // pinout the chosen uart
-    pinmap_pinout(tx, PinMap_UART_TX);
-    pinmap_pinout(rx, PinMap_UART_RX);
-    
-    // set rx/tx pins in PullUp mode
-    pin_mode(tx, PullUp);
-    pin_mode(rx, PullUp);
-    
-    switch (uart) {
-        case UART_0: obj->index = 0; break;
-        case UART_1: obj->index = 1; break;
-        case UART_2: obj->index = 2; break;
-        case UART_3: obj->index = 3; break;
-    }
-    obj->count = 0;
-    
-    is_stdio_uart = (uart == STDIO_UART) ? (1) : (0);
-    
-    if (is_stdio_uart) {
-        stdio_uart_inited = 1;
-        memcpy(&stdio_uart, obj, sizeof(serial_t));
-    }
-}
-
-void serial_free(serial_t *obj) {
-    serial_irq_ids[obj->index] = 0;
-}
-
-// serial_baud
-// set the baud rate, taking in to account the current SystemFrequency
-void serial_baud(serial_t *obj, int baudrate) {
-    // The LPC2300 and LPC1700 have a divider and a fractional divider to control the
-    // baud rate. The formula is:
-    //
-    // Baudrate = (1 / PCLK) * 16 * DL * (1 + DivAddVal / MulVal)
-    //   where:
-    //     1 < MulVal <= 15
-    //     0 <= DivAddVal < 14
-    //     DivAddVal < MulVal
-    //
-    // set pclk to /1
-    switch ((int)obj->uart) {
-        case UART_0: LPC_SC->PCLKSEL0 &= ~(0x3 <<  6); LPC_SC->PCLKSEL0 |= (0x1 <<  6); break;
-        case UART_1: LPC_SC->PCLKSEL0 &= ~(0x3 <<  8); LPC_SC->PCLKSEL0 |= (0x1 <<  8); break;
-        case UART_2: LPC_SC->PCLKSEL1 &= ~(0x3 << 16); LPC_SC->PCLKSEL1 |= (0x1 << 16); break;
-        case UART_3: LPC_SC->PCLKSEL1 &= ~(0x3 << 18); LPC_SC->PCLKSEL1 |= (0x1 << 18); break;
-        default: error("serial_baud"); break;
-    }
-    
-    uint32_t PCLK = SystemCoreClock;
-    
-    // First we check to see if the basic divide with no DivAddVal/MulVal
-    // ratio gives us an integer result. If it does, we set DivAddVal = 0,
-    // MulVal = 1. Otherwise, we search the valid ratio value range to find
-    // the closest match. This could be more elegant, using search methods
-    // and/or lookup tables, but the brute force method is not that much
-    // slower, and is more maintainable.
-    uint16_t DL = PCLK / (16 * baudrate);
-
-    uint8_t DivAddVal = 0;
-    uint8_t MulVal = 1;
-    int hit = 0;
-    uint16_t dlv;
-    uint8_t mv, dav;
-    if ((PCLK % (16 * baudrate)) != 0) {     // Checking for zero remainder
-        float err_best = (float) baudrate;
-        uint16_t dlmax = DL;
-        for ( dlv = (dlmax/2); (dlv <= dlmax) && !hit; dlv++) {
-            for ( mv = 1; mv <= 15; mv++) {
-                for ( dav = 1; dav < mv; dav++) {
-                    float ratio = 1.0f + ((float) dav / (float) mv);
-                    float calcbaud = (float)PCLK / (16.0f * (float) dlv * ratio);
-                    float err = fabs(((float) baudrate - calcbaud) / (float) baudrate);
-                    if (err < err_best) {
-                        DL = dlv;
-                        DivAddVal = dav;
-                        MulVal = mv;
-                        err_best = err;
-                        if (err < 0.001f) {
-                            hit = 1;
-                        }
-                    }
-                }
-            }
-        }
-    }
-    
-    // set LCR[DLAB] to enable writing to divider registers
-    obj->uart->LCR |= (1 << 7);
-    
-    // set divider values
-    obj->uart->DLM = (DL >> 8) & 0xFF;
-    obj->uart->DLL = (DL >> 0) & 0xFF;
-    obj->uart->FDR = (uint32_t) DivAddVal << 0
-                   | (uint32_t) MulVal    << 4;
-    
-    // clear LCR[DLAB]
-    obj->uart->LCR &= ~(1 << 7);
-}
-
-void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits) {
-    // 0: 1 stop bits, 1: 2 stop bits
-    if (stop_bits != 1 && stop_bits != 2) {
-        error("Invalid stop bits specified");
-    }
-    stop_bits -= 1;
-    
-    // 0: 5 data bits ... 3: 8 data bits
-    if (data_bits < 5 || data_bits > 8) {
-        error("Invalid number of bits (%d) in serial format, should be 5..8", data_bits);
-    }
-    data_bits -= 5;
-
-    int parity_enable, parity_select;
-    switch (parity) {
-        case ParityNone: parity_enable = 0; parity_select = 0; break;
-        case ParityOdd : parity_enable = 1; parity_select = 0; break;
-        case ParityEven: parity_enable = 1; parity_select = 1; break;
-        case ParityForced1: parity_enable = 1; parity_select = 2; break;
-        case ParityForced0: parity_enable = 1; parity_select = 3; break;
-        default:
-            error("Invalid serial parity setting");
-            return;
-    }
-    
-    obj->uart->LCR = data_bits            << 0
-                   | stop_bits            << 2
-                   | parity_enable        << 3
-                   | parity_select        << 4;
-}
-
-/******************************************************************************
- * INTERRUPTS HANDLING
- ******************************************************************************/
-static inline void uart_irq(uint32_t iir, uint32_t index) {
-    // [Chapter 14] LPC17xx UART0/2/3: UARTn Interrupt Handling
-    SerialIrq irq_type;
-    switch (iir) {
-        case 1: irq_type = TxIrq; break;
-        case 2: irq_type = RxIrq; break;
-        default: return;
-    }
-    
-    if (serial_irq_ids[index] != 0)
-        irq_handler(serial_irq_ids[index], irq_type);
-}
-
-void uart0_irq() {uart_irq((LPC_UART0->IIR >> 1) & 0x7, 0);}
-void uart1_irq() {uart_irq((LPC_UART1->IIR >> 1) & 0x7, 1);}
-void uart2_irq() {uart_irq((LPC_UART2->IIR >> 1) & 0x7, 2);}
-void uart3_irq() {uart_irq((LPC_UART3->IIR >> 1) & 0x7, 3);}
-
-void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id) {
-    irq_handler = handler;
-    serial_irq_ids[obj->index] = id;
-}
-
-void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) {
-    IRQn_Type irq_n = (IRQn_Type)0;
-    uint32_t vector = 0;
-    switch ((int)obj->uart) {
-        case UART_0: irq_n=UART0_IRQn; vector = (uint32_t)&uart0_irq; break;
-        case UART_1: irq_n=UART1_IRQn; vector = (uint32_t)&uart1_irq; break;
-        case UART_2: irq_n=UART2_IRQn; vector = (uint32_t)&uart2_irq; break;
-        case UART_3: irq_n=UART3_IRQn; vector = (uint32_t)&uart3_irq; break;
-    }
-    
-    if (enable) {
-        obj->uart->IER |= 1 << irq;
-        NVIC_SetVector(irq_n, vector);
-        NVIC_EnableIRQ(irq_n);
-    } else { // disable
-        int all_disabled = 0;
-        SerialIrq other_irq = (irq == RxIrq) ? (TxIrq) : (RxIrq);
-        obj->uart->IER &= ~(1 << irq);
-        all_disabled = (obj->uart->IER & (1 << other_irq)) == 0;
-        if (all_disabled)
-            NVIC_DisableIRQ(irq_n);
-    }
-}
-
-/******************************************************************************
- * READ/WRITE
- ******************************************************************************/
-int serial_getc(serial_t *obj) {
-    while (!serial_readable(obj));
-    return obj->uart->RBR;
-}
-
-void serial_putc(serial_t *obj, int c) {
-    while (!serial_writable(obj));
-    obj->uart->THR = c;
-    obj->count++;
-}
-
-int serial_readable(serial_t *obj) {
-    return obj->uart->LSR & 0x01;
-}
-
-int serial_writable(serial_t *obj) {
-    int isWritable = 1;
-    if (obj->uart->LSR & 0x20)
-        obj->count = 0;
-    else if (obj->count >= 16)
-        isWritable = 0;
-        
-    return isWritable;
-}
-
-void serial_clear(serial_t *obj) {
-    obj->uart->FCR = 1 << 0  // FIFO Enable - 0 = Disables, 1 = Enabled
-                   | 1 << 1  // rx FIFO reset
-                   | 1 << 2  // tx FIFO reset
-                   | 0 << 6; // interrupt depth
-}
-
-void serial_pinout_tx(PinName tx) {
-    pinmap_pinout(tx, PinMap_UART_TX);
-}
-
-void serial_break_set(serial_t *obj) {
-    obj->uart->LCR |= (1 << 6);
-}
-
-void serial_break_clear(serial_t *obj) {
-    obj->uart->LCR &= ~(1 << 6);
-}
-
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/sleep.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "sleep_api.h"
-#include "cmsis.h"
-#include "mbed_interface.h"
-
-void sleep(void) {
-    // ensure debug is disconnected
-    mbed_interface_disconnect();
-    
-    // PCON[PD] set to sleep
-    LPC_SC->PCON = 0x0;
-    
-    // SRC[SLEEPDEEP] set to 0 = sleep
-    SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk;
-    
-    // wait for interrupt
-    __WFI();
-}
-
-/*
-* The mbed lpc1768 does not support the deepsleep mode
-* as a debugger is connected to it (the mbed interface).
-*
-* As mentionned in an application note from NXP:
-*
-*       http://www.po-star.com/public/uploads/20120319123122_141.pdf
-*
-*       {{{
-*       The user should be aware of certain limitations during debugging.
-*       The most important is that, due to limitations of the Cortex-M3
-*       integration, the LPC17xx cannot wake up in the usual manner from
-*       Deep Sleep and Power-down modes. It is recommended not to use these
-*       modes during debug. Once an application is downloaded via JTAG/SWD
-*       interface, the USB to SWD/JTAG debug adapter (Keil ULINK2 for example)
-*       should be removed from the target board, and thereafter, power cycle
-*       the LPC17xx to allow wake-up from deep sleep and power-down modes
-*       }}}
-*
-*       As the interface firmware does not reset the target when a
-*       mbed_interface_disconnect() semihosting call is made, the
-*       core cannot wake-up from deepsleep.
-*
-*       We treat a deepsleep() as a normal sleep().
-*/
-
-void deepsleep(void) {
-    // ensure debug is disconnected
-    mbed_interface_disconnect();
-    
-    // PCON[PD] set to deepsleep
-    sleep();
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/spi_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,222 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <math.h>
-
-#include "spi_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_SPI_SCLK[] = {
-    {P0_7 , SPI_1, 2},
-    {P0_15, SPI_0, 2},
-    {P1_20, SPI_0, 3},
-    {P1_31, SPI_1, 2},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_MOSI[] = {
-    {P0_9 , SPI_1, 2},
-    {P0_13, SPI_1, 2},
-    {P0_18, SPI_0, 2},
-    {P1_24, SPI_0, 3},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_MISO[] = {
-    {P0_8 , SPI_1, 2},
-    {P0_12, SPI_1, 2},
-    {P0_17, SPI_0, 2},
-    {P1_23, SPI_0, 3},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_SSEL[] = {
-    {P0_6 , SPI_1, 2},
-    {P0_11, SPI_1, 2},
-    {P0_16, SPI_0, 2},
-    {P1_21, SPI_0, 3},
-    {NC   , NC   , 0}
-};
-
-static inline int ssp_disable(spi_t *obj);
-static inline int ssp_enable(spi_t *obj);
-
-void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel) {
-    // determine the SPI to use
-    SPIName spi_mosi = (SPIName)pinmap_peripheral(mosi, PinMap_SPI_MOSI);
-    SPIName spi_miso = (SPIName)pinmap_peripheral(miso, PinMap_SPI_MISO);
-    SPIName spi_sclk = (SPIName)pinmap_peripheral(sclk, PinMap_SPI_SCLK);
-    SPIName spi_ssel = (SPIName)pinmap_peripheral(ssel, PinMap_SPI_SSEL);
-    SPIName spi_data = (SPIName)pinmap_merge(spi_mosi, spi_miso);
-    SPIName spi_cntl = (SPIName)pinmap_merge(spi_sclk, spi_ssel);
-    obj->spi = (LPC_SSP_TypeDef*)pinmap_merge(spi_data, spi_cntl);
-    if ((int)obj->spi == NC) {
-        error("SPI pinout mapping failed");
-    }
-    
-    // enable power and clocking
-    switch ((int)obj->spi) {
-        case SPI_0: LPC_SC->PCONP |= 1 << 21; break;
-        case SPI_1: LPC_SC->PCONP |= 1 << 10; break;
-    }
-    
-    // set default format and frequency
-    if (ssel == NC) {
-        spi_format(obj, 8, 0, 0);  // 8 bits, mode 0, master
-    } else {
-        spi_format(obj, 8, 0, 1);  // 8 bits, mode 0, slave
-    }
-    spi_frequency(obj, 1000000);
-    
-    // enable the ssp channel
-    ssp_enable(obj);
-
-    // pin out the spi pins
-    pinmap_pinout(mosi, PinMap_SPI_MOSI);
-    pinmap_pinout(miso, PinMap_SPI_MISO);
-    pinmap_pinout(sclk, PinMap_SPI_SCLK);
-    if (ssel != NC) {
-        pinmap_pinout(ssel, PinMap_SPI_SSEL);
-    }
-}
-
-void spi_free(spi_t *obj) {}
-
-void spi_format(spi_t *obj, int bits, int mode, int slave) {
-    ssp_disable(obj);
-    if (!(bits >= 4 && bits <= 16) || !(mode >= 0 && mode <= 3)) {
-        error("SPI format error");
-    }
-    
-    int polarity = (mode & 0x2) ? 1 : 0;
-    int phase = (mode & 0x1) ? 1 : 0;
-    
-    // set it up
-    int DSS = bits - 1;            // DSS (data select size)
-    int SPO = (polarity) ? 1 : 0;  // SPO - clock out polarity
-    int SPH = (phase) ? 1 : 0;     // SPH - clock out phase
-    
-    int FRF = 0;                   // FRF (frame format) = SPI
-    uint32_t tmp = obj->spi->CR0;
-    tmp &= ~(0xFFFF);
-    tmp |= DSS << 0
-        | FRF << 4
-        | SPO << 6
-        | SPH << 7;
-    obj->spi->CR0 = tmp;
-    
-    tmp = obj->spi->CR1;
-    tmp &= ~(0xD);
-    tmp |= 0 << 0                   // LBM - loop back mode - off
-        | ((slave) ? 1 : 0) << 2   // MS - master slave mode, 1 = slave
-        | 0 << 3;                  // SOD - slave output disable - na
-    obj->spi->CR1 = tmp;
-    
-    ssp_enable(obj);
-}
-
-void spi_frequency(spi_t *obj, int hz) {
-    ssp_disable(obj);
-    
-    // setup the spi clock diveder to /1
-    switch ((int)obj->spi) {
-        case SPI_0:
-            LPC_SC->PCLKSEL1 &= ~(3 << 10);
-            LPC_SC->PCLKSEL1 |=  (1 << 10);
-            break;
-        case SPI_1:
-            LPC_SC->PCLKSEL0 &= ~(3 << 20);
-            LPC_SC->PCLKSEL0 |=  (1 << 20);
-            break;
-    }
-    
-    uint32_t PCLK = SystemCoreClock;
-    
-    int prescaler;
-    
-    for (prescaler = 2; prescaler <= 254; prescaler += 2) {
-        int prescale_hz = PCLK / prescaler;
-        
-        // calculate the divider
-        int divider = floor(((float)prescale_hz / (float)hz) + 0.5f);
-        
-        // check we can support the divider
-        if (divider < 256) {
-            // prescaler
-            obj->spi->CPSR = prescaler;
-            
-            // divider
-            obj->spi->CR0 &= ~(0xFFFF << 8);
-            obj->spi->CR0 |= (divider - 1) << 8;
-            ssp_enable(obj);
-            return;
-        }
-    }
-    error("Couldn't setup requested SPI frequency");
-}
-
-static inline int ssp_disable(spi_t *obj) {
-    return obj->spi->CR1 &= ~(1 << 1);
-}
-
-static inline int ssp_enable(spi_t *obj) {
-    return obj->spi->CR1 |= (1 << 1);
-}
-
-static inline int ssp_readable(spi_t *obj) {
-    return obj->spi->SR & (1 << 2);
-}
-
-static inline int ssp_writeable(spi_t *obj) {
-    return obj->spi->SR & (1 << 1);
-}
-
-static inline void ssp_write(spi_t *obj, int value) {
-    while (!ssp_writeable(obj));
-    obj->spi->DR = value;
-}
-
-static inline int ssp_read(spi_t *obj) {
-    while (!ssp_readable(obj));
-    return obj->spi->DR;
-}
-
-static inline int ssp_busy(spi_t *obj) {
-    return (obj->spi->SR & (1 << 4)) ? (1) : (0);
-}
-
-int spi_master_write(spi_t *obj, int value) {
-    ssp_write(obj, value);
-    return ssp_read(obj);
-}
-
-int spi_slave_receive(spi_t *obj) {
-    return (ssp_readable(obj) && !ssp_busy(obj)) ? (1) : (0);
-};
-
-int spi_slave_read(spi_t *obj) {
-    return obj->spi->DR;
-}
-
-void spi_slave_write(spi_t *obj, int value) {
-    while (ssp_writeable(obj) == 0) ;
-    obj->spi->DR = value;
-}
-
-int spi_busy(spi_t *obj) {
-    return ssp_busy(obj);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/us_ticker.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stddef.h>
-#include "us_ticker_api.h"
-#include "PeripheralNames.h"
-
-#define US_TICKER_TIMER      ((LPC_TIM_TypeDef *)LPC_TIM3_BASE)
-#define US_TICKER_TIMER_IRQn TIMER3_IRQn
-
-int us_ticker_inited = 0;
-
-void us_ticker_init(void) {
-    if (us_ticker_inited) return;
-    us_ticker_inited = 1;
-    
-    LPC_SC->PCONP |= 1 << 23; // Clock TIMER_3
-    
-    US_TICKER_TIMER->CTCR = 0x0; // timer mode
-    uint32_t PCLK = SystemCoreClock / 4;
-    
-    US_TICKER_TIMER->TCR = 0x2;  // reset
-    
-    uint32_t prescale = PCLK / 1000000; // default to 1MHz (1 us ticks)
-    US_TICKER_TIMER->PR = prescale - 1;
-    US_TICKER_TIMER->TCR = 1; // enable = 1, reset = 0
-    
-    NVIC_SetVector(US_TICKER_TIMER_IRQn, (uint32_t)us_ticker_irq_handler);
-    NVIC_EnableIRQ(US_TICKER_TIMER_IRQn);
-}
-
-uint32_t us_ticker_read() {
-    if (!us_ticker_inited)
-        us_ticker_init();
-    
-    return US_TICKER_TIMER->TC;
-}
-
-void us_ticker_set_interrupt(unsigned int timestamp) {
-    // set match value
-    US_TICKER_TIMER->MR0 = timestamp;
-    // enable match interrupt
-    US_TICKER_TIMER->MCR |= 1;
-}
-
-void us_ticker_disable_interrupt(void) {
-    US_TICKER_TIMER->MCR &= ~1;
-}
-
-void us_ticker_clear_interrupt(void) {
-    US_TICKER_TIMER->IR = 1;
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC23XX/PeripheralNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    UART_0 = (int)LPC_UART0_BASE,
-    UART_1 = (int)LPC_UART1_BASE,
-    UART_2 = (int)LPC_UART2_BASE,
-    UART_3 = (int)LPC_UART3_BASE
-} UARTName;
-
-typedef enum {
-    ADC0_0 = 0,
-    ADC0_1,
-    ADC0_2,
-    ADC0_3,
-    ADC0_4,
-    ADC0_5,
-    ADC0_6,
-    ADC0_7
-} ADCName;
-
-typedef enum {
-    DAC_0 = 0
-} DACName;
-
-typedef enum {
-    SPI_0 = (int)LPC_SSP0_BASE,
-    SPI_1 = (int)LPC_SSP1_BASE
-} SPIName;
-
-typedef enum {
-    I2C_0 = (int)LPC_I2C0_BASE,
-    I2C_1 = (int)LPC_I2C1_BASE,
-    I2C_2 = (int)LPC_I2C2_BASE
-} I2CName;
-
-typedef enum {
-    PWM_1 = 1,
-    PWM_2,
-    PWM_3,
-    PWM_4,
-    PWM_5,
-    PWM_6
-} PWMName;
-
-typedef enum {
-     CAN_1 = (int)LPC_CAN1_BASE,
-     CAN_2 = (int)LPC_CAN2_BASE
-} CANName;
-
-#define STDIO_UART_TX     USBTX
-#define STDIO_UART_RX     USBRX
-#define STDIO_UART        UART_0
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC23XX/PinNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef MBED_PINNAMES_H
-#define MBED_PINNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    PIN_INPUT,
-    PIN_OUTPUT
-} PinDirection;
-
-#define PORT_SHIFT  5
-
-typedef enum {
-    // LPC Pin Names
-    P0_0 = LPC_GPIO0_BASE,
-          P0_1, P0_2, P0_3, P0_4, P0_5, P0_6, P0_7, P0_8, P0_9, P0_10, P0_11, P0_12, P0_13, P0_14, P0_15, P0_16, P0_17, P0_18, P0_19, P0_20, P0_21, P0_22, P0_23, P0_24, P0_25, P0_26, P0_27, P0_28, P0_29, P0_30, P0_31,
-    P1_0, P1_1, P1_2, P1_3, P1_4, P1_5, P1_6, P1_7, P1_8, P1_9, P1_10, P1_11, P1_12, P1_13, P1_14, P1_15, P1_16, P1_17, P1_18, P1_19, P1_20, P1_21, P1_22, P1_23, P1_24, P1_25, P1_26, P1_27, P1_28, P1_29, P1_30, P1_31,
-    P2_0, P2_1, P2_2, P2_3, P2_4, P2_5, P2_6, P2_7, P2_8, P2_9, P2_10, P2_11, P2_12, P2_13, P2_14, P2_15, P2_16, P2_17, P2_18, P2_19, P2_20, P2_21, P2_22, P2_23, P2_24, P2_25, P2_26, P2_27, P2_28, P2_29, P2_30, P2_31,
-    P3_0, P3_1, P3_2, P3_3, P3_4, P3_5, P3_6, P3_7, P3_8, P3_9, P3_10, P3_11, P3_12, P3_13, P3_14, P3_15, P3_16, P3_17, P3_18, P3_19, P3_20, P3_21, P3_22, P3_23, P3_24, P3_25, P3_26, P3_27, P3_28, P3_29, P3_30, P3_31,
-    P4_0, P4_1, P4_2, P4_3, P4_4, P4_5, P4_6, P4_7, P4_8, P4_9, P4_10, P4_11, P4_12, P4_13, P4_14, P4_15, P4_16, P4_17, P4_18, P4_19, P4_20, P4_21, P4_22, P4_23, P4_24, P4_25, P4_26, P4_27, P4_28, P4_29, P4_30, P4_31,
-
-    // mbed DIP Pin Names
-    p5 = P0_9,
-    p6 = P0_8,
-    p7 = P0_7,
-    p8 = P0_6,
-    p9 = P0_0,
-    p10 = P0_1,
-    p11 = P0_18,
-    p12 = P0_17,
-    p13 = P0_15,
-    p14 = P0_16,
-    p15 = P0_23,
-    p16 = P0_24,
-    p17 = P0_25,
-    p18 = P0_26,
-    p19 = P1_30,
-    p20 = P1_31,
-    p21 = P2_5,
-    p22 = P2_4,
-    p23 = P2_3,
-    p24 = P2_2,
-    p25 = P2_1,
-    p26 = P2_0,
-    p27 = P0_11,
-    p28 = P0_10,
-    p29 = P0_5,
-    p30 = P0_4,
-
-    // Other mbed Pin Names
-    LED1 = P1_18,
-    LED2 = P1_20,
-    LED3 = P1_21,
-    LED4 = P1_23,
-
-    USBTX = P0_2,
-    USBRX = P0_3,
-
-    // Not connected
-    NC = (int)0xFFFFFFFF
-} PinName;
-
-typedef enum {
-    PullUp = 0,
-    PullDown = 3,
-    PullNone = 2,
-    OpenDrain = 4
-} PinMode;
-
-// version of PINCON_TypeDef using register arrays
-typedef struct {
-  __IO uint32_t PINSEL[11];
-       uint32_t RESERVED0[5];
-  __IO uint32_t PINMODE[10];
-} PINCONARRAY_TypeDef;
-
-#define PINCONARRAY ((PINCONARRAY_TypeDef *)LPC_PINCON_BASE)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC23XX/PortNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PORTNAMES_H
-#define MBED_PORTNAMES_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    Port0 = 0,
-    Port1 = 1,
-    Port2 = 2,
-    Port3 = 3,
-    Port4 = 4
-} PortName;
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC23XX/analogin_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "analogin_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-#define ANALOGIN_MEDIAN_FILTER      1
-
-#define ADC_10BIT_RANGE             0x3FF
-#define ADC_12BIT_RANGE             0xFFF
-
-static inline int div_round_up(int x, int y) {
-  return (x + (y - 1)) / y;
-}
-
-static const PinMap PinMap_ADC[] = {
-    {P0_23, ADC0_0, 1},
-    {P0_24, ADC0_1, 1},
-    {P0_25, ADC0_2, 1},
-    {P0_26, ADC0_3, 1},
-    {P1_30, ADC0_4, 3},
-    {P1_31, ADC0_5, 3},
-    {NC,    NC,     0}
-};
-
-#define ADC_RANGE    ADC_10BIT_RANGE
-
-
-void analogin_init(analogin_t *obj, PinName pin) {
-    obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
-    if (obj->adc == (ADCName)NC) {
-        error("ADC pin mapping failed");
-    }
-    
-    // ensure power is turned on
-    LPC_SC->PCONP |= (1 << 12);
-    
-    // set PCLK of ADC to /1
-    LPC_SC->PCLKSEL0 &= ~(0x3 << 24);
-    LPC_SC->PCLKSEL0 |= (0x1 << 24);
-    uint32_t PCLK = SystemCoreClock;
-    
-    // calculate minimum clock divider
-    //  clkdiv = divider - 1
-    uint32_t MAX_ADC_CLK = 13000000;
-    uint32_t clkdiv = div_round_up(PCLK, MAX_ADC_CLK) - 1;
-    
-    // Set the generic software-controlled ADC settings
-    LPC_ADC->ADCR = (0 << 0)      // SEL: 0 = no channels selected
-                  | (clkdiv << 8) // CLKDIV: PCLK max ~= 25MHz, /25 to give safe 1MHz at fastest
-                  | (0 << 16)     // BURST: 0 = software control
-                  | (0 << 17)     // CLKS: not applicable
-                  | (1 << 21)     // PDN: 1 = operational
-                  | (0 << 24)     // START: 0 = no start
-                  | (0 << 27);    // EDGE: not applicable
-    
-    pinmap_pinout(pin, PinMap_ADC);
-}
-
-static inline uint32_t adc_read(analogin_t *obj) {
-    // Select the appropriate channel and start conversion
-    LPC_ADC->ADCR &= ~0xFF;
-    LPC_ADC->ADCR |= 1 << (int)obj->adc;
-    LPC_ADC->ADCR |= 1 << 24;
-    
-    // Repeatedly get the sample data until DONE bit
-    unsigned int data;
-    do {
-        data = LPC_ADC->ADGDR;
-    } while ((data & ((unsigned int)1 << 31)) == 0);
-    
-    // Stop conversion
-    LPC_ADC->ADCR &= ~(1 << 24);
-    
-    return (data >> 6) & ADC_RANGE; // 10 bit
-}
-
-static inline void order(uint32_t *a, uint32_t *b) {
-    if (*a > *b) {
-        uint32_t t = *a;
-        *a = *b;
-        *b = t;
-    }
-}
-
-static inline uint32_t adc_read_u32(analogin_t *obj) {
-    uint32_t value;
-#if ANALOGIN_MEDIAN_FILTER
-    uint32_t v1 = adc_read(obj);
-    uint32_t v2 = adc_read(obj);
-    uint32_t v3 = adc_read(obj);
-    order(&v1, &v2);
-    order(&v2, &v3);
-    order(&v1, &v2);
-    value = v2;
-#else
-    value = adc_read(obj);
-#endif
-    return value;
-}
-
-uint16_t analogin_read_u16(analogin_t *obj) {
-    uint32_t value = adc_read_u32(obj);
-    
-    return (value << 6) | ((value >> 4) & 0x003F); // 10 bit
-}
-
-float analogin_read(analogin_t *obj) {
-    uint32_t value = adc_read_u32(obj);
-    return (float)value * (1.0f / (float)ADC_RANGE);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC23XX/analogout_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "analogout_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_DAC[] = {
-    {P0_26, DAC_0, 2},
-    {NC   , NC   , 0}
-};
-
-void analogout_init(dac_t *obj, PinName pin) {
-    obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
-    if (obj->dac == (DACName)NC) {
-        error("DAC pin mapping failed");
-    }
-    
-    // power is on by default, set DAC clk divider is /4
-    LPC_SC->PCLKSEL0 &= ~(0x3 << 22);
-    
-    // map out (must be done before accessing registers)
-    pinmap_pinout(pin, PinMap_DAC);
-    
-    analogout_write_u16(obj, 0);
-}
-
-void analogout_free(dac_t *obj) {}
-
-static inline void dac_write(int value) {
-    value &= 0x3FF; // 10-bit
-    
-    // Set the DAC output
-    LPC_DAC->DACR = (0 << 16)       // bias = 0
-                  | (value << 6);
-}
-
-static inline int dac_read() {
-    return (LPC_DAC->DACR >> 6) & 0x3FF;
-}
-
-void analogout_write(dac_t *obj, float value) {
-    if (value < 0.0f) {
-        dac_write(0);
-    } else if (value > 1.0f) {
-        dac_write(0x3FF);
-    } else {
-        dac_write(value * (float)0x3FF);
-    }
-}
-
-void analogout_write_u16(dac_t *obj, uint16_t value) {
-    dac_write(value >> 6); // 10-bit
-}
-
-float analogout_read(dac_t *obj) {
-    uint32_t value = dac_read();
-    return (float)value * (1.0f / (float)0x3FF);
-}
-
-uint16_t analogout_read_u16(dac_t *obj) {
-    uint32_t value = dac_read(); // 10-bit
-    return (value << 6) | ((value >> 4) & 0x003F);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC23XX/can_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,305 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "can_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-#include <math.h>
-#include <string.h>
-
-/* Acceptance filter mode in AFMR register */
-#define ACCF_OFF                0x01
-#define ACCF_BYPASS             0x02
-#define ACCF_ON                 0x00
-#define ACCF_FULLCAN            0x04
-
-/* There are several bit timing calculators on the internet.
-http://www.port.de/engl/canprod/sv_req_form.html
-http://www.kvaser.com/can/index.htm
-*/
-
-static const PinMap PinMap_CAN_RD[] = {
-    {P0_0 , CAN_1, 1},
-    {P0_4 , CAN_2, 2},
-    {P0_21, CAN_1, 3},
-    {P2_7 , CAN_2, 1},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_CAN_TD[] = {
-    {P0_1 , CAN_1, 1},
-    {P0_5 , CAN_2, 2},
-    {P0_22, CAN_1, 3},
-    {P2_8 , CAN_2, 1},
-    {NC   , NC   , 0}
-};
-
-// Type definition to hold a CAN message
-struct CANMsg {
-    unsigned int  reserved1 : 16;
-    unsigned int  dlc       :  4; // Bits 16..19: DLC - Data Length Counter
-    unsigned int  reserved0 : 10;
-    unsigned int  rtr       :  1; // Bit 30: Set if this is a RTR message
-    unsigned int  type      :  1; // Bit 31: Set if this is a 29-bit ID message
-    unsigned int  id;             // CAN Message ID (11-bit or 29-bit)
-    unsigned char data[8];        // CAN Message Data Bytes 0-7
-};
-typedef struct CANMsg CANMsg;
-
-static uint32_t can_disable(can_t *obj) {
-    uint32_t sm = obj->dev->MOD;
-    obj->dev->MOD |= 1;
-    return sm;
-}
-
-static inline void can_enable(can_t *obj) {
-    if (obj->dev->MOD & 1) {
-        obj->dev->MOD &= ~(1);
-    }
-}
-
-int can_mode(can_t *obj, CanMode mode) {
-    return 0; // not implemented
-}
-
-int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t handle) {
-    return 0; // not implemented
-}
-
-static int can_pclk(can_t *obj) {
-    int value = 0;
-    switch ((int)obj->dev) {
-        case CAN_1: value = (LPC_SC->PCLKSEL0 & (0x3 << 26)) >> 26; break;
-        case CAN_2: value = (LPC_SC->PCLKSEL0 & (0x3 << 28)) >> 28; break;
-    }
-    
-    switch (value) {
-        case 1: return 1;
-        case 2: return 2;
-        case 3: return 6;
-        default: return 4;
-    }
-}
-
-// This table has the sampling points as close to 75% as possible. The first
-// value is TSEG1, the second TSEG2.
-static const int timing_pts[23][2] = {
-    {0x0, 0x0},      // 2,  50%
-    {0x1, 0x0},      // 3,  67%
-    {0x2, 0x0},      // 4,  75%
-    {0x3, 0x0},      // 5,  80%
-    {0x3, 0x1},      // 6,  67%
-    {0x4, 0x1},      // 7,  71%
-    {0x5, 0x1},      // 8,  75%
-    {0x6, 0x1},      // 9,  78%
-    {0x6, 0x2},      // 10, 70%
-    {0x7, 0x2},      // 11, 73%
-    {0x8, 0x2},      // 12, 75%
-    {0x9, 0x2},      // 13, 77%
-    {0x9, 0x3},      // 14, 71%
-    {0xA, 0x3},      // 15, 73%
-    {0xB, 0x3},      // 16, 75%
-    {0xC, 0x3},      // 17, 76%
-    {0xD, 0x3},      // 18, 78%
-    {0xD, 0x4},      // 19, 74%
-    {0xE, 0x4},      // 20, 75%
-    {0xF, 0x4},      // 21, 76%
-    {0xF, 0x5},      // 22, 73%
-    {0xF, 0x6},      // 23, 70%
-    {0xF, 0x7},      // 24, 67%
-};
-
-static unsigned int can_speed(unsigned int sclk, unsigned int pclk, unsigned int cclk, unsigned char psjw) {
-    uint32_t    btr;
-    uint16_t    brp = 0;
-    uint32_t    calcbit;
-    uint32_t    bitwidth;
-    int         hit = 0;
-    int         bits;
-    
-    bitwidth = sclk / (pclk * cclk);
-    
-    brp = bitwidth / 0x18;
-    while ((!hit) && (brp < bitwidth / 4)) {
-        brp++;
-        for (bits = 22; bits > 0; bits--) {
-            calcbit = (bits + 3) * (brp + 1);
-            if (calcbit == bitwidth) {
-                hit = 1;
-                break;
-            }
-        }
-    }
-    
-    if (hit) {
-        btr = ((timing_pts[bits][1] << 20) & 0x00700000)
-            | ((timing_pts[bits][0] << 16) & 0x000F0000)
-            | ((psjw                << 14) & 0x0000C000)
-            | ((brp                 <<  0) & 0x000003FF);
-    } else {
-        btr = 0xFFFFFFFF;
-    }
-    
-    return btr;
-}
-
-void can_init(can_t *obj, PinName rd, PinName td) {
-    CANName can_rd = (CANName)pinmap_peripheral(rd, PinMap_CAN_RD);
-    CANName can_td = (CANName)pinmap_peripheral(td, PinMap_CAN_TD);
-    obj->dev = (LPC_CAN_TypeDef *)pinmap_merge(can_rd, can_td);
-    if ((int)obj->dev == NC) {
-        error("CAN pin mapping failed");
-    }
-    
-    switch ((int)obj->dev) {
-        case CAN_1: LPC_SC->PCONP |= 1 << 13; break;
-        case CAN_2: LPC_SC->PCONP |= 1 << 14; break;
-    }
-    
-    pinmap_pinout(rd, PinMap_CAN_RD);
-    pinmap_pinout(td, PinMap_CAN_TD);
-    
-    can_reset(obj);
-    obj->dev->IER = 0;             // Disable Interrupts
-    can_frequency(obj, 100000);
-    
-    LPC_CANAF->AFMR = ACCF_BYPASS; // Bypass Filter
-}
-
-void can_free(can_t *obj) {
-    switch ((int)obj->dev) {
-        case CAN_1: LPC_SC->PCONP &= ~(1 << 13); break;
-        case CAN_2: LPC_SC->PCONP &= ~(1 << 14); break;
-    }
-}
-
-int can_frequency(can_t *obj, int f) {
-    int pclk = can_pclk(obj);
-    int btr = can_speed(SystemCoreClock, pclk, (unsigned int)f, 1);
-    
-    if (btr > 0) {
-        uint32_t modmask = can_disable(obj);
-        obj->dev->BTR = btr;
-        obj->dev->MOD = modmask;
-        return 1;
-    } else {
-        return 0;
-    }
-}
-
-int can_write(can_t *obj, CAN_Message msg, int cc) {
-    unsigned int CANStatus;
-    CANMsg m;
-    
-    can_enable(obj);
-    
-    m.id   = msg.id ;
-    m.dlc  = msg.len & 0xF;
-    m.rtr  = msg.type;
-    m.type = msg.format;
-    memcpy(m.data, msg.data, msg.len);
-    const unsigned int *buf = (const unsigned int *)&m;
-    
-    CANStatus = obj->dev->SR;
-    if (CANStatus & 0x00000004) {
-        obj->dev->TFI1 = buf[0] & 0xC00F0000;
-        obj->dev->TID1 = buf[1];
-        obj->dev->TDA1 = buf[2];
-        obj->dev->TDB1 = buf[3];
-        if (cc) {
-            obj->dev->CMR = 0x30;
-        } else {
-            obj->dev->CMR = 0x21;
-        }
-        return 1;
-    
-    } else if (CANStatus & 0x00000400) {
-        obj->dev->TFI2 = buf[0] & 0xC00F0000;
-        obj->dev->TID2 = buf[1];
-        obj->dev->TDA2 = buf[2];
-        obj->dev->TDB2 = buf[3];
-        if (cc) {
-            obj->dev->CMR = 0x50;
-        } else {
-            obj->dev->CMR = 0x41;
-        }
-        return 1;
-    
-    } else if (CANStatus & 0x00040000) {
-        obj->dev->TFI3 = buf[0] & 0xC00F0000;
-        obj->dev->TID3 = buf[1];
-        obj->dev->TDA3 = buf[2];
-        obj->dev->TDB3 = buf[3];
-        if (cc) {
-            obj->dev->CMR = 0x90;
-        } else {
-            obj->dev->CMR = 0x81;
-        }
-        return 1;
-    }
-    
-    return 0;
-}
-
-int can_read(can_t *obj, CAN_Message *msg, int handle) {
-    CANMsg x;
-    unsigned int *i = (unsigned int *)&x;
-    
-    can_enable(obj);
-    
-    if (obj->dev->GSR & 0x1) {
-        *i++ = obj->dev->RFS;  // Frame
-        *i++ = obj->dev->RID;  // ID
-        *i++ = obj->dev->RDA;  // Data A
-        *i++ = obj->dev->RDB;  // Data B
-        obj->dev->CMR = 0x04;  // release receive buffer
-        
-        msg->id     = x.id;
-        msg->len    = x.dlc;
-        msg->format = (x.type)? CANExtended : CANStandard;
-        msg->type   = (x.rtr)?  CANRemote:    CANData;
-        memcpy(msg->data,x.data,x.dlc);
-        return 1;
-    }
-    
-    return 0;
-}
-
-void can_reset(can_t *obj) {
-    can_disable(obj);
-    obj->dev->GSR = 0; // Reset error counter when CAN1MOD is in reset
-}
-
-unsigned char can_rderror(can_t *obj) {
-    return (obj->dev->GSR >> 16) & 0xFF;
-}
-
-unsigned char can_tderror(can_t *obj) {
-    return (obj->dev->GSR >> 24) & 0xFF;
-}
-
-void can_monitor(can_t *obj, int silent) {
-    uint32_t mod_mask = can_disable(obj);
-    if (silent) {
-        obj->dev->MOD |= (1 << 1);
-    } else {
-        obj->dev->MOD &= ~(1 << 1);
-    }
-    if (!(mod_mask & 1)) {
-        can_enable(obj);
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC23XX/device.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_DEVICE_H
-#define MBED_DEVICE_H
-
-#define DEVICE_PORTIN           1
-#define DEVICE_PORTOUT          1
-#define DEVICE_PORTINOUT        1
-
-#define DEVICE_INTERRUPTIN      1
-
-#define DEVICE_ANALOGIN         1
-#define DEVICE_ANALOGOUT        1
-
-#define DEVICE_SERIAL           1
-
-#define DEVICE_I2C              1
-#define DEVICE_I2CSLAVE         1
-
-#define DEVICE_SPI              1
-#define DEVICE_SPISLAVE         1
-
-#define DEVICE_CAN              1
-
-#define DEVICE_RTC              1
-
-#define DEVICE_ETHERNET         1
-
-#define DEVICE_PWMOUT           1
-
-#define DEVICE_SEMIHOST         1
-#define DEVICE_LOCALFILESYSTEM  1
-#define DEVICE_ID_LENGTH       32
-#define DEVICE_MAC_OFFSET      20
-
-#define DEVICE_SLEEP            0
-
-#define DEVICE_DEBUG_AWARENESS  0
-
-#define DEVICE_STDIO_MESSAGES   1
-
-#define DEVICE_ERROR_PATTERN    1
-
-#include "objects.h"
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC23XX/ethernet_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,935 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <string.h>
-
-#include "ethernet_api.h"
-#include "cmsis.h"
-#include "mbed_interface.h"
-#include "toolchain.h"
-#include "error.h"
-
-#define NEW_LOGIC       0
-#define NEW_ETH_BUFFER  0
-
-#if NEW_ETH_BUFFER
-
-#define NUM_RX_FRAG         4           // Number of Rx Fragments (== packets)
-#define NUM_TX_FRAG         3           // Number of Tx Fragments (== packets)
-
-#define ETH_MAX_FLEN        1536         // Maximum Ethernet Frame Size
-#define ETH_FRAG_SIZE       ETH_MAX_FLEN // Packet Fragment size (same as packet length)
-
-#else
-
-// Memfree calculation:
-// (16 * 1024) - ((2 * 4 * NUM_RX) + (2 * 4 * NUM_RX) + (0x300 * NUM_RX) +
-//                (2 * 4 * NUM_TX) + (1 * 4 * NUM_TX) + (0x300 * NUM_TX)) = 8556
-/* EMAC Memory Buffer configuration for 16K Ethernet RAM. */
-#define NUM_RX_FRAG         4           /* Num.of RX Fragments 4*1536= 6.0kB */
-#define NUM_TX_FRAG         3           /* Num.of TX Fragments 3*1536= 4.6kB */
-//#define ETH_FRAG_SIZE       1536        /* Packet Fragment size 1536 Bytes   */
-
-//#define ETH_MAX_FLEN        1536        /* Max. Ethernet Frame Size          */
-#define ETH_FRAG_SIZE       0x300       /* Packet Fragment size 1536/2 Bytes   */
-#define ETH_MAX_FLEN        0x300       /* Max. Ethernet Frame Size          */
-
-const int ethernet_MTU_SIZE  = 0x300;
-
-#endif
-
-#define ETHERNET_ADDR_SIZE 6
-
-PACKED struct RX_DESC_TypeDef {                        /* RX Descriptor struct              */
-   unsigned int Packet;
-   unsigned int Ctrl;
-};
-typedef struct RX_DESC_TypeDef RX_DESC_TypeDef;
-
-PACKED struct RX_STAT_TypeDef {                        /* RX Status struct                  */
-   unsigned int Info;
-   unsigned int HashCRC;
-};
-typedef struct RX_STAT_TypeDef RX_STAT_TypeDef;
-
-PACKED struct TX_DESC_TypeDef {                        /* TX Descriptor struct              */
-   unsigned int Packet;
-   unsigned int Ctrl;
-};
-typedef struct TX_DESC_TypeDef TX_DESC_TypeDef;
-
-PACKED struct TX_STAT_TypeDef {                        /* TX Status struct                  */
-   unsigned int Info;
-};
-typedef struct TX_STAT_TypeDef TX_STAT_TypeDef;
-
-/* MAC Configuration Register 1 */
-#define MAC1_REC_EN         0x00000001  /* Receive Enable                    */
-#define MAC1_PASS_ALL       0x00000002  /* Pass All Receive Frames           */
-#define MAC1_RX_FLOWC       0x00000004  /* RX Flow Control                   */
-#define MAC1_TX_FLOWC       0x00000008  /* TX Flow Control                   */
-#define MAC1_LOOPB          0x00000010  /* Loop Back Mode                    */
-#define MAC1_RES_TX         0x00000100  /* Reset TX Logic                    */
-#define MAC1_RES_MCS_TX     0x00000200  /* Reset MAC TX Control Sublayer     */
-#define MAC1_RES_RX         0x00000400  /* Reset RX Logic                    */
-#define MAC1_RES_MCS_RX     0x00000800  /* Reset MAC RX Control Sublayer     */
-#define MAC1_SIM_RES        0x00004000  /* Simulation Reset                  */
-#define MAC1_SOFT_RES       0x00008000  /* Soft Reset MAC                    */
-
-/* MAC Configuration Register 2 */
-#define MAC2_FULL_DUP       0x00000001  /* Full Duplex Mode                  */
-#define MAC2_FRM_LEN_CHK    0x00000002  /* Frame Length Checking             */
-#define MAC2_HUGE_FRM_EN    0x00000004  /* Huge Frame Enable                 */
-#define MAC2_DLY_CRC        0x00000008  /* Delayed CRC Mode                  */
-#define MAC2_CRC_EN         0x00000010  /* Append CRC to every Frame         */
-#define MAC2_PAD_EN         0x00000020  /* Pad all Short Frames              */
-#define MAC2_VLAN_PAD_EN    0x00000040  /* VLAN Pad Enable                   */
-#define MAC2_ADET_PAD_EN    0x00000080  /* Auto Detect Pad Enable            */
-#define MAC2_PPREAM_ENF     0x00000100  /* Pure Preamble Enforcement         */
-#define MAC2_LPREAM_ENF     0x00000200  /* Long Preamble Enforcement         */
-#define MAC2_NO_BACKOFF     0x00001000  /* No Backoff Algorithm              */
-#define MAC2_BACK_PRESSURE  0x00002000  /* Backoff Presurre / No Backoff     */
-#define MAC2_EXCESS_DEF     0x00004000  /* Excess Defer                      */
-
-/* Back-to-Back Inter-Packet-Gap Register */
-#define IPGT_FULL_DUP       0x00000015  /* Recommended value for Full Duplex */
-#define IPGT_HALF_DUP       0x00000012  /* Recommended value for Half Duplex */
-
-/* Non Back-to-Back Inter-Packet-Gap Register */
-#define IPGR_DEF            0x00000012  /* Recommended value                 */
-
-/* Collision Window/Retry Register */
-#define CLRT_DEF            0x0000370F  /* Default value                     */
-
-/* PHY Support Register */
-#define SUPP_SPEED          0x00000100  /* Reduced MII Logic Current Speed   */
-//#define SUPP_RES_RMII       0x00000800  /* Reset Reduced MII Logic           */
-#define SUPP_RES_RMII       0x00000000  /* Reset Reduced MII Logic           */
-
-/* Test Register */
-#define TEST_SHCUT_PQUANTA  0x00000001  /* Shortcut Pause Quanta             */
-#define TEST_TST_PAUSE      0x00000002  /* Test Pause                        */
-#define TEST_TST_BACKP      0x00000004  /* Test Back Pressure                */
-
-/* MII Management Configuration Register */
-#define MCFG_SCAN_INC       0x00000001  /* Scan Increment PHY Address        */
-#define MCFG_SUPP_PREAM     0x00000002  /* Suppress Preamble                 */
-#define MCFG_CLK_SEL        0x0000003C  /* Clock Select Mask                 */
-#define MCFG_RES_MII        0x00008000  /* Reset MII Management Hardware     */
-
-/* MII Management Command Register */
-#define MCMD_READ           0x00000001  /* MII Read                          */
-#define MCMD_SCAN           0x00000002  /* MII Scan continuously             */
-
-#define MII_WR_TOUT         0x00050000  /* MII Write timeout count           */
-#define MII_RD_TOUT         0x00050000  /* MII Read timeout count            */
-
-/* MII Management Address Register */
-#define MADR_REG_ADR        0x0000001F  /* MII Register Address Mask         */
-#define MADR_PHY_ADR        0x00001F00  /* PHY Address Mask                  */
-
-/* MII Management Indicators Register */
-#define MIND_BUSY           0x00000001  /* MII is Busy                       */
-#define MIND_SCAN           0x00000002  /* MII Scanning in Progress          */
-#define MIND_NOT_VAL        0x00000004  /* MII Read Data not valid           */
-#define MIND_MII_LINK_FAIL  0x00000008  /* MII Link Failed                   */
-
-/* Command Register */
-#define CR_RX_EN            0x00000001  /* Enable Receive                    */
-#define CR_TX_EN            0x00000002  /* Enable Transmit                   */
-#define CR_REG_RES          0x00000008  /* Reset Host Registers              */
-#define CR_TX_RES           0x00000010  /* Reset Transmit Datapath           */
-#define CR_RX_RES           0x00000020  /* Reset Receive Datapath            */
-#define CR_PASS_RUNT_FRM    0x00000040  /* Pass Runt Frames                  */
-#define CR_PASS_RX_FILT     0x00000080  /* Pass RX Filter                    */
-#define CR_TX_FLOW_CTRL     0x00000100  /* TX Flow Control                   */
-#define CR_RMII             0x00000200  /* Reduced MII Interface             */
-#define CR_FULL_DUP         0x00000400  /* Full Duplex                       */
-
-/* Status Register */
-#define SR_RX_EN            0x00000001  /* Enable Receive                    */
-#define SR_TX_EN            0x00000002  /* Enable Transmit                   */
-
-/* Transmit Status Vector 0 Register */
-#define TSV0_CRC_ERR        0x00000001  /* CRC error                         */
-#define TSV0_LEN_CHKERR     0x00000002  /* Length Check Error                */
-#define TSV0_LEN_OUTRNG     0x00000004  /* Length Out of Range               */
-#define TSV0_DONE           0x00000008  /* Tramsmission Completed            */
-#define TSV0_MCAST          0x00000010  /* Multicast Destination             */
-#define TSV0_BCAST          0x00000020  /* Broadcast Destination             */
-#define TSV0_PKT_DEFER      0x00000040  /* Packet Deferred                   */
-#define TSV0_EXC_DEFER      0x00000080  /* Excessive Packet Deferral         */
-#define TSV0_EXC_COLL       0x00000100  /* Excessive Collision               */
-#define TSV0_LATE_COLL      0x00000200  /* Late Collision Occured            */
-#define TSV0_GIANT          0x00000400  /* Giant Frame                       */
-#define TSV0_UNDERRUN       0x00000800  /* Buffer Underrun                   */
-#define TSV0_BYTES          0x0FFFF000  /* Total Bytes Transferred           */
-#define TSV0_CTRL_FRAME     0x10000000  /* Control Frame                     */
-#define TSV0_PAUSE          0x20000000  /* Pause Frame                       */
-#define TSV0_BACK_PRESS     0x40000000  /* Backpressure Method Applied       */
-#define TSV0_VLAN           0x80000000  /* VLAN Frame                        */
-
-/* Transmit Status Vector 1 Register */
-#define TSV1_BYTE_CNT       0x0000FFFF  /* Transmit Byte Count               */
-#define TSV1_COLL_CNT       0x000F0000  /* Transmit Collision Count          */
-
-/* Receive Status Vector Register */
-#define RSV_BYTE_CNT        0x0000FFFF  /* Receive Byte Count                */
-#define RSV_PKT_IGNORED     0x00010000  /* Packet Previously Ignored         */
-#define RSV_RXDV_SEEN       0x00020000  /* RXDV Event Previously Seen        */
-#define RSV_CARR_SEEN       0x00040000  /* Carrier Event Previously Seen     */
-#define RSV_REC_CODEV       0x00080000  /* Receive Code Violation            */
-#define RSV_CRC_ERR         0x00100000  /* CRC Error                         */
-#define RSV_LEN_CHKERR      0x00200000  /* Length Check Error                */
-#define RSV_LEN_OUTRNG      0x00400000  /* Length Out of Range               */
-#define RSV_REC_OK          0x00800000  /* Frame Received OK                 */
-#define RSV_MCAST           0x01000000  /* Multicast Frame                   */
-#define RSV_BCAST           0x02000000  /* Broadcast Frame                   */
-#define RSV_DRIB_NIBB       0x04000000  /* Dribble Nibble                    */
-#define RSV_CTRL_FRAME      0x08000000  /* Control Frame                     */
-#define RSV_PAUSE           0x10000000  /* Pause Frame                       */
-#define RSV_UNSUPP_OPC      0x20000000  /* Unsupported Opcode                */
-#define RSV_VLAN            0x40000000  /* VLAN Frame                        */
-
-/* Flow Control Counter Register */
-#define FCC_MIRR_CNT        0x0000FFFF  /* Mirror Counter                    */
-#define FCC_PAUSE_TIM       0xFFFF0000  /* Pause Timer                       */
-
-/* Flow Control Status Register */
-#define FCS_MIRR_CNT        0x0000FFFF  /* Mirror Counter Current            */
-
-/* Receive Filter Control Register */
-#define RFC_UCAST_EN        0x00000001  /* Accept Unicast Frames Enable      */
-#define RFC_BCAST_EN        0x00000002  /* Accept Broadcast Frames Enable    */
-#define RFC_MCAST_EN        0x00000004  /* Accept Multicast Frames Enable    */
-#define RFC_UCAST_HASH_EN   0x00000008  /* Accept Unicast Hash Filter Frames */
-#define RFC_MCAST_HASH_EN   0x00000010  /* Accept Multicast Hash Filter Fram.*/
-#define RFC_PERFECT_EN      0x00000020  /* Accept Perfect Match Enable       */
-#define RFC_MAGP_WOL_EN     0x00001000  /* Magic Packet Filter WoL Enable    */
-#define RFC_PFILT_WOL_EN    0x00002000  /* Perfect Filter WoL Enable         */
-
-/* Receive Filter WoL Status/Clear Registers */
-#define WOL_UCAST           0x00000001  /* Unicast Frame caused WoL          */
-#define WOL_BCAST           0x00000002  /* Broadcast Frame caused WoL        */
-#define WOL_MCAST           0x00000004  /* Multicast Frame caused WoL        */
-#define WOL_UCAST_HASH      0x00000008  /* Unicast Hash Filter Frame WoL     */
-#define WOL_MCAST_HASH      0x00000010  /* Multicast Hash Filter Frame WoL   */
-#define WOL_PERFECT         0x00000020  /* Perfect Filter WoL                */
-#define WOL_RX_FILTER       0x00000080  /* RX Filter caused WoL              */
-#define WOL_MAG_PACKET      0x00000100  /* Magic Packet Filter caused WoL    */
-
-/* Interrupt Status/Enable/Clear/Set Registers */
-#define INT_RX_OVERRUN      0x00000001  /* Overrun Error in RX Queue         */
-#define INT_RX_ERR          0x00000002  /* Receive Error                     */
-#define INT_RX_FIN          0x00000004  /* RX Finished Process Descriptors   */
-#define INT_RX_DONE         0x00000008  /* Receive Done                      */
-#define INT_TX_UNDERRUN     0x00000010  /* Transmit Underrun                 */
-#define INT_TX_ERR          0x00000020  /* Transmit Error                    */
-#define INT_TX_FIN          0x00000040  /* TX Finished Process Descriptors   */
-#define INT_TX_DONE         0x00000080  /* Transmit Done                     */
-#define INT_SOFT_INT        0x00001000  /* Software Triggered Interrupt      */
-#define INT_WAKEUP          0x00002000  /* Wakeup Event Interrupt            */
-
-/* Power Down Register */
-#define PD_POWER_DOWN       0x80000000  /* Power Down MAC                    */
-
-/* RX Descriptor Control Word */
-#define RCTRL_SIZE          0x000007FF  /* Buffer size mask                  */
-#define RCTRL_INT           0x80000000  /* Generate RxDone Interrupt         */
-
-/* RX Status Hash CRC Word */
-#define RHASH_SA            0x000001FF  /* Hash CRC for Source Address       */
-#define RHASH_DA            0x001FF000  /* Hash CRC for Destination Address  */
-
-/* RX Status Information Word */
-#define RINFO_SIZE          0x000007FF  /* Data size in bytes                */
-#define RINFO_CTRL_FRAME    0x00040000  /* Control Frame                     */
-#define RINFO_VLAN          0x00080000  /* VLAN Frame                        */
-#define RINFO_FAIL_FILT     0x00100000  /* RX Filter Failed                  */
-#define RINFO_MCAST         0x00200000  /* Multicast Frame                   */
-#define RINFO_BCAST         0x00400000  /* Broadcast Frame                   */
-#define RINFO_CRC_ERR       0x00800000  /* CRC Error in Frame                */
-#define RINFO_SYM_ERR       0x01000000  /* Symbol Error from PHY             */
-#define RINFO_LEN_ERR       0x02000000  /* Length Error                      */
-#define RINFO_RANGE_ERR     0x04000000  /* Range Error (exceeded max. size)  */
-#define RINFO_ALIGN_ERR     0x08000000  /* Alignment Error                   */
-#define RINFO_OVERRUN       0x10000000  /* Receive overrun                   */
-#define RINFO_NO_DESCR      0x20000000  /* No new Descriptor available       */
-#define RINFO_LAST_FLAG     0x40000000  /* Last Fragment in Frame            */
-#define RINFO_ERR           0x80000000  /* Error Occured (OR of all errors)  */
-
-//#define RINFO_ERR_MASK     (RINFO_FAIL_FILT | RINFO_CRC_ERR   | RINFO_SYM_ERR | RINFO_LEN_ERR   | RINFO_ALIGN_ERR | RINFO_OVERRUN)
-#define RINFO_ERR_MASK     (RINFO_FAIL_FILT | RINFO_SYM_ERR | \
-                            RINFO_LEN_ERR   | RINFO_ALIGN_ERR | RINFO_OVERRUN)
-
-
-/* TX Descriptor Control Word */
-#define TCTRL_SIZE          0x000007FF  /* Size of data buffer in bytes      */
-#define TCTRL_OVERRIDE      0x04000000  /* Override Default MAC Registers    */
-#define TCTRL_HUGE          0x08000000  /* Enable Huge Frame                 */
-#define TCTRL_PAD           0x10000000  /* Pad short Frames to 64 bytes      */
-#define TCTRL_CRC           0x20000000  /* Append a hardware CRC to Frame    */
-#define TCTRL_LAST          0x40000000  /* Last Descriptor for TX Frame      */
-#define TCTRL_INT           0x80000000  /* Generate TxDone Interrupt         */
-
-/* TX Status Information Word */
-#define TINFO_COL_CNT       0x01E00000  /* Collision Count                   */
-#define TINFO_DEFER         0x02000000  /* Packet Deferred (not an error)    */
-#define TINFO_EXCESS_DEF    0x04000000  /* Excessive Deferral                */
-#define TINFO_EXCESS_COL    0x08000000  /* Excessive Collision               */
-#define TINFO_LATE_COL      0x10000000  /* Late Collision Occured            */
-#define TINFO_UNDERRUN      0x20000000  /* Transmit Underrun                 */
-#define TINFO_NO_DESCR      0x40000000  /* No new Descriptor available       */
-#define TINFO_ERR           0x80000000  /* Error Occured (OR of all errors)  */
-
-/* ENET Device Revision ID */
-#define OLD_EMAC_MODULE_ID  0x39022000  /* Rev. ID for first rev '-'         */
-
-/* DP83848C PHY Registers */
-#define PHY_REG_BMCR        0x00        /* Basic Mode Control Register       */
-#define PHY_REG_BMSR        0x01        /* Basic Mode Status Register        */
-#define PHY_REG_IDR1        0x02        /* PHY Identifier 1                  */
-#define PHY_REG_IDR2        0x03        /* PHY Identifier 2                  */
-#define PHY_REG_ANAR        0x04        /* Auto-Negotiation Advertisement    */
-#define PHY_REG_ANLPAR      0x05        /* Auto-Neg. Link Partner Abitily    */
-#define PHY_REG_ANER        0x06        /* Auto-Neg. Expansion Register      */
-#define PHY_REG_ANNPTR      0x07        /* Auto-Neg. Next Page TX            */
-
-/* PHY Extended Registers */
-#define PHY_REG_STS         0x10        /* Status Register                   */
-#define PHY_REG_MICR        0x11        /* MII Interrupt Control Register    */
-#define PHY_REG_MISR        0x12        /* MII Interrupt Status Register     */
-#define PHY_REG_FCSCR       0x14        /* False Carrier Sense Counter       */
-#define PHY_REG_RECR        0x15        /* Receive Error Counter             */
-#define PHY_REG_PCSR        0x16        /* PCS Sublayer Config. and Status   */
-#define PHY_REG_RBR         0x17        /* RMII and Bypass Register          */
-#define PHY_REG_LEDCR       0x18        /* LED Direct Control Register       */
-#define PHY_REG_PHYCR       0x19        /* PHY Control Register              */
-#define PHY_REG_10BTSCR     0x1A        /* 10Base-T Status/Control Register  */
-#define PHY_REG_CDCTRL1     0x1B        /* CD Test Control and BIST Extens.  */
-#define PHY_REG_EDCR        0x1D        /* Energy Detect Control Register    */
-
-#define PHY_REG_SCSR        0x1F        /* PHY Special Control/Status Register */
-
-#define PHY_FULLD_100M      0x2100      /* Full Duplex 100Mbit               */
-#define PHY_HALFD_100M      0x2000      /* Half Duplex 100Mbit               */
-#define PHY_FULLD_10M       0x0100      /* Full Duplex 10Mbit                */
-#define PHY_HALFD_10M       0x0000      /* Half Duplex 10MBit                */
-#define PHY_AUTO_NEG        0x3000      /* Select Auto Negotiation           */
-
-#define DP83848C_DEF_ADR    0x0100      /* Default PHY device address        */
-#define DP83848C_ID         0x20005C90  /* PHY Identifier - DP83848C         */
-
-#define LAN8720_ID          0x0007C0F0  /* PHY Identifier - LAN8720          */
-
-#define PHY_STS_LINK        0x0001      /* PHY Status Link Mask              */
-#define PHY_STS_SPEED       0x0002      /* PHY Status Speed Mask             */
-#define PHY_STS_DUPLEX      0x0004      /* PHY Status Duplex Mask            */
-
-#define PHY_BMCR_RESET      0x8000      /* PHY Reset                         */
-
-#define PHY_BMSR_LINK       0x0004      /* PHY BMSR Link valid               */
-
-#define PHY_SCSR_100MBIT    0x0008      /* Speed: 1=100 MBit, 0=10Mbit       */
-#define PHY_SCSR_DUPLEX     0x0010      /* PHY Duplex Mask                   */
-
-
-static int phy_read(unsigned int PhyReg);
-static int phy_write(unsigned int PhyReg, unsigned short Data);
-
-static void txdscr_init(void);
-static void rxdscr_init(void);
-
-#if defined (__ICCARM__)
-#   define AHBSRAM1
-#elif defined(TOOLCHAIN_GCC_CR)
-#   define AHBSRAM1 __attribute__((section(".data.$RamPeriph32")))
-#else
-#   define AHBSRAM1     __attribute__((section("AHBSRAM1"),aligned))
-#endif
-
-AHBSRAM1 volatile uint8_t rxbuf[NUM_RX_FRAG][ETH_FRAG_SIZE];
-AHBSRAM1 volatile uint8_t txbuf[NUM_TX_FRAG][ETH_FRAG_SIZE];
-AHBSRAM1 volatile RX_DESC_TypeDef rxdesc[NUM_RX_FRAG];
-AHBSRAM1 volatile RX_STAT_TypeDef rxstat[NUM_RX_FRAG];
-AHBSRAM1 volatile TX_DESC_TypeDef txdesc[NUM_TX_FRAG];
-AHBSRAM1 volatile TX_STAT_TypeDef txstat[NUM_TX_FRAG];
-
-
-#if NEW_LOGIC
-static int rx_consume_offset = -1;
-static int tx_produce_offset = -1;
-#else
-static int send_doff =  0;
-static int send_idx  = -1;
-static int send_size =  0;
-
-static int receive_soff =  0;
-static int receive_idx  = -1;
-#endif
-
-static uint32_t phy_id = 0;
-
-static inline int rinc(int idx, int mod) {
-  ++idx;
-  idx %= mod;
-  return idx;
-}
-
-//extern unsigned int SystemFrequency;
-static inline unsigned int clockselect() {
-  if(SystemCoreClock < 10000000) {
-    return 1;
-  } else if(SystemCoreClock <  15000000) {
-    return 2;
-  } else if(SystemCoreClock <  20000000) {
-    return 3;
-  } else if(SystemCoreClock <  25000000) {
-    return 4;
-  } else if(SystemCoreClock <  35000000) {
-    return 5;
-  } else if(SystemCoreClock <  50000000) {
-    return 6;
-  } else if(SystemCoreClock <  70000000) {
-    return 7;
-  } else if(SystemCoreClock <  80000000) {
-    return 8;
-  } else if(SystemCoreClock <  90000000) {
-    return 9;
-  } else if(SystemCoreClock < 100000000) {
-    return 10;
-  } else if(SystemCoreClock < 120000000) {
-    return 11;
-  } else if(SystemCoreClock < 130000000) {
-    return 12;
-  } else if(SystemCoreClock < 140000000) {
-    return 13;
-  } else if(SystemCoreClock < 150000000) {
-    return 15;
-  } else if(SystemCoreClock < 160000000) {
-    return 16;
-  } else {
-    return 0;
-  }
-}
-
-#ifndef min
-#define min(x, y) (((x)<(y))?(x):(y))
-#endif
-
-/*----------------------------------------------------------------------------
-  Ethernet Device initialize
- *----------------------------------------------------------------------------*/
-int ethernet_init() {
-  int regv, tout;
-  char mac[ETHERNET_ADDR_SIZE];
-  unsigned int clock = clockselect();
-  
-  LPC_SC->PCONP |= 0x40000000;                       /* Power Up the EMAC controller. */
-  
-  LPC_PINCON->PINSEL2 = 0x50150105;                  /* Enable P1 Ethernet Pins. */
-  LPC_PINCON->PINSEL3 = (LPC_PINCON->PINSEL3 & ~0x0000000F) | 0x00000005;
-  
-   /* Reset all EMAC internal modules. */
-  LPC_EMAC->MAC1    = MAC1_RES_TX | MAC1_RES_MCS_TX | MAC1_RES_RX |
-                      MAC1_RES_MCS_RX | MAC1_SIM_RES | MAC1_SOFT_RES;
-  LPC_EMAC->Command = CR_REG_RES | CR_TX_RES | CR_RX_RES | CR_PASS_RUNT_FRM;
-
-  for(tout = 100; tout; tout--) __NOP();             /* A short delay after reset. */
-
-  LPC_EMAC->MAC1 = MAC1_PASS_ALL;                    /* Initialize MAC control registers. */
-  LPC_EMAC->MAC2 = MAC2_CRC_EN | MAC2_PAD_EN;
-  LPC_EMAC->MAXF = ETH_MAX_FLEN;
-  LPC_EMAC->CLRT = CLRT_DEF;
-  LPC_EMAC->IPGR = IPGR_DEF;
-
-  LPC_EMAC->Command = CR_RMII | CR_PASS_RUNT_FRM;    /* Enable Reduced MII interface. */
-
-  LPC_EMAC->MCFG = (clock << 0x2) & MCFG_CLK_SEL;    /* Set clock */
-  LPC_EMAC->MCFG |= MCFG_RES_MII;                    /* and reset */
-
-  for(tout = 100; tout; tout--) __NOP();             /* A short delay */
-
-  LPC_EMAC->MCFG = (clock << 0x2) & MCFG_CLK_SEL;
-  LPC_EMAC->MCMD = 0;
-
-  LPC_EMAC->SUPP = SUPP_RES_RMII;                    /* Reset Reduced MII Logic. */
-
-  for (tout = 100; tout; tout--) __NOP();            /* A short delay */
-
-  LPC_EMAC->SUPP = 0;
-
-  phy_write(PHY_REG_BMCR, PHY_BMCR_RESET);           /* perform PHY reset */
-  for(tout = 0x20000; ; tout--) {                    /* Wait for hardware reset to end. */
-    regv = phy_read(PHY_REG_BMCR);
-    if(regv < 0 || tout == 0) {
-       return -1;                                    /* Error */
-    }
-    if(!(regv & PHY_BMCR_RESET)) {
-       break;                                        /* Reset complete. */
-    }
-  }
-
-  phy_id =  (phy_read(PHY_REG_IDR1) << 16);
-  phy_id |= (phy_read(PHY_REG_IDR2) & 0XFFF0);
-
-  if (phy_id != DP83848C_ID && phy_id != LAN8720_ID) {
-      error("Unknown Ethernet PHY (%x)", (unsigned int)phy_id);
-  }
-
-  ethernet_set_link(-1, 0);
-
-  /* Set the Ethernet MAC Address registers */
-  ethernet_address(mac);
-  LPC_EMAC->SA0 = ((uint32_t)mac[5] << 8) | (uint32_t)mac[4];
-  LPC_EMAC->SA1 = ((uint32_t)mac[3] << 8) | (uint32_t)mac[2];
-  LPC_EMAC->SA2 = ((uint32_t)mac[1] << 8) | (uint32_t)mac[0];
-
-  txdscr_init();                                      /* initialize DMA TX Descriptor */
-  rxdscr_init();                                      /* initialize DMA RX Descriptor */
-
-  LPC_EMAC->RxFilterCtrl = RFC_UCAST_EN | RFC_MCAST_EN | RFC_BCAST_EN | RFC_PERFECT_EN;
-                                                      /* Receive Broadcast, Perfect Match Packets */
-
-  LPC_EMAC->IntEnable = INT_RX_DONE | INT_TX_DONE;    /* Enable EMAC interrupts. */
-  LPC_EMAC->IntClear  = 0xFFFF;                       /* Reset all interrupts */
-
-
-  LPC_EMAC->Command  |= (CR_RX_EN | CR_TX_EN);        /* Enable receive and transmit mode of MAC Ethernet core */
-  LPC_EMAC->MAC1     |= MAC1_REC_EN;
-
-#if NEW_LOGIC
-  rx_consume_offset = -1;
-  tx_produce_offset = -1;
-#else
-  send_doff =  0;
-  send_idx  = -1;
-  send_size =  0;
-
-  receive_soff =  0;
-  receive_idx  = -1;
-#endif
-
-  return 0;
-}
-
-/*----------------------------------------------------------------------------
-  Ethernet Device Uninitialize
- *----------------------------------------------------------------------------*/
-void ethernet_free() {
-  LPC_EMAC->IntEnable &= ~(INT_RX_DONE | INT_TX_DONE);
-  LPC_EMAC->IntClear   =  0xFFFF;
-  
-  LPC_SC->PCONP   &= ~0x40000000;       /* Power down the EMAC controller. */
-  
-  LPC_PINCON->PINSEL2 &= ~0x50150105;   /* Disable P1 ethernet pins. */
-  LPC_PINCON->PINSEL3  = (LPC_PINCON->PINSEL3 & ~0x0000000F) | 0x00000000;
-}
-
-// if(TxProduceIndex == TxConsumeIndex) buffer array is empty
-// if(TxProduceIndex == TxConsumeIndex - 1) buffer is full, should not fill
-// TxProduceIndex - The buffer that will/is being fileld by driver, s/w increment
-// TxConsumeIndex - The buffer that will/is beign sent by hardware
-
-int ethernet_write(const char *data, int slen) {
-
-#if NEW_LOGIC
-
-   if(tx_produce_offset < 0) { // mark as active if not already
-     tx_produce_offset = 0;
-   }
-
-   int index = LPC_EMAC->TxProduceIndex;
-
-   int remaining = ETH_MAX_FLEN - tx_produce_offset - 4; // bytes written plus checksum
-   int requested = slen;
-   int ncopy = min(remaining, requested);
-
-   void *pdst = (void *)(txdesc[index].Packet + tx_produce_offset);
-   void *psrc = (void *)(data);
-
-   if(ncopy > 0 ){
-     if(data != NULL) {
-       memcpy(pdst, psrc, ncopy);
-     } else {
-       memset(pdst, 0, ncopy);
-     }
-   }
-
-   tx_produce_offset += ncopy;
-
-   return ncopy;
-
-#else
-    void       *pdst, *psrc;
-    const int   dlen = ETH_FRAG_SIZE;
-    int         copy = 0;
-    int         soff = 0;
-
-    if(send_idx == -1) {
-        send_idx = LPC_EMAC->TxProduceIndex;
-    }
-
-    if(slen + send_doff > ethernet_MTU_SIZE) {
-       return -1;
-    }
-
-    do {
-        copy = min(slen - soff, dlen - send_doff);
-        pdst = (void *)(txdesc[send_idx].Packet + send_doff);
-        psrc = (void *)(data + soff);
-        if(send_doff + copy > ETH_FRAG_SIZE) {
-            txdesc[send_idx].Ctrl = (send_doff-1) | (TCTRL_INT);
-            send_idx = rinc(send_idx, NUM_TX_FRAG);
-            send_doff = 0;
-        }
-
-        if(data != NULL) {
-            memcpy(pdst, psrc, copy);
-        } else {
-            memset(pdst, 0, copy);
-        }
-
-        soff += copy;
-        send_doff += copy;
-        send_size += copy;
-    } while(soff != slen);
-
-    return soff;
-#endif
-}
-
-int ethernet_send() {
-
-#if NEW_LOGIC
-  if(tx_produce_offset < 0) { // no buffer active
-    return -1;
-  }
-
-  // ensure there is a link
-  if(!ethernet_link()) {
-    return -2;
-  }
-
-  // we have been writing in to a buffer, so finalise it
-  int size = tx_produce_offset;
-  int index = LPC_EMAC->TxProduceIndex;
-  txdesc[index].Ctrl = (tx_produce_offset-1) | (TCTRL_INT | TCTRL_LAST);
-
-  // Increment ProduceIndex to allow it to be sent
-  // We can only do this if the next slot is free
-  int next = rinc(index, NUM_TX_FRAG);
-  while(next == LPC_EMAC->TxConsumeIndex) {
-    for(int i=0; i<1000; i++) { __NOP(); }
-  }
-
-  LPC_EMAC->TxProduceIndex = next;
-  tx_produce_offset = -1;
-  return size;
-
-#else
-    int s = send_size;
-    txdesc[send_idx].Ctrl = (send_doff-1) | (TCTRL_INT | TCTRL_LAST);
-    send_idx  = rinc(send_idx, NUM_TX_FRAG);
-    LPC_EMAC->TxProduceIndex = send_idx;
-    send_doff =  0;
-    send_idx  = -1;
-    send_size =  0;
-    return s;
-#endif
-}
-
-// RxConsmeIndex - The index of buffer the driver will/is reading from. Driver should inc once read
-// RxProduceIndex - The index of buffer that will/is being filled by MAC. H/w will inc once rxd
-//
-// if(RxConsumeIndex == RxProduceIndex) buffer array is empty
-// if(RxConsumeIndex == RxProduceIndex + 1) buffer array is full
-
-// Recevies an arrived ethernet packet.
-// Receiving an ethernet packet will drop the last received ethernet packet
-// and make a new ethernet packet ready to read.
-// Returns size of packet, else 0 if nothing to receive
-
-// We read from RxConsumeIndex from position rx_consume_offset
-// if rx_consume_offset < 0, then we have not recieved the RxConsumeIndex packet for reading
-// rx_consume_offset = -1 // no frame
-// rx_consume_offset = 0  // start of frame
-// Assumption: A fragment should alway be a whole frame
-
-int ethernet_receive() {
-#if NEW_LOGIC
-
-  // if we are currently reading a valid RxConsume buffer, increment to the next one
-  if(rx_consume_offset >= 0) {
-    LPC_EMAC->RxConsumeIndex = rinc(LPC_EMAC->RxConsumeIndex, NUM_RX_FRAG);
-  }
-
-  // if the buffer is empty, mark it as no valid buffer
-  if(LPC_EMAC->RxConsumeIndex == LPC_EMAC->RxProduceIndex) {
-    rx_consume_offset = -1;
-    return 0;
-  }
-
-  uint32_t info = rxstat[LPC_EMAC->RxConsumeIndex].Info;
-  rx_consume_offset = 0;
-
-  // check if it is not marked as last or for errors
-  if(!(info & RINFO_LAST_FLAG) || (info & RINFO_ERR_MASK)) {
-    return -1;
-  }
-
-  int size = (info & RINFO_SIZE) + 1;
-  return size - 4; // don't include checksum bytes
-
-#else
-    if(receive_idx == -1) {
-      receive_idx = LPC_EMAC->RxConsumeIndex;
-    } else {
-        while(!(rxstat[receive_idx].Info & RINFO_LAST_FLAG) && ((uint32_t)receive_idx != LPC_EMAC->RxProduceIndex)) {
-            receive_idx  = rinc(receive_idx, NUM_RX_FRAG);
-        }
-        unsigned int info =   rxstat[receive_idx].Info;
-        int slen =  (info & RINFO_SIZE) + 1;
-
-        if(slen > ethernet_MTU_SIZE || (info & RINFO_ERR_MASK)) {
-            /* Invalid frame, ignore it and free buffer. */
-            receive_idx = rinc(receive_idx, NUM_RX_FRAG);
-        }
-        receive_idx = rinc(receive_idx, NUM_RX_FRAG);
-        receive_soff = 0;
-        
-        LPC_EMAC->RxConsumeIndex = receive_idx;
-    }
-    
-    if((uint32_t)receive_idx == LPC_EMAC->RxProduceIndex) {
-        receive_idx = -1;
-        return 0;
-    }
-    
-    return (rxstat[receive_idx].Info & RINFO_SIZE) - 3;
-#endif
-}
-
-// Read from an recevied ethernet packet.
-// After receive returnd a number bigger than 0 it is
-// possible to read bytes from this packet.
-// Read will write up to size bytes into data.
-// It is possible to use read multible times.
-// Each time read will start reading after the last read byte before.
-
-int ethernet_read(char *data, int dlen) {
-#if NEW_LOGIC
-  // Check we have a valid buffer to read
-  if(rx_consume_offset < 0) {
-    return 0;
-  }
-
-  // Assume 1 fragment block
-  uint32_t info = rxstat[LPC_EMAC->RxConsumeIndex].Info;
-  int size = (info & RINFO_SIZE) + 1 - 4; // exclude checksum
-
-  int remaining = size - rx_consume_offset;
-  int requested = dlen;
-  int ncopy = min(remaining, requested);
-
-  void *psrc = (void *)(rxdesc[LPC_EMAC->RxConsumeIndex].Packet + rx_consume_offset);
-  void *pdst = (void *)(data);
-
-  if(data != NULL && ncopy > 0) {
-    memcpy(pdst, psrc, ncopy);
-  }
-
-  rx_consume_offset += ncopy;
-
-  return ncopy;
-#else
-    int          slen;
-    int          copy   = 0;
-    unsigned int more;
-    unsigned int info;
-    void        *pdst, *psrc;
-    int          doff = 0;
-    
-    if((uint32_t)receive_idx == LPC_EMAC->RxProduceIndex || receive_idx == -1) {
-        return 0;
-    }
-    
-    do {
-        info =   rxstat[receive_idx].Info;
-        more = !(info & RINFO_LAST_FLAG);
-        slen =  (info & RINFO_SIZE) + 1;
-        
-        if(slen > ethernet_MTU_SIZE || (info & RINFO_ERR_MASK)) {
-            /* Invalid frame, ignore it and free buffer. */
-            receive_idx = rinc(receive_idx, NUM_RX_FRAG);
-        } else {
-            
-            copy = min(slen - receive_soff, dlen - doff);
-            psrc = (void *)(rxdesc[receive_idx].Packet + receive_soff);
-            pdst = (void *)(data + doff);
-            
-            if(data != NULL) {
-                /* check if Buffer available */
-                memcpy(pdst, psrc, copy);
-            }
-            
-            receive_soff += copy;
-            doff += copy;
-            
-            if((more && (receive_soff == slen))) {
-                receive_idx = rinc(receive_idx, NUM_RX_FRAG);
-                receive_soff = 0;
-            }
-        }
-    } while(more && !(doff == dlen) && !receive_soff);
-    
-    return doff;
-#endif
-}
-
-int ethernet_link(void) {
-    if (phy_id == DP83848C_ID) {
-      return (phy_read(PHY_REG_STS) & PHY_STS_LINK);
-    }
-    else { // LAN8720_ID
-      return (phy_read(PHY_REG_BMSR) & PHY_BMSR_LINK);
-    }
-}
-
-static int phy_write(unsigned int PhyReg, unsigned short Data) {
-    unsigned int timeOut;
-    
-    LPC_EMAC->MADR = DP83848C_DEF_ADR | PhyReg;
-    LPC_EMAC->MWTD = Data;
-    
-    for(timeOut = 0; timeOut < MII_WR_TOUT; timeOut++) {     /* Wait until operation completed */
-        if((LPC_EMAC->MIND & MIND_BUSY) == 0) {
-            return 0;
-        }
-    }
-    
-    return -1;
-}
-
-static int phy_read(unsigned int PhyReg) {
-    unsigned int timeOut;
-    
-    LPC_EMAC->MADR = DP83848C_DEF_ADR | PhyReg;
-    LPC_EMAC->MCMD = MCMD_READ;
-    
-    for(timeOut = 0; timeOut < MII_RD_TOUT; timeOut++) {     /* Wait until operation completed */
-        if((LPC_EMAC->MIND & MIND_BUSY) == 0) {
-            LPC_EMAC->MCMD = 0;
-            return LPC_EMAC->MRDD;                           /* Return a 16-bit value. */
-        }
-    }
-    
-    return -1;
-}
-
-
-static void txdscr_init() {
-    int i;
-    
-    for(i = 0; i < NUM_TX_FRAG; i++) {
-        txdesc[i].Packet = (uint32_t)&txbuf[i];
-        txdesc[i].Ctrl   = 0;
-        txstat[i].Info   = 0;
-    }
-    
-    LPC_EMAC->TxDescriptor       = (uint32_t)txdesc;         /* Set EMAC Transmit Descriptor Registers. */
-    LPC_EMAC->TxStatus           = (uint32_t)txstat;
-    LPC_EMAC->TxDescriptorNumber = NUM_TX_FRAG-1;
-    
-    LPC_EMAC->TxProduceIndex  = 0;                           /* Tx Descriptors Point to 0 */
-}
-
-static void rxdscr_init() {
-    int i;
-    
-    for(i = 0; i < NUM_RX_FRAG; i++) {
-        rxdesc[i].Packet  = (uint32_t)&rxbuf[i];
-        rxdesc[i].Ctrl    = RCTRL_INT | (ETH_FRAG_SIZE-1);
-        rxstat[i].Info    = 0;
-        rxstat[i].HashCRC = 0;
-    }
-    
-    LPC_EMAC->RxDescriptor       = (uint32_t)rxdesc;        /* Set EMAC Receive Descriptor Registers. */
-    LPC_EMAC->RxStatus           = (uint32_t)rxstat;
-    LPC_EMAC->RxDescriptorNumber = NUM_RX_FRAG-1;
-    
-    LPC_EMAC->RxConsumeIndex  = 0;                          /* Rx Descriptors Point to 0 */
-}
-
-void ethernet_address(char *mac) {
-    mbed_mac_address(mac);
-}
-
-void ethernet_set_link(int speed, int duplex) {
-    unsigned short phy_data;
-    int tout;
-    
-    if((speed < 0) || (speed > 1)) {
-        phy_data = PHY_AUTO_NEG;
-    } else {
-        phy_data = (((unsigned short) speed << 13) |
-                    ((unsigned short) duplex << 8));
-    }
-    
-    phy_write(PHY_REG_BMCR, phy_data);
-    
-    for(tout = 100; tout; tout--) { __NOP(); }     /* A short delay */
-    
-    switch(phy_id) {
-        case DP83848C_ID:
-            phy_data = phy_read(PHY_REG_STS);
-            
-            if(phy_data & PHY_STS_DUPLEX) {
-                LPC_EMAC->MAC2 |= MAC2_FULL_DUP;
-                LPC_EMAC->Command |= CR_FULL_DUP;
-                LPC_EMAC->IPGT = IPGT_FULL_DUP;
-            } else {
-            LPC_EMAC->MAC2 &= ~MAC2_FULL_DUP;
-                LPC_EMAC->Command &= ~CR_FULL_DUP;
-                LPC_EMAC->IPGT = IPGT_HALF_DUP;
-            }
-            
-            if(phy_data & PHY_STS_SPEED) {
-                LPC_EMAC->SUPP &= ~SUPP_SPEED;
-            } else {
-                LPC_EMAC->SUPP |= SUPP_SPEED;
-            }
-            break;
-        
-        case LAN8720_ID:
-            phy_data = phy_read(PHY_REG_SCSR);
-            
-            if (phy_data & PHY_SCSR_DUPLEX) {
-                LPC_EMAC->MAC2 |= MAC2_FULL_DUP;
-                LPC_EMAC->Command |= CR_FULL_DUP;
-                LPC_EMAC->IPGT = IPGT_FULL_DUP;
-            } else {
-                LPC_EMAC->Command &= ~CR_FULL_DUP;
-                LPC_EMAC->IPGT = IPGT_HALF_DUP;
-            }
-            
-            if(phy_data & PHY_SCSR_100MBIT) {
-                LPC_EMAC->SUPP |= SUPP_SPEED;
-            } else {
-                LPC_EMAC->SUPP &= ~SUPP_SPEED;
-            }
-            break;
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC23XX/gpio_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "gpio_api.h"
-#include "pinmap.h"
-
-uint32_t gpio_set(PinName pin) {
-    LPC_SC->SCS |= 1; // High speed GPIO is enabled on ports 0 and 1
-    
-    pin_function(pin, 0);
-    
-    return (1 << ((int)pin & 0x1F));
-}
-
-void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) {
-    if (pin == NC) return;
-    
-    obj->pin = pin;
-    obj->mask = gpio_set(pin);
-    
-    LPC_GPIO_TypeDef *port_reg = (LPC_GPIO_TypeDef *) ((int)pin & ~0x1F);
-    
-    obj->reg_set = &port_reg->FIOSET;
-    obj->reg_clr = &port_reg->FIOCLR;
-    obj->reg_in  = &port_reg->FIOPIN;
-    obj->reg_dir = &port_reg->FIODIR;
-    
-    gpio_dir(obj, direction);
-    switch (direction) {
-        case PIN_OUTPUT: pin_mode(pin, PullNone); break;
-        case PIN_INPUT : pin_mode(pin, PullDown); break;
-    }
-}
-
-void gpio_mode(gpio_t *obj, PinMode mode) {
-    pin_mode(obj->pin, mode);
-}
-
-void gpio_dir(gpio_t *obj, PinDirection direction) {
-    switch (direction) {
-        case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break;
-        case PIN_OUTPUT: *obj->reg_dir |=  obj->mask; break;
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC23XX/gpio_irq_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "gpio_irq_api.h"
-#include "error.h"
-#include <stddef.h>
-#include "cmsis.h"
-
-#define CHANNEL_NUM     48
-
-static uint32_t channel_ids[CHANNEL_NUM] = {0};
-static gpio_irq_handler irq_handler;
-
-static void handle_interrupt_in(void) {
-    // Read in all current interrupt registers. We do this once as the
-    // GPIO interrupt registers are on the APB bus, and this is slow.
-    uint32_t rise0 = LPC_GPIOINT->IO0IntStatR;
-    uint32_t fall0 = LPC_GPIOINT->IO0IntStatF;
-    uint32_t rise2 = LPC_GPIOINT->IO2IntStatR;
-    uint32_t fall2 = LPC_GPIOINT->IO2IntStatF;
-    uint32_t mask0 = 0;
-    uint32_t mask2 = 0;
-    int i;
-    
-    // P0.0-0.31
-    for (i = 0; i < 32; i++) {
-        uint32_t pmask = (1 << i);
-        if (rise0 & pmask) {
-            mask0 |= pmask;
-            if (channel_ids[i] != 0)
-                irq_handler(channel_ids[i], IRQ_RISE);
-        }
-        if (fall0 & pmask) {
-            mask0 |= pmask;
-            if (channel_ids[i] != 0)
-                irq_handler(channel_ids[i], IRQ_FALL);
-        }
-    }
-    
-    // P2.0-2.15
-    for (i = 0; i < 16; i++) {
-        uint32_t pmask = (1 << i);
-        int channel_index = i + 32;
-        if (rise2 & pmask) {
-            mask2 |= pmask;
-            if (channel_ids[channel_index] != 0)
-                irq_handler(channel_ids[channel_index], IRQ_RISE);
-        }
-        if (fall2 & pmask) {
-            mask2 |= pmask;
-            if (channel_ids[channel_index] != 0)
-                irq_handler(channel_ids[channel_index], IRQ_FALL);
-        }
-    }
-    
-    // Clear the interrupts we just handled
-    LPC_GPIOINT->IO0IntClr = mask0;
-    LPC_GPIOINT->IO2IntClr = mask2;
-}
-
-int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id) {
-    if (pin == NC) return -1;
-    
-    irq_handler = handler;
-    
-    obj->port = (int)pin & ~0x1F;
-    obj->pin = (int)pin & 0x1F;
-    
-    // Interrupts available only on GPIO0 and GPIO2
-    if (obj->port != LPC_GPIO0_BASE && obj->port != LPC_GPIO2_BASE) {
-        error("pins on this port cannot generate interrupts\n");
-    }
-    
-    // put us in the interrupt table
-    int index = (obj->port == LPC_GPIO0_BASE) ? obj->pin : obj->pin + 32;
-    channel_ids[index] = id;
-    obj->ch = index;
-    
-    NVIC_SetVector(EINT3_IRQn, (uint32_t)handle_interrupt_in);
-    NVIC_EnableIRQ(EINT3_IRQn);
-    
-    return 0;
-}
-
-void gpio_irq_free(gpio_irq_t *obj) {
-    channel_ids[obj->ch] = 0;
-}
-
-void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
-    // ensure nothing is pending
-    switch (obj->port) {
-         case LPC_GPIO0_BASE: LPC_GPIOINT->IO0IntClr = 1 << obj->pin; break;
-         case LPC_GPIO2_BASE: LPC_GPIOINT->IO2IntClr = 1 << obj->pin; break;
-    }
-    
-    // enable the pin interrupt
-    if (event == IRQ_RISE) {
-        switch (obj->port) {
-            case LPC_GPIO0_BASE:
-                if (enable) {
-                    LPC_GPIOINT->IO0IntEnR |= 1 << obj->pin;
-                } else {
-                    LPC_GPIOINT->IO0IntEnR &= ~(1 << obj->pin);
-                }
-                break;
-            case LPC_GPIO2_BASE:
-                if (enable) {
-                    LPC_GPIOINT->IO2IntEnR |= 1 << obj->pin;
-                } else {
-                    LPC_GPIOINT->IO2IntEnR &= ~(1 << obj->pin);
-                }
-                break;
-        }
-    } else {
-        switch (obj->port) {
-            case LPC_GPIO0_BASE:
-                if (enable) {
-                    LPC_GPIOINT->IO0IntEnF |= 1 << obj->pin;
-                } else {
-                    LPC_GPIOINT->IO0IntEnF &= ~(1 << obj->pin);
-                }
-                break;
-            
-            case LPC_GPIO2_BASE:
-                if (enable) {
-                    LPC_GPIOINT->IO2IntEnF |= 1 << obj->pin;
-                } else {
-                    LPC_GPIOINT->IO2IntEnF &= ~(1 << obj->pin);
-                }
-                break;
-        }
-    }
-}
-
-void gpio_irq_enable(gpio_irq_t *obj) {
-    NVIC_EnableIRQ(EINT3_IRQn);
-}
-
-void gpio_irq_disable(gpio_irq_t *obj) {
-    NVIC_DisableIRQ(EINT3_IRQn);
-}
-
--- a/targets/hal/TARGET_NXP/TARGET_LPC23XX/gpio_object.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_GPIO_OBJECT_H
-#define MBED_GPIO_OBJECT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
-    PinName  pin;
-    uint32_t mask;
-
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_set;
-    __IO uint32_t *reg_clr;
-    __I  uint32_t *reg_in;
-} gpio_t;
-
-static inline void gpio_write(gpio_t *obj, int value) {
-    if (value)
-        *obj->reg_set = obj->mask;
-    else
-        *obj->reg_clr = obj->mask;
-}
-
-static inline int gpio_read(gpio_t *obj) {
-    return ((*obj->reg_in & obj->mask) ? 1 : 0);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC23XX/i2c_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,397 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "i2c_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_I2C_SDA[] = {
-    {P0_0 , I2C_1, 3},
-    {P0_10, I2C_2, 2},
-    {P0_19, I2C_1, 3},
-    {P0_27, I2C_0, 1},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_I2C_SCL[] = {
-    {P0_1 , I2C_1, 3},
-    {P0_11, I2C_2, 2},
-    {P0_20, I2C_1, 3},
-    {P0_28, I2C_0, 1},
-    {NC   , NC,    0}
-};
-
-#define I2C_CONSET(x)       (x->i2c->I2CONSET)
-#define I2C_CONCLR(x)       (x->i2c->I2CONCLR)
-#define I2C_STAT(x)         (x->i2c->I2STAT)
-#define I2C_DAT(x)          (x->i2c->I2DAT)
-#define I2C_SCLL(x, val)    (x->i2c->I2SCLL = val)
-#define I2C_SCLH(x, val)    (x->i2c->I2SCLH = val)
-
-static const uint32_t I2C_addr_offset[2][4] = {
-    {0x0C, 0x20, 0x24, 0x28},
-    {0x30, 0x34, 0x38, 0x3C}
-};
-
-static inline void i2c_conclr(i2c_t *obj, int start, int stop, int interrupt, int acknowledge) {
-    I2C_CONCLR(obj) = (start << 5)
-                    | (stop << 4)
-                    | (interrupt << 3)
-                    | (acknowledge << 2);
-}
-
-static inline void i2c_conset(i2c_t *obj, int start, int stop, int interrupt, int acknowledge) {
-    I2C_CONSET(obj) = (start << 5)
-                    | (stop << 4)
-                    | (interrupt << 3)
-                    | (acknowledge << 2);
-}
-
-// Clear the Serial Interrupt (SI)
-static inline void i2c_clear_SI(i2c_t *obj) {
-    i2c_conclr(obj, 0, 0, 1, 0);
-}
-
-static inline int i2c_status(i2c_t *obj) {
-    return I2C_STAT(obj);
-}
-
-// Wait until the Serial Interrupt (SI) is set
-static int i2c_wait_SI(i2c_t *obj) {
-    int timeout = 0;
-    while (!(I2C_CONSET(obj) & (1 << 3))) {
-        timeout++;
-        if (timeout > 100000) return -1;
-    }
-    return 0;
-}
-
-static inline void i2c_interface_enable(i2c_t *obj) {
-    I2C_CONSET(obj) = 0x40;
-}
-
-static inline void i2c_power_enable(i2c_t *obj) {
-    switch ((int)obj->i2c) {
-        case I2C_0: LPC_SC->PCONP |= 1 << 7; break;
-        case I2C_1: LPC_SC->PCONP |= 1 << 19; break;
-        case I2C_2: LPC_SC->PCONP |= 1 << 26; break;
-    }
-}
-
-void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
-    // determine the SPI to use
-    I2CName i2c_sda = (I2CName)pinmap_peripheral(sda, PinMap_I2C_SDA);
-    I2CName i2c_scl = (I2CName)pinmap_peripheral(scl, PinMap_I2C_SCL);
-    obj->i2c = (LPC_I2C_TypeDef *)pinmap_merge(i2c_sda, i2c_scl);
-    
-    if ((int)obj->i2c == NC) {
-        error("I2C pin mapping failed");
-    }
-    
-    // enable power
-    i2c_power_enable(obj);
-    
-    // set default frequency at 100k
-    i2c_frequency(obj, 100000);
-    i2c_conclr(obj, 1, 1, 1, 1);
-    i2c_interface_enable(obj);
-    
-    pinmap_pinout(sda, PinMap_I2C_SDA);
-    pinmap_pinout(scl, PinMap_I2C_SCL);
-}
-
-inline int i2c_start(i2c_t *obj) {
-    int status = 0;
-    // 8.1 Before master mode can be entered, I2CON must be initialised to:
-    //  - I2EN STA STO SI AA - -
-    //  -  1    0   0   0  x - -
-    // if AA = 0, it can't enter slave mode
-    i2c_conclr(obj, 1, 1, 1, 1);
-    
-    // The master mode may now be entered by setting the STA bit
-    // this will generate a start condition when the bus becomes free
-    i2c_conset(obj, 1, 0, 0, 1);
-    
-    i2c_wait_SI(obj);
-    status = i2c_status(obj);
-    
-    // Clear start bit now transmitted, and interrupt bit
-    i2c_conclr(obj, 1, 0, 0, 0);
-    return status;
-}
-
-inline int i2c_stop(i2c_t *obj) {
-    int timeout = 0;
-
-    // write the stop bit
-    i2c_conset(obj, 0, 1, 0, 0);
-    i2c_clear_SI(obj);
-    
-    // wait for STO bit to reset
-    while (I2C_CONSET(obj) & (1 << 4)) {
-        timeout ++;
-        if (timeout > 100000) return 1;
-    }
-
-    return 0;
-}
-
-static inline int i2c_do_write(i2c_t *obj, int value, uint8_t addr) {
-    // write the data
-    I2C_DAT(obj) = value;
-    
-    // clear SI to init a send
-    i2c_clear_SI(obj);
-    
-    // wait and return status
-    i2c_wait_SI(obj);
-    return i2c_status(obj);
-}
-
-static inline int i2c_do_read(i2c_t *obj, int last) {
-    // we are in state 0x40 (SLA+R tx'd) or 0x50 (data rx'd and ack)
-    if (last) {
-        i2c_conclr(obj, 0, 0, 0, 1); // send a NOT ACK
-    } else {
-        i2c_conset(obj, 0, 0, 0, 1); // send a ACK
-    }
-    
-    // accept byte
-    i2c_clear_SI(obj);
-    
-    // wait for it to arrive
-    i2c_wait_SI(obj);
-    
-    // return the data
-    return (I2C_DAT(obj) & 0xFF);
-}
-
-void i2c_frequency(i2c_t *obj, int hz) {
-    // [TODO] set pclk to /4
-    uint32_t PCLK = SystemCoreClock / 4;
-    
-    uint32_t pulse = PCLK / (hz * 2);
-    
-    // I2C Rate
-    I2C_SCLL(obj, pulse);
-    I2C_SCLH(obj, pulse);
-}
-
-// The I2C does a read or a write as a whole operation
-// There are two types of error conditions it can encounter
-//  1) it can not obtain the bus
-//  2) it gets error responses at part of the transmission
-//
-// We tackle them as follows:
-//  1) we retry until we get the bus. we could have a "timeout" if we can not get it
-//      which basically turns it in to a 2)
-//  2) on error, we use the standard error mechanisms to report/debug
-//
-// Therefore an I2C transaction should always complete. If it doesn't it is usually
-// because something is setup wrong (e.g. wiring), and we don't need to programatically
-// check for that
-int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) {
-    int count, status;
-    
-    status = i2c_start(obj);
-    
-    if ((status != 0x10) && (status != 0x08)) {
-        i2c_stop(obj);
-        return I2C_ERROR_BUS_BUSY;
-    }
-    
-    status = i2c_do_write(obj, (address | 0x01), 1);
-    if (status != 0x40) {
-        i2c_stop(obj);
-        return I2C_ERROR_NO_SLAVE;
-    }
-    
-    // Read in all except last byte
-    for (count = 0; count < (length - 1); count++) {
-        int value = i2c_do_read(obj, 0);
-        status = i2c_status(obj);
-        if (status != 0x50) {
-            i2c_stop(obj);
-            return count;
-        }
-        data[count] = (char) value;
-    }
-    
-    // read in last byte
-    int value = i2c_do_read(obj, 1);
-    status = i2c_status(obj);
-    if (status != 0x58) {
-        i2c_stop(obj);
-        return length - 1;
-    }
-    
-    data[count] = (char) value;
-    
-    // If not repeated start, send stop.
-    if (stop) {
-        i2c_stop(obj);
-    }
-    
-    return length;
-}
-
-int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) {
-    int i, status;
-    
-    status = i2c_start(obj);
-    
-    if ((status != 0x10) && (status != 0x08)) {
-        i2c_stop(obj);
-        return I2C_ERROR_BUS_BUSY;
-    }
-    
-    status = i2c_do_write(obj, (address & 0xFE), 1);
-    if (status != 0x18) {
-        i2c_stop(obj);
-        return I2C_ERROR_NO_SLAVE;
-    }
-    
-    for (i=0; i<length; i++) {
-        status = i2c_do_write(obj, data[i], 0);
-        if (status != 0x28) {
-            i2c_stop(obj);
-            return i;
-        }
-    }
-    
-    // clearing the serial interrupt here might cause an unintended rewrite of the last byte
-    // see also issue report https://mbed.org/users/mbed_official/code/mbed/issues/1
-    // i2c_clear_SI(obj);
-    
-    // If not repeated start, send stop.
-    if (stop) {
-        i2c_stop(obj);
-    }
-    
-    return length;
-}
-
-void i2c_reset(i2c_t *obj) {
-    i2c_stop(obj);
-}
-
-int i2c_byte_read(i2c_t *obj, int last) {
-    return (i2c_do_read(obj, last) & 0xFF);
-}
-
-int i2c_byte_write(i2c_t *obj, int data) {
-    int ack;
-    int status = i2c_do_write(obj, (data & 0xFF), 0);
-    
-    switch(status) {
-        case 0x18: case 0x28:       // Master transmit ACKs
-            ack = 1;
-            break;
-        
-        case 0x40:                  // Master receive address transmitted ACK
-            ack = 1;
-            break;
-        
-        case 0xB8:                  // Slave transmit ACK
-            ack = 1;
-            break;
-        
-        default:
-            ack = 0;
-            break;
-    }
-    
-    return ack;
-}
-
-void i2c_slave_mode(i2c_t *obj, int enable_slave) {
-    if (enable_slave != 0) {
-        i2c_conclr(obj, 1, 1, 1, 0);
-        i2c_conset(obj, 0, 0, 0, 1);
-    } else {
-        i2c_conclr(obj, 1, 1, 1, 1);
-    }
-}
-
-int i2c_slave_receive(i2c_t *obj) {
-    int status;
-    int retval;
-    
-    status = i2c_status(obj);
-    switch(status) {
-        case 0x60: retval = 3; break;
-        case 0x70: retval = 2; break;
-        case 0xA8: retval = 1; break;
-        default  : retval = 0; break;
-    }
-    
-    return(retval);
-}
-
-int i2c_slave_read(i2c_t *obj, char *data, int length) {
-    int count = 0;
-    int status;
-    
-    do {
-        i2c_clear_SI(obj);
-        i2c_wait_SI(obj);
-        status = i2c_status(obj);
-        if((status == 0x80) || (status == 0x90)) {
-            data[count] = I2C_DAT(obj) & 0xFF;
-        }
-        count++;
-    } while (((status == 0x80) || (status == 0x90) ||
-            (status == 0x060) || (status == 0x70)) && (count < length));
-    
-    if(status != 0xA0) {
-        i2c_stop(obj);
-    }
-    
-    i2c_clear_SI(obj);
-    
-    return count;
-}
-
-int i2c_slave_write(i2c_t *obj, const char *data, int length) {
-    int count = 0;
-    int status;
-    
-    if(length <= 0) {
-        return(0);
-    }
-    
-    do {
-        status = i2c_do_write(obj, data[count], 0);
-        count++;
-    } while ((count < length) && (status == 0xB8));
-    
-    if((status != 0xC0) && (status != 0xC8)) {
-        i2c_stop(obj);
-    }
-    
-    i2c_clear_SI(obj);
-    
-    return(count);
-}
-
-void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask) {
-    uint32_t addr;
-    
-    if ((idx >= 0) && (idx <= 3)) {
-        addr = ((uint32_t)obj->i2c) + I2C_addr_offset[0][idx];
-        *((uint32_t *) addr) = address & 0xFF;
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC23XX/objects.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_OBJECTS_H
-#define MBED_OBJECTS_H
-
-#include "cmsis.h"
-#include "PortNames.h"
-#include "PeripheralNames.h"
-#include "PinNames.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct gpio_irq_s {
-    uint32_t port;
-    uint32_t pin;
-    uint32_t ch;
-};
-
-struct port_s {
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_out;
-    __I  uint32_t *reg_in;
-    PortName port;
-    uint32_t mask;
-};
-
-struct pwmout_s {
-    __IO uint32_t *MR;
-    PWMName pwm;
-};
-
-struct serial_s {
-    LPC_UART_TypeDef *uart;
-    int index;
-};
-
-struct analogin_s {
-    ADCName adc;
-};
-
-struct dac_s {
-    DACName dac;
-};
-
-struct can_s {
-    LPC_CAN_TypeDef *dev;
-};
-
-struct i2c_s {
-    LPC_I2C_TypeDef *i2c;
-};
-
-struct spi_s {
-    LPC_SSP_TypeDef *spi;
-};
-
-#include "gpio_object.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC23XX/pinmap.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "pinmap.h"
-#include "error.h"
-
-void pin_function(PinName pin, int function) {
-    if (pin == (PinName)NC) return;
-    
-    uint32_t pin_number = (uint32_t)pin - (uint32_t)P0_0;
-    int index = pin_number >> 4;
-    int offset = (pin_number & 0xF) << 1;
-    
-    PINCONARRAY->PINSEL[index] &= ~(0x3 << offset);
-    PINCONARRAY->PINSEL[index] |= function << offset;
-}
-
-void pin_mode(PinName pin, PinMode mode) {
-    if (pin == (PinName)NC) { return; }
-    
-    uint32_t pin_number = (uint32_t)pin - (uint32_t)P0_0;
-    int index = pin_number >> 5;
-    int offset = pin_number & 0x1F;
-    uint32_t drain = ((uint32_t) mode & (uint32_t) OpenDrain) >> 2;
-    
-    if (mode == OpenDrain) error("OpenDrain not supported on LPC2368");
-    
-    if (!drain) {
-        index = pin_number >> 4;
-        offset = (pin_number & 0xF) << 1;
-        
-        PINCONARRAY->PINMODE[index] &= ~(0x3 << offset);
-        PINCONARRAY->PINMODE[index] |= (uint32_t)mode << offset;
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC23XX/port_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "port_api.h"
-#include "pinmap.h"
-#include "gpio_api.h"
-
-PinName port_pin(PortName port, int pin_n) {
-    return (PinName)(LPC_GPIO0_BASE + ((port << PORT_SHIFT) | pin_n));
-}
-
-void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
-    obj->port = port;
-    obj->mask = mask;
-    
-    LPC_GPIO_TypeDef *port_reg = (LPC_GPIO_TypeDef *)(LPC_GPIO0_BASE + ((int)port * 0x20));
-    
-    // Do not use masking, because it prevents the use of the unmasked pins
-    // port_reg->FIOMASK = ~mask;
-    
-    obj->reg_out = &port_reg->FIOPIN;
-    obj->reg_in  = &port_reg->FIOPIN;
-    obj->reg_dir  = &port_reg->FIODIR;
-    
-    uint32_t i;
-    // The function is set per pin: reuse gpio logic
-    for (i=0; i<32; i++) {
-        if (obj->mask & (1<<i)) {
-            gpio_set(port_pin(obj->port, i));
-        }
-    }
-    
-    port_dir(obj, dir);
-}
-
-void port_mode(port_t *obj, PinMode mode) {
-    uint32_t i;
-    // The mode is set per pin: reuse pinmap logic
-    for (i=0; i<32; i++) {
-        if (obj->mask & (1<<i)) {
-            pin_mode(port_pin(obj->port, i), mode);
-        }
-    }
-}
-
-void port_dir(port_t *obj, PinDirection dir) {
-    switch (dir) {
-        case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break;
-        case PIN_OUTPUT: *obj->reg_dir |=  obj->mask; break;
-    }
-}
-
-void port_write(port_t *obj, int value) {
-    *obj->reg_out = (*obj->reg_in & ~obj->mask) | (value & obj->mask);
-}
-
-int port_read(port_t *obj) {
-    return (*obj->reg_in & obj->mask);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC23XX/pwmout_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "pwmout_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-#define TCR_CNT_EN       0x00000001
-#define TCR_RESET        0x00000002
-
-//  PORT ID, PWM ID, Pin function
-static const PinMap PinMap_PWM[] = {
-    {P1_18, PWM_1, 2},
-    {P1_20, PWM_2, 2},
-    {P1_21, PWM_3, 2},
-    {P1_23, PWM_4, 2},
-    {P1_24, PWM_5, 2},
-    {P1_26, PWM_6, 2},
-    {P2_0 , PWM_1, 1},
-    {P2_1 , PWM_2, 1},
-    {P2_2 , PWM_3, 1},
-    {P2_3 , PWM_4, 1},
-    {P2_4 , PWM_5, 1},
-    {P2_5 , PWM_6, 1},
-    {P3_25, PWM_2, 3},
-    {P3_26, PWM_3, 3},
-    {NC, NC, 0}
-};
-
-__IO uint32_t *PWM_MATCH[] = {
-    &(LPC_PWM1->MR0),
-    &(LPC_PWM1->MR1),
-    &(LPC_PWM1->MR2),
-    &(LPC_PWM1->MR3),
-    &(LPC_PWM1->MR4),
-    &(LPC_PWM1->MR5),
-    &(LPC_PWM1->MR6)
-};
-
-#define TCR_PWM_EN       0x00000008
-
-static unsigned int pwm_clock_mhz;
-
-void pwmout_init(pwmout_t* obj, PinName pin) {
-    // determine the channel
-    PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM);
-    if (pwm == (PWMName)NC)
-        error("PwmOut pin mapping failed");
-    
-    obj->pwm = pwm;
-    obj->MR = PWM_MATCH[pwm];
-    
-    // ensure the power is on
-    LPC_SC->PCONP |= 1 << 6;
-    
-    // ensure clock to /4
-    LPC_SC->PCLKSEL0 &= ~(0x3 << 12);     // pclk = /4
-    LPC_PWM1->PR = 0;                     // no pre-scale
-    
-    // ensure single PWM mode
-    LPC_PWM1->MCR = 1 << 1; // reset TC on match 0
-    
-    // enable the specific PWM output
-    LPC_PWM1->PCR |= 1 << (8 + pwm);
-    
-    pwm_clock_mhz = SystemCoreClock / 4000000;
-    
-    // default to 20ms: standard for servos, and fine for e.g. brightness control
-    pwmout_period_ms(obj, 20);
-    pwmout_write    (obj, 0);
-    
-    // Wire pinout
-    pinmap_pinout(pin, PinMap_PWM);
-}
-
-void pwmout_free(pwmout_t* obj) {
-    // [TODO]
-}
-
-void pwmout_write(pwmout_t* obj, float value) {
-    if (value < 0.0f) {
-        value = 0.0;
-    } else if (value > 1.0f) {
-        value = 1.0;
-    }
-    
-    // set channel match to percentage
-    uint32_t v = (uint32_t)((float)(LPC_PWM1->MR0) * value);
-    
-    // workaround for PWM1[1] - Never make it equal MR0, else we get 1 cycle dropout
-    if (v == LPC_PWM1->MR0) {
-        v++;
-    }
-    
-    *obj->MR = v;
-    
-    // accept on next period start
-    LPC_PWM1->LER |= 1 << obj->pwm;
-}
-
-float pwmout_read(pwmout_t* obj) {
-    float v = (float)(*obj->MR) / (float)(LPC_PWM1->MR0);
-    return (v > 1.0f) ? (1.0f) : (v);
-}
-
-void pwmout_period(pwmout_t* obj, float seconds) {
-    pwmout_period_us(obj, seconds * 1000000.0f);
-}
-
-void pwmout_period_ms(pwmout_t* obj, int ms) {
-    pwmout_period_us(obj, ms * 1000);
-}
-
-// Set the PWM period, keeping the duty cycle the same.
-void pwmout_period_us(pwmout_t* obj, int us) {
-    // calculate number of ticks
-    uint32_t ticks = pwm_clock_mhz * us;
-    
-    // set reset
-    LPC_PWM1->TCR = TCR_RESET;
-    
-    // set the global match register
-    LPC_PWM1->MR0 = ticks;
-    
-    // Scale the pulse width to preserve the duty ratio
-    if (LPC_PWM1->MR0 > 0) {
-        *obj->MR = (*obj->MR * ticks) / LPC_PWM1->MR0;
-    }
-    
-    // set the channel latch to update value at next period start
-    LPC_PWM1->LER |= 1 << 0;
-    
-    // enable counter and pwm, clear reset
-    LPC_PWM1->TCR = TCR_CNT_EN | TCR_PWM_EN;
-}
-
-void pwmout_pulsewidth(pwmout_t* obj, float seconds) {
-    pwmout_pulsewidth_us(obj, seconds * 1000000.0f);
-}
-
-void pwmout_pulsewidth_ms(pwmout_t* obj, int ms) {
-    pwmout_pulsewidth_us(obj, ms * 1000);
-}
-
-void pwmout_pulsewidth_us(pwmout_t* obj, int us) {
-    // calculate number of ticks
-    uint32_t v = pwm_clock_mhz * us;
-    
-    // workaround for PWM1[1] - Never make it equal MR0, else we get 1 cycle dropout
-    if (v == LPC_PWM1->MR0) {
-        v++;
-    }
-    
-    // set the match register value
-    *obj->MR = v;
-    
-    // set the channel latch to update value at next period start
-    LPC_PWM1->LER |= 1 << obj->pwm;
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC23XX/rtc_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "rtc_api.h"
-
-// ensure rtc is running (unchanged if already running)
-
-/* Setup the RTC based on a time structure, ensuring RTC is enabled
- *
- * Can be clocked by a 32.768KHz oscillator or prescale divider based on the APB clock
- * - We want to use the 32khz clock, allowing for sleep mode
- *
- * Most registers are not changed by a Reset
- * - We must initialize these registers between power-on and setting the RTC into operation
-
- * Clock Control Register
- *  RTC_CCR[0] : Enable - 0 = Disabled, 1 = Enabled
- *  RTC_CCR[1] : Reset - 0 = Normal, 1 = Reset
- *  RTC_CCR[4] : Clock Source - 0 = Prescaler, 1 = 32k Xtal
- *
- * The RTC may already be running, so we should set it up
- * without impacting if it is the case
- */
-void rtc_init(void) {
-    LPC_SC->PCONP |= 0x200; // Ensure power is on
-    LPC_RTC->CCR = 0x00;
-    
-    // clock source on 2368 is special test mode on 1768!
-    LPC_RTC->CCR |= 1 << 4;  // Ensure clock source is 32KHz Xtal
-    
-    LPC_RTC->CCR |= 1 << 0; // Ensure the RTC is enabled
-}
-
-void rtc_free(void) {
-    // [TODO]
-}
-
-/*
- * Little check routine to see if the RTC has been enabled
- *
- * Clock Control Register
- *  RTC_CCR[0] : 0 = Disabled, 1 = Enabled
- *
- */
-
-int rtc_isenabled(void) {
-    return(((LPC_RTC->CCR) & 0x01) != 0);
-}
-
-/*
- * RTC Registers
- *  RTC_SEC        Seconds 0-59
- *  RTC_MIN        Minutes 0-59
- *  RTC_HOUR    Hour 0-23
- *  RTC_DOM        Day of Month 1-28..31
- *  RTC_DOW        Day of Week 0-6
- *  RTC_DOY        Day of Year 1-365
- *  RTC_MONTH    Month 1-12
- *  RTC_YEAR    Year 0-4095
- *
- * struct tm
- *  tm_sec        seconds after the minute 0-61
- *  tm_min        minutes after the hour 0-59
- *  tm_hour        hours since midnight 0-23
- *  tm_mday        day of the month 1-31
- *  tm_mon        months since January 0-11
- *  tm_year        years since 1900
- *  tm_wday        days since Sunday 0-6
- *  tm_yday        days since January 1 0-365
- *  tm_isdst    Daylight Saving Time flag
- */
-time_t rtc_read(void) {
-    // Setup a tm structure based on the RTC
-    struct tm timeinfo;
-    timeinfo.tm_sec = LPC_RTC->SEC;
-    timeinfo.tm_min = LPC_RTC->MIN;
-    timeinfo.tm_hour = LPC_RTC->HOUR;
-    timeinfo.tm_mday = LPC_RTC->DOM;
-    timeinfo.tm_mon = LPC_RTC->MONTH - 1;
-    timeinfo.tm_year = LPC_RTC->YEAR - 1900;
-    
-    // Convert to timestamp
-    time_t t = mktime(&timeinfo);
-    
-    return t;
-}
-
-void rtc_write(time_t t) {
-    // Convert the time in to a tm
-    struct tm *timeinfo = localtime(&t);
-    
-    // Pause clock, and clear counter register (clears us count)
-    LPC_RTC->CCR |= 2;
-    
-    // Set the RTC
-    LPC_RTC->SEC = timeinfo->tm_sec;
-    LPC_RTC->MIN = timeinfo->tm_min;
-    LPC_RTC->HOUR = timeinfo->tm_hour;
-    LPC_RTC->DOM = timeinfo->tm_mday;
-    LPC_RTC->MONTH = timeinfo->tm_mon + 1;
-    LPC_RTC->YEAR = timeinfo->tm_year + 1900;
-    
-    // Restart clock
-    LPC_RTC->CCR &= ~((uint32_t)2);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC23XX/serial_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,313 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// math.h required for floating point operations for baud rate calculation
-#include <math.h>
-#include <string.h>
-
-#include "serial_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-/******************************************************************************
- * INITIALIZATION
- ******************************************************************************/
-#define UART_NUM    4
-
-static const PinMap PinMap_UART_TX[] = {
-    {P0_0,  UART_3, 2},
-    {P0_2,  UART_0, 1},
-    {P0_10, UART_2, 1},
-    {P0_15, UART_1, 1},
-    {P0_25, UART_3, 3},
-    {P2_0 , UART_1, 2},
-    {P2_8 , UART_2, 2},
-    {P4_28, UART_3, 3},
-    {NC   , NC    , 0}
-};
-
-static const PinMap PinMap_UART_RX[] = {
-    {P0_1 , UART_3, 2},
-    {P0_3 , UART_0, 1},
-    {P0_11, UART_2, 1},
-    {P0_16, UART_1, 1},
-    {P0_26, UART_3, 3},
-    {P2_1 , UART_1, 2},
-    {P2_9 , UART_2, 2},
-    {P4_29, UART_3, 3},
-    {NC   , NC    , 0}
-};
-
-static uint32_t serial_irq_ids[UART_NUM] = {0};
-static uart_irq_handler irq_handler;
-
-int stdio_uart_inited = 0;
-serial_t stdio_uart;
-
-void serial_init(serial_t *obj, PinName tx, PinName rx) {
-    int is_stdio_uart = 0;
-    
-    // determine the UART to use
-    UARTName uart_tx = (UARTName)pinmap_peripheral(tx, PinMap_UART_TX);
-    UARTName uart_rx = (UARTName)pinmap_peripheral(rx, PinMap_UART_RX);
-    UARTName uart = (UARTName)pinmap_merge(uart_tx, uart_rx);
-    if ((int)uart == NC) {
-        error("Serial pinout mapping failed");
-    }
-    
-    obj->uart = (LPC_UART_TypeDef *)uart;
-    // enable power
-    switch (uart) {
-        case UART_0: LPC_SC->PCONP |= 1 <<  3; break;
-        case UART_1: LPC_SC->PCONP |= 1 <<  4; break;
-        case UART_2: LPC_SC->PCONP |= 1 << 24; break;
-        case UART_3: LPC_SC->PCONP |= 1 << 25; break;
-    }
-    
-    // enable fifos and default rx trigger level
-    obj->uart->FCR = 1 << 0  // FIFO Enable - 0 = Disables, 1 = Enabled
-                   | 0 << 1  // Rx Fifo Reset
-                   | 0 << 2  // Tx Fifo Reset
-                   | 0 << 6; // Rx irq trigger level - 0 = 1 char, 1 = 4 chars, 2 = 8 chars, 3 = 14 chars
-
-    // disable irqs
-    obj->uart->IER = 0 << 0  // Rx Data available irq enable
-                   | 0 << 1  // Tx Fifo empty irq enable
-                   | 0 << 2; // Rx Line Status irq enable
-    
-    // set default baud rate and format
-    serial_baud  (obj, 9600);
-    serial_format(obj, 8, ParityNone, 1);
-    
-    // pinout the chosen uart
-    pinmap_pinout(tx, PinMap_UART_TX);
-    pinmap_pinout(rx, PinMap_UART_RX);
-    
-    // set rx/tx pins in PullUp mode
-    pin_mode(tx, PullUp);
-    pin_mode(rx, PullUp);
-    
-    switch (uart) {
-        case UART_0: obj->index = 0; break;
-        case UART_1: obj->index = 1; break;
-        case UART_2: obj->index = 2; break;
-        case UART_3: obj->index = 3; break;
-    }
-    
-    is_stdio_uart = (uart == STDIO_UART) ? (1) : (0);
-    
-    if (is_stdio_uart) {
-        stdio_uart_inited = 1;
-        memcpy(&stdio_uart, obj, sizeof(serial_t));
-    }
-}
-
-void serial_free(serial_t *obj) {
-    serial_irq_ids[obj->index] = 0;
-}
-
-// serial_baud
-// set the baud rate, taking in to account the current SystemFrequency
-void serial_baud(serial_t *obj, int baudrate) {
-    // The LPC2300 and LPC1700 have a divider and a fractional divider to control the
-    // baud rate. The formula is:
-    //
-    // Baudrate = (1 / PCLK) * 16 * DL * (1 + DivAddVal / MulVal)
-    //   where:
-    //     1 < MulVal <= 15
-    //     0 <= DivAddVal < 14
-    //     DivAddVal < MulVal
-    //
-    // set pclk to /1
-    switch ((int)obj->uart) {
-        case UART_0: LPC_SC->PCLKSEL0 &= ~(0x3 <<  6); LPC_SC->PCLKSEL0 |= (0x1 <<  6); break;
-        case UART_1: LPC_SC->PCLKSEL0 &= ~(0x3 <<  8); LPC_SC->PCLKSEL0 |= (0x1 <<  8); break;
-        case UART_2: LPC_SC->PCLKSEL1 &= ~(0x3 << 16); LPC_SC->PCLKSEL1 |= (0x1 << 16); break;
-        case UART_3: LPC_SC->PCLKSEL1 &= ~(0x3 << 18); LPC_SC->PCLKSEL1 |= (0x1 << 18); break;
-        default: error("serial_baud"); break;
-    }
-    
-    uint32_t PCLK = SystemCoreClock;
-    
-    // First we check to see if the basic divide with no DivAddVal/MulVal
-    // ratio gives us an integer result. If it does, we set DivAddVal = 0,
-    // MulVal = 1. Otherwise, we search the valid ratio value range to find
-    // the closest match. This could be more elegant, using search methods
-    // and/or lookup tables, but the brute force method is not that much
-    // slower, and is more maintainable.
-    uint16_t DL = PCLK / (16 * baudrate);
-
-    uint8_t DivAddVal = 0;
-    uint8_t MulVal = 1;
-    int hit = 0;
-    uint16_t dlv;
-    uint8_t mv, dav;
-    if ((PCLK % (16 * baudrate)) != 0) {     // Checking for zero remainder
-        float err_best = (float) baudrate;
-        uint16_t dlmax = DL;
-        for ( dlv = (dlmax/2); (dlv <= dlmax) && !hit; dlv++) {
-            for ( mv = 1; mv <= 15; mv++) {
-                for ( dav = 1; dav < mv; dav++) {
-                    float ratio = 1.0f + ((float) dav / (float) mv);
-                    float calcbaud = (float)PCLK / (16.0f * (float) dlv * ratio);
-                    float err = fabs(((float) baudrate - calcbaud) / (float) baudrate);
-                    if (err < err_best) {
-                        DL = dlv;
-                        DivAddVal = dav;
-                        MulVal = mv;
-                        err_best = err;
-                        if (err < 0.001f) {
-                            hit = 1;
-                        }
-                    }
-                }
-            }
-        }
-    }
-    
-    // set LCR[DLAB] to enable writing to divider registers
-    obj->uart->LCR |= (1 << 7);
-    
-    // set divider values
-    obj->uart->DLM = (DL >> 8) & 0xFF;
-    obj->uart->DLL = (DL >> 0) & 0xFF;
-    obj->uart->FDR = (uint32_t) DivAddVal << 0
-                   | (uint32_t) MulVal    << 4;
-    
-    // clear LCR[DLAB]
-    obj->uart->LCR &= ~(1 << 7);
-}
-
-void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits) {
-    // 0: 1 stop bits, 1: 2 stop bits
-    if (stop_bits != 1 && stop_bits != 2) {
-        error("Invalid stop bits specified");
-    }
-    stop_bits -= 1;
-    
-    // 0: 5 data bits ... 3: 8 data bits
-    if (data_bits < 5 || data_bits > 8) {
-        error("Invalid number of bits (%d) in serial format, should be 5..8", data_bits);
-    }
-    data_bits -= 5;
-
-    int parity_enable, parity_select;
-    switch (parity) {
-        case ParityNone: parity_enable = 0; parity_select = 0; break;
-        case ParityOdd : parity_enable = 1; parity_select = 0; break;
-        case ParityEven: parity_enable = 1; parity_select = 1; break;
-        case ParityForced1: parity_enable = 1; parity_select = 2; break;
-        case ParityForced0: parity_enable = 1; parity_select = 3; break;
-        default:
-            error("Invalid serial parity setting");
-            return;
-    }
-    
-    obj->uart->LCR = data_bits            << 0
-                   | stop_bits            << 2
-                   | parity_enable        << 3
-                   | parity_select        << 4;
-}
-
-/******************************************************************************
- * INTERRUPTS HANDLING
- ******************************************************************************/
-static inline void uart_irq(uint32_t iir, uint32_t index) {
-    // [Chapter 14] LPC17xx UART0/2/3: UARTn Interrupt Handling
-    SerialIrq irq_type;
-    switch (iir) {
-        case 1: irq_type = TxIrq; break;
-        case 2: irq_type = RxIrq; break;
-        default: return;
-    }
-    
-    if (serial_irq_ids[index] != 0)
-        irq_handler(serial_irq_ids[index], irq_type);
-}
-
-void uart0_irq() {uart_irq((LPC_UART0->IIR >> 1) & 0x7, 0);}
-void uart1_irq() {uart_irq((LPC_UART1->IIR >> 1) & 0x7, 1);}
-void uart2_irq() {uart_irq((LPC_UART2->IIR >> 1) & 0x7, 2);}
-void uart3_irq() {uart_irq((LPC_UART3->IIR >> 1) & 0x7, 3);}
-
-void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id) {
-    irq_handler = handler;
-    serial_irq_ids[obj->index] = id;
-}
-
-void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) {
-    IRQn_Type irq_n = (IRQn_Type)0;
-    uint32_t vector = 0;
-    switch ((int)obj->uart) {
-        case UART_0: irq_n=UART0_IRQn; vector = (uint32_t)&uart0_irq; break;
-        case UART_1: irq_n=UART1_IRQn; vector = (uint32_t)&uart1_irq; break;
-        case UART_2: irq_n=UART2_IRQn; vector = (uint32_t)&uart2_irq; break;
-        case UART_3: irq_n=UART3_IRQn; vector = (uint32_t)&uart3_irq; break;
-    }
-    
-    if (enable) {
-        obj->uart->IER |= 1 << irq;
-        NVIC_SetVector(irq_n, vector);
-        NVIC_EnableIRQ(irq_n);
-    } else { // disable
-        int all_disabled = 0;
-        SerialIrq other_irq = (irq == RxIrq) ? (TxIrq) : (RxIrq);
-        obj->uart->IER &= ~(1 << irq);
-        all_disabled = (obj->uart->IER & (1 << other_irq)) == 0;
-        if (all_disabled)
-            NVIC_DisableIRQ(irq_n);
-    }
-}
-
-/******************************************************************************
- * READ/WRITE
- ******************************************************************************/
-int serial_getc(serial_t *obj) {
-    while (!serial_readable(obj));
-    return obj->uart->RBR;
-}
-
-void serial_putc(serial_t *obj, int c) {
-    while (!serial_writable(obj));
-    obj->uart->THR = c;
-}
-
-int serial_readable(serial_t *obj) {
-    return obj->uart->LSR & 0x01;
-}
-
-int serial_writable(serial_t *obj) {
-    return obj->uart->LSR & 0x20;
-}
-
-void serial_clear(serial_t *obj) {
-    obj->uart->FCR = 1 << 1  // rx FIFO reset
-                   | 1 << 2  // tx FIFO reset
-                   | 0 << 6; // interrupt depth
-}
-
-void serial_pinout_tx(PinName tx) {
-    pinmap_pinout(tx, PinMap_UART_TX);
-}
-
-void serial_break_set(serial_t *obj) {
-    obj->uart->LCR |= (1 << 6);
-}
-
-void serial_break_clear(serial_t *obj) {
-    obj->uart->LCR &= ~(1 << 6);
-}
-
--- a/targets/hal/TARGET_NXP/TARGET_LPC23XX/spi_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,224 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <math.h>
-
-#include "spi_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_SPI_SCLK[] = {
-    {P0_7 , SPI_1, 2},
-    {P0_15, SPI_0, 2},
-    {P1_20, SPI_0, 3},
-    {P1_31, SPI_1, 2},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_MOSI[] = {
-    {P0_9 , SPI_1, 2},
-    {P0_13, SPI_1, 2},
-    {P0_18, SPI_0, 2},
-    {P1_24, SPI_0, 3},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_MISO[] = {
-    {P0_8 , SPI_1, 2},
-    {P0_12, SPI_1, 2},
-    {P0_17, SPI_0, 2},
-    {P1_23, SPI_0, 3},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_SSEL[] = {
-    {P0_6 , SPI_1, 2},
-    {P0_11, SPI_1, 2},
-    {P0_16, SPI_0, 2},
-    {P1_21, SPI_0, 3},
-    {NC   , NC   , 0}
-};
-
-static inline int ssp_disable(spi_t *obj);
-static inline int ssp_enable(spi_t *obj);
-
-void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel) {
-    // determine the SPI to use
-    SPIName spi_mosi = (SPIName)pinmap_peripheral(mosi, PinMap_SPI_MOSI);
-    SPIName spi_miso = (SPIName)pinmap_peripheral(miso, PinMap_SPI_MISO);
-    SPIName spi_sclk = (SPIName)pinmap_peripheral(sclk, PinMap_SPI_SCLK);
-    SPIName spi_ssel = (SPIName)pinmap_peripheral(ssel, PinMap_SPI_SSEL);
-    SPIName spi_data = (SPIName)pinmap_merge(spi_mosi, spi_miso);
-    SPIName spi_cntl = (SPIName)pinmap_merge(spi_sclk, spi_ssel);
-    obj->spi = (LPC_SSP_TypeDef*)pinmap_merge(spi_data, spi_cntl);
-    
-    if ((int)obj->spi == NC) {
-        error("SPI pinout mapping failed");
-    }
-    
-    // enable power and clocking
-    switch ((int)obj->spi) {
-        case SPI_0: LPC_SC->PCONP |= 1 << 21; break;
-        case SPI_1: LPC_SC->PCONP |= 1 << 10; break;
-    }
-    
-    // set default format and frequency
-    if (ssel == NC) {
-        spi_format(obj, 8, 0, 0);  // 8 bits, mode 0, master
-    } else {
-        spi_format(obj, 8, 0, 1);  // 8 bits, mode 0, slave
-    }
-    spi_frequency(obj, 1000000);
-    
-    // enable the ssp channel
-    ssp_enable(obj);
-    
-    // pin out the spi pins
-    pinmap_pinout(mosi, PinMap_SPI_MOSI);
-    pinmap_pinout(miso, PinMap_SPI_MISO);
-    pinmap_pinout(sclk, PinMap_SPI_SCLK);
-    if (ssel != NC) {
-        pinmap_pinout(ssel, PinMap_SPI_SSEL);
-    }
-}
-
-void spi_free(spi_t *obj) {}
-
-void spi_format(spi_t *obj, int bits, int mode, int slave) {
-    ssp_disable(obj);
-    
-    if (!(bits >= 4 && bits <= 16) || !(mode >= 0 && mode <= 3)) {
-        error("SPI format error");
-    }
-    
-    int polarity = (mode & 0x2) ? 1 : 0;
-    int phase = (mode & 0x1) ? 1 : 0;
-    
-    // set it up
-    int DSS = bits - 1;            // DSS (data select size)
-    int SPO = (polarity) ? 1 : 0;  // SPO - clock out polarity
-    int SPH = (phase) ? 1 : 0;     // SPH - clock out phase
-    
-    int FRF = 0;                   // FRF (frame format) = SPI
-    uint32_t tmp = obj->spi->CR0;
-    tmp &= ~(0xFFFF);
-    tmp |= DSS << 0
-        | FRF << 4
-        | SPO << 6
-        | SPH << 7;
-    obj->spi->CR0 = tmp;
-    
-    tmp = obj->spi->CR1;
-    tmp &= ~(0xD);
-    tmp |= 0 << 0                   // LBM - loop back mode - off
-        | ((slave) ? 1 : 0) << 2   // MS - master slave mode, 1 = slave
-        | 0 << 3;                  // SOD - slave output disable - na
-    obj->spi->CR1 = tmp;
-    
-    ssp_enable(obj);
-}
-
-void spi_frequency(spi_t *obj, int hz) {
-    ssp_disable(obj);
-    
-    // setup the spi clock diveder to /1
-    switch ((int)obj->spi) {
-        case SPI_0:
-            LPC_SC->PCLKSEL1 &= ~(3 << 10);
-            LPC_SC->PCLKSEL1 |=  (1 << 10);
-            break;
-        case SPI_1:
-            LPC_SC->PCLKSEL0 &= ~(3 << 20);
-            LPC_SC->PCLKSEL0 |=  (1 << 20);
-            break;
-    }
-    
-    uint32_t PCLK = SystemCoreClock;
-    
-    int prescaler;
-    
-    for (prescaler = 2; prescaler <= 254; prescaler += 2) {
-        int prescale_hz = PCLK / prescaler;
-        
-        // calculate the divider
-        int divider = floor(((float)prescale_hz / (float)hz) + 0.5f);
-        
-        // check we can support the divider
-        if (divider < 256) {
-            // prescaler
-            obj->spi->CPSR = prescaler;
-            
-            // divider
-            obj->spi->CR0 &= ~(0xFFFF << 8);
-            obj->spi->CR0 |= (divider - 1) << 8;
-            ssp_enable(obj);
-            return;
-        }
-    }
-    error("Couldn't setup requested SPI frequency");
-}
-
-static inline int ssp_disable(spi_t *obj) {
-    return obj->spi->CR1 &= ~(1 << 1);
-}
-
-static inline int ssp_enable(spi_t *obj) {
-    return obj->spi->CR1 |= (1 << 1);
-}
-
-static inline int ssp_readable(spi_t *obj) {
-    return obj->spi->SR & (1 << 2);
-}
-
-static inline int ssp_writeable(spi_t *obj) {
-    return obj->spi->SR & (1 << 1);
-}
-
-static inline void ssp_write(spi_t *obj, int value) {
-    while (!ssp_writeable(obj));
-    obj->spi->DR = value;
-}
-
-static inline int ssp_read(spi_t *obj) {
-    while (!ssp_readable(obj));
-    return obj->spi->DR;
-}
-
-static inline int ssp_busy(spi_t *obj) {
-    return (obj->spi->SR & (1 << 4)) ? (1) : (0);
-}
-
-int spi_master_write(spi_t *obj, int value) {
-    ssp_write(obj, value);
-    return ssp_read(obj);
-}
-
-int spi_slave_receive(spi_t *obj) {
-    return (ssp_readable(obj) && !ssp_busy(obj)) ? (1) : (0);
-};
-
-int spi_slave_read(spi_t *obj) {
-    return obj->spi->DR;
-}
-
-void spi_slave_write(spi_t *obj, int value) {
-    while (ssp_writeable(obj) == 0) ;
-    obj->spi->DR = value;
-}
-
-int spi_busy(spi_t *obj) {
-    return ssp_busy(obj);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC23XX/us_ticker.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stddef.h>
-#include "us_ticker_api.h"
-#include "PeripheralNames.h"
-
-#define US_TICKER_TIMER      ((LPC_TIM_TypeDef *)LPC_TIM3_BASE)
-#define US_TICKER_TIMER_IRQn TIMER3_IRQn
-
-int us_ticker_inited = 0;
-
-void us_ticker_init(void) {
-    if (us_ticker_inited) return;
-    us_ticker_inited = 1;
-    
-    LPC_SC->PCONP |= 1 << 23; // Clock TIMER_3
-    
-    US_TICKER_TIMER->CTCR = 0x0; // timer mode
-    uint32_t PCLK = SystemCoreClock / 4;
-    
-    US_TICKER_TIMER->TCR = 0x2;  // reset
-    
-    uint32_t prescale = PCLK / 1000000; // default to 1MHz (1 us ticks)
-    US_TICKER_TIMER->PR = prescale - 1;
-    US_TICKER_TIMER->TCR = 1; // enable = 1, reset = 0
-    
-    NVIC_SetVector(US_TICKER_TIMER_IRQn, (uint32_t)us_ticker_irq_handler);
-    NVIC_EnableIRQ(US_TICKER_TIMER_IRQn);
-}
-
-uint32_t us_ticker_read() {
-    if (!us_ticker_inited)
-        us_ticker_init();
-    
-    return US_TICKER_TIMER->TC;
-}
-
-void us_ticker_set_interrupt(unsigned int timestamp) {
-    // set match value
-    US_TICKER_TIMER->MR0 = timestamp;
-    // enable match interrupt
-    US_TICKER_TIMER->MCR |= 1;
-}
-
-void us_ticker_disable_interrupt(void) {
-    US_TICKER_TIMER->MCR &= ~1;
-}
-
-void us_ticker_clear_interrupt(void) {
-    US_TICKER_TIMER->IR = 1;
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/PeripheralNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    UART_0 = (int)LPC_UART0_BASE,
-    UART_1 = (int)LPC_UART1_BASE,
-    UART_2 = (int)LPC_UART2_BASE,
-    UART_3 = (int)LPC_UART3_BASE,
-    UART_4 = (int)LPC_UART4_BASE
-} UARTName;
-
-typedef enum {
-    ADC0_0 = 0,
-    ADC0_1,
-    ADC0_2,
-    ADC0_3,
-    ADC0_4,
-    ADC0_5,
-    ADC0_6,
-    ADC0_7
-} ADCName;
-
-typedef enum {
-    DAC_0 = 0
-} DACName;
-
-typedef enum {
-    SPI_0 = (int)LPC_SSP0_BASE,
-    SPI_1 = (int)LPC_SSP1_BASE,
-    SPI_2 = (int)LPC_SSP2_BASE
-} SPIName;
-
-typedef enum {
-    I2C_0 = (int)LPC_I2C0_BASE,
-    I2C_1 = (int)LPC_I2C1_BASE,
-    I2C_2 = (int)LPC_I2C2_BASE
-} I2CName;
-
-typedef enum {
-    PWM0_1 = 1,
-    PWM0_2,
-    PWM0_3,
-    PWM0_4,
-    PWM0_5,
-    PWM0_6,
-    PWM1_1,
-    PWM1_2,
-    PWM1_3,
-    PWM1_4,
-    PWM1_5,
-    PWM1_6
-} PWMName;
-
-typedef enum {
-     CAN_1 = (int)LPC_CAN1_BASE,
-     CAN_2 = (int)LPC_CAN2_BASE
-} CANName;
-
-#define STDIO_UART_TX     USBTX
-#define STDIO_UART_RX     USBRX
-#define STDIO_UART        UART_0
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/PinNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PINNAMES_H
-#define MBED_PINNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    PIN_INPUT,
-    PIN_OUTPUT
-} PinDirection;
-
-#define PORT_SHIFT  5
-
-typedef enum {
-    // LPC Pin Names
-    P0_0 = /*LPC_GPIO0_BASE*/0,
-          P0_1, P0_2, P0_3, P0_4, P0_5, P0_6, P0_7, P0_8, P0_9, P0_10, P0_11, P0_12, P0_13, P0_14, P0_15, P0_16, P0_17, P0_18, P0_19, P0_20, P0_21, P0_22, P0_23, P0_24, P0_25, P0_26, P0_27, P0_28, P0_29, P0_30, P0_31,
-    P1_0, P1_1, P1_2, P1_3, P1_4, P1_5, P1_6, P1_7, P1_8, P1_9, P1_10, P1_11, P1_12, P1_13, P1_14, P1_15, P1_16, P1_17, P1_18, P1_19, P1_20, P1_21, P1_22, P1_23, P1_24, P1_25, P1_26, P1_27, P1_28, P1_29, P1_30, P1_31,
-    P2_0, P2_1, P2_2, P2_3, P2_4, P2_5, P2_6, P2_7, P2_8, P2_9, P2_10, P2_11, P2_12, P2_13, P2_14, P2_15, P2_16, P2_17, P2_18, P2_19, P2_20, P2_21, P2_22, P2_23, P2_24, P2_25, P2_26, P2_27, P2_28, P2_29, P2_30, P2_31,
-    P3_0, P3_1, P3_2, P3_3, P3_4, P3_5, P3_6, P3_7, P3_8, P3_9, P3_10, P3_11, P3_12, P3_13, P3_14, P3_15, P3_16, P3_17, P3_18, P3_19, P3_20, P3_21, P3_22, P3_23, P3_24, P3_25, P3_26, P3_27, P3_28, P3_29, P3_30, P3_31,
-    P4_0, P4_1, P4_2, P4_3, P4_4, P4_5, P4_6, P4_7, P4_8, P4_9, P4_10, P4_11, P4_12, P4_13, P4_14, P4_15, P4_16, P4_17, P4_18, P4_19, P4_20, P4_21, P4_22, P4_23, P4_24, P4_25, P4_26, P4_27, P4_28, P4_29, P4_30, P4_31,
-    P5_0, P5_1, P5_2, P5_3, P5_4,
-
-    // mbed DIP Pin Names
-    p5 = P1_24,
-    p6 = P1_23,
-    p7 = P1_20,
-    p8 = P0_21,
-    p9 = P0_0,
-    p10 = P0_1,
-    p11 = P0_9,
-    p12 = P0_8,
-    p13 = P0_7,
-    p14 = P0_6,
-    p15 = P0_23,
-    p16 = P0_24,
-    p17 = P0_25,
-    p18 = P0_26,
-    p19 = P1_30,
-    p20 = P1_31,
-
-    p23 = P2_10,
-    p24 = P1_12,
-    p25 = P1_11,
-    p26 = P1_7,
-    p27 = P1_6,
-    p28 = P1_5,
-    p29 = P1_3,
-    p30 = P1_2,
-    p31 = P5_3,
-    p32 = P5_2,
-    p33 = P0_5,
-    p34 = P0_4,    
-
-    p37 = P5_4,
-    p38 = P5_1,
-    p39 = P5_0,    
-    
-    // Other mbed Pin Names
-    LED1 = P1_18,
-    LED2 = P0_13,
-    LED3 = P1_13,
-    LED4 = P2_19,
-
-    USBTX = P0_2,
-    USBRX = P0_3,
-
-    // Not connected
-    NC = (int)0xFFFFFFFF
-} PinName;
-
-typedef enum {
-    PullUp = 2,
-    PullDown = 1,
-    PullNone = 0,
-    OpenDrain = 4
-} PinMode;
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/PortNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PORTNAMES_H
-#define MBED_PORTNAMES_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    Port0 = 0,
-    Port1 = 1,
-    Port2 = 2,
-    Port3 = 3,
-    Port4 = 4,
-    Port5 = 5
-} PortName;
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/analogin_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "analogin_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-#define ANALOGIN_MEDIAN_FILTER      1
-
-#define ADC_10BIT_RANGE             0x3FF
-#define ADC_12BIT_RANGE             0xFFF
-
-static inline int div_round_up(int x, int y) {
-  return (x + (y - 1)) / y;
-}
-
-static const PinMap PinMap_ADC[] = {
-    {P0_23, ADC0_0, 0x01},
-    {P0_24, ADC0_1, 0x01},
-    {P0_25, ADC0_2, 0x01},
-    {P0_26, ADC0_3, 0x01},
-    {P1_30, ADC0_4, 0x03},
-    {P1_31, ADC0_5, 0x03},
-    {P0_12, ADC0_6, 0x03},
-    {P0_13, ADC0_7, 0x03},
-    {NC   , NC    , 0   }
-};
-
-#define ADC_RANGE    ADC_12BIT_RANGE
-
-void analogin_init(analogin_t *obj, PinName pin) {
-    obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
-    if (obj->adc == (ADCName)NC) {
-        error("ADC pin mapping failed");
-    }
-    
-    // ensure power is turned on
-    LPC_SC->PCONP |= (1 << 12);
-    
-    uint32_t PCLK = PeripheralClock;
-    
-    // calculate minimum clock divider
-    //  clkdiv = divider - 1
-    uint32_t MAX_ADC_CLK = 12400000;
-    uint32_t clkdiv = div_round_up(PCLK, MAX_ADC_CLK) - 1;
-    
-    // Set the generic software-controlled ADC settings
-    LPC_ADC->CR = (0 << 0)      // SEL: 0 = no channels selected
-                  | (clkdiv << 8) // CLKDIV:
-                  | (0 << 16)     // BURST: 0 = software control
-                  | (1 << 21)     // PDN: 1 = operational
-                  | (0 << 24)     // START: 0 = no start
-                  | (0 << 27);    // EDGE: not applicable
-    
-    // must enable analog mode (ADMODE = 0)
-    __IO uint32_t *reg = (__IO uint32_t*) (LPC_IOCON_BASE + 4 * pin);
-    *reg &= ~(1 << 7);
-    
-    pinmap_pinout(pin, PinMap_ADC);
-}
-
-static inline uint32_t adc_read(analogin_t *obj) {
-    // Select the appropriate channel and start conversion
-    LPC_ADC->CR &= ~0xFF;
-    LPC_ADC->CR |= 1 << (int)obj->adc;
-    LPC_ADC->CR |= 1 << 24;
-
-    // Repeatedly get the sample data until DONE bit
-    unsigned int data;
-    do {
-        data = LPC_ADC->GDR;
-    } while ((data & ((unsigned int)1 << 31)) == 0);
-
-    // Stop conversion
-    LPC_ADC->CR &= ~(1 << 24);
-    
-    return (data >> 4) & ADC_RANGE; // 12 bit
-}
-
-static inline void order(uint32_t *a, uint32_t *b) {
-    if (*a > *b) {
-        uint32_t t = *a;
-        *a = *b;
-        *b = t;
-    }
-}
-
-static inline uint32_t adc_read_u32(analogin_t *obj) {
-    uint32_t value;
-#if ANALOGIN_MEDIAN_FILTER
-    uint32_t v1 = adc_read(obj);
-    uint32_t v2 = adc_read(obj);
-    uint32_t v3 = adc_read(obj);
-    order(&v1, &v2);
-    order(&v2, &v3);
-    order(&v1, &v2);
-    value = v2;
-#else
-    value = adc_read(obj);
-#endif
-    return value;
-}
-
-uint16_t analogin_read_u16(analogin_t *obj) {
-    uint32_t value = adc_read_u32(obj);
-    
-    return (value << 4) | ((value >> 8) & 0x000F); // 12 bit
-}
-
-float analogin_read(analogin_t *obj) {
-    uint32_t value = adc_read_u32(obj);
-    return (float)value * (1.0f / (float)ADC_RANGE);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/analogout_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "analogout_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_DAC[] = {
-    {P0_26, DAC_0, 2},
-    {NC   , NC   , 0}
-};
-
-void analogout_init(dac_t *obj, PinName pin) {
-    obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
-    if (obj->dac == (DACName)NC) {
-        error("DAC pin mapping failed");
-    }
-    
-    // DAC enable bit must be set
-    LPC_IOCON->P0_26 |= (1 << 16); // DACEN
-    
-    // map out (must be done before accessing registers)
-    pinmap_pinout(pin, PinMap_DAC);
-    
-    analogout_write_u16(obj, 0);
-}
-
-void analogout_free(dac_t *obj) {}
-
-static inline void dac_write(int value) {
-    value &= 0x3FF; // 10-bit
-    
-    // Set the DAC output
-    LPC_DAC->CR = (0 << 16)       // bias = 0
-                | (value << 6);
-}
-
-static inline int dac_read() {
-    return (LPC_DAC->CR >> 6) & 0x3FF;
-}
-
-void analogout_write(dac_t *obj, float value) {
-    if (value < 0.0f) {
-        dac_write(0);
-    } else if (value > 1.0f) {
-        dac_write(0x3FF);
-    } else {
-        dac_write(value * (float)0x3FF);
-    }
-}
-
-void analogout_write_u16(dac_t *obj, uint16_t value) {
-    dac_write(value >> 6); // 10-bit
-}
-
-float analogout_read(dac_t *obj) {
-    uint32_t value = dac_read();
-    return (float)value * (1.0f / (float)0x3FF);
-}
-
-uint16_t analogout_read_u16(dac_t *obj) {
-    uint32_t value = dac_read(); // 10-bit
-    return (value << 6) | ((value >> 4) & 0x003F);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/can_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,394 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "can_api.h"
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-#include <math.h>
-#include <string.h>
-
-#define CAN_NUM    2
-
-/* Acceptance filter mode in AFMR register */
-#define ACCF_OFF                0x01
-#define ACCF_BYPASS             0x02
-#define ACCF_ON                 0x00
-#define ACCF_FULLCAN            0x04
-
-/* There are several bit timing calculators on the internet.
-http://www.port.de/engl/canprod/sv_req_form.html
-http://www.kvaser.com/can/index.htm
-*/
-
-static const PinMap PinMap_CAN_RD[] = {
-    {P0_0 , CAN_1, 1},
-    {P0_4 , CAN_2, 2},
-    {P0_21, CAN_1, 4},
-    {P2_7 , CAN_2, 1},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_CAN_TD[] = {
-    {P0_1 , CAN_1, 1},
-    {P0_5 , CAN_2, 2},
-    {P0_22, CAN_1, 4},
-    {P2_8 , CAN_2, 1},
-    {NC   , NC   , 0}
-};
-
-// Type definition to hold a CAN message
-struct CANMsg {
-    unsigned int  reserved1 : 16;
-    unsigned int  dlc       :  4; // Bits 16..19: DLC - Data Length Counter
-    unsigned int  reserved0 : 10;
-    unsigned int  rtr       :  1; // Bit 30: Set if this is a RTR message
-    unsigned int  type      :  1; // Bit 31: Set if this is a 29-bit ID message
-    unsigned int  id;             // CAN Message ID (11-bit or 29-bit)
-    unsigned char data[8];        // CAN Message Data Bytes 0-7
-};
-typedef struct CANMsg CANMsg;
-
-static uint32_t can_irq_ids[CAN_NUM] = {0};
-static can_irq_handler irq_handler;
-
-static uint32_t can_disable(can_t *obj) {
-    uint32_t sm = obj->dev->MOD;
-    obj->dev->MOD |= 1;
-    return sm;
-}
-
-static inline void can_enable(can_t *obj) {
-    if (obj->dev->MOD & 1) {
-        obj->dev->MOD &= ~(1);
-    }
-}
-
-int can_mode(can_t *obj, CanMode mode)
-{
-    return 0; // not implemented
-}
-
-int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t handle) {
-    return 0; // not implemented
-}
-
-static inline void can_irq(uint32_t icr, uint32_t index) {
-    uint32_t i;
-    
-    for(i = 0; i < 8; i++)
-    {
-        if((can_irq_ids[index] != 0) && (icr & (1 << i)))
-        {
-            switch (i) {
-                case 0: irq_handler(can_irq_ids[index], IRQ_RX);      break;
-                case 1: irq_handler(can_irq_ids[index], IRQ_TX);      break;
-                case 2: irq_handler(can_irq_ids[index], IRQ_ERROR);   break;
-                case 3: irq_handler(can_irq_ids[index], IRQ_OVERRUN); break;
-                case 4: irq_handler(can_irq_ids[index], IRQ_WAKEUP);  break;
-                case 5: irq_handler(can_irq_ids[index], IRQ_PASSIVE); break;
-                case 6: irq_handler(can_irq_ids[index], IRQ_ARB);     break;
-                case 7: irq_handler(can_irq_ids[index], IRQ_BUS);     break;
-                case 8: irq_handler(can_irq_ids[index], IRQ_READY);   break;
-            }
-        }
-    }
-}
-
-// Have to check that the CAN block is active before reading the Interrupt
-// Control Register, or the mbed hangs
-void can_irq_n() {
-    uint32_t icr;
-
-    if(LPC_SC->PCONP & (1 << 13)) {
-        icr = LPC_CAN1->ICR & 0x1FF;
-        can_irq(icr, 0);
-    }
-
-    if(LPC_SC->PCONP & (1 << 14)) {
-        icr = LPC_CAN2->ICR & 0x1FF;
-        can_irq(icr, 1);
-    }
-}
-
-// Register CAN object's irq handler
-void can_irq_init(can_t *obj, can_irq_handler handler, uint32_t id) {
-    irq_handler = handler;
-    can_irq_ids[obj->index] = id;
-}
-
-// Unregister CAN object's irq handler
-void can_irq_free(can_t *obj) {
-    obj->dev->IER &= ~(1);
-    can_irq_ids[obj->index] = 0;
-
-    if ((can_irq_ids[0] == 0) && (can_irq_ids[1] == 0)) {
-        NVIC_DisableIRQ(CAN_IRQn);
-    }
-}
-
-// Clear or set a irq
-void can_irq_set(can_t *obj, CanIrqType type, uint32_t enable) {
-    uint32_t ier;
-    
-    switch (type) {
-        case IRQ_RX:      ier = (1 << 0); break;
-        case IRQ_TX:      ier = (1 << 1); break;
-        case IRQ_ERROR:   ier = (1 << 2); break;
-        case IRQ_OVERRUN: ier = (1 << 3); break;
-        case IRQ_WAKEUP:  ier = (1 << 4); break;
-        case IRQ_PASSIVE: ier = (1 << 5); break;
-        case IRQ_ARB:     ier = (1 << 6); break;
-        case IRQ_BUS:     ier = (1 << 7); break;
-        case IRQ_READY:   ier = (1 << 8); break;
-        default: return;
-    }
-    
-    obj->dev->MOD |= 1;
-    if(enable == 0) {
-        obj->dev->IER &= ~ier;
-    }
-    else {
-        obj->dev->IER |= ier;
-    }
-    obj->dev->MOD &= ~(1);
-    
-    // Enable NVIC if at least 1 interrupt is active
-    if(((LPC_SC->PCONP & (1 << 13)) && LPC_CAN1->IER) || ((LPC_SC->PCONP & (1 << 14)) && LPC_CAN2->IER)) {
-        NVIC_SetVector(CAN_IRQn, (uint32_t) &can_irq_n);
-        NVIC_EnableIRQ(CAN_IRQn);
-    }
-    else {
-        NVIC_DisableIRQ(CAN_IRQn);
-    }
-}
-
-// This table has the sampling points as close to 75% as possible. The first
-// value is TSEG1, the second TSEG2.
-static const int timing_pts[23][2] = {
-    {0x0, 0x0},      // 2,  50%
-    {0x1, 0x0},      // 3,  67%
-    {0x2, 0x0},      // 4,  75%
-    {0x3, 0x0},      // 5,  80%
-    {0x3, 0x1},      // 6,  67%
-    {0x4, 0x1},      // 7,  71%
-    {0x5, 0x1},      // 8,  75%
-    {0x6, 0x1},      // 9,  78%
-    {0x6, 0x2},      // 10, 70%
-    {0x7, 0x2},      // 11, 73%
-    {0x8, 0x2},      // 12, 75%
-    {0x9, 0x2},      // 13, 77%
-    {0x9, 0x3},      // 14, 71%
-    {0xA, 0x3},      // 15, 73%
-    {0xB, 0x3},      // 16, 75%
-    {0xC, 0x3},      // 17, 76%
-    {0xD, 0x3},      // 18, 78%
-    {0xD, 0x4},      // 19, 74%
-    {0xE, 0x4},      // 20, 75%
-    {0xF, 0x4},      // 21, 76%
-    {0xF, 0x5},      // 22, 73%
-    {0xF, 0x6},      // 23, 70%
-    {0xF, 0x7},      // 24, 67%
-};
-
-static unsigned int can_speed(unsigned int sclk, unsigned int pclk, unsigned int cclk, unsigned char psjw) {
-    uint32_t    btr;
-    uint16_t    brp = 0;
-    uint32_t    calcbit;
-    uint32_t    bitwidth;
-    int         hit = 0;
-    int         bits;
-    
-    bitwidth = sclk / (pclk * cclk);
-    
-    brp = bitwidth / 0x18;
-    while ((!hit) && (brp < bitwidth / 4)) {
-        brp++;
-        for (bits = 22; bits > 0; bits--) {
-            calcbit = (bits + 3) * (brp + 1);
-            if (calcbit == bitwidth) {
-                hit = 1;
-                break;
-            }
-        }
-    }
-    
-    if (hit) {
-        btr = ((timing_pts[bits][1] << 20) & 0x00700000)
-            | ((timing_pts[bits][0] << 16) & 0x000F0000)
-            | ((psjw                << 14) & 0x0000C000)
-            | ((brp                 <<  0) & 0x000003FF);
-    } else {
-        btr = 0xFFFFFFFF;
-    }
-    
-    return btr;
-
-}
-
-void can_init(can_t *obj, PinName rd, PinName td) {
-    CANName can_rd = (CANName)pinmap_peripheral(rd, PinMap_CAN_RD);
-    CANName can_td = (CANName)pinmap_peripheral(td, PinMap_CAN_TD);
-    obj->dev = (LPC_CAN_TypeDef *)pinmap_merge(can_rd, can_td);
-    if ((int)obj->dev == NC) {
-        error("CAN pin mapping failed");
-    }
-
-    switch ((int)obj->dev) {
-        case CAN_1: LPC_SC->PCONP |= 1 << 13; break;
-        case CAN_2: LPC_SC->PCONP |= 1 << 14; break;
-    }
-
-    pinmap_pinout(rd, PinMap_CAN_RD);
-    pinmap_pinout(td, PinMap_CAN_TD);
-    
-    switch ((int)obj->dev) {
-        case CAN_1: obj->index = 0; break;
-        case CAN_2: obj->index = 1; break;
-    }
-    
-    can_reset(obj);
-    obj->dev->IER = 0;             // Disable Interrupts
-    can_frequency(obj, 100000);
-
-    LPC_CANAF->AFMR = ACCF_BYPASS; // Bypass Filter
-}
-
-void can_free(can_t *obj) {
-    switch ((int)obj->dev) {
-        case CAN_1: LPC_SC->PCONP &= ~(1 << 13); break;
-        case CAN_2: LPC_SC->PCONP &= ~(1 << 14); break;
-    }
-}
-
-int can_frequency(can_t *obj, int f) {
-    int pclk = PeripheralClock;
-    
-    int btr = can_speed(SystemCoreClock, pclk, (unsigned int)f, 1);
-
-    if (btr > 0) {
-        uint32_t modmask = can_disable(obj);
-        obj->dev->BTR = btr;
-        obj->dev->MOD = modmask;
-        return 1;
-    } else {
-        return 0;
-    }
-}
-
-int can_write(can_t *obj, CAN_Message msg, int cc) {
-    unsigned int CANStatus;
-    CANMsg m;
-
-    can_enable(obj);
-
-    m.id   = msg.id ;
-    m.dlc  = msg.len & 0xF;
-    m.rtr  = msg.type;
-    m.type = msg.format;
-    memcpy(m.data, msg.data, msg.len);
-    const unsigned int *buf = (const unsigned int *)&m;
-
-    CANStatus = obj->dev->SR;
-    if (CANStatus & 0x00000004) {
-        obj->dev->TFI1 = buf[0] & 0xC00F0000;
-        obj->dev->TID1 = buf[1];
-        obj->dev->TDA1 = buf[2];
-        obj->dev->TDB1 = buf[3];
-        if(cc) {
-            obj->dev->CMR = 0x30;
-        } else {
-            obj->dev->CMR = 0x21;
-        }
-        return 1;
-
-    } else if (CANStatus & 0x00000400) {
-        obj->dev->TFI2 = buf[0] & 0xC00F0000;
-        obj->dev->TID2 = buf[1];
-        obj->dev->TDA2 = buf[2];
-        obj->dev->TDB2 = buf[3];
-        if (cc) {
-            obj->dev->CMR = 0x50;
-        } else {
-            obj->dev->CMR = 0x41;
-        }
-        return 1;
-
-    } else if (CANStatus & 0x00040000) {
-        obj->dev->TFI3 = buf[0] & 0xC00F0000;
-        obj->dev->TID3 = buf[1];
-        obj->dev->TDA3 = buf[2];
-        obj->dev->TDB3 = buf[3];
-        if (cc) {
-            obj->dev->CMR = 0x90;
-        } else {
-            obj->dev->CMR = 0x81;
-        }
-        return 1;
-    }
-
-    return 0;
-}
-
-int can_read(can_t *obj, CAN_Message *msg, int handle) {
-    CANMsg x;
-    unsigned int *i = (unsigned int *)&x;
-
-    can_enable(obj);
-
-    if (obj->dev->GSR & 0x1) {
-        *i++ = obj->dev->RFS;  // Frame
-        *i++ = obj->dev->RID;  // ID
-        *i++ = obj->dev->RDA;  // Data A
-        *i++ = obj->dev->RDB;  // Data B
-        obj->dev->CMR = 0x04;  // release receive buffer
-
-        msg->id     = x.id;
-        msg->len    = x.dlc;
-        msg->format = (x.type)? CANExtended : CANStandard;
-        msg->type   = (x.rtr)?  CANRemote:    CANData;
-        memcpy(msg->data,x.data,x.dlc);
-        return 1;
-    }
-
-    return 0;
-}
-
-void can_reset(can_t *obj) {
-    can_disable(obj);
-    obj->dev->GSR = 0; // Reset error counter when CAN1MOD is in reset
-}
-
-unsigned char can_rderror(can_t *obj) {
-    return (obj->dev->GSR >> 16) & 0xFF;
-}
-
-unsigned char can_tderror(can_t *obj) {
-    return (obj->dev->GSR >> 24) & 0xFF;
-}
-
-void can_monitor(can_t *obj, int silent) {
-    uint32_t mod_mask = can_disable(obj);
-    if (silent) {
-        obj->dev->MOD |= (1 << 1);
-    } else {
-        obj->dev->MOD &= ~(1 << 1);
-    }
-    if (!(mod_mask & 1)) {
-        can_enable(obj);
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/device.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_DEVICE_H
-#define MBED_DEVICE_H
-
-#define DEVICE_PORTIN           1
-#define DEVICE_PORTOUT          1
-#define DEVICE_PORTINOUT        1
-
-#define DEVICE_INTERRUPTIN      1
-
-#define DEVICE_ANALOGIN         1
-#define DEVICE_ANALOGOUT        1
-
-#define DEVICE_SERIAL           1
-
-#define DEVICE_I2C              1
-#define DEVICE_I2CSLAVE         1
-
-#define DEVICE_SPI              1
-#define DEVICE_SPISLAVE         1
-
-#define DEVICE_CAN              1
-
-#define DEVICE_RTC              1
-
-#define DEVICE_ETHERNET         1
-
-#define DEVICE_PWMOUT           1
-
-#define DEVICE_SEMIHOST         0
-#define DEVICE_LOCALFILESYSTEM  0 
-#define DEVICE_ID_LENGTH       32
-#define DEVICE_MAC_OFFSET      20
-
-#define DEVICE_SLEEP            1
-
-#define DEVICE_DEBUG_AWARENESS  1
-
-#define DEVICE_STDIO_MESSAGES   1
-
-#define DEVICE_ERROR_PATTERN    1
-
-#include "objects.h"
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/ethernet_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1008 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <string.h>
-
-#include "ethernet_api.h"
-#include "cmsis.h"
-#include "mbed_interface.h"
-#include "toolchain.h"
-#include "error.h"
-
-#define NEW_LOGIC       0
-#define NEW_ETH_BUFFER  0
-
-#if NEW_ETH_BUFFER
-
-#define NUM_RX_FRAG         4           // Number of Rx Fragments (== packets)
-#define NUM_TX_FRAG         3           // Number of Tx Fragments (== packets)
-
-#define ETH_MAX_FLEN        1536         // Maximum Ethernet Frame Size
-#define ETH_FRAG_SIZE       ETH_MAX_FLEN // Packet Fragment size (same as packet length)
-
-#else
-
-// Memfree calculation:
-// (16 * 1024) - ((2 * 4 * NUM_RX) + (2 * 4 * NUM_RX) + (0x300 * NUM_RX) +
-//                (2 * 4 * NUM_TX) + (1 * 4 * NUM_TX) + (0x300 * NUM_TX)) = 8556
-/* EMAC Memory Buffer configuration for 16K Ethernet RAM. */
-#define NUM_RX_FRAG         4           /* Num.of RX Fragments 4*1536= 6.0kB */
-#define NUM_TX_FRAG         3           /* Num.of TX Fragments 3*1536= 4.6kB */
-//#define ETH_FRAG_SIZE       1536        /* Packet Fragment size 1536 Bytes   */
-
-//#define ETH_MAX_FLEN        1536        /* Max. Ethernet Frame Size          */
-#define ETH_FRAG_SIZE       0x300       /* Packet Fragment size 1536/2 Bytes   */
-#define ETH_MAX_FLEN        0x300       /* Max. Ethernet Frame Size          */
-
-const int ethernet_MTU_SIZE  = 0x300;
-
-#endif
-
-#define ETHERNET_ADDR_SIZE 6
-
-PACKED struct RX_DESC_TypeDef {                        /* RX Descriptor struct              */
-   unsigned int Packet;
-   unsigned int Ctrl;
-};
-typedef struct RX_DESC_TypeDef RX_DESC_TypeDef;
-
-PACKED struct RX_STAT_TypeDef {                        /* RX Status struct                  */
-   unsigned int Info;
-   unsigned int HashCRC;
-};
-typedef struct RX_STAT_TypeDef RX_STAT_TypeDef;
-
-PACKED struct TX_DESC_TypeDef {                        /* TX Descriptor struct              */
-   unsigned int Packet;
-   unsigned int Ctrl;
-};
-typedef struct TX_DESC_TypeDef TX_DESC_TypeDef;
-
-PACKED struct TX_STAT_TypeDef {                        /* TX Status struct                  */
-   unsigned int Info;
-};
-typedef struct TX_STAT_TypeDef TX_STAT_TypeDef;
-
-/* MAC Configuration Register 1 */
-#define MAC1_REC_EN         0x00000001  /* Receive Enable                    */
-#define MAC1_PASS_ALL       0x00000002  /* Pass All Receive Frames           */
-#define MAC1_RX_FLOWC       0x00000004  /* RX Flow Control                   */
-#define MAC1_TX_FLOWC       0x00000008  /* TX Flow Control                   */
-#define MAC1_LOOPB          0x00000010  /* Loop Back Mode                    */
-#define MAC1_RES_TX         0x00000100  /* Reset TX Logic                    */
-#define MAC1_RES_MCS_TX     0x00000200  /* Reset MAC TX Control Sublayer     */
-#define MAC1_RES_RX         0x00000400  /* Reset RX Logic                    */
-#define MAC1_RES_MCS_RX     0x00000800  /* Reset MAC RX Control Sublayer     */
-#define MAC1_SIM_RES        0x00004000  /* Simulation Reset                  */
-#define MAC1_SOFT_RES       0x00008000  /* Soft Reset MAC                    */
-
-/* MAC Configuration Register 2 */
-#define MAC2_FULL_DUP       0x00000001  /* Full Duplex Mode                  */
-#define MAC2_FRM_LEN_CHK    0x00000002  /* Frame Length Checking             */
-#define MAC2_HUGE_FRM_EN    0x00000004  /* Huge Frame Enable                 */
-#define MAC2_DLY_CRC        0x00000008  /* Delayed CRC Mode                  */
-#define MAC2_CRC_EN         0x00000010  /* Append CRC to every Frame         */
-#define MAC2_PAD_EN         0x00000020  /* Pad all Short Frames              */
-#define MAC2_VLAN_PAD_EN    0x00000040  /* VLAN Pad Enable                   */
-#define MAC2_ADET_PAD_EN    0x00000080  /* Auto Detect Pad Enable            */
-#define MAC2_PPREAM_ENF     0x00000100  /* Pure Preamble Enforcement         */
-#define MAC2_LPREAM_ENF     0x00000200  /* Long Preamble Enforcement         */
-#define MAC2_NO_BACKOFF     0x00001000  /* No Backoff Algorithm              */
-#define MAC2_BACK_PRESSURE  0x00002000  /* Backoff Presurre / No Backoff     */
-#define MAC2_EXCESS_DEF     0x00004000  /* Excess Defer                      */
-
-/* Back-to-Back Inter-Packet-Gap Register */
-#define IPGT_FULL_DUP       0x00000015  /* Recommended value for Full Duplex */
-#define IPGT_HALF_DUP       0x00000012  /* Recommended value for Half Duplex */
-
-/* Non Back-to-Back Inter-Packet-Gap Register */
-#define IPGR_DEF            0x00000012  /* Recommended value                 */
-
-/* Collision Window/Retry Register */
-#define CLRT_DEF            0x0000370F  /* Default value                     */
-
-/* PHY Support Register */
-#define SUPP_SPEED          0x00000100  /* Reduced MII Logic Current Speed   */
-//#define SUPP_RES_RMII       0x00000800  /* Reset Reduced MII Logic           */
-#define SUPP_RES_RMII       0x00000000  /* Reset Reduced MII Logic           */
-
-/* Test Register */
-#define TEST_SHCUT_PQUANTA  0x00000001  /* Shortcut Pause Quanta             */
-#define TEST_TST_PAUSE      0x00000002  /* Test Pause                        */
-#define TEST_TST_BACKP      0x00000004  /* Test Back Pressure                */
-
-/* MII Management Configuration Register */
-#define MCFG_SCAN_INC       0x00000001  /* Scan Increment PHY Address        */
-#define MCFG_SUPP_PREAM     0x00000002  /* Suppress Preamble                 */
-#define MCFG_CLK_SEL        0x0000003C  /* Clock Select Mask                 */
-#define MCFG_RES_MII        0x00008000  /* Reset MII Management Hardware     */
-
-/* MII Management Command Register */
-#define MCMD_READ           0x00000001  /* MII Read                          */
-#define MCMD_SCAN           0x00000002  /* MII Scan continuously             */
-
-#define MII_WR_TOUT         0x00050000  /* MII Write timeout count           */
-#define MII_RD_TOUT         0x00050000  /* MII Read timeout count            */
-
-/* MII Management Address Register */
-#define MADR_REG_ADR        0x0000001F  /* MII Register Address Mask         */
-#define MADR_PHY_ADR        0x00001F00  /* PHY Address Mask                  */
-
-/* MII Management Indicators Register */
-#define MIND_BUSY           0x00000001  /* MII is Busy                       */
-#define MIND_SCAN           0x00000002  /* MII Scanning in Progress          */
-#define MIND_NOT_VAL        0x00000004  /* MII Read Data not valid           */
-#define MIND_MII_LINK_FAIL  0x00000008  /* MII Link Failed                   */
-
-/* Command Register */
-#define CR_RX_EN            0x00000001  /* Enable Receive                    */
-#define CR_TX_EN            0x00000002  /* Enable Transmit                   */
-#define CR_REG_RES          0x00000008  /* Reset Host Registers              */
-#define CR_TX_RES           0x00000010  /* Reset Transmit Datapath           */
-#define CR_RX_RES           0x00000020  /* Reset Receive Datapath            */
-#define CR_PASS_RUNT_FRM    0x00000040  /* Pass Runt Frames                  */
-#define CR_PASS_RX_FILT     0x00000080  /* Pass RX Filter                    */
-#define CR_TX_FLOW_CTRL     0x00000100  /* TX Flow Control                   */
-#define CR_RMII             0x00000200  /* Reduced MII Interface             */
-#define CR_FULL_DUP         0x00000400  /* Full Duplex                       */
-
-/* Status Register */
-#define SR_RX_EN            0x00000001  /* Enable Receive                    */
-#define SR_TX_EN            0x00000002  /* Enable Transmit                   */
-
-/* Transmit Status Vector 0 Register */
-#define TSV0_CRC_ERR        0x00000001  /* CRC error                         */
-#define TSV0_LEN_CHKERR     0x00000002  /* Length Check Error                */
-#define TSV0_LEN_OUTRNG     0x00000004  /* Length Out of Range               */
-#define TSV0_DONE           0x00000008  /* Tramsmission Completed            */
-#define TSV0_MCAST          0x00000010  /* Multicast Destination             */
-#define TSV0_BCAST          0x00000020  /* Broadcast Destination             */
-#define TSV0_PKT_DEFER      0x00000040  /* Packet Deferred                   */
-#define TSV0_EXC_DEFER      0x00000080  /* Excessive Packet Deferral         */
-#define TSV0_EXC_COLL       0x00000100  /* Excessive Collision               */
-#define TSV0_LATE_COLL      0x00000200  /* Late Collision Occured            */
-#define TSV0_GIANT          0x00000400  /* Giant Frame                       */
-#define TSV0_UNDERRUN       0x00000800  /* Buffer Underrun                   */
-#define TSV0_BYTES          0x0FFFF000  /* Total Bytes Transferred           */
-#define TSV0_CTRL_FRAME     0x10000000  /* Control Frame                     */
-#define TSV0_PAUSE          0x20000000  /* Pause Frame                       */
-#define TSV0_BACK_PRESS     0x40000000  /* Backpressure Method Applied       */
-#define TSV0_VLAN           0x80000000  /* VLAN Frame                        */
-
-/* Transmit Status Vector 1 Register */
-#define TSV1_BYTE_CNT       0x0000FFFF  /* Transmit Byte Count               */
-#define TSV1_COLL_CNT       0x000F0000  /* Transmit Collision Count          */
-
-/* Receive Status Vector Register */
-#define RSV_BYTE_CNT        0x0000FFFF  /* Receive Byte Count                */
-#define RSV_PKT_IGNORED     0x00010000  /* Packet Previously Ignored         */
-#define RSV_RXDV_SEEN       0x00020000  /* RXDV Event Previously Seen        */
-#define RSV_CARR_SEEN       0x00040000  /* Carrier Event Previously Seen     */
-#define RSV_REC_CODEV       0x00080000  /* Receive Code Violation            */
-#define RSV_CRC_ERR         0x00100000  /* CRC Error                         */
-#define RSV_LEN_CHKERR      0x00200000  /* Length Check Error                */
-#define RSV_LEN_OUTRNG      0x00400000  /* Length Out of Range               */
-#define RSV_REC_OK          0x00800000  /* Frame Received OK                 */
-#define RSV_MCAST           0x01000000  /* Multicast Frame                   */
-#define RSV_BCAST           0x02000000  /* Broadcast Frame                   */
-#define RSV_DRIB_NIBB       0x04000000  /* Dribble Nibble                    */
-#define RSV_CTRL_FRAME      0x08000000  /* Control Frame                     */
-#define RSV_PAUSE           0x10000000  /* Pause Frame                       */
-#define RSV_UNSUPP_OPC      0x20000000  /* Unsupported Opcode                */
-#define RSV_VLAN            0x40000000  /* VLAN Frame                        */
-
-/* Flow Control Counter Register */
-#define FCC_MIRR_CNT        0x0000FFFF  /* Mirror Counter                    */
-#define FCC_PAUSE_TIM       0xFFFF0000  /* Pause Timer                       */
-
-/* Flow Control Status Register */
-#define FCS_MIRR_CNT        0x0000FFFF  /* Mirror Counter Current            */
-
-/* Receive Filter Control Register */
-#define RFC_UCAST_EN        0x00000001  /* Accept Unicast Frames Enable      */
-#define RFC_BCAST_EN        0x00000002  /* Accept Broadcast Frames Enable    */
-#define RFC_MCAST_EN        0x00000004  /* Accept Multicast Frames Enable    */
-#define RFC_UCAST_HASH_EN   0x00000008  /* Accept Unicast Hash Filter Frames */
-#define RFC_MCAST_HASH_EN   0x00000010  /* Accept Multicast Hash Filter Fram.*/
-#define RFC_PERFECT_EN      0x00000020  /* Accept Perfect Match Enable       */
-#define RFC_MAGP_WOL_EN     0x00001000  /* Magic Packet Filter WoL Enable    */
-#define RFC_PFILT_WOL_EN    0x00002000  /* Perfect Filter WoL Enable         */
-
-/* Receive Filter WoL Status/Clear Registers */
-#define WOL_UCAST           0x00000001  /* Unicast Frame caused WoL          */
-#define WOL_BCAST           0x00000002  /* Broadcast Frame caused WoL        */
-#define WOL_MCAST           0x00000004  /* Multicast Frame caused WoL        */
-#define WOL_UCAST_HASH      0x00000008  /* Unicast Hash Filter Frame WoL     */
-#define WOL_MCAST_HASH      0x00000010  /* Multicast Hash Filter Frame WoL   */
-#define WOL_PERFECT         0x00000020  /* Perfect Filter WoL                */
-#define WOL_RX_FILTER       0x00000080  /* RX Filter caused WoL              */
-#define WOL_MAG_PACKET      0x00000100  /* Magic Packet Filter caused WoL    */
-
-/* Interrupt Status/Enable/Clear/Set Registers */
-#define INT_RX_OVERRUN      0x00000001  /* Overrun Error in RX Queue         */
-#define INT_RX_ERR          0x00000002  /* Receive Error                     */
-#define INT_RX_FIN          0x00000004  /* RX Finished Process Descriptors   */
-#define INT_RX_DONE         0x00000008  /* Receive Done                      */
-#define INT_TX_UNDERRUN     0x00000010  /* Transmit Underrun                 */
-#define INT_TX_ERR          0x00000020  /* Transmit Error                    */
-#define INT_TX_FIN          0x00000040  /* TX Finished Process Descriptors   */
-#define INT_TX_DONE         0x00000080  /* Transmit Done                     */
-#define INT_SOFT_INT        0x00001000  /* Software Triggered Interrupt      */
-#define INT_WAKEUP          0x00002000  /* Wakeup Event Interrupt            */
-
-/* Power Down Register */
-#define PD_POWER_DOWN       0x80000000  /* Power Down MAC                    */
-
-/* RX Descriptor Control Word */
-#define RCTRL_SIZE          0x000007FF  /* Buffer size mask                  */
-#define RCTRL_INT           0x80000000  /* Generate RxDone Interrupt         */
-
-/* RX Status Hash CRC Word */
-#define RHASH_SA            0x000001FF  /* Hash CRC for Source Address       */
-#define RHASH_DA            0x001FF000  /* Hash CRC for Destination Address  */
-
-/* RX Status Information Word */
-#define RINFO_SIZE          0x000007FF  /* Data size in bytes                */
-#define RINFO_CTRL_FRAME    0x00040000  /* Control Frame                     */
-#define RINFO_VLAN          0x00080000  /* VLAN Frame                        */
-#define RINFO_FAIL_FILT     0x00100000  /* RX Filter Failed                  */
-#define RINFO_MCAST         0x00200000  /* Multicast Frame                   */
-#define RINFO_BCAST         0x00400000  /* Broadcast Frame                   */
-#define RINFO_CRC_ERR       0x00800000  /* CRC Error in Frame                */
-#define RINFO_SYM_ERR       0x01000000  /* Symbol Error from PHY             */
-#define RINFO_LEN_ERR       0x02000000  /* Length Error                      */
-#define RINFO_RANGE_ERR     0x04000000  /* Range Error (exceeded max. size)  */
-#define RINFO_ALIGN_ERR     0x08000000  /* Alignment Error                   */
-#define RINFO_OVERRUN       0x10000000  /* Receive overrun                   */
-#define RINFO_NO_DESCR      0x20000000  /* No new Descriptor available       */
-#define RINFO_LAST_FLAG     0x40000000  /* Last Fragment in Frame            */
-#define RINFO_ERR           0x80000000  /* Error Occured (OR of all errors)  */
-
-//#define RINFO_ERR_MASK     (RINFO_FAIL_FILT | RINFO_CRC_ERR   | RINFO_SYM_ERR | RINFO_LEN_ERR   | RINFO_ALIGN_ERR | RINFO_OVERRUN)
-#define RINFO_ERR_MASK     (RINFO_FAIL_FILT | RINFO_SYM_ERR | \
-                            RINFO_LEN_ERR   | RINFO_ALIGN_ERR | RINFO_OVERRUN)
-
-
-/* TX Descriptor Control Word */
-#define TCTRL_SIZE          0x000007FF  /* Size of data buffer in bytes      */
-#define TCTRL_OVERRIDE      0x04000000  /* Override Default MAC Registers    */
-#define TCTRL_HUGE          0x08000000  /* Enable Huge Frame                 */
-#define TCTRL_PAD           0x10000000  /* Pad short Frames to 64 bytes      */
-#define TCTRL_CRC           0x20000000  /* Append a hardware CRC to Frame    */
-#define TCTRL_LAST          0x40000000  /* Last Descriptor for TX Frame      */
-#define TCTRL_INT           0x80000000  /* Generate TxDone Interrupt         */
-
-/* TX Status Information Word */
-#define TINFO_COL_CNT       0x01E00000  /* Collision Count                   */
-#define TINFO_DEFER         0x02000000  /* Packet Deferred (not an error)    */
-#define TINFO_EXCESS_DEF    0x04000000  /* Excessive Deferral                */
-#define TINFO_EXCESS_COL    0x08000000  /* Excessive Collision               */
-#define TINFO_LATE_COL      0x10000000  /* Late Collision Occured            */
-#define TINFO_UNDERRUN      0x20000000  /* Transmit Underrun                 */
-#define TINFO_NO_DESCR      0x40000000  /* No new Descriptor available       */
-#define TINFO_ERR           0x80000000  /* Error Occured (OR of all errors)  */
-
-/* ENET Device Revision ID */
-#define OLD_EMAC_MODULE_ID  0x39022000  /* Rev. ID for first rev '-'         */
-
-/* DP83848C PHY Registers */
-#define PHY_REG_BMCR        0x00        /* Basic Mode Control Register       */
-#define PHY_REG_BMSR        0x01        /* Basic Mode Status Register        */
-#define PHY_REG_IDR1        0x02        /* PHY Identifier 1                  */
-#define PHY_REG_IDR2        0x03        /* PHY Identifier 2                  */
-#define PHY_REG_ANAR        0x04        /* Auto-Negotiation Advertisement    */
-#define PHY_REG_ANLPAR      0x05        /* Auto-Neg. Link Partner Abitily    */
-#define PHY_REG_ANER        0x06        /* Auto-Neg. Expansion Register      */
-#define PHY_REG_ANNPTR      0x07        /* Auto-Neg. Next Page TX            */
-
-/* PHY Extended Registers */
-#define PHY_REG_STS         0x10        /* Status Register                   */
-#define PHY_REG_MICR        0x11        /* MII Interrupt Control Register    */
-#define PHY_REG_MISR        0x12        /* MII Interrupt Status Register     */
-#define PHY_REG_FCSCR       0x14        /* False Carrier Sense Counter       */
-#define PHY_REG_RECR        0x15        /* Receive Error Counter             */
-#define PHY_REG_PCSR        0x16        /* PCS Sublayer Config. and Status   */
-#define PHY_REG_RBR         0x17        /* RMII and Bypass Register          */
-#define PHY_REG_LEDCR       0x18        /* LED Direct Control Register       */
-#define PHY_REG_PHYCR       0x19        /* PHY Control Register              */
-#define PHY_REG_10BTSCR     0x1A        /* 10Base-T Status/Control Register  */
-#define PHY_REG_CDCTRL1     0x1B        /* CD Test Control and BIST Extens.  */
-#define PHY_REG_EDCR        0x1D        /* Energy Detect Control Register    */
-
-#define PHY_REG_SCSR        0x1F        /* PHY Special Control/Status Register */
-
-#define PHY_FULLD_100M      0x2100      /* Full Duplex 100Mbit               */
-#define PHY_HALFD_100M      0x2000      /* Half Duplex 100Mbit               */
-#define PHY_FULLD_10M       0x0100      /* Full Duplex 10Mbit                */
-#define PHY_HALFD_10M       0x0000      /* Half Duplex 10MBit                */
-#define PHY_AUTO_NEG        0x3000      /* Select Auto Negotiation           */
-
-#define DP83848C_DEF_ADR    0x0100      /* Default PHY device address        */
-#define DP83848C_ID         0x20005C90  /* PHY Identifier - DP83848C         */
-
-#define LAN8720_ID          0x0007C0F0  /* PHY Identifier - LAN8720          */
-
-#define PHY_STS_LINK        0x0001      /* PHY Status Link Mask              */
-#define PHY_STS_SPEED       0x0002      /* PHY Status Speed Mask             */
-#define PHY_STS_DUPLEX      0x0004      /* PHY Status Duplex Mask            */
-
-#define PHY_BMCR_RESET      0x8000      /* PHY Reset                         */
-
-#define PHY_BMSR_LINK       0x0004      /* PHY BMSR Link valid               */
-
-#define PHY_SCSR_100MBIT    0x0008      /* Speed: 1=100 MBit, 0=10Mbit       */
-#define PHY_SCSR_DUPLEX     0x0010      /* PHY Duplex Mask                   */
-
-
-static int phy_read(unsigned int PhyReg);
-static int phy_write(unsigned int PhyReg, unsigned short Data);
-
-static void txdscr_init(void);
-static void rxdscr_init(void);
-
-#if defined (__ICCARM__)
-#   define AHBSRAM1
-#elif defined(TOOLCHAIN_GCC_CR)
-#   define AHBSRAM1 __attribute__((section(".data.$RamPeriph32")))
-#else
-#   define AHBSRAM1     __attribute__((section("AHBSRAM1"),aligned))
-#endif
-
-AHBSRAM1 volatile uint8_t rxbuf[NUM_RX_FRAG][ETH_FRAG_SIZE];
-AHBSRAM1 volatile uint8_t txbuf[NUM_TX_FRAG][ETH_FRAG_SIZE];
-AHBSRAM1 volatile RX_DESC_TypeDef rxdesc[NUM_RX_FRAG];
-AHBSRAM1 volatile RX_STAT_TypeDef rxstat[NUM_RX_FRAG];
-AHBSRAM1 volatile TX_DESC_TypeDef txdesc[NUM_TX_FRAG];
-AHBSRAM1 volatile TX_STAT_TypeDef txstat[NUM_TX_FRAG];
-
-
-#if NEW_LOGIC
-static int rx_consume_offset = -1;
-static int tx_produce_offset = -1;
-#else
-static int send_doff =  0;
-static int send_idx  = -1;
-static int send_size =  0;
-
-static int receive_soff =  0;
-static int receive_idx  = -1;
-#endif
-
-static uint32_t phy_id = 0;
-
-static inline int rinc(int idx, int mod) {
-  ++idx;
-  idx %= mod;
-  return idx;
-}
-
-//extern unsigned int SystemFrequency;
-static inline unsigned int clockselect() {
-  if(SystemCoreClock < 10000000) {
-    return 1;
-  } else if(SystemCoreClock <  15000000) {
-    return 2;
-  } else if(SystemCoreClock <  20000000) {
-    return 3;
-  } else if(SystemCoreClock <  25000000) {
-    return 4;
-  } else if(SystemCoreClock <  35000000) {
-    return 5;
-  } else if(SystemCoreClock <  50000000) {
-    return 6;
-  } else if(SystemCoreClock <  70000000) {
-    return 7;
-  } else if(SystemCoreClock <  80000000) {
-    return 8;
-  } else if(SystemCoreClock <  90000000) {
-    return 9;
-  } else if(SystemCoreClock < 100000000) {
-    return 10;
-  } else if(SystemCoreClock < 120000000) {
-    return 11;
-  } else if(SystemCoreClock < 130000000) {
-    return 12;
-  } else if(SystemCoreClock < 140000000) {
-    return 13;
-  } else if(SystemCoreClock < 150000000) {
-    return 15;
-  } else if(SystemCoreClock < 160000000) {
-    return 16;
-  } else {
-    return 0;
-  }
-}
-
-#ifndef min
-#define min(x, y) (((x)<(y))?(x):(y))
-#endif
-
-/*----------------------------------------------------------------------------
-  Ethernet Device initialize
- *----------------------------------------------------------------------------*/
-int ethernet_init() {
-  int regv, tout;
-  char mac[ETHERNET_ADDR_SIZE];
-  unsigned int clock = clockselect();
-  
-  LPC_SC->PCONP |= 0x40000000;                       /* Power Up the EMAC controller. */
-  
-  LPC_IOCON->P1_0  &= ~0x07;    /*  ENET I/O config */
-  LPC_IOCON->P1_0  |= 0x01;     /* ENET_TXD0 */
-  LPC_IOCON->P1_1  &= ~0x07;
-  LPC_IOCON->P1_1  |= 0x01;     /* ENET_TXD1 */
-  LPC_IOCON->P1_4  &= ~0x07;
-  LPC_IOCON->P1_4  |= 0x01;     /* ENET_TXEN */
-  LPC_IOCON->P1_8  &= ~0x07;
-  LPC_IOCON->P1_8  |= 0x01;     /* ENET_CRS */
-  LPC_IOCON->P1_9  &= ~0x07;
-  LPC_IOCON->P1_9  |= 0x01;     /* ENET_RXD0 */
-  LPC_IOCON->P1_10 &= ~0x07;
-  LPC_IOCON->P1_10 |= 0x01;     /* ENET_RXD1 */
-  LPC_IOCON->P1_14 &= ~0x07;
-  LPC_IOCON->P1_14 |= 0x01;     /* ENET_RX_ER */
-  LPC_IOCON->P1_15 &= ~0x07;
-  LPC_IOCON->P1_15 |= 0x01;     /* ENET_REF_CLK */
-  LPC_IOCON->P1_16 &= ~0x07;    /* ENET/PHY I/O config */
-  LPC_IOCON->P1_16 |= 0x01;     /* ENET_MDC */
-  LPC_IOCON->P1_17 &= ~0x07;
-  LPC_IOCON->P1_17 |= 0x01;     /* ENET_MDIO */
-  
-   /* Reset all EMAC internal modules. */
-  LPC_EMAC->MAC1    = MAC1_RES_TX | MAC1_RES_MCS_TX | MAC1_RES_RX |
-                      MAC1_RES_MCS_RX | MAC1_SIM_RES | MAC1_SOFT_RES;
-  LPC_EMAC->Command = CR_REG_RES | CR_TX_RES | CR_RX_RES | CR_PASS_RUNT_FRM;
-
-  for(tout = 100; tout; tout--) __NOP();             /* A short delay after reset. */
-
-  LPC_EMAC->MAC1 = MAC1_PASS_ALL;                    /* Initialize MAC control registers. */
-  LPC_EMAC->MAC2 = MAC2_CRC_EN | MAC2_PAD_EN;
-  LPC_EMAC->MAXF = ETH_MAX_FLEN;
-  LPC_EMAC->CLRT = CLRT_DEF;
-  LPC_EMAC->IPGR = IPGR_DEF;
-
-  LPC_EMAC->Command = CR_RMII | CR_PASS_RUNT_FRM;    /* Enable Reduced MII interface. */
-
-  LPC_EMAC->MCFG = (clock << 0x2) & MCFG_CLK_SEL;    /* Set clock */
-  LPC_EMAC->MCFG |= MCFG_RES_MII;                    /* and reset */
-
-  for(tout = 100; tout; tout--) __NOP();             /* A short delay */
-
-  LPC_EMAC->MCFG = (clock << 0x2) & MCFG_CLK_SEL;
-  LPC_EMAC->MCMD = 0;
-
-  LPC_EMAC->SUPP = SUPP_RES_RMII;                    /* Reset Reduced MII Logic. */
-
-  for (tout = 100; tout; tout--) __NOP();            /* A short delay */
-
-  LPC_EMAC->SUPP = 0;
-
-  phy_write(PHY_REG_BMCR, PHY_BMCR_RESET);           /* perform PHY reset */
-  for(tout = 0x20000; ; tout--) {                    /* Wait for hardware reset to end. */
-    regv = phy_read(PHY_REG_BMCR);
-    if(regv < 0 || tout == 0) {
-       return -1;                                    /* Error */
-    }
-    if(!(regv & PHY_BMCR_RESET)) {
-       break;                                        /* Reset complete. */
-    }
-  }
-
-  phy_id =  (phy_read(PHY_REG_IDR1) << 16);
-  phy_id |= (phy_read(PHY_REG_IDR2) & 0XFFF0);
-
-  if (phy_id != DP83848C_ID && phy_id != LAN8720_ID) {
-      error("Unknown Ethernet PHY (%x)", (unsigned int)phy_id);
-  }
-
-  ethernet_set_link(-1, 0);
-
-  /* Set the Ethernet MAC Address registers */
-  ethernet_address(mac);
-  LPC_EMAC->SA0 = ((uint32_t)mac[5] << 8) | (uint32_t)mac[4];
-  LPC_EMAC->SA1 = ((uint32_t)mac[3] << 8) | (uint32_t)mac[2];
-  LPC_EMAC->SA2 = ((uint32_t)mac[1] << 8) | (uint32_t)mac[0];
-
-  txdscr_init();                                      /* initialize DMA TX Descriptor */
-  rxdscr_init();                                      /* initialize DMA RX Descriptor */
-
-  LPC_EMAC->RxFilterCtrl = RFC_UCAST_EN | RFC_MCAST_EN | RFC_BCAST_EN | RFC_PERFECT_EN;
-                                                      /* Receive Broadcast, Perfect Match Packets */
-
-  LPC_EMAC->IntEnable = INT_RX_DONE | INT_TX_DONE;    /* Enable EMAC interrupts. */
-  LPC_EMAC->IntClear  = 0xFFFF;                       /* Reset all interrupts */
-  
-  LPC_EMAC->Command  |= (CR_RX_EN | CR_TX_EN);        /* Enable receive and transmit mode of MAC Ethernet core */
-  LPC_EMAC->MAC1     |= MAC1_REC_EN;
-
-#if NEW_LOGIC
-  rx_consume_offset = -1;
-  tx_produce_offset = -1;
-#else
-  send_doff =  0;
-  send_idx  = -1;
-  send_size =  0;
-
-  receive_soff =  0;
-  receive_idx  = -1;
-#endif
-
-  return 0;
-}
-
-/*----------------------------------------------------------------------------
-  Ethernet Device Uninitialize
- *----------------------------------------------------------------------------*/
-void ethernet_free() {
-    LPC_EMAC->IntEnable &= ~(INT_RX_DONE | INT_TX_DONE);
-    LPC_EMAC->IntClear   =  0xFFFF;
-    
-    LPC_SC->PCONP   &= ~0x40000000;       /* Power down the EMAC controller. */
-    
-    LPC_IOCON->P1_0  &= ~0x07;    /*  ENET I/O config */
-    LPC_IOCON->P1_1  &= ~0x07;
-    LPC_IOCON->P1_4  &= ~0x07;
-    LPC_IOCON->P1_8  &= ~0x07;
-    LPC_IOCON->P1_9  &= ~0x07;
-    LPC_IOCON->P1_10 &= ~0x07;
-    LPC_IOCON->P1_14 &= ~0x07;
-    LPC_IOCON->P1_15 &= ~0x07;
-    LPC_IOCON->P1_16 &= ~0x07;    /* ENET/PHY I/O config */
-    LPC_IOCON->P1_17 &= ~0x07;
-}
-
-// if(TxProduceIndex == TxConsumeIndex) buffer array is empty
-// if(TxProduceIndex == TxConsumeIndex - 1) buffer is full, should not fill
-// TxProduceIndex - The buffer that will/is being fileld by driver, s/w increment
-// TxConsumeIndex - The buffer that will/is beign sent by hardware
-
-int ethernet_write(const char *data, int slen) {
-
-#if NEW_LOGIC
-
-   if(tx_produce_offset < 0) { // mark as active if not already
-     tx_produce_offset = 0;
-   }
-
-   int index = LPC_EMAC->TxProduceIndex;
-
-   int remaining = ETH_MAX_FLEN - tx_produce_offset - 4; // bytes written plus checksum
-   int requested = slen;
-   int ncopy = min(remaining, requested);
-
-   void *pdst = (void *)(txdesc[index].Packet + tx_produce_offset);
-   void *psrc = (void *)(data);
-
-   if(ncopy > 0 ){
-     if(data != NULL) {
-       memcpy(pdst, psrc, ncopy);
-     } else {
-       memset(pdst, 0, ncopy);
-     }
-   }
-
-   tx_produce_offset += ncopy;
-
-   return ncopy;
-
-#else
-    void       *pdst, *psrc;
-    const int   dlen = ETH_FRAG_SIZE;
-    int         copy = 0;
-    int         soff = 0;
-
-    if(send_idx == -1) {
-        send_idx = LPC_EMAC->TxProduceIndex;
-    }
-
-    if(slen + send_doff > ethernet_MTU_SIZE) {
-       return -1;
-    }
-
-    do {
-        copy = min(slen - soff, dlen - send_doff);
-        pdst = (void *)(txdesc[send_idx].Packet + send_doff);
-        psrc = (void *)(data + soff);
-        if(send_doff + copy > ETH_FRAG_SIZE) {
-            txdesc[send_idx].Ctrl = (send_doff-1) | (TCTRL_INT);
-            send_idx = rinc(send_idx, NUM_TX_FRAG);
-            send_doff = 0;
-        }
-
-        if(data != NULL) {
-            memcpy(pdst, psrc, copy);
-        } else {
-            memset(pdst, 0, copy);
-        }
-
-        soff += copy;
-        send_doff += copy;
-        send_size += copy;
-    } while(soff != slen);
-
-    return soff;
-#endif
-}
-
-int ethernet_send() {
-
-#if NEW_LOGIC
-  if(tx_produce_offset < 0) { // no buffer active
-    return -1;
-  }
-
-  // ensure there is a link
-  if(!ethernet_link()) {
-    return -2;
-  }
-
-  // we have been writing in to a buffer, so finalise it
-  int size = tx_produce_offset;
-  int index = LPC_EMAC->TxProduceIndex;
-  txdesc[index].Ctrl = (tx_produce_offset-1) | (TCTRL_INT | TCTRL_LAST);
-
-  // Increment ProduceIndex to allow it to be sent
-  // We can only do this if the next slot is free
-  int next = rinc(index, NUM_TX_FRAG);
-  while(next == LPC_EMAC->TxConsumeIndex) {
-    for(int i=0; i<1000; i++) { __NOP(); }
-  }
-
-  LPC_EMAC->TxProduceIndex = next;
-  tx_produce_offset = -1;
-  return size;
-
-#else
-    int s = send_size;
-    txdesc[send_idx].Ctrl = (send_doff-1) | (TCTRL_INT | TCTRL_LAST);
-    send_idx  = rinc(send_idx, NUM_TX_FRAG);
-    LPC_EMAC->TxProduceIndex = send_idx;
-    send_doff =  0;
-    send_idx  = -1;
-    send_size =  0;
-    return s;
-#endif
-}
-
-// RxConsmeIndex - The index of buffer the driver will/is reading from. Driver should inc once read
-// RxProduceIndex - The index of buffer that will/is being filled by MAC. H/w will inc once rxd
-//
-// if(RxConsumeIndex == RxProduceIndex) buffer array is empty
-// if(RxConsumeIndex == RxProduceIndex + 1) buffer array is full
-
-// Recevies an arrived ethernet packet.
-// Receiving an ethernet packet will drop the last received ethernet packet
-// and make a new ethernet packet ready to read.
-// Returns size of packet, else 0 if nothing to receive
-
-// We read from RxConsumeIndex from position rx_consume_offset
-// if rx_consume_offset < 0, then we have not recieved the RxConsumeIndex packet for reading
-// rx_consume_offset = -1 // no frame
-// rx_consume_offset = 0  // start of frame
-// Assumption: A fragment should alway be a whole frame
-
-int ethernet_receive() {
-#if NEW_LOGIC
-
-  // if we are currently reading a valid RxConsume buffer, increment to the next one
-  if(rx_consume_offset >= 0) {
-    LPC_EMAC->RxConsumeIndex = rinc(LPC_EMAC->RxConsumeIndex, NUM_RX_FRAG);
-  }
-
-  // if the buffer is empty, mark it as no valid buffer
-  if(LPC_EMAC->RxConsumeIndex == LPC_EMAC->RxProduceIndex) {
-    rx_consume_offset = -1;
-    return 0;
-  }
-
-  uint32_t info = rxstat[LPC_EMAC->RxConsumeIndex].Info;
-  rx_consume_offset = 0;
-
-  // check if it is not marked as last or for errors
-  if(!(info & RINFO_LAST_FLAG) || (info & RINFO_ERR_MASK)) {
-    return -1;
-  }
-
-  int size = (info & RINFO_SIZE) + 1;
-  return size - 4; // don't include checksum bytes
-
-#else
-    if(receive_idx == -1) {
-      receive_idx = LPC_EMAC->RxConsumeIndex;
-    } else {
-        while(!(rxstat[receive_idx].Info & RINFO_LAST_FLAG) && ((uint32_t)receive_idx != LPC_EMAC->RxProduceIndex)) {
-            receive_idx  = rinc(receive_idx, NUM_RX_FRAG);
-        }
-        unsigned int info =   rxstat[receive_idx].Info;
-        int slen =  (info & RINFO_SIZE) + 1;
-
-        if(slen > ethernet_MTU_SIZE || (info & RINFO_ERR_MASK)) {
-            /* Invalid frame, ignore it and free buffer. */
-            receive_idx = rinc(receive_idx, NUM_RX_FRAG);
-        }
-        receive_idx = rinc(receive_idx, NUM_RX_FRAG);
-        receive_soff = 0;
-
-        LPC_EMAC->RxConsumeIndex = receive_idx;
-    }
-
-    if((uint32_t)receive_idx == LPC_EMAC->RxProduceIndex) {
-        receive_idx = -1;
-        return 0;
-    }
-
-    return (rxstat[receive_idx].Info & RINFO_SIZE) - 3;
-#endif
-}
-
-// Read from an recevied ethernet packet.
-// After receive returnd a number bigger than 0 it is
-// possible to read bytes from this packet.
-// Read will write up to size bytes into data.
-// It is possible to use read multible times.
-// Each time read will start reading after the last read byte before.
-
-int ethernet_read(char *data, int dlen) {
-#if NEW_LOGIC
-  // Check we have a valid buffer to read
-  if(rx_consume_offset < 0) {
-    return 0;
-  }
-
-  // Assume 1 fragment block
-  uint32_t info = rxstat[LPC_EMAC->RxConsumeIndex].Info;
-  int size = (info & RINFO_SIZE) + 1 - 4; // exclude checksum
-
-  int remaining = size - rx_consume_offset;
-  int requested = dlen;
-  int ncopy = min(remaining, requested);
-
-  void *psrc = (void *)(rxdesc[LPC_EMAC->RxConsumeIndex].Packet + rx_consume_offset);
-  void *pdst = (void *)(data);
-
-  if(data != NULL && ncopy > 0) {
-    memcpy(pdst, psrc, ncopy);
-  }
-
-  rx_consume_offset += ncopy;
-
-  return ncopy;
-#else
-    int          slen;
-    int          copy   = 0;
-    unsigned int more;
-    unsigned int info;
-    void        *pdst, *psrc;
-    int          doff = 0;
-
-    if((uint32_t)receive_idx == LPC_EMAC->RxProduceIndex || receive_idx == -1) {
-        return 0;
-    }
-
-    do {
-        info =   rxstat[receive_idx].Info;
-        more = !(info & RINFO_LAST_FLAG);
-        slen =  (info & RINFO_SIZE) + 1;
-
-        if(slen > ethernet_MTU_SIZE || (info & RINFO_ERR_MASK)) {
-            /* Invalid frame, ignore it and free buffer. */
-            receive_idx = rinc(receive_idx, NUM_RX_FRAG);
-        } else {
-
-            copy = min(slen - receive_soff, dlen - doff);
-            psrc = (void *)(rxdesc[receive_idx].Packet + receive_soff);
-            pdst = (void *)(data + doff);
-
-            if(data != NULL) {
-                /* check if Buffer available */
-                memcpy(pdst, psrc, copy);
-            }
-
-            receive_soff += copy;
-            doff += copy;
-
-            if((more && (receive_soff == slen))) {
-                receive_idx = rinc(receive_idx, NUM_RX_FRAG);
-                receive_soff = 0;
-            }
-        }
-    } while(more && !(doff == dlen) && !receive_soff);
-
-    return doff;
-#endif
-}
-
-int ethernet_link(void) {
-
-    if (phy_id == DP83848C_ID) {
-      return (phy_read(PHY_REG_STS) & PHY_STS_LINK);
-    }
-    else { // LAN8720_ID
-      return (phy_read(PHY_REG_BMSR) & PHY_BMSR_LINK);
-    }
-}
-
-static int phy_write(unsigned int PhyReg, unsigned short Data) {
-    unsigned int timeOut;
-
-    LPC_EMAC->MADR = DP83848C_DEF_ADR | PhyReg;
-    LPC_EMAC->MWTD = Data;
-
-    for(timeOut = 0; timeOut < MII_WR_TOUT; timeOut++) {     /* Wait until operation completed */
-        if((LPC_EMAC->MIND & MIND_BUSY) == 0) {
-            return 0;
-        }
-    }
-
-    return -1;
-}
-
-
-static int phy_read(unsigned int PhyReg) {
-    unsigned int timeOut;
-
-    LPC_EMAC->MADR = DP83848C_DEF_ADR | PhyReg;
-    LPC_EMAC->MCMD = MCMD_READ;
-
-    for(timeOut = 0; timeOut < MII_RD_TOUT; timeOut++) {     /* Wait until operation completed */
-        if((LPC_EMAC->MIND & MIND_BUSY) == 0) {
-            LPC_EMAC->MCMD = 0;
-            return LPC_EMAC->MRDD;                           /* Return a 16-bit value. */
-        }
-    }
-
-    return -1;
-}
-
-
-static void txdscr_init() {
-    int i;
-
-    for(i = 0; i < NUM_TX_FRAG; i++) {
-        txdesc[i].Packet = (uint32_t)&txbuf[i];
-        txdesc[i].Ctrl   = 0;
-        txstat[i].Info   = 0;
-    }
-
-    LPC_EMAC->TxDescriptor       = (uint32_t)txdesc;         /* Set EMAC Transmit Descriptor Registers. */
-    LPC_EMAC->TxStatus           = (uint32_t)txstat;
-    LPC_EMAC->TxDescriptorNumber = NUM_TX_FRAG-1;
-
-    LPC_EMAC->TxProduceIndex  = 0;                           /* Tx Descriptors Point to 0 */
-}
-
-
-static void rxdscr_init() {
-    int i;
-
-    for(i = 0; i < NUM_RX_FRAG; i++) {
-        rxdesc[i].Packet  = (uint32_t)&rxbuf[i];
-        rxdesc[i].Ctrl    = RCTRL_INT | (ETH_FRAG_SIZE-1);
-        rxstat[i].Info    = 0;
-        rxstat[i].HashCRC = 0;
-    }
-
-    LPC_EMAC->RxDescriptor       = (uint32_t)rxdesc;        /* Set EMAC Receive Descriptor Registers. */
-    LPC_EMAC->RxStatus           = (uint32_t)rxstat;
-    LPC_EMAC->RxDescriptorNumber = NUM_RX_FRAG-1;
-
-    LPC_EMAC->RxConsumeIndex  = 0;                          /* Rx Descriptors Point to 0 */
-}
-
-void ethernet_address(char *mac) {
-    mbed_mac_address(mac);
-}
-
-void ethernet_set_link(int speed, int duplex) {
-    unsigned short phy_data;
-    int tout;
-    
-    if((speed < 0) || (speed > 1)) {
-        phy_data = PHY_AUTO_NEG;
-    } else {
-        phy_data = (((unsigned short) speed << 13) |
-                    ((unsigned short) duplex << 8));
-    }
-    
-    phy_write(PHY_REG_BMCR, phy_data);
-    
-    for (tout = 100; tout; tout--) { __NOP(); }     /* A short delay */
-    
-    switch(phy_id) {
-        case DP83848C_ID:
-            phy_data = phy_read(PHY_REG_STS);
-            
-            if(phy_data & PHY_STS_DUPLEX) {
-                LPC_EMAC->MAC2 |= MAC2_FULL_DUP;
-                LPC_EMAC->Command |= CR_FULL_DUP;
-                LPC_EMAC->IPGT = IPGT_FULL_DUP;
-            } else {
-            LPC_EMAC->MAC2 &= ~MAC2_FULL_DUP;
-                LPC_EMAC->Command &= ~CR_FULL_DUP;
-                LPC_EMAC->IPGT = IPGT_HALF_DUP;
-            }
-            
-            if(phy_data & PHY_STS_SPEED) {
-                LPC_EMAC->SUPP &= ~SUPP_SPEED;
-            } else {
-                LPC_EMAC->SUPP |= SUPP_SPEED;
-            }
-            break;
-        
-        case LAN8720_ID:
-            phy_data = phy_read(PHY_REG_SCSR);
-            
-            if (phy_data & PHY_SCSR_DUPLEX) {
-                LPC_EMAC->MAC2 |= MAC2_FULL_DUP;
-                LPC_EMAC->Command |= CR_FULL_DUP;
-                LPC_EMAC->IPGT = IPGT_FULL_DUP;
-            } else {
-                LPC_EMAC->Command &= ~CR_FULL_DUP;
-                LPC_EMAC->IPGT = IPGT_HALF_DUP;
-            }
-            
-            if(phy_data & PHY_SCSR_100MBIT) {
-                LPC_EMAC->SUPP |= SUPP_SPEED;
-            } else {
-                LPC_EMAC->SUPP &= ~SUPP_SPEED;
-            }
-            
-            break;
-    }
-}
-
-/*
- * The Embedded Artists LPC4088 QuickStart Board has an eeprom with a unique
- * 48 bit ID. This ID is used as MAC address.
- */
-
-#include "i2c_api.h"
-
-static int _macRetrieved = 0;
-static char _macAddr[6] = {0x00,0x02,0xF7,0xF0,0x00,0x00};
-#define EEPROM_24AA02E48_ADDR (0xA0)
-
-void mbed_mac_address(char *mac) {
-
-    if (_macRetrieved == 0) {
-        char tmp[6];
-        i2c_t i2cObj;
-
-        i2c_init(&i2cObj, P0_27, P0_28);
-
-        do {
-            // the unique ID is at offset 0xFA
-            tmp[0] = 0xFA;
-            if (i2c_write(&i2cObj, EEPROM_24AA02E48_ADDR, tmp, 1, 1) != 1) {
-                break; // failed to write
-            }
-
-
-            if (i2c_read(&i2cObj, EEPROM_24AA02E48_ADDR, tmp, 6, 1) != 6) {
-                break; // failed to read
-            }
-
-            memcpy(_macAddr, tmp, 6);
-
-        } while(0);
-
-        // We always consider the MAC address to be retrieved even though
-        // reading from the eeprom failed. If it wasn't possible to read
-        // from eeprom the default address will be used.
-        _macRetrieved = 1;
-    }
-
-    memcpy(mac, _macAddr, 6);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/gpio_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "gpio_api.h"
-#include "pinmap.h"
-
-uint32_t gpio_set(PinName pin) {
-    pin_function(pin, 0);
-    return (1 << ((int)pin & 0x1F));
-}
-
-void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) {
-    if (pin == NC) return;
-    
-    obj->pin = pin;
-    obj->mask = gpio_set(pin);
-    
-    LPC_GPIO_TypeDef *port_reg = (LPC_GPIO_TypeDef *) ((int)(LPC_GPIO0_BASE+pin) & ~0x1F);
-    
-    obj->reg_set = &port_reg->SET;
-    obj->reg_clr = &port_reg->CLR;
-    obj->reg_in  = &port_reg->PIN;
-    obj->reg_dir = &port_reg->DIR;
-    
-    gpio_dir(obj, direction);
-    switch (direction) {
-        case PIN_OUTPUT: pin_mode(pin, PullNone); break;
-        case PIN_INPUT : pin_mode(pin, PullDown); break;
-    }
-}
-
-void gpio_mode(gpio_t *obj, PinMode mode) {
-    pin_mode(obj->pin, mode);
-}
-
-void gpio_dir(gpio_t *obj, PinDirection direction) {
-    switch (direction) {
-        case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break;
-        case PIN_OUTPUT: *obj->reg_dir |=  obj->mask; break;
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/gpio_irq_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stddef.h>
-#include "gpio_irq_api.h"
-#include "error.h"
-#include "cmsis.h"
-
-#define CHANNEL_NUM    64
-
-static uint32_t channel_ids[CHANNEL_NUM] = {0};
-static gpio_irq_handler irq_handler;
-
-static void handle_interrupt_in(void) {
-    // Read in all current interrupt registers. We do this once as the
-    // GPIO interrupt registers are on the APB bus, and this is slow.
-    uint32_t rise0 = LPC_GPIOINT->IO0IntStatR;
-    uint32_t fall0 = LPC_GPIOINT->IO0IntStatF;
-    uint32_t rise2 = LPC_GPIOINT->IO2IntStatR;
-    uint32_t fall2 = LPC_GPIOINT->IO2IntStatF;
-
-    uint8_t bitloc;
-
-    // Continue as long as there are interrupts pending
-    while(rise0 > 0) {
-        // CLZ returns number of leading zeros, 31 minus that is location of
-        // first pending interrupt
-        bitloc = 31 - __CLZ(rise0);
-        if (channel_ids[bitloc] != 0)
-            irq_handler(channel_ids[bitloc], IRQ_RISE); //Run that interrupt
-
-        // Both clear the interrupt with clear register, and remove it from
-        // our local copy of the interrupt pending register
-        LPC_GPIOINT->IO0IntClr = 1 << bitloc;
-        rise0 -= 1<<bitloc;
-    }
-
-    // Continue as long as there are interrupts pending
-    while(fall0 > 0) {
-        // CLZ returns number of leading zeros, 31 minus that is location of
-        // first pending interrupt
-        bitloc = 31 - __CLZ(fall0);
-        if (channel_ids[bitloc] != 0)
-            irq_handler(channel_ids[bitloc], IRQ_FALL); //Run that interrupt
-
-        // Both clear the interrupt with clear register, and remove it from
-        // our local copy of the interrupt pending register
-        LPC_GPIOINT->IO0IntClr = 1 << bitloc;
-        fall0 -= 1<<bitloc;
-    }
-
-    // Same for port 2
-
-    // Continue as long as there are interrupts pending
-    while(rise2 > 0) {
-        // CLZ returns number of leading zeros, 31 minus that is location of
-        // first pending interrupt
-        bitloc = 31 - __CLZ(rise2);
-        if (channel_ids[bitloc+32] != 0)
-            irq_handler(channel_ids[bitloc+32], IRQ_RISE); //Run that interrupt
-
-        // Both clear the interrupt with clear register, and remove it from
-        // our local copy of the interrupt pending register
-        LPC_GPIOINT->IO2IntClr = 1 << bitloc;
-        rise2 -= 1<<bitloc;
-    }
-
-    // Continue as long as there are interrupts pending
-    while(fall2 > 0) {
-        // CLZ returns number of leading zeros, 31 minus that is location of
-        // first pending interrupt
-        bitloc = 31 - __CLZ(fall2);
-        if (channel_ids[bitloc+32] != 0)
-            irq_handler(channel_ids[bitloc+32], IRQ_FALL); //Run that interrupt
-
-        // Both clear the interrupt with clear register, and remove it from
-        // our local copy of the interrupt pending register
-        LPC_GPIOINT->IO2IntClr = 1 << bitloc;
-        fall2 -= 1<<bitloc;
-    }
-}
-
-int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id) {
-    if (pin == NC) return -1;
-    
-    irq_handler = handler;
-    
-    obj->port = ((int)(LPC_GPIO0_BASE+pin) & ~0x1F);
-    obj->pin = (int)pin % 32;
-    
-    // Interrupts available only on GPIO0 and GPIO2
-    if (obj->port != LPC_GPIO0_BASE && obj->port != LPC_GPIO2_BASE) {
-        error("pins on this port cannot generate interrupts\n");
-    }
-    
-    // put us in the interrupt table
-    int index = (obj->port == LPC_GPIO0_BASE) ? obj->pin : obj->pin + 32;
-    channel_ids[index] = id;
-    obj->ch = index;
-    
-    NVIC_SetVector(GPIO_IRQn, (uint32_t)handle_interrupt_in);
-    NVIC_EnableIRQ(GPIO_IRQn);
-    
-    return 0;
-}
-
-void gpio_irq_free(gpio_irq_t *obj) {
-    channel_ids[obj->ch] = 0;
-}
-
-void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
-    // ensure nothing is pending
-    switch (obj->port) {
-         case LPC_GPIO0_BASE: LPC_GPIOINT->IO0IntClr = 1 << obj->pin; break;
-         case LPC_GPIO2_BASE: LPC_GPIOINT->IO2IntClr = 1 << obj->pin; break;
-    }
-    
-    // enable the pin interrupt
-    if (event == IRQ_RISE) {
-        switch (obj->port) {
-            case LPC_GPIO0_BASE:
-                if (enable) {
-                    LPC_GPIOINT->IO0IntEnR |= 1 << obj->pin;
-                } else {
-                    LPC_GPIOINT->IO0IntEnR &= ~(1 << obj->pin);
-                }
-                break;
-            case LPC_GPIO2_BASE:
-                if (enable) {
-                    LPC_GPIOINT->IO2IntEnR |= 1 << obj->pin;
-                } else {
-                    LPC_GPIOINT->IO2IntEnR &= ~(1 << obj->pin);
-                }
-                break;
-        }
-    } else {
-        switch (obj->port) {
-            case LPC_GPIO0_BASE:
-                if (enable) {
-                    LPC_GPIOINT->IO0IntEnF |= 1 << obj->pin;
-                } else {
-                    LPC_GPIOINT->IO0IntEnF &= ~(1 << obj->pin);
-                }
-                break;
-            case LPC_GPIO2_BASE:
-                if (enable) {
-                    LPC_GPIOINT->IO2IntEnF |= 1 << obj->pin;
-                } else {
-                    LPC_GPIOINT->IO2IntEnF &= ~(1 << obj->pin);
-                }
-                break;
-        }
-    }
-}
-
-void gpio_irq_enable(gpio_irq_t *obj) {
-    NVIC_EnableIRQ(GPIO_IRQn);
-}
-
-void gpio_irq_disable(gpio_irq_t *obj) {
-    NVIC_DisableIRQ(GPIO_IRQn);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/gpio_object.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_GPIO_OBJECT_H
-#define MBED_GPIO_OBJECT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
-    PinName  pin;
-    uint32_t mask;
-
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_set;
-    __IO uint32_t *reg_clr;
-    __I  uint32_t *reg_in;
-} gpio_t;
-
-static inline void gpio_write(gpio_t *obj, int value) {
-    if (value)
-        *obj->reg_set = obj->mask;
-    else
-        *obj->reg_clr = obj->mask;
-}
-
-static inline int gpio_read(gpio_t *obj) {
-    return ((*obj->reg_in & obj->mask) ? 1 : 0);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/i2c_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,418 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "i2c_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_I2C_SDA[] = {
-    {P0_0 , I2C_1, 3},
-    {P0_10, I2C_2, 2},
-    {P0_19, I2C_1, 3},
-    {P0_27, I2C_0, 1},
-    {P1_15, I2C_2, 3},
-    {P1_30, I2C_0, 4},
-    {P2_14, I2C_1, 2},
-    {P2_30, I2C_2, 2},
-    {P4_20, I2C_2, 4},
-    {P5_2,  I2C_0, 5},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_I2C_SCL[] = {
-    {P0_1 , I2C_1, 3},
-    {P0_11, I2C_2, 2},
-    {P0_20, I2C_1, 3},
-    {P0_28, I2C_0, 1},
-    {P1_31, I2C_0, 4},
-    {P2_15, I2C_1, 2},
-    {P2_31, I2C_2, 2},
-    {P4_21, I2C_2, 2},
-    {P4_29, I2C_2, 4},
-    {P5_3,  I2C_0, 5},
-    {NC   , NC,    0}
-};
-
-#define I2C_CONSET(x)       (x->i2c->CONSET)
-#define I2C_CONCLR(x)       (x->i2c->CONCLR)
-#define I2C_STAT(x)         (x->i2c->STAT)
-#define I2C_DAT(x)          (x->i2c->DAT)
-#define I2C_SCLL(x, val)    (x->i2c->SCLL = val)
-#define I2C_SCLH(x, val)    (x->i2c->SCLH = val)
-
-static const uint32_t I2C_addr_offset[2][4] = {
-    {0x0C, 0x20, 0x24, 0x28},
-    {0x30, 0x34, 0x38, 0x3C}
-};
-
-static inline void i2c_conclr(i2c_t *obj, int start, int stop, int interrupt, int acknowledge) {
-    I2C_CONCLR(obj) = (start << 5)
-                    | (stop << 4)
-                    | (interrupt << 3)
-                    | (acknowledge << 2);
-}
-
-static inline void i2c_conset(i2c_t *obj, int start, int stop, int interrupt, int acknowledge) {
-    I2C_CONSET(obj) = (start << 5)
-                    | (stop << 4)
-                    | (interrupt << 3)
-                    | (acknowledge << 2);
-}
-
-// Clear the Serial Interrupt (SI)
-static inline void i2c_clear_SI(i2c_t *obj) {
-    i2c_conclr(obj, 0, 0, 1, 0);
-}
-
-static inline int i2c_status(i2c_t *obj) {
-    return I2C_STAT(obj);
-}
-
-// Wait until the Serial Interrupt (SI) is set
-static int i2c_wait_SI(i2c_t *obj) {
-    int timeout = 0;
-    while (!(I2C_CONSET(obj) & (1 << 3))) {
-        timeout++;
-        if (timeout > 100000) return -1;
-    }
-    return 0;
-}
-
-static inline void i2c_interface_enable(i2c_t *obj) {
-    I2C_CONSET(obj) = 0x40;
-}
-
-static inline void i2c_power_enable(i2c_t *obj) {
-    switch ((int)obj->i2c) {
-        case I2C_0: LPC_SC->PCONP |= 1 << 7; break;
-        case I2C_1: LPC_SC->PCONP |= 1 << 19; break;
-        case I2C_2: LPC_SC->PCONP |= 1 << 26; break;
-    }
-}
-
-void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
-    // determine the SPI to use
-    I2CName i2c_sda = (I2CName)pinmap_peripheral(sda, PinMap_I2C_SDA);
-    I2CName i2c_scl = (I2CName)pinmap_peripheral(scl, PinMap_I2C_SCL);
-    obj->i2c = (LPC_I2C_TypeDef *)pinmap_merge(i2c_sda, i2c_scl);
-    if ((int)obj->i2c == NC) {
-        error("I2C pin mapping failed");
-    }
-    
-    // enable power
-    i2c_power_enable(obj);
-    
-    // set default frequency at 100k
-    i2c_frequency(obj, 100000);
-    i2c_conclr(obj, 1, 1, 1, 1);
-    i2c_interface_enable(obj);
-    
-    pinmap_pinout(sda, PinMap_I2C_SDA);
-    pinmap_pinout(scl, PinMap_I2C_SCL);
-
-    // OpenDrain must explicitly be enabled for p0.0 and p0.1
-    if (sda == P0_0) {
-        pin_mode(sda, OpenDrain);
-    }
-    if (scl == P0_1) {
-        pin_mode(scl, OpenDrain);
-    }
-
-}
-
-inline int i2c_start(i2c_t *obj) {
-    int status = 0;
-    // 8.1 Before master mode can be entered, I2CON must be initialised to:
-    //  - I2EN STA STO SI AA - -
-    //  -  1    0   0   0  x - -
-    // if AA = 0, it can't enter slave mode
-    i2c_conclr(obj, 1, 1, 1, 1);
-    
-    // The master mode may now be entered by setting the STA bit
-    // this will generate a start condition when the bus becomes free
-    i2c_conset(obj, 1, 0, 0, 1);
-    
-    i2c_wait_SI(obj);
-    status = i2c_status(obj);
-    
-    // Clear start bit now transmitted, and interrupt bit
-    i2c_conclr(obj, 1, 0, 0, 0);
-    return status;
-}
-
-inline int i2c_stop(i2c_t *obj) {
-    int timeout = 0;
-
-    // write the stop bit
-    i2c_conset(obj, 0, 1, 0, 0);
-    i2c_clear_SI(obj);
-    
-    // wait for STO bit to reset
-    while(I2C_CONSET(obj) & (1 << 4)) {
-        timeout ++;
-        if (timeout > 100000) return 1;
-    }
-
-    return 0;
-}
-
-
-static inline int i2c_do_write(i2c_t *obj, int value, uint8_t addr) {
-    // write the data
-    I2C_DAT(obj) = value;
-    
-    // clear SI to init a send
-    i2c_clear_SI(obj);
-    
-    // wait and return status
-    i2c_wait_SI(obj);
-    return i2c_status(obj);
-}
-
-static inline int i2c_do_read(i2c_t *obj, int last) {
-    // we are in state 0x40 (SLA+R tx'd) or 0x50 (data rx'd and ack)
-    if(last) {
-        i2c_conclr(obj, 0, 0, 0, 1); // send a NOT ACK
-    } else {
-        i2c_conset(obj, 0, 0, 0, 1); // send a ACK
-    }
-    
-    // accept byte
-    i2c_clear_SI(obj);
-    
-    // wait for it to arrive
-    i2c_wait_SI(obj);
-    
-    // return the data
-    return (I2C_DAT(obj) & 0xFF);
-}
-
-void i2c_frequency(i2c_t *obj, int hz) {
-    uint32_t PCLK = PeripheralClock;
-    uint32_t pulse = PCLK / (hz * 2);
-    
-    // I2C Rate
-    I2C_SCLL(obj, pulse);
-    I2C_SCLH(obj, pulse);
-}
-
-// The I2C does a read or a write as a whole operation
-// There are two types of error conditions it can encounter
-//  1) it can not obtain the bus
-//  2) it gets error responses at part of the transmission
-//
-// We tackle them as follows:
-//  1) we retry until we get the bus. we could have a "timeout" if we can not get it
-//      which basically turns it in to a 2)
-//  2) on error, we use the standard error mechanisms to report/debug
-//
-// Therefore an I2C transaction should always complete. If it doesn't it is usually
-// because something is setup wrong (e.g. wiring), and we don't need to programatically
-// check for that
-int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) {
-    int count, status;
-    
-    status = i2c_start(obj);
-    
-    if ((status != 0x10) && (status != 0x08)) {
-        i2c_stop(obj);
-        return I2C_ERROR_BUS_BUSY;
-    }
-    
-    status = i2c_do_write(obj, (address | 0x01), 1);
-    if (status != 0x40) {
-        i2c_stop(obj);
-        return I2C_ERROR_NO_SLAVE;
-    }
-    
-    // Read in all except last byte
-    for (count = 0; count < (length - 1); count++) {
-        int value = i2c_do_read(obj, 0);
-        status = i2c_status(obj);
-        if (status != 0x50) {
-            i2c_stop(obj);
-            return count;
-        }
-        data[count] = (char) value;
-    }
-    
-    // read in last byte
-    int value = i2c_do_read(obj, 1);
-    status = i2c_status(obj);
-    if (status != 0x58) {
-        i2c_stop(obj);
-        return length - 1;
-    }
-    
-    data[count] = (char) value;
-    
-    // If not repeated start, send stop.
-    if (stop) {
-        i2c_stop(obj);
-    }
-    
-    return length;
-}
-
-int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) {
-    int i, status;
-    
-    status = i2c_start(obj);
-    
-    if ((status != 0x10) && (status != 0x08)) {
-        i2c_stop(obj);
-        return I2C_ERROR_BUS_BUSY;
-    }
-    
-    status = i2c_do_write(obj, (address & 0xFE), 1);
-    if (status != 0x18) {
-        i2c_stop(obj);
-        return I2C_ERROR_NO_SLAVE;
-    }
-    
-    for (i=0; i<length; i++) {
-        status = i2c_do_write(obj, data[i], 0);
-        if (status != 0x28) {
-            i2c_stop(obj);
-            return i;
-        }
-    }
-    
-    // clearing the serial interrupt here might cause an unintended rewrite of the last byte
-    // see also issue report https://mbed.org/users/mbed_official/code/mbed/issues/1
-    // i2c_clear_SI(obj);
-    
-    // If not repeated start, send stop.
-    if (stop) {
-        i2c_stop(obj);
-    }
-    
-    return length;
-}
-
-void i2c_reset(i2c_t *obj) {
-    i2c_stop(obj);
-}
-
-int i2c_byte_read(i2c_t *obj, int last) {
-    return (i2c_do_read(obj, last) & 0xFF);
-}
-
-int i2c_byte_write(i2c_t *obj, int data) {
-    int ack;
-    int status = i2c_do_write(obj, (data & 0xFF), 0);
-    
-    switch(status) {
-        case 0x18: case 0x28:       // Master transmit ACKs
-            ack = 1;
-            break;
-        
-        case 0x40:                  // Master receive address transmitted ACK
-            ack = 1;
-            break;
-        
-        case 0xB8:                  // Slave transmit ACK
-            ack = 1;
-            break;
-        
-        default:
-            ack = 0;
-            break;
-    }
-    
-    return ack;
-}
-
-void i2c_slave_mode(i2c_t *obj, int enable_slave) {
-    if (enable_slave != 0) {
-        i2c_conclr(obj, 1, 1, 1, 0);
-        i2c_conset(obj, 0, 0, 0, 1);
-    } else {
-        i2c_conclr(obj, 1, 1, 1, 1);
-    }
-}
-
-int i2c_slave_receive(i2c_t *obj) {
-    int status;
-    int retval;
-    
-    status = i2c_status(obj);
-    switch(status) {
-        case 0x60: retval = 3; break;
-        case 0x70: retval = 2; break;
-        case 0xA8: retval = 1; break;
-        default  : retval = 0; break;
-    }
-    
-    return(retval);
-}
-
-int i2c_slave_read(i2c_t *obj, char *data, int length) {
-    int count = 0;
-    int status;
-    
-    do {
-        i2c_clear_SI(obj);
-        i2c_wait_SI(obj);
-        status = i2c_status(obj);
-        if((status == 0x80) || (status == 0x90)) {
-            data[count] = I2C_DAT(obj) & 0xFF;
-        }
-        count++;
-    } while (((status == 0x80) || (status == 0x90) ||
-            (status == 0x060) || (status == 0x70)) && (count < length));
-    
-    if(status != 0xA0) {
-        i2c_stop(obj);
-    }
-    
-    i2c_clear_SI(obj);
-    
-    return count;
-}
-
-int i2c_slave_write(i2c_t *obj, const char *data, int length) {
-    int count = 0;
-    int status;
-    
-    if(length <= 0) {
-        return(0);
-    }
-    
-    do {
-        status = i2c_do_write(obj, data[count], 0);
-        count++;
-    } while ((count < length) && (status == 0xB8));
-    
-    if((status != 0xC0) && (status != 0xC8)) {
-        i2c_stop(obj);
-    }
-    
-    i2c_clear_SI(obj);
-    
-    return(count);
-}
-
-void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask) {
-    uint32_t addr;
-    
-    if ((idx >= 0) && (idx <= 3)) {
-        addr = ((uint32_t)obj->i2c) + I2C_addr_offset[0][idx];
-        *((uint32_t *) addr) = address & 0xFF;
-        addr = ((uint32_t)obj->i2c) + I2C_addr_offset[1][idx];
-        *((uint32_t *) addr) = mask & 0xFE;
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/objects.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_OBJECTS_H
-#define MBED_OBJECTS_H
-
-#include "cmsis.h"
-#include "PortNames.h"
-#include "PeripheralNames.h"
-#include "PinNames.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct gpio_irq_s {
-    uint32_t port;
-    uint32_t pin;
-    uint32_t ch;
-};
-
-struct port_s {
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_out;
-    __I  uint32_t *reg_in;
-    PortName port;
-    uint32_t mask;
-};
-
-struct pwmout_s {
-    __IO uint32_t *MR;
-    LPC_PWM_TypeDef *pwm;
-    uint32_t channel;
-};
-
-struct serial_s {
-    LPC_UART_TypeDef *uart;
-    int index;
-};
-
-struct analogin_s {
-    ADCName adc;
-};
-
-struct dac_s {
-    DACName dac;
-};
-
-struct can_s {
-    LPC_CAN_TypeDef *dev;
-    int index;
-};
-
-struct i2c_s {
-    LPC_I2C_TypeDef *i2c;
-};
-
-struct spi_s {
-    LPC_SSP_TypeDef *spi;
-};
-
-#include "gpio_object.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/pinmap.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "pinmap.h"
-#include "error.h"
-
-void pin_function(PinName pin, int function) {
-    if (pin == (PinName)NC) return;
-    
-    __IO uint32_t *reg = (__IO uint32_t*) (LPC_IOCON_BASE + 4 * pin);
-    
-    // pin function bits: [2:0] -> 111 = (0x7)
-    *reg = (*reg & ~0x7) | (function & 0x7);
-}
-
-void pin_mode(PinName pin, PinMode mode) {
-    if (pin == (PinName)NC) { return; }
-    
-    uint32_t drain = ((uint32_t) mode & (uint32_t) OpenDrain) >> 2;
-    
-    __IO uint32_t *reg = (__IO uint32_t*) (LPC_IOCON_BASE + 4 * pin);
-    uint32_t tmp = *reg;
-    
-    // pin mode bits: [4:3] -> 11000 = (0x3 << 3)
-    tmp &= ~(0x3 << 3);
-    tmp |= (mode & 0x3) << 3;
-    
-    // drain
-    tmp &= ~(0x1 << 10);
-    tmp |= drain << 10;
-    
-    *reg = tmp;
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/port_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "port_api.h"
-#include "pinmap.h"
-#include "gpio_api.h"
-
-
-PinName port_pin(PortName port, int pin_n) {
-    return (PinName)(((port << PORT_SHIFT) | pin_n));
-}
-
-void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
-    obj->port = port;
-    obj->mask = mask;
-    
-    LPC_GPIO_TypeDef *port_reg = (LPC_GPIO_TypeDef *)(LPC_GPIO0_BASE + ((int)port * 0x20));
-    
-    port_reg->MASK = ~mask;
-    
-    obj->reg_out = &port_reg->PIN;
-    obj->reg_in  = &port_reg->PIN;
-    obj->reg_dir  = &port_reg->DIR;
-    
-    uint32_t i;
-    // The function is set per pin: reuse gpio logic
-    for (i=0; i<32; i++) {
-        if (obj->mask & (1<<i)) {
-            gpio_set(port_pin(obj->port, i));
-        }
-    }
-    
-    port_dir(obj, dir);
-}
-
-void port_mode(port_t *obj, PinMode mode) {
-    uint32_t i;
-    // The mode is set per pin: reuse pinmap logic
-    for (i=0; i<32; i++) {
-        if (obj->mask & (1<<i)) {
-            pin_mode(port_pin(obj->port, i), mode);
-        }
-    }
-}
-
-void port_dir(port_t *obj, PinDirection dir) {
-    switch (dir) {
-        case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break;
-        case PIN_OUTPUT: *obj->reg_dir |=  obj->mask; break;
-    }
-}
-
-void port_write(port_t *obj, int value) {
-    *obj->reg_out = (*obj->reg_in & ~obj->mask) | (value & obj->mask);
-}
-
-int port_read(port_t *obj) {
-    return (*obj->reg_in & obj->mask);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/pwmout_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,190 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "pwmout_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-#define TCR_CNT_EN       0x00000001
-#define TCR_RESET        0x00000002
-
-//  PORT ID, PWM ID, Pin function
-static const PinMap PinMap_PWM[] = {
-    {P1_2,  PWM0_1, 3},
-    {P1_3,  PWM0_2, 3},
-    {P1_5,  PWM0_3, 3},
-    {P1_6,  PWM0_4, 3},
-    {P1_7,  PWM0_5, 3},
-    {P1_11, PWM0_6, 3},
-    {P1_18, PWM1_1, 2},
-    {P1_20, PWM1_2, 2},
-    {P1_21, PWM1_3, 2},
-    {P1_23, PWM1_4, 2},
-    {P1_24, PWM1_5, 2},
-    {P1_26, PWM1_6, 2},
-    {P2_0,  PWM1_1, 1},
-    {P2_1,  PWM1_2, 1},
-    {P2_2,  PWM1_3, 1},
-    {P2_3,  PWM1_4, 1},
-    {P2_4,  PWM1_5, 1},
-    {P2_5,  PWM1_6, 1},
-    {P3_16, PWM0_1, 2},
-    {P3_17, PWM0_2, 2},
-    {P3_18, PWM0_3, 2},
-    {P3_19, PWM0_4, 2},
-    {P3_20, PWM0_5, 2},
-    {P3_21, PWM0_6, 2},
-    {P3_24, PWM1_1, 2},
-    {P3_25, PWM1_2, 2},
-    {P3_26, PWM1_3, 2},
-    {P3_27, PWM1_4, 2},
-    {P3_28, PWM1_5, 2},
-    {P3_29, PWM1_6, 2},
-    {NC, NC, 0}
-};
-
-static const uint32_t PWM_mr_offset[7] = {
-    0x18, 0x1C, 0x20, 0x24, 0x40, 0x44, 0x48
-};
-
-#define TCR_PWM_EN       0x00000008
-static unsigned int pwm_clock_mhz;
-
-void pwmout_init(pwmout_t* obj, PinName pin) {
-    // determine the channel
-    PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM);
-    if (pwm == (PWMName)NC)
-        error("PwmOut pin mapping failed");
-    
-    obj->channel = pwm;
-    obj->pwm = LPC_PWM0;
-    
-    if (obj->channel > 6) { // PWM1 is used if pwm > 6
-      obj->channel -= 6;
-      obj->pwm = LPC_PWM1;
-    }
-    
-    obj->MR = (__IO uint32_t *)((uint32_t)obj->pwm + PWM_mr_offset[obj->channel]);
-    
-    // ensure the power is on
-    if (obj->pwm == LPC_PWM0) {
-        LPC_SC->PCONP |= 1 << 5;
-    } else {
-        LPC_SC->PCONP |= 1 << 6;
-    }
-    
-    obj->pwm->PR = 0;                     // no pre-scale
-    
-    // ensure single PWM mode
-    obj->pwm->MCR = 1 << 1; // reset TC on match 0
-    
-    // enable the specific PWM output
-    obj->pwm->PCR |= 1 << (8 + obj->channel);
-    
-    pwm_clock_mhz = PeripheralClock / 1000000;
-    
-    // default to 20ms: standard for servos, and fine for e.g. brightness control
-    pwmout_period_ms(obj, 20);
-    pwmout_write    (obj, 0);
-    
-    // Wire pinout
-    pinmap_pinout(pin, PinMap_PWM);
-}
-
-void pwmout_free(pwmout_t* obj) {
-    // [TODO]
-}
-
-void pwmout_write(pwmout_t* obj, float value) {
-    if (value < 0.0f) {
-        value = 0.0;
-    } else if (value > 1.0f) {
-        value = 1.0;
-    }
-    
-    // set channel match to percentage
-    uint32_t v = (uint32_t)((float)(obj->pwm->MR0) * value);
-    
-    // workaround for PWM1[1] - Never make it equal MR0, else we get 1 cycle dropout
-    if (v == obj->pwm->MR0) {
-        v++;
-    }
-    
-    *obj->MR = v;
-    
-    // accept on next period start
-    obj->pwm->LER |= 1 << obj->channel;
-}
-
-float pwmout_read(pwmout_t* obj) {
-    float v = (float)(*obj->MR) / (float)(obj->pwm->MR0);
-    return (v > 1.0f) ? (1.0f) : (v);
-}
-
-void pwmout_period(pwmout_t* obj, float seconds) {
-    pwmout_period_us(obj, seconds * 1000000.0f);
-}
-
-void pwmout_period_ms(pwmout_t* obj, int ms) {
-    pwmout_period_us(obj, ms * 1000);
-}
-
-// Set the PWM period, keeping the duty cycle the same.
-void pwmout_period_us(pwmout_t* obj, int us) {
-    // calculate number of ticks
-    uint32_t ticks = pwm_clock_mhz * us;
-    
-    // set reset
-    obj->pwm->TCR = TCR_RESET;
-    
-    // set the global match register
-    obj->pwm->MR0 = ticks;
-    
-    // Scale the pulse width to preserve the duty ratio
-    if (obj->pwm->MR0 > 0) {
-        *obj->MR = (*obj->MR * ticks) / obj->pwm->MR0;
-    }
-    
-    // set the channel latch to update value at next period start
-    obj->pwm->LER |= 1 << 0;
-    
-    // enable counter and pwm, clear reset
-    obj->pwm->TCR = TCR_CNT_EN | TCR_PWM_EN;
-}
-
-void pwmout_pulsewidth(pwmout_t* obj, float seconds) {
-    pwmout_pulsewidth_us(obj, seconds * 1000000.0f);
-}
-
-void pwmout_pulsewidth_ms(pwmout_t* obj, int ms) {
-    pwmout_pulsewidth_us(obj, ms * 1000);
-}
-
-void pwmout_pulsewidth_us(pwmout_t* obj, int us) {
-    // calculate number of ticks
-    uint32_t v = pwm_clock_mhz * us;
-    
-    // workaround for PWM1[1] - Never make it equal MR0, else we get 1 cycle dropout
-    if (v == obj->pwm->MR0) {
-        v++;
-    }
-    
-    // set the match register value
-    *obj->MR = v;
-    
-    // set the channel latch to update value at next period start
-    obj->pwm->LER |= 1 << obj->channel;
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/rtc_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "rtc_api.h"
-
-// ensure rtc is running (unchanged if already running)
-
-/* Setup the RTC based on a time structure, ensuring RTC is enabled
- *
- * Can be clocked by a 32.768KHz oscillator or prescale divider based on the APB clock
- * - We want to use the 32khz clock, allowing for sleep mode
- *
- * Most registers are not changed by a Reset
- * - We must initialize these registers between power-on and setting the RTC into operation
-
- * Clock Control Register
- *  RTC_CCR[0] : Enable - 0 = Disabled, 1 = Enabled
- *  RTC_CCR[1] : Reset - 0 = Normal, 1 = Reset
- *  RTC_CCR[4] : Clock Source - 0 = Prescaler, 1 = 32k Xtal
- *
- * The RTC may already be running, so we should set it up
- * without impacting if it is the case
- */
-void rtc_init(void) {
-    LPC_SC->PCONP |= 0x200; // Ensure power is on
-    LPC_RTC->CCR = 0x00;
-    
-// clock source on 2368 is special test mode on 1768!
-    LPC_RTC->CCR |= 1 << 0; // Ensure the RTC is enabled
-}
-
-void rtc_free(void) {
-    // [TODO]
-}
-
-/*
- * Little check routine to see if the RTC has been enabled
- *
- * Clock Control Register
- *  RTC_CCR[0] : 0 = Disabled, 1 = Enabled
- *
- */
-int rtc_isenabled(void) {
-    return(((LPC_RTC->CCR) & 0x01) != 0);
-}
-
-/*
- * RTC Registers
- *  RTC_SEC        Seconds 0-59
- *  RTC_MIN        Minutes 0-59
- *  RTC_HOUR    Hour 0-23
- *  RTC_DOM        Day of Month 1-28..31
- *  RTC_DOW        Day of Week 0-6
- *  RTC_DOY        Day of Year 1-365
- *  RTC_MONTH    Month 1-12
- *  RTC_YEAR    Year 0-4095
- *
- * struct tm
- *  tm_sec        seconds after the minute 0-61
- *  tm_min        minutes after the hour 0-59
- *  tm_hour        hours since midnight 0-23
- *  tm_mday        day of the month 1-31
- *  tm_mon        months since January 0-11
- *  tm_year        years since 1900
- *  tm_wday        days since Sunday 0-6
- *  tm_yday        days since January 1 0-365
- *  tm_isdst    Daylight Saving Time flag
- */
-time_t rtc_read(void) {
-    // Setup a tm structure based on the RTC
-    struct tm timeinfo;
-    timeinfo.tm_sec = LPC_RTC->SEC;
-    timeinfo.tm_min = LPC_RTC->MIN;
-    timeinfo.tm_hour = LPC_RTC->HOUR;
-    timeinfo.tm_mday = LPC_RTC->DOM;
-    timeinfo.tm_mon = LPC_RTC->MONTH - 1;
-    timeinfo.tm_year = LPC_RTC->YEAR - 1900;
-    
-    // Convert to timestamp
-    time_t t = mktime(&timeinfo);
-    
-    return t;
-}
-
-void rtc_write(time_t t) {
-    // Convert the time in to a tm
-    struct tm *timeinfo = localtime(&t);
-    
-    // Pause clock, and clear counter register (clears us count)
-    LPC_RTC->CCR |= 2;
-    
-    // Set the RTC
-    LPC_RTC->SEC = timeinfo->tm_sec;
-    LPC_RTC->MIN = timeinfo->tm_min;
-    LPC_RTC->HOUR = timeinfo->tm_hour;
-    LPC_RTC->DOM = timeinfo->tm_mday;
-    LPC_RTC->MONTH = timeinfo->tm_mon + 1;
-    LPC_RTC->YEAR = timeinfo->tm_year + 1900;
-    
-    // Restart clock
-    LPC_RTC->CCR &= ~((uint32_t)2);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/serial_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,307 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// math.h required for floating point operations for baud rate calculation
-#include <math.h>
-#include <string.h>
-
-#include "serial_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-/******************************************************************************
- * INITIALIZATION
- ******************************************************************************/
-static const PinMap PinMap_UART_TX[] = {
-    {P0_0,  UART_3, 2},
-    {P0_2,  UART_0, 1},
-    {P0_10, UART_2, 1},
-    {P0_15, UART_1, 1},
-    {P1_29, UART_4, 5},
-    {P0_25, UART_3, 3},
-    {P2_0 , UART_1, 2},
-    {P2_8 , UART_2, 2},
-    {P3_16, UART_1, 3},
-    {P4_22, UART_2, 2},
-    {P4_28, UART_3, 2},
-    {P5_4,  UART_4, 4},
-    {NC   , NC    , 0}
-};
-
-static const PinMap PinMap_UART_RX[] = {
-    {P0_1 , UART_3, 2},
-    {P0_3 , UART_0, 1},
-    {P0_11, UART_2, 1},
-    {P0_16, UART_1, 1},
-    {P0_26, UART_3, 3},
-    {P2_1 , UART_1, 2},
-    {P2_9 , UART_2, 2},
-    {P3_17, UART_1, 3},
-    {P4_23, UART_2, 2},
-    {P4_29, UART_3, 2},
-    {P5_3,  UART_4, 4},
-    {NC   , NC    , 0}
-};
-
-#define UART_NUM    5
-
-static uint32_t serial_irq_ids[UART_NUM] = {0};
-static uart_irq_handler irq_handler;
-
-int stdio_uart_inited = 0;
-serial_t stdio_uart;
-
-void serial_init(serial_t *obj, PinName tx, PinName rx) {
-    int is_stdio_uart = 0;
-    
-    // determine the UART to use
-    UARTName uart_tx = (UARTName)pinmap_peripheral(tx, PinMap_UART_TX);
-    UARTName uart_rx = (UARTName)pinmap_peripheral(rx, PinMap_UART_RX);
-    UARTName uart = (UARTName)pinmap_merge(uart_tx, uart_rx);
-    if ((int)uart == NC) {
-        error("Serial pinout mapping failed");
-    }
-    
-    obj->uart = (LPC_UART_TypeDef *)uart;
-    // enable power
-    switch (uart) {
-        case UART_0: LPC_SC->PCONP |= 1 <<  3; break;
-        case UART_1: LPC_SC->PCONP |= 1 <<  4; break;
-        case UART_2: LPC_SC->PCONP |= 1 << 24; break;
-        case UART_3: LPC_SC->PCONP |= 1 << 25; break;
-        case UART_4: LPC_SC->PCONP |= 1 <<  8; break;
-    }
-    
-    // enable fifos and default rx trigger level
-    obj->uart->FCR = 1 << 0  // FIFO Enable - 0 = Disables, 1 = Enabled
-                   | 0 << 1  // Rx Fifo Reset
-                   | 0 << 2  // Tx Fifo Reset
-                   | 0 << 6; // Rx irq trigger level - 0 = 1 char, 1 = 4 chars, 2 = 8 chars, 3 = 14 chars
-
-    // disable irqs
-    obj->uart->IER = 0 << 0  // Rx Data available irq enable
-                   | 0 << 1  // Tx Fifo empty irq enable
-                   | 0 << 2; // Rx Line Status irq enable
-    
-    // set default baud rate and format
-    serial_baud  (obj, 9600);
-    serial_format(obj, 8, ParityNone, 1);
-    
-    // pinout the chosen uart
-    pinmap_pinout(tx, PinMap_UART_TX);
-    pinmap_pinout(rx, PinMap_UART_RX);
-    
-    // set rx/tx pins in PullUp mode
-    pin_mode(tx, PullUp);
-    pin_mode(rx, PullUp);
-    
-    switch (uart) {
-        case UART_0: obj->index = 0; break;
-        case UART_1: obj->index = 1; break;
-        case UART_2: obj->index = 2; break;
-        case UART_3: obj->index = 3; break;
-        case UART_4: obj->index = 4; break;
-    }
-    
-    is_stdio_uart = (uart == STDIO_UART) ? (1) : (0);
-    
-    if (is_stdio_uart) {
-        stdio_uart_inited = 1;
-        memcpy(&stdio_uart, obj, sizeof(serial_t));
-    }
-}
-
-void serial_free(serial_t *obj) {
-    serial_irq_ids[obj->index] = 0;
-}
-
-// serial_baud
-// set the baud rate, taking in to account the current SystemFrequency
-void serial_baud(serial_t *obj, int baudrate) {
-    uint32_t PCLK = PeripheralClock;
-    
-    // First we check to see if the basic divide with no DivAddVal/MulVal
-    // ratio gives us an integer result. If it does, we set DivAddVal = 0,
-    // MulVal = 1. Otherwise, we search the valid ratio value range to find
-    // the closest match. This could be more elegant, using search methods
-    // and/or lookup tables, but the brute force method is not that much
-    // slower, and is more maintainable.
-    uint16_t DL = PCLK / (16 * baudrate);
-
-    uint8_t DivAddVal = 0;
-    uint8_t MulVal = 1;
-    int hit = 0;
-    uint16_t dlv;
-    uint8_t mv, dav;
-    if ((PCLK % (16 * baudrate)) != 0) {     // Checking for zero remainder
-        float err_best = (float) baudrate;
-        uint16_t dlmax = DL;
-        for ( dlv = (dlmax/2); (dlv <= dlmax) && !hit; dlv++) {
-            for ( mv = 1; mv <= 15; mv++) {
-                for ( dav = 1; dav < mv; dav++) {
-                    float ratio = 1.0f + ((float) dav / (float) mv);
-                    float calcbaud = (float)PCLK / (16.0f * (float) dlv * ratio);
-                    float err = fabs(((float) baudrate - calcbaud) / (float) baudrate);
-                    if (err < err_best) {
-                        DL = dlv;
-                        DivAddVal = dav;
-                        MulVal = mv;
-                        err_best = err;
-                        if (err < 0.001f) {
-                            hit = 1;
-                        }
-                    }
-                }
-            }
-        }
-    }
-    
-    // set LCR[DLAB] to enable writing to divider registers
-    obj->uart->LCR |= (1 << 7);
-    
-    // set divider values
-    obj->uart->DLM = (DL >> 8) & 0xFF;
-    obj->uart->DLL = (DL >> 0) & 0xFF;
-    obj->uart->FDR = (uint32_t) DivAddVal << 0
-                   | (uint32_t) MulVal    << 4;
-    
-    // clear LCR[DLAB]
-    obj->uart->LCR &= ~(1 << 7);
-}
-
-void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits) {
-    // 0: 1 stop bits, 1: 2 stop bits
-    if (stop_bits != 1 && stop_bits != 2) {
-        error("Invalid stop bits specified");
-    }
-    stop_bits -= 1;
-    
-    // 0: 5 data bits ... 3: 8 data bits
-    if (data_bits < 5 || data_bits > 8) {
-        error("Invalid number of bits (%d) in serial format, should be 5..8", data_bits);
-    }
-    data_bits -= 5;
-
-    int parity_enable, parity_select;
-    switch (parity) {
-        case ParityNone: parity_enable = 0; parity_select = 0; break;
-        case ParityOdd : parity_enable = 1; parity_select = 0; break;
-        case ParityEven: parity_enable = 1; parity_select = 1; break;
-        case ParityForced1: parity_enable = 1; parity_select = 2; break;
-        case ParityForced0: parity_enable = 1; parity_select = 3; break;
-        default:
-            error("Invalid serial parity setting");
-            return;
-    }
-    
-    obj->uart->LCR = data_bits            << 0
-                   | stop_bits            << 2
-                   | parity_enable        << 3
-                   | parity_select        << 4;
-}
-
-/******************************************************************************
- * INTERRUPTS HANDLING
- ******************************************************************************/
-static inline void uart_irq(uint32_t iir, uint32_t index) {
-    // [Chapter 14] LPC17xx UART0/2/3: UARTn Interrupt Handling
-    SerialIrq irq_type;
-    switch (iir) {
-        case 1: irq_type = TxIrq; break;
-        case 2: irq_type = RxIrq; break;
-        default: return;
-    }
-    
-    if (serial_irq_ids[index] != 0)
-        irq_handler(serial_irq_ids[index], irq_type);
-}
-
-void uart0_irq() {uart_irq((LPC_UART0->IIR >> 1) & 0x7, 0);}
-void uart1_irq() {uart_irq((LPC_UART1->IIR >> 1) & 0x7, 1);}
-void uart2_irq() {uart_irq((LPC_UART2->IIR >> 1) & 0x7, 2);}
-void uart3_irq() {uart_irq((LPC_UART3->IIR >> 1) & 0x7, 3);}
-void uart4_irq() {uart_irq((LPC_UART4->IIR >> 1) & 0x7, 4);}
-
-void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id) {
-    irq_handler = handler;
-    serial_irq_ids[obj->index] = id;
-}
-
-void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) {
-    IRQn_Type irq_n = (IRQn_Type)0;
-    uint32_t vector = 0;
-    switch ((int)obj->uart) {
-        case UART_0: irq_n=UART0_IRQn; vector = (uint32_t)&uart0_irq; break;
-        case UART_1: irq_n=UART1_IRQn; vector = (uint32_t)&uart1_irq; break;
-        case UART_2: irq_n=UART2_IRQn; vector = (uint32_t)&uart2_irq; break;
-        case UART_3: irq_n=UART3_IRQn; vector = (uint32_t)&uart3_irq; break;
-        case UART_4: irq_n=UART4_IRQn; vector = (uint32_t)&uart4_irq; break;
-    }
-    
-    if (enable) {
-        obj->uart->IER |= 1 << irq;
-        NVIC_SetVector(irq_n, vector);
-        NVIC_EnableIRQ(irq_n);
-    } else { // disable
-        int all_disabled = 0;
-        SerialIrq other_irq = (irq == RxIrq) ? (TxIrq) : (RxIrq);
-        obj->uart->IER &= ~(1 << irq);
-        all_disabled = (obj->uart->IER & (1 << other_irq)) == 0;
-        if (all_disabled)
-            NVIC_DisableIRQ(irq_n);
-    }
-}
-
-/******************************************************************************
- * READ/WRITE
- ******************************************************************************/
-int serial_getc(serial_t *obj) {
-    while (!serial_readable(obj));
-    return obj->uart->RBR;
-}
-
-void serial_putc(serial_t *obj, int c) {
-    while (!serial_writable(obj));
-    obj->uart->THR = c;
-}
-
-int serial_readable(serial_t *obj) {
-    return obj->uart->LSR & 0x01;
-}
-
-int serial_writable(serial_t *obj) {
-    return obj->uart->LSR & 0x20;
-}
-
-void serial_clear(serial_t *obj) {
-    obj->uart->FCR = 1 << 0  // FIFO Enable - 0 = Disables, 1 = Enabled
-            | 1 << 1  // rx FIFO reset
-            | 1 << 2  // tx FIFO reset
-            | 0 << 6; // interrupt depth
-}
-
-void serial_pinout_tx(PinName tx) {
-    pinmap_pinout(tx, PinMap_UART_TX);
-}
-
-void serial_break_set(serial_t *obj) {
-    obj->uart->LCR |= (1 << 6);
-}
-
-void serial_break_clear(serial_t *obj) {
-    obj->uart->LCR &= ~(1 << 6);
-}
-
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/sleep.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "sleep_api.h"
-#include "cmsis.h"
-#include "mbed_interface.h"
-
-void sleep(void) {
-    LPC_SC->PCON = 0x0;
-    
-    // SRC[SLEEPDEEP] set to 0 = sleep
-    SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk;
-    
-    // wait for interrupt
-    __WFI();
-}
-
-/*
-* The mbed lpc1768 does not support the deepsleep mode
-* as a debugger is connected to it (the mbed interface).
-*
-* As mentionned in an application note from NXP:
-*
-*       http://www.po-star.com/public/uploads/20120319123122_141.pdf
-*
-*       {{{
-*       The user should be aware of certain limitations during debugging.
-*       The most important is that, due to limitations of the Cortex-M3
-*       integration, the LPC17xx cannot wake up in the usual manner from
-*       Deep Sleep and Power-down modes. It is recommended not to use these
-*       modes during debug. Once an application is downloaded via JTAG/SWD
-*       interface, the USB to SWD/JTAG debug adapter (Keil ULINK2 for example)
-*       should be removed from the target board, and thereafter, power cycle
-*       the LPC17xx to allow wake-up from deep sleep and power-down modes
-*       }}}
-*
-*       As the interface firmware does not reset the target when a
-*       mbed_interface_disconnect() semihosting call is made, the
-*       core cannot wake-up from deepsleep.
-*
-*       We treat a deepsleep() as a normal sleep().
-*/
-void deepsleep(void) {
-    sleep();
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/spi_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,231 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <math.h>
-
-#include "spi_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_SPI_SCLK[] = {
-    {P0_7 , SPI_1, 2},
-    {P0_15, SPI_0, 2},
-    {P1_0,  SPI_2, 4},
-    {P1_19, SPI_1, 5},
-    {P1_20, SPI_0, 5},
-    {P1_31, SPI_1, 2},
-    {P2_22, SPI_0, 2},
-    {P4_20, SPI_1, 3},
-    {P5_2,  SPI_2, 2},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_MOSI[] = {
-    {P0_9 , SPI_1, 2},
-    {P0_13, SPI_1, 2},
-    {P0_18, SPI_0, 2},
-    {P1_1,  SPI_2, 4},
-    {P1_22, SPI_1, 5},
-    {P1_24, SPI_0, 5},
-    {P2_27, SPI_0, 2},
-    {P4_23, SPI_1, 3},
-    {P5_0,  SPI_2, 2},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_MISO[] = {
-    {P0_8 , SPI_1, 2},
-    {P0_12, SPI_1, 2},
-    {P0_17, SPI_0, 2},
-    {P1_4,  SPI_2, 4},
-    {P1_18, SPI_1, 5},
-    {P1_23, SPI_0, 5},
-    {P2_26, SPI_0, 2},
-    {P4_22, SPI_1, 3},
-    {P5_1,  SPI_2, 2},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_SSEL[] = {
-    {P0_6 , SPI_1, 2},
-    {P0_14, SPI_1, 2},
-    {P0_16, SPI_0, 2},
-    {P1_8,  SPI_2, 4},
-    {P1_21, SPI_0, 3},
-    {P1_26, SPI_1, 5},
-    {P1_28, SPI_0, 5},
-    {P2_23, SPI_0, 2},
-    {P4_21, SPI_1, 3},
-    {NC   , NC   , 0}
-};
-
-static inline int ssp_disable(spi_t *obj);
-static inline int ssp_enable(spi_t *obj);
-
-void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel) {
-    // determine the SPI to use
-    SPIName spi_mosi = (SPIName)pinmap_peripheral(mosi, PinMap_SPI_MOSI);
-    SPIName spi_miso = (SPIName)pinmap_peripheral(miso, PinMap_SPI_MISO);
-    SPIName spi_sclk = (SPIName)pinmap_peripheral(sclk, PinMap_SPI_SCLK);
-    SPIName spi_ssel = (SPIName)pinmap_peripheral(ssel, PinMap_SPI_SSEL);
-    SPIName spi_data = (SPIName)pinmap_merge(spi_mosi, spi_miso);
-    SPIName spi_cntl = (SPIName)pinmap_merge(spi_sclk, spi_ssel);
-    obj->spi = (LPC_SSP_TypeDef*)pinmap_merge(spi_data, spi_cntl);
-    if ((int)obj->spi == NC) {
-        error("SPI pinout mapping failed");
-    }
-    
-    // enable power and clocking
-    switch ((int)obj->spi) {
-        case SPI_0: LPC_SC->PCONP |= 1 << 21; break;
-        case SPI_1: LPC_SC->PCONP |= 1 << 10; break;
-        case SPI_2: LPC_SC->PCONP |= 1 << 20; break;
-    }
-    
-    // set default format and frequency
-    if (ssel == NC) {
-        spi_format(obj, 8, 0, 0);  // 8 bits, mode 0, master
-    } else {
-        spi_format(obj, 8, 0, 1);  // 8 bits, mode 0, slave
-    }
-    spi_frequency(obj, 1000000);
-    
-    // enable the ssp channel
-    ssp_enable(obj);
-    
-    // pin out the spi pins
-    pinmap_pinout(mosi, PinMap_SPI_MOSI);
-    pinmap_pinout(miso, PinMap_SPI_MISO);
-    pinmap_pinout(sclk, PinMap_SPI_SCLK);
-    if (ssel != NC) {
-        pinmap_pinout(ssel, PinMap_SPI_SSEL);
-    }
-}
-
-void spi_free(spi_t *obj) {}
-
-void spi_format(spi_t *obj, int bits, int mode, int slave) {
-    ssp_disable(obj);
-    
-    if (!(bits >= 4 && bits <= 16) || !(mode >= 0 && mode <= 3)) {
-        error("SPI format error");
-    }
-    
-    int polarity = (mode & 0x2) ? 1 : 0;
-    int phase = (mode & 0x1) ? 1 : 0;
-    
-    // set it up
-    int DSS = bits - 1;            // DSS (data select size)
-    int SPO = (polarity) ? 1 : 0;  // SPO - clock out polarity
-    int SPH = (phase) ? 1 : 0;     // SPH - clock out phase
-    
-    int FRF = 0;                   // FRF (frame format) = SPI
-    uint32_t tmp = obj->spi->CR0;
-    tmp &= ~(0xFFFF);
-    tmp |= DSS << 0
-        | FRF << 4
-        | SPO << 6
-        | SPH << 7;
-    obj->spi->CR0 = tmp;
-    
-    tmp = obj->spi->CR1;
-    tmp &= ~(0xD);
-    tmp |= 0 << 0                   // LBM - loop back mode - off
-        | ((slave) ? 1 : 0) << 2   // MS - master slave mode, 1 = slave
-        | 0 << 3;                  // SOD - slave output disable - na
-    obj->spi->CR1 = tmp;
-    ssp_enable(obj);
-}
-
-void spi_frequency(spi_t *obj, int hz) {
-    ssp_disable(obj);
-    
-    uint32_t PCLK = PeripheralClock;
-    
-    int prescaler;
-    
-    for (prescaler = 2; prescaler <= 254; prescaler += 2) {
-        int prescale_hz = PCLK / prescaler;
-        
-        // calculate the divider
-        int divider = floor(((float)prescale_hz / (float)hz) + 0.5f);
-        
-        // check we can support the divider
-        if (divider < 256) {
-            // prescaler
-            obj->spi->CPSR = prescaler;
-            
-            // divider
-            obj->spi->CR0 &= ~(0xFFFF << 8);
-            obj->spi->CR0 |= (divider - 1) << 8;
-            ssp_enable(obj);
-            return;
-        }
-    }
-    error("Couldn't setup requested SPI frequency");
-}
-
-static inline int ssp_disable(spi_t *obj) {
-    return obj->spi->CR1 &= ~(1 << 1);
-}
-
-static inline int ssp_enable(spi_t *obj) {
-    return obj->spi->CR1 |= (1 << 1);
-}
-
-static inline int ssp_readable(spi_t *obj) {
-    return obj->spi->SR & (1 << 2);
-}
-
-static inline int ssp_writeable(spi_t *obj) {
-    return obj->spi->SR & (1 << 1);
-}
-
-static inline void ssp_write(spi_t *obj, int value) {
-    while (!ssp_writeable(obj));
-    obj->spi->DR = value;
-}
-
-static inline int ssp_read(spi_t *obj) {
-    while (!ssp_readable(obj));
-    return obj->spi->DR;
-}
-
-static inline int ssp_busy(spi_t *obj) {
-    return (obj->spi->SR & (1 << 4)) ? (1) : (0);
-}
-
-int spi_master_write(spi_t *obj, int value) {
-    ssp_write(obj, value);
-    return ssp_read(obj);
-}
-
-int spi_slave_receive(spi_t *obj) {
-    return (ssp_readable(obj) && !ssp_busy(obj)) ? (1) : (0);
-};
-
-int spi_slave_read(spi_t *obj) {
-    return obj->spi->DR;
-}
-
-void spi_slave_write(spi_t *obj, int value) {
-    while (ssp_writeable(obj) == 0) ;
-    obj->spi->DR = value;
-}
-
-int spi_busy(spi_t *obj) {
-    return ssp_busy(obj);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC408X/us_ticker.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stddef.h>
-#include "us_ticker_api.h"
-#include "PeripheralNames.h"
-
-#define US_TICKER_TIMER      ((LPC_TIM_TypeDef *)LPC_TIM3_BASE)
-#define US_TICKER_TIMER_IRQn TIMER3_IRQn
-
-int us_ticker_inited = 0;
-
-void us_ticker_init(void) {
-    if (us_ticker_inited) return;
-    us_ticker_inited = 1;
-    
-    LPC_SC->PCONP |= 1 << 23; // Clock TIMER_3
-    
-    US_TICKER_TIMER->CTCR = 0x0; // timer mode
-    uint32_t PCLK = PeripheralClock;
-    
-    US_TICKER_TIMER->TCR = 0x2;  // reset
-    
-    uint32_t prescale = PCLK / 1000000; // default to 1MHz (1 us ticks)
-    US_TICKER_TIMER->PR = prescale - 1;
-    US_TICKER_TIMER->TCR = 1; // enable = 1, reset = 0
-    
-    NVIC_SetVector(US_TICKER_TIMER_IRQn, (uint32_t)us_ticker_irq_handler);
-    NVIC_EnableIRQ(US_TICKER_TIMER_IRQn);
-}
-
-uint32_t us_ticker_read() {
-    if (!us_ticker_inited)
-        us_ticker_init();
-    
-    return US_TICKER_TIMER->TC;
-}
-
-void us_ticker_set_interrupt(unsigned int timestamp) {
-    // set match value
-    US_TICKER_TIMER->MR0 = timestamp;
-    // enable match interrupt
-    US_TICKER_TIMER->MCR |= 1;
-}
-
-void us_ticker_disable_interrupt(void) {
-    US_TICKER_TIMER->MCR &= ~1;
-}
-
-void us_ticker_clear_interrupt(void) {
-    US_TICKER_TIMER->IR = 1;
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC43XX/PeripheralNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    UART_0 = (int)LPC_USART0_BASE,
-    UART_1 = (int)LPC_UART1_BASE,
-    UART_2 = (int)LPC_USART2_BASE,
-    UART_3 = (int)LPC_USART3_BASE
-} UARTName;
-
-typedef enum {
-    ADC0_0 = 0,
-    ADC0_1,
-    ADC0_2,
-    ADC0_3,
-    ADC0_4,
-    ADC0_5,
-    ADC0_6,
-    ADC0_7,
-    ADC1_0,
-    ADC1_1,
-    ADC1_2,
-    ADC1_3,
-    ADC1_4,
-    ADC1_5,
-    ADC1_6,
-    ADC1_7
-} ADCName;
-
-typedef enum {
-    DAC_0 = 0
-} DACName;
-
-typedef enum {
-    SPI_0 = (int)LPC_SSP0_BASE,
-    SPI_1 = (int)LPC_SSP1_BASE
-} SPIName;
-
-typedef enum {
-    I2C_0 = (int)LPC_I2C0_BASE,
-    I2C_1 = (int)LPC_I2C1_BASE
-} I2CName;
-
-typedef enum {
-    PWM0_1 = 1,
-    PWM0_2,
-    PWM0_3,
-    PWM1_1,
-    PWM1_2,
-    PWM1_3,
-    PWM2_1,
-    PWM2_2,
-    PWM2_3
-} PWMName;
-
-typedef enum {
-     CAN_0 = (int)LPC_C_CAN0_BASE,
-     CAN_1 = (int)LPC_C_CAN1_BASE
-} CANName;
-
-#define STDIO_UART_TX     UART0_TX
-#define STDIO_UART_RX     UART0_RX
-#define STDIO_UART        UART_0
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC43XX/PinNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,566 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PINNAMES_H
-#define MBED_PINNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    PIN_INPUT,
-    PIN_OUTPUT
-} PinDirection;
-
-#define PORT_SHIFT  5
-#define NO_GPIO     15
-
-// On the LPC43xx the MCU pin name and the GPIO pin name are not the same.
-// Encode SCU and GPIO offsets as a pin identifier
-#define MBED_PIN(group, num, port, pin)  ((SCU_OFF(group,num) << 16) + GPIO_OFF(port,pin))
-
-// Decode pin identifier into register, port and pin values
-#define MBED_SCU_REG(MBED_PIN)   (LPC_SCU_BASE + (MBED_PIN >> 16))
-#define MBED_GPIO_REG(MBED_PIN)  (LPC_GPIO_PORT_BASE + 0x2000 + ((MBED_PIN >> (PORT_SHIFT - 2)) & 0x0000003C))
-#define MBED_GPIO_PORT(MBED_PIN) ((MBED_PIN >> PORT_SHIFT) & 0x0000000F)
-#define MBED_GPIO_PIN(MBED_PIN)  (MBED_PIN & 0x0000001F)
-
-typedef enum {
-    // LPC43xx Pin Names
-    // All pins defined. Package determines which are available.
-    //          LBGA256  TFBGA180 TFBGA100 LQFP208  LQFP144
-    // GPIO0    [15:0]   [15:0]   [15:6]   [15:0]   [15:0]
-    //                            [4:0]
-    // GPIO1    [15:0]   [15:0]   [15:0]   [15:0]   [15:0]
-    // GPIO2    [15:0]   [15:0]            [15:0]   [15:0]
-    // GPIO3    [15:0]   [15:0]   [7]      [15:0]   [15:0]
-    //                            [5:3]
-    //                            [1:0]
-    // GPIO4    [15:0]   [15:0]            [15:0]   [11]
-    // GPIO5    [26:0]   [26:0]   [11:0]   [25:0]   [18]
-    //                                              [16:0]
-    // GPIO6    [30:0]   [30:28]           [30:20]
-    //                   [26:25]           [5:0]
-    // GPIO7    [25:0]   [4:0]             [25:23]
-    //                                     [21:17]
-    //          ---      ---      ---      ---      ---
-    // Total    164      117      49       131      83
-
-    // Groups 0x00 - 0x0F : Digital pins
-    // * Digital pins support up to 8 functions
-    //   Use func=0 for GPIO0-GPIO4, func=4 for GPIO5-GPIO7
-    // * High-drive pins default to 4 mA but can support 8, 14, 20 mA
-    P0_0  = MBED_PIN(0x00, 0, 0, 0),    // GPIO0[0]
-    P0_1  = MBED_PIN(0x00, 1, 0, 1),    // GPIO0[1]
-
-    P1_0  = MBED_PIN(0x01, 0, 0, 4),    // GPIO0[4]
-    P1_1  = MBED_PIN(0x01, 1, 0, 8),    // GPIO0[8]
-    P1_2  = MBED_PIN(0x01, 2, 0, 9),    // GPIO0[9]
-    P1_3  = MBED_PIN(0x01, 3, 0, 10),   // GPIO0[10]
-    P1_4  = MBED_PIN(0x01, 4, 0, 11),   // GPIO0[11]
-    P1_5  = MBED_PIN(0x01, 5, 1, 8),    // GPIO1[8]
-    P1_6  = MBED_PIN(0x01, 6, 1, 9),    // GPIO1[9]
-    P1_7  = MBED_PIN(0x01, 7, 1, 0),    // GPIO1[0]
-    P1_8  = MBED_PIN(0x01, 8, 1, 1),    // GPIO1[1]
-    P1_9  = MBED_PIN(0x01, 9, 1, 2),    // GPIO1[2]
-    P1_10 = MBED_PIN(0x01, 10, 1, 3),   // GPIO1[3]
-    P1_11 = MBED_PIN(0x01, 11, 1, 4),   // GPIO1[4]
-    P1_12 = MBED_PIN(0x01, 12, 1, 5),   // GPIO1[5]
-    P1_13 = MBED_PIN(0x01, 13, 1, 6),   // GPIO1[6]
-    P1_14 = MBED_PIN(0x01, 14, 1, 7),   // GPIO1[7]
-    P1_15 = MBED_PIN(0x01, 15, 0, 2),   // GPIO0[2]
-    P1_16 = MBED_PIN(0x01, 16, 0, 3),   // GPIO0[3]
-    P1_17 = MBED_PIN(0x01, 17, 0, 12),  // GPIO0[12] high-drive
-    P1_18 = MBED_PIN(0x01, 18, 0, 13),  // GPIO0[13]
-    P1_19 = MBED_PIN(0x01, 19, NO_GPIO, 0),
-    P1_20 = MBED_PIN(0x01, 20, 0, 15),  // GPIO0[15]
-
-    P2_0  = MBED_PIN(0x02, 0, 5, 0),    // GPIO5[0]
-    P2_1  = MBED_PIN(0x02, 1, 5, 1),    // GPIO5[1]
-    P2_2  = MBED_PIN(0x02, 2, 5, 2),    // GPIO5[2]
-    P2_3  = MBED_PIN(0x02, 3, 5, 3),    // GPIO5[3]  high-drive
-    P2_4  = MBED_PIN(0x02, 4, 5, 4),    // GPIO5[4]  high-drive
-    P2_5  = MBED_PIN(0x02, 5, 5, 5),    // GPIO5[5]  high-drive
-    P2_6  = MBED_PIN(0x02, 6, 5, 6),    // GPIO5[6]
-    P2_7  = MBED_PIN(0x02, 7, 0, 7),    // GPIO0[7]
-    P2_8  = MBED_PIN(0x02, 8, 5, 7),    // GPIO5[7]
-    P2_9  = MBED_PIN(0x02, 9, 1, 10),   // GPIO1[10]
-    P2_10 = MBED_PIN(0x02, 10, 0, 14),  // GPIO0[14]
-    P2_11 = MBED_PIN(0x02, 11, 1, 11),  // GPIO1[11]
-    P2_12 = MBED_PIN(0x02, 12, 1, 12),  // GPIO1[12]
-    P2_13 = MBED_PIN(0x02, 13, 1, 13),  // GPIO1[13]
-
-    P3_0  = MBED_PIN(0x03, 0, NO_GPIO, 0),
-    P3_1  = MBED_PIN(0x03, 1, 5, 8),    // GPIO5[8]
-    P3_2  = MBED_PIN(0x03, 2, 5, 9),    // GPIO5[9]
-    P3_3  = MBED_PIN(0x03, 3, NO_GPIO, 0),
-    P3_4  = MBED_PIN(0x03, 4, 1, 14),   // GPIO1[14]
-    P3_5  = MBED_PIN(0x03, 5, 1, 15),   // GPIO1[15]
-    P3_6  = MBED_PIN(0x03, 6, 0, 6),    // GPIO0[6]
-    P3_7  = MBED_PIN(0x03, 7, 5, 10),   // GPIO5[10]
-    P3_8  = MBED_PIN(0x03, 8, 5, 11),   // GPIO5[11]
-
-    P4_0  = MBED_PIN(0x04, 0, 2, 0),    // GPIO2[0]
-    P4_1  = MBED_PIN(0x04, 1, 2, 1),    // GPIO2[1]
-    P4_2  = MBED_PIN(0x04, 2, 2, 2),    // GPIO2[2]
-    P4_3  = MBED_PIN(0x04, 3, 2, 3),    // GPIO2[3]
-    P4_4  = MBED_PIN(0x04, 4, 2, 4),    // GPIO2[4]
-    P4_5  = MBED_PIN(0x04, 5, 2, 5),    // GPIO2[5]
-    P4_6  = MBED_PIN(0x04, 6, 2, 6),    // GPIO2[6]
-    P4_7  = MBED_PIN(0x04, 7, NO_GPIO, 0),
-    P4_8  = MBED_PIN(0x04, 8, 5, 12),   // GPIO5[12]
-    P4_9  = MBED_PIN(0x04, 9, 5, 13),   // GPIO5[13]
-    P4_10 = MBED_PIN(0x04, 10, 5, 14),  // GPIO5[14]
-
-    P5_0  = MBED_PIN(0x05, 0, 2, 9),    // GPIO2[9]
-    P5_1  = MBED_PIN(0x05, 1, 2, 10),   // GPIO2[10]
-    P5_2  = MBED_PIN(0x05, 2, 2, 11),   // GPIO2[11]
-    P5_3  = MBED_PIN(0x05, 3, 2, 12),   // GPIO2[12]
-    P5_4  = MBED_PIN(0x05, 4, 2, 13),   // GPIO2[13]
-    P5_5  = MBED_PIN(0x05, 5, 2, 14),   // GPIO2[14]
-    P5_6  = MBED_PIN(0x05, 6, 2, 15),   // GPIO2[15]
-    P5_7  = MBED_PIN(0x05, 7, 2, 7),    // GPIO2[7]
-
-    P6_0  = MBED_PIN(0x06, 0, NO_GPIO, 0),
-    P6_1  = MBED_PIN(0x06, 1, 3, 0),    // GPIO3[0]
-    P6_2  = MBED_PIN(0x06, 2, 3, 1),    // GPIO3[1]
-    P6_3  = MBED_PIN(0x06, 3, 3, 2),    // GPIO3[2]
-    P6_4  = MBED_PIN(0x06, 4, 3, 3),    // GPIO3[3]
-    P6_5  = MBED_PIN(0x06, 5, 3, 4),    // GPIO3[4]
-    P6_6  = MBED_PIN(0x06, 6, 0, 5),    // GPIO0[5]
-    P6_7  = MBED_PIN(0x06, 7, 5, 15),   // GPIO5[15]
-    P6_8  = MBED_PIN(0x06, 8, 5, 16),   // GPIO5[16]
-    P6_9  = MBED_PIN(0x06, 9, 3, 5),    // GPIO3[5]
-    P6_10 = MBED_PIN(0x06, 10, 3, 6),   // GPIO3[6]
-    P6_11 = MBED_PIN(0x06, 11, 3, 7),   // GPIO3[7]
-    P6_12 = MBED_PIN(0x06, 12, 2, 8),   // GPIO2[8]
-
-    P7_0  = MBED_PIN(0x07, 0, 3, 8),    // GPIO3[8]
-    P7_1  = MBED_PIN(0x07, 1, 3, 9),    // GPIO3[9]
-    P7_2  = MBED_PIN(0x07, 2, 3, 10),   // GPIO3[10]
-    P7_3  = MBED_PIN(0x07, 3, 3, 11),   // GPIO3[11]
-    P7_4  = MBED_PIN(0x07, 4, 3, 12),   // GPIO3[12]
-    P7_5  = MBED_PIN(0x07, 5, 3, 13),   // GPIO3[13]
-    P7_6  = MBED_PIN(0x07, 6, 3, 14),   // GPIO3[14]
-    P7_7  = MBED_PIN(0x07, 7, 3, 15),   // GPIO3[15]
-
-    P8_0  = MBED_PIN(0x08, 8, 4, 0),    // GPIO4[0]  high-drive
-    P8_1  = MBED_PIN(0x09, 0, 4, 1),    // GPIO4[1]  high-drive
-    P8_2  = MBED_PIN(0x09, 1, 4, 2),    // GPIO4[2]  high-drive
-    P8_3  = MBED_PIN(0x09, 2, 4, 3),    // GPIO4[3]
-    P8_4  = MBED_PIN(0x08, 4, 4, 4),    // GPIO4[4]
-    P8_5  = MBED_PIN(0x08, 5, 4, 5),    // GPIO4[5]
-    P8_6  = MBED_PIN(0x08, 6, 4, 6),    // GPIO4[6]
-    P8_7  = MBED_PIN(0x08, 7, 4, 7),    // GPIO4[7]
-    P8_8  = MBED_PIN(0x08, 8, NO_GPIO, 0),
-
-    P9_0  = MBED_PIN(0x09, 0, 4, 12),   // GPIO4[12]
-    P9_1  = MBED_PIN(0x09, 1, 4, 13),   // GPIO4[13]
-    P9_2  = MBED_PIN(0x09, 2, 4, 14),   // GPIO4[14]
-    P9_3  = MBED_PIN(0x09, 3, 4, 15),   // GPIO4[15]
-    P9_4  = MBED_PIN(0x09, 4, 5, 17),   // GPIO5[17]
-    P9_5  = MBED_PIN(0x09, 5, 5, 18),   // GPIO5[18]
-    P9_6  = MBED_PIN(0x09, 6, 4, 11),   // GPIO4[11]
-
-    PA_0  = MBED_PIN(0x0A, 0, NO_GPIO, 0),
-    PA_1  = MBED_PIN(0x0A, 1, 4, 8),    // GPIO4[8]  high-drive
-    PA_2  = MBED_PIN(0x0A, 2, 4, 9),    // GPIO4[9]  high-drive
-    PA_3  = MBED_PIN(0x0A, 3, 4, 10),   // GPIO4[10] high-drive
-    PA_4  = MBED_PIN(0x0A, 4, 5, 19),   // GPIO5[19]
-
-    PB_0   = MBED_PIN(0x0B, 0, 5, 20),  // GPIO5[20]
-    PB_1   = MBED_PIN(0x0B, 1, 5, 21),  // GPIO5[21]
-    PB_2   = MBED_PIN(0x0B, 2, 5, 22),  // GPIO5[22]
-    PB_3   = MBED_PIN(0x0B, 3, 5, 23),  // GPIO5[23]
-    PB_4   = MBED_PIN(0x0B, 4, 5, 24),  // GPIO5[24]
-    PB_5   = MBED_PIN(0x0B, 5, 5, 25),  // GPIO5[25]
-    PB_6   = MBED_PIN(0x0B, 6, 5, 26),  // GPIO5[26]
-
-    PC_0   = MBED_PIN(0x0C, 0, NO_GPIO, 0),
-    PC_1   = MBED_PIN(0x0C, 1, 6, 0),   // GPIO6[0]
-    PC_2   = MBED_PIN(0x0C, 2, 6, 1),   // GPIO6[1]
-    PC_3   = MBED_PIN(0x0C, 3, 6, 2),   // GPIO6[2]
-    PC_4   = MBED_PIN(0x0C, 4, 6, 3),   // GPIO6[3]
-    PC_5   = MBED_PIN(0x0C, 5, 6, 4),   // GPIO6[4]
-    PC_6   = MBED_PIN(0x0C, 6, 6, 5),   // GPIO6[5]
-    PC_7   = MBED_PIN(0x0C, 7, 6, 6),   // GPIO6[6]
-    PC_8   = MBED_PIN(0x0C, 8, 6, 7),   // GPIO6[7]
-    PC_9   = MBED_PIN(0x0C, 9, 6, 8),   // GPIO6[8]
-    PC_10  = MBED_PIN(0x0C, 10, 6, 9),  // GPIO6[9]
-    PC_11  = MBED_PIN(0x0C, 11, 6, 10), // GPIO6[10]
-    PC_12  = MBED_PIN(0x0C, 12, 6, 11), // GPIO6[11]
-    PC_13  = MBED_PIN(0x0C, 13, 6, 12), // GPIO6[12]
-    PC_14  = MBED_PIN(0x0C, 14, 6, 13), // GPIO6[13]
-
-    PD_0   = MBED_PIN(0x0D, 0, 6, 14),  // GPIO6[14]
-    PD_1   = MBED_PIN(0x0D, 1, 6, 15),  // GPIO6[15]
-    PD_2   = MBED_PIN(0x0D, 2, 6, 16),  // GPIO6[16]
-    PD_3   = MBED_PIN(0x0D, 3, 6, 17),  // GPIO6[17]
-    PD_4   = MBED_PIN(0x0D, 4, 6, 18),  // GPIO6[18]
-    PD_5   = MBED_PIN(0x0D, 5, 6, 19),  // GPIO6[19]
-    PD_6   = MBED_PIN(0x0D, 6, 6, 20),  // GPIO6[20]
-    PD_7   = MBED_PIN(0x0D, 7, 6, 21),  // GPIO6[21]
-    PD_8   = MBED_PIN(0x0D, 8, 6, 22),  // GPIO6[22]
-    PD_9   = MBED_PIN(0x0D, 9, 6, 23),  // GPIO6[23]
-    PD_10  = MBED_PIN(0x0D, 10, 6, 24), // GPIO6[24]
-    PD_11  = MBED_PIN(0x0D, 11, 6, 25), // GPIO6[25]
-    PD_12  = MBED_PIN(0x0D, 12, 6, 26), // GPIO6[26]
-    PD_13  = MBED_PIN(0x0D, 13, 6, 27), // GPIO6[27]
-    PD_14  = MBED_PIN(0x0D, 14, 6, 28), // GPIO6[28]
-    PD_15  = MBED_PIN(0x0D, 15, 6, 29), // GPIO6[29]
-    PD_16  = MBED_PIN(0x0D, 16, 6, 30), // GPIO6[30]
-
-    PE_0   = MBED_PIN(0x0E, 0, 7, 0),   // GPIO7[0]
-    PE_1   = MBED_PIN(0x0E, 1, 7, 1),   // GPIO7[1]
-    PE_2   = MBED_PIN(0x0E, 2, 7, 2),   // GPIO7[2]
-    PE_3   = MBED_PIN(0x0E, 3, 7, 3),   // GPIO7[3]
-    PE_4   = MBED_PIN(0x0E, 4, 7, 4),   // GPIO7[4]
-    PE_5   = MBED_PIN(0x0E, 5, 7, 5),   // GPIO7[5]
-    PE_6   = MBED_PIN(0x0E, 6, 7, 6),   // GPIO7[6]
-    PE_7   = MBED_PIN(0x0E, 7, 7, 7),   // GPIO7[7]
-    PE_8   = MBED_PIN(0x0E, 8, 7, 8),   // GPIO7[8]
-    PE_9   = MBED_PIN(0x0E, 9, 7, 9),   // GPIO7[9]
-    PE_10  = MBED_PIN(0x0E, 10, 7, 10), // GPIO7[10]
-    PE_11  = MBED_PIN(0x0E, 11, 7, 11), // GPIO7[11]
-    PE_12  = MBED_PIN(0x0E, 12, 7, 12), // GPIO7[12]
-    PE_13  = MBED_PIN(0x0E, 13, 7, 13), // GPIO7[13]
-    PE_14  = MBED_PIN(0x0E, 14, 7, 14), // GPIO7[14]
-    PE_15  = MBED_PIN(0x0E, 15, 7, 15), // GPIO7[15]
-
-    PF_0   = MBED_PIN(0x0F, 0, NO_GPIO, 0),
-    PF_1   = MBED_PIN(0x0F, 1, 7, 16),  // GPIO7[16]
-    PF_2   = MBED_PIN(0x0F, 2, 7, 17),  // GPIO7[17]
-    PF_3   = MBED_PIN(0x0F, 3, 7, 18),  // GPIO7[18]
-    PF_4   = MBED_PIN(0x0F, 4, NO_GPIO, 0),
-    PF_5   = MBED_PIN(0x0F, 5, 7, 19),  // GPIO7[19]
-    PF_6   = MBED_PIN(0x0F, 6, 7, 20),  // GPIO7[20]
-    PF_7   = MBED_PIN(0x0F, 7, 7, 21),  // GPIO7[21]
-    PF_8   = MBED_PIN(0x0F, 8, 7, 22),  // GPIO7[22]
-    PF_9   = MBED_PIN(0x0F, 9, 7, 23),  // GPIO7[23]
-    PF_10  = MBED_PIN(0x0F, 10, 7, 24), // GPIO7[24]
-    PF_11  = MBED_PIN(0x0F, 11, 7, 25), // GPIO7[25]
-
-    // GPIO pins from MCU pins
-    GPIO0_0 = P0_0,
-    GPIO0_1 = P0_1 ,
-    GPIO0_2 = P1_15,
-    GPIO0_3 = P1_16,
-    GPIO0_4 = P1_0,
-    GPIO0_5 = P6_6,
-    GPIO0_6 = P3_6,
-    GPIO0_7 = P2_7,
-    GPIO0_8 = P1_1,
-    GPIO0_9 = P1_2,
-    GPIO0_10 = P1_3,
-    GPIO0_11 = P1_4,
-    GPIO0_12 = P1_17,
-    GPIO0_13 = P1_18,
-    GPIO0_14 = P2_10,
-    GPIO0_15 = P1_20,
-
-    GPIO1_0 = P1_7,
-    GPIO1_1 = P1_8,
-    GPIO1_2 = P1_9,
-    GPIO1_3 = P1_10,
-    GPIO1_4 = P1_11,
-    GPIO1_5 = P1_12,
-    GPIO1_6 = P1_13,
-    GPIO1_7 = P1_14,
-    GPIO1_8 = P1_5,
-    GPIO1_9 = P1_6,
-    GPIO1_10 = P2_9,
-    GPIO1_11 = P2_11,
-    GPIO1_12 = P2_12,
-    GPIO1_13 = P2_13,
-    GPIO1_14 = P3_4,
-    GPIO1_15 = P3_5,
-
-    GPIO2_0 = P4_0,
-    GPIO2_1 = P4_1,
-    GPIO2_2 = P4_2,
-    GPIO2_3 = P4_3,
-    GPIO2_4 = P4_4,
-    GPIO2_5 = P4_5,
-    GPIO2_6 = P4_6,
-    GPIO2_7 = P5_7,
-    GPIO2_8 = P6_12,
-    GPIO2_9 = P5_0,
-    GPIO2_10 = P5_1,
-    GPIO2_11 = P5_2,
-    GPIO2_12 = P5_3,
-    GPIO2_13 = P5_4,
-    GPIO2_14 = P5_5,
-    GPIO2_15 = P5_6,
-
-    GPIO3_0 = P6_1,
-    GPIO3_1 = P6_2,
-    GPIO3_2 = P6_3,
-    GPIO3_3 = P6_4,
-    GPIO3_4 = P6_5,
-    GPIO3_5 = P6_9,
-    GPIO3_6 = P6_10,
-    GPIO3_7 = P6_11,
-    GPIO3_8 = P7_0,
-    GPIO3_9 = P7_1,
-    GPIO3_10 = P7_2,
-    GPIO3_11 = P7_3,
-    GPIO3_12 = P7_4,
-    GPIO3_13 = P7_5,
-    GPIO3_14 = P7_6,
-    GPIO3_15 = P7_7,
-
-    GPIO4_0 = P8_0,
-    GPIO4_1 = P8_1,
-    GPIO4_2 = P8_2,
-    GPIO4_3 = P8_3,
-    GPIO4_4 = P8_4,
-    GPIO4_5 = P8_5,
-    GPIO4_6 = P8_6,
-    GPIO4_7 = P8_7,
-    GPIO4_8 = PA_1,
-    GPIO4_9 = PA_2,
-    GPIO4_10 = PA_3,
-    GPIO4_11 = P9_6,
-    GPIO4_12 = P9_0,
-    GPIO4_13 = P9_1,
-    GPIO4_14 = P9_2,
-    GPIO4_15 = P9_3,
-
-    GPIO5_0 = P2_0,
-    GPIO5_1 = P2_1,
-    GPIO5_2 = P2_2,
-    GPIO5_3 = P2_3,
-    GPIO5_4 = P2_4,
-    GPIO5_5 = P2_5,
-    GPIO5_6 = P2_6,
-    GPIO5_7 = P2_8,
-    GPIO5_8 = P3_1,
-    GPIO5_9 = P3_2,
-    GPIO5_10 = P3_7,
-    GPIO5_11 = P3_8,
-    GPIO5_12 = P4_8,
-    GPIO5_13 = P4_9,
-    GPIO5_14 = P4_10,
-    GPIO5_15 = P6_7,
-    GPIO5_16 = P6_8,
-    GPIO5_17 = P9_4,
-    GPIO5_18 = P9_5,
-    GPIO5_19 = PA_4,
-    GPIO5_20 = PB_0,
-    GPIO5_21 = PB_1,
-    GPIO5_22 = PB_2,
-    GPIO5_23 = PB_3,
-    GPIO5_24 = PB_4,
-    GPIO5_25 = PB_5,
-    GPIO5_26 = PB_6,
-
-    GPIO6_0 = PC_1,
-    GPIO6_1 = PC_2,
-    GPIO6_2 = PC_3,
-    GPIO6_3 = PC_4,
-    GPIO6_4 = PC_5,
-    GPIO6_5 = PC_6,
-    GPIO6_6 = PC_7,
-    GPIO6_7 = PC_8,
-    GPIO6_8 = PC_9,
-    GPIO6_9 = PC_10,
-    GPIO6_10 = PC_11,
-    GPIO6_11 = PC_12,
-    GPIO6_12 = PC_13,
-    GPIO6_13 = PC_14,
-    GPIO6_14 = PD_0,
-    GPIO6_15 = PD_1,
-    GPIO6_16 = PD_2,
-    GPIO6_17 = PD_3,
-    GPIO6_18 = PD_4,
-    GPIO6_19 = PD_5,
-    GPIO6_20 = PD_6,
-    GPIO6_21 = PD_7,
-    GPIO6_22 = PD_8,
-    GPIO6_23 = PD_9,
-    GPIO6_24 = PD_10,
-    GPIO6_25 = PD_11,
-    GPIO6_26 = PD_12,
-    GPIO6_27 = PD_13,
-    GPIO6_28 = PD_14,
-    GPIO6_29 = PD_15,
-    GPIO6_30 = PD_16,
-
-    GPIO7_0 = PE_0,
-    GPIO7_1 = PE_1,
-    GPIO7_2 = PE_2,
-    GPIO7_3 = PE_3,
-    GPIO7_4 = PE_4,
-    GPIO7_5 = PE_5,
-    GPIO7_6 = PE_5,
-    GPIO7_7 = PE_7,
-    GPIO7_8 = PE_8,
-    GPIO7_9 = PE_9,
-    GPIO7_10 = PE_10,
-    GPIO7_11 = PE_11,
-    GPIO7_12 = PE_12,
-    GPIO7_13 = PE_13,
-    GPIO7_14 = PE_14,
-    GPIO7_15 = PE_15,
-    GPIO7_16 = PF_1,
-    GPIO7_17 = PF_2,
-    GPIO7_18 = PF_3,
-    GPIO7_19 = PF_5,
-    GPIO7_20 = PF_6,
-    GPIO7_21 = PF_7,
-    GPIO7_22 = PF_8,
-    GPIO7_23 = PF_9,
-    GPIO7_24 = PF_10,
-    GPIO7_25 = PF_11,
-
-    // Map mbed pin names to LPC43xx board signals
-
-    // Group 0x18 : CLKn pins
-    SFP_CLK0  = MBED_PIN(0x18, 0, 0, 0),
-    SFP_CLK1  = MBED_PIN(0x18, 1, 0, 0),
-    SFP_CLK2  = MBED_PIN(0x18, 2, 0, 0),
-    SFP_CLK3  = MBED_PIN(0x18, 3, 0, 0),
-	
-    // Group 0x19 : USB1, I2C0, ADC0, ADC1
-    SFP_USB1  = MBED_PIN(0x19, 0, 0, 0),
-    SFP_I2C0  = MBED_PIN(0x19, 1, 0, 0),
-    SFP_AIO0  = MBED_PIN(0x19, 2, 0, 0), // ADC0 function select register
-    SFP_AIO1  = MBED_PIN(0x19, 3, 0, 0), // ADC1 function select register
-    SFP_AIO2  = MBED_PIN(0x19, 4, 0, 0), // Analog function select register
-
-    SFP_EMCD  = MBED_PIN(0x1A, 0, 0, 0), // EMC clock delay register
-
-    SFP_INS0  = MBED_PIN(0x1C, 0, 0, 0), // Interrupt select for pin interrupts 0 to 3
-    SFP_INS1  = MBED_PIN(0x1C, 1, 0, 0), // Interrupt select for pin interrupts 4 to 7
-
-#define MBED_ADC_NUM(MBED_PIN)   ((MBED_PIN >> 5) & 0x0000000F)
-#define MBED_ADC_CHAN(MBED_PIN)  (MBED_PIN & 0x0000001F)
-
-    // Use pseudo-pin ID also for ADCs, although with special handling
-    SFP_ADC0_0 = MBED_PIN(0x19, 2, 0, 0), // ADC0_0
-    SFP_ADC0_1 = MBED_PIN(0x19, 2, 0, 1), // ADC0_1
-    SFP_ADC0_2 = MBED_PIN(0x19, 2, 0, 2), // ADC0_2
-    SFP_ADC0_3 = MBED_PIN(0x19, 2, 0, 3), // ADC0_3
-    SFP_ADC0_4 = MBED_PIN(0x19, 2, 0, 4), // ADC0_4
-    SFP_ADC0_5 = MBED_PIN(0x19, 2, 0, 5), // ADC0_5
-    SFP_ADC0_6 = MBED_PIN(0x19, 2, 0, 6), // ADC0_6
-
-    SFP_ADC1_0 = MBED_PIN(0x19, 3, 1, 0), // ADC1_0
-    SFP_ADC1_1 = MBED_PIN(0x19, 3, 1, 1), // ADC1_1
-    SFP_ADC1_2 = MBED_PIN(0x19, 3, 1, 2), // ADC1_2
-    SFP_ADC1_3 = MBED_PIN(0x19, 3, 1, 3), // ADC1_3
-    SFP_ADC1_4 = MBED_PIN(0x19, 3, 1, 4), // ADC1_4
-    SFP_ADC1_5 = MBED_PIN(0x19, 3, 1, 5), // ADC1_5
-    SFP_ADC1_6 = MBED_PIN(0x19, 3, 1, 6), // ADC1_6
-    SFP_ADC1_7 = MBED_PIN(0x19, 3, 1, 7), // ADC1_7
-
-    // ---------- Micromint Bambino 200 ----------
-    // LQFP144
-    // NOTE: Pins marked (*) only available on 200E
-    p5  = P1_2,   // SPI0 mosi
-    p6  = P1_1,   // SPI0 miso
-    p7  = P3_0,   // SPI0 sck
-    p8  = P4_5,
-    p9  = P6_4,   // Serial0 tx, I2C0 sda
-    p10 = P6_5,   // Serial0 rx, I2C0 scl
-    p11 = P1_4,   // SPI1 mosi (*)
-    p12 = P1_3,   // SPI1 miso (*)
-    p13 = PF_4,   // Serial1 tx, SPI1 sck (*)
-    p14 = P1_14,  // Serial1 rx
-    p15 = P4_3,   // ADC0
-    p16 = P4_1,   // ADC1
-    p17 = P7_4,   // ADC2
-    p18 = SFP_ADC0_0, // ADC3, DAC0
-    p19 = P7_5,   // ADC4
-    p20 = P7_7,   // ADC5
-    p21 = P4_0,   // PWM0
-    p22 = P5_5,   // PWM1
-    p23 = P5_7,   // PWM2
-    p24 = P4_8,   // PWM3
-    p25 = P4_9,   // PWM4
-    p26 = P4_10,  // PWM5
-    p27 = P2_4,   // I2C1 scl, Serial2 rx
-    p28 = P2_3,   // I2C1 sda, Serial2 tx
-    p29 = P3_2,   // CAN0 td
-    p30 = P3_1,   // CAN0 rx
-
-    // User interfaces: LEDs, buttons
-    LED_YELLOW = P6_11,
-    LED_GREEN = P2_5,
-    LED_RED = LED_YELLOW,
-    LED_BLUE = LED_GREEN,
-
-    LED1 = LED_YELLOW,
-    LED2 = LED_GREEN,
-    LED3 = LED_GREEN,
-    LED4 = LED_GREEN,
-
-    BTN1 = P2_7,
-
-    // Serial pins
-    UART0_TX = P6_4,
-    UART0_RX = P6_5,
-    UART1_TX = P5_6,
-    UART1_RX = P1_14,
-    UART2_TX = P2_10,
-    UART2_RX = P2_11,
-    UART3_TX = P2_3,
-    UART3_RX = P2_4,
-
-    // Analog pins
-    P_ADC0_0 = P4_3,
-    P_ADC0_1 = P4_1,
-    P_ADC1_0 = SFP_ADC0_0,
-    P_ADC0_4 = P7_4,
-    P_ADC0_3 = P7_5,
-    P_ADC1_6 = P7_7,
-
-    P_ADC0 = P_ADC0_0,
-    P_ADC1 = P_ADC0_1,
-    P_ADC2 = P_ADC1_0,
-    P_ADC3 = P_ADC0_4,
-    P_ADC4 = P_ADC0_3,
-    P_ADC5 = P_ADC1_6,
-
-    P_DAC0 = P4_4,
-
-    // USB pins
-    //P_USB0_TX = SFP_USB1,
-    //P_USB0_RX = SFP_USB1,
-
-    USBTX = UART0_TX,
-    USBRX = UART0_RX,
-    // ---------- End of Micromint Bambino 200 ----------
-
-    // Not connected
-    NC = (int)0xFFFFFFFF
-} PinName;
-
-typedef enum {
-    PullUp = 0,
-    PullDown = 3,
-    PullNone = 2,
-    Repeater = 1,
-    OpenDrain = 4
-} PinMode;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC43XX/PortNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PORTNAMES_H
-#define MBED_PORTNAMES_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    Port0 = 0,
-    Port1 = 1,
-    Port2 = 2,
-    Port3 = 3,
-    Port4 = 4,
-    Port5 = 5,
-    Port6 = 6,
-    Port7 = 7
-} PortName;
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC43XX/README.txt	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-mbed port to NXP LPC43xx
-========================
-Updated: 06/24/13
-
-The NXP LPC43xx microcontrollers are the first to include multiple Cortex-M
-cores in a single microcontroller package. This port allows mbed developers
-to take advantage of the LPC43xx in their application using APIs that they
-are familiar with. Some of the key features of the LPC43xx include:
-
-* Dual core ARM Cortex-M4/M0 both capable of up to 204 MHz
-* Up to 264 KB SRAM, 1 MB internal flash
-* Two High-speed USB 2.0 interfaces
-* Ethernet MAC
-* LCD interface
-* Quad-SPI Flash Interface (SPIFI)
-* State Configurable Timer (SCT)
-* Serial GPIO (SGPIO)
-* Up to 164 GPIO
-
-The NXP LPC18xx is a single core Cortex-M3 implementation that is compatible
-with the LPC43XX for cost-sensitive applications not requiring multiple cores.
-
-mbed port to the LPC43XX - Micromint USA <support@micromint.com>
-
-Compatibility
--------------
-* This port has been tested with the following boards:
-    Board                    MCU        RAM/Flash
-    Micromint Bambino 200    LPC4330    264K SRAM/4 MB SPIFI flash
-
-* Ethernet, USB and microSD filesystem drivers will be available when the
-  Bambino 200E is released.
-
-* This port uses offline toolchains. Development and testing has been done
-  mainly with the Keil MDK 4.70. Some testing has been done with IAR 6.5.
-  Eventually Keil, IAR and GCC CodeRed will be supported.
-
-* CMSIS-DAP debugging is not currently implemented. To debug use a JTAG.
-  The NXP DFU tool can be used for flash programming.
-
-* This port should support NXP LPC43XX and LPC18XX variants with a single
-  codebase. The core declaration specifies the binaries to be built:
-    mbed define      CMSIS define  MCU Target
-    __CORTEX_M4      CORE_M4       LPC43xx Cortex-M4
-    __CORTEX_M0      CORE_M0       LPC43xx Cortex-M0
-    __CORTEX_M3      CORE_M3       LPC18xx Cortex-M3
-  These MCUs all share the peripheral IP, common driver code is feasible.
-  Yet each variant can have different memory segments, peripherals, etc.
-  Plus, each board design can integrate different external peripherals
-  or interfaces. A future release of the mbed SDK and its build tools will
-  support specifying the target board when building binaries. At this time
-  building binaries for different targets requires an external project or
-  Makefile.
-
-* No testing has been done with LPC18xx hardware. At the very least supporting
-  the LPC18xx would require different compiler flags, additional CMSIS core_cm3
-  code as well as minor driver code changes.
-
-Notes
------
-* On the LPC43xx the hardware pin name and the GPIO pin name are not the same,
-  requiring different offsets for the SCU and GPIO registers. To simplify logic
-  the pin identifier encodes the offsets. Macros are used for decoding.
-  For example, P6_11 corresponds to GPIO3[7] and is encoded/decoded as follows:
-
-    P6_11 = MBED_PIN(0x06, 11, 3, 7) = 0x032C0067
-
-    MBED_SCU_REG(P6_11)  = 0x4008632C      MBED_GPIO_PORT(P6_11) = 3
-    MBED_GPIO_REG(P6_11) = 0x400F4000      MBED_GPIO_PIN(P6_11)  = 7
-
-* The LPC43xx implements GPIO pin and group interrupts. Any pin in the 8 32-bit
-  GPIO ports can interrupt (LPC4350 supports up to 164). On group interrupts a
-  pin can only interrupt on the rising or falling edge, not both as required
-  by the mbed InterruptIn class. Also, group interrupts can't be cleared
-  individually. This implementation uses pin interrupts (8 on M4/M3, 1 on M0).
-  A future implementation may provide group interrupt support.
--- a/targets/hal/TARGET_NXP/TARGET_LPC43XX/analogin_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Ported to NXP LPC43XX by Micromint USA <support@micromint.com>
- */
-#include "analogin_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-#define ANALOGIN_MEDIAN_FILTER      1
-
-static inline int div_round_up(int x, int y) {
-  return (x + (y - 1)) / y;
-}
-
-// ToDo: Add support for ADC1
-static const PinMap PinMap_ADC[] = {
-    {P_ADC0, ADC0_0, 0x08},
-    {P_ADC1, ADC0_1, 0x07},
-    {P_ADC2, ADC0_2, 0x01},
-    {P_ADC3, ADC0_3, 0x08},
-    {P_ADC4, ADC0_4, 0x08},
-    {P_ADC5, ADC0_5, 0x08},
-    {NC   , NC    , 0   }
-};
-
-void analogin_init(analogin_t *obj, PinName pin) {
-    uint8_t num, chan;
-
-    obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
-    if (obj->adc == (uint32_t)NC) {
-        error("ADC pin mapping failed");
-    }
-
-
-    // Configure the pin as GPIO input
-    if (pin < SFP_AIO0) {
-        pin_function(pin, (SCU_PINIO_PULLNONE | 0x0));
-        pin_mode(pin, PullNone);
-        num = (uint8_t)(obj->adc) / 8; // Heuristic?
-        chan = (uint8_t)(obj->adc) % 7;
-    } else {
-        num = MBED_ADC_NUM(pin);
-        chan = MBED_ADC_CHAN(pin);
-    }
-
-    // Calculate minimum clock divider
-    //  clkdiv = divider - 1
-		uint32_t PCLK = SystemCoreClock;
-    uint32_t adcRate = 400000;
-    uint32_t clkdiv = div_round_up(PCLK, adcRate) - 1;
-    
-    // Set the generic software-controlled ADC settings
-    LPC_ADC0->CR = (0 << 0)      // SEL: 0 = no channels selected
-                  | (clkdiv << 8) // CLKDIV:
-                  | (0 << 16)     // BURST: 0 = software control
-                  | (1 << 21)     // PDN: 1 = operational
-                  | (0 << 24)     // START: 0 = no start
-                  | (0 << 27);    // EDGE: not applicable
-
-    // Select ADC on analog function select register in SCU
-    LPC_SCU->ENAIO[num] |= 1UL << chan;
-}
-
-static inline uint32_t adc_read(analogin_t *obj) {
-    // Select the appropriate channel and start conversion
-    LPC_ADC0->CR &= ~0xFF;
-    LPC_ADC0->CR |= 1 << (int)obj->adc;
-    LPC_ADC0->CR |= 1 << 24;
-
-    // Repeatedly get the sample data until DONE bit
-    unsigned int data;
-    do {
-        data = LPC_ADC0->GDR;
-    } while ((data & ((unsigned int)1 << 31)) == 0);
-
-    // Stop conversion
-    LPC_ADC0->CR &= ~(1 << 24);
-
-    return (data >> 6) & ADC_RANGE; // 10 bit
-}
-
-static inline void order(uint32_t *a, uint32_t *b) {
-    if (*a > *b) {
-        uint32_t t = *a;
-        *a = *b;
-        *b = t;
-    }
-}
-
-static inline uint32_t adc_read_u32(analogin_t *obj) {
-    uint32_t value;
-#if ANALOGIN_MEDIAN_FILTER
-    uint32_t v1 = adc_read(obj);
-    uint32_t v2 = adc_read(obj);
-    uint32_t v3 = adc_read(obj);
-    order(&v1, &v2);
-    order(&v2, &v3);
-    order(&v1, &v2);
-    value = v2;
-#else
-    value = adc_read(obj);
-#endif
-    return value;
-}
-
-uint16_t analogin_read_u16(analogin_t *obj) {
-    uint32_t value = adc_read_u32(obj);
-
-    return (value << 6) | ((value >> 4) & 0x003F); // 10 bit
-}
-
-float analogin_read(analogin_t *obj) {
-    uint32_t value = adc_read_u32(obj);
-    return (float)value * (1.0f / (float)ADC_RANGE);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC43XX/analogout_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Ported to NXP LPC43XX by Micromint USA <support@micromint.com>
- */
-#include "analogout_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_DAC[] = {
-    {P_DAC0 , DAC_0, 0x0},
-    {NC     , NC   , 0}
-};
-
-void analogout_init(dac_t *obj, PinName pin) {
-    obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
-    if (obj->dac == (DACName)NC) {
-        error("DAC pin mapping failed");
-    }
-
-    // Configure the pin as GPIO input
-    pin_function(pin, (SCU_PINIO_PULLNONE | 0x0));
-    pin_mode(pin, PullNone);
-    // Select DAC on analog function select register in SCU
-    LPC_SCU->ENAIO[2] |= 1; // Sets pin P4_4 as DAC
-
-    // Set Maximum update rate for DAC */
-    LPC_DAC->CR &= ~DAC_BIAS_EN;
-	
-    analogout_write_u16(obj, 0);
-}
-
-void analogout_free(dac_t *obj) {}
-
-static inline void dac_write(int value) {
-    uint32_t tmp;
-    
-    // Set the DAC output
-    tmp = LPC_DAC->CR & DAC_BIAS_EN;
-    tmp |= DAC_VALUE(value);
-    LPC_DAC->CR = tmp;
-}
-
-static inline int dac_read() {
-    return (DAC_VALUE(LPC_DAC->CR));
-}
-
-void analogout_write(dac_t *obj, float value) {
-    if (value < 0.0f) {
-        dac_write(0);
-    } else if (value > 1.0f) {
-        dac_write(DAC_RANGE);
-    } else {
-        dac_write(value * (float)DAC_RANGE);
-    }
-}
-
-void analogout_write_u16(dac_t *obj, uint16_t value) {
-    dac_write(value >> 6); // 10-bit
-}
-
-float analogout_read(dac_t *obj) {
-    uint32_t value = dac_read();
-    return (float)value * (1.0f / (float)DAC_RANGE);
-}
-
-uint16_t analogout_read_u16(dac_t *obj) {
-    uint32_t value = dac_read(); // 10-bit
-    return (value << 6) | ((value >> 4) & 0x003F);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC43XX/device.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_DEVICE_H
-#define MBED_DEVICE_H
-
-#define DEVICE_PORTIN           1
-#define DEVICE_PORTOUT          1
-#define DEVICE_PORTINOUT        1
-
-#define DEVICE_INTERRUPTIN      1
-
-#define DEVICE_ANALOGIN         1
-#define DEVICE_ANALOGOUT        1
-
-#define DEVICE_SERIAL           1
-
-#define DEVICE_I2C              0
-#define DEVICE_I2CSLAVE         0
-
-#define DEVICE_SPI              1
-#define DEVICE_SPISLAVE         1
-
-#define DEVICE_CAN              0
-
-#define DEVICE_RTC              1
-
-#define DEVICE_ETHERNET         0
-
-#define DEVICE_PWMOUT           0
-
-#define DEVICE_SEMIHOST         0
-#define DEVICE_LOCALFILESYSTEM  0
-#define DEVICE_ID_LENGTH       32
-#define DEVICE_MAC_OFFSET      20
-
-#define DEVICE_SLEEP            1
-
-#define DEVICE_DEBUG_AWARENESS  1
-
-#define DEVICE_STDIO_MESSAGES   1
-
-#define DEVICE_ERROR_RED        1
-
-#include "objects.h"
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC43XX/gpio_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Ported to NXP LPC43XX by Micromint USA <support@micromint.com>
- */
-#include "gpio_api.h"
-#include "pinmap.h"
-
-uint32_t gpio_set(PinName pin) {
-    int f = 0;
-    unsigned int port = (unsigned int)MBED_GPIO_PORT(pin);
-
-    f = SCU_PINIO_FAST | ((port > 4) ? (4) : (0));
-    pin_function(pin, f);
-
-    return (1 << ((int)pin & 0x1F));
-}
-
-void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) {
-    if (pin == NC) return;
-    
-    obj->pin = pin;
-    obj->mask = gpio_set(pin);
-
-    LPC_GPIO_T *port_reg = (LPC_GPIO_T *) (LPC_GPIO_PORT_BASE);
-    unsigned int port = (unsigned int)MBED_GPIO_PORT(pin);
-
-    obj->reg_set = &port_reg->SET[port];
-    obj->reg_clr = &port_reg->CLR[port];
-    obj->reg_in  = &port_reg->PIN[port];
-    obj->reg_dir = &port_reg->DIR[port];
-
-    gpio_dir(obj, direction);
-    switch (direction) {
-        case PIN_OUTPUT: pin_mode(pin, PullNone); break;
-        case PIN_INPUT : pin_mode(pin, PullDown); break;
-    }
-}
-
-void gpio_mode(gpio_t *obj, PinMode mode) {
-    pin_mode(obj->pin, mode);
-}
-
-void gpio_dir(gpio_t *obj, PinDirection direction) {
-    switch (direction) {
-        case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break;
-        case PIN_OUTPUT: *obj->reg_dir |=  obj->mask; break;
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC43XX/gpio_irq_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Ported to NXP LPC43XX by Micromint USA <support@micromint.com>
- */
-#include <stddef.h>
-#include "gpio_irq_api.h"
-#include "error.h"
-#include "cmsis.h"
-
-/* The LPC43xx implements GPIO pin and group interrupts. Any pin in the
- * 8 32-bit GPIO ports can interrupt. On group interrupts a pin can
- * only interrupt on the rising or falling edge, not both as required
- * by mbed. Also, group interrupts can't be cleared individually.
- * This implementation uses pin interrupts (8 on M4/M3, 1 on M0).
- * A future implementation may provide group interrupt support.
- */
-#if !defined(CORE_M0)
-#define CHANNEL_NUM    8
-#else
-#define CHANNEL_NUM    1
-#endif
-
-static uint32_t channel_ids[CHANNEL_NUM] = {0};
-static uint32_t channel = 0;
-static gpio_irq_handler irq_handler;
-
-static void handle_interrupt_in(void) {
-    uint32_t rise = LPC_GPIO_PIN_INT->RISE;
-    uint32_t fall = LPC_GPIO_PIN_INT->FALL;
-    uint32_t pmask;
-    int i;
-
-    for (i = 0; i < CHANNEL_NUM; i++) {
-        pmask = (1 << i);
-        if (rise & pmask) {
-            /* Rising edge interrupts */
-            if (channel_ids[i] != 0)
-                irq_handler(channel_ids[i], IRQ_RISE);
-            /* Clear rising edge detected */
-            LPC_GPIO_PIN_INT->RISE = pmask;
-        }
-        if (fall & pmask) {
-            /* Falling edge interrupts */
-            if (channel_ids[i] != 0)
-                irq_handler(channel_ids[i], IRQ_FALL);
-            /* Clear falling edge detected */
-            LPC_GPIO_PIN_INT->FALL = pmask;
-        }
-    }
-}
-
-int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id) {
-    uint32_t portnum, pinnum; //, pmask;
-
-    if (pin == NC) return -1;
-
-    irq_handler = handler;
-
-    /* Set port and pin numbers */
-    obj->port = portnum = MBED_GPIO_PORT(pin);
-    obj->pin = pinnum = MBED_GPIO_PIN(pin);
-
-    /* Add to channel table */
-    channel_ids[channel] = id;
-    obj->ch = channel;
-
-	  /* Clear rising and falling edge detection */
-    //pmask = (1 << channel);
-    //LPC_GPIO_PIN_INT->IST = pmask;
-
-    /* Set SCU */
-    if (channel < 4) {
-        LPC_SCU->PINTSEL0 &= ~(0xFF << (portnum << 3));
-        LPC_SCU->PINTSEL0 |= (((portnum << 5) | pinnum) << (channel << 3));
-    } else {
-        LPC_SCU->PINTSEL1 &= ~(0xFF << ((portnum - 4) << 3));
-        LPC_SCU->PINTSEL1 |= (((portnum << 5) | pinnum) << ((channel - 4) << 3));
-    }
-	
-#if !defined(CORE_M0)
-    NVIC_SetVector((IRQn_Type)(PIN_INT0_IRQn + channel), (uint32_t)handle_interrupt_in);
-    NVIC_EnableIRQ((IRQn_Type)(PIN_INT0_IRQn + channel));
-#else
-    NVIC_SetVector((IRQn_Type)PIN_INT4_IRQn, (uint32_t)handle_interrupt_in);
-    NVIC_EnableIRQ((IRQn_Type)PIN_INT4_IRQn);
-#endif
-
-    // Increment channel number
-    channel++;
-    channel %= CHANNEL_NUM;
-
-    return 0;
-}
-
-void gpio_irq_free(gpio_irq_t *obj) {
-    channel_ids[obj->ch] = 0;
-}
-
-void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
-    uint32_t pmask;
-
-    /* Clear pending interrupts */
-    pmask = (1 << obj->ch);
-    LPC_GPIO_PIN_INT->IST = pmask;
-
-    /* Configure pin interrupt */
-    LPC_GPIO_PIN_INT->ISEL &= ~pmask;
-    if (event == IRQ_RISE) {
-        /* Rising edge interrupts */
-        if (enable) {
-            LPC_GPIO_PIN_INT->SIENR |= pmask;
-        } else {
-            LPC_GPIO_PIN_INT->CIENR |= pmask;
-        }
-    } else {
-        /* Falling edge interrupts */
-        if (enable) {
-            LPC_GPIO_PIN_INT->SIENF |= pmask;
-        } else {
-            LPC_GPIO_PIN_INT->CIENF |= pmask;
-        }
-    }
-}
-
-void gpio_irq_enable(gpio_irq_t *obj) {
-#if !defined(CORE_M0)
-    NVIC_EnableIRQ((IRQn_Type)(PIN_INT0_IRQn + obj->ch));
-#else
-    NVIC_EnableIRQ((IRQn_Type)(PIN_INT4_IRQn + obj->ch));
-#endif
-}
-
-void gpio_irq_disable(gpio_irq_t *obj) {
-#if !defined(CORE_M0)
-    NVIC_DisableIRQ((IRQn_Type)(PIN_INT0_IRQn + obj->ch));
-#else
-    NVIC_DisableIRQ((IRQn_Type)(PIN_INT4_IRQn + obj->ch));
-#endif
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC43XX/gpio_object.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_GPIO_OBJECT_H
-#define MBED_GPIO_OBJECT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
-    PinName  pin;
-    uint32_t mask;
-
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_set;
-    __IO uint32_t *reg_clr;
-    __I  uint32_t *reg_in;
-} gpio_t;
-
-static inline void gpio_write(gpio_t *obj, int value) {
-    if (value)
-        *obj->reg_set = obj->mask;
-    else
-        *obj->reg_clr = obj->mask;
-}
-
-static inline int gpio_read(gpio_t *obj) {
-    return ((*obj->reg_in & obj->mask) ? 1 : 0);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC43XX/objects.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_OBJECTS_H
-#define MBED_OBJECTS_H
-
-#include "cmsis.h"
-#include "PortNames.h"
-#include "PeripheralNames.h"
-#include "PinNames.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct gpio_irq_s {
-    uint32_t port;
-    uint32_t pin;
-    uint32_t ch;
-};
-
-struct port_s {
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_out;
-    __I  uint32_t *reg_in;
-    PortName port;
-    uint32_t mask;
-};
-
-struct pwmout_s {
-    __IO uint32_t *MR;
-    LPC_MCPWM_T *pwm;
-    uint32_t channel;
-};
-
-struct serial_s {
-    LPC_USART_T *uart;
-    int index;
-};
-
-struct analogin_s {
-    ADCName adc;
-};
-
-struct dac_s {
-    DACName dac;
-};
-
-struct can_s {
-    LPC_CCAN_T *dev;
-};
-
-struct i2c_s {
-    LPC_I2C_T *i2c;
-};
-
-struct spi_s {
-    LPC_SSP_T *spi;
-};
-
-#include "gpio_object.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC43XX/pinmap.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Ported to NXP LPC43XX by Micromint USA <support@micromint.com>
- */
-#include "pinmap.h"
-#include "error.h"
-
-void pin_function(PinName pin, int function) {
-    if (pin == (uint32_t)NC) return;
-
-    __IO uint32_t *reg = (__IO uint32_t*) MBED_SCU_REG(pin);
-
-    // Set pin function
-    *reg = function;
-}
-
-void pin_mode(PinName pin, PinMode mode) {
-    if (pin == (uint32_t)NC) { return; }
-
-    if (mode == OpenDrain) error("OpenDrain not supported on LPC43XX");
-
-    __IO uint32_t *reg = (__IO uint32_t*) MBED_SCU_REG(pin);
-    uint32_t tmp = *reg;
-    
-    // pin mode bits: [4:3] -> 11000 = (0x3 << 3)
-    tmp &= ~(0x3 << 3);
-    tmp |= (mode & 0x3) << 3;
-
-    *reg = tmp;
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC43XX/port_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Ported to NXP LPC43XX by Micromint USA <support@micromint.com>
- */
-#include "port_api.h"
-#include "pinmap.h"
-#include "gpio_api.h"
-
-PinName port_pin(PortName port, int pin_n) {
-    return (PinName)(LPC_GPIO_PORT_BASE + ((port << PORT_SHIFT) | pin_n));
-}
-
-void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
-    obj->port = port;
-    obj->mask = mask;
-    
-    LPC_GPIO_T *port_reg = (LPC_GPIO_T *)(LPC_GPIO_PORT_BASE + ((int)port << PORT_SHIFT));
-    
-    port_reg->MASK[port] = ~mask;
-    
-    obj->reg_out = &port_reg->PIN[port];
-    obj->reg_in  = &port_reg->PIN[port];
-    obj->reg_dir = &port_reg->DIR[port];
-	
-    uint32_t i;
-    // The function is set per pin: reuse gpio logic
-    for (i=0; i<32; i++) {
-        if (obj->mask & (1<<i)) {
-            gpio_set(port_pin(obj->port, i));
-        }
-    }
-    
-    port_dir(obj, dir);
-}
-
-void port_mode(port_t *obj, PinMode mode) {
-    uint32_t i;
-    // The mode is set per pin: reuse pinmap logic
-    for (i=0; i<32; i++) {
-        if (obj->mask & (1<<i)) {
-            pin_mode(port_pin(obj->port, i), mode);
-        }
-    }
-}
-
-void port_dir(port_t *obj, PinDirection dir) {
-    switch (dir) {
-        case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break;
-        case PIN_OUTPUT: *obj->reg_dir |=  obj->mask; break;
-    }
-}
-
-void port_write(port_t *obj, int value) {
-    *obj->reg_out = (*obj->reg_in & ~obj->mask) | (value & obj->mask);
-}
-
-int port_read(port_t *obj) {
-    return (*obj->reg_in & obj->mask);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC43XX/rtc_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Ported to NXP LPC43XX by Micromint USA <support@micromint.com>
- */
-#include "rtc_api.h"
-
-// ensure rtc is running (unchanged if already running)
-
-/* Setup the RTC based on a time structure, ensuring RTC is enabled
- *
- * Can be clocked by a 32.768KHz oscillator or prescale divider based on the APB clock
- * - We want to use the 32khz clock, allowing for sleep mode
- *
- * Most registers are not changed by a Reset
- * - We must initialize these registers between power-on and setting the RTC into operation
-
- * Clock Control Register
- *  RTC_CCR[0] : Enable - 0 = Disabled, 1 = Enabled
- *  RTC_CCR[1] : Reset - 0 = Normal, 1 = Reset
- *  RTC_CCR[4] : Clock Source - 0 = Prescaler, 1 = 32k Xtal
- *
- * The RTC may already be running, so we should set it up
- * without impacting if it is the case
- */
-void rtc_init(void) {
-    LPC_RTC->CCR = 0x00;
-
-    LPC_RTC->CCR |= 1 << 0; // Ensure the RTC is enabled
-}
-
-void rtc_free(void) {
-    // [TODO]
-}
-
-/*
- * Little check routine to see if the RTC has been enabled
- *
- * Clock Control Register
- *  RTC_CCR[0] : 0 = Disabled, 1 = Enabled
- *
- */
-int rtc_isenabled(void) {
-    return(((LPC_RTC->CCR) & 0x01) != 0);
-}
-
-/*
- * RTC Registers
- *  RTC_SEC        Seconds 0-59
- *  RTC_MIN        Minutes 0-59
- *  RTC_HOUR    Hour 0-23
- *  RTC_DOM        Day of Month 1-28..31
- *  RTC_DOW        Day of Week 0-6
- *  RTC_DOY        Day of Year 1-365
- *  RTC_MONTH    Month 1-12
- *  RTC_YEAR    Year 0-4095
- *
- * struct tm
- *  tm_sec        seconds after the minute 0-61
- *  tm_min        minutes after the hour 0-59
- *  tm_hour        hours since midnight 0-23
- *  tm_mday        day of the month 1-31
- *  tm_mon        months since January 0-11
- *  tm_year        years since 1900
- *  tm_wday        days since Sunday 0-6
- *  tm_yday        days since January 1 0-365
- *  tm_isdst    Daylight Saving Time flag
- */
-time_t rtc_read(void) {
-    // Setup a tm structure based on the RTC
-    struct tm timeinfo;
-    timeinfo.tm_sec = LPC_RTC->TIME[RTC_TIMETYPE_SECOND];
-    timeinfo.tm_min = LPC_RTC->TIME[RTC_TIMETYPE_MINUTE];
-    timeinfo.tm_hour = LPC_RTC->TIME[RTC_TIMETYPE_HOUR];
-    timeinfo.tm_mday = LPC_RTC->TIME[RTC_TIMETYPE_DAYOFMONTH];
-    timeinfo.tm_wday = LPC_RTC->TIME[RTC_TIMETYPE_DAYOFWEEK];
-    timeinfo.tm_yday = LPC_RTC->TIME[RTC_TIMETYPE_DAYOFYEAR];
-    timeinfo.tm_mon = LPC_RTC->TIME[RTC_TIMETYPE_MONTH] - 1;
-    timeinfo.tm_year = LPC_RTC->TIME[RTC_TIMETYPE_YEAR] - 1900;
-    
-    // Convert to timestamp
-    time_t t = mktime(&timeinfo);
-    
-    return t;
-}
-
-void rtc_write(time_t t) {
-    // Convert the time in to a tm
-    struct tm *timeinfo = localtime(&t);
-    
-    // Pause clock, and clear counter register (clears us count)
-    LPC_RTC->CCR |= 2;
-    
-    // Set the RTC
-    LPC_RTC->TIME[RTC_TIMETYPE_SECOND] = timeinfo->tm_sec;
-    LPC_RTC->TIME[RTC_TIMETYPE_MINUTE] = timeinfo->tm_min;
-    LPC_RTC->TIME[RTC_TIMETYPE_HOUR] = timeinfo->tm_hour;
-    LPC_RTC->TIME[RTC_TIMETYPE_DAYOFMONTH] = timeinfo->tm_mday;
-    LPC_RTC->TIME[RTC_TIMETYPE_DAYOFWEEK] = timeinfo->tm_wday;
-    LPC_RTC->TIME[RTC_TIMETYPE_DAYOFYEAR] = timeinfo->tm_yday;
-    LPC_RTC->TIME[RTC_TIMETYPE_MONTH] = timeinfo->tm_mon + 1;
-    LPC_RTC->TIME[RTC_TIMETYPE_YEAR] = timeinfo->tm_year + 1900;
-    
-    // Restart clock
-    LPC_RTC->CCR &= ~((uint32_t)2);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC43XX/serial_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,287 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Ported to NXP LPC43XX by Micromint USA <support@micromint.com>
- */
-// math.h required for floating point operations for baud rate calculation
-#include <math.h>
-#include <string.h>
-
-#include "serial_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-/******************************************************************************
- * INITIALIZATION
- ******************************************************************************/
-static const PinMap PinMap_UART_TX[] = {
-    {UART0_TX, UART_0, (SCU_PINIO_PULLDOWN | 2)},
-    {UART1_TX, UART_1, (SCU_PINIO_PULLDOWN | 4)},
-    {UART2_TX, UART_2, (SCU_PINIO_PULLDOWN | 2)},
-    {UART3_TX, UART_3, (SCU_PINIO_PULLDOWN | 2)},
-    {NC        , NC    , 0}
-};
-
-static const PinMap PinMap_UART_RX[] = {
-    {UART0_RX, UART_0, (SCU_PINIO_PULLDOWN | 2)},
-    {UART1_RX, UART_1, (SCU_PINIO_PULLDOWN | 1)},
-    {UART2_RX, UART_2, (SCU_PINIO_PULLDOWN | 2)},
-    {UART3_RX, UART_3, (SCU_PINIO_PULLDOWN | 2)},
-    {NC        , NC    , 0}
-};
-
-#define UART_NUM    4
-
-static uint32_t serial_irq_ids[UART_NUM] = {0};
-static uart_irq_handler irq_handler;
-
-int stdio_uart_inited = 0;
-serial_t stdio_uart;
-
-void serial_init(serial_t *obj, PinName tx, PinName rx) {
-    int is_stdio_uart = 0;
-    
-    // determine the UART to use
-    UARTName uart_tx = (UARTName)pinmap_peripheral(tx, PinMap_UART_TX);
-    UARTName uart_rx = (UARTName)pinmap_peripheral(rx, PinMap_UART_RX);
-    UARTName uart = (UARTName)pinmap_merge(uart_tx, uart_rx);
-    if ((int)uart == NC) {
-        error("Serial pinout mapping failed");
-    }
-
-    obj->uart = (LPC_USART_T *)uart;
-
-    // enable fifos and default rx trigger level
-    obj->uart->FCR = 1 << 0  // FIFO Enable - 0 = Disables, 1 = Enabled
-                   | 0 << 1  // Rx Fifo Reset
-                   | 0 << 2  // Tx Fifo Reset
-                   | 0 << 6; // Rx irq trigger level - 0 = 1 char, 1 = 4 chars, 2 = 8 chars, 3 = 14 chars
-
-    // disable irqs
-    obj->uart->IER = 0 << 0  // Rx Data available irq enable
-                   | 0 << 1  // Tx Fifo empty irq enable
-                   | 0 << 2; // Rx Line Status irq enable
-    
-    // set default baud rate and format
-    serial_baud  (obj, 9600);
-    serial_format(obj, 8, ParityNone, 1);
-    
-    // pinout the chosen uart
-    pinmap_pinout(tx, PinMap_UART_TX);
-    pinmap_pinout(rx, PinMap_UART_RX);
-    
-    // set rx/tx pins in PullUp mode
-    pin_mode(tx, PullUp);
-    pin_mode(rx, PullUp);
-    
-    switch (uart) {
-        case UART_0: obj->index = 0; break;
-        case UART_1: obj->index = 1; break;
-        case UART_2: obj->index = 2; break;
-#if (UART_NUM > 3)
-        case UART_3: obj->index = 3; break;
-#endif
-#if (UART_NUM > 4)
-        case UART_4: obj->index = 4; break;
-#endif
-    }
-    
-    is_stdio_uart = (uart == STDIO_UART) ? (1) : (0);
-    
-    if (is_stdio_uart) {
-        stdio_uart_inited = 1;
-        memcpy(&stdio_uart, obj, sizeof(serial_t));
-    }
-}
-
-void serial_free(serial_t *obj) {
-    serial_irq_ids[obj->index] = 0;
-}
-
-// serial_baud
-// set the baud rate, taking in to account the current SystemFrequency
-void serial_baud(serial_t *obj, int baudrate) {
-    uint32_t PCLK = SystemCoreClock;
-
-    // First we check to see if the basic divide with no DivAddVal/MulVal
-    // ratio gives us an integer result. If it does, we set DivAddVal = 0,
-    // MulVal = 1. Otherwise, we search the valid ratio value range to find
-    // the closest match. This could be more elegant, using search methods
-    // and/or lookup tables, but the brute force method is not that much
-    // slower, and is more maintainable.
-    uint16_t DL = PCLK / (16 * baudrate);
-
-    uint8_t DivAddVal = 0;
-    uint8_t MulVal = 1;
-    int hit = 0;
-    uint16_t dlv;
-    uint8_t mv, dav;
-    if ((PCLK % (16 * baudrate)) != 0) {     // Checking for zero remainder
-        float err_best = (float) baudrate;
-        uint16_t dlmax = DL;
-        for ( dlv = (dlmax/2); (dlv <= dlmax) && !hit; dlv++) {
-            for ( mv = 1; mv <= 15; mv++) {
-                for ( dav = 1; dav < mv; dav++) {
-                    float ratio = 1.0f + ((float) dav / (float) mv);
-                    float calcbaud = (float)PCLK / (16.0f * (float) dlv * ratio);
-                    float err = fabs(((float) baudrate - calcbaud) / (float) baudrate);
-                    if (err < err_best) {
-                        DL = dlv;
-                        DivAddVal = dav;
-                        MulVal = mv;
-                        err_best = err;
-                        if (err < 0.001f) {
-                            hit = 1;
-                        }
-                    }
-                }
-            }
-        }
-    }
-    
-    // set LCR[DLAB] to enable writing to divider registers
-    obj->uart->LCR |= (1 << 7);
-    
-    // set divider values
-    obj->uart->DLM = (DL >> 8) & 0xFF;
-    obj->uart->DLL = (DL >> 0) & 0xFF;
-    obj->uart->FDR = (uint32_t) DivAddVal << 0
-                   | (uint32_t) MulVal    << 4;
-    
-    // clear LCR[DLAB]
-    obj->uart->LCR &= ~(1 << 7);
-}
-
-void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits) {
-    // 0: 1 stop bits, 1: 2 stop bits
-    if (stop_bits != 1 && stop_bits != 2) {
-        error("Invalid stop bits specified");
-    }
-    stop_bits -= 1;
-    
-    // 0: 5 data bits ... 3: 8 data bits
-    if (data_bits < 5 || data_bits > 8) {
-        error("Invalid number of bits (%d) in serial format, should be 5..8", data_bits);
-    }
-    data_bits -= 5;
-
-    int parity_enable, parity_select;
-    switch (parity) {
-        case ParityNone: parity_enable = 0; parity_select = 0; break;
-        case ParityOdd : parity_enable = 1; parity_select = 0; break;
-        case ParityEven: parity_enable = 1; parity_select = 1; break;
-        case ParityForced1: parity_enable = 1; parity_select = 2; break;
-        case ParityForced0: parity_enable = 1; parity_select = 3; break;
-        default:
-            error("Invalid serial parity setting");
-            return;
-    }
-    
-    obj->uart->LCR = data_bits            << 0
-                   | stop_bits            << 2
-                   | parity_enable        << 3
-                   | parity_select        << 4;
-}
-
-/******************************************************************************
- * INTERRUPTS HANDLING
- ******************************************************************************/
-static inline void uart_irq(uint32_t iir, uint32_t index) {
-    // [Chapter 14] LPC17xx UART0/2/3: UARTn Interrupt Handling
-    SerialIrq irq_type;
-    switch (iir) {
-        case 1: irq_type = TxIrq; break;
-        case 2: irq_type = RxIrq; break;
-        default: return;
-    }
-    
-    if (serial_irq_ids[index] != 0)
-        irq_handler(serial_irq_ids[index], irq_type);
-}
-
-void uart0_irq() {uart_irq((LPC_USART0->IIR >> 1) & 0x7, 0);}
-void uart1_irq() {uart_irq((LPC_UART1->IIR >> 1) & 0x7, 1);}
-void uart2_irq() {uart_irq((LPC_USART2->IIR >> 1) & 0x7, 2);}
-void uart3_irq() {uart_irq((LPC_USART3->IIR >> 1) & 0x7, 3);}
-
-void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id) {
-    irq_handler = handler;
-    serial_irq_ids[obj->index] = id;
-}
-
-void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) {
-    IRQn_Type irq_n = (IRQn_Type)0;
-    uint32_t vector = 0;
-    switch ((int)obj->uart) {
-        case UART_0: irq_n=USART0_IRQn; vector = (uint32_t)&uart0_irq; break;
-        case UART_1: irq_n=UART1_IRQn; vector = (uint32_t)&uart1_irq; break;
-        case UART_2: irq_n=USART2_IRQn; vector = (uint32_t)&uart2_irq; break;
-        case UART_3: irq_n=USART3_IRQn; vector = (uint32_t)&uart3_irq; break;
-    }
-    
-    if (enable) {
-        obj->uart->IER |= 1 << irq;
-        NVIC_SetVector(irq_n, vector);
-        NVIC_EnableIRQ(irq_n);
-    } else { // disable
-        int all_disabled = 0;
-        SerialIrq other_irq = (irq == RxIrq) ? (TxIrq) : (RxIrq);
-        obj->uart->IER &= ~(1 << irq);
-        all_disabled = (obj->uart->IER & (1 << other_irq)) == 0;
-        if (all_disabled)
-            NVIC_DisableIRQ(irq_n);
-    }
-}
-
-/******************************************************************************
- * READ/WRITE
- ******************************************************************************/
-int serial_getc(serial_t *obj) {
-    while (!serial_readable(obj));
-    return obj->uart->RBR;
-}
-
-void serial_putc(serial_t *obj, int c) {
-    while (!serial_writable(obj));
-    obj->uart->THR = c;
-}
-
-int serial_readable(serial_t *obj) {
-    return obj->uart->LSR & 0x01;
-}
-
-int serial_writable(serial_t *obj) {
-    return obj->uart->LSR & 0x20;
-}
-
-void serial_clear(serial_t *obj) {
-    obj->uart->FCR = 1 << 1  // rx FIFO reset
-                   | 1 << 2  // tx FIFO reset
-                   | 0 << 6; // interrupt depth
-}
-
-void serial_pinout_tx(PinName tx) {
-    pinmap_pinout(tx, PinMap_UART_TX);
-}
-
-void serial_break_set(serial_t *obj) {
-    obj->uart->LCR |= (1 << 6);
-}
-
-void serial_break_clear(serial_t *obj) {
-    obj->uart->LCR &= ~(1 << 6);
-}
-
--- a/targets/hal/TARGET_NXP/TARGET_LPC43XX/sleep.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Ported to NXP LPC43XX by Micromint USA <support@micromint.com>
- */
-#include "sleep_api.h"
-#include "cmsis.h"
-#include "mbed_interface.h"
-
-void sleep(void) {
-    
-    // SRC[SLEEPDEEP] set to 0 = sleep
-    SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk;
-    
-    // wait for interrupt
-    __WFI();
-}
-
-/*
- *  ToDo: Implement deepsleep()
- */
-void deepsleep(void) {
-    sleep();
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC43XX/spi_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Ported to NXP LPC43XX by Micromint USA <support@micromint.com>
- */
-#include <math.h>
-
-#include "spi_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_SPI_SCLK[] = {
-    {P3_0 , SPI_0, (SCU_PINIO_FAST | 2)},
-    {PF_4 , SPI_1, (SCU_PINIO_FAST | 2)},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_MOSI[] = {
-    {P1_2 , SPI_0, (SCU_PINIO_FAST | 2)},
-    {P1_4 , SPI_1, (SCU_PINIO_FAST | 2)},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_MISO[] = {
-    {P1_1 , SPI_0, (SCU_PINIO_FAST | 2)},
-    {P1_3 , SPI_1, (SCU_PINIO_FAST | 2)},
-    {NC   , NC   , 0}
-};
-
-static const PinMap PinMap_SPI_SSEL[] = {
-    {P1_0 , SPI_0, (SCU_PINIO_FAST | 2)},
-    {P1_5 , SPI_1, (SCU_PINIO_FAST | 2)},
-    {NC   , NC   , 0}
-};
-
-static inline int ssp_disable(spi_t *obj);
-static inline int ssp_enable(spi_t *obj);
-
-void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel) {
-    // determine the SPI to use
-    SPIName spi_mosi = (SPIName)pinmap_peripheral(mosi, PinMap_SPI_MOSI);
-    SPIName spi_miso = (SPIName)pinmap_peripheral(miso, PinMap_SPI_MISO);
-    SPIName spi_sclk = (SPIName)pinmap_peripheral(sclk, PinMap_SPI_SCLK);
-    SPIName spi_ssel = (SPIName)pinmap_peripheral(ssel, PinMap_SPI_SSEL);
-    SPIName spi_data = (SPIName)pinmap_merge(spi_mosi, spi_miso);
-    SPIName spi_cntl = (SPIName)pinmap_merge(spi_sclk, spi_ssel);
-
-    obj->spi = (LPC_SSP_T*)pinmap_merge(spi_data, spi_cntl);
-    if ((int)obj->spi == NC) {
-        error("SPI pinout mapping failed");
-    }
-
-    // set default format and frequency
-    if (ssel == NC) {
-        spi_format(obj, 8, 0, 0);  // 8 bits, mode 0, master
-    } else {
-        spi_format(obj, 8, 0, 1);  // 8 bits, mode 0, slave
-    }
-    spi_frequency(obj, 1000000);
-    
-    // enable the ssp channel
-    ssp_enable(obj);
-    
-    // pin out the spi pins
-    pinmap_pinout(mosi, PinMap_SPI_MOSI);
-    pinmap_pinout(miso, PinMap_SPI_MISO);
-    pinmap_pinout(sclk, PinMap_SPI_SCLK);
-    if (ssel != NC) {
-        pinmap_pinout(ssel, PinMap_SPI_SSEL);
-    }
-}
-
-void spi_free(spi_t *obj) {}
-
-void spi_format(spi_t *obj, int bits, int mode, int slave) {
-    ssp_disable(obj);
-    
-    if (!(bits >= 4 && bits <= 16) || !(mode >= 0 && mode <= 3)) {
-        error("SPI format error");
-    }
-    
-    int polarity = (mode & 0x2) ? 1 : 0;
-    int phase = (mode & 0x1) ? 1 : 0;
-    
-    // set it up
-    int DSS = bits - 1;            // DSS (data select size)
-    int SPO = (polarity) ? 1 : 0;  // SPO - clock out polarity
-    int SPH = (phase) ? 1 : 0;     // SPH - clock out phase
-    
-    int FRF = 0;                   // FRF (frame format) = SPI
-    uint32_t tmp = obj->spi->CR0;
-    tmp &= ~(0xFFFF);
-    tmp |= DSS << 0
-        | FRF << 4
-        | SPO << 6
-        | SPH << 7;
-    obj->spi->CR0 = tmp;
-    
-    tmp = obj->spi->CR1;
-    tmp &= ~(0xD);
-    tmp |= 0 << 0                   // LBM - loop back mode - off
-        | ((slave) ? 1 : 0) << 2   // MS - master slave mode, 1 = slave
-        | 0 << 3;                  // SOD - slave output disable - na
-    obj->spi->CR1 = tmp;
-    ssp_enable(obj);
-}
-
-void spi_frequency(spi_t *obj, int hz) {
-    ssp_disable(obj);
-    
-    uint32_t PCLK = SystemCoreClock;
-    
-    int prescaler;
-    
-    for (prescaler = 2; prescaler <= 254; prescaler += 2) {
-        int prescale_hz = PCLK / prescaler;
-        
-        // calculate the divider
-        int divider = floor(((float)prescale_hz / (float)hz) + 0.5f);
-        
-        // check we can support the divider
-        if (divider < 256) {
-            // prescaler
-            obj->spi->CPSR = prescaler;
-            
-            // divider
-            obj->spi->CR0 &= ~(0xFFFF << 8);
-            obj->spi->CR0 |= (divider - 1) << 8;
-            ssp_enable(obj);
-            return;
-        }
-    }
-    error("Couldn't setup requested SPI frequency");
-}
-
-static inline int ssp_disable(spi_t *obj) {
-    return obj->spi->CR1 &= ~(1 << 1);
-}
-
-static inline int ssp_enable(spi_t *obj) {
-    return obj->spi->CR1 |= (1 << 1);
-}
-
-static inline int ssp_readable(spi_t *obj) {
-    return obj->spi->SR & (1 << 2);
-}
-
-static inline int ssp_writeable(spi_t *obj) {
-    return obj->spi->SR & (1 << 1);
-}
-
-static inline void ssp_write(spi_t *obj, int value) {
-    while (!ssp_writeable(obj));
-    obj->spi->DR = value;
-}
-
-static inline int ssp_read(spi_t *obj) {
-    while (!ssp_readable(obj));
-    return obj->spi->DR;
-}
-
-static inline int ssp_busy(spi_t *obj) {
-    return (obj->spi->SR & (1 << 4)) ? (1) : (0);
-}
-
-int spi_master_write(spi_t *obj, int value) {
-    ssp_write(obj, value);
-    return ssp_read(obj);
-}
-
-int spi_slave_receive(spi_t *obj) {
-    return (ssp_readable(obj) && !ssp_busy(obj)) ? (1) : (0);
-};
-
-int spi_slave_read(spi_t *obj) {
-    return obj->spi->DR;
-}
-
-void spi_slave_write(spi_t *obj, int value) {
-    while (ssp_writeable(obj) == 0) ;
-    obj->spi->DR = value;
-}
-
-int spi_busy(spi_t *obj) {
-    return ssp_busy(obj);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC43XX/us_ticker.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Ported to NXP LPC43XX by Micromint USA <support@micromint.com>
- */
-#include <stddef.h>
-#include "us_ticker_api.h"
-#include "PeripheralNames.h"
-
-#define US_TICKER_TIMER      ((LPC_TIMER_T *)LPC_TIMER3_BASE)
-#define US_TICKER_TIMER_IRQn TIMER3_IRQn
-
-int us_ticker_inited = 0;
-
-void us_ticker_init(void) {
-    if (us_ticker_inited) return;
-    us_ticker_inited = 1;
-    
-    US_TICKER_TIMER->CTCR = 0x0; // timer mode
-    uint32_t PCLK = SystemCoreClock;
-
-    US_TICKER_TIMER->TCR = 0x2;  // reset
-    
-    uint32_t prescale = PCLK / 1000000; // default to 1MHz (1 us ticks)
-    US_TICKER_TIMER->PR = prescale - 1;
-    US_TICKER_TIMER->TCR = 1; // enable = 1, reset = 0
-    
-    NVIC_SetVector(US_TICKER_TIMER_IRQn, (uint32_t)us_ticker_irq_handler);
-    NVIC_EnableIRQ(US_TICKER_TIMER_IRQn);
-}
-
-uint32_t us_ticker_read() {
-    if (!us_ticker_inited)
-        us_ticker_init();
-    
-    return US_TICKER_TIMER->TC;
-}
-
-void us_ticker_set_interrupt(unsigned int timestamp) {
-    // set match value
-    US_TICKER_TIMER->MR[3] = timestamp;
-    // enable match interrupt
-    US_TICKER_TIMER->MCR |= 1;
-}
-
-void us_ticker_disable_interrupt(void) {
-    US_TICKER_TIMER->MCR &= ~1;
-}
-
-void us_ticker_clear_interrupt(void) {
-    US_TICKER_TIMER->IR = 1;
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC810/PinNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PINNAMES_H
-#define MBED_PINNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    PIN_INPUT,
-    PIN_OUTPUT
-} PinDirection;
-
-typedef enum {
-    P0_0 = 0,
-    P0_1 = 1,
-    P0_2 = 2,
-    P0_3 = 3,
-    P0_4 = 4,
-    P0_5 = 5,
-    
-    dp1 = P0_5,
-    dp2 = P0_4,
-    dp3 = P0_3,
-    dp4 = P0_2,
-    dp5 = P0_1,
-    dp8 = P0_0,
-    
-    // mbed original LED naming
-    LED1 = P0_2,
-    LED2 = P0_2,
-    LED3 = P0_2,
-    LED4 = P0_2,
-    LED_RED = P0_2,
-    
-    // Serial to USB pins
-    USBTX = P0_4,
-    USBRX = P0_0,
-    
-    // Not connected
-    NC = (int)0xFFFFFFFF,
-} PinName;
-
-typedef enum {
-    PullUp = 2,
-    PullDown = 1,
-    PullNone = 0,
-    Repeater = 3,
-    OpenDrain = 4
-} PinMode;
-
-#define STDIO_UART_TX     USBTX
-#define STDIO_UART_RX     USBRX
-
-typedef struct {
-    unsigned char n;
-    unsigned char offset;
-} SWM_Map;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC812/PinNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PINNAMES_H
-#define MBED_PINNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    PIN_INPUT,
-    PIN_OUTPUT
-} PinDirection;
-
-typedef enum {
-    P0_0 = 0,
-    P0_1 = 1,
-    P0_2 = 2,
-    P0_3 = 3,
-    P0_4 = 4,
-    P0_5 = 5,
-    P0_6 = 6,
-    P0_7 = 7,
-    P0_8 = 8,
-    P0_9 = 9,
-    P0_10 = 10,
-    P0_11 = 11,
-    P0_12 = 12,
-    P0_13 = 13,
-    P0_14 = 14,
-    P0_15 = 15,
-    P0_16 = 16,
-    P0_17 = 17,
-    
-    D0 = P0_0,
-    D1 = P0_4,
-    D2 = P0_6,
-    D3 = P0_8,
-    D4 = P0_9,
-    
-    D7 = P0_7,
-    D8 = P0_17,
-    D9 = P0_16,
-    D10 = P0_13,
-    D11 = P0_14,
-    D12 = P0_15,
-    D13 = P0_12,
-    
-    A4 = P0_10,
-    A5 = P0_11,
-    
-    // LPC800-MAX board
-    LED_RED = P0_7,
-    LED_GREEN = P0_17,
-    LED_BLUE = P0_16,
-    
-    // mbed original LED naming
-    LED1 = LED_BLUE,
-    LED2 = LED_GREEN,
-    LED3 = LED_RED,
-    LED4 = LED_RED,
-    
-    // Serial to USB pins
-    USBTX = P0_6,
-    USBRX = P0_1,
-    
-    // Not connected
-    NC = (int)0xFFFFFFFF,
-} PinName;
-
-typedef enum {
-    PullUp = 2,
-    PullDown = 1,
-    PullNone = 0,
-    Repeater = 3,
-    OpenDrain = 4
-} PinMode;
-
-#define STDIO_UART_TX     USBTX
-#define STDIO_UART_RX     USBRX
-
-typedef struct {
-    unsigned char n;
-    unsigned char offset;
-} SWM_Map;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/PeripheralNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/PortNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PORTNAMES_H
-#define MBED_PORTNAMES_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    Port0 = 0,
-} PortName;
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/device.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_DEVICE_H
-#define MBED_DEVICE_H
-
-#define DEVICE_PORTIN           0
-#define DEVICE_PORTOUT          0
-#define DEVICE_PORTINOUT        0
-
-#define DEVICE_INTERRUPTIN      1
-
-#define DEVICE_ANALOGIN         0
-#define DEVICE_ANALOGOUT        0
-
-#define DEVICE_SERIAL           1
-
-#define DEVICE_I2C              1
-#define DEVICE_I2CSLAVE         0
-
-#define DEVICE_SPI              1
-#define DEVICE_SPISLAVE         0
-
-#define DEVICE_CAN              0
-
-#define DEVICE_RTC              0
-
-#define DEVICE_ETHERNET         0
-
-#define DEVICE_PWMOUT           0
-
-#define DEVICE_SEMIHOST         0
-#define DEVICE_LOCALFILESYSTEM  0
-
-#define DEVICE_SLEEP            0
-
-#define DEVICE_DEBUG_AWARENESS  0
-
-#define DEVICE_STDIO_MESSAGES   0
-
-#define DEVICE_ERROR_RED        1
-
-#include "objects.h"
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/gpio_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "gpio_api.h"
-#include "pinmap.h"
-
-static int  gpio_enabled = 0;
-static void gpio_enable(void) {
-    gpio_enabled = 1;
-    
-    /* Enable AHB clock to the GPIO domain. */
-    LPC_SYSCON->SYSAHBCLKCTRL |= (1<<6);
-    
-    /* Peripheral reset control to GPIO and GPIO INT, a "1" bring it out of reset. */
-    LPC_SYSCON->PRESETCTRL &= ~(0x1<<10);
-    LPC_SYSCON->PRESETCTRL |=  (0x1<<10);
-}
-
-uint32_t gpio_set(PinName pin) {
-    int f = 0;
-    
-    if (!gpio_enabled)
-         gpio_enable();
-    
-    pin_function(pin, f);
-    
-    return (1 << ((int)pin & 0x1F));
-}
-
-void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) {
-    if(pin == NC) return;
-    
-    obj->pin = pin;
-    obj->mask = gpio_set(pin);
-    
-    obj->reg_set = &LPC_GPIO_PORT->SET0;
-    obj->reg_clr = &LPC_GPIO_PORT->CLR0;
-    obj->reg_in  = &LPC_GPIO_PORT->PIN0;
-    obj->reg_dir = &LPC_GPIO_PORT->DIR0;
-    
-    gpio_dir(obj, direction);
-    switch (direction) {
-        case PIN_OUTPUT: pin_mode(pin, PullNone); break;
-        case PIN_INPUT : pin_mode(pin, PullDown); break;
-    }
-}
-
-void gpio_mode(gpio_t *obj, PinMode mode) {
-    pin_mode(obj->pin, mode);
-}
-
-void gpio_dir(gpio_t *obj, PinDirection direction) {
-    switch (direction) {
-        case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break;
-        case PIN_OUTPUT: *obj->reg_dir |=  obj->mask; break;
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/gpio_irq_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stddef.h>
-
-#include "cmsis.h"
-#include "gpio_irq_api.h"
-#include "error.h"
-
-#define CHANNEL_NUM    8
-#define LPC_GPIO_X LPC_PIN_INT
-#define PININT_IRQ PININT0_IRQn
-
-static uint32_t channel_ids[CHANNEL_NUM] = {0};
-static gpio_irq_handler irq_handler;
-
-static inline void handle_interrupt_in(uint32_t channel) {
-    uint32_t ch_bit = (1 << channel);
-    // Return immediately if:
-    //   * The interrupt was already served
-    //   * There is no user handler
-    //   * It is a level interrupt, not an edge interrupt
-    if ( ((LPC_GPIO_X->IST & ch_bit) == 0) ||
-         (channel_ids[channel] == 0      ) ||
-         (LPC_GPIO_X->ISEL & ch_bit      ) ) return;
-
-    if ((LPC_GPIO_X->IENR & ch_bit) && (LPC_GPIO_X->RISE & ch_bit)) {
-        irq_handler(channel_ids[channel], IRQ_RISE);
-        LPC_GPIO_X->RISE = ch_bit;
-    }
-    if ((LPC_GPIO_X->IENF & ch_bit) && (LPC_GPIO_X->FALL & ch_bit)) {
-        irq_handler(channel_ids[channel], IRQ_FALL);
-    }
-    LPC_GPIO_X->IST = ch_bit;
-}
-
-void gpio_irq0(void) {handle_interrupt_in(0);}
-void gpio_irq1(void) {handle_interrupt_in(1);}
-void gpio_irq2(void) {handle_interrupt_in(2);}
-void gpio_irq3(void) {handle_interrupt_in(3);}
-void gpio_irq4(void) {handle_interrupt_in(4);}
-void gpio_irq5(void) {handle_interrupt_in(5);}
-void gpio_irq6(void) {handle_interrupt_in(6);}
-void gpio_irq7(void) {handle_interrupt_in(7);}
-
-int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id) {
-    if (pin == NC) return -1;
-    
-    irq_handler = handler;
-    
-    int found_free_channel = 0;
-    int i = 0;
-    for (i=0; i<CHANNEL_NUM; i++) {
-        if (channel_ids[i] == 0) {
-            channel_ids[i] = id;
-            obj->ch = i;
-            found_free_channel = 1;
-            break;
-        }
-    }
-    if (!found_free_channel) return -1;
-
-    /* Enable AHB clock to the GPIO domain. */
-    LPC_SYSCON->SYSAHBCLKCTRL |= (1<<6);
-    
-    LPC_SYSCON->PINTSEL[obj->ch] = pin;
-    
-    // Interrupt Wake-Up Enable
-    LPC_SYSCON->STARTERP0 |= 1 << obj->ch;
-    
-    void (*channels_irq)(void) = NULL;
-    switch (obj->ch) {
-        case 0: channels_irq = &gpio_irq0; break;
-        case 1: channels_irq = &gpio_irq1; break;
-        case 2: channels_irq = &gpio_irq2; break;
-        case 3: channels_irq = &gpio_irq3; break;
-        case 4: channels_irq = &gpio_irq4; break;
-        case 5: channels_irq = &gpio_irq5; break;
-        case 6: channels_irq = &gpio_irq6; break;
-        case 7: channels_irq = &gpio_irq7; break;
-    }
-    NVIC_SetVector((IRQn_Type)(PININT_IRQ + obj->ch), (uint32_t)channels_irq);
-    NVIC_EnableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
-    
-    return 0;
-}
-
-void gpio_irq_free(gpio_irq_t *obj) {
-    channel_ids[obj->ch] = 0;
-    LPC_SYSCON->STARTERP0 &= ~(1 << obj->ch);
-}
-
-void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
-    unsigned int ch_bit = (1 << obj->ch);
-    
-    // Clear interrupt
-    if (!(LPC_GPIO_X->ISEL & ch_bit))
-        LPC_GPIO_X->IST = ch_bit;
-    
-    // Edge trigger
-    LPC_GPIO_X->ISEL &= ~ch_bit;
-    if (event == IRQ_RISE) {
-        if (enable) {
-            LPC_GPIO_X->IENR |= ch_bit;
-        } else {
-            LPC_GPIO_X->IENR &= ~ch_bit;
-        }
-    } else {
-        if (enable) {
-            LPC_GPIO_X->IENF |= ch_bit;
-        } else {
-            LPC_GPIO_X->IENF &= ~ch_bit;
-        }
-    }
-}
-
-void gpio_irq_enable(gpio_irq_t *obj) {
-    NVIC_EnableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
-}
-
-void gpio_irq_disable(gpio_irq_t *obj) {
-    NVIC_DisableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/gpio_object.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_GPIO_OBJECT_H
-#define MBED_GPIO_OBJECT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
-    PinName  pin;
-    uint32_t mask;
-
-    __IO uint32_t *reg_dir;
-    __IO uint32_t *reg_set;
-    __IO uint32_t *reg_clr;
-    __I  uint32_t *reg_in;
-} gpio_t;
-
-static inline void gpio_write(gpio_t *obj, int value) {
-    if (value)
-        *obj->reg_set = obj->mask;
-    else
-        *obj->reg_clr = obj->mask;
-}
-
-static inline int gpio_read(gpio_t *obj) {
-    return ((*obj->reg_in & obj->mask) ? 1 : 0);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/i2c_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,242 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "i2c_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const SWM_Map SWM_I2C_SDA[] = {
-    {7, 24},
-};
-
-static const SWM_Map SWM_I2C_SCL[] = {
-    {8, 0},
-};
-
-static uint8_t repeated_start = 0;
-
-#define I2C_DAT(x)          (x->i2c->MSTDAT)
-#define I2C_STAT(x)         ((x->i2c->STAT >> 1) & (0x07))
-
-static inline int i2c_status(i2c_t *obj) {
-    return I2C_STAT(obj);
-}
-
-// Wait until the Serial Interrupt (SI) is set
-static int i2c_wait_SI(i2c_t *obj) {
-    int timeout = 0;
-    while (!(obj->i2c->STAT & (1 << 0))) {
-        timeout++;
-        if (timeout > 100000) return -1;
-    }
-    return 0;
-}
-
-static inline void i2c_interface_enable(i2c_t *obj) {
-    obj->i2c->CFG |= (1 << 0);
-}
-
-static inline void i2c_power_enable(i2c_t *obj) {
-    LPC_SYSCON->SYSAHBCLKCTRL |= (1<<5);	
-    LPC_SYSCON->PRESETCTRL &= ~(0x1<<6);
-    LPC_SYSCON->PRESETCTRL |= (0x1<<6);
-}
-
-void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
-    obj->i2c = (LPC_I2C_TypeDef *)LPC_I2C;
-    
-    const SWM_Map *swm;
-    uint32_t regVal;
-    
-    swm = &SWM_I2C_SDA[0];
-    regVal = LPC_SWM->PINASSIGN[swm->n] & ~(0xFF << swm->offset);
-    LPC_SWM->PINASSIGN[swm->n] = regVal |  (sda   << swm->offset);
-    
-    swm = &SWM_I2C_SCL[0];
-    regVal = LPC_SWM->PINASSIGN[swm->n] & ~(0xFF << swm->offset);
-    LPC_SWM->PINASSIGN[swm->n] = regVal |  (scl   << swm->offset);
-    
-    // enable power
-    i2c_power_enable(obj);
-    // set default frequency at 100k
-    i2c_frequency(obj, 100000);
-    i2c_interface_enable(obj);
-}
-
-inline int i2c_start(i2c_t *obj) {
-    int status = 0;
-    if (repeated_start) {
-        obj->i2c->MSTCTL = (1 << 1) | (1 << 0);
-        repeated_start = 0;
-    } else {
-        obj->i2c->MSTCTL = (1 << 1);
-    }
-    return status;
-}
-
-inline int i2c_stop(i2c_t *obj) {
-    int timeout = 0;
-
-    obj->i2c->MSTCTL = (1 << 2) | (1 << 0);
-    while ((obj->i2c->STAT & ((1 << 0) | (7 << 1))) != ((1 << 0) | (0 << 1))) {
-        timeout ++;
-        if (timeout > 100000) return 1;
-    }
-
-    return 0;
-}
-
-
-static inline int i2c_do_write(i2c_t *obj, int value, uint8_t addr) {
-    // write the data
-    I2C_DAT(obj) = value;
-    
-    if (!addr)
-        obj->i2c->MSTCTL = (1 << 0);
-    
-    // wait and return status
-    i2c_wait_SI(obj);
-    return i2c_status(obj);
-}
-
-static inline int i2c_do_read(i2c_t *obj, int last) {
-    // wait for it to arrive
-    i2c_wait_SI(obj);
-    if (!last)
-        obj->i2c->MSTCTL = (1 << 0);
-    
-    // return the data
-    return (I2C_DAT(obj) & 0xFF);
-}
-
-void i2c_frequency(i2c_t *obj, int hz) {
-    // No peripheral clock divider on the M0
-    uint32_t PCLK = SystemCoreClock;
-    
-    uint32_t clkdiv = PCLK / (hz * 4) - 1;
-    
-    obj->i2c->DIV = clkdiv;
-    obj->i2c->MSTTIME = 0;
-}
-
-// The I2C does a read or a write as a whole operation
-// There are two types of error conditions it can encounter
-//  1) it can not obtain the bus
-//  2) it gets error responses at part of the transmission
-//
-// We tackle them as follows:
-//  1) we retry until we get the bus. we could have a "timeout" if we can not get it
-//      which basically turns it in to a 2)
-//  2) on error, we use the standard error mechanisms to report/debug
-//
-// Therefore an I2C transaction should always complete. If it doesn't it is usually
-// because something is setup wrong (e.g. wiring), and we don't need to programatically
-// check for that
-
-int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) {
-    int count, status;
-    
-    i2c_start(obj);
-    
-    status = i2c_do_write(obj, (address | 0x01), 1);
-    if (status != 0x01) {
-        i2c_stop(obj);
-        return I2C_ERROR_NO_SLAVE;
-    }
-    
-    // Read in all except last byte
-    for (count = 0; count < (length - 1); count++) {
-        int value = i2c_do_read(obj, 0);
-        status = i2c_status(obj);
-        if (status != 0x00) {
-            i2c_stop(obj);
-            return count;
-        }
-        data[count] = (char) value;
-    }
-    
-    // read in last byte
-    int value = i2c_do_read(obj, 1);
-    status = i2c_status(obj);
-    if (status != 0x01) {
-        i2c_stop(obj);
-        return length - 1;
-    }
-    
-    data[count] = (char) value;
-    
-    // If not repeated start, send stop.
-    if (stop) {
-        i2c_stop(obj);
-    } else {
-        repeated_start = 1;
-    }
-    
-    return length;
-}
-
-int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) {
-    int i, status;
-    
-    i2c_start(obj);
-    
-    status = i2c_do_write(obj, (address & 0xFE), 1);
-    if (status != 0x02) {
-        i2c_stop(obj);
-        return I2C_ERROR_NO_SLAVE;
-    }
-    
-    for (i=0; i<length; i++) {
-        status = i2c_do_write(obj, data[i], 0);
-        if (status != 0x02) {
-            i2c_stop(obj);
-            return i;
-        }
-    }
-    
-    // If not repeated start, send stop.
-    if (stop) {
-        i2c_stop(obj);
-    } else {
-        repeated_start = 1;
-    }
-    
-    return length;
-}
-
-void i2c_reset(i2c_t *obj) {
-    i2c_stop(obj);
-}
-
-int i2c_byte_read(i2c_t *obj, int last) {
-    return (i2c_do_read(obj, last) & 0xFF);
-}
-
-int i2c_byte_write(i2c_t *obj, int data) {
-    int ack;
-    int status = i2c_do_write(obj, (data & 0xFF), 0);
-    
-    switch(status) {
-        case 2:
-            ack = 1;
-            break;
-        default:
-            ack = 0;
-            break;
-    }
-
-    return ack;
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/objects.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_OBJECTS_H
-#define MBED_OBJECTS_H
-
-#include "cmsis.h"
-#include "PortNames.h"
-#include "PeripheralNames.h"
-#include "PinNames.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct gpio_irq_s {
-    uint32_t ch;
-};
-
-struct serial_s {
-    LPC_USART_TypeDef *uart;
-    unsigned char index;
-};
-
-struct i2c_s {
-    LPC_I2C_TypeDef *i2c;
-};
-
-struct spi_s {
-    LPC_SPI_TypeDef *spi;
-    unsigned char spi_n;
-};
-
-#include "gpio_object.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/pinmap.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "pinmap.h"
-#include "error.h"
-
-__IO uint32_t* IOCON_REGISTERS[18] = {
-        &LPC_IOCON->PIO0_0 , &LPC_IOCON->PIO0_1 , &LPC_IOCON->PIO0_2 ,
-        &LPC_IOCON->PIO0_3 , &LPC_IOCON->PIO0_4 , &LPC_IOCON->PIO0_5 ,
-        &LPC_IOCON->PIO0_6 , &LPC_IOCON->PIO0_7 , &LPC_IOCON->PIO0_8 ,
-        &LPC_IOCON->PIO0_9 , &LPC_IOCON->PIO0_10, &LPC_IOCON->PIO0_11,
-        &LPC_IOCON->PIO0_12, &LPC_IOCON->PIO0_13, &LPC_IOCON->PIO0_14,
-        &LPC_IOCON->PIO0_15, &LPC_IOCON->PIO0_16, &LPC_IOCON->PIO0_17,
-};
-
-void pin_function(PinName pin, int function) {
-    
-}
-
-void pin_mode(PinName pin, PinMode mode) {
-    if (pin == (uint32_t)NC) { return; }
-    
-    if ((pin == 10) || (pin == 11)) {
-        // True open-drain pins can be configured for different I2C-bus speeds
-        return;
-    }
-    
-    __IO uint32_t *reg = IOCON_REGISTERS[pin];
-    
-    if (mode == OpenDrain) {
-        *reg |= (1 << 10);
-    } else {
-        uint32_t tmp = *reg;
-        tmp &= ~(0x3 << 3);
-        tmp |= (mode & 0x3) << 3;
-        *reg = tmp;
-    }
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/serial_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,280 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// math.h required for floating point operations for baud rate calculation
-#include <math.h>
-#include <string.h>
-
-#include "serial_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-/******************************************************************************
- * INITIALIZATION
- ******************************************************************************/
-#define UART_NUM    3
-
-static const SWM_Map SWM_UART_TX[] = {
-    {0, 0},
-    {1, 8},
-    {2, 16},
-};
-
-static const SWM_Map SWM_UART_RX[] = {
-    {0, 8},
-    {1, 16},
-    {2, 24},
-};
-
-// bit flags for used UARTs
-static unsigned char uart_used = 0;
-static int get_available_uart(void) {
-    int i;
-    for (i=0; i<3; i++) {
-        if ((uart_used & (1 << i)) == 0)
-            return i;
-    }
-    return -1;
-}
-
-#define UART_EN       (0x01<<0)
-
-#define CTS_DELTA     (0x01<<5)
-#define RXBRK         (0x01<<10)
-#define DELTA_RXBRK   (0x01<<11)
-
-#define RXRDY         (0x01<<0)
-#define TXRDY         (0x01<<2)
-
-#define TXBRKEN       (0x01<<1)
-
-static uint32_t UARTSysClk;
-
-static uint32_t serial_irq_ids[UART_NUM] = {0};
-static uart_irq_handler irq_handler;
-
-int stdio_uart_inited = 0;
-serial_t stdio_uart;
-
-void serial_init(serial_t *obj, PinName tx, PinName rx) {
-    int is_stdio_uart = 0;
-    
-    int uart_n = get_available_uart();
-    if (uart_n == -1) {
-        error("No available UART");
-    }
-    obj->index = uart_n;
-    obj->uart = (LPC_USART_TypeDef *)(LPC_USART0_BASE + (0x4000 * uart_n));
-    uart_used |= (1 << uart_n);
-    
-    const SWM_Map *swm;
-    uint32_t regVal;
-    
-    swm = &SWM_UART_TX[uart_n];
-    regVal = LPC_SWM->PINASSIGN[swm->n] & ~(0xFF << swm->offset);
-    LPC_SWM->PINASSIGN[swm->n] = regVal |  (tx   << swm->offset);
-    
-    swm = &SWM_UART_RX[uart_n];
-    regVal = LPC_SWM->PINASSIGN[swm->n] & ~(0xFF << swm->offset);
-    LPC_SWM->PINASSIGN[swm->n] = regVal |  (rx   << swm->offset);
-    
-    /* uart clock divided by 1 */
-    LPC_SYSCON->UARTCLKDIV = 1;
-    
-    /* disable uart interrupts */
-    NVIC_DisableIRQ((IRQn_Type)(UART0_IRQn + uart_n));
-    
-    /* Enable UART clock */
-    LPC_SYSCON->SYSAHBCLKCTRL |= (1 << (14 + uart_n));
-    
-    /* Peripheral reset control to UART, a "1" bring it out of reset. */
-    LPC_SYSCON->PRESETCTRL &= ~(0x1 << (3 + uart_n));
-    LPC_SYSCON->PRESETCTRL |=  (0x1 << (3 + uart_n));
-    
-    UARTSysClk = SystemCoreClock / LPC_SYSCON->UARTCLKDIV;
-    
-    // set default baud rate and format
-    serial_baud  (obj, 9600);
-    serial_format(obj, 8, ParityNone, 1);
-    
-    /* Clear all status bits. */
-    obj->uart->STAT = CTS_DELTA | DELTA_RXBRK;
-    
-    /* enable uart interrupts */
-    NVIC_EnableIRQ((IRQn_Type)(UART0_IRQn + uart_n));
-    
-    /* Enable UART interrupt */
-    // obj->uart->INTENSET = RXRDY | TXRDY | DELTA_RXBRK;
-    
-    /* Enable UART */
-    obj->uart->CFG |= UART_EN;
-    
-    is_stdio_uart = ((tx == USBTX) && (rx == USBRX));
-    
-    if (is_stdio_uart) {
-        stdio_uart_inited = 1;
-        memcpy(&stdio_uart, obj, sizeof(serial_t));
-    }
-}
-
-void serial_free(serial_t *obj) {
-    uart_used &= ~(1 << obj->index);
-    serial_irq_ids[obj->index] = 0;
-}
-
-// serial_baud
-// set the baud rate, taking in to account the current SystemFrequency
-void serial_baud(serial_t *obj, int baudrate) {
-    /* Integer divider:
-         BRG = UARTSysClk/(Baudrate * 16) - 1
-       
-       Frational divider:
-         FRG = ((UARTSysClk / (Baudrate * 16 * (BRG + 1))) - 1)
-       
-       where
-         FRG = (LPC_SYSCON->UARTFRDADD + 1) / (LPC_SYSCON->UARTFRDSUB + 1)
-       
-       (1) The easiest way is set SUB value to 256, -1 encoded, thus SUB
-           register is 0xFF.
-       (2) In ADD register value, depending on the value of UartSysClk,
-           baudrate, BRG register value, and SUB register value, be careful
-           about the order of multiplier and divider and make sure any
-           multiplier doesn't exceed 32-bit boundary and any divider doesn't get
-           down below one(integer 0).
-       (3) ADD should be always less than SUB.
-    */
-    obj->uart->BRG = UARTSysClk / 16 / baudrate - 1;
-    
-    LPC_SYSCON->UARTFRGDIV = 0xFF;
-    LPC_SYSCON->UARTFRGMULT = ( ((UARTSysClk / 16) * (LPC_SYSCON->UARTFRGDIV + 1)) /
-                                (baudrate * (obj->uart->BRG + 1))
-                              ) - (LPC_SYSCON->UARTFRGDIV + 1);
-
-}
-
-void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits) {
-    // 0: 1 stop bits, 1: 2 stop bits
-    if (stop_bits != 1 && stop_bits != 2) {
-        error("Invalid stop bits specified");
-    }
-    stop_bits -= 1;
-    
-    // 0: 7 data bits ... 2: 9 data bits
-    if (data_bits < 7 || data_bits > 9) {
-        error("Invalid number of bits (%d) in serial format, should be 7..9", data_bits);
-    }
-    data_bits -= 7;
-    
-    int paritysel;
-    switch (parity) {
-        case ParityNone: paritysel = 0; break;
-        case ParityEven: paritysel = 2; break;
-        case ParityOdd : paritysel = 3; break;
-        default:
-            error("Invalid serial parity setting");
-            return;
-    }
-    
-    obj->uart->CFG = (data_bits << 2)
-                   | (paritysel << 4)
-                   | (stop_bits << 6);
-}
-
-/******************************************************************************
- * INTERRUPTS HANDLING
- ******************************************************************************/
-static inline void uart_irq(uint32_t iir, uint32_t index) {
-    // [Chapter 14] LPC17xx UART0/2/3: UARTn Interrupt Handling
-    SerialIrq irq_type;
-    switch (iir) {
-        case 1: irq_type = TxIrq; break;
-        case 2: irq_type = RxIrq; break;
-        default: return;
-    }
-    
-    if (serial_irq_ids[index] != 0)
-        irq_handler(serial_irq_ids[index], irq_type);
-}
-
-void uart0_irq() {uart_irq((LPC_USART0->STAT & (1 << 2)) ? 2 : 1, 0);}
-void uart1_irq() {uart_irq((LPC_USART1->STAT & (1 << 2)) ? 2 : 1, 1);}
-void uart2_irq() {uart_irq((LPC_USART2->STAT & (1 << 2)) ? 2 : 1, 2);}
-
-void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id) {
-    irq_handler = handler;
-    serial_irq_ids[obj->index] = id;
-}
-
-void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) {
-    IRQn_Type irq_n = (IRQn_Type)0;
-    uint32_t vector = 0;
-    switch ((int)obj->uart) {
-        case LPC_USART0_BASE: irq_n=UART0_IRQn; vector = (uint32_t)&uart0_irq; break;
-        case LPC_USART1_BASE: irq_n=UART1_IRQn; vector = (uint32_t)&uart1_irq; break;
-        case LPC_USART2_BASE: irq_n=UART2_IRQn; vector = (uint32_t)&uart2_irq; break;
-    }
-    
-    if (enable) {
-        obj->uart->INTENSET = (1 << ((irq == RxIrq) ? 0 : 2));
-        NVIC_SetVector(irq_n, vector);
-        NVIC_EnableIRQ(irq_n);
-    } else { // disable
-        int all_disabled = 0;
-        SerialIrq other_irq = (irq == RxIrq) ? (TxIrq) : (RxIrq);
-        obj->uart->INTENSET &= ~(1 << ((irq == RxIrq) ? 0 : 2));
-        all_disabled = (obj->uart->INTENSET & (1 << ((other_irq == RxIrq) ? 0 : 2))) == 0;
-        if (all_disabled)
-            NVIC_DisableIRQ(irq_n);
-    }
-}
-
-/******************************************************************************
- * READ/WRITE
- ******************************************************************************/
-int serial_getc(serial_t *obj) {
-    while (!serial_readable(obj));
-    return obj->uart->RXDATA;
-}
-
-void serial_putc(serial_t *obj, int c) {
-    while (!serial_writable(obj));
-    obj->uart->TXDATA = c;
-}
-
-int serial_readable(serial_t *obj) {
-    return obj->uart->STAT & RXRDY;
-}
-
-int serial_writable(serial_t *obj) {
-    return obj->uart->STAT & TXRDY;
-}
-
-void serial_clear(serial_t *obj) {
-    // [TODO]
-}
-
-void serial_pinout_tx(PinName tx) {
-    
-}
-
-void serial_break_set(serial_t *obj) {
-    obj->uart->CTRL |= TXBRKEN;
-}
-
-void serial_break_clear(serial_t *obj) {
-    obj->uart->CTRL &= ~TXBRKEN;
-}
-
--- a/targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/spi_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,210 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <math.h>
-
-#include "spi_api.h"
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const SWM_Map SWM_SPI_SSEL[] = {
-    {4, 16},
-    {5, 16},
-};
-
-static const SWM_Map SWM_SPI_SCLK[] = {
-    {3, 24},
-    {4, 24},
-};
-
-static const SWM_Map SWM_SPI_MOSI[] = {
-    {4, 0},
-    {5, 0},
-};
-
-static const SWM_Map SWM_SPI_MISO[] = {
-    {4, 8},
-    {5, 16},
-};
-
-// bit flags for used SPIs
-static unsigned char spi_used = 0;
-static int get_available_spi(void) {
-    int i;
-    for (i=0; i<2; i++) {
-        if ((spi_used & (1 << i)) == 0)
-            return i;
-    }
-    return -1;
-}
-
-static inline int ssp_disable(spi_t *obj);
-static inline int ssp_enable(spi_t *obj);
-
-void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel) {
-    int spi_n = get_available_spi();
-    if (spi_n == -1) {
-        error("No available SPI");
-    }
-    obj->spi_n = spi_n;
-    spi_used |= (1 << spi_n);
-    
-    obj->spi = (spi_n) ? (LPC_SPI_TypeDef *)(LPC_SPI1_BASE) : (LPC_SPI_TypeDef *)(LPC_SPI0_BASE);
-    
-    const SWM_Map *swm;
-    uint32_t regVal;
-    
-    swm = &SWM_SPI_SCLK[obj->spi_n];
-    regVal = LPC_SWM->PINASSIGN[swm->n] & ~(0xFF << swm->offset);
-    LPC_SWM->PINASSIGN[swm->n] = regVal |  (sclk   << swm->offset);
-    
-    swm = &SWM_SPI_MOSI[obj->spi_n];
-    regVal = LPC_SWM->PINASSIGN[swm->n] & ~(0xFF << swm->offset);
-    LPC_SWM->PINASSIGN[swm->n] = regVal |  (mosi   << swm->offset);
-    
-    swm = &SWM_SPI_MISO[obj->spi_n];
-    regVal = LPC_SWM->PINASSIGN[swm->n] & ~(0xFF << swm->offset);
-    LPC_SWM->PINASSIGN[swm->n] = regVal |  (miso   << swm->offset);
-    
-    swm = &SWM_SPI_SSEL[obj->spi_n];
-    regVal = LPC_SWM->PINASSIGN[swm->n] & ~(0xFF << swm->offset);
-    LPC_SWM->PINASSIGN[swm->n] = regVal |  (ssel   << swm->offset);
-    
-    // clear interrupts
-    obj->spi->INTENCLR = 0x3f;
-    
-    // enable power and clocking
-    switch (obj->spi_n) {
-        case 0:
-            LPC_SYSCON->SYSAHBCLKCTRL |= (1<<11);
-            LPC_SYSCON->PRESETCTRL &= ~(0x1<<0);
-            LPC_SYSCON->PRESETCTRL |= (0x1<<0);
-            break;
-        case 1:
-            LPC_SYSCON->SYSAHBCLKCTRL |= (1<<12);
-            LPC_SYSCON->PRESETCTRL &= ~(0x1<<1);
-            LPC_SYSCON->PRESETCTRL |= (0x1<<1);
-            break;
-    }
-    
-    // set default format and frequency
-    if (ssel == NC) {
-        spi_format(obj, 8, 0, 0);  // 8 bits, mode 0, master
-    } else {
-        spi_format(obj, 8, 0, 1);  // 8 bits, mode 0, slave
-    }
-    spi_frequency(obj, 1000000);
-    
-    // enable the ssp channel
-    ssp_enable(obj);
-}
-
-void spi_free(spi_t *obj) {}
-
-void spi_format(spi_t *obj, int bits, int mode, int slave) {
-    ssp_disable(obj);
-    
-    if (!(bits >= 1 && bits <= 16) || !(mode >= 0 && mode <= 3)) {
-        error("SPI format error");
-    }
-    
-    
-    int polarity = (mode & 0x2) ? 1 : 0;
-    int phase = (mode & 0x1) ? 1 : 0;
-    
-    // set it up
-    int DSS = bits - 1;            // DSS (data select size)
-    int SPO = (polarity) ? 1 : 0;  // SPO - clock out polarity
-    int SPH = (phase) ? 1 : 0;     // SPH - clock out phase
-    
-    uint32_t tmp = obj->spi->CFG;
-    tmp &= ~((1 << 2) | (1 << 4) | (1 << 5));
-    tmp |= (SPH << 4) | (SPO << 5) | ((slave ? 0 : 1) << 2);
-    obj->spi->CFG = tmp;
-    
-    // select frame length
-    tmp = obj->spi->TXDATCTL;
-    tmp &= ~(0xf << 24);
-    tmp |= (DSS << 24);
-    obj->spi->TXDATCTL = tmp;
-    
-    ssp_enable(obj);
-}
-
-void spi_frequency(spi_t *obj, int hz) {
-    ssp_disable(obj);
-    
-    uint32_t PCLK = SystemCoreClock;
-    
-    obj->spi->DIV = PCLK/hz - 1;
-    obj->spi->DLY = 0;
-    ssp_enable(obj);
-}
-
-static inline int ssp_disable(spi_t *obj) {
-    return obj->spi->CFG &= ~(1 << 0);
-}
-
-static inline int ssp_enable(spi_t *obj) {
-    return obj->spi->CFG |= (1 << 0);
-}
-
-static inline int ssp_readable(spi_t *obj) {
-    return obj->spi->STAT & (1 << 0);
-}
-
-static inline int ssp_writeable(spi_t *obj) {
-    return obj->spi->STAT & (1 << 1);
-}
-
-static inline void ssp_write(spi_t *obj, int value) {
-    while (!ssp_writeable(obj));
-    // end of transfer
-    obj->spi->TXDATCTL |= (1 << 20);
-    obj->spi->TXDAT = value;
-}
-
-static inline int ssp_read(spi_t *obj) {
-    while (!ssp_readable(obj));
-    return obj->spi->RXDAT;
-}
-
-static inline int ssp_busy(spi_t *obj) {
-    // TODO
-    return 0;
-}
-
-int spi_master_write(spi_t *obj, int value) {
-    ssp_write(obj, value);
-    return ssp_read(obj);
-}
-
-int spi_slave_receive(spi_t *obj) {
-    return (ssp_readable(obj) && !ssp_busy(obj)) ? (1) : (0);
-};
-
-int spi_slave_read(spi_t *obj) {
-    return obj->spi->RXDAT;
-}
-
-void spi_slave_write(spi_t *obj, int value) {
-    while (ssp_writeable(obj) == 0) ;
-    obj->spi->TXDAT = value;
-}
-
-int spi_busy(spi_t *obj) {
-    return ssp_busy(obj);
-}
--- a/targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/us_ticker.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stddef.h>
-#include "us_ticker_api.h"
-#include "PeripheralNames.h"
-
-#define US_TICKER_TIMER_IRQn     SCT_IRQn
-
-int us_ticker_inited = 0;
-
-void us_ticker_init(void) {
-    if (us_ticker_inited) return;
-    us_ticker_inited = 1;
-    
-    // Enable the SCT clock
-    LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 8);
-    
-    // Clear peripheral reset the SCT:
-    LPC_SYSCON->PRESETCTRL |= (1 << 8);
-    
-    // Unified counter (32 bits)
-    LPC_SCT->CONFIG |= 1;
-    
-    // halt and clear the counter
-    LPC_SCT->CTRL_L |= (1 << 2) | (1 << 3);
-    
-    // System Clock (12)MHz -> us_ticker (1)MHz
-    LPC_SCT->CTRL_L |= ((SystemCoreClock/1000000 - 1) << 5);
-    
-    // unhalt the counter:
-    //    - clearing bit 2 of the CTRL register
-    LPC_SCT->CTRL_L &= ~(1 << 2);
-    
-    NVIC_SetVector(US_TICKER_TIMER_IRQn, (uint32_t)us_ticker_irq_handler);
-    NVIC_EnableIRQ(US_TICKER_TIMER_IRQn);
-}
-
-uint32_t us_ticker_read() {
-    if (!us_ticker_inited)
-        us_ticker_init();
-    
-    return LPC_SCT->COUNT_U;
-}
-
-void us_ticker_set_interrupt(unsigned int timestamp) {
-    // halt the counter: 
-    //    - setting bit 2 of the CTRL register
-    LPC_SCT->CTRL_L |= (1 << 2);
-    
-    // set timestamp in compare register
-    LPC_SCT->MATCH[0].U = timestamp;
-    
-    // unhalt the counter:
-    //    - clearing bit 2 of the CTRL register
-    LPC_SCT->CTRL_L &= ~(1 << 2);
-    
-    // if events are not enabled, enable them
-    if (!(LPC_SCT->EVEN & 0x01)) {
-        
-        // comb mode = match only
-        LPC_SCT->EVENT[0].CTRL = (1 << 12);
-        
-        // ref manual:
-        //   In simple applications that do not 
-        //   use states, write 0x01 to this 
-        //   register to enable an event
-        LPC_SCT->EVENT[0].STATE |= 0x1;
-        
-        // enable events
-        LPC_SCT->EVEN |= 0x1;
-    }
-}
-
-void us_ticker_disable_interrupt(void) {
-    LPC_SCT->EVEN &= ~1;
-}
-
-void us_ticker_clear_interrupt(void) {
-    LPC_SCT->EVFLAG = 1;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/hal/TARGET_NXP/analogin_api.c	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,124 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "analogin_api.h"
+#include "cmsis.h"
+#include "pinmap.h"
+#include "error.h"
+
+static const PinMap PinMap_ADC[] = {
+    {P0_11, ADC0_0, 2},
+    {P1_0 , ADC0_1, 2},
+    {P1_1 , ADC0_2, 2},
+    {P1_2 , ADC0_3, 2},
+    // {P1_3 , ADC0_4, 2}, -- should be mapped to SWDIO only
+    {P1_4 , ADC0_5, 1},
+    {P1_10, ADC0_6, 1},
+    {P1_11, ADC0_7, 1},
+    {NC   , NC    , 0}
+};
+
+#define ANALOGIN_MEDIAN_FILTER      1
+
+#define ADC_10BIT_RANGE             0x3FF
+#define ADC_12BIT_RANGE             0xFFF
+
+static inline int div_round_up(int x, int y) {
+  return (x + (y - 1)) / y;
+}
+
+#define ADC_RANGE    ADC_10BIT_RANGE
+
+void analogin_init(analogin_t *obj, PinName pin) {
+    obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
+    if (obj->adc == (uint32_t)NC) {
+        error("ADC pin mapping failed");
+        return;
+    }
+    
+    // Power up ADC
+    LPC_SYSCON->PDRUNCFG &= ~ (1 << 4);
+    LPC_SYSCON->SYSAHBCLKCTRL |= ((uint32_t)1 << 13);
+
+    uint32_t offset = (uint32_t)pin & 0xff;
+    __IO uint32_t *reg = (__IO uint32_t*)(LPC_IOCON_BASE + offset);
+
+    // set pin to ADC mode
+    *reg &= ~(1 << 7); // set ADMODE = 0 (analog mode)
+
+    uint32_t PCLK = SystemCoreClock;
+    uint32_t MAX_ADC_CLK = 4500000;
+    uint32_t clkdiv = div_round_up(PCLK, MAX_ADC_CLK) - 1;
+
+    LPC_ADC->CR = (0 << 0)      // no channels selected
+                | (clkdiv << 8) // max of 4.5MHz
+                | (0 << 16)     // BURST = 0, software controlled
+                | ( 0 << 17 );  // CLKS = 0, not applicable
+    
+    pinmap_pinout(pin, PinMap_ADC);
+}
+
+static inline uint32_t adc_read(analogin_t *obj) {
+    // Select the appropriate channel and start conversion
+    LPC_ADC->CR &= ~0xFF;
+    LPC_ADC->CR |= 1 << (int)obj->adc;
+    LPC_ADC->CR |= 1 << 24;
+    
+    // Repeatedly get the sample data until DONE bit
+    unsigned int data;
+    do {
+        data = LPC_ADC->GDR;
+    } while ((data & ((unsigned int)1 << 31)) == 0);
+    
+    // Stop conversion
+    LPC_ADC->CR &= ~(1 << 24);
+    
+    return (data >> 6) & ADC_RANGE; // 10 bit
+}
+
+static inline void order(uint32_t *a, uint32_t *b) {
+    if (*a > *b) {
+        uint32_t t = *a;
+        *a = *b;
+        *b = t;
+    }
+}
+
+static inline uint32_t adc_read_u32(analogin_t *obj) {
+    uint32_t value;
+#if ANALOGIN_MEDIAN_FILTER
+    uint32_t v1 = adc_read(obj);
+    uint32_t v2 = adc_read(obj);
+    uint32_t v3 = adc_read(obj);
+    order(&v1, &v2);
+    order(&v2, &v3);
+    order(&v1, &v2);
+    value = v2;
+#else
+    value = adc_read(obj);
+#endif
+    return value;
+}
+
+uint16_t analogin_read_u16(analogin_t *obj) {
+    uint32_t value = adc_read_u32(obj);
+    
+    return (value << 6) | ((value >> 4) & 0x003F); // 10 bit
+}
+
+float analogin_read(analogin_t *obj) {
+    uint32_t value = adc_read_u32(obj);
+    return (float)value * (1.0f / (float)ADC_RANGE);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/hal/TARGET_NXP/device.h	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,59 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_DEVICE_H
+#define MBED_DEVICE_H
+
+#define DEVICE_PORTIN           1
+#define DEVICE_PORTOUT          1
+#define DEVICE_PORTINOUT        1
+
+#define DEVICE_INTERRUPTIN      1
+
+#define DEVICE_ANALOGIN         1
+#define DEVICE_ANALOGOUT        0
+
+#define DEVICE_SERIAL           1
+
+#define DEVICE_I2C              1
+#define DEVICE_I2CSLAVE         1
+
+#define DEVICE_SPI              1
+#define DEVICE_SPISLAVE         1
+
+#define DEVICE_CAN              0
+
+#define DEVICE_RTC              0
+
+#define DEVICE_ETHERNET         0
+
+#define DEVICE_PWMOUT           1
+
+#define DEVICE_SEMIHOST         1
+#define DEVICE_LOCALFILESYSTEM  1
+#define DEVICE_ID_LENGTH       32
+#define DEVICE_MAC_OFFSET      20
+
+#define DEVICE_SLEEP            1
+
+#define DEVICE_DEBUG_AWARENESS  0
+
+#define DEVICE_STDIO_MESSAGES   1
+
+#define DEVICE_ERROR_PATTERN    1
+
+#include "objects.h"
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/hal/TARGET_NXP/gpio_api.c	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,65 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "gpio_api.h"
+#include "pinmap.h"
+#include "reserved_pins.h"
+
+static const PinName reserved_pins[] = TARGET_RESERVED_PINS;
+
+uint32_t gpio_set(PinName pin) {
+    // PIO default value of following ports are not same as others
+    unsigned i;
+    int f = 0;
+
+    for (i = 0; i < sizeof(reserved_pins) / sizeof(int); i ++)
+        if (pin == reserved_pins[i]) {
+            f = 1;
+            break;
+        }
+   
+    pin_function(pin, f);
+    return ((pin & 0x0F00) >> 8);
+}
+
+void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) {
+    if(pin == NC) return;
+
+    obj->pin = pin;
+    LPC_GPIO_TypeDef *port_reg = ((LPC_GPIO_TypeDef *) (LPC_GPIO0_BASE + (((pin & 0xF000) >> PORT_SHIFT) * 0x10000)));
+
+    obj->reg_mask_read = &port_reg->MASKED_ACCESS[1 << gpio_set(pin)];
+    obj->reg_dir       = &port_reg->DIR;
+    obj->reg_write     = &port_reg->DATA;
+    
+    gpio_dir(obj, direction);
+    
+    switch (direction) {
+        case PIN_OUTPUT: pin_mode(pin, PullNone); break;
+        case PIN_INPUT : pin_mode(pin, PullDown); break;
+    }
+}
+
+void gpio_mode(gpio_t *obj, PinMode mode) {
+    pin_mode(obj->pin, mode);
+}
+
+void gpio_dir(gpio_t *obj, PinDirection direction) {
+    int pin_number = ((obj->pin & 0x0F00) >> 8);
+    switch (direction) {
+        case PIN_INPUT : *obj->reg_dir &= ~(1 << pin_number); break;
+        case PIN_OUTPUT: *obj->reg_dir |=  (1 << pin_number); break;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/hal/TARGET_NXP/gpio_irq_api.c	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,216 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <stddef.h>
+#include "cmsis.h"
+#include "gpio_irq_api.h"
+#include "error.h"
+#include "gpio_api.h"
+
+// The chip is capable of 42 GPIO interrupts.
+// PIO0_0..PIO0_11, PIO1_0..PIO1_11, PIO2_0..PIO2_11, PIO3_0..PIO3_5
+#define CHANNEL_NUM 42
+
+static uint32_t channel_ids[CHANNEL_NUM] = {0};
+static gpio_irq_handler irq_handler;
+
+static inline int numofbits(uint32_t bits)
+{
+    // Count number of bits
+    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
+    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
+    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
+    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
+    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
+}
+
+static inline void handle_interrupt_in(uint32_t port) {
+    // Find out whether the interrupt has been triggered by a high or low value...
+    // As the LPC1114 doesn't have a specific register for this, we'll just have to read
+    // the level of the pin as if it were just a normal input...
+    
+    uint32_t channel;
+    
+    // Get the number of the pin being used and the port typedef
+    LPC_GPIO_TypeDef *port_reg = ((LPC_GPIO_TypeDef *) (LPC_GPIO0_BASE + (port * 0x10000)));
+    
+    // Get index of function table from Mask Interrupt Status register
+    channel = numofbits(port_reg->MIS - 1);
+    
+    if (port_reg->MIS & port_reg->IBE) {
+        // both edge, read the level of pin
+        if ((port_reg->DATA & port_reg->MIS) != 0)
+            irq_handler(channel_ids[channel], IRQ_RISE);
+        else
+            irq_handler(channel_ids[channel], IRQ_FALL);
+    }
+    else if (port_reg->MIS & port_reg->IEV) {
+        irq_handler(channel_ids[channel], IRQ_RISE);
+    }
+    else {
+        irq_handler(channel_ids[channel], IRQ_FALL);
+    }
+
+    // Clear the interrupt...
+    port_reg->IC = port_reg->MIS;
+}
+
+void gpio_irq0(void) {handle_interrupt_in(0);}
+void gpio_irq1(void) {handle_interrupt_in(1);}
+void gpio_irq2(void) {handle_interrupt_in(2);}
+void gpio_irq3(void) {handle_interrupt_in(3);}
+
+int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id) {
+    int channel;
+    uint32_t port_num;
+    
+    if (pin == NC) return -1;
+    
+    // Firstly, we'll put some data in *obj so we can keep track of stuff.
+    obj->pin = pin;
+    
+    // Set the handler to be the pointer at the top...
+    irq_handler = handler;
+    
+    // Which port are we using?
+    port_num = ((pin & 0xF000) >> PORT_SHIFT);
+    
+    switch (port_num) {
+        case 0:
+            NVIC_SetVector(EINT0_IRQn, (uint32_t)gpio_irq0);
+            NVIC_EnableIRQ(EINT0_IRQn);
+            break;
+        case 1:
+            NVIC_SetVector(EINT1_IRQn, (uint32_t)gpio_irq1);
+            NVIC_EnableIRQ(EINT1_IRQn);
+            break;
+        case 2:
+            NVIC_SetVector(EINT2_IRQn, (uint32_t)gpio_irq2);
+            NVIC_EnableIRQ(EINT2_IRQn);
+            break;
+        case 3:
+            NVIC_SetVector(EINT3_IRQn, (uint32_t)gpio_irq3);
+            NVIC_EnableIRQ(EINT3_IRQn);
+            break;
+        default:
+            return -1;
+    }
+    
+    // Generate index of function pointer table
+    // PIO0_0 - PIO0_11 :  0..11
+    // PIO1_0 - PIO1_11 : 12..23
+    // PIO2_0 - PIO2_11 : 24..35
+    // PIO3_0 - PIO3_5  : 36..41
+    channel = (port_num * 12) + ((pin & 0x0F00) >> PIN_SHIFT);
+    
+    channel_ids[channel] = id;
+    obj->ch = channel;
+    
+    return 0;
+}
+
+void gpio_irq_free(gpio_irq_t *obj) {
+    channel_ids[obj->ch] = 0;
+}
+
+void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
+    // Firstly, check if there is an existing event stored...
+
+    LPC_GPIO_TypeDef *port_reg = ((LPC_GPIO_TypeDef *) (LPC_GPIO0_BASE + (((obj->pin & 0xF000) >> PORT_SHIFT) * 0x10000)));
+
+    // Need to get the pin number of the pin, not the value of the enum
+    uint32_t pin_num = (1 << ((obj->pin & 0x0f00) >> PIN_SHIFT));
+   
+    // Clear
+    port_reg->IC |= pin_num;
+    
+    // Make it edge sensitive.
+    port_reg->IS &= ~pin_num;
+
+    if ( (port_reg->IE & pin_num) != 0) {
+    // We have an event.
+    // Enable both edge interrupts.
+
+        if (enable) {
+            port_reg->IBE |= pin_num;
+            port_reg->IE  |= pin_num;
+        }
+        else {
+            // These all need to be opposite, to reenable the other one.
+            port_reg->IBE &= ~pin_num;
+
+            if (event == IRQ_RISE)
+                port_reg->IEV &= ~pin_num;
+            else 
+                port_reg->IEV |=  pin_num;
+
+            port_reg->IE |= pin_num;
+        }
+    }
+    else {
+        // One edge
+        port_reg->IBE &= ~pin_num;
+        // Rising/falling?
+        if (event == IRQ_RISE)
+            port_reg->IEV |=  pin_num;
+        else
+            port_reg->IEV &= ~pin_num;
+
+        if (enable) {
+            port_reg->IE |= pin_num;
+        }
+    }
+
+}
+
+void gpio_irq_enable(gpio_irq_t *obj) {
+    uint32_t port_num = ((obj->pin & 0xF000) >> PORT_SHIFT);
+    switch (port_num) {
+        case 0:
+            NVIC_EnableIRQ(EINT0_IRQn);
+            break;
+        case 1:
+            NVIC_EnableIRQ(EINT1_IRQn);
+            break;
+        case 2:
+            NVIC_EnableIRQ(EINT2_IRQn);
+            break;
+        case 3:
+            NVIC_EnableIRQ(EINT3_IRQn);
+            break;
+        default:
+            break;
+    }
+}
+
+void gpio_irq_disable(gpio_irq_t *obj) {
+    uint32_t port_num = ((obj->pin & 0xF000) >> PORT_SHIFT);
+    switch (port_num) {
+        case 0:
+            NVIC_DisableIRQ(EINT0_IRQn);
+            break;
+        case 1:
+            NVIC_DisableIRQ(EINT1_IRQn);
+            break;
+        case 2:
+            NVIC_DisableIRQ(EINT2_IRQn);
+            break;
+        case 3:
+            NVIC_DisableIRQ(EINT3_IRQn);
+            break;
+        default:
+            break;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/hal/TARGET_NXP/gpio_object.h	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,46 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_GPIO_OBJECT_H
+#define MBED_GPIO_OBJECT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+    PinName  pin;
+    __I  uint32_t *reg_mask_read;
+    __IO uint32_t *reg_dir;
+    __IO uint32_t *reg_write;
+} gpio_t;
+
+static inline void gpio_write(gpio_t *obj, int value) {
+    uint32_t pin_number = ((obj->pin & 0x0F00) >> 8);
+    if (value)
+        *obj->reg_write |= (1 << pin_number);
+    else
+        *obj->reg_write &= ~(1 << pin_number);
+}
+
+static inline int gpio_read(gpio_t *obj) {
+    return ((*obj->reg_mask_read) ? 1 : 0);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/hal/TARGET_NXP/i2c_api.c	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,389 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "i2c_api.h"
+#include "cmsis.h"
+#include "pinmap.h"
+#include "error.h"
+
+static const PinMap PinMap_I2C_SDA[] = {
+    {P0_5, I2C_0, 1},
+    {NC  , NC   , 0}
+};
+
+static const PinMap PinMap_I2C_SCL[] = {
+    {P0_4, I2C_0, 1},
+    {NC  , NC,    0}
+};
+
+#define I2C_CONSET(x)       (x->i2c->CONSET)
+#define I2C_CONCLR(x)       (x->i2c->CONCLR)
+#define I2C_STAT(x)         (x->i2c->STAT)
+#define I2C_DAT(x)          (x->i2c->DAT)
+#define I2C_SCLL(x, val)    (x->i2c->SCLL = val)
+#define I2C_SCLH(x, val)    (x->i2c->SCLH = val)
+
+static const uint32_t I2C_addr_offset[2][4] = {
+    {0x0C, 0x20, 0x24, 0x28},
+    {0x30, 0x34, 0x38, 0x3C}
+};
+
+static inline void i2c_conclr(i2c_t *obj, int start, int stop, int interrupt, int acknowledge) {
+    I2C_CONCLR(obj) = (start << 5)
+                    | (stop << 4)
+                    | (interrupt << 3)
+                    | (acknowledge << 2);
+}
+
+static inline void i2c_conset(i2c_t *obj, int start, int stop, int interrupt, int acknowledge) {
+    I2C_CONSET(obj) = (start << 5)
+                    | (stop << 4)
+                    | (interrupt << 3)
+                    | (acknowledge << 2);
+}
+
+// Clear the Serial Interrupt (SI)
+static inline void i2c_clear_SI(i2c_t *obj) {
+    i2c_conclr(obj, 0, 0, 1, 0);
+}
+
+static inline int i2c_status(i2c_t *obj) {
+    return I2C_STAT(obj);
+}
+
+// Wait until the Serial Interrupt (SI) is set
+static int i2c_wait_SI(i2c_t *obj) {
+    int timeout = 0;
+    while (!(I2C_CONSET(obj) & (1 << 3))) {
+        timeout++;
+        if (timeout > 100000) return -1;
+    }
+    return 0;
+}
+
+static inline void i2c_interface_enable(i2c_t *obj) {
+    I2C_CONSET(obj) = 0x40;
+}
+
+static inline void i2c_power_enable(i2c_t *obj) {
+    LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 5);
+    LPC_SYSCON->PRESETCTRL |= 1 << 1;
+}
+
+void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
+    // determine the SPI to use
+    I2CName i2c_sda = (I2CName)pinmap_peripheral(sda, PinMap_I2C_SDA);
+    I2CName i2c_scl = (I2CName)pinmap_peripheral(scl, PinMap_I2C_SCL);
+    obj->i2c = (LPC_I2C_TypeDef *)pinmap_merge(i2c_sda, i2c_scl);
+    
+    if ((int)obj->i2c == NC) {
+        error("I2C pin mapping failed");
+    }
+    
+    // enable power
+    i2c_power_enable(obj);
+    
+    // set default frequency at 100k
+    i2c_frequency(obj, 100000);
+    i2c_conclr(obj, 1, 1, 1, 1);
+    i2c_interface_enable(obj);
+    
+    pinmap_pinout(sda, PinMap_I2C_SDA);
+    pinmap_pinout(scl, PinMap_I2C_SCL);
+}
+
+inline int i2c_start(i2c_t *obj) {
+    int status = 0;
+    // 8.1 Before master mode can be entered, I2CON must be initialised to:
+    //  - I2EN STA STO SI AA - -
+    //  -  1    0   0   0  x - -
+    // if AA = 0, it can't enter slave mode
+    i2c_conclr(obj, 1, 1, 1, 1);
+    
+    // The master mode may now be entered by setting the STA bit
+    // this will generate a start condition when the bus becomes free
+    i2c_conset(obj, 1, 0, 0, 1);
+    
+    i2c_wait_SI(obj);
+    status = i2c_status(obj);
+    
+    // Clear start bit now transmitted, and interrupt bit
+    i2c_conclr(obj, 1, 0, 0, 0);
+    return status;
+}
+
+inline int i2c_stop(i2c_t *obj) {
+    int timeout = 0;
+
+    // write the stop bit
+    i2c_conset(obj, 0, 1, 0, 0);
+    i2c_clear_SI(obj);
+    
+    // wait for STO bit to reset
+    while(I2C_CONSET(obj) & (1 << 4)) {
+        timeout ++;
+        if (timeout > 100000) return 1;
+    }
+
+    return 0;
+}
+
+
+static inline int i2c_do_write(i2c_t *obj, int value, uint8_t addr) {
+    // write the data
+    I2C_DAT(obj) = value;
+    
+    // clear SI to init a send
+    i2c_clear_SI(obj);
+    
+    // wait and return status
+    i2c_wait_SI(obj);
+    return i2c_status(obj);
+}
+
+static inline int i2c_do_read(i2c_t *obj, int last) {
+    // we are in state 0x40 (SLA+R tx'd) or 0x50 (data rx'd and ack)
+    if (last) {
+        i2c_conclr(obj, 0, 0, 0, 1); // send a NOT ACK
+    } else {
+        i2c_conset(obj, 0, 0, 0, 1); // send a ACK
+    }
+    
+    // accept byte
+    i2c_clear_SI(obj);
+    
+    // wait for it to arrive
+    i2c_wait_SI(obj);
+    
+    // return the data
+    return (I2C_DAT(obj) & 0xFF);
+}
+
+void i2c_frequency(i2c_t *obj, int hz) {
+    // No peripheral clock divider on the M0
+    uint32_t PCLK = SystemCoreClock;
+    
+    uint32_t pulse = PCLK / (hz * 2);
+    
+    // I2C Rate
+    I2C_SCLL(obj, pulse);
+    I2C_SCLH(obj, pulse);
+}
+
+// The I2C does a read or a write as a whole operation
+// There are two types of error conditions it can encounter
+//  1) it can not obtain the bus
+//  2) it gets error responses at part of the transmission
+//
+// We tackle them as follows:
+//  1) we retry until we get the bus. we could have a "timeout" if we can not get it
+//      which basically turns it in to a 2)
+//  2) on error, we use the standard error mechanisms to report/debug
+//
+// Therefore an I2C transaction should always complete. If it doesn't it is usually
+// because something is setup wrong (e.g. wiring), and we don't need to programatically
+// check for that
+
+int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) {
+    int count, status;
+    
+    status = i2c_start(obj);
+    
+    if ((status != 0x10) && (status != 0x08)) {
+        i2c_stop(obj);
+        return I2C_ERROR_BUS_BUSY;
+    }
+    
+    status = i2c_do_write(obj, (address | 0x01), 1);
+    if (status != 0x40) {
+        i2c_stop(obj);
+        return I2C_ERROR_NO_SLAVE;
+    }
+
+    // Read in all except last byte
+    for (count = 0; count < (length - 1); count++) {
+        int value = i2c_do_read(obj, 0);
+        status = i2c_status(obj);
+        if (status != 0x50) {
+            i2c_stop(obj);
+            return count;
+        }
+        data[count] = (char) value;
+    }
+
+    // read in last byte
+    int value = i2c_do_read(obj, 1);
+    status = i2c_status(obj);
+    if (status != 0x58) {
+        i2c_stop(obj);
+        return length - 1;
+    }
+    
+    data[count] = (char) value;
+    
+    // If not repeated start, send stop.
+    if (stop) {
+        i2c_stop(obj);
+    }
+    
+    return length;
+}
+
+int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) {
+    int i, status;
+    
+    status = i2c_start(obj);
+    
+    if ((status != 0x10) && (status != 0x08)) {
+        i2c_stop(obj);
+        return I2C_ERROR_BUS_BUSY;
+    }
+    
+    status = i2c_do_write(obj, (address & 0xFE), 1);
+    if (status != 0x18) {
+        i2c_stop(obj);
+        return I2C_ERROR_NO_SLAVE;
+    }
+    
+    for (i=0; i<length; i++) {
+        status = i2c_do_write(obj, data[i], 0);
+        if(status != 0x28) {
+            i2c_stop(obj);
+            return i;
+        }
+    }
+    
+    // clearing the serial interrupt here might cause an unintended rewrite of the last byte
+    // see also issue report https://mbed.org/users/mbed_official/code/mbed/issues/1
+    // i2c_clear_SI(obj);
+    
+    // If not repeated start, send stop.
+    if (stop) {
+        i2c_stop(obj);
+    }
+    
+    return length;
+}
+
+void i2c_reset(i2c_t *obj) {
+    i2c_stop(obj);
+}
+
+int i2c_byte_read(i2c_t *obj, int last) {
+    return (i2c_do_read(obj, last) & 0xFF);
+}
+
+int i2c_byte_write(i2c_t *obj, int data) {
+    int ack;
+    int status = i2c_do_write(obj, (data & 0xFF), 0);
+    
+    switch(status) {
+        case 0x18: case 0x28:       // Master transmit ACKs
+            ack = 1;
+            break;
+        case 0x40:                  // Master receive address transmitted ACK
+            ack = 1;
+            break;
+        case 0xB8:                  // Slave transmit ACK
+            ack = 1;
+            break;
+        default:
+            ack = 0;
+            break;
+    }
+
+    return ack;
+}
+
+void i2c_slave_mode(i2c_t *obj, int enable_slave) {
+    if (enable_slave != 0) {
+        i2c_conclr(obj, 1, 1, 1, 0);
+        i2c_conset(obj, 0, 0, 0, 1);
+    } else {
+        i2c_conclr(obj, 1, 1, 1, 1);
+    }
+}
+
+int i2c_slave_receive(i2c_t *obj) {
+    int status;
+    int retval;
+    
+    status = i2c_status(obj);
+    switch(status) {
+        case 0x60: retval = 3; break;
+        case 0x70: retval = 2; break;
+        case 0xA8: retval = 1; break;
+        default  : retval = 0; break;
+    }
+    
+    return(retval);
+}
+
+int i2c_slave_read(i2c_t *obj, char *data, int length) {
+    int count = 0;
+    int status;
+    
+    do {
+        i2c_clear_SI(obj);
+        i2c_wait_SI(obj);
+        status = i2c_status(obj);
+        if((status == 0x80) || (status == 0x90)) {
+            data[count] = I2C_DAT(obj) & 0xFF;
+        }
+        count++;
+    } while (((status == 0x80) || (status == 0x90) ||
+            (status == 0x060) || (status == 0x70)) && (count < length));
+    
+    if(status != 0xA0) {
+        i2c_stop(obj);
+    }
+    
+    i2c_clear_SI(obj);
+    
+    return count;
+}
+
+int i2c_slave_write(i2c_t *obj, const char *data, int length) {
+    int count = 0;
+    int status;
+    
+    if(length <= 0) {
+        return(0);
+    }
+    
+    do {
+        status = i2c_do_write(obj, data[count], 0);
+        count++;
+    } while ((count < length) && (status == 0xB8));
+    
+    if((status != 0xC0) && (status != 0xC8)) {
+        i2c_stop(obj);
+    }
+    
+    i2c_clear_SI(obj);
+    
+    return(count);
+}
+
+void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask) {
+    uint32_t addr;
+    
+    if ((idx >= 0) && (idx <= 3)) {
+        addr = ((uint32_t)obj->i2c) + I2C_addr_offset[0][idx];
+        *((uint32_t *) addr) = address & 0xFF;
+        addr = ((uint32_t)obj->i2c) + I2C_addr_offset[1][idx];
+        *((uint32_t *) addr) = mask & 0xFE;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/hal/TARGET_NXP/objects.h	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,74 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef MBED_OBJECTS_H
+#define MBED_OBJECTS_H
+
+#include "cmsis.h"
+#include "PortNames.h"
+#include "PeripheralNames.h"
+#include "PinNames.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct gpio_irq_s {
+    uint32_t ch;
+    PinName pin;
+    __I  uint32_t *reg_mask_read;
+};
+
+struct port_s {
+    __IO uint32_t *reg_dir;
+    __IO uint32_t *reg_data;
+    PortName port;
+    uint32_t mask;
+};
+
+struct pwmout_s {
+    PWMName pwm;
+};
+
+struct serial_s {
+    LPC_UART_TypeDef *uart;
+    int index;
+};
+
+struct analogin_s {
+    ADCName adc;
+};
+
+struct i2c_s {
+    LPC_I2C_TypeDef *i2c;
+};
+
+struct spi_s {
+    LPC_SSP_TypeDef *spi;
+};
+
+#if DEVICE_CAN
+struct can_s {
+    int index;
+};
+#endif
+
+#include "gpio_object.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/hal/TARGET_NXP/pinmap.c	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,47 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "pinmap.h"
+#include "error.h"
+
+void pin_function(PinName pin, int function) {
+    if (pin == (uint32_t)NC) return;
+    
+    uint32_t offset = (uint32_t)pin & 0xff;
+    __IO uint32_t *reg = (__IO uint32_t*)(LPC_IOCON_BASE + offset);
+
+    // pin function bits: [2:0] -> 111 = (0x7)
+    *reg = (*reg & ~0x7) | (function & 0x7);
+}
+
+void pin_mode(PinName pin, PinMode mode) {
+    if (pin == (uint32_t)NC) { return; }
+    
+    uint32_t offset = (uint32_t)pin & 0xff;
+    uint32_t drain = ((uint32_t) mode & (uint32_t) OpenDrain) >> 2;
+    
+    __IO uint32_t *reg = (__IO uint32_t*)(LPC_IOCON_BASE + offset);
+    uint32_t tmp = *reg;
+    
+    // pin mode bits: [4:3] -> 11000 = (0x3 << 3)
+    tmp &= ~(0x3 << 3);
+    tmp |= (mode & 0x3) << 3;
+    
+    // drain
+    tmp &= ~(0x1 << 10);
+    tmp |= drain << 10;
+    
+    *reg = tmp;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/hal/TARGET_NXP/port_api.c	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,78 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "port_api.h"
+#include "pinmap.h"
+#include "gpio_api.h"
+
+// LPC114 IOCON offset table [port][pin]
+
+static uint8_t iocon_offset[4][12] = {
+    {0x0c,0x10,0x1c,0x2c,0x30,0x34,0x4c,0x50,0x60,0x64,0x68,0x74}, // PORT 0
+    {0x78,0x7c,0x80,0x90,0x94,0xa0,0xa4,0xa8,0x14,0x38,0x6c,0x98}, // PORT 1
+    {0x08,0x28,0x5c,0x8c,0x40,0x44,0x00,0x20,0x24,0x54,0x58,0x70}, // PORT 2
+    {0x84,0x88,0x9c,0xac,0x3c,0x48}                                // PORT 3
+};
+
+PinName port_pin(PortName port, int pin) {
+    return (PinName)((port << PORT_SHIFT) | (pin << PIN_SHIFT) | (uint32_t)iocon_offset[port][pin]);
+}
+
+void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
+    obj->port = port;
+    obj->mask = mask;
+    
+    LPC_GPIO_TypeDef *port_reg = ((LPC_GPIO_TypeDef *) (LPC_GPIO0_BASE + (port * 0x10000)));
+    
+    obj->reg_data  = &port_reg->DATA;
+    obj->reg_dir = &port_reg->DIR;
+    
+    uint32_t i;
+    // The function is set per pin: reuse gpio logic
+    for (i=0; i<12; i++) {
+        if (obj->mask & (1<<i)) {
+            gpio_set(port_pin(obj->port, i));
+        }
+    }
+    
+    port_dir(obj, dir);
+}
+
+void port_mode(port_t *obj, PinMode mode) {
+    uint32_t i;
+    // The mode is set per pin: reuse pinmap logic
+    for (i=0; i<12; i++) {
+        if (obj->mask & (1<<i)) {
+            pin_mode(port_pin(obj->port, i), mode);
+        }
+    }
+}
+
+void port_dir(port_t *obj, PinDirection dir) {
+    switch (dir) {
+        case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break;
+        case PIN_OUTPUT: *obj->reg_dir |=  obj->mask; break;
+    }
+}
+
+void port_write(port_t *obj, int value) {
+    *obj->reg_data = (value & obj->mask);
+}
+
+int port_read(port_t *obj) {
+    return (*obj->reg_data & obj->mask);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/hal/TARGET_NXP/pwmout_api.c	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,182 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "pwmout_api.h"
+#include "cmsis.h"
+#include "pinmap.h"
+#include "error.h"
+
+#define TCR_CNT_EN       0x00000001
+#define TCR_RESET        0x00000002
+
+/* To have a PWM where we can change both the period and the duty cycle,
+ * we need an entire timer. With the following conventions:
+ *   * MR3 is used for the PWM period
+ *   * MR0, MR1, MR2 are used for the duty cycle
+ */
+static const PinMap PinMap_PWM[] = {
+    /* CT16B0 */
+    {P0_8 , PWM_1, 0x02},   /* MR0 */
+    {P0_9 , PWM_2, 0x02},   /* MR1 */
+
+    /* CT16B1 */
+    {P1_9 , PWM_3, 0x01},   /* MR0 */
+    {P1_10, PWM_4, 0x02},   /* MR1 */
+
+    /* CT32B0 */
+    {P0_1 , PWM_5, 0x02},   /* MR2 */
+
+    {NC   , NC    ,0x00}
+};
+
+typedef struct {
+    uint8_t timer;
+    uint8_t mr;
+} timer_mr;
+
+static timer_mr pwm_timer_map[5] = {
+    {0, 0}, /* CT16B0, MR0 */
+    {0, 1}, /* CT16B0, MR1 */
+
+    {1, 0}, /* CT16B1, MR0 */
+    {1, 1}, /* CT16B1, MR1 */
+
+    {2, 2}, /* CT32B0, MR2 */
+};
+
+static LPC_TMR_TypeDef *Timers[3] = {
+    LPC_TMR16B0, LPC_TMR16B1,
+    LPC_TMR32B0
+};
+
+void pwmout_init(pwmout_t* obj, PinName pin) {
+    // determine the channel
+    PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM);
+    if (pwm == (uint32_t)NC)
+        error("PwmOut pin mapping failed");
+    
+    obj->pwm = pwm;
+    
+    // Timer registers
+    timer_mr tid = pwm_timer_map[pwm];
+    LPC_TMR_TypeDef *timer = Timers[tid.timer];
+    
+    // Disable timer
+    timer->TCR = 0;
+    
+    // Power the correspondent timer
+    LPC_SYSCON->SYSAHBCLKCTRL |= 1 << (tid.timer + 7);
+    
+    /* Enable PWM function */
+    timer->PWMC = (1 << 3)|(1 << 2)|(1 << 1)|(1 << 0);
+    
+    /* Reset Functionality on MR3 controlling the PWM period */
+    timer->MCR = 1 << 10;
+    
+    if (timer == LPC_TMR16B0 || timer == LPC_TMR16B1) {
+    /* Set 16-bit timer prescaler to avoid timer expire for default 20ms */
+    /* This can be also modified by user application, but the prescaler value */
+    /* might be trade-off to timer accuracy */
+        timer->PR = 30;
+    }
+
+    // default to 20ms: standard for servos, and fine for e.g. brightness control
+    pwmout_period_ms(obj, 20);
+    pwmout_write    (obj, 0);
+    
+    // Wire pinout
+    pinmap_pinout(pin, PinMap_PWM);
+}
+
+void pwmout_free(pwmout_t* obj) {
+    // [TODO]
+}
+
+void pwmout_write(pwmout_t* obj, float value) {
+    if (value < 0.0f) {
+        value = 0.0;
+    } else if (value > 1.0f) {
+        value = 1.0;
+    }
+    
+    timer_mr tid = pwm_timer_map[obj->pwm];
+    LPC_TMR_TypeDef *timer = Timers[tid.timer];
+    uint32_t t_off = timer->MR3 - (uint32_t)((float)(timer->MR3) * value);
+    
+    timer->TCR = TCR_RESET;
+    timer->MR[tid.mr] = t_off;
+    timer->TCR = TCR_CNT_EN;
+}
+
+float pwmout_read(pwmout_t* obj) {
+    timer_mr tid = pwm_timer_map[obj->pwm];
+    LPC_TMR_TypeDef *timer = Timers[tid.timer];
+    
+    float v = (float)(timer->MR3 - timer->MR[tid.mr]) / (float)(timer->MR3);
+    return (v > 1.0f) ? (1.0f) : (v);
+}
+
+void pwmout_period(pwmout_t* obj, float seconds) {
+    pwmout_period_us(obj, seconds * 1000000.0f);
+}
+
+void pwmout_period_ms(pwmout_t* obj, int ms) {
+    pwmout_period_us(obj, ms * 1000);
+}
+
+// Set the PWM period, keeping the duty cycle the same.
+void pwmout_period_us(pwmout_t* obj, int us) {
+    int i = 0;
+    uint32_t period_ticks;
+    
+    timer_mr tid = pwm_timer_map[obj->pwm];
+    LPC_TMR_TypeDef *timer = Timers[tid.timer];
+    uint32_t old_period_ticks = timer->MR3;
+    period_ticks = (SystemCoreClock / 1000000 * us) / (timer->PR + 1);
+
+    timer->TCR = TCR_RESET;
+    timer->MR3 = period_ticks;
+    
+    // Scale the pulse width to preserve the duty ratio
+    if (old_period_ticks > 0) {
+        for (i=0; i<3; i++) {
+            uint32_t t_off = period_ticks - (uint32_t)(((uint64_t)timer->MR[i] * (uint64_t)period_ticks) / (uint64_t)old_period_ticks);
+            timer->MR[i] = t_off;
+        }
+    }
+    timer->TCR = TCR_CNT_EN;
+}
+
+void pwmout_pulsewidth(pwmout_t* obj, float seconds) {
+    pwmout_pulsewidth_us(obj, seconds * 1000000.0f);
+}
+
+void pwmout_pulsewidth_ms(pwmout_t* obj, int ms) {
+    pwmout_pulsewidth_us(obj, ms * 1000);
+}
+
+void pwmout_pulsewidth_us(pwmout_t* obj, int us) {
+    timer_mr tid = pwm_timer_map[obj->pwm];
+    LPC_TMR_TypeDef *timer = Timers[tid.timer];
+    uint32_t t_on = (uint32_t)((((uint64_t)SystemCoreClock * (uint64_t)us) / (uint64_t)1000000) / (timer->PR + 1));
+    
+    timer->TCR = TCR_RESET;
+    if (t_on > timer->MR3) {
+        pwmout_period_us(obj, us);
+    }
+    uint32_t t_off = timer->MR3 - t_on;
+    timer->MR[tid.mr] = t_off;
+    timer->TCR = TCR_CNT_EN;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/hal/TARGET_NXP/reserved_pins.h	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,8 @@
+// List of reserved pins for LPC1114
+
+#ifndef RESERVED_PINS_H
+#define RESERVED_PINS_H
+
+#define TARGET_RESERVED_PINS {P0_0, P0_11, P1_0, P1_1, P1_2}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/hal/TARGET_NXP/serial_api.c	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,278 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// math.h required for floating point operations for baud rate calculation
+#include <math.h>
+#include <string.h>
+
+#include "serial_api.h"
+#include "cmsis.h"
+#include "pinmap.h"
+#include "error.h"
+
+/******************************************************************************
+ * INITIALIZATION
+ ******************************************************************************/
+#define UART_NUM    1
+
+static const PinMap PinMap_UART_TX[] = {
+    {P2_8 , UART_0, 0x02},
+    {P3_5 , UART_0, 0x02},
+    {P3_0 , UART_0, 0x03},
+    {P1_7 , UART_0, 0x01},
+    {NC   , NC    , 0x00}
+};
+
+static const PinMap PinMap_UART_RX[] = {
+    {P2_7 , UART_0, 0x02},
+    {P3_4 , UART_0, 0x02},
+    {P3_1 , UART_0, 0x03},
+    {P1_6 , UART_0, 0x01},
+    {NC   , NC    , 0x00}
+};
+
+static uint32_t serial_irq_ids[UART_NUM] = {0};
+static uart_irq_handler irq_handler;
+
+int stdio_uart_inited = 0;
+serial_t stdio_uart;
+
+void serial_init(serial_t *obj, PinName tx, PinName rx) {
+    int is_stdio_uart = 0;
+    
+    // determine the UART to use
+    UARTName uart_tx = (UARTName)pinmap_peripheral(tx, PinMap_UART_TX);
+    UARTName uart_rx = (UARTName)pinmap_peripheral(rx, PinMap_UART_RX);
+    UARTName uart = (UARTName)pinmap_merge(uart_tx, uart_rx);
+    if ((int)uart == NC) {
+        error("Serial pinout mapping failed");
+    }
+    
+    obj->uart = (LPC_UART_TypeDef *)uart;
+    LPC_SYSCON->SYSAHBCLKCTRL |= (1<<12);
+    
+    // enable fifos and default rx trigger level
+    obj->uart->FCR = 1 << 0  // FIFO Enable - 0 = Disables, 1 = Enabled
+                   | 0 << 1  // Rx Fifo Reset
+                   | 0 << 2  // Tx Fifo Reset
+                   | 0 << 6; // Rx irq trigger level - 0 = 1 char, 1 = 4 chars, 2 = 8 chars, 3 = 14 chars
+    
+    // disable irqs
+    obj->uart->IER = 0 << 0  // Rx Data available irq enable
+                   | 0 << 1  // Tx Fifo empty irq enable
+                   | 0 << 2; // Rx Line Status irq enable
+    
+    // set default baud rate and format
+    serial_baud  (obj, 9600);
+    serial_format(obj, 8, ParityNone, 1);
+    
+    // pinout the chosen uart
+    pinmap_pinout(tx, PinMap_UART_TX);
+    pinmap_pinout(rx, PinMap_UART_RX);
+    
+    // set rx/tx pins in PullUp mode
+    pin_mode(tx, PullUp);
+    pin_mode(rx, PullUp);
+    
+    switch (uart) {
+        case UART_0: obj->index = 0; break;
+    }
+    
+    is_stdio_uart = (uart == STDIO_UART) ? (1) : (0);
+    
+    if (is_stdio_uart) {
+        stdio_uart_inited = 1;
+        memcpy(&stdio_uart, obj, sizeof(serial_t));
+    }
+}
+
+void serial_free(serial_t *obj) {
+    serial_irq_ids[obj->index] = 0;
+}
+
+// serial_baud
+// set the baud rate, taking in to account the current SystemFrequency
+void serial_baud(serial_t *obj, int baudrate) {
+    LPC_SYSCON->UARTCLKDIV = 0x1;
+    uint32_t PCLK = SystemCoreClock;
+    // First we check to see if the basic divide with no DivAddVal/MulVal
+    // ratio gives us an integer result. If it does, we set DivAddVal = 0,
+    // MulVal = 1. Otherwise, we search the valid ratio value range to find
+    // the closest match. This could be more elegant, using search methods
+    // and/or lookup tables, but the brute force method is not that much
+    // slower, and is more maintainable.
+    uint16_t DL = PCLK / (16 * baudrate);
+    
+    uint8_t DivAddVal = 0;
+    uint8_t MulVal = 1;
+    int hit = 0;
+    uint16_t dlv;
+    uint8_t mv, dav;
+    if ((PCLK % (16 * baudrate)) != 0) {     // Checking for zero remainder
+        float err_best = (float) baudrate;
+        uint16_t dlmax = DL;
+        for ( dlv = (dlmax/2); (dlv <= dlmax) && !hit; dlv++) {
+            for ( mv = 1; mv <= 15; mv++) {
+                for ( dav = 1; dav < mv; dav++) {
+                    float ratio = 1.0f + ((float) dav / (float) mv);
+                    float calcbaud = (float)PCLK / (16.0f * (float) dlv * ratio);
+                    float err = fabs(((float) baudrate - calcbaud) / (float) baudrate);
+                    if (err < err_best) {
+                        DL = dlv;
+                        DivAddVal = dav;
+                        MulVal = mv;
+                        err_best = err;
+                        if (err < 0.001f) {
+                            hit = 1;
+                        }
+                    }
+                }
+            }
+        }
+    }
+    
+    // set LCR[DLAB] to enable writing to divider registers
+    obj->uart->LCR |= (1 << 7);
+    
+    // set divider values
+    obj->uart->DLM = (DL >> 8) & 0xFF;
+    obj->uart->DLL = (DL >> 0) & 0xFF;
+    obj->uart->FDR = (uint32_t) DivAddVal << 0
+                   | (uint32_t) MulVal    << 4;
+    
+    // clear LCR[DLAB]
+    obj->uart->LCR &= ~(1 << 7);
+}
+
+void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits) {
+    // 0: 1 stop bits, 1: 2 stop bits
+    if (stop_bits != 1 && stop_bits != 2) {
+        error("Invalid stop bits specified");
+    }
+    stop_bits -= 1;
+    
+    // 0: 5 data bits ... 3: 8 data bits
+    if (data_bits < 5 || data_bits > 8) {
+        error("Invalid number of bits (%d) in serial format, should be 5..8", data_bits);
+    }
+    data_bits -= 5;
+
+    int parity_enable, parity_select;
+    switch (parity) {
+        case ParityNone: parity_enable = 0; parity_select = 0; break;
+        case ParityOdd : parity_enable = 1; parity_select = 0; break;
+        case ParityEven: parity_enable = 1; parity_select = 1; break;
+        case ParityForced1: parity_enable = 1; parity_select = 2; break;
+        case ParityForced0: parity_enable = 1; parity_select = 3; break;
+        default:
+            error("Invalid serial parity setting");
+            return;
+    }
+    
+    obj->uart->LCR = data_bits            << 0
+                   | stop_bits            << 2
+                   | parity_enable        << 3
+                   | parity_select        << 4;
+}
+
+/******************************************************************************
+ * INTERRUPTS HANDLING
+ ******************************************************************************/
+static inline void uart_irq(uint32_t iir, uint32_t index) {
+    // [Chapter 14] LPC17xx UART0/2/3: UARTn Interrupt Handling
+    SerialIrq irq_type;
+    switch (iir) {
+        case 1: irq_type = TxIrq; break;
+        case 2: irq_type = RxIrq; break;
+        default: return;
+    }
+    
+    if (serial_irq_ids[index] != 0)
+        irq_handler(serial_irq_ids[index], irq_type);
+}
+
+void uart0_irq() {uart_irq((LPC_UART->IIR >> 1) & 0x7, 0);}
+
+void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id) {
+    irq_handler = handler;
+    serial_irq_ids[obj->index] = id;
+}
+
+void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) {
+    IRQn_Type irq_n = (IRQn_Type)0;
+    uint32_t vector = 0;
+    switch ((int)obj->uart) {
+        case UART_0:
+            irq_n=UART_IRQn;
+            vector = (uint32_t)&uart0_irq;
+            break;
+        default:
+            return;
+    }
+    
+    if (enable) {
+        obj->uart->IER |= 1 << irq;
+        NVIC_SetVector(irq_n, vector);
+        NVIC_EnableIRQ(irq_n);
+    } else { // disable
+        int all_disabled = 0;
+        SerialIrq other_irq = (irq == RxIrq) ? (TxIrq) : (RxIrq);
+
+        obj->uart->IER &= ~(1 << irq);
+        all_disabled = (obj->uart->IER & (1 << other_irq)) == 0;
+        
+        if (all_disabled)
+            NVIC_DisableIRQ(irq_n);
+    }
+}
+
+/******************************************************************************
+ * READ/WRITE
+ ******************************************************************************/
+int serial_getc(serial_t *obj) {
+    while (!serial_readable(obj));
+    return obj->uart->RBR;
+}
+
+void serial_putc(serial_t *obj, int c) {
+    while (!serial_writable(obj));
+    obj->uart->THR = c;
+}
+
+int serial_readable(serial_t *obj) {
+    return obj->uart->LSR & 0x01;
+}
+
+int serial_writable(serial_t *obj) {
+    return obj->uart->LSR & 0x20;
+}
+
+void serial_clear(serial_t *obj) {
+    obj->uart->FCR = 1 << 1  // rx FIFO reset
+                   | 1 << 2  // tx FIFO reset
+                   | 0 << 6; // interrupt depth
+}
+
+void serial_pinout_tx(PinName tx) {
+    pinmap_pinout(tx, PinMap_UART_TX);
+}
+
+void serial_break_clear(serial_t *obj) {
+    obj->uart->LCR &= ~(1 << 6);
+}
+
+void serial_break_set(serial_t *obj) {
+    obj->uart->LCR |= 1 << 6;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/hal/TARGET_NXP/sleep.c	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,79 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "sleep_api.h"
+#include "cmsis.h"
+#include "mbed_interface.h"
+
+void sleep(void) {
+#if DEVICE_SEMIHOST
+    // ensure debug is disconnected
+    mbed_interface_disconnect();
+#endif
+    
+    // PCON[DPDEN] set to sleep
+    LPC_PMU->PCON = 0x0;
+    
+    // SRC[SLEEPDEEP] set to 0 = sleep
+    SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk;
+    
+    // wait for interrupt
+    __WFI();
+}
+
+/*
+* The mbed lpc1768 does not support the deepsleep mode
+* as a debugger is connected to it (the mbed interface).
+*
+* As mentionned in an application note from NXP:
+*
+*       http://www.po-star.com/public/uploads/20120319123122_141.pdf
+*
+*       {{{
+*       The user should be aware of certain limitations during debugging.
+*       The most important is that, due to limitations of the Cortex-M3
+*       integration, the LPC17xx cannot wake up in the usual manner from
+*       Deep Sleep and Power-down modes. It is recommended not to use these
+*       modes during debug. Once an application is downloaded via JTAG/SWD
+*       interface, the USB to SWD/JTAG debug adapter (Keil ULINK2 for example)
+*       should be removed from the target board, and thereafter, power cycle
+*       the LPC17xx to allow wake-up from deep sleep and power-down modes
+*       }}}
+*
+*       As the interface firmware does not reset the target when a
+*       mbed_interface_disconnect() semihosting call is made, the
+*       core cannot wake-up from deepsleep.
+*
+*       We treat a deepsleep() as a normal sleep().
+*/
+
+void deepsleep(void) {
+#if DEVICE_SEMIHOST
+    // ensure debug is disconnected
+    mbed_interface_disconnect();
+#endif
+    
+    // PCON[DPDEN] set to deepsleep
+    LPC_PMU->PCON = 0x2;
+    
+    // SRC[SLEEPDEEP] set to 1 = deep sleep
+    SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
+    
+    // Power up everything after powerdown
+    LPC_SYSCON->PDAWAKECFG &= 0xFFFFF800;
+    
+    // wait for interrupt
+    __WFI();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/hal/TARGET_NXP/spi_api.c	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,214 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <math.h>
+#include "spi_api.h"
+#include "cmsis.h"
+#include "pinmap.h"
+#include "error.h"
+
+static const PinMap PinMap_SPI_SCLK[] = {
+    {P0_6 , SPI_0, 0x02},
+    // {P0_10, SPI_0, 0x02}, -- should be mapped to SWCLK only
+    {P2_11, SPI_0, 0x01},
+    {P2_1 , SPI_1, 0x02},
+    {NC   , NC   , 0}
+};
+
+static const PinMap PinMap_SPI_MOSI[] = {
+    {P0_9 , SPI_0, 0x01},
+    {P2_3 , SPI_1, 0x02},
+    {NC   , NC   , 0}
+};
+
+static const PinMap PinMap_SPI_MISO[] = {
+    {P0_8 , SPI_0, 0x01},
+    {P2_2 , SPI_1, 0x02},
+    {NC   , NC   , 0}
+};
+
+static const PinMap PinMap_SPI_SSEL[] = {
+    {P0_2 , SPI_0, 0x01},
+    {P2_0 , SPI_1, 0x02},
+    {NC   , NC   , 0}
+};
+
+static inline int ssp_disable(spi_t *obj);
+static inline int ssp_enable(spi_t *obj);
+
+void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel) {
+    // determine the SPI to use
+    SPIName spi_mosi = (SPIName)pinmap_peripheral(mosi, PinMap_SPI_MOSI);
+    SPIName spi_miso = (SPIName)pinmap_peripheral(miso, PinMap_SPI_MISO);
+    SPIName spi_sclk = (SPIName)pinmap_peripheral(sclk, PinMap_SPI_SCLK);
+    SPIName spi_ssel = (SPIName)pinmap_peripheral(ssel, PinMap_SPI_SSEL);
+    SPIName spi_data = (SPIName)pinmap_merge(spi_mosi, spi_miso);
+    SPIName spi_cntl = (SPIName)pinmap_merge(spi_sclk, spi_ssel);
+    
+    obj->spi = (LPC_SSP_TypeDef*)pinmap_merge(spi_data, spi_cntl);
+    
+    if ((int)obj->spi == NC) {
+        error("SPI pinout mapping failed");
+    }
+    
+    // enable power and clocking
+    switch ((int)obj->spi) {
+        case SPI_0:
+            LPC_SYSCON->SYSAHBCLKCTRL |= 1 << 11;
+            LPC_SYSCON->SSP0CLKDIV = 0x01;
+            LPC_SYSCON->PRESETCTRL |= 1 << 0;
+            break;
+        case SPI_1:
+            LPC_SYSCON->SYSAHBCLKCTRL |= 1 << 18;
+            LPC_SYSCON->SSP1CLKDIV = 0x01;
+            LPC_SYSCON->PRESETCTRL |= 1 << 2;
+            break;
+    }
+    
+    // set default format and frequency
+    if (ssel == NC) {
+        spi_format(obj, 8, 0, 0);  // 8 bits, mode 0, master
+    } else {
+        spi_format(obj, 8, 0, 1);  // 8 bits, mode 0, slave
+    }
+    spi_frequency(obj, 1000000);
+    
+    // enable the ssp channel
+    ssp_enable(obj);
+    
+    // pin out the spi pins
+    pinmap_pinout(mosi, PinMap_SPI_MOSI);
+    pinmap_pinout(miso, PinMap_SPI_MISO);
+    pinmap_pinout(sclk, PinMap_SPI_SCLK);
+    if (ssel != NC) {
+        pinmap_pinout(ssel, PinMap_SPI_SSEL);
+    }
+}
+
+void spi_free(spi_t *obj) {}
+
+void spi_format(spi_t *obj, int bits, int mode, int slave) {
+    ssp_disable(obj);
+    
+    if (!(bits >= 4 && bits <= 16) || !(mode >= 0 && mode <= 3)) {
+        error("SPI format error");
+    }
+    
+    int polarity = (mode & 0x2) ? 1 : 0;
+    int phase = (mode & 0x1) ? 1 : 0;
+    
+    // set it up
+    int DSS = bits - 1;            // DSS (data select size)
+    int SPO = (polarity) ? 1 : 0;  // SPO - clock out polarity
+    int SPH = (phase) ? 1 : 0;     // SPH - clock out phase
+    
+    int FRF = 0;                   // FRF (frame format) = SPI
+    uint32_t tmp = obj->spi->CR0;
+    tmp &= ~(0xFFFF);
+    tmp |= DSS << 0
+        | FRF << 4
+        | SPO << 6
+        | SPH << 7;
+    obj->spi->CR0 = tmp;
+    
+    tmp = obj->spi->CR1;
+    tmp &= ~(0xD);
+    tmp |= 0 << 0                   // LBM - loop back mode - off
+        | ((slave) ? 1 : 0) << 2   // MS - master slave mode, 1 = slave
+        | 0 << 3;                  // SOD - slave output disable - na
+    obj->spi->CR1 = tmp;
+    
+    ssp_enable(obj);
+}
+
+void spi_frequency(spi_t *obj, int hz) {
+    ssp_disable(obj);
+    
+    uint32_t PCLK = SystemCoreClock;
+    
+    int prescaler;
+    
+    for (prescaler = 2; prescaler <= 254; prescaler += 2) {
+        int prescale_hz = PCLK / prescaler;
+        
+        // calculate the divider
+        int divider = floor(((float)prescale_hz / (float)hz) + 0.5f);
+        
+        // check we can support the divider
+        if (divider < 256) {
+            // prescaler
+            obj->spi->CPSR = prescaler;
+            
+            // divider
+            obj->spi->CR0 &= ~(0xFFFF << 8);
+            obj->spi->CR0 |= (divider - 1) << 8;
+            ssp_enable(obj);
+            return;
+        }
+    }
+    error("Couldn't setup requested SPI frequency");
+}
+
+static inline int ssp_disable(spi_t *obj) {
+    return obj->spi->CR1 &= ~(1 << 1);
+}
+
+static inline int ssp_enable(spi_t *obj) {
+    return obj->spi->CR1 |= (1 << 1);
+}
+
+static inline int ssp_readable(spi_t *obj) {
+    return obj->spi->SR & (1 << 2);
+}
+
+static inline int ssp_writeable(spi_t *obj) {
+    return obj->spi->SR & (1 << 1);
+}
+
+static inline void ssp_write(spi_t *obj, int value) {
+    while (!ssp_writeable(obj));
+    obj->spi->DR = value;
+}
+
+static inline int ssp_read(spi_t *obj) {
+    while (!ssp_readable(obj));
+    return obj->spi->DR;
+}
+
+static inline int ssp_busy(spi_t *obj) {
+    return (obj->spi->SR & (1 << 4)) ? (1) : (0);
+}
+
+int spi_master_write(spi_t *obj, int value) {
+    ssp_write(obj, value);
+    return ssp_read(obj);
+}
+
+int spi_slave_receive(spi_t *obj) {
+    return (ssp_readable(obj) && !ssp_busy(obj)) ? (1) : (0);
+};
+
+int spi_slave_read(spi_t *obj) {
+    return obj->spi->DR;
+}
+
+void spi_slave_write(spi_t *obj, int value) {
+    while (ssp_writeable(obj) == 0) ;
+    obj->spi->DR = value;
+}
+
+int spi_busy(spi_t *obj) {
+    return ssp_busy(obj);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/hal/TARGET_NXP/us_ticker.c	Sun Oct 27 20:12:31 2013 +0000
@@ -0,0 +1,62 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <stddef.h>
+#include "us_ticker_api.h"
+#include "PeripheralNames.h"
+
+#define US_TICKER_TIMER          ((LPC_TMR_TypeDef *)LPC_CT32B1_BASE)
+#define US_TICKER_TIMER_IRQn     TIMER_32_1_IRQn
+
+int us_ticker_inited = 0;
+
+void us_ticker_init(void) {
+    if (us_ticker_inited) return;
+    us_ticker_inited = 1;
+    
+    LPC_SYSCON->SYSAHBCLKCTRL |= (1<<10); // Clock TIMER_1
+    uint32_t PCLK = SystemCoreClock;
+
+    US_TICKER_TIMER->TCR = 0x2;  // reset
+
+    uint32_t prescale = PCLK / 1000000; // default to 1MHz (1 us ticks)
+    US_TICKER_TIMER->PR = prescale - 1;
+    US_TICKER_TIMER->TCR = 1; // enable = 1, reset = 0
+
+    NVIC_SetVector(US_TICKER_TIMER_IRQn, (uint32_t)us_ticker_irq_handler);
+    NVIC_EnableIRQ(US_TICKER_TIMER_IRQn);
+}
+
+uint32_t us_ticker_read() {
+    if (!us_ticker_inited)
+        us_ticker_init();
+    
+    return US_TICKER_TIMER->TC;
+}
+
+void us_ticker_set_interrupt(unsigned int timestamp) {
+    // set match value
+    US_TICKER_TIMER->MR0 = timestamp;
+    // enable match interrupt
+    US_TICKER_TIMER->MCR |= 1;
+}
+
+void us_ticker_disable_interrupt(void) {
+    US_TICKER_TIMER->MCR &= ~1;
+}
+
+void us_ticker_clear_interrupt(void) {
+    US_TICKER_TIMER->IR = 1;
+}
--- a/targets/hal/TARGET_STM/TARGET_STM32F4XX/PeripheralNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    UART_1 = (int)USART1_BASE,
-    UART_2 = (int)USART2_BASE,
-    UART_3 = (int)USART3_BASE,
-    UART_4 = (int)UART4_BASE,
-    UART_5 = (int)UART5_BASE,
-    UART_6 = (int)USART6_BASE
-} UARTName;
-
-typedef enum {
-    ADC0_0 = 0,
-    ADC0_1,
-    ADC0_2,
-    ADC0_3,
-    ADC0_4,
-    ADC0_5,
-    ADC0_6,
-    ADC0_7,
-    ADC0_8,
-    ADC0_9,
-    ADC0_10,
-    ADC0_11,
-    ADC0_12,
-    ADC0_13,
-    ADC0_14,
-    ADC0_15
-} ADCName;
-
-typedef enum {
-    DAC_0 = 0,
-    DAC_1
-} DACName;
-
-typedef enum {
-    SPI_1 = (int)SPI1_BASE,
-    SPI_2 = (int)SPI2_BASE,
-    SPI_3 = (int)SPI3_BASE,
-} SPIName;
-
-typedef enum {
-    I2C_1 = (int)I2C1_BASE,
-    I2C_2 = (int)I2C2_BASE,
-    I2C_3 = (int)I2C3_BASE
-} I2CName;
-
-typedef enum {
-    PWM_1 = 1,
-    PWM_2,
-    PWM_3,
-    PWM_4,
-    PWM_5,
-    PWM_6
-} PWMName;
-
-typedef enum {
-     CAN_1 = (int)CAN1_BASE,
-     CAN_2 = (int)CAN2_BASE
-} CANName;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_STM/TARGET_STM32F4XX/PinNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PINNAMES_H
-#define MBED_PINNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define STM_PIN_DATA(MODE, FUNC)    (((MODE) << 8) | (FUNC))
-#define STM_PIN_MODE(X)             ((X) >> 8)
-#define STM_PIN_FUNC(X)             ((X) & 0xFF)
-
-typedef enum {
-    PIN_INPUT,
-    PIN_OUTPUT
-} PinDirection;
-
-#define PORT_SHIFT  6
-
-typedef enum {
-    // STM32 Pin Names
-    PA_0 = 0, PA_1, PA_2, PA_3, PA_4, PA_5, PA_6, PA_7, PA_8, PA_9, PA_10, PA_11, PA_12, PA_13, PA_14, PA_15,
-    PB_0, PB_1, PB_2, PB_3, PB_4, PB_5, PB_6, PB_7, PB_8, PB_9, PB_10, PB_11, PB_12, PB_13, PB_14, PB_15,
-    PC_0, PC_1, PC_2, PC_3, PC_4, PC_5, PC_6, PC_7, PC_8, PC_9, PC_10, PC_11, PC_12, PC_13, PC_14, PC_15,
-    PD_0, PD_1, PD_2, PD_3, PD_4, PD_5, PD_6, PD_7, PD_8, PD_9, PD_10, PD_11, PD_12, PD_13, PD_14, PD_15,
-    PE_0, PE_1, PE_2, PE_3, PE_4, PE_5, PE_6, PE_7, PE_8, PE_9, PE_10, PE_11, PE_12, PE_13, PE_14, PE_15,
-    PF_0, PF_1, PF_2, PF_3, PF_4, PF_5, PF_6, PF_7, PF_8, PF_9, PF_10, PF_11, PF_12, PF_13, PF_14, PF_15,
-    PH_0, PH_1, PH_2, PH_3, PH_4, PH_5, PH_6, PH_7, PH_8, PH_9, PH_10, PH_11,
-
-    // Not connected
-    NC = (int)0xFFFFFFFF
-} PinName;
-
-typedef enum {
-    PullNone = 0,
-    PullUp = 1,
-    PullDown = 2,
-    OpenDrain = 3
-} PinMode;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_STM/TARGET_STM32F4XX/PortNames.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_PORTNAMES_H
-#define MBED_PORTNAMES_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-    PortA = 0,
-    PortB = 1,
-    PortC = 2,
-    PortD = 3,
-    PortE = 4,
-    PortF = 5,
-    PortG = 6,
-    PortH = 7,
-    PortI = 8
-} PortName;
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/targets/hal/TARGET_STM/TARGET_STM32F4XX/analogin_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "analogin_api.h"
-
-#if DEVICE_ANALOGIN
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-#define ADC_10BIT_RANGE             0x3FF
-#define ADC_12BIT_RANGE             0xFFF
-
-static const PinMap PinMap_ADC[] = {
-    {PA_0, ADC0_0,  STM_PIN_DATA(3, 0)},
-    {PA_1, ADC0_1,  STM_PIN_DATA(3, 0)},
-    {PA_2, ADC0_2,  STM_PIN_DATA(3, 0)},
-    {PA_3, ADC0_3,  STM_PIN_DATA(3, 0)},
-    {PA_4, ADC0_4,  STM_PIN_DATA(3, 0)},
-    {PA_5, ADC0_5,  STM_PIN_DATA(3, 0)},
-    {PA_6, ADC0_6,  STM_PIN_DATA(3, 0)},
-    {PA_7, ADC0_7,  STM_PIN_DATA(3, 0)},
-    {PB_0, ADC0_8,  STM_PIN_DATA(3, 0)},
-    {PB_1, ADC0_9,  STM_PIN_DATA(3, 0)},
-    {PC_0, ADC0_10, STM_PIN_DATA(3, 0)},
-    {PC_1, ADC0_11, STM_PIN_DATA(3, 0)},
-    {PC_2, ADC0_12, STM_PIN_DATA(3, 0)},
-    {PC_3, ADC0_13, STM_PIN_DATA(3, 0)},
-    {PC_4, ADC0_14, STM_PIN_DATA(3, 0)},
-    {PC_5, ADC0_15, STM_PIN_DATA(3, 0)},
-    {NC,   NC,      0}
-};
-
-#   define ADC_RANGE    ADC_12BIT_RANGE
-
-void analogin_init(analogin_t *obj, PinName pin) {
-    obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
-    if (obj->adc == (uint32_t)NC) {
-        error("ADC pin mapping failed");
-    }
-
-    // ensure power is turned on
-    RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN | RCC_AHB1ENR_GPIOBEN |
-                    RCC_AHB1ENR_GPIOCEN;
-    RCC->APB2ENR |= RCC_APB2ENR_ADC1EN;
-
-    // Enable the ADC
-    ADC1->CR2 |= ADC_CR2_ADON;
-
-    pinmap_pinout(pin, PinMap_ADC);
-}
-
-static inline uint32_t adc_read(analogin_t *obj) {
-    // Select the appropriate channel
-    ADC1->SQR3 = (int) obj->adc;
-
-    // Start conversion
-    ADC1->CR2 |= ADC_CR2_SWSTART;
-
-    // Wait for conversion to finish
-    while (!(ADC1->SR & ADC_SR_EOC));
-
-    uint32_t data = ADC1->DR;
-    return data; // 12 bit
-}
-
-static inline uint32_t adc_read_u32(analogin_t *obj) {
-    uint32_t value;
-    value = adc_read(obj);
-    return value;
-}
-
-uint16_t analogin_read_u16(analogin_t *obj) {
-    uint32_t value = adc_read_u32(obj);
-
-    return (value << 4) | ((value >> 8) & 0x000F); // 12 bit
-}
-
-float analogin_read(analogin_t *obj) {
-    uint32_t value = adc_read_u32(obj);
-    return (float)value * (1.0f / (float)ADC_RANGE);
-}
-
-#endif
--- a/targets/hal/TARGET_STM/TARGET_STM32F4XX/device.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_DEVICE_H
-#define MBED_DEVICE_H
-
-#define DEVICE_PORTIN           1
-#define DEVICE_PORTOUT          1
-#define DEVICE_PORTINOUT        1
-
-#define DEVICE_INTERRUPTIN      0
-
-#define DEVICE_ANALOGIN         1
-#define DEVICE_ANALOGOUT        0
-
-#define DEVICE_SERIAL           0
-
-#define DEVICE_I2C              1
-#define DEVICE_I2CSLAVE         0
-
-#define DEVICE_SPI              1
-#define DEVICE_SPISLAVE         1
-
-#define DEVICE_CAN              0
-
-#define DEVICE_RTC              0
-
-#define DEVICE_ETHERNET         0
-
-#define DEVICE_PWMOUT           0
-
-#define DEVICE_SLEEP            0
-
-#include "objects.h"
-
-#endif
--- a/targets/hal/TARGET_STM/TARGET_STM32F4XX/gpio_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "gpio_api.h"
-#include "pinmap.h"
-
-uint32_t gpio_set(PinName pin) {
-    uint32_t port_index = (uint32_t) pin >> 4;
-
-    // Enable GPIO peripheral clock
-    RCC->AHB1ENR |= 1 << port_index;
-
-    pin_function(pin, STM_PIN_DATA(0, 0));
-    return 1 << ((uint32_t) pin & 0xF);
-}
-
-void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) {
-    if(pin == NC) return;
-
-    obj->pin = pin;
-    obj->mask = gpio_set(pin);
-
-    uint32_t port_index = (uint32_t) pin >> 4;
-    
-    GPIO_TypeDef *port_reg = (GPIO_TypeDef *) (GPIOA_BASE + (port_index << 10));
-    obj->reg_mode = &port_reg->MODER;
-    obj->reg_set = &port_reg->BSRRL;
-    obj->reg_clr = &port_reg->BSRRH;
-    obj->reg_in  = &port_reg->IDR;
-
-
-    gpio_dir(obj, direction);
-
-    switch (direction) {
-        case PIN_OUTPUT: pin_mode(pin, PullNone); break;
-        case PIN_INPUT : pin_mode(pin, PullDown); break;
-    }
-}
-
-void gpio_mode(gpio_t *obj, PinMode mode) {
-    pin_mode(obj->pin, mode);
-}
-
-void gpio_dir(gpio_t *obj, PinDirection direction) {
-    switch (direction) {
-        case PIN_INPUT : pin_function(obj->pin, STM_PIN_DATA(0, 0)); break;
-        case PIN_OUTPUT: pin_function(obj->pin, STM_PIN_DATA(1, 0)); break;
-    }
-}
--- a/targets/hal/TARGET_STM/TARGET_STM32F4XX/gpio_object.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_GPIO_OBJECT_H
-#define MBED_GPIO_OBJECT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
-    PinName  pin;
-    uint32_t mask;
-
-    __IO uint32_t *reg_mode;
-    __IO uint16_t *reg_set;
-    __IO uint16_t *reg_clr;
-    __I  uint32_t *reg_in;
-    __O  uint32_t *reg_out;
-} gpio_t;
-
-static inline void gpio_write(gpio_t *obj, int value) {
-    if (value)
-        *obj->reg_set = obj->mask;
-    else
-        *obj->reg_clr = obj->mask;
-}
-
-static inline int gpio_read(gpio_t *obj) {
-    return ((*obj->reg_in & obj->mask) ? 1 : 0);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_STM/TARGET_STM32F4XX/i2c_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,296 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "i2c_api.h"
-
-#if DEVICE_I2C
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_I2C_SDA[] = {
-    {PB_7,  I2C_1, STM_PIN_DATA(2, 4)},
-    {PB_9,  I2C_1, STM_PIN_DATA(2, 4)},
-    {PB_11, I2C_2, STM_PIN_DATA(2, 4)},
-    {PC_9,  I2C_3, STM_PIN_DATA(2, 4)},
-    {PF_0,  I2C_2, STM_PIN_DATA(2, 4)},
-    {PH_5,  I2C_2, STM_PIN_DATA(2, 4)},
-    {PH_8,  I2C_3, STM_PIN_DATA(2, 4)},
-    {NC,    NC,    0}
-};
-
-static const PinMap PinMap_I2C_SCL[] = {
-    {PA_8,  I2C_3, STM_PIN_DATA(2, 4)},
-    {PB_6,  I2C_1, STM_PIN_DATA(2, 4)},
-    {PB_8,  I2C_1, STM_PIN_DATA(2, 4)},
-    {PB_10, I2C_2, STM_PIN_DATA(2, 4)},
-    {PF_1,  I2C_2, STM_PIN_DATA(2, 4)},
-    {PH_4,  I2C_2, STM_PIN_DATA(2, 4)},
-    {PH_7,  I2C_3, STM_PIN_DATA(2, 4)},
-    {NC,    NC,    0}
-};
-
-static const uint32_t I2C_addr_offset[2][4] = {
-    {0x0C, 0x20, 0x24, 0x28},
-    {0x30, 0x34, 0x38, 0x3C}
-};
-
-
-static inline void i2c_interface_enable(i2c_t *obj) {
-    obj->i2c->CR1 |= I2C_CR1_PE;
-}
-
-static inline void i2c_interface_disable(i2c_t *obj) {
-    obj->i2c->CR1 &= ~I2C_CR1_PE;
-}
-
-
-static inline void i2c_power_enable(i2c_t *obj) {
-    switch ((int)obj->i2c) {
-        case I2C_1:
-            RCC->AHB1ENR |= RCC_AHB1ENR_GPIOBEN;
-            RCC->APB1ENR |= RCC_APB1ENR_I2C1EN;
-            break;
-        case I2C_2:
-            RCC->AHB1ENR |= RCC_AHB1ENR_GPIOBEN | RCC_AHB1ENR_GPIOFEN |
-                            RCC_AHB1ENR_GPIOHEN;
-            RCC->APB1ENR |= RCC_APB1ENR_I2C2EN;
-            break;
-        case I2C_3:
-            RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN | RCC_AHB1ENR_GPIOCEN |
-                            RCC_AHB1ENR_GPIOHEN;
-            RCC->APB1ENR |= RCC_APB1ENR_I2C3EN;
-            break;
-    }
-}
-
-static inline void i2c_wait_status(i2c_t *obj, uint32_t sr1_mask,
-                                   uint32_t sr2_mask) {
-    while (!(((obj->i2c->SR1 & sr1_mask) >= sr1_mask) &&
-             ((obj->i2c->SR2 & sr2_mask) == sr2_mask)));
-}
-
-// Wait until the slave address has been acknowledged
-static inline void i2c_wait_addr_tx(i2c_t *obj) {
-    uint32_t sr1_mask = I2C_SR1_ADDR | I2C_SR1_TXE;
-    uint32_t sr2_mask = I2C_SR2_MSL | I2C_SR2_BUSY | I2C_SR2_TRA;
-    i2c_wait_status(obj, sr1_mask, sr2_mask);
-}
-
-// Wait until the slave address has been acknowledged
-static inline void i2c_wait_addr_rx(i2c_t *obj) {
-    uint32_t sr1_mask = I2C_SR1_ADDR;
-    uint32_t sr2_mask = I2C_SR2_MSL | I2C_SR2_BUSY;
-    i2c_wait_status(obj, sr1_mask, sr2_mask);
-}
-
-
-// Wait until a byte has been sent
-static inline void i2c_wait_send(i2c_t *obj) {
-    uint32_t sr1_mask = I2C_SR1_BTF | I2C_SR1_TXE;
-    uint32_t sr2_mask = I2C_SR2_MSL | I2C_SR2_BUSY | I2C_SR2_TRA;
-    i2c_wait_status(obj, sr1_mask, sr2_mask);
-}
-
-// Wait until a byte has been received
-static inline void i2c_wait_receive(i2c_t *obj) {
-    uint32_t sr1_mask = I2C_SR1_RXNE;
-    uint32_t sr2_mask = I2C_SR2_MSL | I2C_SR2_BUSY;
-    i2c_wait_status(obj, sr1_mask, sr2_mask);
-}
-
-// Wait until the start condition has been accepted
-static inline void i2c_wait_start(i2c_t *obj) {
-    uint32_t sr1_mask = I2C_SR1_SB;
-    uint32_t sr2_mask = I2C_SR2_MSL | I2C_SR2_BUSY;
-    i2c_wait_status(obj, sr1_mask, sr2_mask);
-}
-
-void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
-    // determine the SPI to use
-    I2CName i2c_sda = (I2CName)pinmap_peripheral(sda, PinMap_I2C_SDA);
-    I2CName i2c_scl = (I2CName)pinmap_peripheral(scl, PinMap_I2C_SCL);
-    obj->i2c = (I2C_TypeDef *)pinmap_merge(i2c_sda, i2c_scl);
-    
-    if ((int)obj->i2c == NC) {
-        error("I2C pin mapping failed");
-    }
-
-    // enable power
-    i2c_power_enable(obj);
-
-    pinmap_pinout(sda, PinMap_I2C_SDA);
-    pinmap_pinout(scl, PinMap_I2C_SCL);
-
-    pin_mode(sda, OpenDrain);
-    pin_mode(scl, OpenDrain);
-
-    // Force reset if the bus is stuck in the BUSY state
-    if (obj->i2c->SR2 & I2C_SR2_BUSY) {
-        obj->i2c->CR1 |= I2C_CR1_SWRST;
-        obj->i2c->CR1 &= ~I2C_CR1_SWRST;
-    }
-
-    // Set the peripheral clock frequency
-    obj->i2c->CR2 |= 42;
-
-    // set default frequency at 100k
-    i2c_frequency(obj, 100000);
-    i2c_interface_enable(obj);
-}
-
-inline int i2c_start(i2c_t *obj) {
-    // Wait until we are not busy any more
-    while (obj->i2c->SR2 & I2C_SR2_BUSY);
-
-    // Generate the start condition
-    obj->i2c->CR1 |= I2C_CR1_START;
-    i2c_wait_start(obj);
-
-    return 0;
-}
-
-inline int i2c_stop(i2c_t *obj) {
-    // Generate the stop condition
-    obj->i2c->CR1 |= I2C_CR1_STOP;
-    return 0;
-}
-
-
-static inline int i2c_do_write(i2c_t *obj, int value, uint8_t addr) {
-    obj->i2c->DR = value;
-    return 0;
-}
-
-static inline int i2c_do_read(i2c_t *obj, int last) {
-    if(last) {
-        // Don't acknowledge the byte
-        obj->i2c->CR1 &= ~(I2C_CR1_ACK);
-    } else {
-        // Acknowledge the byte
-        obj->i2c->CR1 |= I2C_CR1_ACK;
-    }
-
-    // Wait until we receive the byte
-    i2c_wait_receive(obj);
-
-    int data = obj->i2c->DR;
-    return data;
-}
-
-void i2c_frequency(i2c_t *obj, int hz) {
-    i2c_interface_disable(obj);
-    obj->i2c->CCR &= ~(I2C_CCR_CCR | I2C_CCR_FS);
-    if (hz > 100000) {
-        // Fast Mode
-        obj->i2c->CCR |= I2C_CCR_FS;
-        int result = 42000000 / (hz * 3);
-        obj->i2c->CCR |= result & I2C_CCR_CCR;
-        obj->i2c->TRISE = ((42 * 300) / 1000) + 1;
-    }
-    else {
-        // Standard mode
-        obj->i2c->CCR &= ~I2C_CCR_FS;
-        int result = 42000000 / (hz << 1);
-        result = result < 0x4 ? 0x4 : result;
-        obj->i2c->CCR |= result & I2C_CCR_CCR;
-        obj->i2c->TRISE = 42 + 1;
-    }
-    i2c_interface_enable(obj);
-}
-
-// The I2C does a read or a write as a whole operation
-// There are two types of error conditions it can encounter
-//  1) it can not obtain the bus
-//  2) it gets error responses at part of the transmission
-//
-// We tackle them as follows:
-//  1) we retry until we get the bus. we could have a "timeout" if we can not get it
-//      which basically turns it in to a 2)
-//  2) on error, we use the standard error mechanisms to report/debug
-//
-// Therefore an I2C transaction should always complete. If it doesn't it is usually
-// because something is setup wrong (e.g. wiring), and we don't need to programatically
-// check for that
-
-int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) {
-    int count;
-
-    i2c_start(obj);
-
-    // Send the slave address
-    i2c_do_write(obj, (address | 0x01), 1);
-
-    // Wait until we have transmitted and the ADDR byte is set
-    i2c_wait_addr_rx(obj);
-
-    // Read in all except last byte
-    for (count = 0; count < (length - 1); count++) {
-        int value = i2c_do_read(obj, 0);
-        data[count] = (char) value;
-    }
-
-    // read in last byte
-    int value = i2c_do_read(obj, 1);
-    data[count] = (char) value;
-
-    // If not repeated start, send stop.
-    if (stop) {
-        i2c_stop(obj);
-    }
-
-    return length;
-}
-
-int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) {
-    int i;
-
-    i2c_start(obj);
-
-    // Send the slave address
-    i2c_do_write(obj, (address & 0xFE), 1);
-    i2c_wait_addr_tx(obj);
-
-    for (i=0; i<length; i++) {
-        i2c_do_write(obj, data[i], 0);
-        i2c_wait_send(obj);
-    }
-
-    // If not repeated start, send stop.
-    if (stop) {
-        i2c_stop(obj);
-    }
-
-    return length;
-}
-
-void i2c_reset(i2c_t *obj) {
-    i2c_stop(obj);
-}
-
-int i2c_byte_read(i2c_t *obj, int last) {
-    return (i2c_do_read(obj, last) & 0xFF);
-}
-
-int i2c_byte_write(i2c_t *obj, int data) {
-    i2c_do_write(obj, (data & 0xFF), 0);
-    i2c_wait_send(obj);
-
-    // TODO: Should return whether write has been acknowledged
-    return 1;
-}
-
-#endif
--- a/targets/hal/TARGET_STM/TARGET_STM32F4XX/objects.h	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef MBED_OBJECTS_H
-#define MBED_OBJECTS_H
-
-#include "cmsis.h"
-#include "PortNames.h"
-#include "PeripheralNames.h"
-#include "PinNames.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct gpio_irq_s {
-    uint32_t port;
-    uint32_t pin;
-    uint32_t ch;
-};
-
-struct port_s {
-    __IO uint32_t *reg_mode;
-    __IO uint32_t *reg_in;
-    __IO uint32_t *reg_out;
-    __IO uint16_t *reg_set;
-    __IO uint16_t *reg_clr;
-    PortName port;
-    uint32_t mask;
-    PinDirection direction;
-};
-
-struct pwmout_s {
-    __IO uint32_t *MR;
-    PWMName pwm;
-};
-
-struct serial_s {
-    USART_TypeDef *uart;
-    int index;
-};
-
-struct analogin_s {
-    ADCName adc;
-};
-
-struct dac_s {
-    DACName dac;
-};
-
-struct can_s {
-    CAN_TypeDef *dev;
-};
-
-struct i2c_s {
-    I2C_TypeDef *i2c;
-};
-
-struct spi_s {
-    SPI_TypeDef *spi;
-};
-
-#include "gpio_object.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/targets/hal/TARGET_STM/TARGET_STM32F4XX/pinmap.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "pinmap.h"
-#include "error.h"
-
-/**
- * Set the pin into input, output, alternate function or analog mode
- */
-void pin_function(PinName pin, int data) {
-    if (pin == (uint32_t)NC) return;
-    
-    int mode = STM_PIN_MODE(data);
-    int func = STM_PIN_FUNC(data);
-    
-    uint32_t pin_number = (uint32_t)pin;
-    int port_index = pin_number >> 4;
-    int pin_index = (pin_number & 0xF);
-    GPIO_TypeDef * gpio = ((GPIO_TypeDef *) (GPIOA_BASE + (port_index << 10)));
-    
-    // MODE
-    int offset = pin_index << 1;
-    gpio->MODER &= ~(0x3 << offset);
-    gpio->MODER |= mode << offset;
-    
-    // Set high-speed mode
-    gpio->OSPEEDR &= ~(0x3 << offset);
-    gpio->OSPEEDR |= (0x2 << offset);
-    
-    // FUNCTION
-    // Bottom seven pins are in AFR[0], top seven in AFR[1]
-    offset = (pin_index & 0x7) << 2;
-    if (pin_index <= 0x7) {
-        gpio->AFR[0] &= ~(0xF << offset);
-        gpio->AFR[0] |= func << offset;
-    }
-    else {
-        gpio->AFR[1] &= ~(0xF << offset);
-        gpio->AFR[1] |= func << offset;
-    }
-}
-
-void pin_mode(PinName pin, PinMode mode) {
-    if (pin == (uint32_t)NC) { return; }
-
-    uint32_t pin_number = (uint32_t)pin;
-    int port_index = pin_number >> 4;
-    int pin_index = (pin_number & 0xF);
-    int offset = pin_index << 1;
-
-    GPIO_TypeDef * gpio = ((GPIO_TypeDef *) (GPIOA_BASE + (port_index << 10)));
-    if (mode == OpenDrain) {
-        gpio->OTYPER |= 1 << pin_index;
-    }
-    else {
-        gpio->OTYPER &= ~(1 << pin_index);
-        gpio->PUPDR &= ~(0x3 << offset);
-        gpio->PUPDR |= mode << offset;
-    }
-}
-
--- a/targets/hal/TARGET_STM/TARGET_STM32F4XX/port_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "port_api.h"
-#include "pinmap.h"
-#include "gpio_api.h"
-
-#if DEVICE_PORTIN || DEVICE_PORTOUT
-
-PinName port_pin(PortName port, int pin_n) {
-    return pin_n + (port << 4);
-}
-
-void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
-    obj->port = port;
-    obj->mask = mask;
-
-    uint32_t port_index = (uint32_t) port;
-
-    GPIO_TypeDef *port_reg = (GPIO_TypeDef *)(GPIOA_BASE + (port_index << 10));
-    // Enable GPIO peripheral clock
-    RCC->AHB1ENR |= 1 << port_index;
-
-    obj->reg_mode = &port_reg->MODER;
-    obj->reg_set = &port_reg->BSRRH;
-    obj->reg_clr = &port_reg->BSRRL;
-    obj->reg_in  = &port_reg->IDR;
-    obj->reg_out  = &port_reg->ODR;
-
-    port_dir(obj, dir);
-}
-
-void port_mode(port_t *obj, PinMode mode) {
-    uint32_t i;
-    // The mode is set per pin: reuse pinmap logic
-    for (i=0; i<16; i++) {
-        if (obj->mask & (1<<i)) {
-            pin_mode(port_pin(obj->port, i), mode);
-        }
-    }
-}
-
-void port_dir(port_t *obj, PinDirection dir) {
-    obj->direction = dir;
-    uint32_t tmp = *obj->reg_mode;
-    for (int i=0; i<16; i++) {
-        if (obj->mask & (1 << i)) {
-            // Clear the mode bits (i.e. set to input)
-            tmp &= ~(0x3 << (i << 1));
-            if (dir == PIN_OUTPUT) {
-                // Set to output
-                tmp |= 0x1 << (i << 1);
-            }
-        }
-    }
-    *obj->reg_mode = tmp;
-}
-
-void port_write(port_t *obj, int value) {
-    *obj->reg_out = (*obj->reg_out & ~obj->mask) | (value & obj->mask);
-}
-
-int port_read(port_t *obj) {
-    switch (obj->direction) {
-        case PIN_OUTPUT: return *obj->reg_out & obj->mask;
-        case PIN_INPUT: return *obj->reg_in & obj->mask;
-    }
-    return 0;
-}
-
-#endif
--- a/targets/hal/TARGET_STM/TARGET_STM32F4XX/spi_api.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,235 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "spi_api.h"
-
-#if DEVICE_SPI
-#include <math.h>
-
-#include "cmsis.h"
-#include "pinmap.h"
-#include "error.h"
-
-static const PinMap PinMap_SPI_SCLK[] = {
-    {PA_5,  SPI_1, STM_PIN_DATA(2, 5)},
-    {PB_3,  SPI_1, STM_PIN_DATA(2, 5)},
-    {PB_3,  SPI_3, STM_PIN_DATA(2, 6)},
-    {PB_10, SPI_2, STM_PIN_DATA(2, 5)},
-    {PB_13, SPI_2, STM_PIN_DATA(2, 5)},
-    {PC_10, SPI_3, STM_PIN_DATA(2, 6)},
-    {NC,    NC,    0}
-};
-
-static const PinMap PinMap_SPI_MOSI[] = {
-    {PA_7,  SPI_1, STM_PIN_DATA(2, 5)},
-    {PB_5,  SPI_1, STM_PIN_DATA(2, 5)},
-    {PB_5,  SPI_3, STM_PIN_DATA(2, 6)},
-    {PB_15, SPI_2, STM_PIN_DATA(2, 5)},
-    {PC_3,  SPI_2, STM_PIN_DATA(2, 5)},
-    {PC_12, SPI_3, STM_PIN_DATA(2, 6)},
-    {NC,    NC,    0}
-};
-
-static const PinMap PinMap_SPI_MISO[] = {
-    {PA_6,  SPI_1, STM_PIN_DATA(2, 5)},
-    {PB_4,  SPI_1, STM_PIN_DATA(2, 5)},
-    {PB_4,  SPI_3, STM_PIN_DATA(2, 6)},
-    {PB_14, SPI_2, STM_PIN_DATA(2, 5)},
-    {PC_2,  SPI_2, STM_PIN_DATA(2, 5)},
-    {PC_11, SPI_3, STM_PIN_DATA(2, 6)},
-    {NC,    NC,    0}
-};
-
-static const PinMap PinMap_SPI_SSEL[] = {
-    {PA_4,  SPI_1, STM_PIN_DATA(2, 5)},
-    {PA_4,  SPI_3, STM_PIN_DATA(2, 6)},
-    {PA_15, SPI_1, STM_PIN_DATA(2, 5)},
-    {PA_15, SPI_3, STM_PIN_DATA(2, 6)},
-    {PB_9,  SPI_2, STM_PIN_DATA(2, 5)}, 
-    {PB_12, SPI_2, STM_PIN_DATA(2, 5)},
-    {NC,    NC,    0}
-};
-
-
-static inline int ssp_disable(spi_t *obj);
-static inline int ssp_enable(spi_t *obj);
-
-void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel) {
-    // determine the SPI to use
-    SPIName spi_mosi = (SPIName)pinmap_peripheral(mosi, PinMap_SPI_MOSI);
-    SPIName spi_miso = (SPIName)pinmap_peripheral(miso, PinMap_SPI_MISO);
-    SPIName spi_sclk = (SPIName)pinmap_peripheral(sclk, PinMap_SPI_SCLK);
-    SPIName spi_ssel = (SPIName)pinmap_peripheral(ssel, PinMap_SPI_SSEL);
-    SPIName spi_data = (SPIName)pinmap_merge(spi_mosi, spi_miso);
-    SPIName spi_cntl = (SPIName)pinmap_merge(spi_sclk, spi_ssel);
-    obj->spi = (SPI_TypeDef*)pinmap_merge(spi_data, spi_cntl);
-    if ((int)obj->spi == NC) {
-        error("SPI pinout mapping failed");
-    }
-
-    // enable power and clocking
-    switch ((int)obj->spi) {
-        case SPI_1:
-            RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN | RCC_AHB1ENR_GPIOBEN;
-            RCC->APB2ENR |= RCC_APB2ENR_SPI1EN;
-            break;
-        case SPI_2:
-            RCC->AHB1ENR |= RCC_AHB1ENR_GPIOBEN | RCC_AHB1ENR_GPIOCEN;
-            RCC->APB1ENR |= RCC_APB1ENR_SPI2EN;
-            break;
-        case SPI_3:
-            RCC->AHB1ENR |= RCC_AHB1ENR_GPIOBEN | RCC_AHB1ENR_GPIOCEN;
-            RCC->APB1ENR |= RCC_APB1ENR_SPI3EN;
-            break;
-    }
-    
-
-    // set default format and frequency
-    if (ssel == NC) {
-        spi_format(obj, 8, 0, 0);  // 8 bits, mode 0, master
-    } else {
-        spi_format(obj, 8, 0, 1);  // 8 bits, mode 0, slave
-    }
-    spi_frequency(obj, 1000000);
-    
-    // enable the ssp channel
-    ssp_enable(obj);
-
-    // pin out the spi pins
-    pinmap_pinout(mosi, PinMap_SPI_MOSI);
-    pinmap_pinout(miso, PinMap_SPI_MISO);
-    pinmap_pinout(sclk, PinMap_SPI_SCLK);
-    if (ssel != NC) {
-        pinmap_pinout(ssel, PinMap_SPI_SSEL);
-    }
-    else {
-        // Use software slave management
-        obj->spi->CR1 |= SPI_CR1_SSM | SPI_CR1_SSI;
-    }
-}
-
-void spi_free(spi_t *obj) {}
-
-void spi_format(spi_t *obj, int bits, int mode, int slave) {
-    ssp_disable(obj);
-    
-    if (!(bits == 8 || bits == 16) || !(mode >= 0 && mode <= 3)) {
-        error("SPI format error");
-    }
-    
-
-    int polarity = (mode & 0x2) ? 1 : 0;
-    int phase = (mode & 0x1) ? 1 : 0;
-
-    obj->spi->CR1 &= ~0x807;
-    obj->spi->CR1 |= ((phase) ? 1 : 0) << 0 |
-                     ((polarity) ? 1 : 0) << 1 |
-                     ((slave) ? 0: 1) << 2 |
-                     ((bits == 16) ? 1 : 0) << 11;
-
-    if (obj->spi->SR & SPI_SR_MODF) {
-        obj->spi->CR1 = obj->spi->CR1;
-    }
-
-    ssp_enable(obj);
-}
-
-void spi_frequency(spi_t *obj, int hz) {
-    ssp_disable(obj);
-
-    // SPI1 runs from PCLK2, which runs at SystemCoreClock / 2.  SPI2 and SPI3
-    // run from PCLK1, which runs at SystemCoreClock / 4.
-    uint32_t PCLK = SystemCoreClock;
-    switch ((int)obj->spi) {
-        case SPI_1: PCLK = PCLK >> 1; break;
-        case SPI_2: PCLK = PCLK >> 2; break;
-        case SPI_3: PCLK = PCLK >> 2; break;
-    }
-
-    // Choose the baud rate divisor (between 2 and 256)
-    uint32_t divisor = PCLK / hz;
-
-    // Find the nearest power-of-2
-    divisor = divisor > 0 ? divisor-1 : 0;
-    divisor |= divisor >> 1;
-    divisor |= divisor >> 2;
-    divisor |= divisor >> 4;
-    divisor |= divisor >> 8;
-    divisor |= divisor >> 16;
-    divisor++;
-
-    uint32_t baud_rate = __builtin_ffs(divisor) - 1;
-    baud_rate = baud_rate > 0x7 ? 0x7 : baud_rate;
-
-    obj->spi->CR1 &= ~(0x7 << 3);
-    obj->spi->CR1 |= baud_rate << 3;
-
-    ssp_enable(obj);
-}
-
-static inline int ssp_disable(spi_t *obj) {
-    // TODO: Follow the instructions in 25.3.8 for safely disabling the SPI
-    return obj->spi->CR1 &= ~SPI_CR1_SPE;
-}
-
-static inline int ssp_enable(spi_t *obj) {
-    return obj->spi->CR1 |= SPI_CR1_SPE;
-}
-
-static inline int ssp_readable(spi_t *obj) {
-    return obj->spi->SR & SPI_SR_RXNE;
-}
-
-static inline int ssp_writeable(spi_t *obj) {
-    return obj->spi->SR & SPI_SR_TXE;
-}
-
-static inline void ssp_write(spi_t *obj, int value) {
-    while (!ssp_writeable(obj));
-    obj->spi->DR = value;
-}
-
-static inline int ssp_read(spi_t *obj) {
-    while (!ssp_readable(obj));
-    return obj->spi->DR;
-}
-
-static inline int ssp_busy(spi_t *obj) {
-    return (obj->spi->SR & SPI_SR_BSY) ? (1) : (0);
-}
-
-int spi_master_write(spi_t *obj, int value) {
-    ssp_write(obj, value);
-    return ssp_read(obj);
-}
-
-int spi_slave_receive(spi_t *obj) {
-    return (ssp_readable(obj) && !ssp_busy(obj)) ? (1) : (0);
-};
-
-int spi_slave_read(spi_t *obj) {
-    return obj->spi->DR;
-}
-
-void spi_slave_write(spi_t *obj, int value) {
-    while (ssp_writeable(obj) == 0) ;
-    obj->spi->DR = value;
-}
-
-int spi_busy(spi_t *obj) {
-    return ssp_busy(obj);
-}
-
-#endif
--- a/targets/hal/TARGET_STM/TARGET_STM32F4XX/us_ticker.c	Sun Oct 27 16:30:04 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stddef.h>
-#include "us_ticker_api.h"
-#include "PeripheralNames.h"
-
-#define US_TICKER_TIMER TIM2
-#define US_TICKER_TIMER_IRQn TIM2_IRQn
-
-int us_ticker_inited = 0;
-
-void us_ticker_init(void) {
-    if (us_ticker_inited) return;
-    us_ticker_inited = 1;
-    
-    RCC->APB1ENR |= RCC_APB1ENR_TIM2EN;
-    
-    uint32_t PCLK = SystemCoreClock / 4;
-    
-    uint32_t prescale = PCLK / 1000000; // default to 1MHz (1 us ticks)
-    US_TICKER_TIMER->PSC = prescale - 1;
-    US_TICKER_TIMER->CR1 |= TIM_CR1_CEN;
-    // Trigger an update - this needs to happen after the counter is enabled.
-    US_TICKER_TIMER->EGR |= TIM_EGR_UG;
-
-    NVIC_SetVector(US_TICKER_TIMER_IRQn, (uint32_t)us_ticker_irq_handler);
-    NVIC_EnableIRQ(US_TICKER_TIMER_IRQn);
-}
-
-uint32_t us_ticker_read() {
-    if (!us_ticker_inited)
-        us_ticker_init();
-    
-    return US_TICKER_TIMER->CNT;
-}
-
-void us_ticker_set_interrupt(unsigned int timestamp) {
-    // set match value
-    US_TICKER_TIMER->CCR1 = timestamp;
-    // enable compare interrupt
-    US_TICKER_TIMER->DIER |= TIM_DIER_CC1IE;
-}
-
-void us_ticker_disable_interrupt(void) {
-    US_TICKER_TIMER->DIER &= ~TIM_DIER_CC1IE;
-}
-
-void us_ticker_clear_interrupt(void) {
-    US_TICKER_TIMER->SR &= ~TIM_SR_CC1IF;
-}